diff --git a/agents/overview.mdx b/agents/overview.mdx new file mode 100644 index 0000000..acef450 --- /dev/null +++ b/agents/overview.mdx @@ -0,0 +1,333 @@ +--- +title: "WalletConnect Agents SDK" +sidebarTitle: "Overview" + +metatags: + description: "WalletConnect Agent SDK — CLI tools and libraries for wallet connection, signing, cross-chain bridging, and WCT staking from the terminal or any AI agent environment." +--- + +The **WalletConnect Agents SDK** is a monorepo of CLI tools and libraries that bring WalletConnect capabilities to the terminal and AI agent environments. It enables wallet connection, message signing, cross-chain bridging, and WCT staking without a browser UI. + + + **Beta (v0.1.x)** — This project is under active development. APIs and CLI interfaces may change between releases. Not yet recommended for production use. + + +## Packages + + + + + + + + + + + + + + + + + + + + + + +
PackageDescription
+ @walletconnect/pay-cli + Create and complete WalletConnect Pay payments from the terminal
+ @walletconnect/cli-sdk + Wallet connection, signing, and cross-chain swidge for terminal apps
+ @walletconnect/staking-cli + WCT staking on Optimism — stake, unstake, claim rewards
+ +## Install + +```bash +npm install -g @walletconnect/cli-sdk @walletconnect/staking-cli +``` + +Get a Project ID from [WalletConnect Cloud](https://cloud.walletconnect.com), then configure it: + +```bash +walletconnect config set project-id +# or +export WALLETCONNECT_PROJECT_ID= +``` + +--- + +## WalletConnect Pay CLI + + + **Experimental** — This package is under active development. APIs, commands, and behavior may change significantly between releases. + + +Create and complete WalletConnect Pay payments from the terminal. Supports proxy mode (no API keys needed) and direct API mode. + +### Commands + +``` +Usage: walletconnect-pay [options] + +Commands: + status Check the status of a payment + create Create a new payment (merchant credentials required) + checkout Complete a payment using a connected wallet + +Options: + --staging Use the staging API + --proxy Proxy through frontend (no API keys needed) + --help Show this help message +``` + +### Authentication + +By default, the CLI proxies through the WalletConnect Pay frontend — no API keys needed. For direct API access: + +```bash +export WC_PAY_WALLET_API_KEY= + +# Required for merchant operations +export WC_PAY_PARTNER_API_KEY= +export WC_PAY_MERCHANT_ID= +``` + +### Travel Rule compliance + +Some payments require Information Capture data. Provide via CLI flags or environment variables: + +```bash +walletconnect-pay checkout \ + --name "John Doe" \ + --dob "1990-01-15" \ + --pob-country "US" \ + --pob-address "New York, NY" +``` + +Or via environment variables: + +```bash +export WC_PAY_NAME="John Doe" +export WC_PAY_DOB="1990-01-15" +export WC_PAY_POB_COUNTRY="US" +export WC_PAY_POB_ADDRESS="New York, NY" +``` + +### Examples + +```bash +# Check a payment's status +walletconnect-pay status pay_abc123 --staging + +# Create a $10 payment (1000 = minor units / cents) +walletconnect-pay create 1000 --staging + +# Complete a payment with a connected wallet +walletconnect-pay checkout pay_abc123 --staging +``` + +### Programmatic usage + +```typescript +import { createPayClient, createFrontendPayClient } from "@walletconnect/pay-cli"; + +// Direct API client +const client = createPayClient({ + walletApiKey: "your-wallet-api-key", + sdkVersion: "0.5.0", + staging: true, +}); + +// Proxy through the frontend (no API keys needed) +const proxyClient = createFrontendPayClient({ + frontendUrl: "https://staging.pay.walletconnect.com", +}); + +const payment = await client.getPayment("pay_abc123"); +``` + +--- + +## WalletConnect CLI + +Connect a wallet, sign messages, send transactions, and bridge tokens across chains from the terminal. + +### Commands + +``` +Usage: walletconnect [options] + +Commands: + connect Connect to a wallet via QR code + whoami Show current session info + sign Sign a message with the connected wallet + sign-typed-data Sign EIP-712 typed data (JSON string) + send-transaction Send a transaction (EVM or Solana) + swidge Bridge/swap tokens across chains via LI.FI + disconnect Disconnect the current session + config set Set a config value (e.g. project-id) + config get Get a config value + +Options: + --browser Use browser UI instead of terminal QR code + --json Output as JSON (for whoami) + --chain Specify chain (e.g. evm, solana, eip155:10) for connect + --version Show version number + --help Show this help message +``` + +### Examples + +```bash +# Connect a wallet (shows QR code in terminal) +walletconnect connect + +# Connect using a browser-based QR code +walletconnect connect --browser + +# Sign a message +walletconnect sign "Hello from the terminal" + +# Check connected wallet +walletconnect whoami + +# Send a transaction on Optimism +walletconnect send-transaction '{"to":"0x...","value":"0x0","chainId":"eip155:10"}' + +# Disconnect +walletconnect disconnect +``` + +### Swidge (Cross-Chain Bridge/Swap) + +Bridge or swap tokens across EVM chains, powered by [LI.FI](https://li.fi). The connected wallet approves and executes each transaction. + +```bash +# Bridge 5 WCT from Optimism to Ethereum mainnet +walletconnect swidge --from-chain eip155:10 --to-chain eip155:1 \ + --from-token WCT --to-token WCT --amount 5 + +# Swap USDC on Base to ETH on Optimism +walletconnect swidge --from-chain eip155:8453 --to-chain eip155:10 \ + --from-token USDC --to-token ETH --amount 10 + +# Bridge ETH from Ethereum to Base +walletconnect swidge --from-chain eip155:1 --to-chain eip155:8453 \ + --amount 0.01 +``` + +When sending a transaction, the CLI automatically checks if the connected wallet has sufficient ETH on the target chain. If funds are insufficient: + +- **Interactive (TTY):** Prompts you to bridge from another chain +- **Pipe / agent mode:** Auto-bridges from the chain with the most funds + +### Programmatic usage + +```typescript +import { WalletConnectCLI, withWallet } from "@walletconnect/cli-sdk"; + +// High-level helper — connect → use → cleanup +await withWallet( + { + projectId: "your-project-id", + metadata: { name: "My App", description: "...", url: "...", icons: [] }, + }, + async (wallet, { accounts }) => { + const txHash = await wallet.request({ + chainId: "eip155:1", + request: { + method: "eth_sendTransaction", + params: [{ from: accounts[0].split(":").pop(), to: "0x...", value: "0x0" }], + }, + }); + }, +); + +// Direct client usage +const wallet = new WalletConnectCLI({ + projectId: "your-project-id", + metadata: { name: "My App", description: "...", url: "...", icons: [] }, + chains: ["eip155:1", "eip155:10"], + ui: "browser", // or "terminal" (default) +}); + +const { accounts } = await wallet.connect(); +const signature = await wallet.request({ + chainId: "eip155:1", + request: { method: "personal_sign", params: ["0x48656c6c6f", accounts[0]] }, +}); +await wallet.disconnect(); +await wallet.destroy(); +``` + +--- + +## WalletConnect Staking CLI + +Stake WCT tokens on Optimism, check staking positions, and claim rewards. + +### Commands + +``` +Usage: walletconnect-staking [options] + +Commands: + stake Stake WCT (approve + createLock/updateLock) + unstake Withdraw all staked WCT (after lock expires) + claim Claim staking rewards + status Show staking position, rewards, and APY + balance Show WCT token balance + +Options: + --address=0x... Use address directly (for read-only commands) + --browser Use browser UI for wallet connection + --help Show this help message +``` + +### Examples + +```bash +# Stake 1000 WCT for 52 weeks +walletconnect-staking stake 1000 52 + +# Check staking position and rewards (read-only, no wallet needed) +walletconnect-staking status --address=0x... + +# Check WCT balance +walletconnect-staking balance --address=0x... + +# Claim staking rewards (requires wallet) +walletconnect-staking claim + +# Withdraw all staked WCT (after lock expires) +walletconnect-staking unstake +``` + +### Programmatic usage + +```typescript +import { stake, status, balance, fetchStaking, formatWCT } from "@walletconnect/staking-cli"; +``` + +The staking package exports transaction builders, formatting utilities, and API helpers for building custom staking integrations. + +--- + +## Agent Skills + +Install the accompanying Claude Code / agent skills: + +```bash +npx skills add WalletConnect/agent-sdk +``` + +This adds the `walletconnect-pay`, `walletconnect`, and `walletconnect-staking` skills to your Claude Code environment, enabling AI agents to interact with wallets and payments directly from the terminal. + +## Source + + + View the source, file issues, and contribute on GitHub. + diff --git a/docs.json b/docs.json index eb5b384..bb1cc4a 100644 --- a/docs.json +++ b/docs.json @@ -76,6 +76,12 @@ "pages": [ "payments/ecommerce/overview" ] + }, + { + "group": "WalletConnect AI Agent SDK", + "pages": [ + "agents/overview" + ] } ] }, @@ -193,6 +199,12 @@ "pages": [ "payments/ecommerce/overview" ] + }, + { + "group": "WalletConnect AI Agent SDK", + "pages": [ + "agents/overview" + ] } ] },