Updated API for calling smart contract functions
Adam MajmudarThe API for interacting with smart contracts via the thirdweb React & TypeScript SDKs has been updated in favor of explicitly defining function arguments and (optionally) call overrides.
Using the contract.call function in the TypeScript SDK now looks like the following:
Note that the arguments to the contract function are now passed in as an array as the second parameter to contract.call, and the overrides are passed optionally as the last parameter.
Similarly, the useContractRead and useContractWrite hooks in the React SDK have an updated API:
These changes make the API more conducive to having static types on contract arguments when contract ABIs are available, allowing for strongly typed contract calls for every function.
Keep an eye out for the thirdweb generate feature coming out soon that takes advantage of this to give static typing for all of your contracts!