{"_id":"@aroha-sdk/settlement","_rev":"5-69cbf079743830df2085200aaab93a5e","name":"@aroha-sdk/settlement","dist-tags":{"latest":"1.4.0"},"versions":{"1.0.0":{"name":"@aroha-sdk/settlement","version":"1.0.0","_id":"@aroha-sdk/settlement@1.0.0","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"f1a7bccf18eaab5b09d58ba9ca2c2eba1018fa5d","tarball":"https://registry.npmjs.org/@aroha-sdk/settlement/-/settlement-1.0.0.tgz","fileCount":13,"integrity":"sha512-KIxEcFpXWirZpLlINGlpuv6eeQDet/RjaqzKHyU9QAoZL1QC8ZYz02IpP2d5wd603qT2V5m0o2fb1G476nUxCQ==","signatures":[{"sig":"MEQCIEPRu1ZUmFqBEkW4QTu80NApaGPkULZu5jx6vVel2yvLAiB1NNRawfOF18Msp787Q1w5MRCgFH9IlZ0HaAosnI3qcg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":52646},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./payments":{"types":"./dist/wallet.d.ts","import":"./dist/wallet.js"}},"gitHead":"67cbe687cd0664deb4374aaa75788c9d7119d74b","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.13.0","description":"Pluggable settlement layer for the Aroha Protocol — null, API-key, quota, escrow, Stripe, and Postgres backends","directories":{},"_nodeVersion":"24.16.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/settlement_1.0.0_1782173761332_0.1351249971516657","host":"s3://npm-registry-packages-npm-production"}},"1.2.0":{"name":"@aroha-sdk/settlement","version":"1.2.0","_id":"@aroha-sdk/settlement@1.2.0","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"0cd993690b759aeec2b3d0e7cb64ae59d9dd35ba","tarball":"https://registry.npmjs.org/@aroha-sdk/settlement/-/settlement-1.2.0.tgz","fileCount":56,"integrity":"sha512-xLybmu/6lJ4LZSYH9cjxhoRMoG00bD0nSHXmZDiuzct/hquBLhm+a1ElxZ/IIkvovWmYxK0KS6ggpb49htvUSg==","signatures":[{"sig":"MEUCIQCNuOZHc78H6hakwAbQ919MUzL3/BTeP7oibAfCjvanYwIgWMMkHTU8inoRBLGdY5ELMJ6//lxBMbj+tO2LocZXQJA=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":151212},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./payments":{"types":"./dist/wallet.d.ts","import":"./dist/wallet.js"}},"gitHead":"3fd6d5ab883e07e6c38989dc642f87ef70bb6320","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.13.0","description":"Pluggable settlement layer for the Aroha Protocol â€” null, API-key, quota, escrow, Stripe, and Postgres backends","directories":{},"_nodeVersion":"24.16.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/settlement_1.2.0_1782181564585_0.35594868994022","host":"s3://npm-registry-packages-npm-production"}},"1.2.1":{"name":"@aroha-sdk/settlement","version":"1.2.1","license":"MIT","_id":"@aroha-sdk/settlement@1.2.1","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"d6db0c3f70dce1d5a1f029ea90a8f100ffa34c93","tarball":"https://registry.npmjs.org/@aroha-sdk/settlement/-/settlement-1.2.1.tgz","fileCount":56,"integrity":"sha512-41j6g5O2PUtVF/AMZZj0FN3r/j1d77fXXAmSIik40VPt5nF0wVBsKYlxBYCtE8HUpM6D8xhQ/dE4ie0gQt4ucg==","signatures":[{"sig":"MEUCIQDipBBx8yu9p8vAyQbzMc71zTQgbI1DhesdwfFNCaGGaAIgGF64hEJJ1DlCpq3xRIQJAL+qYACSBXFSgZZUITKp9r4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":149862},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./payments":{"types":"./dist/wallet.d.ts","import":"./dist/wallet.js"}},"gitHead":"ca0800d55b453d5e9b38ffce3dff055f010619eb","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.16.0","description":"Pluggable settlement layer for the Aroha Protocol â€” null, API-key, quota, escrow, Stripe, and Postgres backends","directories":{},"_nodeVersion":"24.18.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.0","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/settlement_1.2.1_1783119754208_0.9612631784402608","host":"s3://npm-registry-packages-npm-production"}},"1.3.0":{"name":"@aroha-sdk/settlement","version":"1.3.0","license":"MIT","_id":"@aroha-sdk/settlement@1.3.0","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"dist":{"shasum":"fef170a5321b1ffbd2daec519913646eb10e1d78","tarball":"https://registry.npmjs.org/@aroha-sdk/settlement/-/settlement-1.3.0.tgz","fileCount":57,"integrity":"sha512-rjHKnX1Zg3C2J1HSkiLclqqBrUVShvO9RnOzTi6S5cSjp2l37gsWFvHQUIkei2l/a8YM3lnsJu8lx9sEsnpYhw==","signatures":[{"sig":"MEYCIQD+uq2kH0a7fxUThfR8o+FtBnCyTIEftCdWLb2Uo7q1pQIhAIzCOL+KU7N0tzMMZbUSnKaYXEVmzR/hEmQbO9Qz47bx","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":158730},"main":"./dist/index.js","type":"module","types":"./dist/index.d.ts","engines":{"node":">=18.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./payments":{"types":"./dist/wallet.d.ts","import":"./dist/wallet.js"}},"gitHead":"59f177e5c55a3a25977c1fd9895040f339806fb7","scripts":{"test":"vitest run","build":"tsc -p tsconfig.json","clean":"rm -rf dist"},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"_npmVersion":"11.16.0","description":"Pluggable settlement layer for the Aroha Protocol â€” null, API-key, quota, escrow, Stripe, and Postgres backends","directories":{},"_nodeVersion":"24.18.0","dependencies":{},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.0","@types/node":"^20.14.0"},"_npmOperationalInternal":{"tmp":"tmp/settlement_1.3.0_1783298898650_0.8475023957201318","host":"s3://npm-registry-packages-npm-production"}},"1.4.0":{"name":"@aroha-sdk/settlement","version":"1.4.0","description":"Pluggable settlement layer for the Aroha Protocol â€” null, API-key, quota, escrow, Stripe, and Postgres backends","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"import":"./dist/index.js","types":"./dist/index.d.ts"},"./payments":{"import":"./dist/wallet.js","types":"./dist/wallet.d.ts"}},"scripts":{"build":"tsc -p tsconfig.json","clean":"rm -rf dist","test":"vitest run"},"dependencies":{"@aroha-sdk/core":"^1.4.0"},"devDependencies":{"typescript":"^5.4.0","vitest":"^1.6.0","@types/node":"^20.14.0"},"license":"MIT","engines":{"node":">=18.0.0"},"gitHead":"8fa8563aea2cc73fcd7a82d1c56063a3d9edc7d6","_id":"@aroha-sdk/settlement@1.4.0","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-NmVIBJK6ZKAwC1I2e78VoX03Btb6xDhJDskqhbGXhmnqzmfdB3Y5uQgByNShBX60jJp+0ri/eF5/Xs1Vuhp+hQ==","shasum":"64c28a3a8c854a2b6f8c39a823695064964f4c16","tarball":"https://registry.npmjs.org/@aroha-sdk/settlement/-/settlement-1.4.0.tgz","fileCount":62,"unpackedSize":228105,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIGjFOapkRuIz7SGjiMf8vJioXFLYcBcKILnPC6dqsF1xAiEA483AyhcH/flZOJynPHifSzw7NB4gMk8OwVJ3gGGm+vI="}]},"_npmUser":{"name":"aroha-labs","email":"projectmed99@gmail.com"},"directories":{},"maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/settlement_1.4.0_1787073864592_0.14193251318411093"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-23T00:16:01.166Z","modified":"2026-08-18T17:24:24.956Z","1.0.0":"2026-06-23T00:16:01.490Z","1.2.0":"2026-06-23T02:26:04.795Z","1.2.1":"2026-07-03T23:02:34.339Z","1.3.0":"2026-07-06T00:48:18.789Z","1.4.0":"2026-08-18T17:24:24.764Z"},"license":"MIT","description":"Pluggable settlement layer for the Aroha Protocol â€” null, API-key, quota, escrow, Stripe, and Postgres backends","maintainers":[{"name":"aroha-labs","email":"projectmed99@gmail.com"}],"readme":"# @aroha-sdk/settlement\n\n![npm](https://img.shields.io/npm/v/@aroha-sdk/settlement)\n\n| Adapter | Status |\n|---|---|\n| `NullSettlement` | ![Stable](https://img.shields.io/badge/status-stable-brightgreen) |\n| `QuotaSettlement` | ![Stable](https://img.shields.io/badge/status-stable-brightgreen) |\n| `ApiKeySettlement` | ![Stable](https://img.shields.io/badge/status-stable-brightgreen) |\n| `StripeSettlement` | ![Alpha](https://img.shields.io/badge/status-alpha-orange) — pass `{ acknowledgeAlpha: true }` to suppress warning |\n| `PostgresSettlement` | ![Alpha](https://img.shields.io/badge/status-alpha-orange) — pass `{ acknowledgeAlpha: true }` to suppress warning |\n| `EscrowSettlement` | ![Pre-alpha](https://img.shields.io/badge/status-pre--alpha-red) — throws unless `{ acknowledgeAlpha: true }`; `ArohaEscrow.sol` not deployed |\n\nPluggable billing adapters for Aroha agents — from free to quota-enforced to escrow-based settlement.\n\n## Install\n\n```bash\nnpm install @aroha-sdk/settlement\n```\n\n## Quick example\n\n```typescript\nimport { NullSettlement, QuotaSettlement, EscrowSettlement } from \"@aroha-sdk/settlement\";\n\n// No-op — useful for open/free agents\nconst settlement = new NullSettlement();\n\n// Enforce a per-agent spending cap derived from the mandate\nconst settlement = new QuotaSettlement({\n  getLimit: (mandateConstraints) => mandateConstraints.spendLimitUsd,\n  onExceeded: (agentDID, used, limit) => {\n    throw new Error(`Mandate spending cap exceeded: $${used} > $${limit}`);\n  },\n});\n\n// Escrow-backed settlement for production financial flows\nconst settlement = new EscrowSettlement({\n  escrowContractAddress: \"0xabc...\",\n  signerPrivateKey: process.env.ESCROW_SIGNER_KEY!,\n});\n\n// Attach to your server\nserve({ name: \"my-agent\", did, privateKey, settlement, onRequest });\n```\n\n## Why this exists in the mandate chain\n\nSpending limits are one dimension of mandate scope. The settlement layer is where those limits are operationally enforced — checking actual charges against the `spendLimitUsd` constraint in the mandate before committing a transaction.\n\n## API\n\n- `NullSettlement` — no-op adapter. All charges pass through. Use for free or internally-trusted agents.\n- `QuotaSettlement(opts)` — enforce per-call and cumulative spending caps derived from mandate constraints.\n- `EscrowSettlement(opts)` — on-chain escrow using the ArohaEscrow Solidity contract. Alpha — not for production financial use.\n- `ApiKeySettlement(opts)` — simple API-key-based billing for SaaS-style monetization.\n\n## License\n\nMIT\n","readmeFilename":"README.md"}