This function is used to make a readonly call to a smart contract.
import { L1XProvider, EVMReadOnlyCallArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: EVMReadOnlyCallArg = {
attrib: {
arguments: {
account: "0x78e044394595D4984F66c1B19059Bc14ecc24063",
},
contract_address: "5885b1A8aA82F99Ab90C0fc6C2498fd458a8c348",
function: "balanceOf",
abi: ["StablePool_abi"],
},
private_key: "YOUR_PRIVATE_KEY",
fee_limit: 1,
};
l1xProvider.evm
.makeReadOnlyCall(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
The smart contract parameters for readonly object.
{
attrib: {
arguments: {
account: "0x78e044394595D4984F66c1B19059Bc14ecc24063",
},
contract_address: "5885b1A8aA82F99Ab90C0fc6C2498fd458a8c348",
function: "balanceOf",
abi: ["StablePool_abi"],
},
private_key: "YOUR_PRIVATE_KEY",
fee_limit: 1,
}
A promise that resolves when the transaction is submitted.
[
[
{
"type":"BigNumber",
"hex":"0x25e25e9bcbc31787196efea260"
}
]
]