@scuro/sdk 0.1.0-beta.1 → 0.1.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +109 -152
  2. package/package.json +2 -2
package/README.md CHANGED
@@ -1,51 +1,37 @@
1
1
  # Scuro SDK
2
2
 
3
- Bun-first TypeScript SDK for the Scuro protocol.
3
+ Server-side TypeScript SDK for the Scuro protocol.
4
4
 
5
- This package is aimed at Node/Bun integrators who need to:
5
+ This package is for backend applications and services that need to:
6
6
 
7
- - load Scuro protocol metadata and ABIs
7
+ - load checked-in Scuro protocol metadata and ABIs
8
8
  - normalize deployment outputs into typed addresses and ids
9
- - build typed `viem` contract reads and transaction requests
10
- - use higher-level gameplay and staking helpers
11
- - run coordinator-style poker and blackjack proof workflows
9
+ - prepare typed `viem` contract reads and transaction requests
10
+ - use higher-level gameplay, settlement, and staking helpers
11
+ - run coordinator-style poker and blackjack proof submission loops
12
12
 
13
- The SDK currently targets Bun first and standard Node server runtimes second. Browser support is out of scope for this version.
13
+ The SDK supports standard Node.js and Bun server runtimes. It ships ESM output and is not intended for browser clients in this version.
14
14
 
15
15
  ## Status
16
16
 
17
- This is an early v1 scaffold with a working package surface, generated metadata pipeline, unit tests, and build output.
17
+ This is an early v1 SDK with a working package surface, generated metadata pipeline, unit tests, and publishable build output.
18
18
 
19
- What is included:
19
+ Included today:
20
20
 
21
21
  - root client via `createScuroClient(...)`
22
- - subpath-ready modules for `manifest`, `registry`, `contracts`, `flows`, `coordinator`, and `types`
22
+ - subpath exports for `manifest`, `registry`, `contracts`, `flows`, `coordinator`, and `types`
23
23
  - generated protocol manifest, enum labels, event signatures, proof-input metadata, and ABI constants
24
24
  - typed tx builders for staking, governance, gameplay, settlement, engine-registry admin actions, proof submission, and supported factory deployments
25
25
  - runtime helpers for NumberPicker, Slot Machine, Super Baccarat, Chemin de Fer, poker, and blackjack
26
26
  - slot preset admin helpers and GameEngineRegistry read/write helpers
27
27
  - poker and blackjack coordinator executors with injected proof providers
28
28
 
29
- What is not included yet:
29
+ Not included yet:
30
30
 
31
31
  - bundled proof generation or witness tooling
32
- - automatic fetching of AWS beta release manifests or actors records
32
+ - automatic fetching of hosted beta release manifests or actor records
33
33
  - full live integration tests against a running local Scuro deployment
34
34
 
35
- ## Package layout
36
-
37
- The package exports these entrypoints:
38
-
39
- - `@scuro/sdk`
40
- - `@scuro/sdk/manifest`
41
- - `@scuro/sdk/registry`
42
- - `@scuro/sdk/contracts`
43
- - `@scuro/sdk/flows`
44
- - `@scuro/sdk/coordinator`
45
- - `@scuro/sdk/types`
46
-
47
- The root entrypoint re-exports the main client constructor and the support modules.
48
-
49
35
  ## Install
50
36
 
51
37
  Use the prerelease channel while the SDK is aligned to the hosted beta network snapshot:
@@ -60,52 +46,98 @@ Use the stable channel only after a version has been intentionally promoted:
60
46
  npm install @scuro/sdk
61
47
  ```
62
48
 
63
- ## Quick start
49
+ ## Runtime Expectations
50
+
51
+ - Server-side runtime only: Node.js 18.14+ or Bun 1.3+
52
+ - Package format: ESM
53
+ - Primary transport/client dependency: [`viem`](https://viem.sh/)
54
+ - Browser support: out of scope for this release
55
+
56
+ ## Quick Start
57
+
58
+ ### Read-only client
59
+
60
+ Use a read-only client when you only need metadata, chain reads, or tx preparation.
64
61
 
65
62
  ```ts
66
- import { createPublicClient, createWalletClient, http } from "viem";
63
+ import { createPublicClient, http } from "viem";
67
64
  import { foundry } from "viem/chains";
68
- import { privateKeyToAccount } from "viem/accounts";
69
65
  import { createScuroClient, getDeploymentProfile } from "@scuro/sdk";
70
66
 
71
- const deployment = getDeploymentProfile("anvil-local");
72
- if (!deployment) {
67
+ const profile = getDeploymentProfile("anvil-local");
68
+ if (!profile?.rpcUrl) {
73
69
  throw new Error("missing anvil-local profile");
74
70
  }
75
71
 
76
72
  const publicClient = createPublicClient({
77
73
  chain: foundry,
78
- transport: http(deployment.rpcUrl)
74
+ transport: http(profile.rpcUrl)
75
+ });
76
+
77
+ const scuro = createScuroClient({
78
+ publicClient,
79
+ deployment: profile
80
+ });
81
+
82
+ const manifest = scuro.manifest.getProtocolManifest();
83
+ const governorDelay = await scuro.flows.governance.readConfig();
84
+ const approveTx = scuro.contracts.encode.approveSettlement(1000n);
85
+ ```
86
+
87
+ ### Signer-enabled client
88
+
89
+ Add `walletClient` when you want the SDK to submit writes for you. Read and encode helpers still work without it.
90
+
91
+ ```ts
92
+ import { createPublicClient, createWalletClient, http } from "viem";
93
+ import { privateKeyToAccount } from "viem/accounts";
94
+ import { foundry } from "viem/chains";
95
+ import { createScuroClient, getDeploymentProfile } from "@scuro/sdk";
96
+
97
+ const profile = getDeploymentProfile("anvil-local");
98
+ if (!profile?.rpcUrl || !profile.privateKeys?.Admin) {
99
+ throw new Error("missing anvil-local signer config");
100
+ }
101
+
102
+ const transport = http(profile.rpcUrl);
103
+ const account = privateKeyToAccount(profile.privateKeys.Admin);
104
+
105
+ const publicClient = createPublicClient({
106
+ chain: foundry,
107
+ transport
79
108
  });
80
109
 
81
110
  const walletClient = createWalletClient({
82
111
  chain: foundry,
83
- transport: http(deployment.rpcUrl),
84
- account: privateKeyToAccount(deployment.privateKeys!.Admin!)
112
+ transport,
113
+ account
85
114
  });
86
115
 
87
116
  const scuro = createScuroClient({
88
117
  publicClient,
89
118
  walletClient,
90
- deployment
119
+ deployment: profile
91
120
  });
92
121
 
93
- const manifest = scuro.manifest.getProtocolManifest();
94
- const approveTx = scuro.contracts.encode.approveSettlement(1000n);
122
+ const txHash = await scuro.contracts.write.approveSettlement(1000n);
95
123
  ```
96
124
 
97
125
  Built-in deployment profiles currently include:
98
126
 
99
127
  - `anvil-local` for local Foundry/Anvil development
100
- - `testnet-beta` for the hosted private AWS beta pinned to the March 30, 2026 release handoff
128
+ - `testnet-beta` for the hosted private beta pinned to the March 30, 2026 release handoff
129
+
130
+ Beta package releases should only move the checked-in `testnet-beta` snapshot intentionally when a new hosted deployment is promoted.
101
131
 
102
- Beta package releases should only move this checked-in `testnet-beta` snapshot intentionally when a new hosted deployment is promoted.
132
+ ## Entrypoints
103
133
 
104
- ## Core concepts
134
+ ### `@scuro/sdk`
105
135
 
106
- ### `manifest`
136
+ The root entrypoint exports the main client constructor plus the support modules.
107
137
 
108
- Use manifest helpers when you need checked-in protocol metadata, not chain state.
138
+ ### `@scuro/sdk/manifest`
139
+
140
+ Use manifest helpers when you need checked-in protocol metadata instead of chain state.
109
141
 
110
142
  ```ts
111
143
  import { getAbi, getContractMetadata, getProtocolManifest } from "@scuro/sdk/manifest";
@@ -115,15 +147,32 @@ const settlementMeta = getContractMetadata("ProtocolSettlement");
115
147
  const settlementAbi = getAbi("ProtocolSettlement");
116
148
  ```
117
149
 
118
- ### `registry`
150
+ ### `@scuro/sdk/registry`
119
151
 
120
- Use registry helpers to work with built-in deployment profiles or normalize your own chain-specific deployment records.
152
+ Use registry helpers for built-in deployment profiles or to register and normalize your own deployment records.
121
153
 
122
154
  ```ts
123
- import { getDeploymentProfile, normalizeDeploymentLabels } from "@scuro/sdk/registry";
155
+ import {
156
+ defineDeploymentProfile,
157
+ getDeploymentProfile,
158
+ normalizeDeploymentLabels
159
+ } from "@scuro/sdk/registry";
124
160
 
125
161
  const hostedBeta = getDeploymentProfile("testnet-beta");
126
162
 
163
+ defineDeploymentProfile({
164
+ key: "staging",
165
+ name: "Staging",
166
+ chainId: 31337,
167
+ rpcUrl: "https://staging-rpc.example.com",
168
+ labels: {
169
+ ScuroToken: "0x1000000000000000000000000000000000000001",
170
+ GameCatalog: "0x1000000000000000000000000000000000000005",
171
+ NumberPickerModuleId: "1",
172
+ NumberPickerExpressionTokenId: "1"
173
+ }
174
+ });
175
+
127
176
  const deployment = normalizeDeploymentLabels({
128
177
  ScuroToken: "0x1000000000000000000000000000000000000001",
129
178
  GameCatalog: "0x1000000000000000000000000000000000000005",
@@ -132,11 +181,9 @@ const deployment = normalizeDeploymentLabels({
132
181
  });
133
182
  ```
134
183
 
135
- The built-in `testnet-beta` profile is a checked-in snapshot of the March 30, 2026 private AWS beta release record. The canonical source of truth remains the protocol release artifacts, and SDK updates should only change this profile intentionally when a new deployment is promoted.
136
-
137
- ### `contracts`
184
+ ### `@scuro/sdk/contracts`
138
185
 
139
- Use contract helpers when you want typed transaction preparation, direct reads, and low-level control over write submission.
186
+ Use contract helpers when you want typed transaction preparation, direct reads, and explicit write submission.
140
187
 
141
188
  ```ts
142
189
  const tx = scuro.contracts.encode.startBlackjackHand({
@@ -148,15 +195,15 @@ const tx = scuro.contracts.encode.startBlackjackHand({
148
195
  const session = await scuro.contracts.read.blackjack.session(1n);
149
196
  ```
150
197
 
151
- ### `flows`
198
+ ### `@scuro/sdk/flows`
152
199
 
153
- Use flow helpers when you want documented workflow steps with some state guards already applied.
200
+ Use flow helpers when you want workflow-oriented helpers with useful state guards already applied.
154
201
 
155
202
  ```ts
156
203
  const stakingTxs = scuro.flows.staking.prepareApproveAndStake({
157
204
  approveAmount: 1000n,
158
205
  stakeAmount: 1000n,
159
- delegatee: deployment.labels.Admin
206
+ delegatee: scuro.deployment.actors.Admin
160
207
  });
161
208
 
162
209
  const blackjackActionTx = await scuro.flows.blackjack.prepareAction(7n, "doubleDown");
@@ -168,11 +215,11 @@ const slotTx = scuro.flows.slotMachine.prepareSpin({
168
215
  });
169
216
  ```
170
217
 
171
- ### `coordinator`
218
+ ### `@scuro/sdk/coordinator`
172
219
 
173
- Use coordinator helpers for operational proof submission loops.
220
+ Use coordinator helpers for operational proof submission loops in backend services.
174
221
 
175
- Proof generation stays outside the SDK. You inject proof providers that return the concrete calldata fields each engine expects.
222
+ Proof generation stays outside the SDK. You inject proof providers that return the calldata each engine expects.
176
223
 
177
224
  ```ts
178
225
  const blackjackCoordinator = scuro.coordinator.blackjack({
@@ -189,106 +236,16 @@ const blackjackCoordinator = scuro.coordinator.blackjack({
189
236
  await blackjackCoordinator.runUntilIdle(3n);
190
237
  ```
191
238
 
192
- More detail is in [docs/coordinators.md](./docs/coordinators.md).
193
-
194
- ## Supported helpers in this version
195
-
196
- ### Gameplay and protocol helpers
197
-
198
- - staking approvals, stake, unstake, and delegation
199
- - governance reads for threshold, delay, period, quorum, and state
200
- - catalog reads for module metadata and launchability checks
201
- - GameEngineRegistry reads and admin writes
202
- - NumberPicker play/finalize helpers
203
- - Slot Machine spin/settle helpers and slot preset admin helpers
204
- - Super Baccarat play/settle helpers
205
- - Chemin de Fer table lifecycle helpers
206
- - PvP poker session create/settle helpers
207
- - tournament poker create/start/report helpers
208
- - blackjack start/action/timeout/settle helpers
209
- - settlement tx builders
210
- - event decoding through protocol ABIs
211
-
212
- ### Factory deployment helpers
213
-
214
- Typed deployment-param encoders are included for:
215
-
216
- - NumberPicker
217
- - Blackjack
218
- - Super Baccarat
219
- - Slot Machine
220
- - Poker Single Draw 2-7
221
- - Chemin de Fer Baccarat
222
-
223
- Unsupported or underdocumented families should use the raw factory escape hatches. For the new solo and chemin modules, gameplay helpers require explicit `expressionTokenId` values rather than relying on built-in local profile defaults.
224
-
225
- ## Generated metadata
226
-
227
- The SDK does not read the sibling Scuro repo at runtime.
228
-
229
- Instead, `bun run generate-protocol` uses the checked-in upstream generated metadata as a base, then supplements missing module surfaces from sibling protocol artifacts:
230
-
231
- - `../scuro/docs/generated/protocol-manifest.json`
232
- - `../scuro/docs/generated/enum-labels.json`
233
- - `../scuro/docs/generated/event-signatures.json`
234
- - `../scuro/docs/generated/proof-inputs.json`
235
- - `../scuro/docs/generated/contracts/*.abi.json`
236
- - `../scuro/out/SlotMachine*.json`
237
- - `../scuro/out/SuperBaccarat*.json`
238
- - `../scuro/out/CheminDeFer*.json`
239
- - `../scuro/out/ICheminDeFerEngine.sol/ICheminDeFerEngine.json`
240
-
241
- The generated output is written into [`src/generated`](./src/generated).
242
-
243
- ## Development
244
-
245
- Install dependencies:
246
-
247
- ```bash
248
- bun install
249
- ```
250
-
251
- Regenerate protocol metadata:
252
-
253
- ```bash
254
- bun run generate-protocol
255
- ```
256
-
257
- Run checks:
258
-
259
- ```bash
260
- bun test
261
- bun run typecheck
262
- bun run build
263
- bun run smoke:node
264
- bun run release:check
265
- ```
266
-
267
- More detail is in [docs/development.md](./docs/development.md).
268
- The maintainer release playbook lives in [docs/releasing.md](./docs/releasing.md).
269
-
270
- ## Release preparation
271
-
272
- The package is set up to publish from built `dist/` output only.
273
-
274
- Useful preflight commands:
275
-
276
- ```bash
277
- bun run release:check
278
- bun run release:pack
279
- ```
280
-
281
- `bun run release:check` runs tests, typechecking, a fresh build, and a local release verification pass that confirms the exported files exist.
282
- `bun run release:pack` writes the tarball to `.artifacts/releases/` so release artifacts stay out of the repo root.
283
-
284
- GitHub Actions workflows are included for:
239
+ ## Deeper Guides
285
240
 
286
- - CI on pull requests and pushes to `main`
287
- - npm publish on GitHub Release publication, with prereleases publishing to the npm `beta` dist-tag and stable releases publishing to `latest`
288
- - optional beta testnet RPC smoke checks when `ENABLE_BETA_RPC_SMOKE=true`
241
+ - Integration guide: [docs/integration.md](./docs/integration.md)
242
+ - Coordinator operations: [docs/coordinators.md](./docs/coordinators.md)
243
+ - Contributor development workflow: [docs/development.md](./docs/development.md)
244
+ - Maintainer release workflow: [docs/releasing.md](./docs/releasing.md)
289
245
 
290
- ## Notes and caveats
246
+ ## Notes and Caveats
291
247
 
292
248
  - The built-in registry currently ships `anvil-local` and the pinned `testnet-beta` hosted profile.
249
+ - `walletClient` is optional on `createScuroClient(...)`, but write helpers require a signer and will fail without one.
293
250
  - The coordinator layer is designed for server-side orchestration, not browser automation.
294
251
  - Public helper types are intentionally lightweight in this revision to keep declaration output stable while the API is still settling.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@scuro/sdk",
3
- "version": "0.1.0-beta.1",
4
- "description": "Bun-first TypeScript SDK for the Scuro protocol",
3
+ "version": "0.1.0-beta.2",
4
+ "description": "Server-side TypeScript SDK for the Scuro protocol",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",