The twak CLI provides full access to the Trust Wallet Agent SDK from the command line.
Run: npx @trustwallet/cli <command> or install globally with npm install -g @trustwallet/cli
Initialize configuration and save credentials.
twak init --api-key <key> --api-secret <secret>| Flag | Required | Description |
|---|---|---|
--api-key |
Yes | TWAK API access ID |
--api-secret |
Yes | HMAC secret |
Credentials are saved to ~/.twak/credentials.json.
twak auth setup --api-key <key> --api-secret <secret>twak auth status [--json]twak wallet create --password <pw> [--no-keychain] [--json]twak wallet address --chain <chain> [--password <pw>] [--json]Password falls back to the OS keychain or TWAK_WALLET_PASSWORD environment variable.
twak wallet addresses [--password <pw>] [--json]twak wallet balance [--chain <chain>] [--all] [--no-tokens] [--password <pw>] [--json]Use --all to show balances across all chains with funds. Use --no-tokens to skip token balance lookup.
Full portfolio across all chains — native balances, token holdings, and USD values.
twak wallet portfolio [--chains <list>] [--password <pw>] [--json]Default chains include all major EVM chains plus Solana and TRON.
Sign an arbitrary message with the agent wallet key.
twak wallet sign-message --chain <chain> --message <text> [--password <pw>] [--json]Save the wallet password to the OS keychain for passwordless usage.
twak wallet keychain save --password <pw>twak wallet keychain deletetwak wallet keychain checktwak wallet status [--json]twak transfer --to <address> --amount <amount> --token <token> \
[--confirm-to <address>] [--max-usd <n>] [--skip-safety-check] \
[--password <pw>] [--json]| Flag | Description |
|---|---|
--to |
Destination address or ENS name (e.g., vitalik.eth) |
--amount |
Amount in human-readable format |
--token |
Asset ID (e.g., c60 for ETH, c60_t0xA0b8... for ERC-20) |
--max-usd |
Maximum allowed transfer value in USD (default: 10000) |
--skip-safety-check |
Skip the USD-value safety check |
--confirm-to |
Pin expected resolved address — rejects if ENS resolves differently |
twak swap <amount> <from> <to> [--chain <chain>] [--to-chain <chain>] \
[--slippage <pct>] [--quote-only] [--password <pw>] [--json]| Flag | Description |
|---|---|
--chain |
Source chain (default: ethereum) |
--to-chain |
Destination chain for cross-chain swaps |
--slippage |
Slippage tolerance % (default: 1, max: 50) |
--quote-only |
Preview quote without executing |
Use --quote-only to preview without executing.
twak price <token> [--chain <chain>] [--json]Chain is auto-detected from native token symbols (ETH, BNB, SOL, etc.).
Get the native balance for any address using a SLIP44 coin ID.
twak balance --address <address> --coin <coinId> [--json]Common coin IDs: 60 (Ethereum), 0 (Bitcoin), 501 (Solana).
twak search <query> [--networks <ids>] [--limit <n>] [--json]twak trending [--category <cat>] [--sort <field>] [--limit <n>] [--json]Categories: ai, rwa, memes, defi, dex, bnb, eth, sol, pumpfun, bonk, launchpad, launchpool, layer1.
Sort fields: price_change (default), market_cap, volume.
Browse featured DApps and protocols.
twak dapps [--category <cat>] [--search <query>] [--categories] [--limit <n>] [--json]Categories: defi, dex, lending, nft, gaming, social. Use --categories to list all available.
twak history --address <address> [--chain <chain>] [--from <date>] \
[--to <date>] [--limit <n>] [--json]twak tx <hash> --chain <chain> [--json]twak chains [--json]twak asset <assetId> [--json]twak validate --address <address> [--asset-id <id>] [--json]Check token security and rug-risk info.
twak risk <assetId> [--json]twak erc20 approve --token <assetId> --spender <address> --amount <amount> \
[--confirm-unlimited] --password <pw> [--json]Token uses the Trust Wallet asset ID format (e.g., c60_t0xA0b8...).
twak erc20 revoke --token <assetId> --spender <address> --password <pw> [--json]twak erc20 allowance --token <assetId> --owner <address> --spender <address> [--json]twak alert create --token <token> --chain <chain> (--above <price> | --below <price>) [--json]twak alert list [--active] [--json]twak alert check [--json]twak alert delete <id> [--json]Start an MCP server (stdio) or REST API server for AI agent integrations.
twak serve [--rest] [--port <port>] [--host <host>] \
[--auto-lock <minutes>] [--password <pw>] \
[--x402] [--payment-amount <amount>] [--payment-asset <asset>] \
[--payment-chain <chain>] [--payment-recipient <address>]| Flag | Description |
|---|---|
--rest |
Start REST HTTP server instead of MCP stdio |
--port |
Port for REST server (default: 3000) |
--auto-lock |
Auto-lock wallet after N minutes of inactivity |
--x402 |
Require x402 micropayment for REST endpoints |
The REST server authenticates requests via Authorization: Bearer <HMAC_SECRET>. This is separate from the HMAC signing used by tws.trustwallet.com — the REST server runs locally and uses the raw secret as a shared token for simplicity.