Send Contract

Parameters

  • contractAddress - string Contract address to interact with

  • functionName - string Smart contract function to interact with

  • abi - Array<AbiItem> (Optional) ABI of the contract to call

  • params - Array<string> (Optional) Params to call the smart contract function with

  • valueInWei - string (Optional) Amount of wei to send

  • gasLimit - string (Optional) Gas limit for the function call

  • chain - Object used to ensure the user is on the correct chain (follows the MetaMask specification)

    • chainId - string Base 10 string matching the chain id on Chainlist

    • chainMetadata (Optional) - Object used to add the chain if the user does not have the chain added to their wallet

      • chainName - string

      • nativeCurrency - Object

        • name - string is the currency's name

        • symbol - string 2-6 characters long symbol for the chain

        • decimals - 18

      • rpcUrls - Array<string> is an array of rpc node urls that can be used to make requests. We recommend selecting a few from the listing on Chainlist

      • blockExplorerUrls (Optional) - Array<string> is an array of block explorers that can be used with the chain

      • iconUrls (Optional) - Array<string> is currently unused by MetaMask

Request

This request sends ERC-20 tokens.

curl --location --request POST "localhost:9680/sendContract" \
--header 'Content-Type: application/json' \
--data-raw '{
    "contractAddress": "0xc657c7ca0f06b9c241a080AC0d6625923Ef9f1aF",
    "functionName": "transfer",
    "params": ["0x638105AA1B69406560f6428aEFACe3DB9da83c64", "1000000000000000000"],
    "abi": [{ "inputs": [ { "internalType": "address", "name": "to", "type": "address" }, { "internalType": "uint256", "name": "amount", "type": "uint256" } ], "name": "transfer", "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], "stateMutability": "nonpayable", "type": "function" }],
    "valueInWei": "0",
    "chain": {
        "chainId": "11155111"
    }
}'

Response

The transaction hash

0x1b8368d5b67a914a49c76984776849ee3c56a4ac28c92d98103ef18e7215ae2b

Last updated