@rhinestone/sdk 2.0.0-beta.4 → 2.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.
Files changed (114) hide show
  1. package/dist/src/accounts/error.d.ts +2 -9
  2. package/dist/src/accounts/error.d.ts.map +1 -1
  3. package/dist/src/accounts/error.js +5 -11
  4. package/dist/src/accounts/hca.d.ts +25 -0
  5. package/dist/src/accounts/hca.d.ts.map +1 -0
  6. package/dist/src/accounts/hca.js +148 -0
  7. package/dist/src/accounts/index.d.ts +9 -9
  8. package/dist/src/accounts/index.d.ts.map +1 -1
  9. package/dist/src/accounts/index.js +119 -43
  10. package/dist/src/accounts/kernel.d.ts +1 -2
  11. package/dist/src/accounts/kernel.d.ts.map +1 -1
  12. package/dist/src/accounts/kernel.js +1 -8
  13. package/dist/src/accounts/nexus.d.ts +3 -2
  14. package/dist/src/accounts/nexus.d.ts.map +1 -1
  15. package/dist/src/accounts/nexus.js +33 -8
  16. package/dist/src/accounts/safe.d.ts +1 -2
  17. package/dist/src/accounts/safe.d.ts.map +1 -1
  18. package/dist/src/accounts/safe.js +3 -9
  19. package/dist/src/accounts/signing/common.d.ts +1 -4
  20. package/dist/src/accounts/signing/common.d.ts.map +1 -1
  21. package/dist/src/accounts/signing/common.js +8 -11
  22. package/dist/src/accounts/signing/message.d.ts.map +1 -1
  23. package/dist/src/accounts/signing/message.js +1 -4
  24. package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
  25. package/dist/src/accounts/signing/typedData.js +1 -4
  26. package/dist/src/accounts/startale.d.ts +1 -2
  27. package/dist/src/accounts/startale.d.ts.map +1 -1
  28. package/dist/src/accounts/startale.js +6 -9
  29. package/dist/src/actions/ecdsa.js +5 -5
  30. package/dist/src/actions/index.js +2 -2
  31. package/dist/src/actions/mfa.js +2 -2
  32. package/dist/src/actions/passkeys.js +2 -2
  33. package/dist/src/actions/smart-sessions.d.ts +29 -5
  34. package/dist/src/actions/smart-sessions.d.ts.map +1 -1
  35. package/dist/src/actions/smart-sessions.js +38 -10
  36. package/dist/src/errors/index.d.ts +6 -4
  37. package/dist/src/errors/index.d.ts.map +1 -1
  38. package/dist/src/errors/index.js +6 -6
  39. package/dist/src/execution/error.d.ts +8 -21
  40. package/dist/src/execution/error.d.ts.map +1 -1
  41. package/dist/src/execution/error.js +7 -21
  42. package/dist/src/execution/index.d.ts +18 -18
  43. package/dist/src/execution/index.d.ts.map +1 -1
  44. package/dist/src/execution/index.js +27 -42
  45. package/dist/src/execution/utils.d.ts +15 -11
  46. package/dist/src/execution/utils.d.ts.map +1 -1
  47. package/dist/src/execution/utils.js +281 -80
  48. package/dist/src/index.d.ts +246 -37
  49. package/dist/src/index.d.ts.map +1 -1
  50. package/dist/src/index.js +82 -116
  51. package/dist/src/jwt-server/jcs.d.ts +1 -1
  52. package/dist/src/jwt-server/jcs.js +4 -2
  53. package/dist/src/modules/index.d.ts.map +1 -1
  54. package/dist/src/modules/index.js +0 -5
  55. package/dist/src/modules/read.d.ts +3 -2
  56. package/dist/src/modules/read.d.ts.map +1 -1
  57. package/dist/src/modules/read.js +52 -4
  58. package/dist/src/modules/validators/core.d.ts +6 -6
  59. package/dist/src/modules/validators/core.d.ts.map +1 -1
  60. package/dist/src/modules/validators/core.js +42 -39
  61. package/dist/src/modules/validators/cross-chain-permits.d.ts +21 -0
  62. package/dist/src/modules/validators/cross-chain-permits.d.ts.map +1 -0
  63. package/dist/src/modules/validators/cross-chain-permits.js +111 -0
  64. package/dist/src/modules/validators/permissions.d.ts +1 -0
  65. package/dist/src/modules/validators/permissions.d.ts.map +1 -1
  66. package/dist/src/modules/validators/permissions.js +192 -18
  67. package/dist/src/modules/validators/policies/claim/arbiters.d.ts +22 -0
  68. package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
  69. package/dist/src/modules/validators/policies/claim/arbiters.js +57 -0
  70. package/dist/src/modules/validators/smart-sessions.d.ts +38 -9
  71. package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
  72. package/dist/src/modules/validators/smart-sessions.js +509 -92
  73. package/dist/src/orchestrator/caip2.d.ts +16 -3
  74. package/dist/src/orchestrator/caip2.d.ts.map +1 -1
  75. package/dist/src/orchestrator/caip2.js +38 -6
  76. package/dist/src/orchestrator/client.d.ts +2 -1
  77. package/dist/src/orchestrator/client.d.ts.map +1 -1
  78. package/dist/src/orchestrator/client.js +50 -24
  79. package/dist/src/orchestrator/consts.d.ts +1 -1
  80. package/dist/src/orchestrator/consts.d.ts.map +1 -1
  81. package/dist/src/orchestrator/consts.js +1 -1
  82. package/dist/src/orchestrator/destinations.d.ts +24 -0
  83. package/dist/src/orchestrator/destinations.d.ts.map +1 -0
  84. package/dist/src/orchestrator/destinations.js +59 -0
  85. package/dist/src/orchestrator/error.d.ts +95 -5
  86. package/dist/src/orchestrator/error.d.ts.map +1 -1
  87. package/dist/src/orchestrator/error.js +260 -4
  88. package/dist/src/orchestrator/index.d.ts +7 -5
  89. package/dist/src/orchestrator/index.d.ts.map +1 -1
  90. package/dist/src/orchestrator/index.js +4 -3
  91. package/dist/src/orchestrator/registry.d.ts +2 -1
  92. package/dist/src/orchestrator/registry.d.ts.map +1 -1
  93. package/dist/src/orchestrator/registry.js +13 -0
  94. package/dist/src/orchestrator/types.d.ts +92 -29
  95. package/dist/src/orchestrator/types.d.ts.map +1 -1
  96. package/dist/src/orchestrator/types.js +1 -5
  97. package/dist/src/orchestrator/wire.d.ts +30 -0
  98. package/dist/src/orchestrator/wire.d.ts.map +1 -0
  99. package/dist/src/orchestrator/wire.gen.d.ts +4290 -0
  100. package/dist/src/orchestrator/wire.gen.d.ts.map +1 -0
  101. package/dist/src/orchestrator/wire.gen.js +1 -0
  102. package/dist/src/orchestrator/wire.js +1 -0
  103. package/dist/src/smart-sessions/index.d.ts +6 -0
  104. package/dist/src/smart-sessions/index.d.ts.map +1 -0
  105. package/dist/src/smart-sessions/index.js +7 -0
  106. package/dist/src/types.d.ts +299 -31
  107. package/dist/src/types.d.ts.map +1 -1
  108. package/dist/src/utils/index.d.ts +59 -0
  109. package/dist/src/utils/index.d.ts.map +1 -1
  110. package/dist/src/utils/index.js +59 -0
  111. package/package.json +5 -9
  112. package/dist/src/actions/recovery.d.ts +0 -33
  113. package/dist/src/actions/recovery.d.ts.map +0 -1
  114. package/dist/src/actions/recovery.js +0 -189
@@ -37,7 +37,25 @@ class UnauthorizedError extends OrchestratorError {
37
37
  }
38
38
  class ForbiddenError extends OrchestratorError {
39
39
  constructor(params) {
40
- super({ ...params, code: 'FORBIDDEN' });
40
+ super({ ...params, code: params.code ?? 'FORBIDDEN' });
41
+ }
42
+ }
43
+ /**
44
+ * Thrown when an API key's scope denies the request.
45
+ *
46
+ * Subclass of `ForbiddenError` carrying the failed `scope` and the
47
+ * `required` / `actual` levels — distinct from a generic 403 so integrators
48
+ * can prompt the user to widen the key's scope rather than rotate it.
49
+ */
50
+ class KeyScopeDeniedError extends ForbiddenError {
51
+ scope;
52
+ required;
53
+ actual;
54
+ constructor(params) {
55
+ super({ ...params, code: 'KEY_SCOPE_DENIED' });
56
+ this.scope = params.scope;
57
+ this.required = params.required;
58
+ this.actual = params.actual;
41
59
  }
42
60
  }
43
61
  class ConflictError extends OrchestratorError {
@@ -46,8 +64,10 @@ class ConflictError extends OrchestratorError {
46
64
  }
47
65
  }
48
66
  class UnprocessableContentError extends OrchestratorError {
67
+ details;
49
68
  constructor(params) {
50
69
  super({ ...params, code: 'UNPROCESSABLE_CONTENT' });
70
+ this.details = params.details ?? [];
51
71
  }
52
72
  }
53
73
  class RateLimitedError extends OrchestratorError {
@@ -67,6 +87,27 @@ class SettlementExecutionError extends OrchestratorError {
67
87
  super({ ...params, code: 'SETTLEMENT_EXECUTION_ERROR' });
68
88
  }
69
89
  }
90
+ class SimulationFailedError extends OrchestratorError {
91
+ nonce;
92
+ category;
93
+ errorSelector;
94
+ errorName;
95
+ errorArgs;
96
+ retryable;
97
+ retryHint;
98
+ simulations;
99
+ constructor(params) {
100
+ super({ ...params, code: 'SIMULATION_FAILED' });
101
+ this.nonce = params.nonce;
102
+ this.category = params.category;
103
+ this.errorSelector = params.errorSelector;
104
+ this.errorName = params.errorName;
105
+ this.errorArgs = params.errorArgs;
106
+ this.retryable = params.retryable ?? false;
107
+ this.retryHint = params.retryHint;
108
+ this.simulations = params.simulations ?? [];
109
+ }
110
+ }
70
111
  class ExternalServiceTimeoutError extends OrchestratorError {
71
112
  constructor(params) {
72
113
  super({ ...params, code: 'EXTERNAL_SERVICE_TIMEOUT' });
@@ -106,6 +147,131 @@ class UnsupportedTokenError extends Error {
106
147
  function parseTokenAmounts(record) {
107
148
  return Object.fromEntries(Object.entries(record).map(([addr, amount]) => [addr, BigInt(amount)]));
108
149
  }
150
+ function isRecord(value) {
151
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
152
+ }
153
+ function stringValue(value) {
154
+ return typeof value === 'string' ? value : undefined;
155
+ }
156
+ function booleanValue(value) {
157
+ return typeof value === 'boolean' ? value : undefined;
158
+ }
159
+ function recordValue(value) {
160
+ return isRecord(value) ? value : undefined;
161
+ }
162
+ function parseErrorDetails(details) {
163
+ if (!Array.isArray(details)) {
164
+ return [];
165
+ }
166
+ return details.flatMap((detail) => {
167
+ if (!isRecord(detail) || typeof detail.message !== 'string') {
168
+ return [];
169
+ }
170
+ const context = recordValue(detail.context);
171
+ return [
172
+ {
173
+ message: detail.message,
174
+ ...(context ? { context } : {}),
175
+ },
176
+ ];
177
+ });
178
+ }
179
+ const SIMULATION_ACTIONS = ['claim', 'fill'];
180
+ const SIMULATION_RETRY_HINTS = ['RE_PREPARE', 'RETRY_LATER'];
181
+ const SIMULATION_ERROR_CATEGORIES = [
182
+ 'QUOTE_EXPIRED',
183
+ 'ORDER_EXPIRED',
184
+ 'PERMIT_EXPIRED',
185
+ 'PERMIT2_NONCE_CONSUMED',
186
+ 'EXECUTOR_NONCE_CONSUMED',
187
+ 'INVALID_SIGNATURE',
188
+ 'INVALID_PERMIT2_SIGNATURE',
189
+ 'INVALID_CONTRACT_SIGNATURE',
190
+ 'INVALID_SIGNER',
191
+ 'INSUFFICIENT_BALANCE',
192
+ 'INSUFFICIENT_ALLOWANCE',
193
+ 'ACCOUNT_CREATION_FAILED',
194
+ 'ACCOUNT_UNAUTHORIZED',
195
+ 'ADAPTER_CALL_FAILED',
196
+ 'EXECUTION_FAILED',
197
+ 'CLAIM_FAILED',
198
+ 'ROUTER_PAUSED',
199
+ 'ADAPTER_NOT_FOUND',
200
+ 'PANIC',
201
+ 'REQUIRE_FAILED',
202
+ 'UNCLASSIFIED_REVERT',
203
+ 'EMPTY_REVERT',
204
+ ];
205
+ function oneOf(value, allowed) {
206
+ return typeof value === 'string' && allowed.includes(value)
207
+ ? value
208
+ : undefined;
209
+ }
210
+ function stringArrayValue(value) {
211
+ return Array.isArray(value)
212
+ ? value.filter((item) => typeof item === 'string')
213
+ : undefined;
214
+ }
215
+ function parseSimulationCall(value) {
216
+ if (!isRecord(value)) {
217
+ return undefined;
218
+ }
219
+ return {
220
+ chainId: stringValue(value.chainId),
221
+ to: stringValue(value.to),
222
+ data: stringValue(value.data),
223
+ value: stringValue(value.value),
224
+ };
225
+ }
226
+ function parseSimulationDetails(value) {
227
+ if (!isRecord(value)) {
228
+ return undefined;
229
+ }
230
+ return {
231
+ stateOverride: value.stateOverride,
232
+ blockNumber: stringValue(value.blockNumber),
233
+ relayer: stringValue(value.relayer),
234
+ simulationUrls: stringArrayValue(value.simulationUrls),
235
+ };
236
+ }
237
+ function isSimulationFailureSimulation(value) {
238
+ return isRecord(value) && value.success === false;
239
+ }
240
+ function parseSimulationFailureSimulation(value) {
241
+ if (!isSimulationFailureSimulation(value)) {
242
+ return undefined;
243
+ }
244
+ return {
245
+ success: false,
246
+ action: oneOf(value.action, SIMULATION_ACTIONS),
247
+ chainId: stringValue(value.chainId),
248
+ call: parseSimulationCall(value.call),
249
+ errorSelector: stringValue(value.errorSelector),
250
+ errorName: stringValue(value.errorName),
251
+ errorArgs: recordValue(value.errorArgs),
252
+ errorCategory: oneOf(value.errorCategory, SIMULATION_ERROR_CATEGORIES),
253
+ details: parseSimulationDetails(value.details),
254
+ };
255
+ }
256
+ function parseSimulationFailureDetails(details) {
257
+ if (!isRecord(details)) {
258
+ return {};
259
+ }
260
+ return {
261
+ nonce: stringValue(details.nonce),
262
+ category: oneOf(details.category, SIMULATION_ERROR_CATEGORIES),
263
+ errorSelector: stringValue(details.errorSelector),
264
+ errorName: stringValue(details.errorName),
265
+ errorArgs: recordValue(details.errorArgs),
266
+ retryable: booleanValue(details.retryable),
267
+ retryHint: oneOf(details.retryHint, SIMULATION_RETRY_HINTS),
268
+ simulations: Array.isArray(details.simulations)
269
+ ? details.simulations
270
+ .map(parseSimulationFailureSimulation)
271
+ .filter((simulation) => simulation !== undefined)
272
+ : undefined,
273
+ };
274
+ }
109
275
  function parseErrorEnvelope(envelope, statusCode, retryAfter) {
110
276
  const base = {
111
277
  message: envelope.message,
@@ -133,16 +299,36 @@ function parseErrorEnvelope(envelope, statusCode, retryAfter) {
133
299
  return new UnauthorizedError(base);
134
300
  case 'FORBIDDEN':
135
301
  return new ForbiddenError(base);
302
+ case 'KEY_SCOPE_DENIED': {
303
+ const detail = Array.isArray(envelope.details)
304
+ ? envelope.details[0]
305
+ : undefined;
306
+ const context = (detail?.context ?? {});
307
+ return new KeyScopeDeniedError({
308
+ ...base,
309
+ scope: context.scope ?? '',
310
+ required: context.required ?? '',
311
+ actual: context.actual ?? '',
312
+ });
313
+ }
136
314
  case 'CONFLICT':
137
315
  return new ConflictError(base);
138
316
  case 'UNPROCESSABLE_CONTENT':
139
- return new UnprocessableContentError(base);
317
+ return new UnprocessableContentError({
318
+ ...base,
319
+ details: parseErrorDetails(envelope.details),
320
+ });
140
321
  case 'TOO_MANY_REQUESTS':
141
322
  return new RateLimitedError({ ...base, retryAfter });
142
323
  case 'SETTLEMENT_QUOTE_ERROR':
143
324
  return new SettlementQuoteError(base);
144
325
  case 'SETTLEMENT_EXECUTION_ERROR':
145
326
  return new SettlementExecutionError(base);
327
+ case 'SIMULATION_FAILED':
328
+ return new SimulationFailedError({
329
+ ...base,
330
+ ...parseSimulationFailureDetails(envelope.details),
331
+ });
146
332
  case 'EXTERNAL_SERVICE_TIMEOUT':
147
333
  return new ExternalServiceTimeoutError(base);
148
334
  case 'RELAYER_MARKET_UNAVAILABLE':
@@ -165,9 +351,79 @@ function isValidationError(error) {
165
351
  function isAuthError(error) {
166
352
  return error instanceof UnauthorizedError || error instanceof ForbiddenError;
167
353
  }
354
+ function isSimulationFailed(error) {
355
+ return error instanceof SimulationFailedError;
356
+ }
168
357
  function isRetryable(error) {
169
358
  return (error instanceof InternalServerError ||
170
359
  error instanceof ExternalServiceTimeoutError ||
171
- error instanceof RelayerMarketUnavailableError);
360
+ error instanceof RelayerMarketUnavailableError ||
361
+ (error instanceof SimulationFailedError && error.retryable));
362
+ }
363
+ // Transport-level error codes that escape `fetch` as raw errors rather than
364
+ // typed HTTP envelopes. Spans Node/undici and common system codes.
365
+ const CONNECTION_ERROR_CODES = new Set([
366
+ 'ECONNRESET',
367
+ 'ECONNREFUSED',
368
+ 'ECONNABORTED',
369
+ 'ETIMEDOUT',
370
+ 'EPIPE',
371
+ 'ENOTFOUND',
372
+ 'EAI_AGAIN',
373
+ 'EHOSTUNREACH',
374
+ 'ENETUNREACH',
375
+ 'UND_ERR_SOCKET',
376
+ 'UND_ERR_CONNECT_TIMEOUT',
377
+ 'UND_ERR_HEADERS_TIMEOUT',
378
+ 'UND_ERR_BODY_TIMEOUT',
379
+ ]);
380
+ const CONNECTION_ERROR_MESSAGES = [
381
+ 'socket connection was closed', // Bun
382
+ 'fetch failed', // undici/Node (the coded cause is matched separately)
383
+ 'failed to fetch', // Chrome/Edge
384
+ 'networkerror when attempting to fetch', // Firefox
385
+ 'network request failed',
386
+ 'connection closed',
387
+ 'connection reset',
388
+ ];
389
+ /**
390
+ * Detects transport-level failures (connection reset, socket closed, DNS, TLS)
391
+ * that `fetch` rejects with instead of returning an HTTP response. Unlike HTTP
392
+ * errors — which the client converts into typed {@link OrchestratorError}s —
393
+ * these carry no status and bubble up untyped, so {@link isRetryable} misses
394
+ * them. They are safe to retry for idempotent reads (e.g. intent-status
395
+ * polling). We match by `code` and message across the cause chain — never by
396
+ * error type: `fetch` rejects network failures as `TypeError`, but `TypeError`
397
+ * is also thrown for logic bugs, bad URLs, and response-decoding errors that
398
+ * must NOT be retried (`waitForExecution` has no SDK-side deadline). Runtimes
399
+ * differ (Bun throws a plain `Error` with a socket message; undici/Node a
400
+ * `TypeError` with a coded `cause`), hence both signals. Caller-initiated
401
+ * aborts are excluded so deadlines/cancellation still propagate.
402
+ */
403
+ function isConnectionError(error) {
404
+ // HTTP-status errors are already typed and classified elsewhere.
405
+ if (isOrchestratorError(error)) {
406
+ return false;
407
+ }
408
+ // Caller cancellation / deadline must propagate, not retry.
409
+ if (error instanceof Error && error.name === 'AbortError') {
410
+ return false;
411
+ }
412
+ // Walk the `cause` chain; `seen` guards against cyclic causes looping forever.
413
+ const seen = new Set();
414
+ let current = error;
415
+ while (current != null && !seen.has(current)) {
416
+ seen.add(current);
417
+ const code = current.code;
418
+ if (typeof code === 'string' && CONNECTION_ERROR_CODES.has(code)) {
419
+ return true;
420
+ }
421
+ const message = current instanceof Error ? current.message.toLowerCase() : '';
422
+ if (CONNECTION_ERROR_MESSAGES.some((m) => message.includes(m))) {
423
+ return true;
424
+ }
425
+ current = current.cause;
426
+ }
427
+ return false;
172
428
  }
173
- export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
429
+ export { parseErrorEnvelope, isOrchestratorError, isRetryable, isConnectionError, isAuthError, isValidationError, isRateLimited, isSimulationFailed, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, KeyScopeDeniedError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, SimulationFailedError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
@@ -1,11 +1,13 @@
1
1
  import type { AuthProvider } from '../auth/provider.js';
2
2
  import { Orchestrator } from './client.js';
3
3
  import { RHINESTONE_SPOKE_POOL_ADDRESS } from './consts.js';
4
- import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError } from './error.js';
4
+ import { type DestinationChain, hyperCoreMainnet, isNonEvmChain, type NonEvmAddress, type NonEvmChain, solanaMainnet, tronMainnet } from './destinations.js';
5
+ import type { ErrorDetail } from './error.js';
6
+ import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isConnectionError, isOrchestratorError, isRateLimited, isRetryable, isSimulationFailed, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, SimulationFailedError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError } from './error.js';
5
7
  import { getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry.js';
6
- import type { ApprovalRequired, AuxiliaryFunds, BridgeFill, Cost, CostTokenEntry, EstimatedFillTime, Execution, FeeBreakdown, Fees, IntentInput, IntentOpStatus, IntentOptions, IntentSubmitRequest, IntentSubmitResponse, Portfolio, Price, Quote, QuoteResponse, SettlementLayer, SignatureMode, SignData, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, SponsorSettings, SupportedChain, TokenConfig, TokenRequirements, TypedDataDefinition, UsdAmount, WrapRequired } from './types.js';
7
- import { INTENT_STATUS_CLAIMED, INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED } from './types.js';
8
+ import type { AppFeeBalances, AppFeeRate, ApprovalRequired, AuxiliaryFunds, BridgeFill, ChainOperation, Cost, CostTokenEntry, EstimatedFillTime, Execution, FailureReason, FeeBreakdown, Fees, IntentInput, IntentOpStatus, IntentOptions, IntentSubmitRequest, IntentSubmitResponse, OperationStatus, OriginSignature, Portfolio, Price, Quote, QuoteResponse, SettlementLayer, SettlementLayerFilter, SignatureMode, SignData, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, SponsorSettings, SupportedChain, TokenConfig, TokenRequirements, TypedDataDefinition, UsdAmount, WrapRequired } from './types.js';
9
+ import { INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, INTENT_STATUS_PENDING } from './types.js';
8
10
  declare function getOrchestrator(authProvider: AuthProvider, orchestratorUrl?: string, headers?: Record<string, string>): Orchestrator;
9
- export type { ApprovalRequired, AuxiliaryFunds, BridgeFill, Cost, CostTokenEntry, EstimatedFillTime, Execution, FeeBreakdown, Fees, IntentInput, IntentOpStatus, IntentOptions, IntentSubmitRequest, IntentSubmitResponse, Portfolio, Price, Quote, QuoteResponse, SettlementLayer, SignatureMode, SignData, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, SponsorSettings, SupportedChain, TokenConfig, TokenRequirements, TypedDataDefinition, UsdAmount, WrapRequired, };
10
- export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_CLAIMED, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isTokenAddressSupported, };
11
+ export type { ApprovalRequired, AppFeeBalances, AppFeeRate, AuxiliaryFunds, BridgeFill, ChainOperation, Cost, CostTokenEntry, DestinationChain, ErrorDetail, NonEvmAddress, NonEvmChain, EstimatedFillTime, Execution, FailureReason, FeeBreakdown, Fees, IntentInput, IntentOpStatus, IntentOptions, IntentSubmitRequest, IntentSubmitResponse, OperationStatus, OriginSignature, Portfolio, Price, Quote, QuoteResponse, SettlementLayer, SettlementLayerFilter, SignatureMode, SignData, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, SponsorSettings, SupportedChain, TokenConfig, TokenRequirements, TypedDataDefinition, UsdAmount, WrapRequired, };
12
+ export { hyperCoreMainnet, isNonEvmChain, solanaMainnet, tronMainnet, INTENT_STATUS_PENDING, INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SimulationFailedError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isConnectionError, isAuthError, isValidationError, isRateLimited, isSimulationFailed, isTokenAddressSupported, };
11
13
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAA;AACvC,OAAO,EAAyB,6BAA6B,EAAE,MAAM,UAAU,CAAA;AAC/E,OAAO,EACL,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,WAAW,EACX,mBAAmB,EACnB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EAChB,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,cAAc,EACd,cAAc,EACd,uBAAuB,EACxB,MAAM,YAAY,CAAA;AACnB,OAAO,KAAK,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,KAAK,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACb,MAAM,SAAS,CAAA;AAChB,OAAO,EACL,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,SAAS,CAAA;AAEhB,iBAAS,eAAe,CACtB,YAAY,EAAE,YAAY,EAC1B,eAAe,CAAC,EAAE,MAAM,EACxB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC/B,YAAY,CAMd;AAED,YAAY,EACV,gBAAgB,EAChB,cAAc,EACd,UAAU,EACV,IAAI,EACJ,cAAc,EACd,iBAAiB,EACjB,SAAS,EACT,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,SAAS,EACT,KAAK,EACL,KAAK,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,QAAQ,EACR,mBAAmB,EACnB,iBAAiB,EACjB,kBAAkB,EAClB,eAAe,EACf,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,mBAAmB,EACnB,SAAS,EACT,YAAY,GACb,CAAA;AACD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,oBAAoB,EACpB,0BAA0B,EAC1B,qBAAqB,EACrB,6BAA6B,EAC7B,YAAY,EACZ,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,aAAa,EACb,iBAAiB,EACjB,gBAAgB,EAChB,6BAA6B,EAC7B,wBAAwB,EACxB,oBAAoB,EACpB,iBAAiB,EACjB,yBAAyB,EACzB,qBAAqB,EACrB,qBAAqB,EACrB,eAAe,EACf,eAAe,EACf,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,uBAAuB,GACxB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../orchestrator/index.ts"],"names":[],"mappings":"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"}
@@ -1,9 +1,10 @@
1
1
  import { Orchestrator } from './client.js';
2
2
  import { PROD_ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS } from './consts.js';
3
- import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isOrchestratorError, isRateLimited, isRetryable, isValidationError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, } from './error.js';
3
+ import { hyperCoreMainnet, isNonEvmChain, solanaMainnet, tronMainnet, } from './destinations.js';
4
+ import { ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, isAuthError, isConnectionError, isOrchestratorError, isRateLimited, isRetryable, isSimulationFailed, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, SimulationFailedError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, } from './error.js';
4
5
  import { getTokenSymbol, getWethAddress, isTokenAddressSupported, } from './registry.js';
5
- import { INTENT_STATUS_CLAIMED, INTENT_STATUS_COMPLETED, INTENT_STATUS_EXPIRED, INTENT_STATUS_FAILED, INTENT_STATUS_FILLED, INTENT_STATUS_PENDING, INTENT_STATUS_PRECONFIRMED, } from './types.js';
6
+ import { INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, INTENT_STATUS_PENDING, } from './types.js';
6
7
  function getOrchestrator(authProvider, orchestratorUrl, headers) {
7
8
  return new Orchestrator(orchestratorUrl ?? PROD_ORCHESTRATOR_URL, authProvider, headers);
8
9
  }
9
- export { INTENT_STATUS_PENDING, INTENT_STATUS_EXPIRED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_FAILED, INTENT_STATUS_PRECONFIRMED, INTENT_STATUS_CLAIMED, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, isTokenAddressSupported, };
10
+ export { hyperCoreMainnet, isNonEvmChain, solanaMainnet, tronMainnet, INTENT_STATUS_PENDING, INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, RHINESTONE_SPOKE_POOL_ADDRESS, Orchestrator, ConflictError, ExternalServiceTimeoutError, ForbiddenError, InsufficientLiquidityError, InternalServerError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SimulationFailedError, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isConnectionError, isAuthError, isValidationError, isRateLimited, isSimulationFailed, isTokenAddressSupported, };
@@ -1,5 +1,6 @@
1
1
  import { type Address, type Chain } from 'viem';
2
2
  import type { TokenSymbol } from '../types.js';
3
+ import type { NonEvmAddress } from './destinations.js';
3
4
  declare function getSupportedChainIds(): number[];
4
5
  declare function getWethAddress(chain: Chain): Address;
5
6
  declare function getWrappedTokenAddress(chain: Chain): Address;
@@ -11,6 +12,6 @@ declare function isTokenAddressSupported(address: Address, chainId: number): boo
11
12
  declare function getDefaultAccountAccessList(onTestnets?: boolean): {
12
13
  chainIds: number[];
13
14
  };
14
- declare function resolveTokenAddress(token: TokenSymbol | Address, chainId: number): Address;
15
+ declare function resolveTokenAddress(token: TokenSymbol | Address | NonEvmAddress, chainId: number): Address | NonEvmAddress;
15
16
  export { getTokenSymbol, getTokenAddress, getWethAddress, getWrappedTokenAddress, getChainById, getSupportedChainIds, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, resolveTokenAddress, };
16
17
  //# sourceMappingURL=registry.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,MAAM,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAG3C,iBAAS,oBAAoB,IAAI,MAAM,EAAE,CAExC;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAY7C;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAarD;AAED,iBAAS,cAAc,CACrB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAY3E;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAM5C;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3C;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAS3E;AAED,iBAAS,2BAA2B,CAAC,UAAU,CAAC,EAAE,OAAO;;EAaxD;AAED,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,WAAW,GAAG,OAAO,EAC5B,OAAO,EAAE,MAAM,GACd,OAAO,CAKT;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,GACpB,CAAA"}
1
+ {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../../orchestrator/registry.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,KAAK,EAAa,MAAM,MAAM,CAAA;AAC1D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAA;AAGnD,iBAAS,oBAAoB,IAAI,MAAM,EAAE,CAExC;AAMD,iBAAS,cAAc,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAY7C;AAED,iBAAS,sBAAsB,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAarD;AAED,iBAAS,cAAc,CACrB,YAAY,EAAE,OAAO,EACrB,OAAO,EAAE,MAAM,GACd,MAAM,GAAG,SAAS,CAWpB;AAED,iBAAS,eAAe,CAAC,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAY3E;AAED,iBAAS,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,KAAK,CAM5C;AAED,iBAAS,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAG3C;AAED,iBAAS,uBAAuB,CAAC,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAS3E;AAED,iBAAS,2BAA2B,CAAC,UAAU,CAAC,EAAE,OAAO;;EAaxD;AAED,iBAAS,mBAAmB,CAC1B,KAAK,EAAE,WAAW,GAAG,OAAO,GAAG,aAAa,EAC5C,OAAO,EAAE,MAAM,GACd,OAAO,GAAG,aAAa,CAiBzB;AAED,OAAO,EACL,cAAc,EACd,eAAe,EACf,cAAc,EACd,sBAAsB,EACtB,YAAY,EACZ,oBAAoB,EACpB,SAAS,EACT,uBAAuB,EACvB,2BAA2B,EAC3B,mBAAmB,GACpB,CAAA"}
@@ -1,5 +1,6 @@
1
1
  import { chainRegistry, chains, } from '@rhinestone/shared-configs';
2
2
  import { isAddress } from 'viem';
3
+ import { isNonEvmChainId } from './caip2.js';
3
4
  import { UnsupportedChainError, UnsupportedTokenError } from './error.js';
4
5
  function getSupportedChainIds() {
5
6
  return chains.map((chain) => chain.id);
@@ -85,6 +86,18 @@ function resolveTokenAddress(token, chainId) {
85
86
  if (isAddress(token)) {
86
87
  return token;
87
88
  }
89
+ // Non-EVM destinations carry SPL mints (base58) / Tron T-prefixed
90
+ // addresses that don't satisfy viem's `isAddress`. The orchestrator's
91
+ // wire schema accepts the raw string for non-EVM chains, so pass it
92
+ // through unchanged. HyperCore is descriptor-addressed too but its tokens
93
+ // are EVM hex addresses (returned above), so it is intentionally absent
94
+ // from `isNonEvmChainId` — a token *symbol* for HyperCore is not a valid
95
+ // request and falls through to the throw below.
96
+ if (isNonEvmChainId(chainId)) {
97
+ return token;
98
+ }
99
+ // For EVM chains that aren't a hex address, the value must be a known
100
+ // token symbol. `getTokenAddress` throws if it isn't.
88
101
  return getTokenAddress(token, chainId);
89
102
  }
90
103
  export { getTokenSymbol, getTokenAddress, getWethAddress, getWrappedTokenAddress, getChainById, getSupportedChainIds, isTestnet, isTokenAddressSupported, getDefaultAccountAccessList, resolveTokenAddress, };
@@ -1,16 +1,20 @@
1
1
  import type { SettlementLayer as CrossChainSettlementLayer, SupportedChain, SupportedMainnet, SupportedOPStackMainnet, SupportedOPStackTestnet, SupportedTestnet } from '@rhinestone/shared-configs';
2
2
  import type { Address, Chain, Hex, TypedDataDefinition } from 'viem';
3
+ import type { NonEvmAddress } from './destinations.js';
3
4
  type SupportedTokenSymbol = 'ETH' | 'WETH' | 'USDC' | 'USDT' | 'USDT0';
4
5
  type SupportedToken = SupportedTokenSymbol | Address;
5
6
  type AccountType = 'GENERIC' | 'ERC7579' | 'EOA';
6
7
  declare const INTENT_STATUS_PENDING = "PENDING";
7
8
  declare const INTENT_STATUS_FAILED = "FAILED";
8
- declare const INTENT_STATUS_EXPIRED = "EXPIRED";
9
9
  declare const INTENT_STATUS_COMPLETED = "COMPLETED";
10
- declare const INTENT_STATUS_FILLED = "FILLED";
11
- declare const INTENT_STATUS_PRECONFIRMED = "PRECONFIRMED";
12
- declare const INTENT_STATUS_CLAIMED = "CLAIMED";
13
- type IntentStatus = typeof INTENT_STATUS_PENDING | typeof INTENT_STATUS_EXPIRED | typeof INTENT_STATUS_COMPLETED | typeof INTENT_STATUS_FILLED | typeof INTENT_STATUS_PRECONFIRMED | typeof INTENT_STATUS_FAILED | typeof INTENT_STATUS_CLAIMED;
10
+ /**
11
+ * High-level intent status.
12
+ *
13
+ * - `PENDING` – the intent has been accepted and is being processed
14
+ * - `COMPLETED` – all operations finished successfully
15
+ * - `FAILED` – the intent failed (inspect `operations` for details)
16
+ */
17
+ type IntentStatus = typeof INTENT_STATUS_PENDING | typeof INTENT_STATUS_COMPLETED | typeof INTENT_STATUS_FAILED;
14
18
  type MappedChainTokenAccessList = {
15
19
  chainTokens?: {
16
20
  [chainId in SupportedChain]?: SupportedToken[];
@@ -24,20 +28,50 @@ type UnmappedChainTokenAccessList = {
24
28
  tokens?: SupportedToken[];
25
29
  };
26
30
  type AccountAccessList = MappedChainTokenAccessList | UnmappedChainTokenAccessList;
27
- type ClaimStatus = 'PENDING' | 'EXPIRED' | 'CLAIMED';
28
- interface Claim {
29
- depositId: bigint;
30
- chainId: number;
31
- status: ClaimStatus;
32
- claimTimestamp?: number;
33
- claimTransactionHash?: Hex;
34
- }
31
+ /** Per-operation status. */
32
+ type OperationStatus = 'PENDING' | 'COMPLETED' | 'FAILED';
33
+ /**
34
+ * Why an operation failed. Only meaningful when `status` is `FAILED`.
35
+ *
36
+ * - `EXPIRED` – the operation deadline passed without completion
37
+ * - `REVERTED` – the on-chain transaction reverted
38
+ * - `RELAYER_FAILURE` – the relayer could not submit the transaction
39
+ */
40
+ type FailureReason = 'EXPIRED' | 'REVERTED' | 'RELAYER_FAILURE';
41
+ /**
42
+ * One operation per chain involved in the intent.
43
+ *
44
+ * The orchestrator returns `items[]` per chain for future extensibility;
45
+ * the SDK flattens to one entry per chain for simpler DX.
46
+ */
47
+ type ChainOperation = {
48
+ /** Chain ID this operation belongs to. */
49
+ chain: number;
50
+ status: 'PENDING';
51
+ } | {
52
+ chain: number;
53
+ status: 'COMPLETED';
54
+ /** Transaction hash of the confirmed on-chain transaction. */
55
+ txHash: Hex;
56
+ /** UNIX epoch seconds when the on-chain transaction was confirmed. */
57
+ timestamp: number;
58
+ } | {
59
+ chain: number;
60
+ status: 'FAILED';
61
+ /** Why the operation failed. */
62
+ failureReason: FailureReason;
63
+ };
35
64
  interface Execution {
36
65
  to: Address;
37
66
  value: bigint;
38
67
  data: Hex;
39
68
  }
40
69
  type SettlementLayer = 'SAME_CHAIN' | 'INTENT_EXECUTOR' | CrossChainSettlementLayer;
70
+ type SettlementLayerFilter = {
71
+ include: CrossChainSettlementLayer[];
72
+ } | {
73
+ exclude: CrossChainSettlementLayer[];
74
+ };
41
75
  declare const SIG_MODE_EMISSARY = 0;
42
76
  declare const SIG_MODE_ERC1271 = 1;
43
77
  declare const SIG_MODE_EMISSARY_ERC1271 = 2;
@@ -50,12 +84,22 @@ type AuxiliaryFunds = {
50
84
  [chainId: number]: Record<Address, bigint>;
51
85
  };
52
86
  interface IntentOptions {
53
- feeToken?: Address | SupportedTokenSymbol;
87
+ appFees?: AppFeeRate;
54
88
  sponsorSettings?: SponsorSettings;
55
- settlementLayers?: SettlementLayer[];
89
+ settlementLayers?: SettlementLayerFilter;
56
90
  signatureMode?: SignatureMode;
57
91
  auxiliaryFunds?: AuxiliaryFunds;
58
92
  }
93
+ interface AppFeeRate {
94
+ feeBps: number;
95
+ }
96
+ /** An integrator's accrued app-fee balance, as USD totals. */
97
+ interface AppFeeBalances {
98
+ /** Collected (accrued) app fees available to withdraw, valued in USD at collection. */
99
+ withdrawableUsd: number;
100
+ /** Value reserved by an in-flight withdrawal; `0` until withdrawals are enabled. */
101
+ pendingUsd: number;
102
+ }
59
103
  interface SponsorSettings {
60
104
  gas: boolean;
61
105
  bridgeFees: boolean;
@@ -77,7 +121,7 @@ interface IntentInput {
77
121
  destinationExecutions: Execution[];
78
122
  destinationGasUnits?: bigint;
79
123
  tokenRequests: {
80
- tokenAddress: Address;
124
+ tokenAddress: Address | NonEvmAddress;
81
125
  amount?: bigint;
82
126
  }[];
83
127
  recipient?: Account;
@@ -102,9 +146,8 @@ interface CostTokenEntry {
102
146
  interface FeeBreakdown {
103
147
  gas: UsdAmount;
104
148
  bridge: UsdAmount;
105
- protocol: UsdAmount;
106
149
  swap: UsdAmount;
107
- settlement: UsdAmount;
150
+ app: UsdAmount;
108
151
  }
109
152
  interface Fees {
110
153
  total: UsdAmount;
@@ -155,6 +198,7 @@ interface Quote {
155
198
  bridgeFill?: BridgeFill;
156
199
  }
157
200
  interface QuoteResponse {
201
+ traceId: string;
158
202
  routes: Quote[];
159
203
  }
160
204
  type OriginSignature = Hex | {
@@ -162,7 +206,7 @@ type OriginSignature = Hex | {
162
206
  preClaimSig: Hex;
163
207
  };
164
208
  interface SignedAuthorization {
165
- chainId: number;
209
+ chainId: string;
166
210
  address: Address;
167
211
  nonce: number;
168
212
  yParity: number;
@@ -192,6 +236,7 @@ interface IntentSubmitRequestInternal extends IntentSubmitRequest {
192
236
  };
193
237
  }
194
238
  interface IntentSubmitResponse {
239
+ traceId: string;
195
240
  intentId: string;
196
241
  }
197
242
  type AccountContext = {
@@ -204,9 +249,18 @@ type AccountContext = {
204
249
  accountType: 'EOA';
205
250
  };
206
251
  interface Account {
207
- address: Address;
208
- accountType: AccountType;
209
- setupOps: Pick<Execution, 'to' | 'data'>[];
252
+ address: Address | NonEvmAddress;
253
+ /**
254
+ * Account type — required for EVM accounts. Omitted for non-EVM
255
+ * recipients (Solana / Tron) where smart-account semantics don't apply
256
+ * and the orchestrator schema requires it unset.
257
+ */
258
+ accountType?: AccountType;
259
+ /**
260
+ * Per-chain account-setup operations — required for EVM accounts.
261
+ * Omitted for non-EVM recipients for the same reason as `accountType`.
262
+ */
263
+ setupOps?: Pick<Execution, 'to' | 'data'>[];
210
264
  delegations?: Delegations;
211
265
  /** Per-chain SSX mock signatures keyed by decimal chainId string. */
212
266
  mockSignatures?: Record<`${number}`, Hex>;
@@ -259,19 +313,28 @@ export type OPNetworkParams = {
259
313
  interface SplitIntentsInput {
260
314
  chain: Chain;
261
315
  tokens: Record<Address, bigint>;
262
- settlementLayers?: SettlementLayer[];
316
+ settlementLayers?: SettlementLayerFilter;
263
317
  }
264
318
  interface SplitIntentsResult {
319
+ traceId: string;
265
320
  intents: Record<Address, bigint>[];
266
321
  }
322
+ /**
323
+ * Full intent status as returned by the orchestrator (blanc API version).
324
+ *
325
+ * One operation per chain involved in the intent. The SDK flattens the
326
+ * orchestrator's per-chain `items[]` to a single entry per chain.
327
+ */
267
328
  interface IntentOpStatus {
329
+ /** OpenTelemetry trace ID for correlating this orchestrator response. */
330
+ traceId: string;
331
+ /** High-level intent status. */
268
332
  status: IntentStatus;
269
- claims: Claim[];
270
- destinationChainId: number;
333
+ /** The smart-account address that owns this intent. */
271
334
  accountAddress: Address;
272
- fillTimestamp?: number;
273
- fillTransactionHash?: Hex;
335
+ /** Per-chain operation status. One entry per chain. */
336
+ operations: ChainOperation[];
274
337
  }
275
- export type { Account, AccountType, AccountWithContext, AuxiliaryFunds, TokenConfig, SupportedChain, SettlementLayer, SignatureMode, IntentInput, BridgeFill, Quote, QuoteResponse, Cost, CostTokenEntry, FeeBreakdown, Fees, Price, UsdAmount, EstimatedFillTime, SignData, IntentSubmitRequest, IntentSubmitRequestInternal, IntentSubmitResponse, IntentOpStatus, IntentOptions, SponsorSettings, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, Portfolio, PortfolioToken, Execution, AccountAccessList, MappedChainTokenAccessList, UnmappedChainTokenAccessList, OriginSignature, TokenRequirements, WrapRequired, ApprovalRequired, TypedDataDefinition, };
276
- export { INTENT_STATUS_PENDING, INTENT_STATUS_FAILED, INTENT_STATUS_EXPIRED, INTENT_STATUS_CLAIMED, INTENT_STATUS_COMPLETED, INTENT_STATUS_FILLED, INTENT_STATUS_PRECONFIRMED, SIG_MODE_EMISSARY, SIG_MODE_ERC1271, SIG_MODE_EMISSARY_ERC1271, SIG_MODE_ERC1271_EMISSARY, SIG_MODE_EMISSARY_EXECUTION, SIG_MODE_EMISSARY_EXECUTION_ERC1271, SIG_MODE_ERC1271_EMISSARY_EXECUTION, };
338
+ export type { Account, AccountType, AccountWithContext, AppFeeRate, AuxiliaryFunds, AppFeeBalances, TokenConfig, SupportedChain, SettlementLayer, SettlementLayerFilter, SignatureMode, IntentInput, BridgeFill, Quote, QuoteResponse, Cost, CostTokenEntry, FeeBreakdown, Fees, Price, UsdAmount, EstimatedFillTime, SignData, IntentSubmitRequest, IntentSubmitRequestInternal, IntentSubmitResponse, IntentOpStatus, IntentOptions, SponsorSettings, SignedAuthorization, SplitIntentsInput, SplitIntentsResult, Portfolio, PortfolioToken, Execution, AccountAccessList, MappedChainTokenAccessList, UnmappedChainTokenAccessList, OriginSignature, TokenRequirements, WrapRequired, ApprovalRequired, TypedDataDefinition, OperationStatus, FailureReason, ChainOperation, };
339
+ export { INTENT_STATUS_PENDING, INTENT_STATUS_FAILED, INTENT_STATUS_COMPLETED, SIG_MODE_EMISSARY, SIG_MODE_ERC1271, SIG_MODE_EMISSARY_ERC1271, SIG_MODE_ERC1271_EMISSARY, SIG_MODE_EMISSARY_EXECUTION, SIG_MODE_EMISSARY_EXECUTION_ERC1271, SIG_MODE_ERC1271_EMISSARY_EXECUTION, };
277
340
  //# sourceMappingURL=types.d.ts.map