💰 Wallet Skill
Multi-chain wallet for EVM (DeBank-supported chains) + Solana. Balances,
transfers, signing, and policy management. Script skill — call the functions
below via bash; no wallet tools are registered.
How to call
All read/transfer/sign operations are Python functions in core.skill_tools.wallet.
Run them from bash and read the JSON result:
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
The one operation that is NOT a script function is proposing a wallet policy
— it needs to render a confirmation card in the UI, so it goes through the native
frontend_action tool (see Policy Management below).
Functions (from core.skill_tools import wallet)
| Function |
Description |
wallet_info() |
Get all AGENT wallet addresses |
get_user_wallets() |
The USER'S OWN wallets (login + secondary) — read-only, from env |
wallet_balance(chain, address="", asset="") |
EVM balance on a chain (DeBank). chain required |
wallet_sol_balance(address="", asset="") |
Solana balance (Birdeye) |
wallet_get_all_balances(evm_address="", sol_address="") |
All chains at once |
wallet_transfer(to, amount, chain_id=1, data="", **kw) |
Broadcast EVM tx (gas sponsored by default) |
wallet_sign_transaction(to, amount, chain_id=1, data="", **kw) |
Sign EVM tx (no broadcast) |
wallet_sign(message) |
EIP-191 message signing |
wallet_sign_typed_data(domain, types, primaryType, message) |
EIP-712 typed data signing |
wallet_transactions(chain="ethereum", asset="", limit=20) |
EVM tx history |
wallet_sol_transfer(transaction, caip2=...) |
Broadcast Solana tx (base64) |
wallet_sol_sign_transaction(transaction) |
Sign Solana tx (no broadcast) |
wallet_sol_sign(message) |
Solana message signing |
wallet_sol_transactions(chain="solana", asset="sol", limit=20) |
Solana tx history |
wallet_get_policy(chain_type="ethereum") |
Check policy status |
validate_and_clean_rules(rules, chain_type) |
Pre-validate policy rules before proposing |
The User's Own Wallets (login / secondary)
The agent wallet is NOT the user's wallet. The platform injects the user's own
wallet identities as env vars (synced from the control plane at container start
and on user wallet actions):
USER_LOGIN_WALLET_ADDRESS / USER_LOGIN_WALLET_TYPE — the wallet the user
logs in with (or bound as primary).
USER_SECONDARY_WALLET_ADDRESS / USER_SECONDARY_WALLET_TYPE — the user's
other linked wallet (e.g. Solana when login is EVM).
When asked "what's my wallet" / "my login wallet" / "check MY balance", read
these — do NOT answer with the agent wallet or say you don't know:
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.get_user_wallets()))"
Empty/missing values mean the user has never bound a wallet in that slot
(e.g. social login) — say so and point them to wallet binding in the web app.
Rules:
- Read-only. The agent holds no keys for these wallets. To check the user's
balances, pass the address into
wallet_balance(chain, address=...) /
wallet_sol_balance(address=...).
- Transactions from the user's wallet never go through script functions —
use the native
frontend_action(action_type="user_wallet_tx", ...) flow,
where the user signs in the UI and expected_from is enforced server-side.
Key Facts
- Amounts are in wei for EVM (
wallet_transfer / wallet_sign_transaction). 0.01 ETH = 10000000000000000. For ERC-20 token sends, amount is 0 (native) and the transfer is encoded in data calldata.
- Gas is sponsored by default on EVM chains — user doesn't need native tokens for gas. Falls back to user-paid if unavailable. Pass
sponsor=False to pay gas from wallet balance.
- Policy default: OFF (allow-all). Only when policy is enabled do transactions need UI confirmation.
- Supported EVM chains: All DeBank-supported chains. Common names auto-mapped (e.g.
avalanche → avax, bsc → bsc, zksync → era). Fallback aliases include ethereum/base/arbitrum/optimism/polygon/linea/bsc/avalanche/fantom/gnosis/zksync/scroll/blast/mantle/celo/aurora plus monad/world/unichain/abstract/sonic/berachain.
- Balance sources: DeBank (EVM), Birdeye (Solana), wallet-service (fallback). DeBank/Birdeye keys are auto-injected by sc-proxy.
Workflows
Check balances
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_get_all_balances()))"
Send a transaction (EVM)
Always verify balance before, and the result/history after.
# 1. check
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
# 2. transfer (amount in wei)
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_transfer(to='0x...', amount='10000000000000000', chain_id=8453)))"
# 3. verify
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_transactions(chain='base')))"
Sign EIP-712 typed data
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_sign_typed_data(domain={...}, types={...}, primaryType='Permit', message={...})))"
Policy Management
Checking policy is a script function; proposing a policy uses the native
frontend_action tool (it renders a signature card in the UI — a script cannot).
- Check current policy:
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_get_policy(chain_type='ethereum')))"
- (Optional) pre-validate rules:
python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.validate_and_clean_rules([...], 'ethereum')))"
- Propose — call the
frontend_action tool (not a script):frontend_action(action_type="update_wallet_policy", chain_type="ethereum", rules=[...])
The user confirms + signs in the UI. Call once per chain (EVM + Solana = two calls).
Standard Wildcard Policy (when needed)
rules = [
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Allow all", "method": "*", "conditions": [], "action": "ALLOW"},
]
Policy Modes — CRITICAL DECISION TABLE
⚠️ DENY > ALLOW in Privy. DENY * overrides ALL ALLOW rules. NEVER mix them.
| Mode |
Rules |
Effect |
| Allow-all (default) |
DENY exportPrivateKey + ALLOW * |
Everything allowed except key export |
| Deny-all (lockdown) |
DENY exportPrivateKey + DENY * |
Nothing works. No ALLOW rules! |
| Whitelist (selective) |
DENY exportPrivateKey + specific ALLOW rules only |
Only whitelisted ops work, rest implicitly denied |
Mode 1: Allow-All (Standard Wildcard)
rules = [
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Allow all", "method": "*", "conditions": [], "action": "ALLOW"},
]
Mode 2: Deny-All (Lockdown)
rules = [
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Deny all actions", "method": "*", "conditions": [], "action": "DENY"},
]
# ⚠️ NO ALLOW rules here — DENY * would override them!
Mode 3: Whitelist (Selective Allow)
rules = [
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Allow transfer to Uniswap", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}
], "action": "ALLOW"},
]
# ⚠️ NO "DENY *" here! enabled=true already denies everything not ALLOWed.
# Adding DENY * would override the ALLOW rules above (DENY > ALLOW).
Privy Policy Rules — Key Constraints
| Rule |
Details |
| Default behavior |
enabled=true → deny-all unless explicitly ALLOWed |
| DENY > ALLOW |
DENY always wins when both match |
| Empty conditions |
Only exportPrivateKey and * (wildcard) allow conditions: [] |
| TX methods need conditions |
eth_sendTransaction, eth_signTransaction, eth_signTypedData_v4, eth_signUserOperation, signAndSendTransaction, etc. ALL require ≥1 condition |
| Valid field_sources |
EVM: ethereum_transaction (to/value/chain_id), ethereum_calldata (function_name), ethereum_typed_data_domain (chainId/verifyingContract), ethereum_typed_data_message, system |
| Valid operators |
eq, gt, gte, lt, lte, in (array, max 100 values) |
| Dual chain |
Call frontend_action(action_type="update_wallet_policy", ...) TWICE for EVM + Solana |
Gotchas
- Policy proposal goes through the
frontend_action tool — needs an active SSE session (won't work from a background task).
wallet_balance requires chain — use wallet_get_all_balances for discovery.
- For both EVM + Solana policy, call
frontend_action TWICE (one per chain_type).
1---
2name: wallet
3version: 3.7.0
4description: |
5 Multi-chain wallet: EVM and Solana balances, transfers, signing, and policy.
6
7 Use when checking balances, sending tokens, signing typed data, or proposing a wallet policy (e.g. send 10 USDC on Base, sign EIP-712, Solana balance).
8author: starchild
9tags: [wallet, evm, solana, transfer, sign, policy, debank, birdeye]
10delivery: script
11metadata:
12 source: https://skillmd.com/skills/starchild-ai-agent/wallet
13 starchild:
14 emoji: 💰
15 skillKey: wallet
16---
17
18# 💰 Wallet Skill
19
20Multi-chain wallet for EVM (DeBank-supported chains) + Solana. Balances,
21transfers, signing, and policy management. **Script skill** — call the functions
22below via bash; no wallet tools are registered.
23
24## How to call
25
26All read/transfer/sign operations are Python functions in `core.skill_tools.wallet`.
27Run them from bash and read the JSON result:
28
29```bash
30python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
31```
32
33The **one** operation that is NOT a script function is proposing a wallet policy
34— it needs to render a confirmation card in the UI, so it goes through the native
35`frontend_action` tool (see Policy Management below).
36
37## Functions (`from core.skill_tools import wallet`)
38
39| Function | Description |
40|----------|-------------|
41| `wallet_info()` | Get all AGENT wallet addresses |
42| `get_user_wallets()` | The USER'S OWN wallets (login + secondary) — read-only, from env |
43| `wallet_balance(chain, address="", asset="")` | EVM balance on a chain (DeBank). `chain` required |
44| `wallet_sol_balance(address="", asset="")` | Solana balance (Birdeye) |
45| `wallet_get_all_balances(evm_address="", sol_address="")` | All chains at once |
46| `wallet_transfer(to, amount, chain_id=1, data="", **kw)` | **Broadcast** EVM tx (gas sponsored by default) |
47| `wallet_sign_transaction(to, amount, chain_id=1, data="", **kw)` | Sign EVM tx (no broadcast) |
48| `wallet_sign(message)` | EIP-191 message signing |
49| `wallet_sign_typed_data(domain, types, primaryType, message)` | EIP-712 typed data signing |
50| `wallet_transactions(chain="ethereum", asset="", limit=20)` | EVM tx history |
51| `wallet_sol_transfer(transaction, caip2=...)` | **Broadcast** Solana tx (base64) |
52| `wallet_sol_sign_transaction(transaction)` | Sign Solana tx (no broadcast) |
53| `wallet_sol_sign(message)` | Solana message signing |
54| `wallet_sol_transactions(chain="solana", asset="sol", limit=20)` | Solana tx history |
55| `wallet_get_policy(chain_type="ethereum")` | Check policy status |
56| `validate_and_clean_rules(rules, chain_type)` | Pre-validate policy rules before proposing |
57
58## The User's Own Wallets (login / secondary)
59
60The agent wallet is NOT the user's wallet. The platform injects the user's own
61wallet identities as env vars (synced from the control plane at container start
62and on user wallet actions):
63
64- `USER_LOGIN_WALLET_ADDRESS` / `USER_LOGIN_WALLET_TYPE` — the wallet the user
65 logs in with (or bound as primary).
66- `USER_SECONDARY_WALLET_ADDRESS` / `USER_SECONDARY_WALLET_TYPE` — the user's
67 other linked wallet (e.g. Solana when login is EVM).
68
69When asked "what's my wallet" / "my login wallet" / "check MY balance", read
70these — do NOT answer with the agent wallet or say you don't know:
71
72```bash
73python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.get_user_wallets()))"
74```
75
76Empty/missing values mean the user has never bound a wallet in that slot
77(e.g. social login) — say so and point them to wallet binding in the web app.
78
79Rules:
80- **Read-only.** The agent holds no keys for these wallets. To check the user's
81 balances, pass the address into `wallet_balance(chain, address=...)` /
82 `wallet_sol_balance(address=...)`.
83- **Transactions from the user's wallet** never go through script functions —
84 use the native `frontend_action(action_type="user_wallet_tx", ...)` flow,
85 where the user signs in the UI and `expected_from` is enforced server-side.
86
87## Key Facts
88
89- **Amounts are in wei** for EVM (`wallet_transfer` / `wallet_sign_transaction`). 0.01 ETH = `10000000000000000`. For ERC-20 token sends, `amount` is `0` (native) and the transfer is encoded in `data` calldata.
90- **Gas is sponsored by default** on EVM chains — user doesn't need native tokens for gas. Falls back to user-paid if unavailable. Pass `sponsor=False` to pay gas from wallet balance.
91- **Policy default: OFF** (allow-all). Only when policy is enabled do transactions need UI confirmation.
92- **Supported EVM chains**: All DeBank-supported chains. Common names auto-mapped (e.g. `avalanche` → `avax`, `bsc` → `bsc`, `zksync` → `era`). Fallback aliases include ethereum/base/arbitrum/optimism/polygon/linea/bsc/avalanche/fantom/gnosis/zksync/scroll/blast/mantle/celo/aurora **plus** monad/world/unichain/abstract/sonic/berachain.
93- **Balance sources**: DeBank (EVM), Birdeye (Solana), wallet-service (fallback). DeBank/Birdeye keys are auto-injected by sc-proxy.
94
95## Workflows
96
97### Check balances
98```bash
99python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
100python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_get_all_balances()))"
101```
102
103### Send a transaction (EVM)
104Always verify balance before, and the result/history after.
105```bash
106# 1. check
107python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_balance(chain='base')))"
108# 2. transfer (amount in wei)
109python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_transfer(to='0x...', amount='10000000000000000', chain_id=8453)))"
110# 3. verify
111python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_transactions(chain='base')))"
112```
113
114### Sign EIP-712 typed data
115```bash
116python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_sign_typed_data(domain={...}, types={...}, primaryType='Permit', message={...})))"
117```
118
119## Policy Management
120
121Checking policy is a script function; **proposing** a policy uses the native
122`frontend_action` tool (it renders a signature card in the UI — a script cannot).
123
1241. Check current policy:
125 ```bash
126 python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.wallet_get_policy(chain_type='ethereum')))"
127 ```
1282. (Optional) pre-validate rules:
129 ```bash
130 python3 -c "from core.skill_tools import wallet; import json; print(json.dumps(wallet.validate_and_clean_rules([...], 'ethereum')))"
131 ```
1323. Propose — call the **`frontend_action` tool** (not a script):
133 ```
134 frontend_action(action_type="update_wallet_policy", chain_type="ethereum", rules=[...])
135 ```
136 The user confirms + signs in the UI. **Call once per chain** (EVM + Solana = two calls).
137
138### Standard Wildcard Policy (when needed)
139```
140rules = [
141 {"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
142 {"name": "Allow all", "method": "*", "conditions": [], "action": "ALLOW"},
143]
144```
145
146### Policy Modes — CRITICAL DECISION TABLE
147
148⚠️ **DENY > ALLOW in Privy.** `DENY *` overrides ALL ALLOW rules. NEVER mix them.
149
150| Mode | Rules | Effect |
151|------|-------|--------|
152| **Allow-all** (default) | `DENY exportPrivateKey` + `ALLOW *` | Everything allowed except key export |
153| **Deny-all** (lockdown) | `DENY exportPrivateKey` + `DENY *` | Nothing works. No ALLOW rules! |
154| **Whitelist** (selective) | `DENY exportPrivateKey` + specific ALLOW rules only | Only whitelisted ops work, rest implicitly denied |
155
156### Mode 1: Allow-All (Standard Wildcard)
157```
158rules = [
159 {"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
160 {"name": "Allow all", "method": "*", "conditions": [], "action": "ALLOW"},
161]
162```
163
164### Mode 2: Deny-All (Lockdown)
165```
166rules = [
167 {"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
168 {"name": "Deny all actions", "method": "*", "conditions": [], "action": "DENY"},
169]
170# ⚠️ NO ALLOW rules here — DENY * would override them!
171```
172
173### Mode 3: Whitelist (Selective Allow)
174```
175rules = [
176 {"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
177 {"name": "Allow transfer to Uniswap", "method": "eth_sendTransaction", "conditions": [
178 {"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"}
179 ], "action": "ALLOW"},
180]
181# ⚠️ NO "DENY *" here! enabled=true already denies everything not ALLOWed.
182# Adding DENY * would override the ALLOW rules above (DENY > ALLOW).
183```
184
185## Privy Policy Rules — Key Constraints
186
187| Rule | Details |
188|------|---------|
189| **Default behavior** | `enabled=true` → deny-all unless explicitly ALLOWed |
190| **DENY > ALLOW** | DENY always wins when both match |
191| **Empty conditions** | Only `exportPrivateKey` and `*` (wildcard) allow `conditions: []` |
192| **TX methods need conditions** | `eth_sendTransaction`, `eth_signTransaction`, `eth_signTypedData_v4`, `eth_signUserOperation`, `signAndSendTransaction`, etc. ALL require ≥1 condition |
193| **Valid field_sources** | EVM: `ethereum_transaction` (to/value/chain_id), `ethereum_calldata` (function_name), `ethereum_typed_data_domain` (chainId/verifyingContract), `ethereum_typed_data_message`, `system` |
194| **Valid operators** | `eq`, `gt`, `gte`, `lt`, `lte`, `in` (array, max 100 values) |
195| **Dual chain** | Call `frontend_action(action_type="update_wallet_policy", ...)` TWICE for EVM + Solana |
196
197## Gotchas
198
199- Policy proposal goes through the `frontend_action` tool — needs an active SSE session (won't work from a background task).
200- `wallet_balance` requires `chain` — use `wallet_get_all_balances` for discovery.
201- For both EVM + Solana policy, call `frontend_action` TWICE (one per chain_type).