This function is used to make a readonly call to a VM contract.
import { L1XProvider, VMReadOnlyCallArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let params: VMReadOnlyCallArg = {
attrib: {
arguments: {
token: "BNB",
value: "10000",
duration: "180",
},
contract_address: "YOUR_CONTRACT_ADDRESS",
function: "YOUR_FUNCTION_NAME",
},
};
l1xProvider.vm
.makeReadOnlyCall(params)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err)); // log error
The VM contract parameters for readonly object.
{
attrib: {
arguments: {
token: "BNB",
value: "10000",
duration: "180",
},
contract_address: "YOUR_CONTRACT_ADDRESS",
function: "YOUR_FUNCTION_NAME",
},
}
A promise that resolves when the transaction is submitted.