@rolly-dev/witness-core 0.3.2 → 1.0.1

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.
package/index.d.ts CHANGED
@@ -68,7 +68,7 @@ export interface DirtyNode {
68
68
  index: number
69
69
  hash: Buffer
70
70
  }
71
- /** One dirty raw balance leaf (56-byte little-endian, 7 limbs). */
71
+ /** One dirty raw balance leaf (64-byte little-endian, 8 limbs). */
72
72
  export interface DirtyRaw {
73
73
  userId: number
74
74
  raw: Buffer
@@ -105,8 +105,8 @@ export interface DirtyData {
105
105
  }
106
106
  /**
107
107
  * Per-tx request from Node. Opaque field groups arrive as little-endian
108
- * `Buffer`s (`session_key` / `new_pk_hash` / `user_secret_random` = 32 bytes =
109
- * 4 limbs; `user_address` = 20 bytes); monetary values arrive as decimal
108
+ * `Buffer`s (`new_pk_hash` / `user_secret_random` = 32 bytes = 4 limbs;
109
+ * `user_address` = 20 bytes); monetary values arrive as decimal
110
110
  * strings to dodge JS `Number` precision and `BigInt`-in-object quirks. Node
111
111
  * keeps all hex/string parsing (incl. deriving `user_secret_random` from the
112
112
  * raw user-seed source via wasm-signer); the engine takes only parsed bytes.
@@ -117,9 +117,20 @@ export interface ProcessTxRequest {
117
117
  amount: string
118
118
  winAmount?: string
119
119
  userAddress?: Buffer
120
- sessionKey?: Buffer
121
- sessionExpiry?: string
120
+ /**
121
+ * `Poseidon2(recipient_address)[0..2]` as 16 little-endian bytes (2 limbs)
122
+ * — the payout counterparty (hot wallet) the client Schnorr-signs. Absent
123
+ * for operator / non-authenticated tx.
124
+ */
125
+ recipientAddrHash?: Buffer
122
126
  newPkHash?: Buffer
127
+ /**
128
+ * Client authorization signature bytes, forwarded verbatim (opaque here).
129
+ * EcGFp5 Schnorr `(s, e)` over the tx_hash for a user-authenticated tx, or
130
+ * an EIP-712 secp256k1 signature for `key_register`. Absent for operator /
131
+ * L1-event tx. See [`process::TxRequest::signature`].
132
+ */
133
+ signature?: Buffer
123
134
  gameId?: number
124
135
  gameMode?: number
125
136
  predictionLo?: number
@@ -131,7 +142,6 @@ export interface ProcessTxRequest {
131
142
  baseBet?: string
132
143
  userSecretRandom?: Buffer
133
144
  useGameLock?: boolean
134
- maxBlockTimestamp?: string
135
145
  }
136
146
  /**
137
147
  * Authoritative post-tx result returned to Node. Monetary values are decimal
@@ -143,6 +153,7 @@ export interface ProcessTxResult {
143
153
  newBalance: string
144
154
  available: string
145
155
  newCredit: string
156
+ newNonce: string
146
157
  winAmount: string
147
158
  random?: string
148
159
  nextSeedHash?: string
@@ -274,6 +285,7 @@ export declare class MerkleEngine {
274
285
  getTl(): bigint
275
286
  getBalance(userId: number): bigint
276
287
  getCredit(userId: number): bigint
288
+ getNonce(userId: number): bigint
277
289
  /** Spendable balance minus all frozen buckets (withdrawal + game locks). */
278
290
  getAvailable(userId: number): bigint
279
291
  getSeedHash(userId: number): Buffer
@@ -305,6 +317,21 @@ export declare class MerkleEngine {
305
317
  releaseSeed(userId: number): void
306
318
  /** Whether `user_id` currently holds a live (non-expired) seed reservation. */
307
319
  isSeedReserved(userId: number): boolean
320
+ /**
321
+ * Open a crash-round auth lock for `user_id`: while set, `process_tx`
322
+ * rejects any nonce-bumping tx (`in_house_bet` / `withdrawal` / `transfer`
323
+ * / `key_register`) with `CrashRoundOpen`, so the account's pre-signed
324
+ * `crash_settle` auto-cashout keeps its bound nonce. Called by the crash
325
+ * game when a bet is placed. NON-consensus; idempotent.
326
+ */
327
+ lockCrashRound(userId: number): void
328
+ /**
329
+ * Release a crash-round auth lock (the round settled or was abandoned).
330
+ * No-op when the user has none.
331
+ */
332
+ unlockCrashRound(userId: number): void
333
+ /** Whether `user_id` currently has an open crash-round auth lock. */
334
+ isCrashRoundLocked(userId: number): boolean
308
335
  getPkHash(userId: number): Buffer
309
336
  getAddressHash(userId: number): Buffer
310
337
  getLockedTotal(userId: number): bigint
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rolly-dev/witness-core",
3
- "version": "0.3.2",
3
+ "version": "1.0.1",
4
4
  "description": "Authoritative native witness-state engine for Rolly ZK-Rollup (Node-API addon)",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
Binary file
Binary file