Pocket Node Client
AI-generatedOverview
This node automatically handles HTTP 402 Payment Required responses by detecting them and paying with USDC on the Solana blockchain. It can also provide wallet information such as address and balance. It is useful for workflows that interact with services requiring payment via Solana's USDC, automating the payment process to avoid manual intervention. For example, it can auto-pay API usage fees or provide wallet details for funding.
Use Case Examples
- Automatically detect a 402 response from an API call and pay the required USDC amount using an auto-generated or credentialed Solana wallet.
- Retrieve the wallet address and balance to monitor funds or prepare for manual funding.
Properties
| Name | Meaning |
|---|---|
| Mode | Selects the operation mode: either automatically handle 402 payment-required responses or get wallet info. |
| Reset Auto-Generated Wallet | If enabled, regenerates the auto-generated wallet stored in this workflow. Only shown in 'Get Wallet Info' mode. |
| Auto-Fund Wallet (Devnet Only) | Automatically request USDC from Circle faucet when creating a new wallet on devnet. Only shown in 'Get Wallet Info' mode. |
Output
JSON
paymentMade- Indicates a payment was successfully made.signature- Signature of the payment transaction.amount- Amount paid in USDC.recipient- Recipient address of the payment.paymentHeader- Payment header created for the transaction.originalRequestresource- Resource description from the original 402 response.description- Description from the original 402 response.
_pocketNodeaction- Action taken by the node (e.g., payment_completed, wallet_needs_funding, passthrough, error).
walletAddress- Wallet address used for payments or info.network- Blockchain network used (e.g., devnet).solBalance- SOL token balance of the wallet.usdcBalance- USDC token balance of the wallet.paymentRequired- Indicates if payment is required due to insufficient balance.paymentStatus- Status of the payment attempt (e.g., insufficient_balance).message- Informational or error message related to payment or wallet status.fundingInstructions- Instructions on how to fund the wallet if needed.
Dependencies
- x402-client-sdk for Solana wallet and payment handling
- An API key credential for Pocket Node Wallet (optional)
Troubleshooting
- Workflow must be saved and active for auto-generated wallet to persist; otherwise, wallet data will not persist across executions.
- If payment fails due to insufficient USDC or SOL balance, the node throws detailed errors with instructions to fund the wallet.
- Errors related to missing or invalid USDC token accounts are handled with specific messages guiding the user to fund or fix the wallet.
- If the workflow is not active or saved, warnings are logged and wallet persistence is not guaranteed.
Links
- Circle USDC Faucet - Used to fund wallets with USDC on Solana devnet.
- Solana Faucet - Used to fund wallets with SOL on Solana devnet.