WAX Smart Contract icon

WAX Smart Contract

Execute actions on WAX smart contracts

Overview

This node enables interaction with WAX blockchain smart contracts by either executing actions on a contract or querying data from a contract's table. It is useful for automating blockchain operations such as token transfers, minting NFTs, or reading contract state data within an n8n workflow.

Common scenarios:

  • Executing a transfer action on a token contract.
  • Minting or updating assets on NFT contracts.
  • Querying user balances or asset ownership from contract tables.
  • Reading configuration or state data stored in smart contract tables.

Practical example:

  • Automatically trigger a token transfer action when a certain event occurs in your system.
  • Periodically fetch and process the latest entries from a contract’s table to sync blockchain data with an external database.

Properties

Name Meaning
Contract Name The name of the smart contract to interact with (e.g., eosio.token, atomicassets).
API Endpoint The URL of the WAX blockchain API endpoint to send requests to (default: https://wax.greymass.com).

Note: The node supports two operations with additional properties shown conditionally:

For "Execute Action" operation:

Name Meaning
Action Name The name of the action to execute on the smart contract.
Action Data JSON object containing the data payload to send with the action.
Authorization One or more authorization entries specifying the actor account and permission level (active, owner, or custom) required to authorize the action.
Memo (Optional) An optional memo string to include with the transaction.

For "Get Table Data" operation:

Name Meaning
Table Name The name of the smart contract table to query.
Scope The scope of the table, usually an account or contract name that owns the table.
Lower Bound Optional lower bound for the query; can be an account name or number depending on key type.
Upper Bound Optional upper bound for the query; can be an account name or number depending on key type.
Limit Maximum number of rows to return (minimum 1).
Key Type The type of the primary key used for indexing the table. Options: float128, float64, i128, i256, i64, name, ripemd160, sha256.
Auto Convert Account Names When enabled and key type is i64, automatically converts account names in bounds to their numeric representation.
Index Position The index position to use for the query (1 for primary index, 2+ for secondary indexes).

Output

The node outputs an array of items, each containing a json field with the following structure depending on the operation:

Execute Action

  • success: true if the action was executed successfully.
  • operation: "executeAction".
  • contract: The contract name.
  • action: The action name executed.
  • actionData: The JSON data sent with the action.
  • authorization: Array of authorization objects used.
  • memo: Optional memo string.
  • transaction: Object containing transaction details including transaction_id and processed block info if available; otherwise includes raw result and a note.

Get Table Data

  • success: true if the table data was fetched successfully.
  • operation: "getTable".
  • contract: The contract name.
  • table: The queried table name.
  • scope: The scope used for the query.
  • queryParams: The parameters sent to the blockchain API for the query.
  • originalBounds: The original lower and upper bounds as input.
  • convertedBounds: The possibly converted bounds after processing (e.g., account names converted to numeric).
  • autoConvert: Boolean indicating if auto conversion was applied.
  • rows: Array of rows returned from the table query.
  • more: Boolean indicating if there are more rows available beyond the limit.
  • next_key: The key to use for fetching the next batch of rows if more is true.

Dependencies

  • Requires an API authentication token in the form of a private key credential to sign transactions.
  • Uses the eosjs library to interact with the WAX blockchain.
  • Requires network access to the specified WAX blockchain API endpoint.
  • No additional environment variables needed beyond the configured credentials.

Troubleshooting

  • Invalid character in name error: Occurs if contract, scope, or account names contain invalid characters. Ensure names only use allowed characters [a-z1-5.] and are up to 12 characters long.
  • Invalid JSON in action data: If the JSON provided for action data is malformed, the node will throw an error. Validate JSON syntax before running.
  • Failed to convert bounds: When using i64 key type with auto-conversion enabled, non-numeric bounds must be valid account names. Invalid names cause conversion errors.
  • Authorization errors: Ensure the private key corresponds to the actor account and has sufficient permissions for the requested action.
  • API endpoint issues: Verify the endpoint URL is correct and reachable. Network or CORS issues may prevent successful calls.
  • Transaction failures: Blockchain transactions may fail due to insufficient CPU/NET resources, incorrect action data, or contract restrictions. Review the error message and blockchain logs.

To resolve errors, check input values carefully, validate JSON, confirm credentials, and verify blockchain resource availability.

Links and References

Discussion