decodeFunctionResult
decodeFunctionResult(
abi,functionName,data):any
Defined in: utils/abi-encode-decode.ts:78
Decode the result of a contract function call.
Parameters
abi
The full JSON ABI array of the contract
functionName
string
The name of the function whose result to decode
data
string
The hex-encoded return data from the RPC call
Returns
any
The decoded value(s). Returns a single value if only one output, otherwise an array.
Example
import { decodeFunctionResult } from 'essential-eth';
const abi = [ { name: 'balanceOf', type: 'function', inputs: [{ name: 'owner', type: 'address' }], outputs: [{ name: 'balance', type: 'uint256' }], },];
const result = decodeFunctionResult(abi, 'balanceOf', '0x000...0001');// result === 1n