digift-plugin

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Live Trading Confirmation Protocol

实盘交易确认协议

These gates are mandatory before any
pending_sign
that results in an on-chain transaction (subscribe, redeem, approve):
  1. 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.
  2. Live-mode switch requires typed confirmation. Before the first on-chain transaction in a session, display: wallet address (
    onchainos wallet addresses
    ), current balance (
    onchainos wallet balance
    ), and a statement that on-chain transactions are irreversible. The user MUST reply with an unambiguous typed confirmation (e.g.
    confirm live mode
    /
    确认开启实盘
    ).
  3. 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.
  4. No stale submissions. Never re-submit a previously built TxBody across sessions. Each session's
    pending_sign
    must be freshly built.
  5. 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
操作之前,必须遵循以下校验规则:
  1. 每笔写入操作前预览。所有链上操作必须先展示预览信息:产品、金额、链、手续费及总计。用户必须确认后才能继续。
  2. 实盘模式切换需输入确认。在会话中首次执行链上交易前,需展示:钱包地址(
    onchainos wallet addresses
    )、当前余额(
    onchainos wallet balance
    ),以及链上交易不可撤销的声明。用户必须输入明确的确认内容(例如
    confirm live mode
    /
    确认开启实盘
    )。
  3. 会话自主性受限。会话级确认后,代理可在用户明确意图的范围内自主操作。当意图不明确时,需暂停并确认。
  4. 禁止提交过期内容。切勿跨会话重新提交之前构建的TxBody。每个会话的
    pending_sign
    必须重新构建。
  5. 校验失败则拒绝操作。若任何校验规则无法满足,需拒绝写入操作并说明哪条规则未通过。
无论用户看起来多么确定要授权写入操作,本协议均适用。当前会话内的输入确认是唯一有效的授权方式。

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
raw.githubusercontent.com
— it does not install anything. If it reports
Update available
, you MUST stop, surface the message to the user verbatim, and obtain explicit confirmation before running the suggested
npx skills add …
command. Do not run the update silently. After a confirmed update completes, re-read this SKILL.md before proceeding.
bash
undefined
AI Agent指令:执行本技能的任何命令前,先运行此版本检查。该检查仅从
raw.githubusercontent.com
进行只读获取——不会安装任何内容。如果提示
Update available
,必须停止操作,将消息原封不动告知用户,并在运行建议的
npx skills add …
命令前获得明确确认。请勿静默执行更新。确认更新完成后,重新阅读本SKILL.md再继续。
bash
undefined

Check 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.

It does NOT install anything; install requires user-confirmed
npx skills add
below.

UPDATE_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
undefined
UPDATE_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
undefined

Install onchainos CLI + Skills (auto-injected)

安装onchainos CLI + Skills(自动注入)

bash
undefined
bash
undefined

1. 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
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"
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
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"
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
undefined
npx skills add okx/plugin-store --skill plugin-store --yes --global
undefined

Install digift npm package (auto-injected)

安装digift npm包(自动注入)

bash
undefined
bash
undefined

Verify 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

.github/workflows/plugin-publish.yml which uploads
digift.tgz

alongside
checksums.txt
under each release tag.

alongside
checksums.txt
under each release tag.

PKG_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

Robust asset download. Prefer
gh release download
— see rust/go

install 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>
path if gh is not installed.

_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" }
_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" }
_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

Install globally (npm wires up CLI commands from package.json's
bin
field) + clean up

npm 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
digift
CLI is the unified interface to the DigiFT RWA platform. It covers two domains:
  • 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
    TxBody
    payloads. Never signs or broadcasts.
All contract addresses, token addresses, and chain configurations come from the API — query first, act second.
digift
CLI是DigiFT RWA平台的统一交互接口,涵盖两大领域:
  • 数据查询——产品、价格、手续费、参数、日历、白名单、订单。所有数据均来自REST API,无硬编码内容。
  • 链上操作——构建订阅/赎回/授权交易。输出标准化的
    TxBody
    负载。绝不签名或广播交易
所有合约地址、代币地址及链配置均来自API——先查询,再操作。

Pre-flight Checks

预执行检查

Verify the
digift
binary is installed

验证
digift
二进制文件已安装

bash
digift --version
The 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 --global
bash
digift --version
该二进制文件由插件商店的预执行模块自动安装(见上方自动注入部分)。若缺失,重新运行安装命令:
bash
npx skills add okx/plugin-store --skill digift-plugin --global

Verify the
DIGIFT_API_KEY
environment variable is set

验证
DIGIFT_API_KEY
环境变量已设置

VariableRequiredDescription
DIGIFT_API_KEY
YesAPI 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.
变量是否必填描述
DIGIFT_API_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
  • "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
    isSubscribable
    /
    isRedeemable
    on
    digift products
  • "When will my order settle?" →
    digift calendar EXAMPLE [--type sub|red]
  • "Calculate fee for 1000 USDC" → Read
    feeRate
    /
    fixedFee
    /
    minFee
    from params and apply formula
  • "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 — 构建交易

  1. Check tradability
    digift products
    (verify
    isSubscribable
    /
    isRedeemable
    )
  2. Check whitelist
    digift whitelist <address> --chain <chain-id>
  3. Check balance
    digift balance <token> <address> --chain <chain-id>
  4. Build transaction
    digift subscribe
    /
    digift redeem
    /
    digift approve
  5. Check
    needsApprove
    in output → broadcast approval first if present

  1. 检查可交易性
    digift products
    (验证
    isSubscribable
    /
    isRedeemable
  2. 检查白名单
    digift whitelist <address> --chain <chain-id>
  3. 检查余额
    digift balance <token> <address> --chain <chain-id>
  4. 构建交易
    digift subscribe
    /
    digift redeem
    /
    digift approve
  5. 检查输出中的
    needsApprove
    → 若存在,先广播授权交易

Quick Reference

快速参考

Query commands (at a glance)

查询命令一览

User saysCLI command
"what products are available" / "list RWA tokens"
digift products
"what chains does DigiFT support" / "contract addresses"
digift chains
"EXAMPLE token address / precision / chain info"
digift info EXAMPLE
"who issues EXAMPLE" / "ISIN / issuance details"
digift issuance EXAMPLE
"subscription rules for EXAMPLE" / "subscribe fee / min / max"
digift sub-params EXAMPLE
"redemption rules for EXAMPLE" / "redeem fee / min / max"
digift red-params EXAMPLE
"when will my order settle" / "settlement cycle / holidays"
digift calendar EXAMPLE [--type sub|red]
"what's the price / yield of EXAMPLE"
digift price EXAMPLE
"price history for EXAMPLE"
digift price-history EXAMPLE
"is 0x... whitelisted" / "check whitelist"
digift whitelist <address> --chain <chain-id>
"order status for tx 0x..." / "has my order settled"
digift order <txhash>
"my order history" / "list orders for 0x..."
digift orders <address> [--project <project>] [--size <n>]
用户需求CLI命令
"有哪些可用产品" / "列出RWA代币"
digift products
"DigiFT支持哪些链" / "合约地址"
digift chains
"EXAMPLE代币地址/精度/链信息"
digift info EXAMPLE
"谁发行了EXAMPLE" / "ISIN/发行详情"
digift issuance EXAMPLE
"EXAMPLE的订阅规则" / "订阅手续费/最低/最高限额"
digift sub-params EXAMPLE
"EXAMPLE的赎回规则" / "赎回手续费/最低/最高限额"
digift red-params EXAMPLE
"我的订单何时结算" / "结算周期/节假日"
digift calendar EXAMPLE [--type sub|red]
"EXAMPLE的价格/收益率是多少"
digift price EXAMPLE
"EXAMPLE的价格历史"
digift price-history EXAMPLE
"0x...是否在白名单中" / "检查白名单"
digift whitelist <address> --chain <chain-id>
"交易0x...的订单状态" / "我的订单是否已结算"
digift order <txhash>
"我的订单历史" / "列出0x...的订单"
digift orders <address> [--project <project>] [--size <n>]

On-chain commands (at a glance)

链上命令一览

User saysCLI command
"check balance of USDC for 0x..." / "how much EXAMPLE does 0x... have"
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]
"subscribe 1000 USDC to EXAMPLE" / "buy EXAMPLE"
digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
"redeem 100 EXAMPLE" / "sell EXAMPLE"
digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
"approve USDC for contract 0x..." / "authorize spending"
digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]

用户需求CLI命令
"查看0x...的USDC余额" / "0x...持有多少EXAMPLE"
digift balance <token> <address> --chain <chain-id> [--rpc <rpc-url>]
"用1000 USDC订阅EXAMPLE" / "买入EXAMPLE"
digift subscribe --product <tokencode> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
"赎回100 EXAMPLE" / "卖出EXAMPLE"
digift redeem --product <tokencode> --quantity <n> --from <address> --chain <chain-id> [--rpc <rpc-url>] [--currency <currency>]
"授权合约0x...使用USDC" / "授权支出"
digift approve --token <address> --spender <address> --amount <n> --from <address> --chain <chain-id> [--rpc <rpc-url>]

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.,
EXAMPLE
). On-chain addresses are resolved by querying
/products/{tokenCode}/chains
for ST tokens or
/platform/chains
for currencies. The CLI handles resolution automatically via
resolveToken()
.
Resolution order:
  1. If input is a valid
    0x...
    address → use as-is
  2. Query
    /products/{code}/chains
    → ST token address
  3. Query
    /platform/chains
    → currency address (USDC, etc.)
  4. Error if nothing matches
产品通过代币代码标识(例如
EXAMPLE
)。链上地址通过查询ST代币的
/products/{tokenCode}/chains
或货币的
/platform/chains
获取。CLI通过
resolveToken()
自动处理地址解析。
解析顺序:
  1. 若输入为有效的
    0x...
    地址 → 直接使用
  2. 查询
    /products/{code}/chains
    → ST代币地址
  3. 查询
    /platform/chains
    → 货币地址(如USDC等)
  4. 无匹配项则报错

Precision — on-chain vs API display

精度 — 链上vs API显示

⚠️ Critical: The API's
precision
fields (
pricePrecision
,
stPrecision
,
decimal
) are price/display precisions only. They describe how values are formatted in the UI. Do NOT use these for
ethers.parseUnits()
or on-chain amount conversion. Always read the actual
decimals()
from the ERC20 contract on-chain. The CLI handles this automatically — you never need to read API precision fields manually.
⚠️ 重点: API的
precision
字段(
pricePrecision
stPrecision
decimal
)仅用于价格/显示精度,描述UI中的值格式。请勿将其用于
ethers.parseUnits()
或链上金额转换。始终从链上ERC20合约读取实际的
decimals()
值。CLI会自动处理此操作——无需手动读取API精度字段。

Trading calendar

交易日历

  • Tradability is determined by
    isSubscribable
    /
    isRedeemable
    on
    digift products
    , not by the calendar.
  • The calendar tells you when settlement occurs after a trade.
  • Settlement follows a business-day calendar with configurable cycle (e.g.,
    T+1
    ).
  • When
    unit
    is
    BUSINESS_DAY
    , settlement skips weekends and holidays.
  • When
    unit
    is
    CALENDAR_DAY
    , settlement occurs after N calendar days regardless.
  • 可交易性由
    digift products
    中的
    isSubscribable
    /
    isRedeemable
    决定,而非日历。
  • 日历告知用户交易后的结算时间
  • 结算遵循工作日日历,周期可配置(例如
    T+1
    )。
  • unit
    BUSINESS_DAY
    时,结算跳过周末和节假日。
  • unit
    CALENDAR_DAY
    时,无论是否为节假日,均在N个日历日后结算。

Fee structure

手续费结构

Every subscription/redemption config has:
feeRate
+
fixedFee
+
minFee
+
gst
.
Formula:
Fee = max(amount × feeRate + fixedFee, minFee)
  • All math uses
    bigint
    — no floating-point on monetary values.
  • Fee rate is a decimal (e.g.,
    "0.001"
    = 0.1%), not a percentage.
  • gst
    is display-only — not used in fee computation.
  • Subscribe: user pays
    amount + fee
    ; the
    subscribe()
    contract parameter includes the fee.
  • Redeem: fee is informational (deducted from settlement proceeds on-chain).
每个订阅/赎回配置包含:
feeRate
+
fixedFee
+
minFee
+
gst
公式:
手续费 = max(金额 × 费率 + 固定手续费, 最低手续费)
  • 所有计算使用
    bigint
    ——货币值不使用浮点数。
  • 费率为小数(例如
    "0.001"
    = 0.1%),而非百分比。
  • gst
    仅用于显示——不参与手续费计算。
  • 订阅: 用户支付
    金额 + 手续费
    subscribe()
    合约参数包含手续费。
  • 赎回: 手续费仅为参考信息——会从链上结算收益中扣除。

TxBody — the standardized output

TxBody — 标准化输出

All on-chain commands output a
TxBody
payload. This skill never signs or broadcasts — any EVM wallet can sign and broadcast the
TxBody
.
json
{
  "to": "0x...",
  "from": "0x...",
  "data": "0x...",
  "value": "0",
  "deadline": 1716200000,
  "description": "DigiFT subscribe: ..."
}
FieldDescription
to
Target contract address
from
Sender address
data
ABI-encoded function calldata
value
Native token value (always
"0"
for DigiFT operations)
deadline
Expiry timestamp (now + 30 minutes) — reverts if submitted after
description
Human-readable summary
所有链上命令输出
TxBody
负载。本技能绝不签名或广播——任何EVM钱包均可对
TxBody
进行签名和广播。
json
{
  "to": "0x...",
  "from": "0x...",
  "data": "0x...",
  "value": "0",
  "deadline": 1716200000,
  "description": "DigiFT subscribe: ..."
}
字段描述
to
目标合约地址
from
发送方地址
data
ABI编码的函数调用数据
value
原生代币金额(DigiFT操作始终为
"0"
deadline
过期时间戳(当前时间+30分钟)——超过该时间提交会回滚
description
人类可读的摘要

Approve before action

操作前需授权

ERC20 tokens require the spender (SubRed contract) to be approved before subscribe/redeem. The CLI automatically checks allowance and outputs
needsApprove
if needed:
  • 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
needsApprove
is present, broadcast the approval TxBody first, wait for confirmation, then broadcast the main TxBody.
ERC20代币要求支出方(SubRed合约)在订阅/赎回前获得授权。CLI会自动检查额度,若需要则输出
needsApprove
  • 订阅: 检查SubRed合约对货币代币(如USDC)的额度
  • 赎回: 检查SubRed合约对ST代币的额度
若存在
needsApprove
,需先广播授权TxBody,等待确认后再广播主TxBody。

Standard methods only

仅支持标准方法

Currently only
STANDARD_SUBSCRIPTION
and
STANDARD_REDEMPTION
are supported. Flash subscription/redemption methods exist in the API but are not used by the CLI.
目前仅支持
STANDARD_SUBSCRIPTION
STANDARD_REDEMPTION
。API中存在闪兑订阅/赎回方法,但CLI不使用。

Deadline

过期时间

Every transaction includes a
deadline
timestamp (30 minutes from build time). Transactions submitted after the deadline will revert. The user must broadcast within 30 minutes.

每笔交易均包含
deadline
时间戳(构建时间+30分钟)。超过过期时间提交的交易会回滚。用户必须在30分钟内广播交易。

Commands

命令

Query Commands

查询命令

All query commands are read-only — no wallet, no private key, no RPC endpoint required.
所有查询命令均为只读——无需钱包、私钥或RPC端点。

digift products

digift products

List all available RWA products.
bash
digift products
Output: array of
{ tokenCode, projectName, assetType, isSubscribable, isRedeemable }
. If no products, outputs
No products found.
列出所有可用的RWA产品。
bash
digift products
输出:
{ tokenCode, projectName, assetType, isSubscribable, isRedeemable }
数组。若无产品,输出
No products found.

digift chains

digift chains

Platform chain configuration, contract addresses, and supported currencies.
bash
digift chains
Key fields:
chainId
,
chainName
,
standardSubRedContractAddress
,
currencies[]
.
平台链配置、合约地址及支持的货币。
bash
digift chains
关键字段:
chainId
chainName
standardSubRedContractAddress
currencies[]

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 EXAMPLE

digift issuance <tokencode>

digift issuance <tokencode>

Product issuance details — issuer, ISIN, issue date, highlights.
bash
digift issuance EXAMPLE
产品发行详情——发行方、ISIN、发行日期、重点信息。
bash
digift issuance EXAMPLE

digift sub-params <tokencode>

digift sub-params <tokencode>

Subscription parameters — fees, min/max, increment per chain and method.
bash
digift sub-params EXAMPLE
Validation rules:
  • Amount must be
    >= min
    and
    <= 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>

Redemption parameters — same structure as subscription.
bash
digift red-params EXAMPLE
赎回参数——结构与订阅参数相同。
bash
digift red-params EXAMPLE

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 sub

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:
0
=Non-yield,
1
=Yield to Maturity,
2
=7-Day Annualized,
3
=1-Year Floating,
4
=Redemption Yield.
当前指示性价格和收益率。
bash
digift price EXAMPLE
⚠️ 价格仅为指示性——实际结算价格可能不同。
收益率类型:
0
=无收益,
1
=到期收益率,
2
=7天年化收益率,
3
=1年期浮动收益率,
4
=赎回收益率。

digift price-history <tokencode>

digift price-history <tokencode>

Historical price data.
bash
digift price-history EXAMPLE
历史价格数据。
bash
digift price-history EXAMPLE

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:
Pending
Submitted
Allocating
ConfirmShare
Completed
(or
Cancelled
/
Refunded
).
通过交易哈希查询单个订单。先尝试查询订阅订单,再查询赎回订单。
bash
digift order 0x...
订单状态:
Pending
Submitted
Allocating
ConfirmShare
Completed
(或
Cancelled
/
Refunded
)。

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 10

On-Chain Commands

链上命令

All on-chain commands require
--chain <chain-id>
an RPC endpoint (via
--rpc
flag,
DIGIFT_RPC_URL
env, or built-in fallback).
所有链上命令需指定
--chain <chain-id>
和RPC端点(通过
--rpc
标志、
DIGIFT_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 1

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:
  1. Fetch chain info and connect to RPC
  2. Get ST token address from API
  3. Get subscription parameters, match config for requested currency
  4. Validate amount against min/max/increment
  5. Check whitelist status
  6. Check on-chain currency balance (must cover amount + fee)
  7. Calculate fee (bigint arithmetic)
  8. Build subscribe TxBody
  9. Check allowance on currency token → outputs
    needsApprove
    if insufficient
bash
digift subscribe --product EXAMPLE --amount 1000 --from 0x... --chain 1 --currency USDC
Key details:
  • Contract parameter
    amount
    = subscription amount + fee
  • Amount uses currency on-chain decimals (read from ERC20, not API)
  • Allowance checked on currency token for SubRed contract
构建未签名的订阅交易。CLI会自动执行所有预检查:
  1. 获取链信息并连接到RPC
  2. 从API获取ST代币地址
  3. 获取订阅参数,匹配请求货币的配置
  4. 验证金额是否符合最低/最高限额/增量要求
  5. 检查白名单状态
  6. 检查链上货币余额(必须覆盖金额+手续费)
  7. 计算手续费(bigint算术)
  8. 构建订阅TxBody
  9. 检查货币代币的额度 → 若不足则输出
    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>]

Build an unsigned redeem transaction.
bash
digift redeem --product EXAMPLE --quantity 100 --from 0x... --chain 1 --currency USDC
Key differences from subscribe:
AspectSubscribeRedeem
Contract parameter
amount
= total payment (USDC)
quantity
= ST token count
Amount precisionCurrency on-chain decimalsST token on-chain decimals
Fee handlingUser pays amount + feeFee is informational; deducted from proceeds
Balance checkCurrency balance ≥ amount + feeST token balance ≥ quantity
Allowance checkCurrency allowance ≥ amount + feeST token allowance ≥ quantity
构建未签名的赎回交易。
bash
digift redeem --product EXAMPLE --quantity 100 --from 0x... --chain 1 --currency USDC
与订阅的关键区别:
方面订阅赎回
合约参数
amount
= 总支付金额(USDC)
quantity
= ST代币数量
金额精度链上货币的小数位数链上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>]

Build an ERC20 approve transaction.
bash
digift approve --token USDC --spender 0x... --amount 1000 --from 0x... --chain 1
Prefer 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)
FieldTypeExampleDescription
rate
string
"0.001"
Decimal rate (0.1%)
fixedFee
string
"0"
Fixed fee in currency units
minFee
string
"1"
Minimum fee floor
gst
string
"0.002"
GST — display-only, not used in computation
  • For subscriptions, user pays
    amount + fee
    — verify wallet balance covers the total.
  • For redemptions, fee is informational — the contract deducts it from settlement proceeds.

公式:
手续费 = max(金额 × 费率 + 固定手续费, 最低手续费)
字段类型示例描述
rate
string
"0.001"
小数费率(0.1%)
fixedFee
string
"0"
货币单位的固定手续费
minFee
string
"1"
最低手续费下限
gst
string
"0.002"
GST——仅用于显示,不参与计算
  • 订阅时,用户支付
    金额 + 手续费
    ——需验证钱包余额覆盖总计。
  • 赎回时,手续费仅为参考——合约会从结算收益中扣除。

Error Handling

错误处理

Symptom / messageCauseResolution
DIGIFT_API_KEY not set
/
401 Unauthorized
from
digift
Env var missing or invalidAsk the user to
export DIGIFT_API_KEY=<key>
in the current shell, then retry. Never log the key.
digift: command not found
Binary not installedRe-run
npx skills add okx/plugin-store --skill digift-plugin --global
.
Product not found
/
Unknown tokenCode
Token code typo, or product delistedRun
digift products
to list current tokens; verify exact
tokenCode
(case-sensitive).
isSubscribable=false
/
isRedeemable=false
Trading window closed for that productShow the user the next trading window from
digift calendar <tokencode>
. Do not build the TxBody.
Whitelist check failed
/ wallet not whitelisted
KYC not completed for this wallet+chainDirect the user to DigiFT's KYC flow; do not build the TxBody.
Insufficient balance
(subscribe)
Wallet
amount + fee
exceeds token balance
Show the user the shortfall amount; let them adjust
--amount
or fund the wallet.
Insufficient allowance
/
needsApprove
present in output
Spender allowance < amountRun
digift approve --token ... --spender ... --amount ...
first, route through
onchainos wallet contract-call
, then re-run the original command.
Deadline exceeded
after
pending_sign
build
TxBody older than 30 minutesRebuild the TxBody (re-run
digift subscribe
/
digift redeem
). Never replay a stale TxBody.
RPC error
/
chain RPC unreachable
Public RPC unreachable or rate-limitedRetry with
--rpc <alternative-rpc>
or set
DIGIFT_RPC_URL
. Do not silently fall back to a different chain.
Order not found
for
digift order <txhash>
Tx not yet indexed or wrong hashWait a few seconds and retry; verify the user pasted the correct hash.

症状/消息原因解决方法
DIGIFT_API_KEY not set
/
digift
返回
401 Unauthorized
环境变量缺失或无效请用户在当前shell中执行
export DIGIFT_API_KEY=<key>
,然后重试。切勿记录密钥。
digift: command not found
二进制文件未安装重新运行
npx skills add okx/plugin-store --skill digift-plugin --global
Product not found
/
Unknown tokenCode
代币代码输入错误,或产品已下架运行
digift products
列出当前代币;验证
tokenCode
的准确性(区分大小写)。
isSubscribable=false
/
isRedeemable=false
该产品的交易窗口已关闭向用户展示
digift calendar <tokencode>
中的下一个交易窗口。请勿构建TxBody。
Whitelist check failed
/ 钱包不在白名单中
该钱包+链未完成KYC引导用户完成DigiFT的KYC流程;请勿构建TxBody。
Insufficient balance
(订阅)
钱包余额不足以支付
金额 + 手续费
向用户展示差额;让用户调整
--amount
或给钱包充值。
Insufficient allowance
/ 输出中存在
needsApprove
支出方额度 < 金额先运行
digift approve --token ... --spender ... --amount ...
,通过
onchainos wallet contract-call
执行,然后重新运行原命令。
Deadline exceeded
出现在
pending_sign
构建后
TxBody已超过30分钟重新构建TxBody(重新运行
digift subscribe
/
digift redeem
)。切勿重复提交过期的TxBody。
RPC error
/
chain RPC unreachable
公共RPC无法访问或受限使用
--rpc <alternative-rpc>
重试,或设置
DIGIFT_RPC_URL
。请勿静默切换到其他链。
digift order <txhash>
返回
Order not found
交易尚未索引或哈希错误等待几秒后重试;验证用户粘贴的哈希是否正确。

Security Notices

安全须知

  • NEVER sign or broadcast transactions — this skill only builds
    TxBody
    payloads.
  • 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
    needsApprove
    is present.
  • 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密钥
  • 构建订阅/赎回交易前,始终检查白名单状态
  • 构建交易前,始终验证代币余额
  • 若存在
    needsApprove
    ,始终先广播授权TxBody,再广播主TxBody
  • 优先选择精确金额授权,而非无限授权(
    type(uint256).max
    )。
  • 交易过期时间为30分钟——用户必须及时广播,否则交易会回滚。
  • 请勿提供投资建议——仅提供事实数据。

Best Practices

最佳实践

  • ALWAYS query the API for data — never hardcode addresses, chain IDs, or decimals.
  • ALWAYS check
    isSubscribable
    /
    isRedeemable
    before suggesting subscription or redemption.
  • 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
digift
on-chain command outputs JSON containing a
txBody
. Convert per:
digift 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
每个
digift
链上命令输出包含
txBody
的JSON。按以下规则转换:
digift 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    →  description

next_action.tool mapping

next_action.tool映射

Operationnext_action.tool
subscribe, redeem, approve
onchainos wallet contract-call
操作next_action.tool
subscribe, redeem, approve
onchainos wallet contract-call

Approve-before-action sequence (Onchain OS)

操作前授权流程(Onchain OS)

When
needsApprove
is present, execute two
pending_sign
cycles:
⚠️
needsApprove
is NOT a pre-built TxBody.
It is a parameter triple
{token, spender, amount}
. Run
digift approve
separately.
Step 1 — Approve:
  1. Extract
    needsApprove.token
    ,
    .spender
    ,
    .amount
  2. Run
    digift approve --token <token> --spender <spender> --amount <amount> --from <address> --chain <chain-id>
  3. Wrap
    txBody
    in
    pending_sign
    , route to
    onchainos wallet contract-call
  4. Wait for confirmation
Step 2 — Main transaction:
  1. Run the original
    digift subscribe
    /
    digift redeem
    command
  2. Wrap
    txBody
    in
    pending_sign
    , route to
    onchainos wallet contract-call
当存在
needsApprove
时,执行两个
pending_sign
周期:
⚠️
needsApprove
并非预构建的TxBody
。它是一个三元参数
{token, spender, amount}
。需单独运行
digift approve
步骤1 — 授权:
  1. 提取
    needsApprove.token
    .spender
    .amount
  2. 运行
    digift approve --token <token> --spender <spender> --amount <amount> --from <address> --chain <chain-id>
  3. txBody
    包装到
    pending_sign
    中,路由到
    onchainos wallet contract-call
  4. 等待确认
步骤2 — 主交易:
  1. 运行原
    digift subscribe
    /
    digift redeem
    命令
  2. txBody
    包装到
    pending_sign
    中,路由到
    onchainos 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
onchainos wallet contract-call
. Do NOT attempt to broadcast separately.
Onchain OS通过
onchainos wallet contract-call
内部处理签名和广播。请勿尝试单独广播。

Runtime LLM MUST read

运行时LLM必须阅读

The transaction commands output unsigned
TxBody
JSON. Do NOT instruct the user to "broadcast with your wallet." Instead:
  1. Parse the CLI JSON output
  2. Convert
    txBody
    to
    pending_sign
    per the mapping above
  3. Return
    pending_sign
    to the routing layer
  4. Onchain OS takes over signing + broadcasting via
    onchainos wallet contract-call
交易命令输出未签名的
TxBody
JSON。请勿指示用户“用你的钱包广播”。请按以下步骤操作:
  1. 解析CLI的JSON输出
  2. 按上述映射将
    txBody
    转换为
    pending_sign
  3. pending_sign
    返回给路由层
  4. Onchain OS通过
    onchainos wallet contract-call
    接管签名和广播