WAX Smart Contract icon

WAX Smart Contract

Execute actions on WAX smart contracts

Overview

This node allows you to interact with WAX blockchain smart contracts by executing actions on them. It is useful when you want to programmatically trigger contract functions such as token transfers, asset creation, or other custom contract operations on the WAX blockchain.

Typical use cases include:

  • Sending tokens or assets by calling transfer actions.
  • Executing custom contract actions for games, NFTs, or DeFi protocols on WAX.
  • Automating workflows that require blockchain state changes via smart contract calls.

For example, you could use this node to execute the transfer action on the eosio.token contract to send WAX tokens from one account to another, providing the necessary authorization and action data.

Properties

Name Meaning
Contract Name The name of the smart contract to interact with (e.g., eosio.token, atomicassets).
Action Name The specific action within the contract to execute (e.g., transfer).
Action Data JSON object containing the parameters required by the action (e.g., { "from": "user", "to": "receiver", "quantity": "1.0000 WAX", "memo": "Payment" }).
Authorization One or more authorizations specifying which accounts and permission levels authorize the action. Options for permission are active, owner, or a custom permission name. Each authorization includes:
- Actor: Account name authorizing the action.
- Permission: Permission level (active, owner, or custom).
- Custom Permission: If custom is selected, specify the custom permission name here.
API Endpoint The URL of the WAX blockchain API endpoint to connect to (default: https://wax.greymass.com).
Memo (Optional) An optional memo string to attach to the transaction (usage depends on the contract/action).

Output

The node outputs a JSON object with the following structure upon successful execution:

{
  "success": true,
  "operation": "executeAction",
  "contract": "<contractName>",
  "action": "<actionName>",
  "actionData": { /* The JSON data sent with the action */ },
  "authorization": [ /* Array of authorization objects used */ ],
  "memo": "<memo if provided>",
  "transaction": {
    "transaction_id": "<transaction ID>",
    "processed": { /* Detailed processed transaction info from blockchain */ }
  }
}

If the transaction response format varies or does not contain expected fields, the output will include a result field with the raw response and a note indicating the variation.

No binary data output is produced by this node.

Dependencies

  • Requires an API key credential that provides a private key for signing transactions on the WAX blockchain.
  • Connects to a specified WAX blockchain API endpoint (default is https://wax.greymass.com).
  • Uses the eosjs library for blockchain interaction and transaction signing.
  • Requires network access to the WAX blockchain API endpoint.

Troubleshooting

  • Invalid JSON in Action Data: If the Action Data property contains malformed JSON, the node will throw an error indicating invalid JSON. Ensure the JSON syntax is correct.
  • Invalid Characters in Names: Contract names, actor names, or permissions must only contain valid characters; otherwise, errors about invalid characters may occur.
  • Authorization Errors: If the provided authorization actor or permission is incorrect or lacks sufficient rights, the transaction will fail. Verify the account and permission levels.
  • Transaction Failures: Network issues, incorrect API endpoints, or blockchain rejections can cause failures. Check connectivity and ensure the endpoint is correct.
  • Permission Customization: When using a custom permission, ensure the custom permission name is correctly specified; otherwise, authorization will fail.
  • Continue On Fail: If enabled, the node will continue processing subsequent items even if one fails, returning error details in the output.

Links and References

Discussion