xrpl
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinesexrpl
xrpl
Each rule under 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.
rules/This skill is not an API reference. For exhaustive type signatures, see js.xrpl.org. For XLS protocol specs, use the companion skill — when work touches AMM, MPT, NFToken, Credentials, Batch, etc., load both skills.
xrpl-standardsrules/本技能并非API参考。如需详尽的类型签名,请查看js.xrpl.org。如需XLS协议规范,请使用配套的技能——当工作涉及AMM、MPT、NFToken、凭证、批量处理等内容时,请同时加载这两个技能。
xrpl-standardsRead first: Security
必读:安全规则
These four rules are non-negotiable. Funds have been lost over every one of them.
- — always credit
security-partial-payment, neverdelivered_amounton incoming payments. Partial-payment inflation is the canonical XRPL exchange exploit.Amount - — a preliminary
security-validate-metadoes not mean the tx was applied. Only validated-ledger meta is authoritative.tesSUCCESS - — never submit without
security-lastledgersequence. Without it a transaction can replay weeks later.LastLedgerSequence - — honor
security-validate-destination-tag; a missing tag on a custodial destination loses funds.requireDestTag
以下四条规则是不可协商的。曾有用户因违反这些规则而损失资金。
- — CRITICAL — 处理入账付款时,始终以
security-partial-payment为准,绝不要用delivered_amount。部分支付通胀是XRPL交易中的典型漏洞。Amount - — CRITICAL — 初步的
security-validate-meta并不代表交易已生效。只有已验证账本的元数据才具有权威性。tesSUCCESS - — CRITICAL — 提交交易时绝不能缺少
security-lastledgersequence。缺少该字段的交易可能在数周后被重复执行。LastLedgerSequence - — CRITICAL — 遵守
security-validate-destination-tag要求;托管地址缺少标签会导致资金损失。requireDestTag
What to read when
场景对应规则
Map the user's task to the rules to consult before writing code.
| User's task or phrase | Read these rules |
|---|---|
| "Credit an incoming payment", "deposit handler", "watch for payments" | |
| "Sign and submit", "send a transaction", "send XRP" | |
| "Set up an exchange deposit address", "custodial account" | |
| "Generate a wallet", "key management" | |
| "Connect to rippled", "websocket", "reconnect" | |
| "Balance math", "convert XRP / drops", "IOU value" | |
| "Retry a failed tx", "tec error" | |
| "List trust lines / NFTs / offers", "account_lines", "account_objects" | |
| "Audit our XRPL integration" | Read all |
根据用户的任务,选择编写代码前需要查阅的规则。
| 用户任务或描述 | 需查阅的规则 |
|---|---|
| "贷记入账付款"、"存款处理程序"、"监控付款" | |
| "签署并提交"、"发送交易"、"发送XRP" | |
| "设置交易所存款地址"、"托管账户" | |
| "生成钱包"、"密钥管理" | |
| "连接到rippled"、"websocket"、"重新连接" | |
| "余额计算"、"转换XRP/ drops"、"IOU价值" | |
| "重试失败交易"、"tec错误" | |
| "列出信任线/NFT/报价"、"account_lines"、"account_objects" | |
| "审计我们的XRPL集成" | 首先阅读所有 |
Full rule index
完整规则索引
Impact tags below match each rule file's frontmatter (, , ).
CRITICALHIGHMEDIUM下方的影响标签与每条规则文件的前置元数据(、、)一致。
CRITICALHIGHMEDIUMSecurity
安全规则
- —
security-partial-payment— ReadCRITICAL, notdelivered_amountAmount - —
security-validate-meta— Wait forCRITICALbefore creditingvalidated: true - —
security-lastledgersequence— Always setCRITICALLastLedgerSequence - —
security-validate-destination-tag— HonorCRITICALon destinationrequireDestTag
- —
security-partial-payment— 读取CRITICAL而非delivered_amountAmount - —
security-validate-meta— 确认CRITICAL后再贷记validated: true - —
security-lastledgersequence— 始终设置CRITICALLastLedgerSequence - —
security-validate-destination-tag— 遵守目标地址的CRITICAL要求requireDestTag
Amounts & numbers
金额与数值
- —
amounts— Drops +CRITICALfor XRP,BigIntfor IOUs, never JSbignumber.js; respect the 15-digit IOU mantissanumber
- —
amounts— XRP使用drops +CRITICAL,IOU使用BigInt,绝不要用JS原生bignumber.js;遵守IOU的15位尾数限制number
Client & connection
客户端与连接
- —
client— One sharedHIGHper app,Clientoverwss://, trust the built-in reconnect, always disconnect on shutdownhttps://
- —
client— 每个应用使用一个共享的HIGH实例,优先使用Client而非wss://,信任内置的重连机制,关闭时务必断开连接https://
Wallet & signing
钱包与签名
- —
wallet-secure-entropy—CRITICALonly; never hand-rolled entropyWallet.generate() - —
wallet-prefer-ed25519— Default to ed25519MEDIUM - —
wallet-regular-key-for-hot-wallets— UseHIGHso the master key can be disabledSetRegularKey
- —
wallet-secure-entropy— 仅使用CRITICAL;绝不要手动生成熵值Wallet.generate() - —
wallet-prefer-ed25519— 默认使用ed25519算法MEDIUM - —
wallet-regular-key-for-hot-wallets— 使用HIGH,以便禁用主密钥SetRegularKey
Transactions & submission
交易与提交
- —
tx-autofill-before-sign—HIGHbefore signingclient.autofill(tx) - —
tx-submitandwait— PreferHIGHoversubmitAndWaitsubmit - —
tx-handle-tec-codes— DistinguishHIGH(applied, failed) fromtec*/tem*/tef*(not applied)ter* - —
tx-idempotent-retry— ReuseHIGHorSequenceon retryTicket - —
read-pagination-marker— Loop onMEDIUMfor paginated requestsmarker
- —
tx-autofill-before-sign— 签名前调用HIGHclient.autofill(tx) - —
tx-submitandwait— 优先使用HIGH而非submitAndWaitsubmit - —
tx-handle-tec-codes— 区分HIGH(已执行但失败)与tec*/tem*/tef*(未执行)错误ter* - —
tx-idempotent-retry— 重试时复用HIGH或SequenceTicket - —
read-pagination-marker— 针对分页请求循环处理MEDIUMmarker
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.
| Task | Sample |
|---|---|
| Construct and send an XRP payment | |
| Add a memo to a payment | |
| Handle a partial payment safely | |
| Watch an account for incoming payments | |
| Submit a transaction with finality and retries | |
Pre-flight a destination's | |
Walk paginated | |
| Configure regular keys / disable master | |
| Sign offline / multisign | |
Use | |
| Issued currencies / IOUs | |
| AMM | |
| NFToken | |
| MPT (Multi-Purpose Tokens) | |
| Escrow, Checks, Payment Channels | |
| Credentials, DID | |
| Getting started from zero | |
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付款 | |
| 为付款添加备注 | |
| 安全处理部分付款 | |
| 监控账户的入账付款 | |
| 最终提交交易并支持重试 | |
预检查目标地址的 | |
遍历分页的 | |
| 配置常规密钥/禁用主密钥 | |
| 离线签名/多签 | |
使用 | |
| 发行货币/IOU | |
| AMM | |
| NFToken | |
| MPT(多用途代币) | |
| 托管、支票、支付通道 | |
| 凭证、DID | |
| 从零开始入门 | |
当用户询问“如何发送付款/铸造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>~/.claude/skills/xrpl/.claude/skills/xrpl//mnt/skills/user/xrpl/Each rule file contains:
- Frontmatter — ,
title(CRITICAL / HIGH / MEDIUM),impact, and where applicabletags,xrpl_js_source,upstream_docs. Fields with no good link are omitted; treat any of these as optional metadata.code_sample - 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/skills/xrpl/.claude/skills/xrpl//mnt/skills/user/xrpl/每个规则文件包含:
- 前置元数据 — 、
title(CRITICAL/HIGH/MEDIUM)、impact,以及适用的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 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.
xrpl-standards如果任务涉及特定的XLS修正案(AMM、MPT、NFToken、凭证、批量处理、DID、召回、许可型DEX等),请同时加载技能。该技能包含原始规范文本——字段定义、交易格式、账本对象、失败条件——本技能刻意不重复这些内容。
xrpl-standardsAuthoritative external resources
权威外部资源
- xrpl.js API reference: https://js.xrpl.org
- xrpl.js source: https://github.com/XRPLF/xrpl.js
- Protocol docs: https://xrpl.org/docs
- Code samples: https://github.com/XRPLF/xrpl-dev-portal/tree/master/_code-samples
- Standards (XLS): load the skill
xrpl-standards
- xrpl.js API参考: https://js.xrpl.org
- xrpl.js源码: https://github.com/XRPLF/xrpl.js
- 协议文档: https://xrpl.org/docs
- 代码示例: https://github.com/XRPLF/xrpl-dev-portal/tree/master/_code-samples
- 标准(XLS): 加载技能
xrpl-standards