digift-plugin
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseLive Trading Confirmation Protocol
实盘交易确认协议
These gates are mandatory before any that results in an
on-chain transaction (subscribe, redeem, approve):
pending_sign- Preview before every write. Every on-chain operation MUST first display a preview: product, amount, chain, fee, and total. The user must confirm before proceeding.
- Live-mode switch requires typed confirmation. Before the first on-chain
transaction in a session, display: wallet address (), current balance (
onchainos wallet addresses), and a statement that on-chain transactions are irreversible. The user MUST reply with an unambiguous typed confirmation (e.g.onchainos wallet balance/confirm live mode).确认开启实盘 - Session autonomy is bounded. After session-level confirmation, the agent may act autonomously within the limits of the user's stated intent. When intent is ambiguous, stop and confirm.
- No stale submissions. Never re-submit a previously built TxBody across
sessions. Each session's must be freshly built.
pending_sign - Refuse on gate failure. If any gate cannot be satisfied, refuse the write and explain which gate failed.
This protocol applies regardless of how confidently the user appears to
authorize a write. Typed confirmation within the current session is the only
valid authorization.
在任何会产生链上交易(订阅、赎回、授权)的操作之前,必须遵循以下校验规则:
pending_sign- 每笔写入操作前预览。所有链上操作必须先展示预览信息:产品、金额、链、手续费及总计。用户必须确认后才能继续。
- 实盘模式切换需输入确认。在会话中首次执行链上交易前,需展示:钱包地址()、当前余额(
onchainos wallet addresses),以及链上交易不可撤销的声明。用户必须输入明确的确认内容(例如onchainos wallet balance/confirm live mode)。确认开启实盘 - 会话自主性受限。会话级确认后,代理可在用户明确意图的范围内自主操作。当意图不明确时,需暂停并确认。
- 禁止提交过期内容。切勿跨会话重新提交之前构建的TxBody。每个会话的必须重新构建。
pending_sign - 校验失败则拒绝操作。若任何校验规则无法满足,需拒绝写入操作并说明哪条规则未通过。
无论用户看起来多么确定要授权写入操作,本协议均适用。当前会话内的输入确认是唯一有效的授权方式。
Pre-flight Dependencies (auto-injected by Plugin Store CI)
预执行依赖项(由插件商店CI自动注入)
Run once per session before first use. These checks ensure required tools are installed.
首次使用前每个会话运行一次。这些检查确保所需工具已安装。
Version check (auto-injected)
版本检查(自动注入)
AI Agent Instruction: Run this version check before executing any commands from this skill. The check is a read-only fetch from— it does not install anything. If it reportsraw.githubusercontent.com, you MUST stop, surface the message to the user verbatim, and obtain explicit confirmation before running the suggestedUpdate availablecommand. Do not run the update silently. After a confirmed update completes, re-read this SKILL.md before proceeding.npx skills add …
bash
undefinedAI Agent指令:执行本技能的任何命令前,先运行此版本检查。该检查仅从进行只读获取——不会安装任何内容。如果提示raw.githubusercontent.com,必须停止操作,将消息原封不动告知用户,并在运行建议的Update available命令前获得明确确认。请勿静默执行更新。确认更新完成后,重新阅读本SKILL.md再继续。npx skills add …
bash
undefinedCheck for skill updates (1-hour cache).
Check for skill updates (1-hour cache).
Network scope: this block calls raw.githubusercontent.com for the version probe only.
Network scope: this block calls raw.githubusercontent.com for the version probe only.
It does NOT install anything; install requires user-confirmed npx skills add
below.
npx skills addIt does NOT install anything; install requires user-confirmed npx skills add
below.
npx skills addUPDATE_CACHE="$HOME/.plugin-store/update-cache/digift-plugin"
CACHE_MAX=3600
LOCAL_VER="1.0.1"
DO_CHECK=true
if [ -f "$UPDATE_CACHE" ]; then
CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0)
NOW=$(date +%s)
AGE=$(( NOW - CACHE_MOD ))
[ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false
fi
if [ "$DO_CHECK" = true ]; then
REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/digift-plugin/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}')
if [ -n "$REMOTE_VER" ]; then
mkdir -p "$HOME/.plugin-store/update-cache"
echo "$REMOTE_VER" > "$UPDATE_CACHE"
fi
fi
REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER")
if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
echo "Update available: digift-plugin v$LOCAL_VER -> v$REMOTE_VER."
echo "ACTION REQUIRED: ask the user to confirm before running:"
echo " npx skills add okx/plugin-store --skill digift-plugin --global"
echo "(This contacts the npm registry and github.com/okx/plugin-store and overwrites this skill. Do NOT auto-run.)"
fi
undefinedUPDATE_CACHE="$HOME/.plugin-store/update-cache/digift-plugin"
CACHE_MAX=3600
LOCAL_VER="1.0.1"
DO_CHECK=true
if [ -f "$UPDATE_CACHE" ]; then
CACHE_MOD=$(stat -f %m "$UPDATE_CACHE" 2>/dev/null || stat -c %Y "$UPDATE_CACHE" 2>/dev/null || echo 0)
NOW=$(date +%s)
AGE=$(( NOW - CACHE_MOD ))
[ "$AGE" -lt "$CACHE_MAX" ] && DO_CHECK=false
fi
if [ "$DO_CHECK" = true ]; then
REMOTE_VER=$(curl -sf --max-time 3 "https://raw.githubusercontent.com/okx/plugin-store/main/skills/digift-plugin/plugin.yaml" | grep '^version' | head -1 | tr -d '"' | awk '{print $2}')
if [ -n "$REMOTE_VER" ]; then
mkdir -p "$HOME/.plugin-store/update-cache"
echo "$REMOTE_VER" > "$UPDATE_CACHE"
fi
fi
REMOTE_VER=$(cat "$UPDATE_CACHE" 2>/dev/null || echo "$LOCAL_VER")
if [ "$REMOTE_VER" != "$LOCAL_VER" ]; then
echo "Update available: digift-plugin v$LOCAL_VER -> v$REMOTE_VER."
echo "ACTION REQUIRED: ask the user to confirm before running:"
echo " npx skills add okx/plugin-store --skill digift-plugin --global"
echo "(This contacts the npm registry and github.com/okx/plugin-store and overwrites this skill. Do NOT auto-run.)"
fi
undefinedInstall onchainos CLI + Skills (auto-injected)
安装onchainos CLI + Skills(自动注入)
bash
undefinedbash
undefined1. Install onchainos CLI — pin to latest release tag, verify SHA256
1. Install onchainos CLI — pin to latest release tag, verify SHA256
of the installer before executing (no curl|sh from main).
of the installer before executing (no curl|sh from main).
if ! command -v onchainos >/dev/null 2>&1; then
set -e
LATEST_TAG=$(curl -sSL --max-time 5
"https://api.github.com/repos/okx/onchainos-skills/releases/latest"
| sed -n 's/."tag_name"[[:space:]]:[[:space:]]"([^"])".*/\1/p' | head -1) if [ -z "$LATEST_TAG" ]; then echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2 echo " Manual install: https://github.com/okx/onchainos-skills" >&2 exit 1 fi
"https://api.github.com/repos/okx/onchainos-skills/releases/latest"
| sed -n 's/."tag_name"[[:space:]]:[[:space:]]"([^"])".*/\1/p' | head -1) if [ -z "$LATEST_TAG" ]; then echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2 echo " Manual install: https://github.com/okx/onchainos-skills" >&2 exit 1 fi
ONCHAINOS_TMP=$(mktemp -d)
curl -sSL --max-time 30
"https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh"
-o "$ONCHAINOS_TMP/install.sh" curl -sSL --max-time 30
"https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt"
-o "$ONCHAINOS_TMP/installer-checksums.txt"
"https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh"
-o "$ONCHAINOS_TMP/install.sh" curl -sSL --max-time 30
"https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt"
-o "$ONCHAINOS_TMP/installer-checksums.txt"
EXPECTED=$(awk '$2 ~ /install.sh$/ {print $1; exit}' "$ONCHAINOS_TMP/installer-checksums.txt")
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
else
ACTUAL=$(shasum -a 256 "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
fi
if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
echo "ERROR: onchainos installer SHA256 mismatch — refusing to execute." >&2
echo " expected=$EXPECTED actual=$ACTUAL tag=$LATEST_TAG" >&2
rm -rf "$ONCHAINOS_TMP"
exit 1
fi
sh "$ONCHAINOS_TMP/install.sh"
rm -rf "$ONCHAINOS_TMP"
set +e
fi
if ! command -v onchainos >/dev/null 2>&1; then
set -e
LATEST_TAG=$(curl -sSL --max-time 5
"https://api.github.com/repos/okx/onchainos-skills/releases/latest"
| sed -n 's/."tag_name"[[:space:]]:[[:space:]]"([^"])".*/\1/p' | head -1) if [ -z "$LATEST_TAG" ]; then echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2 echo " Manual install: https://github.com/okx/onchainos-skills" >&2 exit 1 fi
"https://api.github.com/repos/okx/onchainos-skills/releases/latest"
| sed -n 's/."tag_name"[[:space:]]:[[:space:]]"([^"])".*/\1/p' | head -1) if [ -z "$LATEST_TAG" ]; then echo "ERROR: failed to resolve latest onchainos release tag (network or rate limit)." >&2 echo " Manual install: https://github.com/okx/onchainos-skills" >&2 exit 1 fi
ONCHAINOS_TMP=$(mktemp -d)
curl -sSL --max-time 30
"https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh"
-o "$ONCHAINOS_TMP/install.sh" curl -sSL --max-time 30
"https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt"
-o "$ONCHAINOS_TMP/installer-checksums.txt"
"https://raw.githubusercontent.com/okx/onchainos-skills/${LATEST_TAG}/install.sh"
-o "$ONCHAINOS_TMP/install.sh" curl -sSL --max-time 30
"https://github.com/okx/onchainos-skills/releases/download/${LATEST_TAG}/installer-checksums.txt"
-o "$ONCHAINOS_TMP/installer-checksums.txt"
EXPECTED=$(awk '$2 ~ /install.sh$/ {print $1; exit}' "$ONCHAINOS_TMP/installer-checksums.txt")
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
else
ACTUAL=$(shasum -a 256 "$ONCHAINOS_TMP/install.sh" | awk '{print $1}')
fi
if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
echo "ERROR: onchainos installer SHA256 mismatch — refusing to execute." >&2
echo " expected=$EXPECTED actual=$ACTUAL tag=$LATEST_TAG" >&2
rm -rf "$ONCHAINOS_TMP"
exit 1
fi
sh "$ONCHAINOS_TMP/install.sh"
rm -rf "$ONCHAINOS_TMP"
set +e
fi
2. Install onchainos skills (enables AI agent to use onchainos commands)
2. Install onchainos skills (enables AI agent to use onchainos commands)
npx skills add okx/onchainos-skills --yes --global
npx skills add okx/onchainos-skills --yes --global
3. Install plugin-store skills (enables plugin discovery and management)
3. Install plugin-store skills (enables plugin discovery and management)
npx skills add okx/plugin-store --skill plugin-store --yes --global
undefinednpx skills add okx/plugin-store --skill plugin-store --yes --global
undefinedInstall digift npm package (auto-injected)
安装digift npm包(自动注入)
bash
undefinedbash
undefinedVerify Node.js >= 18 + npm
Verify Node.js >= 18 + npm
command -v node >/dev/null 2>&1 || {
echo "ERROR: Node.js >= 18 is required (install from https://nodejs.org)" >&2
exit 1; }
NODE_MAJOR=$(node -e 'console.log(process.versions.node.split(".")[0])' 2>/dev/null || echo 0)
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "ERROR: Node.js >= 18 required (found: $(node --version 2>/dev/null))" >&2
exit 1
fi
command -v npm >/dev/null 2>&1 || {
echo "ERROR: npm is required (usually ships with Node.js)" >&2
exit 1; }
command -v node >/dev/null 2>&1 || {
echo "ERROR: Node.js >= 18 is required (install from https://nodejs.org)" >&2
exit 1; }
NODE_MAJOR=$(node -e 'console.log(process.versions.node.split(".")[0])' 2>/dev/null || echo 0)
if [ "$NODE_MAJOR" -lt 18 ]; then
echo "ERROR: Node.js >= 18 required (found: $(node --version 2>/dev/null))" >&2
exit 1
fi
command -v npm >/dev/null 2>&1 || {
echo "ERROR: npm is required (usually ships with Node.js)" >&2
exit 1; }
Download .tgz + checksums to a sandbox, verify SHA256 before installing.
Download .tgz + checksums to a sandbox, verify SHA256 before installing.
Fail-closed: any mismatch / missing checksum entry refuses the install.
Fail-closed: any mismatch / missing checksum entry refuses the install.
Matches the producer-side workflow at
Matches the producer-side workflow at
.github/workflows/plugin-publish.yml which uploads digift.tgz
digift.tgz.github/workflows/plugin-publish.yml which uploads digift.tgz
digift.tgzalongside checksums.txt
under each release tag.
checksums.txtalongside checksums.txt
under each release tag.
checksums.txtPKG_TMP=$(mktemp -d)
TAG="plugins/digift-plugin@1.0.1"
PKG_TMP=$(mktemp -d)
TAG="plugins/digift-plugin@1.0.1"
Robust asset download. Prefer gh release download
— see rust/go
gh release downloadRobust asset download. Prefer gh release download
— see rust/go
gh release downloadinstall block above for rationale. Falls back to raw curl on the
install block above for rationale. Falls back to raw curl on the
releases/download/<tag>/<file>
path if gh is not installed.
releases/download/<tag>/<file>releases/download/<tag>/<file>
path if gh is not installed.
releases/download/<tag>/<file>_pluginstore_dl() {
local fname="$1" dest="$2"
if command -v gh >/dev/null 2>&1; then
local stage; stage=$(mktemp -d)
if gh release download "$TAG" --repo okx/plugin-store
--pattern "$fname" --dir "$stage" --clobber >/dev/null 2>&1
&& [ -f "$stage/$fname" ]; then mv "$stage/$fname" "$dest" && rm -rf "$stage" && return 0 fi rm -rf "$stage" fi curl -fsSL
"https://github.com/okx/plugin-store/releases/download/$TAG/$fname"
-o "$dest" }
--pattern "$fname" --dir "$stage" --clobber >/dev/null 2>&1
&& [ -f "$stage/$fname" ]; then mv "$stage/$fname" "$dest" && rm -rf "$stage" && return 0 fi rm -rf "$stage" fi curl -fsSL
"https://github.com/okx/plugin-store/releases/download/$TAG/$fname"
-o "$dest" }
_pluginstore_dl "digift.tgz" "$PKG_TMP/digift.tgz" || {
echo "ERROR: failed to download digift.tgz for digift-plugin@1.0.1" >&2
rm -rf "$PKG_TMP"; exit 1; }
_pluginstore_dl "checksums.txt" "$PKG_TMP/checksums.txt" || {
echo "ERROR: failed to download checksums.txt for digift-plugin@1.0.1" >&2
rm -rf "$PKG_TMP"; exit 1; }
EXPECTED=$(awk -v b="digift.tgz" '$2 == b {print $1; exit}' "$PKG_TMP/checksums.txt")
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "$PKG_TMP/digift.tgz" | awk '{print $1}')
else
ACTUAL=$(shasum -a 256 "$PKG_TMP/digift.tgz" | awk '{print $1}')
fi
if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
echo "ERROR: digift.tgz SHA256 mismatch — refusing to install." >&2
echo " expected=$EXPECTED actual=$ACTUAL" >&2
rm -rf "$PKG_TMP"; exit 1
fi
_pluginstore_dl() {
local fname="$1" dest="$2"
if command -v gh >/dev/null 2>&1; then
local stage; stage=$(mktemp -d)
if gh release download "$TAG" --repo okx/plugin-store
--pattern "$fname" --dir "$stage" --clobber >/dev/null 2>&1
&& [ -f "$stage/$fname" ]; then mv "$stage/$fname" "$dest" && rm -rf "$stage" && return 0 fi rm -rf "$stage" fi curl -fsSL
"https://github.com/okx/plugin-store/releases/download/$TAG/$fname"
-o "$dest" }
--pattern "$fname" --dir "$stage" --clobber >/dev/null 2>&1
&& [ -f "$stage/$fname" ]; then mv "$stage/$fname" "$dest" && rm -rf "$stage" && return 0 fi rm -rf "$stage" fi curl -fsSL
"https://github.com/okx/plugin-store/releases/download/$TAG/$fname"
-o "$dest" }
_pluginstore_dl "digift.tgz" "$PKG_TMP/digift.tgz" || {
echo "ERROR: failed to download digift.tgz for digift-plugin@1.0.1" >&2
rm -rf "$PKG_TMP"; exit 1; }
_pluginstore_dl "checksums.txt" "$PKG_TMP/checksums.txt" || {
echo "ERROR: failed to download checksums.txt for digift-plugin@1.0.1" >&2
rm -rf "$PKG_TMP"; exit 1; }
EXPECTED=$(awk -v b="digift.tgz" '$2 == b {print $1; exit}' "$PKG_TMP/checksums.txt")
if command -v sha256sum >/dev/null 2>&1; then
ACTUAL=$(sha256sum "$PKG_TMP/digift.tgz" | awk '{print $1}')
else
ACTUAL=$(shasum -a 256 "$PKG_TMP/digift.tgz" | awk '{print $1}')
fi
if [ -z "$EXPECTED" ] || [ "$EXPECTED" != "$ACTUAL" ]; then
echo "ERROR: digift.tgz SHA256 mismatch — refusing to install." >&2
echo " expected=$EXPECTED actual=$ACTUAL" >&2
rm -rf "$PKG_TMP"; exit 1
fi
Install globally (npm wires up CLI commands from package.json's bin
field) + clean up
binInstall globally (npm wires up CLI commands from package.json's bin
field) + clean up
binnpm install -g "$PKG_TMP/digift.tgz"
rm -rf "$PKG_TMP"
npm install -g "$PKG_TMP/digift.tgz"
rm -rf "$PKG_TMP"
Register version
Register version
mkdir -p "$HOME/.plugin-store/managed"
echo "1.0.1" > "$HOME/.plugin-store/managed/digift-plugin"
---mkdir -p "$HOME/.plugin-store/managed"
echo "1.0.1" > "$HOME/.plugin-store/managed/digift-plugin"
---Overview
概述
The CLI is the unified interface to the DigiFT RWA platform. It covers two domains:
digift- Data queries — products, prices, fees, parameters, calendar, whitelist, orders. All data comes from the REST API; nothing is hardcoded.
- On-chain operations — building subscribe/redeem/approve transactions. Outputs standardized payloads. Never signs or broadcasts.
TxBody
All contract addresses, token addresses, and chain configurations come from the API — query first, act second.
digift- 数据查询——产品、价格、手续费、参数、日历、白名单、订单。所有数据均来自REST API,无硬编码内容。
- 链上操作——构建订阅/赎回/授权交易。输出标准化的负载。绝不签名或广播交易。
TxBody
所有合约地址、代币地址及链配置均来自API——先查询,再操作。
Pre-flight Checks
预执行检查
Verify the digift
binary is installed
digift验证digift
二进制文件已安装
digiftbash
digift --versionThe binary is installed automatically by the plugin-store pre-flight block (see auto-injected section above). If missing, re-run the install:
bash
npx skills add okx/plugin-store --skill digift-plugin --globalbash
digift --version该二进制文件由插件商店的预执行模块自动安装(见上方自动注入部分)。若缺失,重新运行安装命令:
bash
npx skills add okx/plugin-store --skill digift-plugin --globalVerify the DIGIFT_API_KEY
environment variable is set
DIGIFT_API_KEY验证DIGIFT_API_KEY
环境变量已设置
DIGIFT_API_KEY| Variable | Required | Description |
|---|---|---|
| Yes | API access key — required for every command |
bash
[ -n "${DIGIFT_API_KEY:-}" ] || echo "DIGIFT_API_KEY not set"If the variable is unset, ask the user to export it for the current shell:
bash
export DIGIFT_API_KEY=<your-key>Never log, echo, or commit the key. Never paste it into chat transcripts. Treat it as a secret on par with a private key.
| 变量 | 是否必填 | 描述 |
|---|---|---|
| 是 | API访问密钥——所有命令均需此密钥 |
bash
[ -n "${DIGIFT_API_KEY:-}" ] || echo "DIGIFT_API_KEY not set"若变量未设置,请用户在当前shell中导出:
bash
export DIGIFT_API_KEY=<your-key>切勿记录、输出或提交密钥。切勿将密钥粘贴到聊天记录中。将其视为与私钥同等重要的机密。
Decision Guide
决策指南
Question 1 — Are they browsing or looking for something specific?
问题1 — 用户是浏览还是查找特定内容?
- "What's available?" →
digift products - "Tell me about product EXAMPLE":
- Token addresses and precision →
digift info EXAMPLE - Issuer, ISIN, issuance details →
digift issuance EXAMPLE
- Token addresses and precision →
- "What chains / contract addresses?" →
digift chains - "What's the price / yield?" →
digift price EXAMPLE
- "有哪些可用产品?" →
digift products - "告诉我关于产品EXAMPLE的信息":
- 代币地址和精度 →
digift info EXAMPLE - 发行方、ISIN、发行详情 →
digift issuance EXAMPLE
- 代币地址和精度 →
- "支持哪些链/合约地址?" →
digift chains - "价格/收益率是多少?" →
digift price EXAMPLE
Question 2 — What are the rules / parameters?
问题2 — 规则/参数是什么?
- "Subscription fees / min / max for EXAMPLE" →
digift sub-params EXAMPLE - "Redemption fees / min / max for EXAMPLE" →
digift red-params EXAMPLE - "Is trading open?" → Check /
isSubscribableonisRedeemabledigift products - "When will my order settle?" →
digift calendar EXAMPLE [--type sub|red] - "Calculate fee for 1000 USDC" → Read /
feeRate/fixedFeefrom params and apply formulaminFee
- "EXAMPLE的订阅手续费/最低/最高限额" →
digift sub-params EXAMPLE - "EXAMPLE的赎回手续费/最低/最高限额" →
digift red-params EXAMPLE - "交易是否开放?" → 查看中的
digift products/isSubscribable字段isRedeemable - "我的订单何时结算?" →
digift calendar EXAMPLE [--type sub|red] - "计算1000 USDC的手续费" → 从参数中读取/
feeRate/fixedFee并应用公式计算minFee
Question 3 — Am I set up for a transaction?
问题3 — 我是否已准备好进行交易?
- "Am I whitelisted?" →
digift whitelist <address> --chain <chain-id> - "Check my balance of TOKEN" →
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>] - "Check my order status" →
digift order <txhash> - "My order history" →
digift orders <address> [--project <project>] [--size <n>]
- "我是否在白名单中?" →
digift whitelist <address> --chain <chain-id> - "查看我持有的TOKEN余额" →
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>] - "查看我的订单状态" →
digift order <txhash> - "我的订单历史" →
digift orders <address> [--project <project>] [--size <n>]
Question 4 — Build a transaction
问题4 — 构建交易
- Check tradability → (verify
digift products/isSubscribable)isRedeemable - Check whitelist →
digift whitelist <address> --chain <chain-id> - Check balance →
digift balance <token> <address> --chain <chain-id> - Build transaction → /
digift subscribe/digift redeemdigift approve - Check in output → broadcast approval first if present
needsApprove
- 检查可交易性 → (验证
digift products/isSubscribable)isRedeemable - 检查白名单 →
digift whitelist <address> --chain <chain-id> - 检查余额 →
digift balance <token> <address> --chain <chain-id> - 构建交易 → /
digift subscribe/digift redeemdigift approve - 检查输出中的→ 若存在,先广播授权交易
needsApprove
Quick Reference
快速参考
Query commands (at a glance)
查询命令一览
| User says | CLI command |
|---|---|
| "what products are available" / "list RWA tokens" | |
| "what chains does DigiFT support" / "contract addresses" | |
| "EXAMPLE token address / precision / chain info" | |
| "who issues EXAMPLE" / "ISIN / issuance details" | |
| "subscription rules for EXAMPLE" / "subscribe fee / min / max" | |
| "redemption rules for EXAMPLE" / "redeem fee / min / max" | |
| "when will my order settle" / "settlement cycle / holidays" | |
| "what's the price / yield of EXAMPLE" | |
| "price history for EXAMPLE" | |
| "is 0x... whitelisted" / "check whitelist" | |
| "order status for tx 0x..." / "has my order settled" | |
| "my order history" / "list orders for 0x..." | |
| 用户需求 | CLI命令 |
|---|---|
| "有哪些可用产品" / "列出RWA代币" | |
| "DigiFT支持哪些链" / "合约地址" | |
| "EXAMPLE代币地址/精度/链信息" | |
| "谁发行了EXAMPLE" / "ISIN/发行详情" | |
| "EXAMPLE的订阅规则" / "订阅手续费/最低/最高限额" | |
| "EXAMPLE的赎回规则" / "赎回手续费/最低/最高限额" | |
| "我的订单何时结算" / "结算周期/节假日" | |
| "EXAMPLE的价格/收益率是多少" | |
| "EXAMPLE的价格历史" | |
| "0x...是否在白名单中" / "检查白名单" | |
| "交易0x...的订单状态" / "我的订单是否已结算" | |
| "我的订单历史" / "列出0x...的订单" | |
On-chain commands (at a glance)
链上命令一览
| User says | CLI command |
|---|---|
| "check balance of USDC for 0x..." / "how much EXAMPLE does 0x... have" | |
| "subscribe 1000 USDC to EXAMPLE" / "buy EXAMPLE" | |
| "redeem 100 EXAMPLE" / "sell EXAMPLE" | |
| "approve USDC for contract 0x..." / "authorize spending" | |
| 用户需求 | CLI命令 |
|---|---|
| "查看0x...的USDC余额" / "0x...持有多少EXAMPLE" | |
| "用1000 USDC订阅EXAMPLE" / "买入EXAMPLE" | |
| "赎回100 EXAMPLE" / "卖出EXAMPLE" | |
| "授权合约0x...使用USDC" / "授权支出" | |
Core Concepts
核心概念
API is the single source of truth
API是唯一数据源
All chain configurations, contract addresses, token addresses, fee structures, and parameters come from the REST API. Never hardcode values. No fallback hardcoded addresses.
所有链配置、合约地址、代币地址、手续费结构及参数均来自REST API。切勿硬编码任何值。无备用硬编码地址。
Token codes vs addresses
代币代码vs地址
Products are identified by token codes (e.g., ). On-chain addresses are resolved by querying for ST tokens or for currencies. The CLI handles resolution automatically via .
EXAMPLE/products/{tokenCode}/chains/platform/chainsresolveToken()Resolution order:
- If input is a valid address → use as-is
0x... - Query → ST token address
/products/{code}/chains - Query → currency address (USDC, etc.)
/platform/chains - Error if nothing matches
产品通过代币代码标识(例如)。链上地址通过查询ST代币的或货币的获取。CLI通过自动处理地址解析。
EXAMPLE/products/{tokenCode}/chains/platform/chainsresolveToken()解析顺序:
- 若输入为有效的地址 → 直接使用
0x... - 查询→ ST代币地址
/products/{code}/chains - 查询→ 货币地址(如USDC等)
/platform/chains - 无匹配项则报错
Precision — on-chain vs API display
精度 — 链上vs API显示
⚠️ Critical: The API'sfields (precision,pricePrecision,stPrecision) are price/display precisions only. They describe how values are formatted in the UI. Do NOT use these fordecimalor on-chain amount conversion. Always read the actualethers.parseUnits()from the ERC20 contract on-chain. The CLI handles this automatically — you never need to read API precision fields manually.decimals()
⚠️ 重点: API的字段(precision、pricePrecision、stPrecision)仅用于价格/显示精度,描述UI中的值格式。请勿将其用于decimal或链上金额转换。始终从链上ERC20合约读取实际的ethers.parseUnits()值。CLI会自动处理此操作——无需手动读取API精度字段。decimals()
Trading calendar
交易日历
- Tradability is determined by /
isSubscribableonisRedeemable, not by the calendar.digift products - The calendar tells you when settlement occurs after a trade.
- Settlement follows a business-day calendar with configurable cycle (e.g., ).
T+1 - When is
unit, settlement skips weekends and holidays.BUSINESS_DAY - When is
unit, settlement occurs after N calendar days regardless.CALENDAR_DAY
- 可交易性由中的
digift products/isSubscribable决定,而非日历。isRedeemable - 日历告知用户交易后的结算时间。
- 结算遵循工作日日历,周期可配置(例如)。
T+1 - 当为
unit时,结算跳过周末和节假日。BUSINESS_DAY - 当为
unit时,无论是否为节假日,均在N个日历日后结算。CALENDAR_DAY
Fee structure
手续费结构
Every subscription/redemption config has: + + + .
feeRatefixedFeeminFeegstFormula:
Fee = max(amount × feeRate + fixedFee, minFee)- All math uses — no floating-point on monetary values.
bigint - Fee rate is a decimal (e.g., = 0.1%), not a percentage.
"0.001" - is display-only — not used in fee computation.
gst - Subscribe: user pays ; the
amount + feecontract parameter includes the fee.subscribe() - Redeem: fee is informational (deducted from settlement proceeds on-chain).
每个订阅/赎回配置包含: + + + 。
feeRatefixedFeeminFeegst公式:
手续费 = max(金额 × 费率 + 固定手续费, 最低手续费)- 所有计算使用——货币值不使用浮点数。
bigint - 费率为小数(例如= 0.1%),而非百分比。
"0.001" - 仅用于显示——不参与手续费计算。
gst - 订阅: 用户支付;
金额 + 手续费合约参数包含手续费。subscribe() - 赎回: 手续费仅为参考信息——会从链上结算收益中扣除。
TxBody — the standardized output
TxBody — 标准化输出
All on-chain commands output a payload. This skill never signs or broadcasts — any EVM wallet can sign and broadcast the .
TxBodyTxBodyjson
{
"to": "0x...",
"from": "0x...",
"data": "0x...",
"value": "0",
"deadline": 1716200000,
"description": "DigiFT subscribe: ..."
}| Field | Description |
|---|---|
| Target contract address |
| Sender address |
| ABI-encoded function calldata |
| Native token value (always |
| Expiry timestamp (now + 30 minutes) — reverts if submitted after |
| Human-readable summary |
所有链上命令输出负载。本技能绝不签名或广播——任何EVM钱包均可对进行签名和广播。
TxBodyTxBodyjson
{
"to": "0x...",
"from": "0x...",
"data": "0x...",
"value": "0",
"deadline": 1716200000,
"description": "DigiFT subscribe: ..."
}| 字段 | 描述 |
|---|---|
| 目标合约地址 |
| 发送方地址 |
| ABI编码的函数调用数据 |
| 原生代币金额(DigiFT操作始终为 |
| 过期时间戳(当前时间+30分钟)——超过该时间提交会回滚 |
| 人类可读的摘要 |
Approve before action
操作前需授权
ERC20 tokens require the spender (SubRed contract) to be approved before subscribe/redeem. The CLI automatically checks allowance and outputs if needed:
needsApprove- Subscribe: checks allowance on the currency token (e.g., USDC) for the SubRed contract
- Redeem: checks allowance on the ST token for the SubRed contract
If is present, broadcast the approval TxBody first, wait for confirmation, then broadcast the main TxBody.
needsApproveERC20代币要求支出方(SubRed合约)在订阅/赎回前获得授权。CLI会自动检查额度,若需要则输出:
needsApprove- 订阅: 检查SubRed合约对货币代币(如USDC)的额度
- 赎回: 检查SubRed合约对ST代币的额度
若存在,需先广播授权TxBody,等待确认后再广播主TxBody。
needsApproveStandard methods only
仅支持标准方法
Currently only and are supported. Flash subscription/redemption methods exist in the API but are not used by the CLI.
STANDARD_SUBSCRIPTIONSTANDARD_REDEMPTION目前仅支持和。API中存在闪兑订阅/赎回方法,但CLI不使用。
STANDARD_SUBSCRIPTIONSTANDARD_REDEMPTIONDeadline
过期时间
Every transaction includes a timestamp (30 minutes from build time). Transactions submitted after the deadline will revert. The user must broadcast within 30 minutes.
deadline每笔交易均包含时间戳(构建时间+30分钟)。超过过期时间提交的交易会回滚。用户必须在30分钟内广播交易。
deadlineCommands
命令
Query Commands
查询命令
All query commands are read-only — no wallet, no private key, no RPC endpoint required.
所有查询命令均为只读——无需钱包、私钥或RPC端点。
digift products
digift productsdigift products
digift productsList all available RWA products.
bash
digift productsOutput: array of . If no products, outputs
{ tokenCode, projectName, assetType, isSubscribable, isRedeemable }No products found.列出所有可用的RWA产品。
bash
digift products输出:数组。若无产品,输出
{ tokenCode, projectName, assetType, isSubscribable, isRedeemable }No products found.digift chains
digift chainsdigift chains
digift chainsPlatform chain configuration, contract addresses, and supported currencies.
bash
digift chainsKey fields: , , , .
chainIdchainNamestandardSubRedContractAddresscurrencies[]平台链配置、合约地址及支持的货币。
bash
digift chains关键字段:、、、。
chainIdchainNamestandardSubRedContractAddresscurrencies[]digift info <tokencode>
digift info <tokencode>digift info <tokencode>
digift info <tokencode>Product-specific chain info — ST token address and precision on each deployed chain.
bash
digift info EXAMPLE产品特定的链信息——ST代币在各部署链上的地址和精度。
bash
digift info EXAMPLEdigift issuance <tokencode>
digift issuance <tokencode>digift issuance <tokencode>
digift issuance <tokencode>Product issuance details — issuer, ISIN, issue date, highlights.
bash
digift issuance EXAMPLE产品发行详情——发行方、ISIN、发行日期、重点信息。
bash
digift issuance EXAMPLEdigift sub-params <tokencode>
digift sub-params <tokencode>digift sub-params <tokencode>
digift sub-params <tokencode>Subscription parameters — fees, min/max, increment per chain and method.
bash
digift sub-params EXAMPLEValidation rules:
- Amount must be and
>= min<= max - Amount must be a multiple of
increment - Fee =
max(amount × feeRate + fixedFee, minFee)
订阅参数——各链和方法的手续费、最低/最高限额、增量。
bash
digift sub-params EXAMPLE验证规则:
- 金额必须且
>= 最低限额<= 最高限额 - 金额必须是的倍数
增量 - 手续费 =
max(金额 × 费率 + 固定手续费, 最低手续费)
digift red-params <tokencode>
digift red-params <tokencode>digift red-params <tokencode>
digift red-params <tokencode>Redemption parameters — same structure as subscription.
bash
digift red-params EXAMPLE赎回参数——结构与订阅参数相同。
bash
digift red-params EXAMPLEdigift calendar <tokencode> [--type sub|red]
digift calendar <tokencode> [--type sub|red]digift calendar <tokencode> [--type sub|red]
digift calendar <tokencode> [--type sub|red]Trading calendar and settlement schedule.
bash
digift calendar EXAMPLE --type sub交易日历和结算时间表。
bash
digift calendar EXAMPLE --type subdigift price <tokencode>
digift price <tokencode>digift price <tokencode>
digift price <tokencode>Current indicative price and yield.
bash
digift price EXAMPLE⚠️ Prices are indicative — the actual settlement price may differ.
Yield types: =Non-yield, =Yield to Maturity, =7-Day Annualized, =1-Year Floating, =Redemption Yield.
01234当前指示性价格和收益率。
bash
digift price EXAMPLE⚠️ 价格仅为指示性——实际结算价格可能不同。
收益率类型: =无收益, =到期收益率, =7天年化收益率, =1年期浮动收益率, =赎回收益率。
01234digift price-history <tokencode>
digift price-history <tokencode>digift price-history <tokencode>
digift price-history <tokencode>Historical price data.
bash
digift price-history EXAMPLE历史价格数据。
bash
digift price-history EXAMPLEdigift order <txhash>
digift order <txhash>digift order <txhash>
digift order <txhash>Look up a single order by transaction hash. Tries subscription first, then redemption.
bash
digift order 0x...Order statuses: → → → → (or / ).
PendingSubmittedAllocatingConfirmShareCompletedCancelledRefunded通过交易哈希查询单个订单。先尝试查询订阅订单,再查询赎回订单。
bash
digift order 0x...订单状态: → → → → (或 / )。
PendingSubmittedAllocatingConfirmShareCompletedCancelledRefundeddigift orders <address> [--project <project>] [--size <n>]
digift orders <address> [--project <project>] [--size <n>]digift orders <address> [--project <project>] [--size <n>]
digift orders <address> [--project <project>] [--size <n>]Paginated order history for a wallet address.
bash
digift orders 0x... --project EXAMPLE --size 10钱包地址的分页订单历史。
bash
digift orders 0x... --project EXAMPLE --size 10On-Chain Commands
链上命令
All on-chain commands require an RPC endpoint (via flag, env, or built-in fallback).
--chain <chain-id>--rpcDIGIFT_RPC_URL所有链上命令需指定和RPC端点(通过标志、环境变量或内置备用端点)。
--chain <chain-id>--rpcDIGIFT_RPC_URLdigift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]Check on-chain ERC20 token balance.
bash
digift balance USDC 0x... --chain 1检查链上ERC20代币余额。
bash
digift balance USDC 0x... --chain 1digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]Build an unsigned subscribe transaction. The CLI performs all pre-flight checks automatically:
- Fetch chain info and connect to RPC
- Get ST token address from API
- Get subscription parameters, match config for requested currency
- Validate amount against min/max/increment
- Check whitelist status
- Check on-chain currency balance (must cover amount + fee)
- Calculate fee (bigint arithmetic)
- Build subscribe TxBody
- Check allowance on currency token → outputs if insufficient
needsApprove
bash
digift subscribe --product EXAMPLE --amount 1000 --from 0x... --chain 1 --currency USDCKey details:
- Contract parameter = subscription amount + fee
amount - Amount uses currency on-chain decimals (read from ERC20, not API)
- Allowance checked on currency token for SubRed contract
构建未签名的订阅交易。CLI会自动执行所有预检查:
- 获取链信息并连接到RPC
- 从API获取ST代币地址
- 获取订阅参数,匹配请求货币的配置
- 验证金额是否符合最低/最高限额/增量要求
- 检查白名单状态
- 检查链上货币余额(必须覆盖金额+手续费)
- 计算手续费(bigint算术)
- 构建订阅TxBody
- 检查货币代币的额度 → 若不足则输出
needsApprove
bash
digift subscribe --product EXAMPLE --amount 1000 --from 0x... --chain 1 --currency USDC关键细节:
- 合约参数= 订阅金额 + 手续费
amount - 金额使用链上货币的小数位数(从ERC20读取,而非API)
- 检查SubRed合约对货币代币的额度
digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]Build an unsigned redeem transaction.
bash
digift redeem --product EXAMPLE --quantity 100 --from 0x... --chain 1 --currency USDCKey differences from subscribe:
| Aspect | Subscribe | Redeem |
|---|---|---|
| Contract parameter | | |
| Amount precision | Currency on-chain decimals | ST token on-chain decimals |
| Fee handling | User pays amount + fee | Fee is informational; deducted from proceeds |
| Balance check | Currency balance ≥ amount + fee | ST token balance ≥ quantity |
| Allowance check | Currency allowance ≥ amount + fee | ST token allowance ≥ quantity |
构建未签名的赎回交易。
bash
digift redeem --product EXAMPLE --quantity 100 --from 0x... --chain 1 --currency USDC与订阅的关键区别:
| 方面 | 订阅 | 赎回 |
|---|---|---|
| 合约参数 | | |
| 金额精度 | 链上货币的小数位数 | 链上ST代币的小数位数 |
| 手续费处理 | 用户支付金额+手续费 | 手续费仅为参考;从收益中扣除 |
| 余额检查 | 货币余额 ≥ 金额+手续费 | ST代币余额 ≥ 数量 |
| 额度检查 | 货币额度 ≥ 金额+手续费 | ST代币额度 ≥ 数量 |
digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]
digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]
digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]Build an ERC20 approve transaction.
bash
digift approve --token USDC --spender 0x... --amount 1000 --from 0x... --chain 1Prefer exact-amount approvals over unlimited ().type(uint256).max
构建ERC20授权交易。
bash
digift approve --token USDC --spender 0x... --amount 1000 --from 0x... --chain 1优先选择精确金额授权,而非无限授权()。type(uint256).max
Fee Calculation
手续费计算
Formula:
Fee = max(amount × feeRate + fixedFee, minFee)| Field | Type | Example | Description |
|---|---|---|---|
| | | Decimal rate (0.1%) |
| | | Fixed fee in currency units |
| | | Minimum fee floor |
| | | GST — display-only, not used in computation |
- For subscriptions, user pays — verify wallet balance covers the total.
amount + fee - For redemptions, fee is informational — the contract deducts it from settlement proceeds.
公式:
手续费 = max(金额 × 费率 + 固定手续费, 最低手续费)| 字段 | 类型 | 示例 | 描述 |
|---|---|---|---|
| | | 小数费率(0.1%) |
| | | 货币单位的固定手续费 |
| | | 最低手续费下限 |
| | | GST——仅用于显示,不参与计算 |
- 订阅时,用户支付——需验证钱包余额覆盖总计。
金额 + 手续费 - 赎回时,手续费仅为参考——合约会从结算收益中扣除。
Error Handling
错误处理
| Symptom / message | Cause | Resolution |
|---|---|---|
| Env var missing or invalid | Ask the user to |
| Binary not installed | Re-run |
| Token code typo, or product delisted | Run |
| Trading window closed for that product | Show the user the next trading window from |
| KYC not completed for this wallet+chain | Direct the user to DigiFT's KYC flow; do not build the TxBody. |
| Wallet | Show the user the shortfall amount; let them adjust |
| Spender allowance < amount | Run |
| TxBody older than 30 minutes | Rebuild the TxBody (re-run |
| Public RPC unreachable or rate-limited | Retry with |
| Tx not yet indexed or wrong hash | Wait a few seconds and retry; verify the user pasted the correct hash. |
| 症状/消息 | 原因 | 解决方法 |
|---|---|---|
| 环境变量缺失或无效 | 请用户在当前shell中执行 |
| 二进制文件未安装 | 重新运行 |
| 代币代码输入错误,或产品已下架 | 运行 |
| 该产品的交易窗口已关闭 | 向用户展示 |
| 该钱包+链未完成KYC | 引导用户完成DigiFT的KYC流程;请勿构建TxBody。 |
| 钱包余额不足以支付 | 向用户展示差额;让用户调整 |
| 支出方额度 < 金额 | 先运行 |
| TxBody已超过30分钟 | 重新构建TxBody(重新运行 |
| 公共RPC无法访问或受限 | 使用 |
| 交易尚未索引或哈希错误 | 等待几秒后重试;验证用户粘贴的哈希是否正确。 |
Security Notices
安全须知
- NEVER sign or broadcast transactions — this skill only builds payloads.
TxBody - NEVER handle or access private keys.
- NEVER hardcode contract addresses, chain IDs, or decimals — all data comes from the API.
- NEVER display or log API keys. If a user shares one, warn them and advise rotation.
- ALWAYS load API keys from environment variables only.
- ALWAYS check whitelist status before building subscribe/redeem.
- ALWAYS verify token balance before building a transaction.
- ALWAYS broadcast approval TxBody before the main TxBody if is present.
needsApprove - Prefer exact-amount approvals over unlimited ().
type(uint256).max - Transaction deadline is 30 minutes — user must broadcast promptly or it reverts.
- Do NOT provide investment advice — only present factual data.
- 绝不签名或广播交易——本技能仅构建负载。
TxBody - 绝不处理或访问私钥。
- 绝不硬编码合约地址、链ID或小数位数——所有数据均来自API。
- 绝不显示或记录API密钥。若用户分享密钥,需警告并建议其轮换密钥。
- 仅从环境变量加载API密钥。
- 构建订阅/赎回交易前,始终检查白名单状态。
- 构建交易前,始终验证代币余额。
- 若存在,始终先广播授权TxBody,再广播主TxBody。
needsApprove - 优先选择精确金额授权,而非无限授权()。
type(uint256).max - 交易过期时间为30分钟——用户必须及时广播,否则交易会回滚。
- 请勿提供投资建议——仅提供事实数据。
Best Practices
最佳实践
- ALWAYS query the API for data — never hardcode addresses, chain IDs, or decimals.
- ALWAYS check /
isSubscribablebefore suggesting subscription or redemption.isRedeemable - Follow the pre-flight checklist for subscribe/redeem: tradability → parameters → whitelist → balance → allowance → build.
- Wait for approval confirmation before broadcasting the main transaction.
- 始终从API查询数据——绝不硬编码地址、链ID或小数位数。
- 建议订阅或赎回前,始终检查/
isSubscribable。isRedeemable - 订阅/赎回遵循预执行清单:可交易性 → 参数 → 白名单 → 余额 → 额度 → 构建。
- 等待授权确认后,再广播主交易。
Onchain OS routing instructions (read before executing any tool)
Onchain OS路由说明(执行任何工具前阅读)
pending_sign mapping
pending_sign映射
Every on-chain command outputs JSON containing a . Convert per:
digifttxBodydigift CLI output → pending_sign
────────────────────────────────────────────────
txBody.to → unsigned_tx.to
txBody.data → unsigned_tx.data
txBody.value → unsigned_tx.value ("0")
txBody.from → (not used in pending_sign)
chainId from output → unsigned_tx.chain (just the number, e.g. "1")
txBody.description → description每个链上命令输出包含的JSON。按以下规则转换:
digifttxBodydigift CLI输出 → pending_sign
────────────────────────────────────────────────
txBody.to → unsigned_tx.to
txBody.data → unsigned_tx.data
txBody.value → unsigned_tx.value ("0")
txBody.from → (pending_sign中不使用)
chainId from output → unsigned_tx.chain (仅数字,例如"1")
txBody.description → descriptionnext_action.tool mapping
next_action.tool映射
| Operation | next_action.tool |
|---|---|
| subscribe, redeem, approve | |
| 操作 | next_action.tool |
|---|---|
| subscribe, redeem, approve | |
Approve-before-action sequence (Onchain OS)
操作前授权流程(Onchain OS)
When is present, execute two cycles:
needsApprovepending_sign⚠️is NOT a pre-built TxBody. It is a parameter tripleneedsApprove. Run{token, spender, amount}separately.digift approve
Step 1 — Approve:
- Extract ,
needsApprove.token,.spender.amount - Run
digift approve --token <token> --spender <spender> --amount <amount> --from <address> --chain <chain-id> - Wrap in
txBody, route topending_signonchainos wallet contract-call - Wait for confirmation
Step 2 — Main transaction:
- Run the original /
digift subscribecommanddigift redeem - Wrap in
txBody, route topending_signonchainos wallet contract-call
当存在时,执行两个周期:
needsApprovepending_sign⚠️并非预构建的TxBody。它是一个三元参数needsApprove。需单独运行{token, spender, amount}。digift approve
步骤1 — 授权:
- 提取、
needsApprove.token、.spender.amount - 运行
digift approve --token <token> --spender <spender> --amount <amount> --from <address> --chain <chain-id> - 将包装到
txBody中,路由到pending_signonchainos wallet contract-call - 等待确认
步骤2 — 主交易:
- 运行原/
digift subscribe命令digift redeem - 将包装到
txBody中,路由到pending_signonchainos wallet contract-call
pending_sign contract (reference)
pending_sign合约(参考)
typescript
type PendingSign = {
status: 'pending_sign';
unsigned_tx: {
to: string; // target contract address
data: string; // ABI-encoded calldata
value: string; // native token amount (always "0" for DigiFT)
chain: string; // chain ID (from CLI output's chainId field)
};
description: string; // human-readable summary
next_action: { tool: string; reason?: string };
};typescript
type PendingSign = {
status: 'pending_sign';
unsigned_tx: {
to: string; // target contract address
data: string; // ABI-encoded calldata
value: string; // native token amount (always "0" for DigiFT)
chain: string; // chain ID (from CLI output's chainId field)
};
description: string; // human-readable summary
next_action: { tool: string; reason?: string };
};Broadcasting
广播
Onchain OS handles both signing AND broadcasting internally via . Do NOT attempt to broadcast separately.
onchainos wallet contract-callOnchain OS通过内部处理签名和广播。请勿尝试单独广播。
onchainos wallet contract-callRuntime LLM MUST read
运行时LLM必须阅读
The transaction commands output unsigned JSON. Do NOT instruct the user to "broadcast with your wallet." Instead:
TxBody- Parse the CLI JSON output
- Convert to
txBodyper the mapping abovepending_sign - Return to the routing layer
pending_sign - Onchain OS takes over signing + broadcasting via
onchainos wallet contract-call
交易命令输出未签名的 JSON。请勿指示用户“用你的钱包广播”。请按以下步骤操作:
TxBody- 解析CLI的JSON输出
- 按上述映射将转换为
txBodypending_sign - 将返回给路由层
pending_sign - Onchain OS通过接管签名和广播
onchainos wallet contract-call