Actions11
Overview
This node enables interaction with the Solana blockchain network, supporting a variety of operations such as sending SOL (native cryptocurrency), sending SPL tokens, retrieving balances, creating wallets, signing/verifying messages, staking SOL, and more. It is particularly useful for automating blockchain-related workflows within n8n, such as managing token transfers, checking account balances, or handling staking operations programmatically.
For the Get Token Balance operation specifically, the node fetches the balance of a specified SPL token for a given address on the Solana network. This is beneficial when you want to monitor token holdings or integrate token balance checks into larger automation processes.
Practical Example
- Automatically check the balance of a specific SPL token in a wallet before initiating a transfer.
- Monitor multiple token balances for an address to trigger alerts or further actions based on thresholds.
Properties
Name | Meaning |
---|---|
Recipient / Address | The Solana address to get the token balance from. |
Token Mint Address | The mint address of the SPL token whose balance you want to retrieve. This is required for this operation. |
Output
The output JSON object for the Get Token Balance operation contains:
success
: A boolean indicating if the operation was successful.balance
: The token balance as a floating-point number representing the amount of tokens held by the specified address.operation
: The name of the operation performed (getTokenBalance
).
Example output:
{
"success": true,
"balance": 123.456,
"operation": "getTokenBalance"
}
No binary data output is produced by this operation.
Dependencies
- Requires connection to a Solana RPC endpoint, configured via credentials that include a private key and RPC URL.
- Uses the
@solana/web3.js
library for blockchain interactions. - Uses the
@solana/spl-token
library to handle SPL token-specific functionality. - Requires an API authentication token or private key credential to sign transactions and query the blockchain.
Troubleshooting
- Missing or invalid credentials: The node requires valid Solana credentials including a private key and RPC URL. Ensure these are correctly set up in n8n.
- Invalid or empty token mint address: The token mint address must be provided and valid; otherwise, the node will fail to retrieve the token balance.
- Invalid recipient address: The address must be a valid Solana public key string.
- Network or RPC errors: If the RPC endpoint is unreachable or returns errors, the node will throw exceptions. Verify network connectivity and RPC URL correctness.
- Token account does not exist: If the associated token account for the given address and token mint does not exist, the balance retrieval may fail or return zero.
Common error message example:
"No credentials returned!"
— Indicates missing or misconfigured credentials."Unsupported operation"
— Occurs if an unsupported operation value is passed."Message is required for signing"
— For other operations, indicates missing required parameters.