@gearbox-protocol/sdk 12.2.0 → 12.4.0-next.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.
@@ -19,10 +19,59 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
19
19
  var RevolverTransport_exports = {};
20
20
  __export(RevolverTransport_exports, {
21
21
  NoAvailableTransportsError: () => NoAvailableTransportsError,
22
- RevolverTransport: () => RevolverTransport
22
+ RevolverTransport: () => RevolverTransport,
23
+ SelectionStrategy: () => SelectionStrategy,
24
+ providerConfigSchema: () => providerConfigSchema,
25
+ revolverTransportConfigSchema: () => revolverTransportConfigSchema
23
26
  });
24
27
  module.exports = __toCommonJS(RevolverTransport_exports);
25
28
  var import_viem = require("viem");
29
+ var import_v4 = require("zod/v4");
30
+ var import_sdk = require("../sdk/index.js");
31
+ var import_transports = require("./transports.js");
32
+ const providerConfigSchema = import_v4.z.object({
33
+ /**
34
+ * Provider name for display purposes
35
+ */
36
+ name: import_v4.z.string(),
37
+ /**
38
+ * Provider URL
39
+ */
40
+ url: import_v4.z.url(),
41
+ /**
42
+ * How long, in milliseconds, to wait before try this provider again
43
+ */
44
+ cooldown: import_v4.z.number().optional(),
45
+ /**
46
+ * HTTP transport options to use for this provider
47
+ */
48
+ httpClientOptions: import_transports.httpTransportConfigSchema.optional()
49
+ });
50
+ const SelectionStrategy = import_v4.z.enum(["simple", "ordered"]);
51
+ const revolverTransportConfigSchema = import_v4.z.object({
52
+ network: import_sdk.NetworkType,
53
+ /**
54
+ * Providers to use
55
+ */
56
+ providers: import_v4.z.array(providerConfigSchema),
57
+ /**
58
+ * How to select the next transport
59
+ * Defaults to "simple"
60
+ */
61
+ selectionStrategy: SelectionStrategy.optional(),
62
+ /** The key of the transport. */
63
+ key: import_v4.z.string().optional(),
64
+ /** The name of the transport. */
65
+ name: import_v4.z.string().optional(),
66
+ /**
67
+ * Default HTTP options to use for all providers, can be overridden by provider config
68
+ */
69
+ defaultHTTPOptions: import_transports.httpTransportConfigSchema.optional(),
70
+ /**
71
+ * Default cooldown, in milliseconds, to wait before try this transport again
72
+ */
73
+ defaultCooldown: import_v4.z.number().optional()
74
+ });
26
75
  class NoAvailableTransportsError extends import_viem.BaseError {
27
76
  constructor(cause) {
28
77
  super("no available transports", { cause });
@@ -61,11 +110,8 @@ class RevolverTransport {
61
110
  ({ url, name, cooldown, httpClientOptions }) => ({
62
111
  name,
63
112
  transport: (0, import_viem.http)(url, {
113
+ ...config.defaultHTTPOptions,
64
114
  ...httpClientOptions,
65
- retryCount: config.retryCount,
66
- retryDelay: config.retryDelay,
67
- timeout: config.timeout,
68
- batch: !!config.batch,
69
115
  key: name,
70
116
  name,
71
117
  onFetchRequest: this.#config.onRequest ? (...args) => this.#config.onRequest?.(name, ...args) : void 0,
@@ -79,7 +125,7 @@ class RevolverTransport {
79
125
  }
80
126
  this.#isSingle = transports.length === 1;
81
127
  const selectionStrategy = config.selectionStrategy ?? "simple";
82
- this.#selector = selectionStrategy === "simple" ? new SimpleTransportSelector(transports, config.cooldown) : new OrderedTransportSelector(transports, config.cooldown);
128
+ this.#selector = selectionStrategy === "simple" ? new SimpleTransportSelector(transports, config.defaultCooldown) : new OrderedTransportSelector(transports, config.defaultCooldown);
83
129
  }
84
130
  get value() {
85
131
  return {
@@ -102,8 +148,8 @@ class RevolverTransport {
102
148
  ...this.overrides
103
149
  });
104
150
  const resp = await (0, import_viem.withRetry)(() => transport.request(r), {
105
- delay: this.#config.retryDelay,
106
- retryCount: this.#config.retryCount,
151
+ delay: this.#config.defaultHTTPOptions?.retryDelay,
152
+ retryCount: this.#config.defaultHTTPOptions?.retryCount,
107
153
  shouldRetry: this.#config.shouldRetry
108
154
  });
109
155
  this.#requests.delete(r);
@@ -134,10 +180,10 @@ class RevolverTransport {
134
180
  name: "revolver",
135
181
  type: "revolver",
136
182
  request: this.request,
137
- retryCount: this.#config.retryCount,
138
- methods: void 0,
139
- retryDelay: this.#config.retryDelay,
140
- timeout: this.#config.timeout
183
+ retryCount: this.#config.defaultHTTPOptions?.retryCount,
184
+ methods: this.#config.defaultHTTPOptions?.methods,
185
+ retryDelay: this.#config.defaultHTTPOptions?.retryDelay,
186
+ timeout: this.#config.defaultHTTPOptions?.timeout
141
187
  };
142
188
  }
143
189
  /**
@@ -283,5 +329,8 @@ class OrderedTransportSelector extends AbstractTransportSelector {
283
329
  // Annotate the CommonJS export names for ESM import in node:
284
330
  0 && (module.exports = {
285
331
  NoAvailableTransportsError,
286
- RevolverTransport
332
+ RevolverTransport,
333
+ SelectionStrategy,
334
+ providerConfigSchema,
335
+ revolverTransportConfigSchema
287
336
  });
@@ -29,6 +29,7 @@ __reExport(dev_exports, require("./mint/index.js"), module.exports);
29
29
  __reExport(dev_exports, require("./providers.js"), module.exports);
30
30
  __reExport(dev_exports, require("./RevolverTransport.js"), module.exports);
31
31
  __reExport(dev_exports, require("./replaceStorage.js"), module.exports);
32
+ __reExport(dev_exports, require("./transports.js"), module.exports);
32
33
  __reExport(dev_exports, require("./types.js"), module.exports);
33
34
  // Annotate the CommonJS export names for ESM import in node:
34
35
  0 && (module.exports = {
@@ -46,5 +47,6 @@ __reExport(dev_exports, require("./types.js"), module.exports);
46
47
  ...require("./providers.js"),
47
48
  ...require("./RevolverTransport.js"),
48
49
  ...require("./replaceStorage.js"),
50
+ ...require("./transports.js"),
49
51
  ...require("./types.js")
50
52
  });
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+ var transports_exports = {};
20
+ __export(transports_exports, {
21
+ httpTransportConfigSchema: () => httpTransportConfigSchema
22
+ });
23
+ module.exports = __toCommonJS(transports_exports);
24
+ var import_v4 = require("zod/v4");
25
+ const httpTransportConfigSchema = import_v4.z.object({
26
+ /**
27
+ * Whether to enable Batch JSON-RPC.
28
+ * @link https://www.jsonrpc.org/specification#batch
29
+ */
30
+ batch: import_v4.z.union([
31
+ import_v4.z.boolean(),
32
+ import_v4.z.object({
33
+ /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */
34
+ batchSize: import_v4.z.number().optional(),
35
+ /** The maximum number of milliseconds to wait before sending a batch. @default 0 */
36
+ wait: import_v4.z.number().optional()
37
+ })
38
+ ]).optional(),
39
+ /**
40
+ * Request configuration to pass to `fetch`.
41
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch
42
+ */
43
+ fetchOptions: import_v4.z.record(import_v4.z.string(), import_v4.z.any()).optional(),
44
+ /**
45
+ * Methods to include or exclude from executing RPC requests.
46
+ **/
47
+ methods: import_v4.z.union([
48
+ import_v4.z.object({
49
+ include: import_v4.z.array(import_v4.z.string()).optional()
50
+ }),
51
+ import_v4.z.object({
52
+ exclude: import_v4.z.array(import_v4.z.string()).optional()
53
+ })
54
+ ]).optional(),
55
+ /**
56
+ * The max number of times to retry.
57
+ **/
58
+ retryCount: import_v4.z.number().optional(),
59
+ /**
60
+ * The base delay (in ms) between retries.
61
+ **/
62
+ retryDelay: import_v4.z.number().optional(),
63
+ /**
64
+ * The timeout (in ms) for the HTTP request. Default: 10_000
65
+ **/
66
+ timeout: import_v4.z.number().optional()
67
+ });
68
+ // Annotate the CommonJS export names for ESM import in node:
69
+ 0 && (module.exports = {
70
+ httpTransportConfigSchema
71
+ });
@@ -38,7 +38,7 @@ var import_sdk_legacy = require("../sdk-legacy/index.js");
38
38
  var import_utils = require("../utils/index.js");
39
39
  var import_viem2 = require("../utils/viem/index.js");
40
40
  const COMPRESSORS = {
41
- [import_chains.chains.Mainnet.id]: "0xfB79b6713fe214B8748ED7b0db1f93E4f1aC9d29",
41
+ [import_chains.chains.Mainnet.id]: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
42
42
  [import_chains.chains.Monad.id]: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023"
43
43
  };
44
44
  function getWithdrawalCompressorAddress(chainId) {
@@ -10,6 +10,52 @@ import {
10
10
  RpcError,
11
11
  withRetry
12
12
  } from "viem";
13
+ import { z } from "zod/v4";
14
+ import { NetworkType } from "../sdk/index.js";
15
+ import { httpTransportConfigSchema } from "./transports.js";
16
+ const providerConfigSchema = z.object({
17
+ /**
18
+ * Provider name for display purposes
19
+ */
20
+ name: z.string(),
21
+ /**
22
+ * Provider URL
23
+ */
24
+ url: z.url(),
25
+ /**
26
+ * How long, in milliseconds, to wait before try this provider again
27
+ */
28
+ cooldown: z.number().optional(),
29
+ /**
30
+ * HTTP transport options to use for this provider
31
+ */
32
+ httpClientOptions: httpTransportConfigSchema.optional()
33
+ });
34
+ const SelectionStrategy = z.enum(["simple", "ordered"]);
35
+ const revolverTransportConfigSchema = z.object({
36
+ network: NetworkType,
37
+ /**
38
+ * Providers to use
39
+ */
40
+ providers: z.array(providerConfigSchema),
41
+ /**
42
+ * How to select the next transport
43
+ * Defaults to "simple"
44
+ */
45
+ selectionStrategy: SelectionStrategy.optional(),
46
+ /** The key of the transport. */
47
+ key: z.string().optional(),
48
+ /** The name of the transport. */
49
+ name: z.string().optional(),
50
+ /**
51
+ * Default HTTP options to use for all providers, can be overridden by provider config
52
+ */
53
+ defaultHTTPOptions: httpTransportConfigSchema.optional(),
54
+ /**
55
+ * Default cooldown, in milliseconds, to wait before try this transport again
56
+ */
57
+ defaultCooldown: z.number().optional()
58
+ });
13
59
  class NoAvailableTransportsError extends BaseError {
14
60
  constructor(cause) {
15
61
  super("no available transports", { cause });
@@ -48,11 +94,8 @@ class RevolverTransport {
48
94
  ({ url, name, cooldown, httpClientOptions }) => ({
49
95
  name,
50
96
  transport: http(url, {
97
+ ...config.defaultHTTPOptions,
51
98
  ...httpClientOptions,
52
- retryCount: config.retryCount,
53
- retryDelay: config.retryDelay,
54
- timeout: config.timeout,
55
- batch: !!config.batch,
56
99
  key: name,
57
100
  name,
58
101
  onFetchRequest: this.#config.onRequest ? (...args) => this.#config.onRequest?.(name, ...args) : void 0,
@@ -66,7 +109,7 @@ class RevolverTransport {
66
109
  }
67
110
  this.#isSingle = transports.length === 1;
68
111
  const selectionStrategy = config.selectionStrategy ?? "simple";
69
- this.#selector = selectionStrategy === "simple" ? new SimpleTransportSelector(transports, config.cooldown) : new OrderedTransportSelector(transports, config.cooldown);
112
+ this.#selector = selectionStrategy === "simple" ? new SimpleTransportSelector(transports, config.defaultCooldown) : new OrderedTransportSelector(transports, config.defaultCooldown);
70
113
  }
71
114
  get value() {
72
115
  return {
@@ -89,8 +132,8 @@ class RevolverTransport {
89
132
  ...this.overrides
90
133
  });
91
134
  const resp = await withRetry(() => transport.request(r), {
92
- delay: this.#config.retryDelay,
93
- retryCount: this.#config.retryCount,
135
+ delay: this.#config.defaultHTTPOptions?.retryDelay,
136
+ retryCount: this.#config.defaultHTTPOptions?.retryCount,
94
137
  shouldRetry: this.#config.shouldRetry
95
138
  });
96
139
  this.#requests.delete(r);
@@ -121,10 +164,10 @@ class RevolverTransport {
121
164
  name: "revolver",
122
165
  type: "revolver",
123
166
  request: this.request,
124
- retryCount: this.#config.retryCount,
125
- methods: void 0,
126
- retryDelay: this.#config.retryDelay,
127
- timeout: this.#config.timeout
167
+ retryCount: this.#config.defaultHTTPOptions?.retryCount,
168
+ methods: this.#config.defaultHTTPOptions?.methods,
169
+ retryDelay: this.#config.defaultHTTPOptions?.retryDelay,
170
+ timeout: this.#config.defaultHTTPOptions?.timeout
128
171
  };
129
172
  }
130
173
  /**
@@ -269,5 +312,8 @@ class OrderedTransportSelector extends AbstractTransportSelector {
269
312
  }
270
313
  export {
271
314
  NoAvailableTransportsError,
272
- RevolverTransport
315
+ RevolverTransport,
316
+ SelectionStrategy,
317
+ providerConfigSchema,
318
+ revolverTransportConfigSchema
273
319
  };
@@ -12,4 +12,5 @@ export * from "./mint/index.js";
12
12
  export * from "./providers.js";
13
13
  export * from "./RevolverTransport.js";
14
14
  export * from "./replaceStorage.js";
15
+ export * from "./transports.js";
15
16
  export * from "./types.js";
@@ -0,0 +1,47 @@
1
+ import { z } from "zod/v4";
2
+ const httpTransportConfigSchema = z.object({
3
+ /**
4
+ * Whether to enable Batch JSON-RPC.
5
+ * @link https://www.jsonrpc.org/specification#batch
6
+ */
7
+ batch: z.union([
8
+ z.boolean(),
9
+ z.object({
10
+ /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */
11
+ batchSize: z.number().optional(),
12
+ /** The maximum number of milliseconds to wait before sending a batch. @default 0 */
13
+ wait: z.number().optional()
14
+ })
15
+ ]).optional(),
16
+ /**
17
+ * Request configuration to pass to `fetch`.
18
+ * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch
19
+ */
20
+ fetchOptions: z.record(z.string(), z.any()).optional(),
21
+ /**
22
+ * Methods to include or exclude from executing RPC requests.
23
+ **/
24
+ methods: z.union([
25
+ z.object({
26
+ include: z.array(z.string()).optional()
27
+ }),
28
+ z.object({
29
+ exclude: z.array(z.string()).optional()
30
+ })
31
+ ]).optional(),
32
+ /**
33
+ * The max number of times to retry.
34
+ **/
35
+ retryCount: z.number().optional(),
36
+ /**
37
+ * The base delay (in ms) between retries.
38
+ **/
39
+ retryDelay: z.number().optional(),
40
+ /**
41
+ * The timeout (in ms) for the HTTP request. Default: 10_000
42
+ **/
43
+ timeout: z.number().optional()
44
+ });
45
+ export {
46
+ httpTransportConfigSchema
47
+ };
@@ -28,7 +28,7 @@ import { BigIntMath } from "../sdk-legacy/index.js";
28
28
  import { AddressMap } from "../utils/index.js";
29
29
  import { simulateWithPriceUpdates } from "../utils/viem/index.js";
30
30
  const COMPRESSORS = {
31
- [chains.Mainnet.id]: "0xfB79b6713fe214B8748ED7b0db1f93E4f1aC9d29",
31
+ [chains.Mainnet.id]: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023",
32
32
  [chains.Monad.id]: "0x36F3d0Bb73CBC2E94fE24dF0f26a689409cF9023"
33
33
  };
34
34
  function getWithdrawalCompressorAddress(chainId) {
@@ -1,34 +1,108 @@
1
- import { BaseError, type ClientConfig, type EIP1193RequestFn, type Transport, type TransportConfig } from "viem";
1
+ import { BaseError, type EIP1193RequestFn, type Transport, type TransportConfig } from "viem";
2
2
  import type { HttpRpcClientOptions } from "viem/utils";
3
- import type { ILogger, NetworkType } from "../sdk/index.js";
4
- export interface ProviderConfig {
5
- name: string;
6
- url: string;
7
- cooldown?: number;
8
- httpClientOptions?: HttpRpcClientOptions | undefined;
9
- }
3
+ import { z } from "zod/v4";
4
+ import { type ILogger } from "../sdk/index.js";
5
+ export declare const providerConfigSchema: z.ZodObject<{
6
+ name: z.ZodString;
7
+ url: z.ZodURL;
8
+ cooldown: z.ZodOptional<z.ZodNumber>;
9
+ httpClientOptions: z.ZodOptional<z.ZodObject<{
10
+ batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
11
+ batchSize: z.ZodOptional<z.ZodNumber>;
12
+ wait: z.ZodOptional<z.ZodNumber>;
13
+ }, z.core.$strip>]>>;
14
+ fetchOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
15
+ methods: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
16
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
17
+ }, z.core.$strip>, z.ZodObject<{
18
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
19
+ }, z.core.$strip>]>>;
20
+ retryCount: z.ZodOptional<z.ZodNumber>;
21
+ retryDelay: z.ZodOptional<z.ZodNumber>;
22
+ timeout: z.ZodOptional<z.ZodNumber>;
23
+ }, z.core.$strip>>;
24
+ }, z.core.$strip>;
25
+ export type ProviderConfig = z.infer<typeof providerConfigSchema>;
10
26
  export interface ProviderStatus {
11
27
  id: string;
12
28
  status: "active" | "cooldown" | "standby";
13
29
  }
14
30
  type OnRequestFn = (providerName: string, ...args: Parameters<Required<HttpRpcClientOptions>["onRequest"]>) => ReturnType<Required<HttpRpcClientOptions>["onRequest"]>;
15
31
  type OnResponseFn = (providerName: string, ...args: Parameters<Required<HttpRpcClientOptions>["onResponse"]>) => ReturnType<Required<HttpRpcClientOptions>["onResponse"]>;
32
+ export declare const SelectionStrategy: z.ZodEnum<{
33
+ simple: "simple";
34
+ ordered: "ordered";
35
+ }>;
16
36
  /**
17
37
  * How to select the next transport
18
38
  * - simple: selects next transport after current that is not in cooldown by checking all transports in cyclic order
19
39
  * - ordered: will select first available transport that is not in cooldown
20
40
  */
21
- export type SelectionStrategy = "simple" | "ordered";
22
- export interface RevolverTransportConfig {
23
- network: NetworkType;
24
- providers: ProviderConfig[];
41
+ export type SelectionStrategy = z.infer<typeof SelectionStrategy>;
42
+ export declare const revolverTransportConfigSchema: z.ZodObject<{
43
+ network: z.ZodEnum<{
44
+ Mainnet: "Mainnet";
45
+ Arbitrum: "Arbitrum";
46
+ Optimism: "Optimism";
47
+ Base: "Base";
48
+ Sonic: "Sonic";
49
+ MegaETH: "MegaETH";
50
+ Monad: "Monad";
51
+ Berachain: "Berachain";
52
+ Avalanche: "Avalanche";
53
+ BNB: "BNB";
54
+ WorldChain: "WorldChain";
55
+ Etherlink: "Etherlink";
56
+ Hemi: "Hemi";
57
+ Lisk: "Lisk";
58
+ Plasma: "Plasma";
59
+ Somnia: "Somnia";
60
+ }>;
61
+ providers: z.ZodArray<z.ZodObject<{
62
+ name: z.ZodString;
63
+ url: z.ZodURL;
64
+ cooldown: z.ZodOptional<z.ZodNumber>;
65
+ httpClientOptions: z.ZodOptional<z.ZodObject<{
66
+ batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
67
+ batchSize: z.ZodOptional<z.ZodNumber>;
68
+ wait: z.ZodOptional<z.ZodNumber>;
69
+ }, z.core.$strip>]>>;
70
+ fetchOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
71
+ methods: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
72
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ }, z.core.$strip>, z.ZodObject<{
74
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ }, z.core.$strip>]>>;
76
+ retryCount: z.ZodOptional<z.ZodNumber>;
77
+ retryDelay: z.ZodOptional<z.ZodNumber>;
78
+ timeout: z.ZodOptional<z.ZodNumber>;
79
+ }, z.core.$strip>>;
80
+ }, z.core.$strip>>;
81
+ selectionStrategy: z.ZodOptional<z.ZodEnum<{
82
+ simple: "simple";
83
+ ordered: "ordered";
84
+ }>>;
85
+ key: z.ZodOptional<z.ZodString>;
86
+ name: z.ZodOptional<z.ZodString>;
87
+ defaultHTTPOptions: z.ZodOptional<z.ZodObject<{
88
+ batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
89
+ batchSize: z.ZodOptional<z.ZodNumber>;
90
+ wait: z.ZodOptional<z.ZodNumber>;
91
+ }, z.core.$strip>]>>;
92
+ fetchOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
93
+ methods: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
94
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
95
+ }, z.core.$strip>, z.ZodObject<{
96
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ }, z.core.$strip>]>>;
98
+ retryCount: z.ZodOptional<z.ZodNumber>;
99
+ retryDelay: z.ZodOptional<z.ZodNumber>;
100
+ timeout: z.ZodOptional<z.ZodNumber>;
101
+ }, z.core.$strip>>;
102
+ defaultCooldown: z.ZodOptional<z.ZodNumber>;
103
+ }, z.core.$strip>;
104
+ export type RevolverTransportConfig = {
25
105
  logger?: ILogger;
26
- key?: TransportConfig["key"] | undefined;
27
- name?: TransportConfig["name"] | undefined;
28
- pollingInterval?: ClientConfig["pollingInterval"] | undefined;
29
- retryCount?: TransportConfig["retryCount"] | undefined;
30
- retryDelay?: TransportConfig["retryDelay"] | undefined;
31
- timeout?: TransportConfig["timeout"] | undefined;
32
106
  /**
33
107
  * When single http transport should retry?
34
108
  * Defaults to some less strict criteria, so it'll retry "blockNumber from the future" errors
@@ -42,10 +116,6 @@ export interface RevolverTransportConfig {
42
116
  count: number;
43
117
  error: Error;
44
118
  }) => Promise<boolean> | boolean) | undefined;
45
- /**
46
- * Allow batching of json-rpc requests
47
- */
48
- batch?: boolean | undefined;
49
119
  /**
50
120
  * Spying function that also returns provider name in additional to the request
51
121
  */
@@ -62,16 +132,7 @@ export interface RevolverTransportConfig {
62
132
  * Callback that is called when the transport cannot be rotated
63
133
  */
64
134
  onRotateFailed?: (oldTransportName: string, reason?: BaseError) => void | Promise<void>;
65
- /**
66
- * How long, in milliseconds, to wait before try this transport again
67
- */
68
- cooldown?: number | undefined;
69
- /**
70
- * How to select the next transport
71
- * Defaults to "simple"
72
- */
73
- selectionStrategy?: SelectionStrategy;
74
- }
135
+ } & z.infer<typeof revolverTransportConfigSchema>;
75
136
  export declare class NoAvailableTransportsError extends BaseError {
76
137
  constructor(cause?: Error);
77
138
  }
@@ -12,4 +12,5 @@ export * from "./mint/index.js";
12
12
  export * from "./providers.js";
13
13
  export * from "./RevolverTransport.js";
14
14
  export * from "./replaceStorage.js";
15
+ export * from "./transports.js";
15
16
  export * from "./types.js";
@@ -0,0 +1,16 @@
1
+ import { z } from "zod/v4";
2
+ export declare const httpTransportConfigSchema: z.ZodObject<{
3
+ batch: z.ZodOptional<z.ZodUnion<readonly [z.ZodBoolean, z.ZodObject<{
4
+ batchSize: z.ZodOptional<z.ZodNumber>;
5
+ wait: z.ZodOptional<z.ZodNumber>;
6
+ }, z.core.$strip>]>>;
7
+ fetchOptions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
8
+ methods: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
9
+ include: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ }, z.core.$strip>, z.ZodObject<{
11
+ exclude: z.ZodOptional<z.ZodArray<z.ZodString>>;
12
+ }, z.core.$strip>]>>;
13
+ retryCount: z.ZodOptional<z.ZodNumber>;
14
+ retryDelay: z.ZodOptional<z.ZodNumber>;
15
+ timeout: z.ZodOptional<z.ZodNumber>;
16
+ }, z.core.$strip>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "12.2.0",
3
+ "version": "12.4.0-next.1",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",