@no-witness-labs/midday-sdk 0.1.1 → 0.2.0

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.
@@ -0,0 +1,40 @@
1
+ /**
2
+ * Error types for DevNet operations.
3
+ *
4
+ * @since 0.2.0
5
+ * @module
6
+ */
7
+ import { Data } from 'effect';
8
+ /**
9
+ * Error thrown when cluster operations fail.
10
+ *
11
+ * @since 0.2.0
12
+ * @category errors
13
+ */
14
+ export class ClusterError extends Data.TaggedError('ClusterError') {
15
+ }
16
+ /**
17
+ * Error thrown when container operations fail.
18
+ *
19
+ * @since 0.2.0
20
+ * @category errors
21
+ */
22
+ export class ContainerError extends Data.TaggedError('ContainerError') {
23
+ }
24
+ /**
25
+ * Error thrown when health check fails.
26
+ *
27
+ * @since 0.2.0
28
+ * @category errors
29
+ */
30
+ export class HealthCheckError extends Data.TaggedError('HealthCheckError') {
31
+ }
32
+ /**
33
+ * Error thrown when Docker is not running.
34
+ *
35
+ * @since 0.2.0
36
+ * @category errors
37
+ */
38
+ export class DockerNotRunningError extends Data.TaggedError('DockerNotRunningError') {
39
+ }
40
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/devnet/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAE9B;;;;;GAKG;AACH,MAAM,OAAO,YAAa,SAAQ,IAAI,CAAC,WAAW,CAAC,cAAc,CAI/D;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,cAAe,SAAQ,IAAI,CAAC,WAAW,CAAC,gBAAgB,CAInE;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,IAAI,CAAC,WAAW,CAAC,kBAAkB,CAGvE;CAAG;AAEL;;;;;GAKG;AACH,MAAM,OAAO,qBAAsB,SAAQ,IAAI,CAAC,WAAW,CAAC,uBAAuB,CAEjF;CAAG"}
@@ -0,0 +1,72 @@
1
+ /**
2
+ * DevNet module for local Midnight development and testing.
3
+ *
4
+ * Provides a complete local development environment with Docker containers
5
+ * for Midnight node, indexer, and proof server.
6
+ *
7
+ * @example Promise API (default)
8
+ * ```typescript
9
+ * import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
10
+ * import { createClient } from '@no-witness-labs/midday-sdk';
11
+ *
12
+ * // Create and start a local devnet
13
+ * const cluster = await Cluster.make();
14
+ * await Cluster.start(cluster);
15
+ *
16
+ * // Use with midday-sdk
17
+ * const client = await createClient({
18
+ * networkConfig: Cluster.toNetworkConfig(cluster),
19
+ * seed: 'your-wallet-seed',
20
+ * });
21
+ *
22
+ * // ... run your tests or development ...
23
+ *
24
+ * // Cleanup
25
+ * await Cluster.remove(cluster);
26
+ * ```
27
+ *
28
+ * @example Effect API (composable)
29
+ * ```typescript
30
+ * import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
31
+ * import { Effect } from 'effect';
32
+ *
33
+ * // Compose with Effect
34
+ * const program = Effect.gen(function* () {
35
+ * const cluster = yield* Cluster.effect.make();
36
+ * yield* Cluster.effect.start(cluster);
37
+ * // ... your Effect-based code ...
38
+ * yield* Cluster.effect.remove(cluster);
39
+ * });
40
+ *
41
+ * await Effect.runPromise(program);
42
+ * ```
43
+ *
44
+ * @example Effect DI (dependency injection)
45
+ * ```typescript
46
+ * import { Cluster, ClusterService } from '@no-witness-labs/midday-sdk/devnet';
47
+ * import { Effect } from 'effect';
48
+ *
49
+ * // Use with Effect's dependency injection
50
+ * const program = Effect.gen(function* () {
51
+ * const svc = yield* ClusterService;
52
+ * const cluster = yield* svc.make();
53
+ * yield* svc.start(cluster);
54
+ * return Cluster.toNetworkConfig(cluster);
55
+ * });
56
+ *
57
+ * await Effect.runPromise(program.pipe(Effect.provide(Cluster.Live)));
58
+ * ```
59
+ *
60
+ * @since 0.2.0
61
+ * @module
62
+ */
63
+ export * as Cluster from './Cluster.js';
64
+ export * as Config from './Config.js';
65
+ export * as Container from './Container.js';
66
+ export * as Health from './Health.js';
67
+ export * as Images from './Images.js';
68
+ export * from './errors.js';
69
+ export { ClusterService } from './Cluster.js';
70
+ export { ContainerService } from './Container.js';
71
+ export { HealthService } from './Health.js';
72
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/devnet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC;AAG5B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * DevNet module for local Midnight development and testing.
3
+ *
4
+ * Provides a complete local development environment with Docker containers
5
+ * for Midnight node, indexer, and proof server.
6
+ *
7
+ * @example Promise API (default)
8
+ * ```typescript
9
+ * import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
10
+ * import { createClient } from '@no-witness-labs/midday-sdk';
11
+ *
12
+ * // Create and start a local devnet
13
+ * const cluster = await Cluster.make();
14
+ * await Cluster.start(cluster);
15
+ *
16
+ * // Use with midday-sdk
17
+ * const client = await createClient({
18
+ * networkConfig: Cluster.toNetworkConfig(cluster),
19
+ * seed: 'your-wallet-seed',
20
+ * });
21
+ *
22
+ * // ... run your tests or development ...
23
+ *
24
+ * // Cleanup
25
+ * await Cluster.remove(cluster);
26
+ * ```
27
+ *
28
+ * @example Effect API (composable)
29
+ * ```typescript
30
+ * import { Cluster } from '@no-witness-labs/midday-sdk/devnet';
31
+ * import { Effect } from 'effect';
32
+ *
33
+ * // Compose with Effect
34
+ * const program = Effect.gen(function* () {
35
+ * const cluster = yield* Cluster.effect.make();
36
+ * yield* Cluster.effect.start(cluster);
37
+ * // ... your Effect-based code ...
38
+ * yield* Cluster.effect.remove(cluster);
39
+ * });
40
+ *
41
+ * await Effect.runPromise(program);
42
+ * ```
43
+ *
44
+ * @example Effect DI (dependency injection)
45
+ * ```typescript
46
+ * import { Cluster, ClusterService } from '@no-witness-labs/midday-sdk/devnet';
47
+ * import { Effect } from 'effect';
48
+ *
49
+ * // Use with Effect's dependency injection
50
+ * const program = Effect.gen(function* () {
51
+ * const svc = yield* ClusterService;
52
+ * const cluster = yield* svc.make();
53
+ * yield* svc.start(cluster);
54
+ * return Cluster.toNetworkConfig(cluster);
55
+ * });
56
+ *
57
+ * await Effect.runPromise(program.pipe(Effect.provide(Cluster.Live)));
58
+ * ```
59
+ *
60
+ * @since 0.2.0
61
+ * @module
62
+ */
63
+ export * as Cluster from './Cluster.js';
64
+ export * as Config from './Config.js';
65
+ export * as Container from './Container.js';
66
+ export * as Health from './Health.js';
67
+ export * as Images from './Images.js';
68
+ export * from './errors.js';
69
+ // Re-export service tags for DI users
70
+ export { ClusterService } from './Cluster.js';
71
+ export { ContainerService } from './Container.js';
72
+ export { HealthService } from './Health.js';
73
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/devnet/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6DG;AAEH,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,cAAc,aAAa,CAAC;AAE5B,sCAAsC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@no-witness-labs/midday-sdk",
3
- "version": "0.1.1",
3
+ "version": "0.2.0",
4
4
  "description": "Developer-friendly SDK for building dapps on Midnight Network",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,6 +9,10 @@
9
9
  ".": {
10
10
  "types": "./dist/index.d.ts",
11
11
  "import": "./dist/index.js"
12
+ },
13
+ "./devnet": {
14
+ "types": "./dist/devnet/index.d.ts",
15
+ "import": "./dist/devnet/index.js"
12
16
  }
13
17
  },
14
18
  "files": [
@@ -30,17 +34,22 @@
30
34
  "@midnight-ntwrk/wallet-sdk-hd": "3.0.0-beta.7",
31
35
  "@midnight-ntwrk/wallet-sdk-shielded": "1.0.0-beta.12",
32
36
  "@midnight-ntwrk/wallet-sdk-unshielded-wallet": "1.0.0-beta.14",
37
+ "dockerode": "^4.0.7",
38
+ "effect": "^3.19.15",
33
39
  "pino": "^8.16.0",
34
40
  "pino-pretty": "^10.2.3",
35
- "rxjs": "^7.8.1"
41
+ "rxjs": "^7.8.1",
42
+ "ws": "^8.18.0"
36
43
  },
37
44
  "devDependencies": {
38
45
  "@changesets/cli": "^2.28.1",
39
- "typedoc": "^0.28.7",
40
- "typedoc-plugin-markdown": "^4.6.3",
41
46
  "@eslint/js": "^9.34.0",
47
+ "@types/dockerode": "^3.3.43",
42
48
  "@types/node": "^22.0.0",
49
+ "@types/ws": "^8.5.10",
43
50
  "eslint": "^9.34.0",
51
+ "typedoc": "^0.28.7",
52
+ "typedoc-plugin-markdown": "^4.6.3",
44
53
  "typescript": "^5.6.0",
45
54
  "typescript-eslint": "^8.33.0",
46
55
  "vitest": "^3.2.4"
@@ -76,6 +85,7 @@
76
85
  "docgen:html": "typedoc --options typedoc.html.json",
77
86
  "test": "vitest run",
78
87
  "test:watch": "vitest",
88
+ "test:devnet": "vitest run test/devnet.integration.test.ts",
79
89
  "changeset": "changeset",
80
90
  "changeset:version": "changeset version",
81
91
  "changeset:publish": "pnpm build && changeset publish"