This function is used to make a state changing call to a smart contract.
import { L1XProvider, EVMStateChangeCallArg } from "@l1x/l1x-wallet-sdk";
import DIDAbi from "./evm_abi";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
const didDocument = {
context: ['https://www.w3.org/ns/did/v1'],
id: 'did:ethr:0x123297897894634756546546',
controller: '0x12345654345453453435435cdefghi',
};
let params: EVMStateChangeCallArg = {
attrib: {
arguments: {
did: didDocument.id,
didDocument: didDocument,
},
contract_address: "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
function: "createDID",
abi: DIDAbi,
},
private_key: "6668446bbea04c0b5a6cf6d96667fbfd88a91c960c7218f2e27d11ce07bcee8f",
fee_limit: 1,
};
The smart contract parameters for state changing object.
{
attrib: {
arguments: {
did: "DID_URL",
didDocument: "DID_DOCUMENT_URL",
},
contract_address: "cf0289e86714d97979d726eeb2fa3a23b9c007c1",
function: "createDID",
abi: ["ABI"],
},
private_key: "YOUR_PRIVATE_KEY",
fee_limit: 1,
}
A promise that resolves when the transaction is submitted.
{
"hash": "dc224ba854d5fbd3371f6d509b9a0b5451fff78a70ad3a209b5c273f8da0abfb"
}