xrpl

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

xrpl

xrpl

Each rule under
rules/
is self-contained: an incorrect example, a correct example, and links to upstream xrpl.js source, xrpl.org docs, and (where available) an XRPL Developer Portal code sample. Use the index below to jump to the rule that fits the task.
This skill is not an API reference. For exhaustive type signatures, see js.xrpl.org. For XLS protocol specs, use the companion
xrpl-standards
skill — when work touches AMM, MPT, NFToken, Credentials, Batch, etc., load both skills.
rules/
目录下的每条规则都是独立的:包含错误示例、正确示例,以及指向xrpl.js上游源码、xrpl.org文档的链接,还有(如有提供)XRPL开发者门户代码示例的链接。使用下方索引跳转到适合当前任务的规则。
本技能并非API参考。如需详尽的类型签名,请查看js.xrpl.org。如需XLS协议规范,请使用配套的
xrpl-standards
技能——当工作涉及AMM、MPT、NFToken、凭证、批量处理等内容时,请同时加载这两个技能。

Read first: Security

必读:安全规则

These four rules are non-negotiable. Funds have been lost over every one of them.
  • security-partial-payment
    always credit
    delivered_amount
    , never
    Amount
    on incoming payments. Partial-payment inflation is the canonical XRPL exchange exploit.
  • security-validate-meta
    — a preliminary
    tesSUCCESS
    does not mean the tx was applied. Only validated-ledger meta is authoritative.
  • security-lastledgersequence
    — never submit without
    LastLedgerSequence
    . Without it a transaction can replay weeks later.
  • security-validate-destination-tag
    — honor
    requireDestTag
    ; a missing tag on a custodial destination loses funds.
以下四条规则是不可协商的。曾有用户因违反这些规则而损失资金。
  • security-partial-payment
    CRITICAL — 处理入账付款时,始终以
    delivered_amount
    为准,绝不要用
    Amount
    。部分支付通胀是XRPL交易中的典型漏洞。
  • security-validate-meta
    CRITICAL — 初步的
    tesSUCCESS
    并不代表交易已生效。只有已验证账本的元数据才具有权威性。
  • security-lastledgersequence
    CRITICAL — 提交交易时绝不能缺少
    LastLedgerSequence
    。缺少该字段的交易可能在数周后被重复执行。
  • security-validate-destination-tag
    CRITICAL — 遵守
    requireDestTag
    要求;托管地址缺少标签会导致资金损失。

What to read when

场景对应规则

Map the user's task to the rules to consult before writing code.
User's task or phraseRead these rules
"Credit an incoming payment", "deposit handler", "watch for payments"
security-partial-payment
,
security-validate-meta
,
read-pagination-marker
"Sign and submit", "send a transaction", "send XRP"
tx-autofill-before-sign
,
tx-submitandwait
,
security-lastledgersequence
,
tx-handle-tec-codes
"Set up an exchange deposit address", "custodial account"
security-validate-destination-tag
,
wallet-regular-key-for-hot-wallets
"Generate a wallet", "key management"
wallet-secure-entropy
,
wallet-prefer-ed25519
,
wallet-regular-key-for-hot-wallets
"Connect to rippled", "websocket", "reconnect"
client
"Balance math", "convert XRP / drops", "IOU value"
amounts
"Retry a failed tx", "tec error"
tx-handle-tec-codes
,
tx-idempotent-retry
,
tx-submitandwait
"List trust lines / NFTs / offers", "account_lines", "account_objects"
read-pagination-marker
"Audit our XRPL integration"Read all
security-*
rules first, then
amounts
and
wallet-*
.
根据用户的任务,选择编写代码前需要查阅的规则。
用户任务或描述需查阅的规则
"贷记入账付款"、"存款处理程序"、"监控付款"
security-partial-payment
,
security-validate-meta
,
read-pagination-marker
"签署并提交"、"发送交易"、"发送XRP"
tx-autofill-before-sign
,
tx-submitandwait
,
security-lastledgersequence
,
tx-handle-tec-codes
"设置交易所存款地址"、"托管账户"
security-validate-destination-tag
,
wallet-regular-key-for-hot-wallets
"生成钱包"、"密钥管理"
wallet-secure-entropy
,
wallet-prefer-ed25519
,
wallet-regular-key-for-hot-wallets
"连接到rippled"、"websocket"、"重新连接"
client
"余额计算"、"转换XRP/ drops"、"IOU价值"
amounts
"重试失败交易"、"tec错误"
tx-handle-tec-codes
,
tx-idempotent-retry
,
tx-submitandwait
"列出信任线/NFT/报价"、"account_lines"、"account_objects"
read-pagination-marker
"审计我们的XRPL集成"首先阅读所有
security-*
规则,然后阅读
amounts
wallet-*
规则。

Full rule index

完整规则索引

Impact tags below match each rule file's frontmatter (
CRITICAL
,
HIGH
,
MEDIUM
).
下方的影响标签与每条规则文件的前置元数据(
CRITICAL
HIGH
MEDIUM
)一致。

Security

安全规则

  • security-partial-payment
    CRITICAL
    — Read
    delivered_amount
    , not
    Amount
  • security-validate-meta
    CRITICAL
    — Wait for
    validated: true
    before crediting
  • security-lastledgersequence
    CRITICAL
    — Always set
    LastLedgerSequence
  • security-validate-destination-tag
    CRITICAL
    — Honor
    requireDestTag
    on destination
  • security-partial-payment
    CRITICAL
    — 读取
    delivered_amount
    而非
    Amount
  • security-validate-meta
    CRITICAL
    — 确认
    validated: true
    后再贷记
  • security-lastledgersequence
    CRITICAL
    — 始终设置
    LastLedgerSequence
  • security-validate-destination-tag
    CRITICAL
    — 遵守目标地址的
    requireDestTag
    要求

Amounts & numbers

金额与数值

  • amounts
    CRITICAL
    — Drops +
    BigInt
    for XRP,
    bignumber.js
    for IOUs, never JS
    number
    ; respect the 15-digit IOU mantissa
  • amounts
    CRITICAL
    — XRP使用drops +
    BigInt
    ,IOU使用
    bignumber.js
    ,绝不要用JS原生
    number
    ;遵守IOU的15位尾数限制

Client & connection

客户端与连接

  • client
    HIGH
    — One shared
    Client
    per app,
    wss://
    over
    https://
    , trust the built-in reconnect, always disconnect on shutdown
  • client
    HIGH
    — 每个应用使用一个共享的
    Client
    实例,优先使用
    wss://
    而非
    https://
    ,信任内置的重连机制,关闭时务必断开连接

Wallet & signing

钱包与签名

  • wallet-secure-entropy
    CRITICAL
    Wallet.generate()
    only; never hand-rolled entropy
  • wallet-prefer-ed25519
    MEDIUM
    — Default to ed25519
  • wallet-regular-key-for-hot-wallets
    HIGH
    — Use
    SetRegularKey
    so the master key can be disabled
  • wallet-secure-entropy
    CRITICAL
    — 仅使用
    Wallet.generate()
    ;绝不要手动生成熵值
  • wallet-prefer-ed25519
    MEDIUM
    — 默认使用ed25519算法
  • wallet-regular-key-for-hot-wallets
    HIGH
    — 使用
    SetRegularKey
    ,以便禁用主密钥

Transactions & submission

交易与提交

  • tx-autofill-before-sign
    HIGH
    client.autofill(tx)
    before signing
  • tx-submitandwait
    HIGH
    — Prefer
    submitAndWait
    over
    submit
  • tx-handle-tec-codes
    HIGH
    — Distinguish
    tec*
    (applied, failed) from
    tem*
    /
    tef*
    /
    ter*
    (not applied)
  • tx-idempotent-retry
    HIGH
    — Reuse
    Sequence
    or
    Ticket
    on retry
  • read-pagination-marker
    MEDIUM
    — Loop on
    marker
    for paginated requests
  • tx-autofill-before-sign
    HIGH
    — 签名前调用
    client.autofill(tx)
  • tx-submitandwait
    HIGH
    — 优先使用
    submitAndWait
    而非
    submit
  • tx-handle-tec-codes
    HIGH
    — 区分
    tec*
    (已执行但失败)与
    tem*
    /
    tef*
    /
    ter*
    (未执行)错误
  • tx-idempotent-retry
    HIGH
    — 重试时复用
    Sequence
    Ticket
  • read-pagination-marker
    MEDIUM
    — 针对分页请求循环处理
    marker

Code samples

代码示例

The rules in this skill explain what to do and why. When you need a runnable, end-to-end example — how to actually construct, sign, and submit a transaction — go to the XRPL Developer Portal code samples. They are maintained by XRPLF and stay current with xrpl.js. Prefer them over inventing example code.
TaskSample
Construct and send an XRP payment
send-xrp
Add a memo to a payment
send-a-memo
Handle a partial payment safely
partial-payment
Watch an account for incoming payments
monitor-payments-websocket
Submit a transaction with finality and retries
reliable-tx-submission
,
submit-and-verify
Pre-flight a destination's
requireDestTag
require-destination-tags
Walk paginated
account_*
responses
markers-and-pagination
,
walk-owner-directory
Configure regular keys / disable master
assign-regular-key
,
disable-master-key
Sign offline / multisign
secure-signing
,
multisigning
Use
Tickets
for parallel submission
use-tickets
Issued currencies / IOUs
issue-a-token
,
freeze
,
clawback
AMM
create-amm
,
amm-clob
NFToken
non-fungible-token
,
nft-modular-tutorials
MPT (Multi-Purpose Tokens)
mpt-generator
,
mpt-sender
,
issue-mpt-with-metadata
Escrow, Checks, Payment Channels
escrow
,
checks
,
claim-payment-channel
Credentials, DID
credential
,
issue-credentials
,
verify-credential
,
did
Getting started from zero
get-started
,
quickstart
When the user asks "how do I send a payment / mint an NFT / set up an escrow" and the answer requires runnable code, fetch the matching sample and adapt it — do not paraphrase the structure from memory.
本技能中的规则解释了应该做什么以及为什么要这么做。当你需要可运行的端到端示例——比如如何实际构建、签署并提交交易——请前往XRPL开发者门户代码示例。这些示例由XRPLF维护,始终与xrpl.js保持同步。优先使用这些示例,而非自行编写示例代码。
任务示例链接
构建并发送XRP付款
send-xrp
为付款添加备注
send-a-memo
安全处理部分付款
partial-payment
监控账户的入账付款
monitor-payments-websocket
最终提交交易并支持重试
reliable-tx-submission
,
submit-and-verify
预检查目标地址的
requireDestTag
require-destination-tags
遍历分页的
account_*
响应
markers-and-pagination
,
walk-owner-directory
配置常规密钥/禁用主密钥
assign-regular-key
,
disable-master-key
离线签名/多签
secure-signing
,
multisigning
使用
Tickets
进行并行提交
use-tickets
发行货币/IOU
issue-a-token
,
freeze
,
clawback
AMM
create-amm
,
amm-clob
NFToken
non-fungible-token
,
nft-modular-tutorials
MPT(多用途代币)
mpt-generator
,
mpt-sender
,
issue-mpt-with-metadata
托管、支票、支付通道
escrow
,
checks
,
claim-payment-channel
凭证、DID
credential
,
issue-credentials
,
verify-credential
,
did
从零开始入门
get-started
,
quickstart
当用户询问“如何发送付款/铸造NFT/设置托管”等需要可运行代码的问题时,请获取匹配的示例并加以调整——不要凭记忆改写结构。

How to Use

使用方法

Once you have picked a rule from the table above, read its file:
text
Read <skill-dir>/rules/<rule-name>.md
<skill-dir>
resolves to wherever the skill is installed —
~/.claude/skills/xrpl/
for a user-level Claude Code install,
.claude/skills/xrpl/
for a project-level install,
/mnt/skills/user/xrpl/
on claude.ai, or a plugin-managed path. Don't hard-code the directory; rely on the path the host resolves.
Each rule file contains:
  • Frontmatter
    title
    ,
    impact
    (CRITICAL / HIGH / MEDIUM),
    tags
    , and where applicable
    xrpl_js_source
    ,
    upstream_docs
    ,
    code_sample
    . Fields with no good link are omitted; treat any of these as optional metadata.
  • Why it matters — one or two sentences explaining the failure mode.
  • Incorrect example — what the broken code typically looks like.
  • Correct example — the idiomatic fix.
  • Notes — edge cases, related amendments, version caveats.
  • See also — explicit links back to upstream xrpl.js source files, xrpl.org protocol docs, and (where it exists) a dev-portal code sample.
从上方表格中选择规则后,阅读对应的文件:
text
Read <skill-dir>/rules/<rule-name>.md
<skill-dir>
指向技能安装的位置——用户级Claude Code安装为
~/.claude/skills/xrpl/
,项目级安装为
.claude/skills/xrpl/
,claude.ai上为
/mnt/skills/user/xrpl/
,或插件管理的路径。不要硬编码目录,依赖宿主解析的路径即可。
每个规则文件包含:
  • 前置元数据
    title
    impact
    (CRITICAL/HIGH/MEDIUM)、
    tags
    ,以及适用的
    xrpl_js_source
    upstream_docs
    code_sample
    。无合适链接的字段会被省略;这些均为可选元数据。
  • 重要性说明 — 一两句话解释失败场景。
  • 错误示例 — 典型的错误代码写法。
  • 正确示例 — 符合规范的修复方案。
  • 注意事项 — 边缘情况、相关补充、版本说明。
  • 相关链接 — 指向xrpl.js上游源码文件、xrpl.org协议文档的明确链接,以及(如有)开发者门户代码示例的链接。

Companion skill: xrpl-standards

配套技能:xrpl-standards

If the task touches a specific XLS amendment (AMM, MPT, NFToken, Credentials, Batch, DID, Clawback, Permissioned DEX, etc.), load the
xrpl-standards
skill alongside this one. That skill holds the raw spec text — field definitions, transaction formats, ledger objects, failure conditions — that this skill deliberately does not duplicate.
如果任务涉及特定的XLS修正案(AMM、MPT、NFToken、凭证、批量处理、DID、召回、许可型DEX等),请同时加载
xrpl-standards
技能。该技能包含原始规范文本——字段定义、交易格式、账本对象、失败条件——本技能刻意不重复这些内容。

Authoritative external resources

权威外部资源