{"_id":"@accord-protocol/rails-rosen","_rev":"3-bfeb2e65d1134fe6fcb0bd53ed09a4ee","name":"@accord-protocol/rails-rosen","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0":{"name":"@accord-protocol/rails-rosen","version":"0.4.0","keywords":["accord-protocol","rails","rosen","rosen-bridge","rsusdt","rsusdc","rsbtc","agent-payments","rail-adapter"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/rails-rosen@0.4.0","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-rails-rosen","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"792ef695b553690f7724ea6fd6a4643e083ee9cb","tarball":"https://registry.npmjs.org/@accord-protocol/rails-rosen/-/rails-rosen-0.4.0.tgz","fileCount":6,"integrity":"sha512-r4CTOqpfFOaPDxb/s2HMok4mxPFJ+UpxvR6TZw1xxINlLGHkKa4hN1V9uGZ2vGtyGAXmZ3M3aCtshjmvf/p34w==","signatures":[{"sig":"MEUCIDgPPtPLgJiqHqu/vma6p8YfuX6QI5r4XNe/8A6JNdLdAiEAhSGWMFiQhb0QghZbCklter0NtGvM+XlCxVOjnM20T+8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30577},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"3de0b386d2e83302cac87206d198a8a799b6baa8","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-rails-rosen"},"_npmVersion":"10.9.4","description":"Accord rail adapter for Rosen-bridged stablecoins on Ergo (rsUSDT, rsUSDC, rsBTC). Wraps the Ergo Note primitive with token-aware value lookups against a configurable token registry.","directories":{},"_nodeVersion":"22.21.1","dependencies":{"@noble/hashes":"^1.8.0","@accord-protocol/core":"^0.4.0","@accord-protocol/rails":"^0.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"ergo-agent-pay":"^0.3.0","ergo-agent-rosen":"^0.3.0"},"peerDependenciesMeta":{"ergo-agent-pay":{"optional":true},"ergo-agent-rosen":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/rails-rosen_0.4.0_1778775561264_0.3910053822527986","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@accord-protocol/rails-rosen","version":"0.4.1","keywords":["accord-protocol","rails","rosen","rosen-bridge","rsusdt","rsusdc","rsbtc","agent-payments","rail-adapter"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/rails-rosen@0.4.1","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"homepage":"https://github.com/accord-protocol/accord-protocol/tree/main/packages/accord-rails-rosen","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"fecbff725d153c8b5dbe3921fe83f072205a931c","tarball":"https://registry.npmjs.org/@accord-protocol/rails-rosen/-/rails-rosen-0.4.1.tgz","fileCount":6,"integrity":"sha512-+/Wttdvu1s76hAPEeRUY+TbhaRFBXzb3kNNMkVH5/uAjkSl7eqgsA30x2VC4zLZ6BOzg2OjjRwFYH5dH5f78QA==","signatures":[{"sig":"MEUCIQDkaQ8JW38UVZA7gi1KWW1OJndn1xBIRMmlH5t90Pb40gIgD07a2Qm0hybzZKzPwvX424p6BzHUc141NqAcgmGZBUM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2frails-rosen@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30614},"main":"./dist/index.cjs","type":"module","types":"./dist/index.d.ts","module":"./dist/index.js","engines":{"node":">=18"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"gitHead":"e42de427235ef205df05351fb51e607b159d23b6","scripts":{"test":"npx tsx --test src/__tests__/*.test.ts","build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a4ca5b14-aa9a-4490-9084-dce79eaba012"}},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-rails-rosen"},"_npmVersion":"11.14.1","description":"Accord rail adapter for Rosen-bridged stablecoins on Ergo (rsUSDT, rsUSDC, rsBTC). Wraps the Ergo Note primitive with token-aware value lookups against a configurable token registry.","directories":{},"_nodeVersion":"24.15.0","dependencies":{"@noble/hashes":"^1.8.0","@accord-protocol/core":"^0.4.1","@accord-protocol/rails":"^0.4.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"tsx":"^4.0.0","tsup":"^8.0.0","typescript":"^5.0.0","@types/node":"^20.0.0"},"peerDependencies":{"ergo-agent-pay":"^0.3.1","ergo-agent-rosen":"^0.3.1"},"peerDependenciesMeta":{"ergo-agent-pay":{"optional":true},"ergo-agent-rosen":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/rails-rosen_0.4.1_1778872902196_0.16947160407120432","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@accord-protocol/rails-rosen","version":"0.4.2","description":"Accord rail adapter for Rosen-bridged stablecoins on Ergo (rsUSDT, rsUSDC, rsBTC). Wraps the Ergo Note primitive with token-aware value lookups against a configurable token registry.","type":"module","main":"./dist/index.cjs","module":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js","require":"./dist/index.cjs"}},"scripts":{"build":"tsup src/index.ts --format esm,cjs --dts --clean","typecheck":"tsc --noEmit","test":"npx tsx --test src/__tests__/*.test.ts"},"keywords":["accord-protocol","rails","rosen","rosen-bridge","rsusdt","rsusdc","rsbtc","agent-payments","rail-adapter"],"author":{"name":"bez111"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-rails-rosen"},"homepage":"https://accordprotocol.ai/learn/rail-adapters/","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dependencies":{"@accord-protocol/core":"^0.4.2","@accord-protocol/rails":"^0.4.2","@noble/hashes":"^1.8.0"},"peerDependencies":{"ergo-agent-pay":"^0.3.2","ergo-agent-rosen":"^0.3.2"},"peerDependenciesMeta":{"ergo-agent-pay":{"optional":true},"ergo-agent-rosen":{"optional":true}},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","tsx":"^4.0.0","typescript":"^5.0.0"},"engines":{"node":">=18"},"publishConfig":{"access":"public"},"gitHead":"437febb0a70b3162d4b10b19874f1a0026a59bdf","_id":"@accord-protocol/rails-rosen@0.4.2","_nodeVersion":"24.15.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-i1ZMhOrI1LOGwPsT554fmhZ+pHMKlu6FLd2ETRpJ7+Uzs6AbBhbCRelhp5LcbAFTgewbflJnTvW++tMbnpZbYQ==","shasum":"2949ffad0132eed6c59cd5e0053942976a6557ef","tarball":"https://registry.npmjs.org/@accord-protocol/rails-rosen/-/rails-rosen-0.4.2.tgz","fileCount":6,"unpackedSize":30971,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2frails-rosen@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCznK4flQdTzrHaA8sA6vfAWDuYAh6IZcxrqOUyoYex9wIhAKeAqRNS/89cF31lkVqCCzNsWm9Ynzh94SGxkvYCmLiy"}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:a4ca5b14-aa9a-4490-9084-dce79eaba012"}},"directories":{},"maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rails-rosen_0.4.2_1779582056651_0.33370866374128827"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T16:19:21.145Z","modified":"2026-05-24T00:20:57.081Z","0.4.0":"2026-05-14T16:19:21.413Z","0.4.1":"2026-05-15T19:21:42.344Z","0.4.2":"2026-05-24T00:20:56.797Z"},"bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"author":{"name":"bez111"},"license":"MIT","homepage":"https://accordprotocol.ai/learn/rail-adapters/","keywords":["accord-protocol","rails","rosen","rosen-bridge","rsusdt","rsusdc","rsbtc","agent-payments","rail-adapter"],"repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-rails-rosen"},"description":"Accord rail adapter for Rosen-bridged stablecoins on Ergo (rsUSDT, rsUSDC, rsBTC). Wraps the Ergo Note primitive with token-aware value lookups against a configurable token registry.","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"readme":"# `@accord-protocol/rails-rosen`\n\nAccord rail adapter for **Rosen-bridged stablecoins on Ergo** — `rsUSDT`, `rsUSDC`, `rsBTC`. Same on-chain primitive as `rails-ergo` (R4 reserve / R6 task-hash on an Ergo Note), but the value lives in a wrapped-token amount carried in the box's `tokens[]` array, **not** in the box's nanoERG `value` field.\n\nPublic docs: [Website](https://accordprotocol.ai/) · [Rail adapters](https://accordprotocol.ai/learn/rail-adapters/) · [Why Ergo is the reference rail](https://accordprotocol.ai/learn/why-ergo-reference-rail/)\n\n## Install\n\n```bash\nnpm install @accord-protocol/rails-rosen @accord-protocol/rails @accord-protocol/core\n# peer deps for non-mock use:\nnpm install ergo-agent-pay ergo-agent-rosen\n```\n\n## Token registry — caller-supplied\n\nToken ids differ by Rosen network, so the rail adapter does NOT bake constants in. Pass a `RosenTokenRegistry` for the network you are testing:\n\n```ts\nimport { createRosenRailAdapter } from \"@accord-protocol/rails-rosen\";\n\nconst ROSEN_TOKENS = {\n  rsUSDT: { tokenId: \"<64 hex>\", decimals: 6 },\n  rsUSDC: { tokenId: \"<64 hex>\", decimals: 6 },\n  rsBTC:  { tokenId: \"<64 hex>\", decimals: 8 },\n};\n\nconst rail = createRosenRailAdapter({ ops: rosenAgent, tokens: ROSEN_TOKENS });\n```\n\nThe agreement's `price.currency` must be one of `{ rsUSDT, rsUSDC, rsBTC }`, AND the registry must have that currency, AND the registry's `decimals` must match `agreement.price.decimals`. All three rails-rosen-specific rejections — `CURRENCY_NOT_SUPPORTED`, `CURRENCY_NOT_REGISTERED`, `INVALID_PAYMENT_SHAPE` (decimals mismatch) — fire here.\n\n## Buyer payment-proof shape\n\n```json\n{\n  \"note_box_id\": \"<64 hex>\",\n  \"task_output\": \"{\\\"word_count\\\":2}\",\n  \"receiver_address\": \"9XSeller...\"\n}\n```\n\nSame shape as `rails-ergo`. The on-chain Note's R4/R5/R6/R7 layout is identical; the wrapped-token value lookup happens against the box's `tokens[]` array.\n\n## verifyPayment checks (in order)\n\n1. **Shape** — `note_box_id` 64-hex, `task_output` present.\n2. **Currency / registry** — currency in `{rsUSDT,rsUSDC,rsBTC}`, registry has it, `decimals` match (rejections: `CURRENCY_NOT_SUPPORTED`, `CURRENCY_NOT_REGISTERED`, `INVALID_PAYMENT_SHAPE`).\n3. **Note exists on chain** (rejection: `NOTE_NOT_FOUND`).\n4. **Not expired** (rejection: `NOTE_EXPIRED`).\n5. **Reserve binding** (rejection: `RESERVE_MISMATCH`).\n6. **Task-hash binding** — `blake2b256(task_output) === R6` (same as Ergo) (rejections: `TASK_HASH_MISSING`, `TASK_HASH_MISMATCH`).\n7. **Token presence** — `tokens[].tokenId == registry[currency].tokenId` (rejection: `TOKEN_NOT_PRESENT`).\n8. **Token amount** — carried token amount ≥ `decimalToBaseUnits(price.amount, decimals)` (rejection: `INSUFFICIENT_VALUE`).\n\nOn success: `payment_id = note.boxId`.\n\n## settle\n\nCalls `ops.redeemNote(noteBoxId, taskOutput, receiverAddress?)` and emits a Settlement Receipt with:\n\n- `rail: \"rosen\"`\n- `mode: \"note_redeemed\"` (per-rail allow-list per ACCORD-003: `note_redeemed | reserve_refunded | batch_settled`)\n- `status: \"settled\"` (or `\"pending\"` if `redeemNote` returns `submitted: false`)\n\n## Error codes (10)\n\n```text\nINVALID_PAYMENT_SHAPE\nNOTE_NOT_FOUND\nNOTE_EXPIRED\nRESERVE_MISMATCH\nTASK_HASH_MISSING\nTASK_HASH_MISMATCH\nCURRENCY_NOT_SUPPORTED\nCURRENCY_NOT_REGISTERED\nTOKEN_NOT_PRESENT\nINSUFFICIENT_VALUE\n```\n\n## What's NOT here\n\n- **Token-id constants for mainnet/testnet.** Caller-supplied registry on purpose — Rosen Bridge updates these and we don't want stale constants baked in.\n- **The bridge itself.** This adapter assumes wrapped tokens are already on Ergo. The actual `wrap` (Ethereum/Bitcoin/Cardano → Ergo) flow lives in `ergo-agent-rosen` and is a separate concern.\n- **Refunds.** Rosen Notes self-refund through the Ergo predicate, same as plain Ergo Notes.\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}