Quick Reference
Use this skill to run the gator CLI from the repo and to choose the correct command/flags for delegation workflows.
Installation
CODEBLOCK0
CLI Overview
- - Binary name: INLINECODE0
- Default profile: INLINECODE1
- Config path:
~/.gator-cli/permissions.json (or ~/.gator-cli/profiles/<profile-name>.json) - Delegations local cache:
~/.gator-cli/delegations/<profile-name>.json when storage not configured
Configuration Requirements
Edit the profile config after gator init:
CODEBLOCK1
- -
delegationStorage is optional; when missing, delegations are stored locally. - INLINECODE7 is required for on-chain actions.
Commands
init
Generate a private key and save config. Errors if the profile already exists.
- - INLINECODE8
- INLINECODE9 values:
base (default), baseSepolia, INLINECODE12 - INLINECODE13 default: INLINECODE14
- Prints: address, chain, and config file path.
create
Upgrade an EOA to an EIP-7702 smart account. Uses the chain in your profile config.
- - INLINECODE15
- Requires the account to be funded with native token first.
- Prints: address, chain, and the upgrade transaction hash.
show
Display the EOA address for a profile.
status
Check config and on-chain account status.
- - INLINECODE17
- Prints: address, chain, config upgrade status, on-chain code presence, storage and RPC URL config.
balance
Show native balance and optional ERC-20 balance.
- - INLINECODE18
- If
--tokenAddress is provided, prints ERC-20 balance and decimals-derived units.
grant
Create, sign, and store a delegation with a predefined scope.
Scope flags:
- - Token scopes:
--tokenAddress <token-address>, --maxAmount <amount>, INLINECODE23 - Periodic scopes:
--periodAmount <amount>, --periodDuration <seconds>, INLINECODE26 - Streaming scopes:
--amountPerSecond <amount>, --initialAmount <amount>, INLINECODE29 - Function call scope:
--targets <addresses>, --selectors <sigs>, INLINECODE32 - Ownership transfer: INLINECODE33
Supported scopes:
- - INLINECODE34
- INLINECODE35
- INLINECODE36
- INLINECODE37
- INLINECODE38
- INLINECODE39
- INLINECODE40
- INLINECODE41
- INLINECODE42
Grant flags per scope:
| Scope | Required Flags | Optional Flags |
|---|
| INLINECODE43 | INLINECODE44 , INLINECODE45 | |
| INLINECODE46 |
--tokenAddress,
--periodAmount,
--periodDuration |
--startDate |
|
erc20Streaming |
--tokenAddress,
--amountPerSecond,
--initialAmount,
--maxAmount |
--startTime |
|
erc721Transfer |
--tokenAddress,
--tokenId | |
|
nativeTokenTransferAmount |
--maxAmount | |
|
nativeTokenPeriodTransfer |
--periodAmount,
--periodDuration |
--startDate |
|
nativeTokenStreaming |
--amountPerSecond,
--initialAmount,
--maxAmount |
--startTime |
|
functionCall |
--targets,
--selectors |
--valueLte |
|
ownershipTransfer |
--contractAddress | |
- -
--startDate and --startTime default to the current time (unix seconds) when omitted. - INLINECODE79 sets the max native token value per call for
functionCall scopes.
redeem
Redeem a stored delegation using a specific action type.
Supported action types: erc20Transfer, erc721Transfer, nativeTransfer, functionCall, ownershipTransfer, INLINECODE87
Action-specific flags:
- -
erc20Transfer: --tokenAddress, --to, INLINECODE91 - INLINECODE92 :
--tokenAddress, --to, INLINECODE95 - INLINECODE96 :
--to, INLINECODE98 - INLINECODE99 :
--target, --function, --args, INLINECODE103 - INLINECODE104 :
--contractAddress, INLINECODE106 - INLINECODE107 :
--target, --callData, INLINECODE110
revoke
Revoke a delegation on-chain. Revokes the first matching delegation.
inspect
Inspect delegations for your account.
- - INLINECODE112
- With no filters, prints both Given and Received.
- Printed fields: From, To, Authority, Caveats count, Signed flag.
Redeem Flags per Action
| Action | Required Flags |
|---|
| INLINECODE113 | INLINECODE114 , --to, INLINECODE116 |
| INLINECODE117 |
--tokenAddress,
--to,
--tokenId |
|
nativeTransfer |
--to,
--amount |
|
functionCall |
--target,
--function,
--args |
|
ownershipTransfer |
--contractAddress,
--to |
|
raw |
--target,
--callData |
Example Flows
Initialize and upgrade:
CODEBLOCK2
Grant an ERC-20 transfer delegation:
CODEBLOCK3
Redeem an ERC-20 transfer:
CODEBLOCK4
Redeem a native transfer:
CODEBLOCK5
Redeem in raw mode:
CODEBLOCK6
Inspect delegations:
CODEBLOCK7
Revoke a delegation:
CODEBLOCK8
Operational Notes
- - Private key security: This is alpha version. Private keys are stored in plaintext JSON. Never use accounts with significant funds.
- INLINECODE134 refers to the delegator address;
--to refers to the delegate/recipient. - INLINECODE136 and
--selectors are comma-separated lists. - INLINECODE138 accepts a human-readable Solidity function signature like
"approve(address,uint256)". Do not pass a 4-byte selector (e.g. 0x095ea7b3) — the CLI derives the selector from the signature automatically. - INLINECODE141 and
--startTime accept unix timestamps in seconds. When omitted, they default to the current time. - INLINECODE143 is required for
redeem and must be one of: erc20Transfer, erc721Transfer, nativeTransfer, functionCall, ownershipTransfer, raw. - Supported chains for
--chain in gator init: base (default), baseSepolia, sepolia.
快速参考
使用此技能可从仓库运行 gator CLI,并为委托工作流选择正确的命令/标志。
安装
sh
npm install -g @metamask/gator-cli
CLI 概述
- - 二进制名称:gator
- 默认配置文件:default
- 配置路径:~/.gator-cli/permissions.json(或 ~/.gator-cli/profiles/.json)
- 委托本地缓存:未配置存储时位于 ~/.gator-cli/delegations/.json
配置要求
运行 gator init 后编辑配置文件:
json
{
delegationStorage: {
apiKey: your-api-key,
apiKeyId: your-api-key-id
},
rpcUrl: https://your-rpc-url.com
}
- - delegationStorage 为可选配置;缺失时委托将存储在本地。
- rpcUrl 为链上操作所必需。
命令
init
生成私钥并保存配置。如果配置文件已存在则会报错。
- - gator init [--chain ] [--profile ]
- --chain 可选值:base(默认)、baseSepolia、sepolia
- --profile 默认值:default
- 输出:地址、链和配置文件路径。
create
将 EOA 升级为 EIP-7702 智能账户。使用配置文件中的链。
- - gator create [--profile ]
- 要求账户先存入原生代币。
- 输出:地址、链和升级交易哈希。
show
显示配置文件的 EOA 地址。
- - gator show [--profile ]
status
检查配置和链上账户状态。
- - gator status [--profile ]
- 输出:地址、链、配置升级状态、链上代码存在性、存储和 RPC URL 配置。
balance
显示原生代币余额和可选的 ERC-20 余额。
- - gator balance [--tokenAddress ] [--profile ]
- 如果提供了 --tokenAddress,则输出 ERC-20 余额及基于小数位的单位。
grant
创建、签名并存储具有预定义范围的委托。
- - gator grant --to --scope [scope flags] [--profile ]
范围标志:
- - 代币范围:--tokenAddress 、--maxAmount 、--tokenId
- 定期范围:--periodAmount 、--periodDuration 、--startDate
- 流式范围:--amountPerSecond 、--initialAmount 、--startTime
- 函数调用范围:--targets 、--selectors 、--valueLte
- 所有权转移:--contractAddress
支持的范围:
- - erc20TransferAmount
- erc20PeriodTransfer
- erc20Streaming
- erc721Transfer
- nativeTokenTransferAmount
- nativeTokenPeriodTransfer
- nativeTokenStreaming
- functionCall
- ownershipTransfer
各范围的授权标志:
| 范围 | 必需标志 | 可选标志 |
|---|
| erc20TransferAmount | --tokenAddress、--maxAmount | |
| erc20PeriodTransfer |
--tokenAddress、--periodAmount、--periodDuration | --startDate |
| erc20Streaming | --tokenAddress、--amountPerSecond、--initialAmount、--maxAmount | --startTime |
| erc721Transfer | --tokenAddress、--tokenId | |
| nativeTokenTransferAmount | --maxAmount | |
| nativeTokenPeriodTransfer | --periodAmount、--periodDuration | --startDate |
| nativeTokenStreaming | --amountPerSecond、--initialAmount、--maxAmount | --startTime |
| functionCall | --targets、--selectors | --valueLte |
| ownershipTransfer | --contractAddress | |
- - 省略时 --startDate 和 --startTime 默认为当前时间(Unix 秒)。
- --valueLte 为 functionCall 范围设置每次调用的最大原生代币值。
redeem
使用特定操作类型赎回存储的委托。
- - gator redeem --from --action [action flags] [--profile ]
支持的操作类型:erc20Transfer、erc721Transfer、nativeTransfer、functionCall、ownershipTransfer、raw
操作特定标志:
- - erc20Transfer:--tokenAddress、--to、--amount
- erc721Transfer:--tokenAddress、--to、--tokenId
- nativeTransfer:--to、--amount
- functionCall:--target、--function、--args、--value
- ownershipTransfer:--contractAddress、--to
- raw:--target、--callData、--value
revoke
在链上撤销委托。撤销第一个匹配的委托。
- - gator revoke --to [--profile ]
inspect
检查账户的委托。
- - gator inspect [--from ] [--to ] [--profile ]
- 无过滤器时,同时显示已授予和已接收的委托。
- 输出字段:发送方、接收方、授权方、限制条件数量、已签名标志。
各操作的赎回标志
| 操作 | 必需标志 |
|---|
| erc20Transfer | --tokenAddress、--to、--amount |
| erc721Transfer |
--tokenAddress、--to、--tokenId |
| nativeTransfer | --to、--amount |
| functionCall | --target、--function、--args |
| ownershipTransfer | --contractAddress、--to |
| raw | --target、--callData |
示例流程
初始化和升级:
bash
gator init --profile
gator create --profile
授予 ERC-20 转账委托:
bash
gator grant --profile --to --scope erc20TransferAmount \
--tokenAddress --maxAmount 50
赎回 ERC-20 转账:
bash
gator redeem --profile --from --action erc20Transfer \
--tokenAddress --to --amount 10
赎回原生代币转账:
bash
gator redeem --profile --from --action nativeTransfer \
--to --amount 0.5
以原始模式赎回:
bash
gator redeem --profile --from --action raw \
--target --callData 0xa9059cbb...
检查委托:
bash
gator inspect --profile
gator inspect --profile --from
gator inspect --profile --to
撤销委托:
bash
gator revoke --profile --to
操作说明
- - 私钥安全:此为 alpha 版本。私钥以明文 JSON 存储。切勿使用存有大额资金的账户。
- --from 指委托方地址;--to 指被委托方/接收方。
- --targets 和 --selectors 为逗号分隔列表。
- --function 接受人类可读的 Solidity 函数签名,如 approve(address,uint256)。不要传递 4 字节选择器(例如 0x095ea7b3