Custom transaction is the action to interact with Solidity smart contracts that were not created using the Contracts module.

Please be cautious! This is an advanced route made for Solidity developers.

1

Create a custom contract

To invoke a custom transaction you need to interact with a Solidity smart contract.

For this recipe we developed an “airdrop contract” that will be able to generate a random quantity of tokens and transfer them to a external wallet (wallet not created through our Wallet module)

You can check the contract at the block explorer

2

Invoke a custom transaction

Now, its time to invoke the custom transaction.

Remember to switch <WALLET_ID> and <EXTERNAL_WALLET_ADDRESS>.
This example transaction is for a contract that was deployed on Polygon Amoy testnet.
    curl --request POST \
    --url https://protocol-staging.int.lumx.io/v2/transactions/custom \
    --header 'Authorization: Bearer <API_KEY>' \
    --header 'Content-Type: application/json' \
    --data '{
    "contractAddress": "0xa7Cb3EF2e19bCAA7C765370c39d7a06ea5595D08",
    "walletId": "<WALLET_ID>",
    "operations": [
        {
          "functionSignature": "generateRandomAirdrop(string)",
          "argumentsValues": [
              "randomStringValue"
          ]
        },
        {
          "functionSignature": "transfer(address, uint256)",
          "argumentsValues": [
              "<EXTERNAL_WALLET_ADDRESS>",
              "25644842301077323776"
          ]
        }
    ],
    }'

You will receive a status 202 with an object containing the ID of the transaction.

3

Read a transaction

Every new custom transaction is queued up to mitigate the possibility of a transaction failing.

Now, let’s check the transaction’s status on the blockchain.

Remember to switch <TRANSACTION_ID>.
curl --request GET \
  --url https://protocol-sandbox.lumx.io/v2/transactions/<TRANSACTION_ID> \
  --header 'Authorization: Bearer $API_KEY'

You will receive a status 200 with an object containing the transaction status and transaction hash.

Congratulations! You can check your transaction on the block explorer.

Any problems during this guide? Check some possible troubleshooting.