@dashevo/evo-sdk 2.1.0-dev.8 → 2.1.0-rc.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/dist/sdk.d.ts CHANGED
@@ -23,6 +23,7 @@ export interface ConnectionOptions {
23
23
  export interface EvoSDKOptions extends ConnectionOptions {
24
24
  network?: 'testnet' | 'mainnet';
25
25
  trusted?: boolean;
26
+ addresses?: string[];
26
27
  }
27
28
  export declare class EvoSDK {
28
29
  private wasmSdk?;
@@ -50,6 +51,21 @@ export declare class EvoSDK {
50
51
  static mainnet(options?: ConnectionOptions): EvoSDK;
51
52
  static testnetTrusted(options?: ConnectionOptions): EvoSDK;
52
53
  static mainnetTrusted(options?: ConnectionOptions): EvoSDK;
54
+ /**
55
+ * Create an EvoSDK instance configured with specific masternode addresses.
56
+ *
57
+ * @param addresses - Array of HTTPS URLs to masternodes (e.g., ['https://127.0.0.1:1443'])
58
+ * @param network - Network identifier: 'mainnet', 'testnet' (default: 'testnet')
59
+ * @param options - Additional connection options
60
+ * @returns A configured EvoSDK instance (not yet connected - call .connect() to establish connection)
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * const sdk = EvoSDK.withAddresses(['https://52.12.176.90:1443'], 'testnet');
65
+ * await sdk.connect();
66
+ * ```
67
+ */
68
+ static withAddresses(addresses: string[], network?: 'mainnet' | 'testnet', options?: ConnectionOptions): EvoSDK;
53
69
  }
54
70
  export { DocumentsFacade } from './documents/facade.js';
55
71
  export { IdentitiesFacade } from './identities/facade.js';
package/dist/sdk.js CHANGED
@@ -13,8 +13,8 @@ import { VotingFacade } from './voting/facade.js';
13
13
  export class EvoSDK {
14
14
  constructor(options = {}) {
15
15
  // Apply defaults while preserving any future connection options
16
- const { network = 'testnet', trusted = false, ...connection } = options;
17
- this.options = { network, trusted, ...connection };
16
+ const { network = 'testnet', trusted = false, addresses, ...connection } = options;
17
+ this.options = { network, trusted, addresses, ...connection };
18
18
  this.documents = new DocumentsFacade(this);
19
19
  this.identities = new IdentitiesFacade(this);
20
20
  this.contracts = new ContractsFacade(this);
@@ -42,9 +42,20 @@ export class EvoSDK {
42
42
  if (this.wasmSdk)
43
43
  return; // idempotent
44
44
  await initWasm();
45
- const { network, trusted, version, proofs, settings, logs } = this.options;
45
+ const { network, trusted, version, proofs, settings, logs, addresses } = this.options;
46
46
  let builder;
47
- if (network === 'mainnet') {
47
+ // If specific addresses are provided, use them instead of network presets
48
+ if (addresses && addresses.length > 0) {
49
+ // Prefetch trusted quorums for the network before creating builder with addresses
50
+ if (network === 'mainnet') {
51
+ await wasm.WasmSdk.prefetchTrustedQuorumsMainnet();
52
+ }
53
+ else if (network === 'testnet') {
54
+ await wasm.WasmSdk.prefetchTrustedQuorumsTestnet();
55
+ }
56
+ builder = wasm.WasmSdkBuilder.withAddresses(addresses, network);
57
+ }
58
+ else if (network === 'mainnet') {
48
59
  await wasm.WasmSdk.prefetchTrustedQuorumsMainnet();
49
60
  builder = trusted ? wasm.WasmSdkBuilder.mainnetTrusted() : wasm.WasmSdkBuilder.mainnet();
50
61
  }
@@ -88,6 +99,23 @@ export class EvoSDK {
88
99
  static mainnet(options = {}) { return new EvoSDK({ network: 'mainnet', ...options }); }
89
100
  static testnetTrusted(options = {}) { return new EvoSDK({ network: 'testnet', trusted: true, ...options }); }
90
101
  static mainnetTrusted(options = {}) { return new EvoSDK({ network: 'mainnet', trusted: true, ...options }); }
102
+ /**
103
+ * Create an EvoSDK instance configured with specific masternode addresses.
104
+ *
105
+ * @param addresses - Array of HTTPS URLs to masternodes (e.g., ['https://127.0.0.1:1443'])
106
+ * @param network - Network identifier: 'mainnet', 'testnet' (default: 'testnet')
107
+ * @param options - Additional connection options
108
+ * @returns A configured EvoSDK instance (not yet connected - call .connect() to establish connection)
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const sdk = EvoSDK.withAddresses(['https://52.12.176.90:1443'], 'testnet');
113
+ * await sdk.connect();
114
+ * ```
115
+ */
116
+ static withAddresses(addresses, network = 'testnet', options = {}) {
117
+ return new EvoSDK({ addresses, network, ...options });
118
+ }
91
119
  }
92
120
  export { DocumentsFacade } from './documents/facade.js';
93
121
  export { IdentitiesFacade } from './identities/facade.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/evo-sdk",
3
- "version": "2.1.0-dev.8",
3
+ "version": "2.1.0-rc.1",
4
4
  "type": "module",
5
5
  "main": "./dist/evo-sdk.module.js",
6
6
  "types": "./dist/sdk.d.ts",
@@ -22,7 +22,7 @@
22
22
  "README.md"
23
23
  ],
24
24
  "dependencies": {
25
- "@dashevo/wasm-sdk": "2.1.0-dev.8"
25
+ "@dashevo/wasm-sdk": "2.1.0-rc.1"
26
26
  },
27
27
  "scripts": {
28
28
  "build": "rm -rf dist && tsc -p tsconfig.json && webpack --config webpack.config.cjs",