@rhinestone/sdk 2.0.0-beta.3 → 2.0.0-beta.31
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.
- package/dist/src/accounts/error.d.ts +2 -9
- package/dist/src/accounts/error.d.ts.map +1 -1
- package/dist/src/accounts/error.js +5 -11
- package/dist/src/accounts/hca.d.ts +25 -0
- package/dist/src/accounts/hca.d.ts.map +1 -0
- package/dist/src/accounts/hca.js +145 -0
- package/dist/src/accounts/index.d.ts +9 -9
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +112 -41
- package/dist/src/accounts/kernel.d.ts +1 -2
- package/dist/src/accounts/kernel.d.ts.map +1 -1
- package/dist/src/accounts/kernel.js +1 -8
- package/dist/src/accounts/nexus.d.ts +3 -2
- package/dist/src/accounts/nexus.d.ts.map +1 -1
- package/dist/src/accounts/nexus.js +33 -8
- package/dist/src/accounts/safe.d.ts +1 -2
- package/dist/src/accounts/safe.d.ts.map +1 -1
- package/dist/src/accounts/safe.js +3 -9
- package/dist/src/accounts/signing/common.d.ts +1 -4
- package/dist/src/accounts/signing/common.d.ts.map +1 -1
- package/dist/src/accounts/signing/common.js +7 -11
- package/dist/src/accounts/signing/message.d.ts.map +1 -1
- package/dist/src/accounts/signing/message.js +1 -4
- package/dist/src/accounts/signing/typedData.d.ts.map +1 -1
- package/dist/src/accounts/signing/typedData.js +1 -4
- package/dist/src/accounts/startale.d.ts +1 -2
- package/dist/src/accounts/startale.d.ts.map +1 -1
- package/dist/src/accounts/startale.js +2 -5
- package/dist/src/actions/ecdsa.js +5 -5
- package/dist/src/actions/index.js +2 -2
- package/dist/src/actions/mfa.js +2 -2
- package/dist/src/actions/passkeys.js +2 -2
- package/dist/src/actions/smart-sessions.d.ts +29 -5
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +38 -10
- package/dist/src/errors/index.d.ts +4 -4
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +6 -6
- package/dist/src/execution/error.d.ts +8 -21
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +7 -21
- package/dist/src/execution/index.d.ts +17 -17
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +22 -41
- package/dist/src/execution/utils.d.ts +15 -11
- package/dist/src/execution/utils.d.ts.map +1 -1
- package/dist/src/execution/utils.js +279 -75
- package/dist/src/index.d.ts +236 -37
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +60 -115
- package/dist/src/jwt-server/jcs.d.ts +1 -1
- package/dist/src/jwt-server/jcs.js +4 -2
- package/dist/src/modules/index.d.ts.map +1 -1
- package/dist/src/modules/index.js +0 -5
- package/dist/src/modules/read.d.ts +3 -2
- package/dist/src/modules/read.d.ts.map +1 -1
- package/dist/src/modules/read.js +33 -4
- package/dist/src/modules/validators/core.d.ts +5 -5
- package/dist/src/modules/validators/core.d.ts.map +1 -1
- package/dist/src/modules/validators/core.js +45 -34
- package/dist/src/modules/validators/cross-chain-permits.d.ts +11 -0
- package/dist/src/modules/validators/cross-chain-permits.d.ts.map +1 -0
- package/dist/src/modules/validators/cross-chain-permits.js +76 -0
- package/dist/src/modules/validators/permissions.d.ts +1 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +162 -17
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts +22 -0
- package/dist/src/modules/validators/policies/claim/arbiters.d.ts.map +1 -0
- package/dist/src/modules/validators/policies/claim/arbiters.js +57 -0
- package/dist/src/modules/validators/smart-sessions.d.ts +38 -9
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +509 -92
- package/dist/src/orchestrator/caip2.d.ts +9 -3
- package/dist/src/orchestrator/caip2.d.ts.map +1 -1
- package/dist/src/orchestrator/caip2.js +40 -5
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +44 -21
- package/dist/src/orchestrator/consts.d.ts +1 -1
- package/dist/src/orchestrator/consts.d.ts.map +1 -1
- package/dist/src/orchestrator/consts.js +1 -1
- package/dist/src/orchestrator/destinations.d.ts +24 -0
- package/dist/src/orchestrator/destinations.d.ts.map +1 -0
- package/dist/src/orchestrator/destinations.js +55 -0
- package/dist/src/orchestrator/error.d.ts +87 -4
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +237 -3
- package/dist/src/orchestrator/index.d.ts +6 -5
- package/dist/src/orchestrator/index.d.ts.map +1 -1
- package/dist/src/orchestrator/index.js +4 -3
- package/dist/src/orchestrator/registry.d.ts +2 -1
- package/dist/src/orchestrator/registry.d.ts.map +1 -1
- package/dist/src/orchestrator/registry.js +13 -0
- package/dist/src/orchestrator/types.d.ts +114 -28
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +1 -5
- package/dist/src/smart-sessions/index.d.ts +5 -0
- package/dist/src/smart-sessions/index.d.ts.map +1 -0
- package/dist/src/smart-sessions/index.js +6 -0
- package/dist/src/types.d.ts +298 -29
- package/dist/src/types.d.ts.map +1 -1
- package/dist/src/utils/index.d.ts +59 -0
- package/dist/src/utils/index.d.ts.map +1 -1
- package/dist/src/utils/index.js +59 -0
- package/package.json +4 -8
- package/dist/src/actions/recovery.d.ts +0 -33
- package/dist/src/actions/recovery.d.ts.map +0 -1
- 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 {
|
|
@@ -67,6 +85,27 @@ class SettlementExecutionError extends OrchestratorError {
|
|
|
67
85
|
super({ ...params, code: 'SETTLEMENT_EXECUTION_ERROR' });
|
|
68
86
|
}
|
|
69
87
|
}
|
|
88
|
+
class SimulationFailedError extends OrchestratorError {
|
|
89
|
+
nonce;
|
|
90
|
+
category;
|
|
91
|
+
errorSelector;
|
|
92
|
+
errorName;
|
|
93
|
+
errorArgs;
|
|
94
|
+
retryable;
|
|
95
|
+
retryHint;
|
|
96
|
+
simulations;
|
|
97
|
+
constructor(params) {
|
|
98
|
+
super({ ...params, code: 'SIMULATION_FAILED' });
|
|
99
|
+
this.nonce = params.nonce;
|
|
100
|
+
this.category = params.category;
|
|
101
|
+
this.errorSelector = params.errorSelector;
|
|
102
|
+
this.errorName = params.errorName;
|
|
103
|
+
this.errorArgs = params.errorArgs;
|
|
104
|
+
this.retryable = params.retryable ?? false;
|
|
105
|
+
this.retryHint = params.retryHint;
|
|
106
|
+
this.simulations = params.simulations ?? [];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
70
109
|
class ExternalServiceTimeoutError extends OrchestratorError {
|
|
71
110
|
constructor(params) {
|
|
72
111
|
super({ ...params, code: 'EXTERNAL_SERVICE_TIMEOUT' });
|
|
@@ -106,6 +145,114 @@ class UnsupportedTokenError extends Error {
|
|
|
106
145
|
function parseTokenAmounts(record) {
|
|
107
146
|
return Object.fromEntries(Object.entries(record).map(([addr, amount]) => [addr, BigInt(amount)]));
|
|
108
147
|
}
|
|
148
|
+
function isRecord(value) {
|
|
149
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
150
|
+
}
|
|
151
|
+
function stringValue(value) {
|
|
152
|
+
return typeof value === 'string' ? value : undefined;
|
|
153
|
+
}
|
|
154
|
+
function booleanValue(value) {
|
|
155
|
+
return typeof value === 'boolean' ? value : undefined;
|
|
156
|
+
}
|
|
157
|
+
function recordValue(value) {
|
|
158
|
+
return isRecord(value) ? value : undefined;
|
|
159
|
+
}
|
|
160
|
+
const SIMULATION_ACTIONS = ['claim', 'fill'];
|
|
161
|
+
const SIMULATION_RETRY_HINTS = ['RE_PREPARE', 'RETRY_LATER'];
|
|
162
|
+
const SIMULATION_ERROR_CATEGORIES = [
|
|
163
|
+
'QUOTE_EXPIRED',
|
|
164
|
+
'ORDER_EXPIRED',
|
|
165
|
+
'PERMIT_EXPIRED',
|
|
166
|
+
'PERMIT2_NONCE_CONSUMED',
|
|
167
|
+
'EXECUTOR_NONCE_CONSUMED',
|
|
168
|
+
'INVALID_SIGNATURE',
|
|
169
|
+
'INVALID_PERMIT2_SIGNATURE',
|
|
170
|
+
'INVALID_CONTRACT_SIGNATURE',
|
|
171
|
+
'INVALID_SIGNER',
|
|
172
|
+
'INSUFFICIENT_BALANCE',
|
|
173
|
+
'INSUFFICIENT_ALLOWANCE',
|
|
174
|
+
'ACCOUNT_CREATION_FAILED',
|
|
175
|
+
'ACCOUNT_UNAUTHORIZED',
|
|
176
|
+
'ADAPTER_CALL_FAILED',
|
|
177
|
+
'EXECUTION_FAILED',
|
|
178
|
+
'CLAIM_FAILED',
|
|
179
|
+
'ROUTER_PAUSED',
|
|
180
|
+
'ADAPTER_NOT_FOUND',
|
|
181
|
+
'PANIC',
|
|
182
|
+
'REQUIRE_FAILED',
|
|
183
|
+
'UNCLASSIFIED_REVERT',
|
|
184
|
+
'EMPTY_REVERT',
|
|
185
|
+
];
|
|
186
|
+
function oneOf(value, allowed) {
|
|
187
|
+
return typeof value === 'string' && allowed.includes(value)
|
|
188
|
+
? value
|
|
189
|
+
: undefined;
|
|
190
|
+
}
|
|
191
|
+
function stringArrayValue(value) {
|
|
192
|
+
return Array.isArray(value)
|
|
193
|
+
? value.filter((item) => typeof item === 'string')
|
|
194
|
+
: undefined;
|
|
195
|
+
}
|
|
196
|
+
function parseSimulationCall(value) {
|
|
197
|
+
if (!isRecord(value)) {
|
|
198
|
+
return undefined;
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
chainId: stringValue(value.chainId),
|
|
202
|
+
to: stringValue(value.to),
|
|
203
|
+
data: stringValue(value.data),
|
|
204
|
+
value: stringValue(value.value),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
function parseSimulationDetails(value) {
|
|
208
|
+
if (!isRecord(value)) {
|
|
209
|
+
return undefined;
|
|
210
|
+
}
|
|
211
|
+
return {
|
|
212
|
+
stateOverride: value.stateOverride,
|
|
213
|
+
blockNumber: stringValue(value.blockNumber),
|
|
214
|
+
relayer: stringValue(value.relayer),
|
|
215
|
+
simulationUrls: stringArrayValue(value.simulationUrls),
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
function isSimulationFailureSimulation(value) {
|
|
219
|
+
return isRecord(value) && value.success === false;
|
|
220
|
+
}
|
|
221
|
+
function parseSimulationFailureSimulation(value) {
|
|
222
|
+
if (!isSimulationFailureSimulation(value)) {
|
|
223
|
+
return undefined;
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
success: false,
|
|
227
|
+
action: oneOf(value.action, SIMULATION_ACTIONS),
|
|
228
|
+
chainId: stringValue(value.chainId),
|
|
229
|
+
call: parseSimulationCall(value.call),
|
|
230
|
+
errorSelector: stringValue(value.errorSelector),
|
|
231
|
+
errorName: stringValue(value.errorName),
|
|
232
|
+
errorArgs: recordValue(value.errorArgs),
|
|
233
|
+
errorCategory: oneOf(value.errorCategory, SIMULATION_ERROR_CATEGORIES),
|
|
234
|
+
details: parseSimulationDetails(value.details),
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function parseSimulationFailureDetails(details) {
|
|
238
|
+
if (!isRecord(details)) {
|
|
239
|
+
return {};
|
|
240
|
+
}
|
|
241
|
+
return {
|
|
242
|
+
nonce: stringValue(details.nonce),
|
|
243
|
+
category: oneOf(details.category, SIMULATION_ERROR_CATEGORIES),
|
|
244
|
+
errorSelector: stringValue(details.errorSelector),
|
|
245
|
+
errorName: stringValue(details.errorName),
|
|
246
|
+
errorArgs: recordValue(details.errorArgs),
|
|
247
|
+
retryable: booleanValue(details.retryable),
|
|
248
|
+
retryHint: oneOf(details.retryHint, SIMULATION_RETRY_HINTS),
|
|
249
|
+
simulations: Array.isArray(details.simulations)
|
|
250
|
+
? details.simulations
|
|
251
|
+
.map(parseSimulationFailureSimulation)
|
|
252
|
+
.filter((simulation) => simulation !== undefined)
|
|
253
|
+
: undefined,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
109
256
|
function parseErrorEnvelope(envelope, statusCode, retryAfter) {
|
|
110
257
|
const base = {
|
|
111
258
|
message: envelope.message,
|
|
@@ -133,6 +280,18 @@ function parseErrorEnvelope(envelope, statusCode, retryAfter) {
|
|
|
133
280
|
return new UnauthorizedError(base);
|
|
134
281
|
case 'FORBIDDEN':
|
|
135
282
|
return new ForbiddenError(base);
|
|
283
|
+
case 'KEY_SCOPE_DENIED': {
|
|
284
|
+
const detail = Array.isArray(envelope.details)
|
|
285
|
+
? envelope.details[0]
|
|
286
|
+
: undefined;
|
|
287
|
+
const context = (detail?.context ?? {});
|
|
288
|
+
return new KeyScopeDeniedError({
|
|
289
|
+
...base,
|
|
290
|
+
scope: context.scope ?? '',
|
|
291
|
+
required: context.required ?? '',
|
|
292
|
+
actual: context.actual ?? '',
|
|
293
|
+
});
|
|
294
|
+
}
|
|
136
295
|
case 'CONFLICT':
|
|
137
296
|
return new ConflictError(base);
|
|
138
297
|
case 'UNPROCESSABLE_CONTENT':
|
|
@@ -143,6 +302,11 @@ function parseErrorEnvelope(envelope, statusCode, retryAfter) {
|
|
|
143
302
|
return new SettlementQuoteError(base);
|
|
144
303
|
case 'SETTLEMENT_EXECUTION_ERROR':
|
|
145
304
|
return new SettlementExecutionError(base);
|
|
305
|
+
case 'SIMULATION_FAILED':
|
|
306
|
+
return new SimulationFailedError({
|
|
307
|
+
...base,
|
|
308
|
+
...parseSimulationFailureDetails(envelope.details),
|
|
309
|
+
});
|
|
146
310
|
case 'EXTERNAL_SERVICE_TIMEOUT':
|
|
147
311
|
return new ExternalServiceTimeoutError(base);
|
|
148
312
|
case 'RELAYER_MARKET_UNAVAILABLE':
|
|
@@ -165,9 +329,79 @@ function isValidationError(error) {
|
|
|
165
329
|
function isAuthError(error) {
|
|
166
330
|
return error instanceof UnauthorizedError || error instanceof ForbiddenError;
|
|
167
331
|
}
|
|
332
|
+
function isSimulationFailed(error) {
|
|
333
|
+
return error instanceof SimulationFailedError;
|
|
334
|
+
}
|
|
168
335
|
function isRetryable(error) {
|
|
169
336
|
return (error instanceof InternalServerError ||
|
|
170
337
|
error instanceof ExternalServiceTimeoutError ||
|
|
171
|
-
error instanceof RelayerMarketUnavailableError
|
|
338
|
+
error instanceof RelayerMarketUnavailableError ||
|
|
339
|
+
(error instanceof SimulationFailedError && error.retryable));
|
|
340
|
+
}
|
|
341
|
+
// Transport-level error codes that escape `fetch` as raw errors rather than
|
|
342
|
+
// typed HTTP envelopes. Spans Node/undici and common system codes.
|
|
343
|
+
const CONNECTION_ERROR_CODES = new Set([
|
|
344
|
+
'ECONNRESET',
|
|
345
|
+
'ECONNREFUSED',
|
|
346
|
+
'ECONNABORTED',
|
|
347
|
+
'ETIMEDOUT',
|
|
348
|
+
'EPIPE',
|
|
349
|
+
'ENOTFOUND',
|
|
350
|
+
'EAI_AGAIN',
|
|
351
|
+
'EHOSTUNREACH',
|
|
352
|
+
'ENETUNREACH',
|
|
353
|
+
'UND_ERR_SOCKET',
|
|
354
|
+
'UND_ERR_CONNECT_TIMEOUT',
|
|
355
|
+
'UND_ERR_HEADERS_TIMEOUT',
|
|
356
|
+
'UND_ERR_BODY_TIMEOUT',
|
|
357
|
+
]);
|
|
358
|
+
const CONNECTION_ERROR_MESSAGES = [
|
|
359
|
+
'socket connection was closed', // Bun
|
|
360
|
+
'fetch failed', // undici/Node (the coded cause is matched separately)
|
|
361
|
+
'failed to fetch', // Chrome/Edge
|
|
362
|
+
'networkerror when attempting to fetch', // Firefox
|
|
363
|
+
'network request failed',
|
|
364
|
+
'connection closed',
|
|
365
|
+
'connection reset',
|
|
366
|
+
];
|
|
367
|
+
/**
|
|
368
|
+
* Detects transport-level failures (connection reset, socket closed, DNS, TLS)
|
|
369
|
+
* that `fetch` rejects with instead of returning an HTTP response. Unlike HTTP
|
|
370
|
+
* errors — which the client converts into typed {@link OrchestratorError}s —
|
|
371
|
+
* these carry no status and bubble up untyped, so {@link isRetryable} misses
|
|
372
|
+
* them. They are safe to retry for idempotent reads (e.g. intent-status
|
|
373
|
+
* polling). We match by `code` and message across the cause chain — never by
|
|
374
|
+
* error type: `fetch` rejects network failures as `TypeError`, but `TypeError`
|
|
375
|
+
* is also thrown for logic bugs, bad URLs, and response-decoding errors that
|
|
376
|
+
* must NOT be retried (`waitForExecution` has no SDK-side deadline). Runtimes
|
|
377
|
+
* differ (Bun throws a plain `Error` with a socket message; undici/Node a
|
|
378
|
+
* `TypeError` with a coded `cause`), hence both signals. Caller-initiated
|
|
379
|
+
* aborts are excluded so deadlines/cancellation still propagate.
|
|
380
|
+
*/
|
|
381
|
+
function isConnectionError(error) {
|
|
382
|
+
// HTTP-status errors are already typed and classified elsewhere.
|
|
383
|
+
if (isOrchestratorError(error)) {
|
|
384
|
+
return false;
|
|
385
|
+
}
|
|
386
|
+
// Caller cancellation / deadline must propagate, not retry.
|
|
387
|
+
if (error instanceof Error && error.name === 'AbortError') {
|
|
388
|
+
return false;
|
|
389
|
+
}
|
|
390
|
+
// Walk the `cause` chain; `seen` guards against cyclic causes looping forever.
|
|
391
|
+
const seen = new Set();
|
|
392
|
+
let current = error;
|
|
393
|
+
while (current != null && !seen.has(current)) {
|
|
394
|
+
seen.add(current);
|
|
395
|
+
const code = current.code;
|
|
396
|
+
if (typeof code === 'string' && CONNECTION_ERROR_CODES.has(code)) {
|
|
397
|
+
return true;
|
|
398
|
+
}
|
|
399
|
+
const message = current instanceof Error ? current.message.toLowerCase() : '';
|
|
400
|
+
if (CONNECTION_ERROR_MESSAGES.some((m) => message.includes(m))) {
|
|
401
|
+
return true;
|
|
402
|
+
}
|
|
403
|
+
current = current.cause;
|
|
404
|
+
}
|
|
405
|
+
return false;
|
|
172
406
|
}
|
|
173
|
-
export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
|
|
407
|
+
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,12 @@
|
|
|
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 {
|
|
4
|
+
import { type DestinationChain, hyperCoreMainnet, isNonEvmChain, type NonEvmAddress, type NonEvmChain, solanaMainnet, tronMainnet } from './destinations.js';
|
|
5
|
+
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
6
|
import { getTokenSymbol, getWethAddress, isTokenAddressSupported } from './registry.js';
|
|
6
|
-
import type { ApprovalRequired, AuxiliaryFunds, 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 {
|
|
7
|
+
import type { AppFee, 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';
|
|
8
|
+
import { INTENT_STATUS_COMPLETED, INTENT_STATUS_FAILED, INTENT_STATUS_PENDING } from './types.js';
|
|
8
9
|
declare function getOrchestrator(authProvider: AuthProvider, orchestratorUrl?: string, headers?: Record<string, string>): Orchestrator;
|
|
9
|
-
export type { ApprovalRequired, AuxiliaryFunds, 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 {
|
|
10
|
+
export type { ApprovalRequired, AppFee, AppFeeRate, AuxiliaryFunds, BridgeFill, ChainOperation, Cost, CostTokenEntry, DestinationChain, 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, };
|
|
11
|
+
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
12
|
//# 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,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,
|
|
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 {
|
|
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 {
|
|
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 {
|
|
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;
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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;
|
|
@@ -51,11 +85,21 @@ type AuxiliaryFunds = {
|
|
|
51
85
|
};
|
|
52
86
|
interface IntentOptions {
|
|
53
87
|
feeToken?: Address | SupportedTokenSymbol;
|
|
88
|
+
appFees?: AppFeeRate;
|
|
54
89
|
sponsorSettings?: SponsorSettings;
|
|
55
|
-
settlementLayers?:
|
|
90
|
+
settlementLayers?: SettlementLayerFilter;
|
|
56
91
|
signatureMode?: SignatureMode;
|
|
57
92
|
auxiliaryFunds?: AuxiliaryFunds;
|
|
58
93
|
}
|
|
94
|
+
interface AppFeeRate {
|
|
95
|
+
feeBps: number;
|
|
96
|
+
}
|
|
97
|
+
interface AppFee extends AppFeeRate {
|
|
98
|
+
baseAmount: bigint;
|
|
99
|
+
amount: bigint;
|
|
100
|
+
chainId: number;
|
|
101
|
+
tokenAddress: Address;
|
|
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
|
-
|
|
150
|
+
app: UsdAmount;
|
|
108
151
|
}
|
|
109
152
|
interface Fees {
|
|
110
153
|
total: UsdAmount;
|
|
@@ -123,6 +166,27 @@ interface SignData {
|
|
|
123
166
|
destination: TypedDataDefinition;
|
|
124
167
|
targetExecution?: TypedDataDefinition;
|
|
125
168
|
}
|
|
169
|
+
type BridgeFill = {
|
|
170
|
+
type: 'OFT';
|
|
171
|
+
destinationChainId: number;
|
|
172
|
+
} | {
|
|
173
|
+
type: 'RELAY';
|
|
174
|
+
destinationChainId: number;
|
|
175
|
+
requestId: string;
|
|
176
|
+
} | {
|
|
177
|
+
type: 'NEAR';
|
|
178
|
+
destinationChainId: number;
|
|
179
|
+
depositAddress: Address;
|
|
180
|
+
} | {
|
|
181
|
+
type: 'RHINO';
|
|
182
|
+
destinationChainId: number;
|
|
183
|
+
commitmentId: string;
|
|
184
|
+
} | {
|
|
185
|
+
type: 'CCTP';
|
|
186
|
+
destinationChainId: number;
|
|
187
|
+
sourceDomainId: number;
|
|
188
|
+
destinationDomainId: number;
|
|
189
|
+
};
|
|
126
190
|
interface Quote {
|
|
127
191
|
intentId: string;
|
|
128
192
|
expiresAt: number;
|
|
@@ -130,9 +194,12 @@ interface Quote {
|
|
|
130
194
|
settlementLayer: SettlementLayer;
|
|
131
195
|
signData: SignData;
|
|
132
196
|
cost: Cost;
|
|
197
|
+
appFee?: AppFee[];
|
|
133
198
|
tokenRequirements?: TokenRequirements;
|
|
199
|
+
bridgeFill?: BridgeFill;
|
|
134
200
|
}
|
|
135
201
|
interface QuoteResponse {
|
|
202
|
+
traceId: string;
|
|
136
203
|
routes: Quote[];
|
|
137
204
|
}
|
|
138
205
|
type OriginSignature = Hex | {
|
|
@@ -140,7 +207,7 @@ type OriginSignature = Hex | {
|
|
|
140
207
|
preClaimSig: Hex;
|
|
141
208
|
};
|
|
142
209
|
interface SignedAuthorization {
|
|
143
|
-
chainId:
|
|
210
|
+
chainId: string;
|
|
144
211
|
address: Address;
|
|
145
212
|
nonce: number;
|
|
146
213
|
yParity: number;
|
|
@@ -170,6 +237,7 @@ interface IntentSubmitRequestInternal extends IntentSubmitRequest {
|
|
|
170
237
|
};
|
|
171
238
|
}
|
|
172
239
|
interface IntentSubmitResponse {
|
|
240
|
+
traceId: string;
|
|
173
241
|
intentId: string;
|
|
174
242
|
}
|
|
175
243
|
type AccountContext = {
|
|
@@ -182,9 +250,18 @@ type AccountContext = {
|
|
|
182
250
|
accountType: 'EOA';
|
|
183
251
|
};
|
|
184
252
|
interface Account {
|
|
185
|
-
address: Address;
|
|
186
|
-
|
|
187
|
-
|
|
253
|
+
address: Address | NonEvmAddress;
|
|
254
|
+
/**
|
|
255
|
+
* Account type — required for EVM accounts. Omitted for non-EVM
|
|
256
|
+
* recipients (Solana / Tron) where smart-account semantics don't apply
|
|
257
|
+
* and the orchestrator schema requires it unset.
|
|
258
|
+
*/
|
|
259
|
+
accountType?: AccountType;
|
|
260
|
+
/**
|
|
261
|
+
* Per-chain account-setup operations — required for EVM accounts.
|
|
262
|
+
* Omitted for non-EVM recipients for the same reason as `accountType`.
|
|
263
|
+
*/
|
|
264
|
+
setupOps?: Pick<Execution, 'to' | 'data'>[];
|
|
188
265
|
delegations?: Delegations;
|
|
189
266
|
/** Per-chain SSX mock signatures keyed by decimal chainId string. */
|
|
190
267
|
mockSignatures?: Record<`${number}`, Hex>;
|
|
@@ -237,19 +314,28 @@ export type OPNetworkParams = {
|
|
|
237
314
|
interface SplitIntentsInput {
|
|
238
315
|
chain: Chain;
|
|
239
316
|
tokens: Record<Address, bigint>;
|
|
240
|
-
settlementLayers?:
|
|
317
|
+
settlementLayers?: SettlementLayerFilter;
|
|
241
318
|
}
|
|
242
319
|
interface SplitIntentsResult {
|
|
320
|
+
traceId: string;
|
|
243
321
|
intents: Record<Address, bigint>[];
|
|
244
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* Full intent status as returned by the orchestrator (blanc API version).
|
|
325
|
+
*
|
|
326
|
+
* One operation per chain involved in the intent. The SDK flattens the
|
|
327
|
+
* orchestrator's per-chain `items[]` to a single entry per chain.
|
|
328
|
+
*/
|
|
245
329
|
interface IntentOpStatus {
|
|
330
|
+
/** OpenTelemetry trace ID for correlating this orchestrator response. */
|
|
331
|
+
traceId: string;
|
|
332
|
+
/** High-level intent status. */
|
|
246
333
|
status: IntentStatus;
|
|
247
|
-
|
|
248
|
-
destinationChainId: number;
|
|
334
|
+
/** The smart-account address that owns this intent. */
|
|
249
335
|
accountAddress: Address;
|
|
250
|
-
|
|
251
|
-
|
|
336
|
+
/** Per-chain operation status. One entry per chain. */
|
|
337
|
+
operations: ChainOperation[];
|
|
252
338
|
}
|
|
253
|
-
export type { Account, AccountType, AccountWithContext, AuxiliaryFunds, TokenConfig, SupportedChain, SettlementLayer, SignatureMode, IntentInput, 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, };
|
|
254
|
-
export { INTENT_STATUS_PENDING, INTENT_STATUS_FAILED,
|
|
339
|
+
export type { Account, AccountType, AccountWithContext, AppFee, AppFeeRate, AuxiliaryFunds, 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, };
|
|
340
|
+
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, };
|
|
255
341
|
//# sourceMappingURL=types.d.ts.map
|