Call Contract Endpoint
Interact easily with Smart Contracts with this endpoint
contractAddress
-string
Contract address to interact withfunctionName
-string
Smart contract function to interact withabi
-Array<AbiItem>
(Optional) ABI of the contract to callparams
-Array<string>
(Optional) Params to call the smart contract function withvalueInWei
-string
(Optional) Amount of wei to sendgasLimit
-string
(Optional) Gas limit for the function callchainMetadata
(Optional) -Object
used to add the chain if the user does not have the chain added to their walletchainName
-string
nativeCurrency
-Object
name
-string
is the currency's namesymbol
-string
2-6 characters long symbol for the chaindecimals
-18
rpcUrls
-Array<string>
is an array of rpc node urls that can be used to make requests. We recommend selecting a few from the listing on ChainlistblockExplorerUrls
(Optional) -Array<string>
is an array of block explorers that can be used with the chainiconUrls
(Optional) -Array<string>
is currently unused by MetaMask
Mixed
- the return value(s) of the smart contract method. If it returns a single value, it’s returned as is. If it has multiple return values they are returned as an object with properties and indices: // MULTI-ARGUMENT RETURN:
// Solidity
contract MyContract {
function myFunction() returns(uint256 myNumber, string myString) {
return (23456, "Hello!%");
}
}
// /callContract Result:
> Result {
myNumber: '23456',
myString: 'Hello!%',
0: '23456', // these are here as fallbacks if the name is not know or given
1: 'Hello!%'
}
// SINGLE-ARGUMENT RETURN:
// Solidity
contract MyContract {
function myFunction() returns(string myString) {
return "Hello!%";
}
}
// /callContract Result:
> "Hello!%"
Last modified 3mo ago