CallGenericReadFunction
Description
This allows you to call any read-only smart contract function that does not require the user to sign the transaction. It can be invoked even before the user is logged in.
Signature
async CallGenericReadFunction(args, apiKey)
Arguments
Parameter | Type | Definition |
---|---|---|
| String | Contract address of the smart contract to be called |
| JSON | The JSON object for the smart contract ABI |
| String | Name of the function to be called |
| chain (class) | Which chain the smart contract is deployed on. Pick a chain from the supported chains list |
| array | Array of objects that will be sent as the arguments to the smart contract function. Please ensure that the order of params matches the contract ABI. For large numerical inputs, please refer to the section below. |
| String | The API Key generated from the Developer Portal |
Return Value
Object returned from smart contract.
Handling Large Numerical Values
Applicable to EVM Chains only
While passing in large numerical values (values above 9007199254740991) in args.params
, a conversion to BigNumber format needs to be made. You can use the following methods that convert the number to and from the appropriate format:
ConvertNumberToBigNumber(number, decimal)
- Use this method while passing in numbers as params to a smart function that requires uint256 numbers
ConvertBigNumberToNumber(bigNumber, decimal)
- Use this method while converting response values from a smart contract function call (which are in bigNumber format) to a JS Number
Example
Last updated