@gearbox-protocol/sdk 14.0.0-next.8 → 14.0.0-next.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.
@@ -87,8 +87,14 @@ const revolverTransportConfigSchema = import_v4.z.union([
87
87
  })
88
88
  ]);
89
89
  class NoAvailableTransportsError extends import_viem.BaseError {
90
- constructor(cause) {
91
- super("no available transports", { cause });
90
+ statuses;
91
+ constructor(statuses, cause) {
92
+ super("No available transports", {
93
+ cause,
94
+ metaMessages: statuses.length > 0 ? statuses.map((s) => `- ${s.id}: ${s.status}`) : ["No transports configured"],
95
+ name: "NoAvailableTransportsError"
96
+ });
97
+ this.statuses = statuses;
92
98
  }
93
99
  }
94
100
  class RevolverTransport {
@@ -146,7 +152,7 @@ class RevolverTransport {
146
152
  );
147
153
  }
148
154
  if (transports.length === 0) {
149
- throw new NoAvailableTransportsError();
155
+ throw new NoAvailableTransportsError([]);
150
156
  }
151
157
  this.#isSingle = transports.length === 1;
152
158
  const selectionStrategy = config.selectionStrategy ?? "simple";
@@ -197,7 +203,7 @@ class RevolverTransport {
197
203
  }
198
204
  } while (this.#selector.canRotate());
199
205
  this.#requests.delete(r);
200
- throw new NoAvailableTransportsError(error);
206
+ throw new NoAvailableTransportsError(this.#selector.statuses(), error);
201
207
  };
202
208
  get config() {
203
209
  return {
@@ -70,8 +70,14 @@ const revolverTransportConfigSchema = z.union([
70
70
  })
71
71
  ]);
72
72
  class NoAvailableTransportsError extends BaseError {
73
- constructor(cause) {
74
- super("no available transports", { cause });
73
+ statuses;
74
+ constructor(statuses, cause) {
75
+ super("No available transports", {
76
+ cause,
77
+ metaMessages: statuses.length > 0 ? statuses.map((s) => `- ${s.id}: ${s.status}`) : ["No transports configured"],
78
+ name: "NoAvailableTransportsError"
79
+ });
80
+ this.statuses = statuses;
75
81
  }
76
82
  }
77
83
  class RevolverTransport {
@@ -129,7 +135,7 @@ class RevolverTransport {
129
135
  );
130
136
  }
131
137
  if (transports.length === 0) {
132
- throw new NoAvailableTransportsError();
138
+ throw new NoAvailableTransportsError([]);
133
139
  }
134
140
  this.#isSingle = transports.length === 1;
135
141
  const selectionStrategy = config.selectionStrategy ?? "simple";
@@ -180,7 +186,7 @@ class RevolverTransport {
180
186
  }
181
187
  } while (this.#selector.canRotate());
182
188
  this.#requests.delete(r);
183
- throw new NoAvailableTransportsError(error);
189
+ throw new NoAvailableTransportsError(this.#selector.statuses(), error);
184
190
  };
185
191
  get config() {
186
192
  return {
@@ -167,7 +167,8 @@ export type RevolverTransportConfig = {
167
167
  onRotateFailed?: (oldTransportName: string, reason?: BaseError) => void | Promise<void>;
168
168
  } & z.infer<typeof revolverTransportConfigSchema>;
169
169
  export declare class NoAvailableTransportsError extends BaseError {
170
- constructor(cause?: Error);
170
+ statuses: ProviderStatus[];
171
+ constructor(statuses: ProviderStatus[], cause?: Error);
171
172
  }
172
173
  export interface RevolverTransportValue {
173
174
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.0.0-next.8",
3
+ "version": "14.0.0-next.9",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "main": "./dist/cjs/sdk/index.js",