Managed Wallets
Managed wallets let your agent execute swaps without handling private keys. Suwappu generates the keypair, stores the private key securely, and signs transactions on your behalf when you call POST /swap/execute.
How It Works
1. Create a wallet -- POST /wallets generates a new keypair server-side
2. Fund the wallet -- Send tokens to the wallet address using an external wallet or exchange
3. Get a quote -- POST /quote to get swap pricing
4. Execute -- POST /swap/execute signs and submits the transaction using your managed wallet's private key
You never see or handle the private key. The server does all signing.
Wallet Types
| Type | Chains Supported | Address Format |
|---|---|---|
| EVM | All 12 EVM chains (Ethereum, Base, Arbitrum, etc.) | 0x... (42 characters) |
| Solana | Solana | Base58 (32-44 characters) |
A single EVM wallet works across all EVM chains. Solana requires a separate wallet.
Step-by-Step Workflow
Step 1: Create a Wallet
-kw">curl -X POST https://api.suwappu.bot/v1/agent/wallets \
-H -str">"Authorization: Bearer suwappu_sk_your_api_key"
#### Response
{
"hl-key">"success": true,
"hl-key">"wallet": {
"hl-key">"address": "0x9f8E163C2b4a1FA28cE3851F2B3D5C53bE6a4E71",
"hl-key">"chain_type": "evm",
"hl-key">"supported_chains": ["ethereum", "base", "arbitrum", "optimism"]
}
}
Step 2: List Your Wallets
-kw">curl https://api.suwappu.bot/v1/agent/wallets \
-H -str">"Authorization: Bearer suwappu_sk_your_api_key"
#### Response
{
"hl-key">"success": true,
"hl-key">"wallets": [
{
"hl-key">"address": "0x9f8E163C2b4a1FA28cE3851F2B3D5C53bE6a4E71",
"hl-key">"chain_type": "evm",
"hl-key">"supported_chains": ["ethereum", "base", "arbitrum", "optimism"]
}
]
}
Step 3: Fund the Wallet
Send tokens to the wallet address from any external source (exchange, another wallet, faucet for testnets). The wallet address works like any standard address on its supported chains.
For EVM wallets, send tokens on any supported EVM chain to the same 0x address. For Solana, send SPL tokens or SOL to the Base58 address.
Step 4: Get a Quote
-kw">curl -X POST https://api.suwappu.bot/v1/agent/quote \
-H -str">"Authorization: Bearer suwappu_sk_your_api_key" \
-H -str">"Content-Type: application/json" \
-d -str">'{
-str">"from_token": -str">"ETH",
-str">"to_token": -str">"USDC",
-str">"amount": -str">"0.5",
-str">"chain": -str">"base"
}'
#### Response
{
"hl-key">"success": true,
"hl-key">"quote_id": "qt_a1b2c3d4e5f6",
"hl-key">"from_token": "ETH",
"hl-key">"to_token": "USDC",
"hl-key">"amount": "0.5",
"hl-key">"expected_output": "985.42",
"hl-key">"chain": "base",
"hl-key">"expires_at": "2026-03-07T12:05:00Z"
}
Step 5: Execute the Swap
-kw">curl -X POST https://api.suwappu.bot/v1/agent/swap/execute \
-H -str">"Authorization: Bearer suwappu_sk_your_api_key" \
-H -str">"Content-Type: application/json" \
-d -str">'{-str">"quote_id": -str">"qt_a1b2c3d4e5f6"}'
#### Response
{
"hl-key">"success": true,
"hl-key">"swap_id": 4821,
"hl-key">"status": "submitted",
"hl-key">"tx_hash": "0x8a3c...f29e"
}
Step 6: Check Status
-kw">curl https://api.suwappu.bot/v1/agent/swap/status/4821 \
-H -str">"Authorization: Bearer suwappu_sk_your_api_key"
Complete Example: curl
API_KEY=-str">"suwappu_sk_your_api_key"
BASE=-str">"https://api.suwappu.bot/v1/agent"
-str">"hl-comment"># Create a wallet
-kw">curl -X POST -str">"$BASE/wallets" \
-H -str">"Authorization: Bearer $API_KEY"
-str">"hl-comment"># List wallets to confirm
-kw">curl -str">"$BASE/wallets" \
-H -str">"Authorization: Bearer $API_KEY"
-str">"hl-comment"># Get a quote (after funding the wallet)
QUOTE_RESPONSE=$(-kw">curl -s -X POST -str">"$BASE/quote" \
-H -str">"Authorization: Bearer $API_KEY" \
-H -str">"Content-Type: application/json" \
-d -str">'{
-str">"from_token": -str">"ETH",
-str">"to_token": -str">"USDC",
-str">"amount": -str">"0.1",
-str">"chain": -str">"base"
}')
QUOTE_ID=$(-kw">echo -str">"$QUOTE_RESPONSE" | jq -r -str">'.quote_id')
-kw">echo -str">"Quote ID: $QUOTE_ID"
-str">"hl-comment"># Execute the swap
SWAP_RESPONSE=$(-kw">curl -s -X POST -str">"$BASE/swap/execute" \
-H -str">"Authorization: Bearer $API_KEY" \
-H -str">"Content-Type: application/json" \
-d -str">"{\"quote_id\-str">": \"$QUOTE_ID\-str">"}")
SWAP_ID=$(-kw">echo -str">"$SWAP_RESPONSE" | jq -r -str">'.swap_id')
-kw">echo -str">"Swap ID: $SWAP_ID"
-str">"hl-comment"># Check status
-kw">curl -str">"$BASE/swap/status/$SWAP_ID" \
-H -str">"Authorization: Bearer $API_KEY"
Complete Example: Python
import requests
import time
API_KEY = class="hl-str">"suwappu_sk_your_api_key"
BASE_URL = class="hl-str">"https:class="hl-commentclass="hl-str">">//api.suwappu.bot/v1/agent"
headers = {class="hl-str">"Authorization": fclass="hl-str">"Bearer {API_KEY}"}
class=class="hl-str">"hl-comment"># Create a managed wallet
wallet = requests.post(fclass="hl-str">"{BASE_URL}/wallets", headers=headers).json()
address = wallet[class="hl-str">"wallet"][class="hl-str">"address"]
print(fclass="hl-str">"Wallet created: {address}")
print(fclass="hl-str">"Fund this address with tokens, then continue.")
class=class="hl-str">"hl-comment"># List wallets
wallets = requests.get(fclass="hl-str">"{BASE_URL}/wallets", headers=headers).json()
for w in wallets[class="hl-str">"wallets"]:
print(fclass="hl-str">" {w[class="hl-str">'chain_type']}: {w[class="hl-str">'address']}")
class=class="hl-str">"hl-comment"># After funding, get a quote
quote = requests.post(
fclass="hl-str">"{BASE_URL}/quote",
headers=headers,
json={
class="hl-str">"from_token": class="hl-str">"ETH",
class="hl-str">"to_token": class="hl-str">"USDC",
class="hl-str">"amount": class="hl-str">"0.1",
class="hl-str">"chain": class="hl-str">"base",
},
).json()
print(fclass="hl-str">"Quote: {quote[class="hl-str">'expected_output']} USDC for 0.1 ETH")
class=class="hl-str">"hl-comment"># Execute
swap = requests.post(
fclass="hl-str">"{BASE_URL}/swap/execute",
headers=headers,
json={class="hl-str">"quote_id": quote[class="hl-str">"quote_id"]},
).json()
print(fclass="hl-str">"Swap {swap[class="hl-str">'swap_id']}: {swap[class="hl-str">'status']}")
class=class="hl-str">"hl-comment"># Poll for completion
while True:
status = requests.get(
fclass="hl-str">"{BASE_URL}/swap/status/{swap[class="hl-str">'swap_id']}",
headers=headers,
).json()
if status[class="hl-str">"status"] in (class="hl-str">"completed", class="hl-str">"failed"):
print(fclass="hl-str">"Final: {status[class="hl-str">'status']}, tx: {status[class="hl-str">'tx_hash']}")
break
time.sleep(5)
Complete Example: TypeScript
const API_KEY = class="hl-str">"suwappu_sk_your_api_key";
const BASE_URL = class="hl-str">"https:class="hl-commentclass="hl-str">">//api.suwappu.bot/v1/agent";
const headers = {
Authorization: Bearer ${API_KEY},
class="hl-str">"Content-Type": class="hl-str">"application/json",
};
class=class="hl-str">"hl-comment">// Create a managed wallet
const walletRes = await fetch(${BASE_URL}/wallets, {
method: class="hl-str">"POST",
headers,
});
const wallet = await walletRes.json();
console.log(Wallet created: ${wallet.wallet.address});
class=class="hl-str">"hl-comment">// List wallets
const listRes = await fetch(${BASE_URL}/wallets, { headers });
const list = await listRes.json();
for (const w of list.wallets) {
console.log( ${w.chain_type}: ${w.address});
}
class=class="hl-str">"hl-comment">// After funding, get a quote
const quoteRes = await fetch(${BASE_URL}/quote, {
method: class="hl-str">"POST",
headers,
body: JSON.stringify({
from_token: class="hl-str">"ETH",
to_token: class="hl-str">"USDC",
amount: class="hl-str">"0.1",
chain: class="hl-str">"base",
}),
});
const quote = await quoteRes.json();
console.log(Quote: ${quote.expected_output} USDC for 0.1 ETH);
class=class="hl-str">"hl-comment">// Execute
const swapRes = await fetch(${BASE_URL}/swap/execute, {
method: class="hl-str">"POST",
headers,
body: JSON.stringify({ quote_id: quote.quote_id }),
});
const swap = await swapRes.json();
console.log(Swap ${swap.swap_id}: ${swap.status});
class=class="hl-str">"hl-comment">// Poll for completion
const sleep = (ms: number) => new Promise((r) => setTimeout(r, ms));
while (true) {
const statusRes = await fetch(${BASE_URL}/swap/status/${swap.swap_id}, {
headers: { Authorization: Bearer ${API_KEY} },
});
const status = await statusRes.json();
if (status.status === class="hl-str">"completed" || status.status === class="hl-str">"failed") {
console.log(Final: ${status.status}, tx: ${status.tx_hash});
break;
}
await sleep(5000);
}