Package Exports
- @agenttech/tpay-cli
- @agenttech/tpay-cli/dist/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@agenttech/tpay-cli) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
@agenttech/tpay-cli
Send USDT payments on Solana via the T402 x402 v2 protocol. Designed for AI agents — all output is structured JSON on stdout, logs go to stderr.
Install
npm install -g @agenttech/tpay-cliVerify:
tpay versionSetup
The CLI needs a BIP-39 seed phrase to sign transactions. Two setup paths:
Non-interactive (recommended for agents)
WALLET_SEED_PHRASE="your twelve or twenty four word seed phrase here" \
TPAY_PASSPHRASE="encryption-password" \
tpay setupThis encrypts and saves the seed phrase to ~/.config/tpay/.env.
From env file
tpay setup --from-env /path/to/.envThe file must contain WALLET_SEED_PHRASE=....
Skip setup (inline seed phrase)
You can skip tpay setup entirely by passing the seed phrase as an environment variable on every call:
WALLET_SEED_PHRASE="your seed phrase" tpay send --to <address> --amount 10Setup output
{"status":"success","saved":true}Commands
tpay send
Send a USDT payment.
tpay send --to <solana-address> --amount <number>Or pipe JSON via stdin:
echo '{"to":"<solana-address>","amount":"10"}' | tpay sendSuccess output:
{"status":"success","intent_id":"intent_abc123","tx_hash":"5xY...","explorer_url":"https://..."}Error output:
{"status":"error","error_type":"payment_error","message":"Payment failed","intent_id":"intent_abc123"}tpay balance
Check SOL and USDT balances for any address. No wallet keys required.
tpay balance --address <solana-address>Output:
{"status":"ok","address":"<solana-address>","sol":"1.5","usdt":"100.0"}tpay intent status
Check the status of a payment intent.
tpay intent status <intent_id>Or via stdin:
echo '{"intent_id":"intent_abc123"}' | tpay intent statusOutput:
{"status":"ok","intent_id":"intent_abc123","payment_status":"BASE_SETTLED","sending_amount":"10","receiving_amount":"10","payer_chain":"solana","created_at":"...","expires_at":"...","tx_hash":"5xY...","explorer_url":"https://..."}tpay version
tpay versiontpay help
tpay helpGlobal Flags
| Flag | Description |
|---|---|
--verbose |
Debug logs to stderr |
--format json|text |
Output format (default: json) |
Environment Variables
| Variable | Required | Description |
|---|---|---|
WALLET_SEED_PHRASE |
Yes (if no config file) | BIP-39 mnemonic (12–24 words) |
TPAY_PASSPHRASE |
No | Decrypts saved config at ~/.config/tpay/.env |
SOLANA_FEE_PAYER |
No | Override fee payer address |
If both WALLET_SEED_PHRASE env var and an encrypted config file exist, the env var takes precedence.
Exit Codes
| Code | Type | Meaning |
|---|---|---|
| 0 | — | Success |
| 1 | validation_error |
Invalid arguments or input |
| 2 | runtime_error |
Unexpected runtime failure |
| 3 | configuration_error |
Missing or invalid config |
| 4 | network_error |
API or RPC failure |
| 5 | payment_error |
Payment-specific failure |
All errors output JSON to stdout:
{"status":"error","error_type":"<type>","message":"<description>"}Supported Chains
| Chain | Network ID |
|---|---|
| Solana Mainnet | solana |
| Solana Devnet | solana-devnet |
Third-party Dependencies
- @tetherto/wdk-wallet-solana — WDK by Tether, Solana wallet module
- @solana/web3.js — Solana RPC and transaction construction
- @solana/keys — Cryptographic signing
- Commander.js — CLI framework
- AgentPay T402 API — Payment intent and settlement service
License
Apache-2.0