{"_id":"@accord-protocol/rails-base","_rev":"3-e4b7d9d452e2edd717963b4c0a973d74","name":"@accord-protocol/rails-base","dist-tags":{"latest":"0.4.2"},"versions":{"0.4.0":{"name":"@accord-protocol/rails-base","version":"0.4.0","keywords":["accord-protocol","rails","base","evm","usdc","agent-payments","rail-adapter"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/rails-base@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-base","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"b2e7c8a388c1ec00e3507e1f5cbc244f5c95dcf8","tarball":"https://registry.npmjs.org/@accord-protocol/rails-base/-/rails-base-0.4.0.tgz","fileCount":6,"integrity":"sha512-w36W6ogU5HoVng0DxljCaS6cnsLj6COtNoIIBgjA5DrU7uCl/piws12+OkRs9zzYGl5hjm7SFycpjWMrRmWAZA==","signatures":[{"sig":"MEQCIE5NfY/5vHOaZ71KkTItvaoVY7tOEmVPaiFSzsdHWl6rAiAq3vyIchXAJ7BOIm10j1XWtPgsmbqV//JyrypA5cMTjQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":27904},"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-base"},"_npmVersion":"10.9.4","description":"Accord rail adapter for the Base / EVM Note primitive (AgentPayReserveV0). verifyPayment fetches the Note from the Solidity contract, checks expiry / receiver binding / task-hash / value; settle calls redeemNote and emits a v0 Settlement Receipt with mode","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":{"agentpay-base":"^0.3.0"},"peerDependenciesMeta":{"agentpay-base":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/rails-base_0.4.0_1778775554392_0.1916446636675211","host":"s3://npm-registry-packages-npm-production"}},"0.4.1":{"name":"@accord-protocol/rails-base","version":"0.4.1","keywords":["accord-protocol","rails","base","evm","usdc","agent-payments","rail-adapter"],"author":{"name":"bez111"},"license":"MIT","_id":"@accord-protocol/rails-base@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-base","bugs":{"url":"https://github.com/accord-protocol/accord-protocol/issues"},"dist":{"shasum":"5a1206212dd4e7255b4e136237f46ede00a4581a","tarball":"https://registry.npmjs.org/@accord-protocol/rails-base/-/rails-base-0.4.1.tgz","fileCount":6,"integrity":"sha512-vz966W/U+Bi8Ze8483cEbLqrGewuMn6ZSYBAsHOz0m5x2lVh43wZYY7bsnV8Rqqljgemm9hfFeOc0Td1Kn81vA==","signatures":[{"sig":"MEUCIBd78dvVwvHrzELcFDUVBKZxmQ1Opgx1pKhwtfUpqGzIAiEAphKple7fwULAdUKxe60enCg1HgljnhvuAavVq9u/FW8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2frails-base@0.4.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":27912},"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:33951281-ec9f-41f0-a4cd-54cb61ff86fb"}},"repository":{"url":"git+https://github.com/accord-protocol/accord-protocol.git","type":"git","directory":"packages/accord-rails-base"},"_npmVersion":"11.14.1","description":"Accord rail adapter for the Base / EVM Note primitive (AgentPayReserveV0). verifyPayment fetches the Note from the Solidity contract, checks expiry / receiver binding / task-hash / value; settle calls redeemNote and emits a v0 Settlement Receipt with mode","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":{"agentpay-base":"^0.3.1"},"peerDependenciesMeta":{"agentpay-base":{"optional":true}},"_npmOperationalInternal":{"tmp":"tmp/rails-base_0.4.1_1778872900219_0.19757575268321714","host":"s3://npm-registry-packages-npm-production"}},"0.4.2":{"name":"@accord-protocol/rails-base","version":"0.4.2","description":"Accord rail adapter for the Base / EVM Note primitive (AgentPayReserveV0). verifyPayment fetches the Note from the Solidity contract, checks expiry / receiver binding / task-hash / value; settle calls redeemNote and emits a v0 Settlement Receipt with mode","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","base","evm","usdc","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-base"},"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":{"agentpay-base":"^0.3.2"},"peerDependenciesMeta":{"agentpay-base":{"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-base@0.4.2","_nodeVersion":"24.15.0","_npmVersion":"11.15.0","dist":{"integrity":"sha512-i4nbTSbXYedGUnl4ZthDqthp5+LiiUnEKxxkaCZWxCErQqUWXpoaZceqVlevs3fnn2iGEbLUbEMiBkdgWiBoOg==","shasum":"aeec2d0491399d31d3ce2f69285da846b79acb0e","tarball":"https://registry.npmjs.org/@accord-protocol/rails-base/-/rails-base-0.4.2.tgz","fileCount":6,"unpackedSize":28387,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@accord-protocol%2frails-base@0.4.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAN3bE9TaIomZFm3YbexQ+pgwRuBn5cjwZhLaXhIoBM2AiEA0zXWLnCcUgaPBa+vkdWWxglOKw/1B90hp1Ix0SdY198="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:33951281-ec9f-41f0-a4cd-54cb61ff86fb"}},"directories":{},"maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/rails-base_0.4.2_1779582058514_0.02791487008957505"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-14T16:19:14.288Z","modified":"2026-05-24T00:20:58.954Z","0.4.0":"2026-05-14T16:19:14.544Z","0.4.1":"2026-05-15T19:21:40.362Z","0.4.2":"2026-05-24T00:20:58.652Z"},"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","base","evm","usdc","agent-payments","rail-adapter"],"repository":{"type":"git","url":"git+https://github.com/accord-protocol/accord-protocol.git","directory":"packages/accord-rails-base"},"description":"Accord rail adapter for the Base / EVM Note primitive (AgentPayReserveV0). verifyPayment fetches the Note from the Solidity contract, checks expiry / receiver binding / task-hash / value; settle calls redeemNote and emits a v0 Settlement Receipt with mode","maintainers":[{"name":"accord-protocol","email":"alexander.bezkrovny@gmail.com"}],"readme":"# `@accord-protocol/rails-base`\n\nAccord rail adapter for the **Base / EVM Note** primitive, backed by the legacy `AgentPayReserveV0` Solidity contract. Implements [`AccordRailAdapter`](../accord-rails) by reading a Note from the Solidity contract, checking expiry / receiver binding / task-hash / value, then redeeming or refunding.\n\nThis is the canonical Accord-facing package for the Base rail. The underlying reference SDK is [`agentpay-base`](../agentpay-base/), which keeps its legacy npm name for bytecode/audit continuity; new integrations should import this package, not `agentpay-base` directly.\n\nPublic docs: [Website](https://accordprotocol.ai/) · [Rail adapters](https://accordprotocol.ai/learn/rail-adapters/) · [Status](https://accordprotocol.ai/status/)\n\n## Install\n\n```bash\nnpm install @accord-protocol/rails-base @accord-protocol/rails @accord-protocol/core\n# plus the EVM Note SDK (peer dep):\nnpm install agentpay-base\n```\n\n## Usage\n\n```ts\nimport { BaseAgentPay } from \"agentpay-base\";\nimport { createBaseRailAdapter } from \"@accord-protocol/rails-base\";\nimport { accordGateway } from \"@accord-protocol/gateway\";\n\nconst baseAgent = new BaseAgentPay({\n  reserveAddress: \"0x…\",\n  network: \"base-sepolia\",\n  walletClient,\n});\n\nconst rail = createBaseRailAdapter({ ops: baseAgent });\n\napp.post(\"/api/run\", accordGateway({\n  rail,\n  resolveAgreement,\n  buildAgreementTemplate,\n  handler: async (req, { agreement, body }) => ({ /* … */ }),\n}));\n```\n\nThe adapter never imports `agentpay-base` directly — it expects a `BaseNoteOps` interface (`network` + `checkNote` + `redeemNote` + optional `refundExpired`). `BaseAgentPay` is shape-compatible. Tests pass an in-memory stub.\n\n## Buyer payment-proof shape\n\n```json\n{\n  \"note_id\": \"0x<64 hex>\",\n  \"task_output\": \"{\\\"word_count\\\":2}\",\n  \"tx_hash\": \"0x<64 hex>\"\n}\n```\n\n`task_output` is the raw bytes the seller pre-committed to. `keccak256(task_output)` MUST equal the on-chain Note's `taskHash`.\n\n## verifyPayment checks (in order)\n\n1. **Shape** — `note_id` is `0x` + 64 hex, `task_output` present.\n2. **Note exists on chain** — `note.exists` (rejection: `NOTE_NOT_FOUND`).\n3. **Not already redeemed** (rejection: `NOTE_ALREADY_REDEEMED`).\n4. **Not expired** (rejection: `NOTE_EXPIRED`).\n5. **Currency** — agreement asks for USDC or USDT (rejection: `CURRENCY_NOT_SUPPORTED`; for ERG use `rails-ergo`, for rsUSDT/rsUSDC/rsBTC use `rails-rosen`).\n6. **Task-hash binding** — `note.taskHash != 0x00…` and equals `keccak256(task_output)` (rejections: `TASK_HASH_MISSING`, `TASK_HASH_MISMATCH`). Note: keccak256, not blake2b256 — Accord stays portable, the rail uses each chain's native hash.\n7. **Value** — `note.amount >= decimalToBaseUnits(price.amount, decimals)` (rejection: `INSUFFICIENT_VALUE`).\n\nOn success: `payment_id = tx_hash` (preferred — anchors to a specific issuance tx), or `note_id` if `tx_hash` was absent.\n\n## settle / refund\n\n- **`settle`** — calls `ops.redeemNote(noteId, taskOutput)`. Emits a v0 Settlement Receipt with `mode: \"redeemed\"`, `status: \"settled\"`.\n- **`refund`** — calls `ops.refundExpired(noteId)`. Emits with `mode: \"refund_expired\"`, `status: \"refunded\"`. Required when the engagement fails past the deadline.\n\nThe Base rail's per-rail allow-list per ACCORD-003 is `{ \"redeemed\", \"refund_expired\" }`; the adapter respects that.\n\n## Error codes\n\n`BASE_RAIL_ERROR_CODES`:\n\n```text\nINVALID_PAYMENT_SHAPE\nNOTE_NOT_FOUND\nNOTE_EXPIRED\nNOTE_ALREADY_REDEEMED\nTASK_HASH_MISSING\nTASK_HASH_MISMATCH\nINSUFFICIENT_VALUE\nCURRENCY_NOT_SUPPORTED\n```\n\n## License\n\nMIT.\n","readmeFilename":"README.md"}