@midnight-ntwrk/wallet-sdk-node-client 1.0.0-beta.9 → 1.0.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.
package/README.md ADDED
@@ -0,0 +1,88 @@
1
+ # @midnight-ntwrk/wallet-sdk-node-client
2
+
3
+ Client for communicating with the Midnight blockchain node.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install @midnight-ntwrk/wallet-sdk-node-client
9
+ ```
10
+
11
+ ## Overview
12
+
13
+ This package provides a client for interacting with the Midnight blockchain node using Polkadot.js APIs. It handles:
14
+
15
+ - RPC communication with the node
16
+ - Transaction submission and tracking
17
+ - Blockchain state queries
18
+ - Type-safe interactions via generated types
19
+
20
+ ## Usage
21
+
22
+ ### Basic Usage
23
+
24
+ ```typescript
25
+ import { PolkadotNodeClient, makeConfig } from '@midnight-ntwrk/wallet-sdk-node-client';
26
+
27
+ // Initialize the client
28
+ const config = makeConfig({ endpoint: 'ws://localhost:9944' });
29
+ const client = await PolkadotNodeClient.init(config);
30
+
31
+ // Submit a transaction and wait for finalization
32
+ const result = await client.sendMidnightTransactionAndWait(serializedTransaction, 'Finalized');
33
+
34
+ // Clean up
35
+ await client.close();
36
+ ```
37
+
38
+ ### Tracking Submission Events
39
+
40
+ ```typescript
41
+ // Get an observable of submission events
42
+ const events$ = client.sendMidnightTransaction(serializedTransaction);
43
+
44
+ events$.subscribe({
45
+ next: (event) => {
46
+ switch (event._tag) {
47
+ case 'Submitted':
48
+ console.log('Transaction submitted');
49
+ break;
50
+ case 'InBlock':
51
+ console.log('Transaction in block:', event.blockHash);
52
+ break;
53
+ case 'Finalized':
54
+ console.log('Transaction finalized');
55
+ break;
56
+ }
57
+ },
58
+ });
59
+ ```
60
+
61
+ ## Exports
62
+
63
+ ### Default Export
64
+
65
+ - `PolkadotNodeClient` - Main client class for node communication
66
+ - `Config` - Configuration type
67
+ - `makeConfig` - Configuration factory function
68
+ - `DEFAULT_CONFIG` - Default configuration values
69
+
70
+ ### Effect Submodule (`/effect`)
71
+
72
+ Effect.ts-based implementation for functional programming patterns:
73
+
74
+ ```typescript
75
+ import { NodeClient, PolkadotNodeClient } from '@midnight-ntwrk/wallet-sdk-node-client/effect';
76
+ ```
77
+
78
+ ### Testing Submodule (`/testing`)
79
+
80
+ Testing utilities and mocks:
81
+
82
+ ```typescript
83
+ import { ... } from '@midnight-ntwrk/wallet-sdk-node-client/testing';
84
+ ```
85
+
86
+ ## License
87
+
88
+ Apache-2.0
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Context, Effect, Option, Stream } from 'effect';
2
14
  import * as SubmissionEvent from './SubmissionEvent.js';
3
15
  import * as NodeClientError from './NodeClientError.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Data } from 'effect';
2
14
  export class SubmissionError extends Data.TaggedError('SubmissionError') {
3
15
  }
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import '../gen/augment-api.js';
2
14
  import { ApiPromise, WsProvider } from '@polkadot/api';
3
15
  import { Duration, Effect, Either, Layer, pipe, Schedule, Schema, Stream, } from 'effect';
@@ -21,6 +33,7 @@ export class PolkadotNodeClient {
21
33
  // @ts-expect-error -- exactOptionalPropertyTypes cause an incompatibility here
22
34
  provider: new WsProvider(config.nodeURL.toString()),
23
35
  throwOnConnect: false,
36
+ noInitWarn: true,
24
37
  })), (api) => Effect.promise(() => api.disconnect())).pipe(Effect.map((api) => new PolkadotNodeClient(config, api)));
25
38
  }
26
39
  static layer(configInput) {
@@ -1,2 +1,14 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Data } from 'effect';
2
14
  export const { Submitted, InBlock, Finalized, $match: match, $is: is } = Data.taggedEnum();
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * as NodeClient from './NodeClient.js';
2
14
  export * from './PolkadotNodeClient.js';
3
15
  export * as SubmissionEvent from './SubmissionEvent.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  /* eslint-disable */
2
14
  /**
3
15
  * Auto-generated with scripts/generate-types.ts
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  /* eslint-disable */
2
14
  /**
3
15
  * Auto-generated with scripts/generate-types.ts
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  /* eslint-disable */
2
14
  /**
3
15
  * Auto-generated with scripts/generate-types.ts
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  /* eslint-disable */
2
14
  /**
3
15
  * Auto-generated with scripts/generate-types.ts
package/dist/index.js CHANGED
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { NodeClient, PolkadotNodeClient as EffectNodeClient, } from './effect/index.js';
2
14
  import { Effect, Exit, pipe, Scope } from 'effect';
3
15
  import { ObservableOps } from '@midnight-ntwrk/wallet-sdk-utilities';
@@ -1 +1,13 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  export * as TestTransactions from './test-transactions.js';
@@ -1,3 +1,15 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { Encoding } from 'effect';
2
14
  export function normalizeTxs(tx) {
3
15
  const normalizedTxs = {
@@ -1,5 +1,5 @@
1
1
  import { Error, FileSystem } from '@effect/platform';
2
- import * as ledger from '@midnight-ntwrk/ledger-v6';
2
+ import * as ledger from '@midnight-ntwrk/ledger-v7';
3
3
  import { SerializedTransaction } from '@midnight-ntwrk/wallet-sdk-abstractions';
4
4
  import { ProverClient } from '@midnight-ntwrk/wallet-sdk-prover-client/effect';
5
5
  import { ClientError, ServerError } from '@midnight-ntwrk/wallet-sdk-utilities/networking';
@@ -1,5 +1,17 @@
1
+ // This file is part of MIDNIGHT-WALLET-SDK.
2
+ // Copyright (C) 2025 Midnight Foundation
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ // Licensed under the Apache License, Version 2.0 (the "License");
5
+ // You may not use this file except in compliance with the License.
6
+ // You may obtain a copy of the License at
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ // Unless required by applicable law or agreed to in writing, software
9
+ // distributed under the License is distributed on an "AS IS" BASIS,
10
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11
+ // See the License for the specific language governing permissions and
12
+ // limitations under the License.
1
13
  import { FileSystem } from '@effect/platform';
2
- import * as ledger from '@midnight-ntwrk/ledger-v6';
14
+ import * as ledger from '@midnight-ntwrk/ledger-v7';
3
15
  import { SerializedTransaction } from '@midnight-ntwrk/wallet-sdk-abstractions';
4
16
  import { HttpProverClient, ProverClient } from '@midnight-ntwrk/wallet-sdk-prover-client/effect';
5
17
  import { TestContainers } from '@midnight-ntwrk/wallet-sdk-utilities/testing';
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/wallet-sdk-node-client",
3
- "version": "1.0.0-beta.9",
3
+ "version": "1.0.0",
4
4
  "type": "module",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
7
- "author": "IOHK",
7
+ "author": "Midnight Foundation",
8
8
  "license": "Apache-2.0",
9
9
  "publishConfig": {
10
10
  "registry": "https://npm.pkg.github.com/"
@@ -43,9 +43,9 @@
43
43
  "@polkadot/types-support": "^16.3.1",
44
44
  "@types/bn.js": "^5.2.0",
45
45
  "bn.js": "^5.2.2",
46
- "effect": "^3.17.3",
46
+ "effect": "^3.19.14",
47
47
  "rxjs": "^7.5",
48
- "testcontainers": "^11.4.0"
48
+ "testcontainers": "^11.10.0"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@effect/cluster": "^0.46.2",
@@ -55,18 +55,19 @@
55
55
  "@effect/rpc": "^0.68.0",
56
56
  "@effect/sql": "^0.44.0",
57
57
  "@effect/workflow": "^0.8.1",
58
- "@midnight-ntwrk/ledger-v6": "6.1.0-alpha.5",
59
- "@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0-beta.8",
60
- "@midnight-ntwrk/wallet-sdk-prover-client": "1.0.0-beta.8",
61
- "@midnight-ntwrk/wallet-sdk-utilities": "1.0.0-beta.7",
58
+ "@midnight-ntwrk/ledger-v7": "7.0.0",
59
+ "@midnight-ntwrk/wallet-sdk-abstractions": "1.0.0",
60
+ "@midnight-ntwrk/wallet-sdk-prover-client": "1.0.0",
61
+ "@midnight-ntwrk/wallet-sdk-utilities": "1.0.0",
62
62
  "@polkadot/typegen": "^16.3.1",
63
63
  "@types/yargs": "^17.0.33",
64
64
  "eslint": "^9.37.0",
65
+ "prettier": "^3.7.0",
65
66
  "publint": "~0.3.14",
66
67
  "rimraf": "^6.0.1",
67
68
  "tsx": "^4.20.4",
68
69
  "typescript": "^5.9.3",
69
- "vitest": "^3.2.4",
70
+ "vitest": "^4.0.16",
70
71
  "yargs": "^18.0.0"
71
72
  },
72
73
  "scripts": {
@@ -75,7 +76,8 @@
75
76
  "typecheck": "tsc -b ./tsconfig.json --noEmit",
76
77
  "test": "vitest run",
77
78
  "lint": "eslint --max-warnings 0",
78
- "format": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
79
+ "format": "prettier --write \"**/*.{ts,js,json,yaml,yml,md}\"",
80
+ "format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml,md}\"",
79
81
  "dist": "tsc -b ./tsconfig.build.json",
80
82
  "dist:publish": "tsc -b ./tsconfig.publish.json",
81
83
  "clean": "rimraf --glob dist 'tsconfig.*.tsbuildinfo' && date +%s > .clean-timestamp",