@midnight-ntwrk/wallet-sdk-utilities 1.0.0-beta.7 → 1.0.0-beta.9

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/dist/ArrayOps.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 { reduce, match } from 'effect/Array';
2
14
  import { dual } from 'effect/Function';
3
15
  export const fold = dual(2, (arr, folder) => arr.reduce(folder));
package/dist/BlobOps.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
  /**
2
14
  * Browser-compatible utility for converting a Blob to Uint8Array.
3
15
  * Uses arrayBuffer() instead of bytes() for broader browser support.
package/dist/DateOps.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
  export const dateToSeconds = (date) => {
2
14
  return BigInt(Math.floor(date.getTime() / 1000));
3
15
  };
package/dist/EitherOps.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 { Effect, Either, Data } from 'effect';
2
14
  import { dual } from 'effect/Function';
3
15
  export const toEffect = (either) => {
package/dist/LedgerOps.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 { Either, Data } from 'effect';
2
14
  export class LedgerError extends Data.TaggedError('LedgerError') {
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 { Effect, Stream, Fiber, Option, Chunk } from 'effect';
2
14
  import { Observable } from 'rxjs';
3
15
  /**
package/dist/RecordOps.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
  export const merge = (combine) => (records) => {
2
14
  const result = {};
3
15
  for (const record of records) {
package/dist/hlist.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
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
14
  import { dispatch } from './polyFunction.js';
3
15
  export const empty = [];
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
  export * as ArrayOps from './ArrayOps.js';
2
14
  export * as BlobOps from './BlobOps.js';
3
15
  export * as DateOps from './DateOps.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
  /**
3
15
  * An error representing a connection or client-side error.
@@ -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 { Either } from 'effect';
2
14
  import * as Brand from 'effect/Brand';
3
15
  import { InvalidProtocolSchemeError } from './URLError.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
  /**
3
15
  * A configuration error where the protocol scheme of a given server URL was unexpected (e.g., used
@@ -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 { Either } from 'effect';
2
14
  import * as Brand from 'effect/Brand';
3
15
  import { InvalidProtocolSchemeError } from './URLError.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
  export * as HttpURL from './HttpURL.js';
2
14
  export * as WsURL from './WsURL.js';
3
15
  export * from './URLError.js';
@@ -0,0 +1,31 @@
1
+ /**
2
+ * Gets the absolute path to the repository root directory.
3
+ *
4
+ * @returns The absolute path to the repository root
5
+ */
6
+ export declare function getRepositoryRoot(): string;
7
+ /**
8
+ * Gets the absolute path to the docker compose directory.
9
+ *
10
+ * @returns The absolute path to the compose directory
11
+ */
12
+ export declare function getComposeDirectory(): string;
13
+ /**
14
+ * Options for building test environment variables.
15
+ */
16
+ export interface BuildTestEnvironmentVariablesOptions {
17
+ /**
18
+ * Additional environment variables to include.
19
+ * These will be merged with the variables collected from process.env.
20
+ */
21
+ additionalVars?: Record<string, string>;
22
+ }
23
+ /**
24
+ * Builds and validates environment variables for test containers.
25
+ * Throws an error if any required environment variable from envVarsToPass is missing.
26
+ *
27
+ * @param envVarsToPass - Array of environment variable names to collect from process.env
28
+ * @param options - Optional configuration for building environment variables
29
+ * @returns Record of environment variables to pass to Docker Compose
30
+ */
31
+ export declare function buildTestEnvironmentVariables(envVarsToPass: readonly string[], options?: BuildTestEnvironmentVariablesOptions): Record<string, string>;
@@ -0,0 +1,58 @@
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.
13
+ import * as path from 'node:path';
14
+ import { fileURLToPath } from 'node:url';
15
+ /**
16
+ * Gets the absolute path to the repository root directory.
17
+ *
18
+ * @returns The absolute path to the repository root
19
+ */
20
+ export function getRepositoryRoot() {
21
+ const currentFile = fileURLToPath(import.meta.url);
22
+ const currentDir = path.dirname(currentFile);
23
+ return path.resolve(currentDir, '../../../../');
24
+ }
25
+ /**
26
+ * Gets the absolute path to the docker compose directory.
27
+ *
28
+ * @returns The absolute path to the compose directory
29
+ */
30
+ export function getComposeDirectory() {
31
+ const repoRoot = getRepositoryRoot();
32
+ return path.join(repoRoot, 'infra', 'compose');
33
+ }
34
+ /**
35
+ * Builds and validates environment variables for test containers.
36
+ * Throws an error if any required environment variable from envVarsToPass is missing.
37
+ *
38
+ * @param envVarsToPass - Array of environment variable names to collect from process.env
39
+ * @param options - Optional configuration for building environment variables
40
+ * @returns Record of environment variables to pass to Docker Compose
41
+ */
42
+ export function buildTestEnvironmentVariables(envVarsToPass, options) {
43
+ // Add any additional vars first (so they can be overridden by process.env vars if needed)
44
+ const environmentVars = {
45
+ ...options?.additionalVars,
46
+ };
47
+ // Collect and validate required environment variables
48
+ for (const envVar of envVarsToPass) {
49
+ const value = process.env[envVar];
50
+ if (value) {
51
+ environmentVars[envVar] = value;
52
+ }
53
+ else {
54
+ throw new Error(`Required environment variable ${envVar} is not set. Please ensure it is exported in your shell or CI environment.`);
55
+ }
56
+ }
57
+ return environmentVars;
58
+ }
@@ -1 +1,2 @@
1
1
  export * as TestContainers from './test-containers.js';
2
+ export * from './compose.js';
@@ -1 +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
  export * as TestContainers from './test-containers.js';
14
+ export * from './compose.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 { Effect, identity } from 'effect';
2
14
  import { GenericContainer, Network, Wait } from 'testcontainers';
3
15
  import { getPortPromise } from 'portfinder';
@@ -6,7 +18,7 @@ const startContainer = (container) => {
6
18
  return Effect.acquireRelease(Effect.promise(() => container.start()), (container) => Effect.promise(() => container.stop({ timeout: 5_000 })));
7
19
  };
8
20
  export const runNodeContainer = (adjustment = identity) => {
9
- const container = new GenericContainer('ghcr.io/midnight-ntwrk/midnight-node:0.18.0-rc.4')
21
+ const container = new GenericContainer('ghcr.io/midnight-ntwrk/midnight-node:0.20.0-alpha.1')
10
22
  .withEnvironment({
11
23
  CFG_PRESET: 'dev',
12
24
  SIDECHAIN_BLOCK_BENEFICIARY: '04bcf7ad3be7a5c790460be82a713af570f22e0f801f6659ab8e84a52be6969e',
@@ -16,7 +28,7 @@ export const runNodeContainer = (adjustment = identity) => {
16
28
  return startContainer(adjustment(container));
17
29
  };
18
30
  export const runProofServerContainer = (adjustment = identity) => {
19
- const container = new GenericContainer('ghcr.io/midnight-ntwrk/proof-server:6.1.0-alpha.5')
31
+ const container = new GenericContainer('ghcr.io/midnight-ntwrk/proof-server:7.0.0-alpha.1')
20
32
  .withEnvironment({
21
33
  RUST_BACKTRACE: 'full',
22
34
  })
@@ -26,7 +38,7 @@ export const runProofServerContainer = (adjustment = identity) => {
26
38
  return startContainer(adjustment(container));
27
39
  };
28
40
  export const runTxGenerator = (config, adjustment = identity) => {
29
- const container = new GenericContainer('ghcr.io/midnight-ntwrk/midnight-node-toolkit:0.18.0-rc.4')
41
+ const container = new GenericContainer('ghcr.io/midnight-ntwrk/midnight-node-toolkit:0.20.0-alpha.1')
30
42
  .withBindMounts([{ source: config.destPath, target: '/tmp', mode: 'rw' }])
31
43
  .withCommand([
32
44
  'generate-txs',
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@midnight-ntwrk/wallet-sdk-utilities",
3
3
  "description": "Domain-agnostic utilities for the wallet SDK - common operations and types",
4
- "version": "1.0.0-beta.7",
4
+ "version": "1.0.0-beta.9",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "module": "./dist/index.js",
8
8
  "types": "./dist/index.d.ts",
9
- "author": "IOHK",
9
+ "author": "Midnight Foundation",
10
10
  "license": "Apache-2.0",
11
11
  "publishConfig": {
12
12
  "registry": "https://npm.pkg.github.com/"
@@ -40,13 +40,14 @@
40
40
  "effect": "^3.17.3",
41
41
  "portfinder": "^1.0.37",
42
42
  "rxjs": "^7.5",
43
- "testcontainers": "^11.4.0"
43
+ "testcontainers": "^11.10.0"
44
44
  },
45
45
  "scripts": {
46
46
  "typecheck": "tsc -b ./tsconfig.json --noEmit",
47
47
  "test": "vitest run",
48
48
  "lint": "eslint --max-warnings 0",
49
- "format": "prettier --write \"**/*.{ts,js,json,yaml,yml}\"",
49
+ "format": "prettier --write \"**/*.{ts,js,json,yaml,yml,md}\"",
50
+ "format:check": "prettier --check \"**/*.{ts,js,json,yaml,yml,md}\"",
50
51
  "dist": "tsc -b ./tsconfig.build.json",
51
52
  "dist:publish": "tsc -b ./tsconfig.publish.json",
52
53
  "clean": "rimraf --glob dist 'tsconfig.*.tsbuildinfo' && date +%s > .clean-timestamp",
@@ -55,9 +56,10 @@
55
56
  "devDependencies": {
56
57
  "eslint": "^9.37.0",
57
58
  "fast-check": "^4.2.0",
59
+ "prettier": "^3.7.0",
58
60
  "publint": "~0.3.14",
59
61
  "rimraf": "^6.0.1",
60
62
  "typescript": "^5.9.3",
61
- "vitest": "^3.2.4"
63
+ "vitest": "^4.0.16"
62
64
  }
63
65
  }