@rhinestone/sdk 1.0.0-beta.38 → 1.0.0-beta.40

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.
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,OAAO,EAAuB,MAAM,MAAM,CAAA;AAexD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAC,CAAQ;gBAEX,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKxC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IAmDf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,EAC3B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,MAAM,CAAC;IAqDZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAqBtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAqBxD,YAAY,CAChB,yBAAyB,EAAE,cAAc,EACzC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,YAAY,CAAC;IA2BlB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAoBlE,OAAO,CAAC,UAAU;IA0ElB,OAAO,CAAC,iBAAiB;CAmD1B"}
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../orchestrator/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,OAAO,EAAe,MAAM,MAAM,CAAA;AAyBhD,OAAO,KAAK,EACV,UAAU,EACV,WAAW,EACX,cAAc,EACd,YAAY,EACZ,WAAW,EACX,SAAS,EAET,cAAc,EACf,MAAM,SAAS,CAAA;AAGhB,qBAAa,YAAY;IACvB,OAAO,CAAC,SAAS,CAAQ;IACzB,OAAO,CAAC,MAAM,CAAC,CAAQ;gBAEX,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM;IAKxC,YAAY,CAChB,WAAW,EAAE,OAAO,EACpB,MAAM,CAAC,EAAE;QACP,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;QACnB,MAAM,CAAC,EAAE;YACP,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,EAAE,CAAA;SAC7B,CAAA;KACF,GACA,OAAO,CAAC,SAAS,CAAC;IA+Cf,iBAAiB,CACrB,WAAW,EAAE,OAAO,EACpB,kBAAkB,EAAE,MAAM,EAC1B,uBAAuB,EAAE,OAAO,EAChC,mBAAmB,EAAE,MAAM,EAC3B,SAAS,EAAE,OAAO,GACjB,OAAO,CAAC,MAAM,CAAC;IAqDZ,aAAa,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC;IAQtD,cAAc,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;IAQxD,YAAY,CAChB,yBAAyB,EAAE,cAAc,EACzC,MAAM,EAAE,OAAO,GACd,OAAO,CAAC,YAAY,CAAC;IAgBlB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IASlE,OAAO,CAAC,UAAU;YAUJ,KAAK;IA4BnB,OAAO,CAAC,UAAU;IAkHlB,OAAO,CAAC,iBAAiB;CAwF1B"}
@@ -1,10 +1,6 @@
1
1
  "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
2
  Object.defineProperty(exports, "__esModule", { value: true });
6
3
  exports.Orchestrator = void 0;
7
- const axios_1 = __importDefault(require("axios"));
8
4
  const viem_1 = require("viem");
9
5
  const error_1 = require("./error");
10
6
  const utils_1 = require("./utils");
@@ -16,41 +12,36 @@ class Orchestrator {
16
12
  this.apiKey = apiKey;
17
13
  }
18
14
  async getPortfolio(userAddress, filter) {
19
- try {
20
- const response = await axios_1.default.get(`${this.serverUrl}/accounts/${userAddress}/portfolio`, {
21
- params: {
22
- chainIds: filter?.chainIds?.join(','),
23
- tokens: filter?.tokens
24
- ? Object.entries(filter.tokens)
25
- .map(([chainId, tokens]) => tokens.map((token) => `${chainId}:${token}`))
26
- .reduce(viem_1.concat, [])
27
- : undefined,
28
- },
29
- headers: {
30
- 'x-api-key': this.apiKey,
31
- },
32
- });
33
- const portfolioResponse = response.data.portfolio;
34
- const portfolio = portfolioResponse.map((tokenResponse) => ({
35
- symbol: tokenResponse.tokenName,
36
- decimals: tokenResponse.tokenDecimals,
37
- balances: {
38
- locked: BigInt(tokenResponse.balance.locked),
39
- unlocked: BigInt(tokenResponse.balance.unlocked),
40
- },
41
- chains: tokenResponse.tokenChainBalance.map((chainBalance) => ({
42
- chain: chainBalance.chainId,
43
- address: chainBalance.tokenAddress,
44
- locked: BigInt(chainBalance.balance.locked),
45
- unlocked: BigInt(chainBalance.balance.unlocked),
46
- })),
47
- }));
48
- return portfolio;
15
+ const params = new URLSearchParams();
16
+ if (filter?.chainIds) {
17
+ params.set('chainIds', filter.chainIds.join(','));
49
18
  }
50
- catch (error) {
51
- this.parseError(error);
52
- throw new error_1.OrchestratorError({ message: 'Failed to get portfolio' });
19
+ if (filter?.tokens) {
20
+ params.set('tokens', Object.entries(filter.tokens)
21
+ .flatMap(([chainId, tokens]) => tokens.map((token) => `${chainId}:${token}`))
22
+ .join(','));
53
23
  }
24
+ const url = new URL(`${this.serverUrl}/accounts/${userAddress}/portfolio`);
25
+ url.search = params.toString();
26
+ const json = await this.fetch(url.toString(), {
27
+ headers: this.getHeaders(),
28
+ });
29
+ const portfolioResponse = json.portfolio;
30
+ const portfolio = portfolioResponse.map((tokenResponse) => ({
31
+ symbol: tokenResponse.tokenName,
32
+ decimals: tokenResponse.tokenDecimals,
33
+ balances: {
34
+ locked: BigInt(tokenResponse.balance.locked),
35
+ unlocked: BigInt(tokenResponse.balance.unlocked),
36
+ },
37
+ chains: tokenResponse.tokenChainBalance.map((chainBalance) => ({
38
+ chain: chainBalance.chainId,
39
+ address: chainBalance.tokenAddress,
40
+ locked: BigInt(chainBalance.balance.locked),
41
+ unlocked: BigInt(chainBalance.balance.unlocked),
42
+ })),
43
+ }));
44
+ return portfolio;
54
45
  }
55
46
  async getMaxTokenAmount(userAddress, destinationChainId, destinationTokenAddress, destinationGasUnits, sponsored) {
56
47
  const intentCost = await this.getIntentCost({
@@ -100,141 +91,179 @@ class Orchestrator {
100
91
  : tokenReceived.destinationAmount;
101
92
  }
102
93
  async getIntentCost(input) {
103
- try {
104
- const response = await axios_1.default.post(`${this.serverUrl}/intents/cost`, {
105
- ...(0, utils_1.convertBigIntFields)(input),
106
- }, {
107
- headers: {
108
- 'x-api-key': this.apiKey,
109
- },
110
- });
111
- return response.data;
112
- }
113
- catch (error) {
114
- this.parseError(error);
115
- throw new error_1.OrchestratorError({ message: 'Failed to get intent cost' });
116
- }
94
+ return await this.fetch(`${this.serverUrl}/intents/cost`, {
95
+ method: 'POST',
96
+ headers: this.getHeaders(),
97
+ body: JSON.stringify((0, utils_1.convertBigIntFields)(input)),
98
+ });
117
99
  }
118
100
  async getIntentRoute(input) {
119
- try {
120
- const response = await axios_1.default.post(`${this.serverUrl}/intents/route`, {
121
- ...(0, utils_1.convertBigIntFields)(input),
122
- }, {
123
- headers: {
124
- 'x-api-key': this.apiKey,
125
- },
126
- });
127
- return response.data;
128
- }
129
- catch (error) {
130
- this.parseError(error);
131
- throw new error_1.OrchestratorError({ message: 'Failed to get intent route' });
132
- }
101
+ return await this.fetch(`${this.serverUrl}/intents/route`, {
102
+ method: 'POST',
103
+ headers: this.getHeaders(),
104
+ body: JSON.stringify((0, utils_1.convertBigIntFields)(input)),
105
+ });
133
106
  }
134
107
  async submitIntent(signedIntentOpUnformatted, dryRun) {
135
- try {
136
- const signedIntentOp = (0, utils_1.convertBigIntFields)(signedIntentOpUnformatted);
137
- if (dryRun) {
138
- signedIntentOp.options = {
139
- dryRun: true,
140
- };
141
- }
142
- const response = await axios_1.default.post(`${this.serverUrl}/intent-operations`, {
143
- signedIntentOp,
144
- }, {
145
- headers: {
146
- 'x-api-key': this.apiKey,
147
- },
148
- });
149
- return response.data;
150
- }
151
- catch (error) {
152
- this.parseError(error);
153
- throw new error_1.OrchestratorError({ message: 'Failed to submit intent' });
108
+ const signedIntentOp = (0, utils_1.convertBigIntFields)(signedIntentOpUnformatted);
109
+ if (dryRun) {
110
+ signedIntentOp.options = {
111
+ dryRun: true,
112
+ };
154
113
  }
114
+ return await this.fetch(`${this.serverUrl}/intent-operations`, {
115
+ method: 'POST',
116
+ headers: this.getHeaders(),
117
+ body: JSON.stringify({
118
+ signedIntentOp,
119
+ }),
120
+ });
155
121
  }
156
122
  async getIntentOpStatus(intentId) {
157
- try {
158
- const response = await axios_1.default.get(`${this.serverUrl}/intent-operation/${intentId.toString()}/status`, {
159
- headers: {
160
- 'x-api-key': this.apiKey,
161
- },
162
- });
163
- return response.data;
123
+ return await this.fetch(`${this.serverUrl}/intent-operation/${intentId.toString()}/status`, {
124
+ headers: this.getHeaders(),
125
+ });
126
+ }
127
+ getHeaders() {
128
+ const headers = {
129
+ 'Content-Type': 'application/json',
130
+ };
131
+ if (this.apiKey) {
132
+ headers['x-api-key'] = this.apiKey;
164
133
  }
165
- catch (error) {
166
- this.parseError(error);
167
- throw new error_1.OrchestratorError({
168
- message: 'Failed to get intent op status',
134
+ return headers;
135
+ }
136
+ async fetch(url, options) {
137
+ const response = await fetch(url, options);
138
+ if (!response.ok) {
139
+ let errorData = {};
140
+ try {
141
+ errorData = await response.json();
142
+ }
143
+ catch {
144
+ try {
145
+ const text = await response.text();
146
+ errorData = { message: text };
147
+ }
148
+ catch { }
149
+ }
150
+ const retryAfterHeader = response.headers?.get?.('retry-after') || undefined;
151
+ this.parseError({
152
+ response: {
153
+ status: response.status,
154
+ data: errorData,
155
+ headers: {
156
+ retryAfter: retryAfterHeader,
157
+ },
158
+ },
169
159
  });
170
160
  }
161
+ return response.json();
171
162
  }
172
163
  parseError(error) {
173
164
  if (error.response) {
174
- let errorType;
175
- if (error.response.status) {
176
- switch (error.response.status) {
177
- case 400:
178
- errorType = 'Bad Request';
179
- break;
180
- case 401:
181
- errorType = 'Unauthorized';
182
- break;
183
- case 403:
184
- errorType = 'Forbidden';
185
- break;
186
- case 404:
187
- errorType = 'Not Found';
188
- break;
189
- case 409:
190
- errorType = 'Conflict';
191
- break;
192
- case 422:
193
- errorType = 'Unprocessable Entity';
194
- break;
195
- case 500:
196
- errorType = 'Internal Server Error';
197
- break;
198
- default:
199
- errorType = 'Unknown';
200
- }
165
+ const status = error.response.status;
166
+ const { headers } = error.response;
167
+ const { errors = [], traceId, message } = error.response.data || {};
168
+ let errorType = 'Unknown';
169
+ switch (status) {
170
+ case 400:
171
+ errorType = 'Bad Request';
172
+ break;
173
+ case 401:
174
+ errorType = 'Unauthorized';
175
+ break;
176
+ case 403:
177
+ errorType = 'Forbidden';
178
+ break;
179
+ case 404:
180
+ errorType = 'Not Found';
181
+ break;
182
+ case 409:
183
+ errorType = 'Conflict';
184
+ break;
185
+ case 422:
186
+ errorType = 'Unprocessable Entity';
187
+ break;
188
+ case 429:
189
+ errorType = 'Too Many Requests';
190
+ break;
191
+ case 500:
192
+ errorType = 'Internal Server Error';
193
+ break;
194
+ case 503:
195
+ errorType = 'Service Unavailable';
196
+ break;
197
+ default:
198
+ errorType = 'Unknown';
201
199
  }
202
- let context = {};
203
- if (error.response.data) {
204
- const { errors, traceId, message } = error.response.data;
205
- if (message) {
206
- const mainErrorParams = {
207
- context: { traceId },
208
- errorType,
209
- traceId,
210
- };
211
- this.parseErrorMessage(message, mainErrorParams);
212
- }
213
- for (const err of errors) {
214
- let errorMessage = `Rhinestone Error: ${err.message}`;
215
- if (errorType) {
216
- errorMessage += ` (${errorType})`;
217
- }
218
- if (traceId) {
219
- errorMessage += ` [Trace ID: ${traceId}]`;
220
- context.traceId = traceId;
200
+ const baseParams = {
201
+ context: { traceId },
202
+ errorType,
203
+ traceId,
204
+ statusCode: status,
205
+ };
206
+ if (status === 422) {
207
+ // zod / json schema validation errors
208
+ const context = { traceId, errors };
209
+ throw new error_1.SchemaValidationError({
210
+ ...baseParams,
211
+ context,
212
+ message: message || 'Schema validation error',
213
+ });
214
+ }
215
+ if (status === 429) {
216
+ const retryAfter = headers?.retryAfter;
217
+ const context = { traceId, retryAfter };
218
+ throw new error_1.RateLimitedError({
219
+ ...baseParams,
220
+ context,
221
+ });
222
+ }
223
+ if (status === 503) {
224
+ throw new error_1.ServiceUnavailableError(baseParams);
225
+ }
226
+ if (message) {
227
+ this.parseErrorMessage(message, baseParams);
228
+ }
229
+ for (const err of errors) {
230
+ const mergedParams = {
231
+ ...baseParams,
232
+ context: { ...err.context, traceId },
233
+ };
234
+ this.parseErrorMessage(err.message, mergedParams);
235
+ }
236
+ switch (status) {
237
+ case 400:
238
+ throw new error_1.BadRequestError(baseParams);
239
+ case 401:
240
+ if (message === 'Authentication is required') {
241
+ throw new error_1.AuthenticationRequiredError(baseParams);
221
242
  }
222
- console.error(errorMessage);
223
- if (err.context) {
224
- console.error(`Context: ${JSON.stringify(err.context, undefined, 4)}`);
243
+ throw new error_1.UnauthorizedError(baseParams);
244
+ case 403:
245
+ throw new error_1.ForbiddenError(baseParams);
246
+ case 404:
247
+ throw new error_1.ResourceNotFoundError(baseParams);
248
+ case 409:
249
+ throw new error_1.ConflictError(baseParams);
250
+ case 500:
251
+ if (errors && errors.length > 0) {
252
+ const mergedParams = {
253
+ ...baseParams,
254
+ context: { ...errors[0].context, traceId },
255
+ };
256
+ throw new error_1.OrchestratorError({
257
+ ...mergedParams,
258
+ message: errors[0].message || 'Internal Server Error',
259
+ });
225
260
  }
226
- context = { ...context, ...err.context };
227
- const message = err.message;
228
- const finalErrorParams = {
229
- context: { ...context, traceId },
230
- errorType,
231
- traceId,
232
- };
233
- this.parseErrorMessage(message, finalErrorParams);
234
- }
235
- }
236
- else {
237
- console.error(error);
261
+ throw new error_1.InternalServerError(baseParams);
262
+ default:
263
+ throw new error_1.OrchestratorError({
264
+ ...baseParams,
265
+ message: message || errorType,
266
+ });
238
267
  }
239
268
  }
240
269
  }
@@ -242,7 +271,8 @@ class Orchestrator {
242
271
  if (message === 'Insufficient balance') {
243
272
  throw new error_1.InsufficientBalanceError(errorParams);
244
273
  }
245
- else if (message === 'Unsupported chain id') {
274
+ else if (message === 'Unsupported chain id' ||
275
+ message === 'Unsupported chain ids') {
246
276
  throw new error_1.UnsupportedChainIdError(errorParams);
247
277
  }
248
278
  else if (message.startsWith('Unsupported chain ')) {
@@ -263,6 +293,10 @@ class Orchestrator {
263
293
  }
264
294
  throw new error_1.OrchestratorError({ message, ...errorParams });
265
295
  }
296
+ else if (message === 'Unsupported token addresses') {
297
+ // generic unsupported tokens without specific symbol/chain context
298
+ throw new error_1.BadRequestError({ message, ...errorParams });
299
+ }
266
300
  else if (message.includes('not supported on chain')) {
267
301
  const tokenMatch = message.match(/Token (.+) not supported on chain (\d+)/);
268
302
  if (tokenMatch) {
@@ -278,18 +312,43 @@ class Orchestrator {
278
312
  else if (message === 'Invalid API key') {
279
313
  throw new error_1.InvalidApiKeyError(errorParams);
280
314
  }
315
+ else if (message === 'Insufficient permissions') {
316
+ throw new error_1.ForbiddenError(errorParams);
317
+ }
281
318
  else if (message === 'Invalid bundle signature') {
282
319
  throw new error_1.InvalidIntentSignatureError(errorParams);
283
320
  }
284
- else if (message === 'Only one target token amount can be unset') {
321
+ else if (message === 'Invalid checksum signature') {
322
+ throw new error_1.InvalidIntentSignatureError(errorParams);
323
+ }
324
+ else if (message === 'Only one target token amount can be unset' ||
325
+ message === 'Only one max-out transfer is allowed') {
285
326
  throw new error_1.OnlyOneTargetTokenAmountCanBeUnsetError(errorParams);
286
327
  }
287
- else if (message === 'No Path Found') {
328
+ else if (message === 'No valid settlement plan found for the given transfers' ||
329
+ message === 'No valid transfers sent for settlement quotes' ||
330
+ message === 'No Path Found') {
288
331
  throw new error_1.NoPathFoundError(errorParams);
289
332
  }
290
- else if (message === 'Order bundle not found') {
333
+ else if (message === 'Emissary is not enabled' ||
334
+ message === 'Emissary is not the expected address') {
335
+ throw new error_1.ForbiddenError(errorParams);
336
+ }
337
+ else if (message.includes('No such intent with nonce') ||
338
+ message === 'Order bundle not found') {
291
339
  throw new error_1.IntentNotFoundError(errorParams);
292
340
  }
341
+ else if (message === 'Could not retrieve a valid quote from any aggregator') {
342
+ throw new error_1.NoPathFoundError(errorParams);
343
+ }
344
+ else if (message === 'No aggregators available for swap') {
345
+ throw new error_1.InternalServerError(errorParams);
346
+ }
347
+ else if (message === 'entity.parse.failed' ||
348
+ message === 'entity.too.large' ||
349
+ message === 'encoding.unsupported') {
350
+ throw new error_1.BodyParserError({ message, ...errorParams });
351
+ }
293
352
  else {
294
353
  throw new error_1.OrchestratorError({ message, ...errorParams });
295
354
  }
@@ -3,22 +3,26 @@ declare class OrchestratorError extends Error {
3
3
  private readonly _context;
4
4
  private readonly _errorType;
5
5
  private readonly _traceId;
6
+ private readonly _statusCode?;
6
7
  constructor(params?: {
7
8
  message?: string;
8
9
  context?: any;
9
10
  errorType?: string;
10
11
  traceId?: string;
12
+ statusCode?: number;
11
13
  });
12
14
  get message(): string;
13
15
  get context(): any;
14
16
  get errorType(): string;
15
17
  get traceId(): string;
18
+ get statusCode(): number | undefined;
16
19
  }
17
20
  declare class InsufficientBalanceError extends OrchestratorError {
18
21
  constructor(params?: {
19
22
  context?: any;
20
23
  errorType?: string;
21
24
  traceId?: string;
25
+ statusCode?: number;
22
26
  });
23
27
  }
24
28
  declare class UnsupportedChainIdError extends OrchestratorError {
@@ -26,6 +30,7 @@ declare class UnsupportedChainIdError extends OrchestratorError {
26
30
  context?: any;
27
31
  errorType?: string;
28
32
  traceId?: string;
33
+ statusCode?: number;
29
34
  });
30
35
  }
31
36
  declare class UnsupportedChainError extends OrchestratorError {
@@ -33,6 +38,7 @@ declare class UnsupportedChainError extends OrchestratorError {
33
38
  context?: any;
34
39
  errorType?: string;
35
40
  traceId?: string;
41
+ statusCode?: number;
36
42
  });
37
43
  }
38
44
  declare class UnsupportedTokenError extends OrchestratorError {
@@ -40,6 +46,7 @@ declare class UnsupportedTokenError extends OrchestratorError {
40
46
  context?: any;
41
47
  errorType?: string;
42
48
  traceId?: string;
49
+ statusCode?: number;
43
50
  });
44
51
  }
45
52
  declare class TokenNotSupportedError extends OrchestratorError {
@@ -47,6 +54,7 @@ declare class TokenNotSupportedError extends OrchestratorError {
47
54
  context?: any;
48
55
  errorType?: string;
49
56
  traceId?: string;
57
+ statusCode?: number;
50
58
  });
51
59
  }
52
60
  declare class AuthenticationRequiredError extends OrchestratorError {
@@ -54,6 +62,7 @@ declare class AuthenticationRequiredError extends OrchestratorError {
54
62
  context?: any;
55
63
  errorType?: string;
56
64
  traceId?: string;
65
+ statusCode?: number;
57
66
  });
58
67
  }
59
68
  declare class InvalidApiKeyError extends OrchestratorError {
@@ -61,6 +70,7 @@ declare class InvalidApiKeyError extends OrchestratorError {
61
70
  context?: any;
62
71
  errorType?: string;
63
72
  traceId?: string;
73
+ statusCode?: number;
64
74
  });
65
75
  }
66
76
  declare class InvalidIntentSignatureError extends OrchestratorError {
@@ -68,6 +78,7 @@ declare class InvalidIntentSignatureError extends OrchestratorError {
68
78
  context?: any;
69
79
  errorType?: string;
70
80
  traceId?: string;
81
+ statusCode?: number;
71
82
  });
72
83
  }
73
84
  declare class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError {
@@ -75,6 +86,7 @@ declare class OnlyOneTargetTokenAmountCanBeUnsetError extends OrchestratorError
75
86
  context?: any;
76
87
  errorType?: string;
77
88
  traceId?: string;
89
+ statusCode?: number;
78
90
  });
79
91
  }
80
92
  declare class NoPathFoundError extends OrchestratorError {
@@ -82,6 +94,7 @@ declare class NoPathFoundError extends OrchestratorError {
82
94
  context?: any;
83
95
  errorType?: string;
84
96
  traceId?: string;
97
+ statusCode?: number;
85
98
  });
86
99
  }
87
100
  declare class IntentNotFoundError extends OrchestratorError {
@@ -89,8 +102,105 @@ declare class IntentNotFoundError extends OrchestratorError {
89
102
  context?: any;
90
103
  errorType?: string;
91
104
  traceId?: string;
105
+ statusCode?: number;
106
+ });
107
+ }
108
+ declare class SchemaValidationError extends OrchestratorError {
109
+ constructor(params?: {
110
+ message?: string;
111
+ context?: any;
112
+ errorType?: string;
113
+ traceId?: string;
114
+ statusCode?: number;
115
+ });
116
+ }
117
+ declare class RateLimitedError extends OrchestratorError {
118
+ constructor(params?: {
119
+ context?: any;
120
+ errorType?: string;
121
+ traceId?: string;
122
+ statusCode?: number;
123
+ });
124
+ }
125
+ declare class ServiceUnavailableError extends OrchestratorError {
126
+ constructor(params?: {
127
+ context?: any;
128
+ errorType?: string;
129
+ traceId?: string;
130
+ statusCode?: number;
131
+ });
132
+ }
133
+ declare class UnauthorizedError extends OrchestratorError {
134
+ constructor(params?: {
135
+ context?: any;
136
+ errorType?: string;
137
+ traceId?: string;
138
+ statusCode?: number;
139
+ });
140
+ }
141
+ declare class ForbiddenError extends OrchestratorError {
142
+ constructor(params?: {
143
+ context?: any;
144
+ errorType?: string;
145
+ traceId?: string;
146
+ statusCode?: number;
147
+ });
148
+ }
149
+ declare class ResourceNotFoundError extends OrchestratorError {
150
+ constructor(params?: {
151
+ context?: any;
152
+ errorType?: string;
153
+ traceId?: string;
154
+ statusCode?: number;
155
+ });
156
+ }
157
+ declare class ConflictError extends OrchestratorError {
158
+ constructor(params?: {
159
+ context?: any;
160
+ errorType?: string;
161
+ traceId?: string;
162
+ statusCode?: number;
163
+ });
164
+ }
165
+ declare class BadRequestError extends OrchestratorError {
166
+ constructor(params?: {
167
+ message?: string;
168
+ context?: any;
169
+ errorType?: string;
170
+ traceId?: string;
171
+ statusCode?: number;
172
+ });
173
+ }
174
+ declare class UnprocessableEntityError extends OrchestratorError {
175
+ constructor(params?: {
176
+ message?: string;
177
+ context?: any;
178
+ errorType?: string;
179
+ traceId?: string;
180
+ statusCode?: number;
181
+ });
182
+ }
183
+ declare class InternalServerError extends OrchestratorError {
184
+ constructor(params?: {
185
+ context?: any;
186
+ errorType?: string;
187
+ traceId?: string;
188
+ statusCode?: number;
189
+ });
190
+ }
191
+ declare class BodyParserError extends OrchestratorError {
192
+ constructor(params?: {
193
+ message?: string;
194
+ context?: any;
195
+ errorType?: string;
196
+ traceId?: string;
197
+ statusCode?: number;
92
198
  });
93
199
  }
94
200
  declare function isOrchestratorError(error: Error): error is OrchestratorError;
95
- export { isOrchestratorError, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidIntentSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, IntentNotFoundError, };
201
+ declare function isRateLimited(error: unknown): error is RateLimitedError;
202
+ declare function isValidationError(error: unknown): boolean;
203
+ declare function isAuthError(error: unknown): boolean;
204
+ declare function isRetryable(error: unknown): boolean;
205
+ export { isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, InsufficientBalanceError, UnsupportedChainIdError, UnsupportedChainError, UnsupportedTokenError, TokenNotSupportedError, AuthenticationRequiredError, InvalidApiKeyError, InvalidIntentSignatureError, OnlyOneTargetTokenAmountCanBeUnsetError, NoPathFoundError, IntentNotFoundError, SchemaValidationError, RateLimitedError, ServiceUnavailableError, UnauthorizedError, ForbiddenError, ResourceNotFoundError, ConflictError, BadRequestError, UnprocessableEntityError, InternalServerError, BodyParserError, };
96
206
  //# sourceMappingURL=error.d.ts.map