@gearbox-protocol/sdk 11.1.6 → 11.1.7

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.
@@ -151,7 +151,12 @@ class BytecodeRepositoryContract extends import_base_contract.BaseContract {
151
151
  if (code === void 0 || code === "0x") {
152
152
  return [];
153
153
  }
154
- const publicDomains = await this.contract.read.getPublicDomains();
154
+ let publicDomains = [];
155
+ try {
156
+ publicDomains = await this.contract.read.getPublicDomains();
157
+ } catch {
158
+ publicDomains = [];
159
+ }
155
160
  const publicDomainsString = publicDomains.map(
156
161
  (domain) => (0, import_viem.hexToString)(domain, { size: 32 })
157
162
  );
@@ -35,12 +35,18 @@ class ArchiveTransport {
35
35
  enableLogging: false,
36
36
  ...config
37
37
  };
38
- this.primaryTransport = (0, import_viem.http)(this.config.primaryRpcUrl, {
38
+ if (!config.primaryRpcUrl && !config.primaryTransport) {
39
+ throw new Error("primaryRpcUrl or primaryTransport are required");
40
+ }
41
+ if (!config.archiveRpcUrl && !config.archiveTransport) {
42
+ throw new Error("archiveRpcUrl or archiveTransport are required");
43
+ }
44
+ this.primaryTransport = config.primaryTransport ?? (0, import_viem.http)(config.primaryRpcUrl, {
39
45
  retryCount: this.config.retryCount,
40
46
  retryDelay: this.config.retryDelay,
41
47
  timeout: this.config.timeout
42
48
  });
43
- this.archiveTransport = (0, import_viem.http)(this.config.archiveRpcUrl, {
49
+ this.archiveTransport = config.archiveTransport ?? (0, import_viem.http)(config.archiveRpcUrl, {
44
50
  retryCount: this.config.retryCount,
45
51
  retryDelay: this.config.retryDelay,
46
52
  timeout: this.config.timeout
@@ -240,27 +246,6 @@ class ArchiveTransport {
240
246
  getConfig() {
241
247
  return { ...this.config };
242
248
  }
243
- /**
244
- * Update configuration (will invalidate cached transport)
245
- */
246
- updateConfig(updates) {
247
- this.config = { ...this.config, ...updates };
248
- this.cachedTransport = void 0;
249
- if (updates.primaryRpcUrl) {
250
- this.primaryTransport = (0, import_viem.http)(this.config.primaryRpcUrl, {
251
- retryCount: this.config.retryCount,
252
- retryDelay: this.config.retryDelay,
253
- timeout: this.config.timeout
254
- });
255
- }
256
- if (updates.archiveRpcUrl) {
257
- this.archiveTransport = (0, import_viem.http)(this.config.archiveRpcUrl, {
258
- retryCount: this.config.retryCount,
259
- retryDelay: this.config.retryDelay,
260
- timeout: this.config.timeout
261
- });
262
- }
263
- }
264
249
  /**
265
250
  * Enable or disable logging
266
251
  */
@@ -134,7 +134,12 @@ class BytecodeRepositoryContract extends BaseContract {
134
134
  if (code === void 0 || code === "0x") {
135
135
  return [];
136
136
  }
137
- const publicDomains = await this.contract.read.getPublicDomains();
137
+ let publicDomains = [];
138
+ try {
139
+ publicDomains = await this.contract.read.getPublicDomains();
140
+ } catch {
141
+ publicDomains = [];
142
+ }
138
143
  const publicDomainsString = publicDomains.map(
139
144
  (domain) => hexToString(domain, { size: 32 })
140
145
  );
@@ -12,12 +12,18 @@ class ArchiveTransport {
12
12
  enableLogging: false,
13
13
  ...config
14
14
  };
15
- this.primaryTransport = http(this.config.primaryRpcUrl, {
15
+ if (!config.primaryRpcUrl && !config.primaryTransport) {
16
+ throw new Error("primaryRpcUrl or primaryTransport are required");
17
+ }
18
+ if (!config.archiveRpcUrl && !config.archiveTransport) {
19
+ throw new Error("archiveRpcUrl or archiveTransport are required");
20
+ }
21
+ this.primaryTransport = config.primaryTransport ?? http(config.primaryRpcUrl, {
16
22
  retryCount: this.config.retryCount,
17
23
  retryDelay: this.config.retryDelay,
18
24
  timeout: this.config.timeout
19
25
  });
20
- this.archiveTransport = http(this.config.archiveRpcUrl, {
26
+ this.archiveTransport = config.archiveTransport ?? http(config.archiveRpcUrl, {
21
27
  retryCount: this.config.retryCount,
22
28
  retryDelay: this.config.retryDelay,
23
29
  timeout: this.config.timeout
@@ -217,27 +223,6 @@ class ArchiveTransport {
217
223
  getConfig() {
218
224
  return { ...this.config };
219
225
  }
220
- /**
221
- * Update configuration (will invalidate cached transport)
222
- */
223
- updateConfig(updates) {
224
- this.config = { ...this.config, ...updates };
225
- this.cachedTransport = void 0;
226
- if (updates.primaryRpcUrl) {
227
- this.primaryTransport = http(this.config.primaryRpcUrl, {
228
- retryCount: this.config.retryCount,
229
- retryDelay: this.config.retryDelay,
230
- timeout: this.config.timeout
231
- });
232
- }
233
- if (updates.archiveRpcUrl) {
234
- this.archiveTransport = http(this.config.archiveRpcUrl, {
235
- retryCount: this.config.retryCount,
236
- retryDelay: this.config.retryDelay,
237
- timeout: this.config.timeout
238
- });
239
- }
240
- }
241
226
  /**
242
227
  * Enable or disable logging
243
228
  */
@@ -1,7 +1,9 @@
1
1
  import { type Transport } from "viem";
2
2
  export interface ArchiveTransportConfig {
3
- primaryRpcUrl: string;
4
- archiveRpcUrl: string;
3
+ primaryTransport?: Transport;
4
+ archiveTransport?: Transport;
5
+ primaryRpcUrl?: string;
6
+ archiveRpcUrl?: string;
5
7
  blockThreshold: number;
6
8
  retryCount?: number;
7
9
  retryDelay?: number;
@@ -37,11 +39,7 @@ export declare class ArchiveTransport {
37
39
  /**
38
40
  * Get current configuration
39
41
  */
40
- getConfig(): Required<ArchiveTransportConfig>;
41
- /**
42
- * Update configuration (will invalidate cached transport)
43
- */
44
- updateConfig(updates: Partial<ArchiveTransportConfig>): void;
42
+ getConfig(): ArchiveTransportConfig;
45
43
  /**
46
44
  * Enable or disable logging
47
45
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "11.1.6",
3
+ "version": "11.1.7",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",