{"_id":"@arccade/game-sdk","_rev":"2-de41c77d9e0906b45a2189f39ee79b39","name":"@arccade/game-sdk","dist-tags":{"latest":"1.5.1"},"versions":{"1.5.0":{"name":"@arccade/game-sdk","version":"1.5.0","keywords":["canton","splice","daml","gaming","featured-app","audit","merkle"],"license":"Apache-2.0","_id":"@arccade/game-sdk@1.5.0","maintainers":[{"name":"melkor1907","email":"melkor@arccade.io"}],"homepage":"https://sdk.arccade.io/","bugs":{"url":"https://github.com/arCCade/arccade-game-sdk/issues"},"dist":{"shasum":"f6083959d85c9fd4c903108f4ff3e4b5618e7403","tarball":"https://registry.npmjs.org/@arccade/game-sdk/-/game-sdk-1.5.0.tgz","fileCount":13,"integrity":"sha512-4BdaHUnA6ywe1yaX+xFcKn+AJot9yr/CuaClMB8TAIan/vYhb5E6Y9Pk5vr1oaWSfu/8IhAUaBlWtOlk1lqhZA==","signatures":[{"sig":"MEQCIBIQ898FRUYqn86rOefiPPuNjZ7nWQX661vKKtV7NwhaAiAXCylwlmCUdGbD/h+mvt58aO16Kg/NQ/tE0OXFZF7Fxg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arccade%2fgame-sdk@1.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":83164},"main":"src/index.js","type":"module","types":"index.d.ts","engines":{"node":">=20"},"exports":{".":{"types":"./index.d.ts","import":"./src/index.js"}},"gitHead":"2622c33463c7399499de5ae2ab1d02dc94a5d037","scripts":{"test":"node --test test/"},"_npmUser":{"name":"melkor1907","email":"melkor@arccade.io"},"repository":{"url":"git+https://github.com/arCCade/arccade-game-sdk.git","type":"git","directory":"js"},"_npmVersion":"10.8.2","description":"Gaming SDK for Canton — a two-write game cycle on the Canton Network: value commitment, settlement, and independently verifiable period anchors","directories":{},"_nodeVersion":"20.20.2","publishConfig":{"access":"public"},"_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/game-sdk_1.5.0_1787943223333_0.669496803393691","host":"s3://npm-registry-packages-npm-production"}},"1.5.1":{"name":"@arccade/game-sdk","version":"1.5.1","description":"Gaming SDK for Canton — a two-write game cycle on the Canton Network: value commitment, settlement, and independently verifiable period anchors","type":"module","main":"src/index.js","types":"index.d.ts","exports":{".":{"types":"./index.d.ts","import":"./src/index.js"},"./package.json":"./package.json"},"scripts":{"test":"node --test test/"},"keywords":["canton","splice","daml","gaming","featured-app","audit","merkle"],"homepage":"https://sdk.arccade.io/","repository":{"type":"git","url":"git+https://github.com/arCCade/arccade-game-sdk.git","directory":"js"},"bugs":{"url":"https://github.com/arCCade/arccade-game-sdk/issues"},"license":"Apache-2.0","publishConfig":{"access":"public"},"engines":{"node":">=20"},"_id":"@arccade/game-sdk@1.5.1","gitHead":"98454da3c9b0a7effba1dfbe1ec850146d6d606b","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-bUeIXruQ7WtmxlK6od1xlWC4gikT817S7fHZM4MUV1cpjLSb3kHl8AteCBURtrL5prFt8Cifuri7K5r/7Equtw==","shasum":"b095f95bc9718a8e1ef83815e0020d75e9d80389","tarball":"https://registry.npmjs.org/@arccade/game-sdk/-/game-sdk-1.5.1.tgz","fileCount":13,"unpackedSize":86117,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@arccade%2fgame-sdk@1.5.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCnq7/MLNLtakp+eM4Jxr90m7fvQ7aCmj28LNMkaKzbhAIhAJroMxMDIxUorBU4BB9E95IvWLYhZXB0OE3RezJrepI7"}]},"_npmUser":{"name":"melkor1907","email":"melkor@arccade.io"},"directories":{},"maintainers":[{"name":"melkor1907","email":"melkor@arccade.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/game-sdk_1.5.1_1787946471685_0.27188314397619906"},"_hasShrinkwrap":false}},"time":{"created":"2026-08-28T18:53:43.149Z","modified":"2026-08-28T19:47:52.208Z","1.5.0":"2026-08-28T18:53:43.459Z","1.5.1":"2026-08-28T19:47:51.831Z"},"bugs":{"url":"https://github.com/arCCade/arccade-game-sdk/issues"},"license":"Apache-2.0","homepage":"https://sdk.arccade.io/","keywords":["canton","splice","daml","gaming","featured-app","audit","merkle"],"repository":{"type":"git","url":"git+https://github.com/arCCade/arccade-game-sdk.git","directory":"js"},"description":"Gaming SDK for Canton — a two-write game cycle on the Canton Network: value commitment, settlement, and independently verifiable period anchors","maintainers":[{"name":"melkor1907","email":"melkor@arccade.io"}],"readme":"# @arccade/game-sdk\n\nJavaScript client for the [Gaming SDK for Canton](https://github.com/arCCade/arccade-game-sdk)\n— the off-ledger half of a two-write game cycle on the Canton Network.\n\n```bash\nnpm install @arccade/game-sdk\n```\n\nRequires Node 20 or later. No runtime dependencies.\n\n## What this package is for\n\nThe Daml package (`arccade-game-sdk`) holds the contracts. This one holds\neverything a client needs to speak to them **correctly**, which in practice\nmeans everything that has to produce the same bytes the ledger will produce:\n\n- the **commitment scheme** `arccade-sdk-digest-v1/sha256` — canonical document\n  encoding, digests, integer amount units;\n- the **period audit** side — Merkle trees, cycle-audit-row leaves, inclusion\n  proofs, and rebuilding report rows from the ledger's transaction tree;\n- helpers for cycle ids, custody tags, tenant keys and asset instrument ids.\n\n**MAJOR.MINOR tracks the Daml package; PATCH does not.** 1.5.x of this client\ntalks to 1.5.0 of the contracts. The two encode one agreement, and letting\nthem drift is how a client starts computing a digest the ledger will reject —\nthat already happened once, at 1.1.0 against a 1.5.0 ledger package, unnoticed\nbecause the only consumer was a local `file:` dependency.\n\nPatch is free to move on its own so that a client-only change — a packaging\nfix, a helper, better types — does not require a new Daml package and another\nround of on-chain vetting, which is governance-paced. The release workflow\nenforces exactly this.\n\n## Why a digest has to match exactly\n\n`GameStake_Settle` recomputes the commitment on the ledger and rejects a\nmismatch. A digest that differs by one byte does not produce a warning — it\nproduces a stake that cannot be settled. That is why this implementation is\npinned by golden vectors against the Daml, Python and Java ones:\n\n```js\nimport { documentDigest, canonText, canonInt } from '@arccade/game-sdk'\n\nconst digest = documentDigest('my-game-entry', 1, [\n  ['cycleId', canonText('pr-abc123')],\n  ['seed', canonInt(42n)],\n])\n```\n\nTwo rules the encoding will not let you break quietly: lengths are counted in\n**Unicode code points**, and amounts are hashed as **integer 1e-10 units**,\nnever as formatted decimals.\n\n## Verifying a published period\n\nEvery cycle arCCade settles is committed to a daily Merkle root written on\nCanton in a `VenuePeriodAnchor`. Given a published report you can check a row\nbelongs to it without trusting the publisher:\n\n```js\nimport { periodLeaf, merkleProof, periodRowVerify, merkleRoot } from '@arccade/game-sdk'\n\nconst leaves = report.rows.map(periodLeaf)\nconst root = merkleRoot(leaves)                      // compare with the anchor\nconst ok = periodRowVerify(report.rows[2], merkleProof(2, leaves), root)\n```\n\nUse `periodRowVerify`, not `merkleVerify`, when the claim is \"this cycle is in\nthe report\". `merkleVerify` folds a hash and cannot know whether it started\nfrom a leaf or an internal node; deriving the leaf from the row is what binds\nthe claim to the row schema.\n\n## Rebuilding rows from the ledger\n\n`rowsFromTransactions` turns a `TRANSACTION_SHAPE_LEDGER_EFFECTS` stream into\nreport rows, so an auditor can produce the report themselves rather than taking\none. The rules live in fixtures — `test-vectors/cycle-trees.json` and\n`cycle-rows.json` in the repository — and the Python and Java implementations\nassert against the same pair.\n\nTwo things it does that are easy to get wrong: it joins the commit and closing\nhalves by the **stake contract id** (a closing choice does not repeat the cycle\nid), and it reports unmatched halves instead of dropping them.\n\n## License\n\nApache-2.0. See `LICENSE` and `NOTICE`.\n","readmeFilename":"README.md"}