@dust-dice/verifier 0.4.0 → 0.4.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.
package/package.json CHANGED
@@ -1,18 +1,33 @@
1
1
  {
2
2
  "name": "@dust-dice/verifier",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "type": "module",
5
5
  "description": "Independent verifier for Dust Dice: replays every roll of a finished table from the chain's own record \u2014 no operator, no trust \u2014 and the shared read-side helpers (compiled-contract handles, indexer queries).",
6
6
  "exports": {
7
+ ".": {
8
+ "types": "./dist/index.d.ts",
9
+ "default": "./dist/index.js"
10
+ },
11
+ "./config": {
12
+ "types": "./dist/config.d.ts",
13
+ "default": "./dist/config.js"
14
+ },
15
+ "./contracts": {
16
+ "types": "./dist/contracts.d.ts",
17
+ "default": "./dist/contracts.js"
18
+ },
19
+ "./indexer": {
20
+ "types": "./dist/indexer.d.ts",
21
+ "default": "./dist/indexer.js"
22
+ },
7
23
  "./src/*": "./src/*"
8
24
  },
9
25
  "scripts": {
26
+ "build": "rm -rf dist && tsc -p tsconfig.build.json && chmod +x dist/verify.js",
10
27
  "verify": "node src/verify.ts",
11
28
  "typecheck": "tsc -p tsconfig.json --noEmit"
12
29
  },
13
30
  "dependencies": {
14
- "@dust-dice/api": "0.4.0",
15
- "@dust-dice/contract": "0.4.0",
16
31
  "@midnight-ntwrk/compact-runtime": "0.19.0",
17
32
  "@midnight-ntwrk/midnight-js-indexer-public-data-provider": "5.0.0-beta.7",
18
33
  "@midnight-ntwrk/midnight-js-network-id": "5.0.0-beta.7",
@@ -27,16 +42,26 @@
27
42
  "access": "public"
28
43
  },
29
44
  "files": [
45
+ "dist",
30
46
  "src"
31
47
  ],
32
48
  "repository": {
33
49
  "type": "git",
34
- "url": "https://github.com/chrispalaskas/dust-dice-contract.git",
50
+ "url": "git+https://github.com/chrispalaskas/dust-dice-contract.git",
35
51
  "directory": "verifier"
36
52
  },
37
53
  "license": "Apache-2.0",
38
54
  "engines": {
39
- "node": ">=22.6"
55
+ "node": ">=22"
40
56
  },
41
- "//engines": "src/verify.ts runs as TypeScript under Node's type stripping (default from Node 23; --experimental-strip-types on 22.6+)."
57
+ "main": "dist/index.js",
58
+ "types": "dist/index.d.ts",
59
+ "bin": {
60
+ "dust-dice-verify": "dist/verify.js"
61
+ },
62
+ "peerDependencies": {
63
+ "@dust-dice/api": ">=0.4.0",
64
+ "@dust-dice/contract": ">=0.4.1"
65
+ },
66
+ "//peerDependencies": "The verifier resolves the compiled contract artifacts from wherever @dust-dice/contract is installed next to it. As regular dependencies with exact pins, npm nested a second copy of the contract package under the verifier whenever the consumer's version differed \u2014 and that copy was the one its config found (dust-dice bug #33). Peers make the consumer's single copy the only one."
42
67
  }
package/src/config.ts CHANGED
@@ -4,6 +4,7 @@
4
4
  * The verifier's configuration: which network to read, and where the compiled contract lives.
5
5
  * Nothing here is a secret or a game parameter — the verifier only READS the chain.
6
6
  */
7
+ import * as fs from 'node:fs';
7
8
  import * as path from 'node:path';
8
9
  import { createRequire } from 'node:module';
9
10
  import { resolveNetwork, type NetworkConfig } from '@dust-dice/api/node';
@@ -14,6 +15,17 @@ const require = createRequire(import.meta.url);
14
15
  export const NETWORK: NetworkConfig = resolveNetwork();
15
16
 
16
17
  const CONTRACT_ROOT = path.dirname(require.resolve('@dust-dice/contract/package.json'));
17
- /** compactc output for the two deployable contracts (`npm run compact -w contract`). */
18
- export const MANAGED_TABLE = path.join(CONTRACT_ROOT, 'src', 'managed', 'table');
19
- export const MANAGED_LOBBY = path.join(CONTRACT_ROOT, 'src', 'managed', 'lobby');
18
+ /**
19
+ * Where `@dust-dice/contract` keeps compactc's output for the two deployables. The PUBLISHED
20
+ * package ships them under `dist/managed` (keys and ZKIR for table and lobby only); a source
21
+ * checkout that has compiled but not built has them under `src/managed`. Prefer the built copy,
22
+ * which is what a consumer installs, and fall back to the source tree for development.
23
+ */
24
+ const managedRoot = ((): string => {
25
+ const built = path.join(CONTRACT_ROOT, 'dist', 'managed');
26
+ return fs.existsSync(path.join(built, 'table', 'keys'))
27
+ ? built
28
+ : path.join(CONTRACT_ROOT, 'src', 'managed');
29
+ })();
30
+ export const MANAGED_TABLE = path.join(managedRoot, 'table');
31
+ export const MANAGED_LOBBY = path.join(managedRoot, 'lobby');
package/src/index.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Copyright (C) Shielded Technologies
2
+ // SPDX-License-Identifier: Apache-2.0
3
+ /**
4
+ * The read side of Dust Dice, for anyone: compiled-contract handles, indexer queries, and the
5
+ * network/artifact configuration. The verifier itself is the package's `bin` (`dust-dice-verify`)
6
+ * and is deliberately not re-exported here — importing it runs it.
7
+ */
8
+ export * from './config.ts';
9
+ export * from './contracts.ts';
10
+ export * from './indexer.ts';