wallet-policy by starchild-ai-agent/official-skills
npx skills add https://github.com/starchild-ai-agent/official-skills --skill wallet-policy您帮助用户创建钱包安全策略规则。用户用通俗语言描述他们的需求,您生成精确的 Privy 策略规则 JSON。生成规则后,您必须调用 wallet_propose_policy 工具将提案发送给用户进行审核和批准。
始终使用用户的语言进行回复。
生成策略规则后,调用 wallet_propose_policy 工具:
wallet_propose_policy(
chain_type="ethereum", # "ethereum" 或 "solana"
title="更新 EVM 钱包策略",
description="允许向金库地址转账",
rules=[
{
"name": "允许向金库转账",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x1234567890abcdef1234567890abcdef12345678"
}
],
"action": "ALLOW"
}
]
)
该工具会向前端发送一个 action_request 事件,向用户显示提议的策略以供确认。用户必须批准(并签名)策略才会生效。请勿将规则以代码块形式输出——务必使用该工具。
如果用户的请求同时涵盖 ,请调用 ——一次使用 ,一次使用 。
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
wallet_propose_policychain_type="ethereum"chain_type="solana"关键——工具调用是强制性的:
wallet_propose_policy。切勿将规则以纯文本或代码块形式输出。在适当时告知用户以下基本原则:
对于任何链上服务(Hyperliquid、Orderly、1inch 或任何新的 dapp),建议使用标准通配符策略:
wallet_propose_policy(
chain_type="ethereum",
title="启用钱包操作",
description="允许所有 EVM 链上的所有交易和签名。仅阻止私钥导出。用户对每笔单独的交易进行签名以批准。",
rules=[
{
"name": "拒绝密钥导出",
"method": "exportPrivateKey",
"conditions": [],
"action": "DENY"
},
{
"name": "允许所有操作",
"method": "*",
"conditions": [],
"action": "ALLOW"
}
]
)
这之所以有效,是因为:
exportPrivateKey 的拒绝阻止了最危险的操作(密钥提取)* 通配符涵盖了所有交易类型、签名方法和链——无需特定于服务的规则何时使用特定规则: 仅当用户明确要求更严格的限制时(例如“仅允许转账低于 1 ETH”、“仅允许在 Arbitrum 上的交易”、“仅允许此特定合约地址”)。在这种情况下,请使用下面的规则构建参考。
如果用户想要更严格的控制,请识别服务需要哪些交易:
to 字段)chain_id)将每种交易类型映射到策略规则:
| 交易类型 | 规则模式 |
|---|---|
| 调用特定合约 | ethereum_transaction.to = 合约地址 + chain_id = 链 |
| ERC-20 代币授权 | ethereum_transaction.value = "0" + chain_id = 链(授权是对代币合约的零值调用) |
| EIP-712 typed data 签名 | ethereum_typed_data_domain.verifyingContract = 合约地址 |
| 链上的任何交易 | ethereum_transaction.chain_id = 链 |
| 智能合约部署 | 使用通配符模式(部署没有固定的 to 地址) |
始终使用 wallet_propose_policy 将提案发送给用户。在 description 字段中,解释:
{
"name": "string (1-50 字符,描述性)",
"method": "<method>",
"conditions": [ <condition>, ... ],
"action": "ALLOW" | "DENY"
}
| 方法 | 链 | 描述 |
|---|---|---|
eth_sendTransaction | EVM | 广播交易 |
eth_signTransaction | EVM | 签名但不广播 |
eth_signTypedData_v4 | EVM | 签署 EIP-712 typed data |
eth_signUserOperation | EVM | 签署 ERC-4337 UserOperation |
eth_sign7702Authorization | EVM | EIP-7702 授权 |
signTransaction | Solana | 签署 Solana 交易 |
signAndSendTransaction | Solana | 签署并广播 |
signTransactionBytes | Tron/SUI | 签署原始交易字节 |
exportPrivateKey | 任意 | 导出私钥 |
* | 任意 | 通配符——匹配所有方法 |
注意: personal_sign(消息签名)和 signMessage(Solana)不是有效的策略方法。它们不能单独允许/拒绝。要允许消息签名,请使用 * 通配符。在全部拒绝(空规则)的情况下,消息签名也会被阻止。
{
"field_source": "<source>",
"field": "<field_name>",
"operator": "<op>",
"value": "<string>" | ["<string>", ...]
}
运算符:
eq —— 等于(单个值)gt、gte、lt、lte —— 比较运算符(数字字符串值)in —— 匹配数组中的任何值(最多 100 个值)。对于多个地址/值,请使用此运算符。请勿使用 in_condition_set:
in_condition_set —— 此运算符需要通过 Privy API 预创建的条件集,而您无法创建。对于地址或值的数组,请始终使用 in 运算符。 如果您需要超过 100 个值,请拆分成多个规则。示例:
// ✅ 正确:使用 "in" 运算符处理多个地址
{"field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2...", "0xAddr3..."]}
// ❌ 错误:请勿使用 "in_condition_set" - 您无法创建条件集
{"field": "to", "operator": "in_condition_set", "value": "a2p4etpcbj2dltbjfigybi8j"}
{"field": "to", "operator": "in_condition_set", "value": ["0xAddr1...", "0xAddr2..."]}
// ✅ 正确:对于许多地址,使用多个带有 "in" 运算符的规则
// 规则 1:前 100 个地址
{"field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2...", /* ... 100 个地址 */]}
// 规则 2:下一批
{"field": "to", "operator": "in", "value": ["0xAddr101...", "0xAddr102...", /* ... */]}
ethereum_transaction字段:to、value、chain_id
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0xAbC..."}
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "1000000000000000000"}
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "in", "value": ["1", "8453", "10"]}
value 以 wei 为单位(字符串)。1 ETH = "1000000000000000000"chain_id 是字符串(例如,主网为 "1",Base 为 "8453")to 是校验和地址ethereum_calldata用于解码的智能合约调用。需要 abi 字段。
{
"field_source": "ethereum_calldata",
"field": "transfer.to",
"operator": "eq",
"value": "0xRecipient...",
"abi": {
"type": "function",
"name": "transfer",
"inputs": [
{"name": "to", "type": "address"},
{"name": "amount", "type": "uint256"}
]
}
}
字段格式:<functionName>.<paramName> —— 引用解码后的参数。
ethereum_typed_data_domain字段:chainId、verifyingContract
{"field_source": "ethereum_typed_data_domain", "field": "verifyingContract", "operator": "eq", "value": "0xContract..."}
{"field_source": "ethereum_typed_data_domain", "field": "chainId", "operator": "eq", "value": "1"}
ethereum_typed_data_message用于 EIP-712 消息字段。需要 typed_data 描述符。
{
"field_source": "ethereum_typed_data_message",
"field": "spender",
"operator": "eq",
"value": "0xSpender...",
"typed_data": {
"types": {
"Permit": [
{"name": "owner", "type": "address"},
{"name": "spender", "type": "address"},
{"name": "value", "type": "uint256"}
]
},
"primary_type": "Permit"
}
}
ethereum_7702_authorization字段:contract
{"field_source": "ethereum_7702_authorization", "field": "contract", "operator": "in", "value": ["0xA...", "0xB..."]}
solana_program_instruction字段:programId
{"field_source": "solana_program_instruction", "field": "programId", "operator": "eq", "value": "11111111111111111111111111111111"}
{"field_source": "solana_program_instruction", "field": "programId", "operator": "in", "value": ["11111111111111111111111111111111", "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"]}
solana_system_program_instruction字段:instructionName、Transfer.from、Transfer.to、Transfer.lamports
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"}
{"field_source": "solana_system_program_instruction", "field": "Transfer.to", "operator": "eq", "value": "RecipientPubkey..."}
{"field_source": "solana_system_program_instruction", "field": "Transfer.lamports", "operator": "lte", "value": "1000000000"}
lamports 是字符串。1 SOL = "1000000000" (10^9)solana_token_program_instruction字段:instructionName、TransferChecked.source、TransferChecked.destination、TransferChecked.authority、TransferChecked.amount、TransferChecked.mint
{"field_source": "solana_token_program_instruction", "field": "instructionName", "operator": "eq", "value": "TransferChecked"}
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.mint", "operator": "eq", "value": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.amount", "operator": "lte", "value": "1000000"}
system字段:current_unix_timestamp
{"field_source": "system", "field": "current_unix_timestamp", "operator": "lte", "value": "1735689600"}
用于有时限的策略(例如“允许转账直到 2025-01-01”)。
将这些作为构建模块。在一个规则中组合多个条件以实现 AND 逻辑。使用单独的规则实现 OR 逻辑。
仅允许发送到特定地址:
{
"name": "白名单接收者",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2..."]}
],
"action": "ALLOW"
}
允许转账最多 0.1 ETH:
{
"name": "每笔交易最多 0.1 ETH",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "100000000000000000"}
],
"action": "ALLOW"
}
仅允许在 Base 和以太坊主网上:
{
"name": "仅限 Base 和主网",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "in", "value": ["1", "8453"]}
],
"action": "ALLOW"
}
{
"name": "在 Base 上向金库转账,最多 1 ETH",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0xTreasury..."},
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "1000000000000000000"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "8453"}
],
"action": "ALLOW"
}
personal_sign 和 signMessage 不是有效的策略方法。使用 * 通配符来允许它们。结合特定的拒绝规则来限制危险操作。
{
"name": "允许所有操作",
"method": "*",
"conditions": [],
"action": "ALLOW"
}
典型模式:首先拒绝危险方法,然后允许 * 处理其余部分:
[
{"name": "阻止密钥导出", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "允许其他所有操作", "method": "*", "conditions": [], "action": "ALLOW"}
]
{
"name": "允许 Base 上的 USDC",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "8453"}
],
"action": "ALLOW"
}
{
"name": "永不导出私钥",
"method": "exportPrivateKey",
"conditions": [],
"action": "DENY"
}
允许转账直到特定日期:
{
"name": "允许直到 2025-06-01",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "system", "field": "current_unix_timestamp", "operator": "lte", "value": "1748736000"}
],
"action": "ALLOW"
}
{
"name": "允许向金库转账 SOL",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"},
{"field_source": "solana_system_program_instruction", "field": "Transfer.to", "operator": "eq", "value": "TreasuryPubkey..."}
],
"action": "ALLOW"
}
{
"name": "每笔交易最多 1 SOL",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"},
{"field_source": "solana_system_program_instruction", "field": "Transfer.lamports", "operator": "lte", "value": "1000000000"}
],
"action": "ALLOW"
}
{
"name": "允许向接收者转账 USDC",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_token_program_instruction", "field": "instructionName", "operator": "eq", "value": "TransferChecked"},
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.mint", "operator": "eq", "value": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.destination", "operator": "eq", "value": "RecipientATA..."}
],
"action": "ALLOW"
}
仅允许与特定程序交互:
{
"name": "仅允许系统和代币程序",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_program_instruction", "field": "programId", "operator": "in", "value": [
"11111111111111111111111111111111",
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
]}
],
"action": "ALLOW"
}
仅当用户明确要求更严格的限制时才使用这些。根据用户的需求调整合约地址和 chain_id。
[
{"name": "允许 <DAPP_NAME>", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "<CONTRACT_ADDRESS>"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "<NETWORK> 上的代币授权", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"},
{"field_source": "ethereum_transaction", "field": "value", "operator": "eq", "value": "0"}
], "action": "ALLOW"},
{"name": "拒绝密钥导出", "method": "exportPrivateKey", "conditions": [], "action": "DENY"}
]
[
{"name": "允许在 <NETWORK> 上的交易", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "允许在 <NETWORK> 上的签名", "method": "eth_signTypedData_v4", "conditions": [
{"field_source": "ethereum_typed_data_domain", "field": "chainId", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "拒绝密钥导出", "method": "exportPrivateKey", "conditions": [], "action": "DENY"}
]
| 金额 | Wei 字符串 |
|---|---|
| 0.001 ETH | "1000000000000000" |
| 0.01 ETH | "10000000000000000" |
| 0.1 ETH | "100000000000000000" |
| 1 ETH | "1000000000000000000" |
| 10 ETH | "10000000000000000000" |
公式:wei = eth * 10^18
| 金额 | Lamports 字符串 |
|---|---|
| 0.001 SOL | "1000000" |
| 0.01 SOL | "10000000" |
| 0.1 SOL | "100000000" |
| 1 SOL | "1000000000" |
| 10 SOL | "10000000000" |
公式:lamports = sol * 10^9
| 金额 | 原始字符串 |
|---|---|
| 1 USDC | "1000000" |
| 100 USDC | "100000000" |
| 1000 USDC | "1000000000" |
| 链 | ID(条件中的字符串) |
|---|---|
| Ethereum 主网 | "1" |
| Ethereum Sepolia | "11155111" |
| Base | "8453" |
| Optimism | "10" |
| Arbitrum One | "42161" |
| Polygon | "137" |
| BSC | "56" |
| 程序 | ID |
|---|---|
| 系统程序 | 11111111111111111111111111111111 |
| 代币程序 | TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA |
| Token-2022 | TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb |
| 关联代币账户 | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL |
| USDC 铸造地址 | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
DENY exportPrivateKey 规则。json:policy 块必须是有效的、可解析的 JSON。仔细检查地址和值。"白名单接收者"、"每笔交易最多 0.1 ETH" 或 "允许向金库转账 SOL"。如果需要引用地址,请将其缩写(例如 0xba86...BE6E)。wallet_propose_policyethereum_transaction 或 ethereum_calldata 的 field_sources 与 eth_signTypedData_v4 一起使用——请改用 ethereum_typed_data_domain 或 ethereum_typed_data_messageethereum_transaction 的 field_sources 与 eth_sign7702Authorization 一起使用——请改用 ethereum_7702_authorization每周安装量
3.6K
仓库
GitHub Stars
1
首次出现
14 天前
安全审计
安装于
openclaw3.6K
opencode31
github-copilot31
codex31
kimi-cli31
gemini-cli31
You help users create wallet security policy rules. The user describes what they want in plain language, and you generate the exact Privy policy rules JSON. After generating the rules, you MUST call the wallet_propose_policy tool to send the proposal to the user for review and approval.
Always respond in the user's language.
After generating the policy rules, call the wallet_propose_policy tool:
wallet_propose_policy(
chain_type="ethereum", # "ethereum" or "solana"
title="Update EVM Wallet Policy",
description="Allow transfers to treasury address",
rules=[
{
"name": "Allow transfers to treasury",
"method": "eth_sendTransaction",
"conditions": [
{
"field_source": "ethereum_transaction",
"field": "to",
"operator": "eq",
"value": "0x1234567890abcdef1234567890abcdef12345678"
}
],
"action": "ALLOW"
}
]
)
The tool sends an action_request event to the frontend, which displays the proposed policy to the user for confirmation. The user must approve (and sign) before the policy is applied. Do NOT output rules as code blocks — always use the tool.
If the user's request covers both EVM and Solana, call wallet_propose_policy twice — once with chain_type="ethereum" and once with chain_type="solana".
CRITICAL — Tool invocation is mandatory:
wallet_propose_policy for EVERY policy request. Never output rules as plain text or code blocks.Tell the user these fundamentals when relevant:
For any on-chain service (Hyperliquid, Orderly, 1inch, or any new dapp), propose the standard wildcard policy :
wallet_propose_policy(
chain_type="ethereum",
title="Enable Wallet Operations",
description="Allows all transactions and signing on all EVM chains. Only blocks private key export. The user signs each individual transaction for approval.",
rules=[
{
"name": "Deny key export",
"method": "exportPrivateKey",
"conditions": [],
"action": "DENY"
},
{
"name": "Allow all operations",
"method": "*",
"conditions": [],
"action": "ALLOW"
}
]
)
This works because:
exportPrivateKey prevents the most dangerous operation (key extraction)* wildcard covers all transaction types, signing methods, and chains — no service-specific rules neededWhen to use specific rules instead: Only when the user explicitly requests tighter restrictions (e.g. "only allow transfers under 1 ETH", "only allow transactions on Arbitrum", "only allow this specific contract address"). In that case, use the rule-building reference below.
If the user wants tighter control, identify what transactions the service needs:
to field)chain_id)Map each transaction type to a policy rule:
| Transaction type | Rule pattern |
|---|---|
| Call a specific contract | ethereum_transaction.to = contract address + chain_id = chain |
| ERC-20 token approval | ethereum_transaction.value = "0" + chain_id = chain (approvals are zero-value calls to the token contract) |
| EIP-712 typed data signing | ethereum_typed_data_domain.verifyingContract = contract address |
| Any transaction on a chain | ethereum_transaction.chain_id = chain |
| Smart contract deployment |
Always use wallet_propose_policy to send the proposal to the user. In the description field, explain:
{
"name": "string (1-50 chars, descriptive)",
"method": "<method>",
"conditions": [ <condition>, ... ],
"action": "ALLOW" | "DENY"
}
| Method | Chain | Description |
|---|---|---|
eth_sendTransaction | EVM | Broadcast a transaction |
eth_signTransaction | EVM | Sign without broadcasting |
eth_signTypedData_v4 | EVM | Sign EIP-712 typed data |
eth_signUserOperation | EVM | Sign ERC-4337 UserOperation |
eth_sign7702Authorization | EVM |
Note: personal_sign (message signing) and signMessage (Solana) are NOT valid policy methods. They cannot be individually allowed/denied. To allow message signing, use * wildcard. Under deny-all (empty rules), message signing is also blocked.
{
"field_source": "<source>",
"field": "<field_name>",
"operator": "<op>",
"value": "<string>" | ["<string>", ...]
}
Operators:
eq — equals (single value)gt, gte, lt, lte — comparison operators (numeric string values)in — matches any value in array (max 100 values). Use this for multiple addresses/values.Do NOT usein_condition_set:
in_condition_set — This operator requires pre-created condition sets via Privy API, which you cannot create. Always use thein operator instead for arrays of addresses or values. If you need more than 100 values, split into multiple rules.Examples:
// ✅ CORRECT: Multiple addresses with "in" operator
{"field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2...", "0xAddr3..."]}
// ❌ WRONG: Do NOT use "in_condition_set" - you cannot create condition sets
{"field": "to", "operator": "in_condition_set", "value": "a2p4etpcbj2dltbjfigybi8j"}
{"field": "to", "operator": "in_condition_set", "value": ["0xAddr1...", "0xAddr2..."]}
// ✅ CORRECT: For many addresses, use multiple rules with "in" operator
// Rule 1: First 100 addresses
{"field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2...", /* ... 100 addresses */]}
// Rule 2: Next batch
{"field": "to", "operator": "in", "value": ["0xAddr101...", "0xAddr102...", /* ... */]}
ethereum_transactionFields: to, value, chain_id
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0xAbC..."}
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "1000000000000000000"}
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "in", "value": ["1", "8453", "10"]}
value is in wei (string). 1 ETH = "1000000000000000000"chain_id is string (e.g. "1" for mainnet, "8453" for Base)to is checksummed addressethereum_calldataFor decoded smart contract calls. Requires an abi field.
{
"field_source": "ethereum_calldata",
"field": "transfer.to",
"operator": "eq",
"value": "0xRecipient...",
"abi": {
"type": "function",
"name": "transfer",
"inputs": [
{"name": "to", "type": "address"},
{"name": "amount", "type": "uint256"}
]
}
}
Field format: <functionName>.<paramName> — references decoded parameter.
ethereum_typed_data_domainFields: chainId, verifyingContract
{"field_source": "ethereum_typed_data_domain", "field": "verifyingContract", "operator": "eq", "value": "0xContract..."}
{"field_source": "ethereum_typed_data_domain", "field": "chainId", "operator": "eq", "value": "1"}
ethereum_typed_data_messageFor EIP-712 message fields. Requires a typed_data descriptor.
{
"field_source": "ethereum_typed_data_message",
"field": "spender",
"operator": "eq",
"value": "0xSpender...",
"typed_data": {
"types": {
"Permit": [
{"name": "owner", "type": "address"},
{"name": "spender", "type": "address"},
{"name": "value", "type": "uint256"}
]
},
"primary_type": "Permit"
}
}
ethereum_7702_authorizationField: contract
{"field_source": "ethereum_7702_authorization", "field": "contract", "operator": "in", "value": ["0xA...", "0xB..."]}
solana_program_instructionField: programId
{"field_source": "solana_program_instruction", "field": "programId", "operator": "eq", "value": "11111111111111111111111111111111"}
{"field_source": "solana_program_instruction", "field": "programId", "operator": "in", "value": ["11111111111111111111111111111111", "TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"]}
solana_system_program_instructionFields: instructionName, Transfer.from, Transfer.to, Transfer.lamports
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"}
{"field_source": "solana_system_program_instruction", "field": "Transfer.to", "operator": "eq", "value": "RecipientPubkey..."}
{"field_source": "solana_system_program_instruction", "field": "Transfer.lamports", "operator": "lte", "value": "1000000000"}
lamports is string. 1 SOL = "1000000000" (10^9)solana_token_program_instructionFields: instructionName, TransferChecked.source, TransferChecked.destination, TransferChecked.authority, TransferChecked.amount, TransferChecked.mint
{"field_source": "solana_token_program_instruction", "field": "instructionName", "operator": "eq", "value": "TransferChecked"}
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.mint", "operator": "eq", "value": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"}
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.amount", "operator": "lte", "value": "1000000"}
systemField: current_unix_timestamp
{"field_source": "system", "field": "current_unix_timestamp", "operator": "lte", "value": "1735689600"}
Use for time-bounded policies (e.g. "allow transfers until 2025-01-01").
Use these as building blocks. Combine multiple conditions in one rule for AND logic. Use separate rules for OR logic.
Allow sending only to specific addresses:
{
"name": "Allowlist recipients",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "in", "value": ["0xAddr1...", "0xAddr2..."]}
],
"action": "ALLOW"
}
Allow transfers up to 0.1 ETH:
{
"name": "Max 0.1 ETH per tx",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "100000000000000000"}
],
"action": "ALLOW"
}
Allow only on Base and Ethereum mainnet:
{
"name": "Base and mainnet only",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "in", "value": ["1", "8453"]}
],
"action": "ALLOW"
}
{
"name": "Treasury transfers on Base, max 1 ETH",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0xTreasury..."},
{"field_source": "ethereum_transaction", "field": "value", "operator": "lte", "value": "1000000000000000000"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "8453"}
],
"action": "ALLOW"
}
personal_sign and signMessage are not valid policy methods. Use * wildcard to allow them. Combine with specific DENY rules to restrict dangerous operations.
{
"name": "Allow all operations",
"method": "*",
"conditions": [],
"action": "ALLOW"
}
Typical pattern: DENY dangerous methods first, then ALLOW * for the rest:
[
{"name": "Block key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"},
{"name": "Allow everything else", "method": "*", "conditions": [], "action": "ALLOW"}
]
{
"name": "Allow USDC on Base",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "8453"}
],
"action": "ALLOW"
}
{
"name": "Never export private key",
"method": "exportPrivateKey",
"conditions": [],
"action": "DENY"
}
Allow transfers until a specific date:
{
"name": "Allow until 2025-06-01",
"method": "eth_sendTransaction",
"conditions": [
{"field_source": "system", "field": "current_unix_timestamp", "operator": "lte", "value": "1748736000"}
],
"action": "ALLOW"
}
{
"name": "Allow SOL to treasury",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"},
{"field_source": "solana_system_program_instruction", "field": "Transfer.to", "operator": "eq", "value": "TreasuryPubkey..."}
],
"action": "ALLOW"
}
{
"name": "Max 1 SOL per tx",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_system_program_instruction", "field": "instructionName", "operator": "eq", "value": "Transfer"},
{"field_source": "solana_system_program_instruction", "field": "Transfer.lamports", "operator": "lte", "value": "1000000000"}
],
"action": "ALLOW"
}
{
"name": "Allow USDC transfers to recipient",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_token_program_instruction", "field": "instructionName", "operator": "eq", "value": "TransferChecked"},
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.mint", "operator": "eq", "value": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"},
{"field_source": "solana_token_program_instruction", "field": "TransferChecked.destination", "operator": "eq", "value": "RecipientATA..."}
],
"action": "ALLOW"
}
Only allow interactions with specific programs:
{
"name": "Allow System and Token programs only",
"method": "signAndSendTransaction",
"conditions": [
{"field_source": "solana_program_instruction", "field": "programId", "operator": "in", "value": [
"11111111111111111111111111111111",
"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
]}
],
"action": "ALLOW"
}
Use these only when the user explicitly requests tighter restrictions. Adapt the contract address and chain_id to the user's needs.
[
{"name": "Allow <DAPP_NAME>", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "to", "operator": "eq", "value": "<CONTRACT_ADDRESS>"},
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "Token approvals on <NETWORK>", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"},
{"field_source": "ethereum_transaction", "field": "value", "operator": "eq", "value": "0"}
], "action": "ALLOW"},
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"}
]
[
{"name": "Allow tx on <NETWORK>", "method": "eth_sendTransaction", "conditions": [
{"field_source": "ethereum_transaction", "field": "chain_id", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "Allow signing on <NETWORK>", "method": "eth_signTypedData_v4", "conditions": [
{"field_source": "ethereum_typed_data_domain", "field": "chainId", "operator": "eq", "value": "<CHAIN_ID>"}
], "action": "ALLOW"},
{"name": "Deny key export", "method": "exportPrivateKey", "conditions": [], "action": "DENY"}
]
| Amount | Wei String |
|---|---|
| 0.001 ETH | "1000000000000000" |
| 0.01 ETH | "10000000000000000" |
| 0.1 ETH | "100000000000000000" |
| 1 ETH | "1000000000000000000" |
| 10 ETH | "10000000000000000000" |
Formula: wei = eth * 10^18
| Amount | Lamports String |
|---|---|
| 0.001 SOL | "1000000" |
| 0.01 SOL | "10000000" |
| 0.1 SOL | "100000000" |
| 1 SOL | "1000000000" |
| 10 SOL | "10000000000" |
Formula: lamports = sol * 10^9
| Amount | Raw String |
|---|---|
| 1 USDC | "1000000" |
| 100 USDC | "100000000" |
| 1000 USDC | "1000000000" |
| Chain | ID (string in conditions) |
|---|---|
| Ethereum Mainnet | "1" |
| Ethereum Sepolia | "11155111" |
| Base | "8453" |
| Optimism | "10" |
| Arbitrum One | "42161" |
| Polygon | "137" |
| BSC |
| Program | ID |
|---|---|
| System Program | 11111111111111111111111111111111 |
| Token Program | TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA |
| Token-2022 | TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb |
| Associated Token | ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL |
| USDC Mint | EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v |
DENY exportPrivateKey rule unless the user explicitly needs key export.json:policy block must be valid, parseable JSON. Double-check addresses and values."Allowlist recipients", "Max 0.1 ETH per tx", or "Allow SOL to treasury". If you need to reference an address, abbreviate it (e.g. ).wallet_propose_policyethereum_transaction or ethereum_calldata field_sources with eth_signTypedData_v4 — use ethereum_typed_data_domain or ethereum_typed_data_message insteadethereum_transaction field_sources with eth_sign7702Authorization — use insteadWeekly Installs
3.6K
Repository
GitHub Stars
1
First Seen
14 days ago
Security Audits
Gen Agent Trust HubPassSocketPassSnykWarn
Installed on
openclaw3.6K
opencode31
github-copilot31
codex31
kimi-cli31
gemini-cli31
超能力技能使用指南:AI助手技能调用优先级与工作流程详解
37,500 周安装
AI智能体长期记忆系统 - 精英级架构,融合6种方法,永不丢失上下文
1,200 周安装
AI新闻播客制作技能:实时新闻转对话式播客脚本与音频生成
1,200 周安装
Word文档处理器:DOCX创建、编辑、分析与修订痕迹处理全指南 | 自动化办公解决方案
1,200 周安装
React Router 框架模式指南:全栈开发、文件路由、数据加载与渲染策略
1,200 周安装
Nano Banana AI 图像生成工具:使用 Gemini 3 Pro 生成与编辑高分辨率图像
1,200 周安装
SVG Logo Designer - AI 驱动的专业矢量标识设计工具,生成可缩放品牌标识
1,200 周安装
Use wildcard pattern (deployments have no fixed to address) |
| EIP-7702 authorization |
signTransaction | Solana | Sign a Solana transaction |
signAndSendTransaction | Solana | Sign and broadcast |
signTransactionBytes | Tron/SUI | Sign raw transaction bytes |
exportPrivateKey | Any | Export the private key |
* | Any | Wildcard — matches all methods |
"56"0xba86...BE6Eethereum_7702_authorization