💸Making transactions

Example of a mint transaction using our SDK

  1. Initiating Smart Contract:

    const apiKey = process.env.API_KEY;
    const chainEx = new ChainEx(apiKey);
    const smartAccount = await chainEx.initialize(provider, configParams); 
    const contractAddress = "<contract_address>";
    const abi = ERC721_ABI;
    const erc721Contract = new ethers.Contract(contractAddress, abi);

    Identify the address and ABI of your ERC-721 contract for SDK-enabled interactions.

  2. Constructing a Transaction:

    const transaction = {
        target: contractAddress,
        data: erc721Contract.interface.encodeFunctionData("safeMint", [param1, param2]) `
    };

    Create a transaction blueprint for invoking the safeMint function on your ERC-721 contract via ChainEx.

  3. Transaction Execution:

    const operationHash = await chainEx.executeTransaction(transaction);
    console.log("Operation Hash:", operationHash);

    Execute the transaction with ChainEx and receive the operation hash.

Last updated