adrianhajdin / project_crowdfunding

With a stunning design, connected to the blockchain, metamask pairing, interaction with smart contracts, sending Ethereum through the blockchain network, and writing solidity code.
https://jsmastery.pro
680 stars 372 forks source link

[Resolved issue #31] #50

Closed krishnaacharyaa closed 1 year ago

krishnaacharyaa commented 1 year ago

In the latest release contract.call() has changed the parameters to accept array instead of single param.

The 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:

const owner = "0x...";
const operator = "0x...";
const overrides = { gasPrice: 800000 };
const res = await contract.call("approve", [owner, operator], overrides);

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.

Also refer official docs

const data = await contract.call(
"myFunctionName", // Name of your function as it is on the smart contract
// Arguments to your function, in the same order they are on your smart contract
[
"arg1", // e.g. Argument 1
"arg2", // e.g. Argument 2
],
);