@rhinestone/sdk 2.0.0-beta.2 → 2.0.0-beta.21
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/index.d.ts +5 -5
- package/dist/src/accounts/index.d.ts.map +1 -1
- package/dist/src/accounts/index.js +46 -2
- package/dist/src/actions/ecdsa.js +2 -2
- 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 +11 -3
- package/dist/src/actions/smart-sessions.d.ts.map +1 -1
- package/dist/src/actions/smart-sessions.js +14 -9
- package/dist/src/errors/index.d.ts +3 -3
- package/dist/src/errors/index.d.ts.map +1 -1
- package/dist/src/errors/index.js +4 -4
- package/dist/src/execution/error.d.ts +8 -7
- package/dist/src/execution/error.d.ts.map +1 -1
- package/dist/src/execution/error.js +7 -5
- package/dist/src/execution/index.d.ts +16 -17
- package/dist/src/execution/index.d.ts.map +1 -1
- package/dist/src/execution/index.js +18 -34
- 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 +259 -56
- package/dist/src/index.d.ts +6 -7
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +3 -0
- package/dist/src/modules/validators/permissions.d.ts.map +1 -1
- package/dist/src/modules/validators/permissions.js +161 -17
- package/dist/src/modules/validators/smart-sessions.d.ts +24 -8
- package/dist/src/modules/validators/smart-sessions.d.ts.map +1 -1
- package/dist/src/modules/validators/smart-sessions.js +227 -83
- 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 +2 -1
- package/dist/src/orchestrator/client.d.ts.map +1 -1
- package/dist/src/orchestrator/client.js +56 -30
- 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 +22 -3
- package/dist/src/orchestrator/error.d.ts.map +1 -1
- package/dist/src/orchestrator/error.js +32 -2
- 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 +103 -35
- package/dist/src/orchestrator/types.d.ts.map +1 -1
- package/dist/src/orchestrator/types.js +1 -5
- package/dist/src/types.d.ts +148 -15
- package/dist/src/types.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { fromCaip2, toCaip2 } from './caip2.js';
|
|
1
|
+
import { fromCaip2, isCaip2, toCaip2 } from './caip2.js';
|
|
2
2
|
import { API_VERSION, SDK_VERSION } from './consts.js';
|
|
3
3
|
import { OrchestratorError, parseErrorEnvelope, } from './error.js';
|
|
4
4
|
import { convertBigIntFields } from './utils.js';
|
|
@@ -37,8 +37,7 @@ export class Orchestrator {
|
|
|
37
37
|
chain: parseChainId(c.chainId),
|
|
38
38
|
address: c.address,
|
|
39
39
|
decimals: c.decimals,
|
|
40
|
-
|
|
41
|
-
unlocked: BigInt(c.balance.unlocked),
|
|
40
|
+
amount: BigInt(c.amount),
|
|
42
41
|
})),
|
|
43
42
|
}));
|
|
44
43
|
}
|
|
@@ -55,7 +54,9 @@ export class Orchestrator {
|
|
|
55
54
|
const body = convertBigIntFields({
|
|
56
55
|
chainId: toCaip2(input.chain.id),
|
|
57
56
|
tokens: input.tokens,
|
|
58
|
-
settlementLayers: input.settlementLayers
|
|
57
|
+
settlementLayers: input.settlementLayers
|
|
58
|
+
? encodeSettlementLayers(input.settlementLayers)
|
|
59
|
+
: undefined,
|
|
59
60
|
});
|
|
60
61
|
const json = await this.fetch(`${this.serverUrl}/intents/splits`, {
|
|
61
62
|
method: 'POST',
|
|
@@ -63,6 +64,7 @@ export class Orchestrator {
|
|
|
63
64
|
body: JSON.stringify(body),
|
|
64
65
|
});
|
|
65
66
|
return {
|
|
67
|
+
traceId: json.traceId,
|
|
66
68
|
intents: json.intents.map(parseTokenAmountsRecord),
|
|
67
69
|
};
|
|
68
70
|
}
|
|
@@ -82,18 +84,14 @@ export class Orchestrator {
|
|
|
82
84
|
headers: await this.getHeaders(),
|
|
83
85
|
});
|
|
84
86
|
return {
|
|
87
|
+
traceId: json.traceId,
|
|
85
88
|
status: json.status,
|
|
86
|
-
claims: (json.claims ?? []).map((claim) => ({
|
|
87
|
-
depositId: claim.depositId !== undefined ? BigInt(claim.depositId) : 0n,
|
|
88
|
-
chainId: parseChainId(claim.chainId),
|
|
89
|
-
status: claim.status,
|
|
90
|
-
claimTimestamp: claim.claimTimestamp,
|
|
91
|
-
claimTransactionHash: claim.claimTransactionHash,
|
|
92
|
-
})),
|
|
93
|
-
destinationChainId: parseChainId(json.destinationChainId),
|
|
94
89
|
accountAddress: json.accountAddress,
|
|
95
|
-
|
|
96
|
-
|
|
90
|
+
// Flatten orchestrator's per-chain items[] to one entry per chain.
|
|
91
|
+
operations: (json.operations ?? []).map((op) => {
|
|
92
|
+
const item = op.items?.[0] ?? {};
|
|
93
|
+
return { chain: op.chain, ...item };
|
|
94
|
+
}),
|
|
97
95
|
};
|
|
98
96
|
}
|
|
99
97
|
async getHeaders() {
|
|
@@ -118,6 +116,7 @@ export class Orchestrator {
|
|
|
118
116
|
}
|
|
119
117
|
async fetch(url, options) {
|
|
120
118
|
const response = await fetch(url, options);
|
|
119
|
+
const traceId = response.headers?.get?.('x-trace-id') ?? undefined;
|
|
121
120
|
if (!response.ok) {
|
|
122
121
|
let body;
|
|
123
122
|
try {
|
|
@@ -130,10 +129,15 @@ export class Orchestrator {
|
|
|
130
129
|
traceId: '',
|
|
131
130
|
};
|
|
132
131
|
}
|
|
132
|
+
body = { ...body, traceId: traceId ?? body.traceId ?? '' };
|
|
133
133
|
const retryAfter = response.headers?.get?.('retry-after') ?? undefined;
|
|
134
134
|
throw parseErrorEnvelope(body, response.status, retryAfter ?? undefined);
|
|
135
135
|
}
|
|
136
|
-
|
|
136
|
+
const body = await response.json();
|
|
137
|
+
if (body && typeof body === 'object' && !Array.isArray(body)) {
|
|
138
|
+
return { ...body, traceId: traceId ?? body.traceId };
|
|
139
|
+
}
|
|
140
|
+
return body;
|
|
137
141
|
}
|
|
138
142
|
}
|
|
139
143
|
function parseTokenAmountsRecord(record) {
|
|
@@ -146,9 +150,11 @@ function parseChainId(value) {
|
|
|
146
150
|
if (typeof value === 'number')
|
|
147
151
|
return value;
|
|
148
152
|
if (typeof value === 'string') {
|
|
149
|
-
if (value
|
|
153
|
+
if (isCaip2(value))
|
|
150
154
|
return fromCaip2(value);
|
|
151
|
-
|
|
155
|
+
const numeric = Number(value);
|
|
156
|
+
if (Number.isFinite(numeric))
|
|
157
|
+
return numeric;
|
|
152
158
|
}
|
|
153
159
|
throw new OrchestratorError({
|
|
154
160
|
message: `Invalid chain id value: ${String(value)}`,
|
|
@@ -207,16 +213,35 @@ function encodeAuxiliaryFunds(funds) {
|
|
|
207
213
|
]));
|
|
208
214
|
}
|
|
209
215
|
function encodeOptions(options) {
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
+
const wire = { ...options };
|
|
217
|
+
if (options.auxiliaryFunds) {
|
|
218
|
+
wire.auxiliaryFunds = encodeAuxiliaryFunds(options.auxiliaryFunds);
|
|
219
|
+
}
|
|
220
|
+
if (options.settlementLayers) {
|
|
221
|
+
wire.settlementLayers = encodeSettlementLayers(options.settlementLayers);
|
|
222
|
+
}
|
|
223
|
+
return wire;
|
|
224
|
+
}
|
|
225
|
+
// Inversion universe for `{ exclude }` — must mirror the orchestrator's
|
|
226
|
+
// cross-chain settlement layer enum.
|
|
227
|
+
const KNOWN_SETTLEMENT_LAYERS = [
|
|
228
|
+
'ACROSS',
|
|
229
|
+
'ECO',
|
|
230
|
+
'RELAY',
|
|
231
|
+
'OFT',
|
|
232
|
+
'NEAR',
|
|
233
|
+
'RHINO',
|
|
234
|
+
'CCTP',
|
|
235
|
+
];
|
|
236
|
+
export function encodeSettlementLayers(filter) {
|
|
237
|
+
if ('include' in filter)
|
|
238
|
+
return filter.include;
|
|
239
|
+
const excluded = new Set(filter.exclude);
|
|
240
|
+
return KNOWN_SETTLEMENT_LAYERS.filter((layer) => !excluded.has(layer));
|
|
216
241
|
}
|
|
217
242
|
function decodeQuoteResponse(json) {
|
|
218
243
|
const routes = (json.routes ?? []);
|
|
219
|
-
return { routes: routes.map(decodeQuote) };
|
|
244
|
+
return { traceId: json.traceId, routes: routes.map(decodeQuote) };
|
|
220
245
|
}
|
|
221
246
|
function decodeQuote(route) {
|
|
222
247
|
return {
|
|
@@ -229,18 +254,19 @@ function decodeQuote(route) {
|
|
|
229
254
|
tokenRequirements: route.tokenRequirements
|
|
230
255
|
? decodeTokenRequirements(route.tokenRequirements)
|
|
231
256
|
: undefined,
|
|
257
|
+
bridgeFill: decodeBridgeFill(route.bridgeFill),
|
|
232
258
|
};
|
|
233
259
|
}
|
|
260
|
+
// Normalizes CAIP-2 strings to numeric IDs for consistency with BridgeFill decodeCostTokenEntry, and getIntent
|
|
261
|
+
function decodeBridgeFill(bf) {
|
|
262
|
+
if (!bf)
|
|
263
|
+
return undefined;
|
|
264
|
+
return { ...bf, destinationChainId: parseChainId(bf.destinationChainId) };
|
|
265
|
+
}
|
|
234
266
|
function decodeCost(cost) {
|
|
235
267
|
return {
|
|
236
268
|
input: cost.input.map(decodeCostTokenEntry),
|
|
237
269
|
output: cost.output.map(decodeCostTokenEntry),
|
|
238
|
-
feeToken: cost.feeToken
|
|
239
|
-
? {
|
|
240
|
-
chainId: parseChainId(cost.feeToken.chainId),
|
|
241
|
-
tokenAddress: cost.feeToken.tokenAddress,
|
|
242
|
-
}
|
|
243
|
-
: undefined,
|
|
244
270
|
fees: cost.fees,
|
|
245
271
|
};
|
|
246
272
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
declare const PROD_ORCHESTRATOR_URL = "https://v1.orchestrator.rhinestone.dev";
|
|
2
2
|
declare const RHINESTONE_SPOKE_POOL_ADDRESS = "0x000000000060f6e853447881951574cdd0663530";
|
|
3
|
-
declare const SDK_VERSION = "2.0.0-beta.
|
|
3
|
+
declare const SDK_VERSION = "2.0.0-beta.21";
|
|
4
4
|
declare const API_VERSION = "2026-04.blanc";
|
|
5
5
|
export { PROD_ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS, SDK_VERSION, API_VERSION, };
|
|
6
6
|
//# sourceMappingURL=consts.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../orchestrator/consts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,qBAAqB,2CAA2C,CAAA;AACtE,QAAA,MAAM,6BAA6B,+CACW,CAAA;AAE9C,QAAA,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"consts.d.ts","sourceRoot":"","sources":["../../../orchestrator/consts.ts"],"names":[],"mappings":"AAAA,QAAA,MAAM,qBAAqB,2CAA2C,CAAA;AACtE,QAAA,MAAM,6BAA6B,+CACW,CAAA;AAE9C,QAAA,MAAM,WAAW,kBAAkB,CAAA;AACnC,QAAA,MAAM,WAAW,kBAAkB,CAAA;AAEnC,OAAO,EACL,qBAAqB,EACrB,6BAA6B,EAC7B,WAAW,EACX,WAAW,GACZ,CAAA"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const PROD_ORCHESTRATOR_URL = 'https://v1.orchestrator.rhinestone.dev';
|
|
2
2
|
const RHINESTONE_SPOKE_POOL_ADDRESS = '0x000000000060f6e853447881951574cdd0663530';
|
|
3
|
-
const SDK_VERSION = '2.0.0-beta.
|
|
3
|
+
const SDK_VERSION = '2.0.0-beta.21';
|
|
4
4
|
const API_VERSION = '2026-04.blanc';
|
|
5
5
|
export { PROD_ORCHESTRATOR_URL, RHINESTONE_SPOKE_POOL_ADDRESS, SDK_VERSION, API_VERSION, };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Chain } from 'viem';
|
|
2
|
+
import type { Caip2ChainId } from './caip2.js';
|
|
3
|
+
interface NativeCurrency {
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly symbol: string;
|
|
6
|
+
readonly decimals: number;
|
|
7
|
+
}
|
|
8
|
+
type NonEvmAddress = string;
|
|
9
|
+
interface NonEvmChain {
|
|
10
|
+
readonly name: string;
|
|
11
|
+
readonly caip2: Caip2ChainId;
|
|
12
|
+
readonly kind: 'svm' | 'tvm' | 'hypercore';
|
|
13
|
+
readonly nativeCurrency: NativeCurrency;
|
|
14
|
+
readonly testnet?: boolean;
|
|
15
|
+
}
|
|
16
|
+
type DestinationChain = Chain | NonEvmChain;
|
|
17
|
+
declare const solanaMainnet: NonEvmChain;
|
|
18
|
+
declare const tronMainnet: NonEvmChain;
|
|
19
|
+
declare const hyperCoreMainnet: NonEvmChain;
|
|
20
|
+
declare function isNonEvmChain(chain: DestinationChain): chain is NonEvmChain;
|
|
21
|
+
declare function getChainId(chain: DestinationChain): number;
|
|
22
|
+
export type { DestinationChain, NativeCurrency, NonEvmAddress, NonEvmChain };
|
|
23
|
+
export { getChainId, hyperCoreMainnet, isNonEvmChain, solanaMainnet, tronMainnet, };
|
|
24
|
+
//# sourceMappingURL=destinations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"destinations.d.ts","sourceRoot":"","sources":["../../../orchestrator/destinations.ts"],"names":[],"mappings":"AAgBA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AACjC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C,UAAU,cAAc;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;IACvB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAA;CAC1B;AAMD,KAAK,aAAa,GAAG,MAAM,CAAA;AAE3B,UAAU,WAAW;IACnB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,QAAQ,CAAC,KAAK,EAAE,YAAY,CAAA;IAI5B,QAAQ,CAAC,IAAI,EAAE,KAAK,GAAG,KAAK,GAAG,WAAW,CAAA;IAC1C,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAA;IACvC,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAC3B;AAED,KAAK,gBAAgB,GAAG,KAAK,GAAG,WAAW,CAAA;AAE3C,QAAA,MAAM,aAAa,EAAE,WAKpB,CAAA;AAED,QAAA,MAAM,WAAW,EAAE,WAKlB,CAAA;AAQD,QAAA,MAAM,gBAAgB,EAAE,WAKvB,CAAA;AAOD,iBAAS,aAAa,CAAC,KAAK,EAAE,gBAAgB,GAAG,KAAK,IAAI,WAAW,CAEpE;AAKD,iBAAS,UAAU,CAAC,KAAK,EAAE,gBAAgB,GAAG,MAAM,CAEnD;AAED,YAAY,EAAE,gBAAgB,EAAE,cAAc,EAAE,aAAa,EAAE,WAAW,EAAE,CAAA;AAC5E,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,WAAW,GACZ,CAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Public destination chain descriptors for destinations that aren't a plain
|
|
2
|
+
// viem `Chain`: the non-EVM chains (Solana, Tron) plus HyperCore (an EVM-settled
|
|
3
|
+
// virtual L1). Mirrors the minimal shape of viem's `Chain` (name,
|
|
4
|
+
// nativeCurrency) so callers can pass them anywhere a destination chain is
|
|
5
|
+
// expected — `targetChain: solanaMainnet` reads the same as `targetChain:
|
|
6
|
+
// optimism`.
|
|
7
|
+
//
|
|
8
|
+
// The `kind` field discriminates these from viem `Chain` objects; viem
|
|
9
|
+
// chains don't carry a `kind` field, so the `isNonEvmChain` helper
|
|
10
|
+
// narrows a `Chain | NonEvmChain` union structurally.
|
|
11
|
+
//
|
|
12
|
+
// The wire format is the CAIP-2 string. Internally the SDK and the
|
|
13
|
+
// orchestrator also use a synthetic numeric chain id derived from the
|
|
14
|
+
// CAIP-2 mapping, but it is non-standard and intentionally not exposed
|
|
15
|
+
// on this type — use `getChainId` if you need a numeric id.
|
|
16
|
+
import { fromCaip2 } from './caip2.js';
|
|
17
|
+
const solanaMainnet = {
|
|
18
|
+
name: 'Solana',
|
|
19
|
+
caip2: 'solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp',
|
|
20
|
+
kind: 'svm',
|
|
21
|
+
nativeCurrency: { name: 'Solana', symbol: 'SOL', decimals: 9 },
|
|
22
|
+
};
|
|
23
|
+
const tronMainnet = {
|
|
24
|
+
name: 'Tron',
|
|
25
|
+
caip2: 'tron:0x2b6653dc',
|
|
26
|
+
kind: 'tvm',
|
|
27
|
+
nativeCurrency: { name: 'Tron', symbol: 'TRX', decimals: 6 },
|
|
28
|
+
};
|
|
29
|
+
// HyperCore is Hyperliquid's virtual trading L1 (chain id 1337). Unlike Solana
|
|
30
|
+
// and Tron it settles on an EVM chain (HyperEVM, 999), but the deposit is
|
|
31
|
+
// solver-mediated: the orchestrator builds the core-deposit executions and the
|
|
32
|
+
// user signs no destination session, so it belongs with the descriptor-addressed
|
|
33
|
+
// destinations rather than the standard EVM signing path. The CAIP-2 reference
|
|
34
|
+
// is the virtual id; the orchestrator maps 1337 → 999 for settlement.
|
|
35
|
+
const hyperCoreMainnet = {
|
|
36
|
+
name: 'HyperCore',
|
|
37
|
+
caip2: 'eip155:1337',
|
|
38
|
+
kind: 'hypercore',
|
|
39
|
+
nativeCurrency: { name: 'Hyperliquid', symbol: 'HYPE', decimals: 18 },
|
|
40
|
+
};
|
|
41
|
+
// True for any descriptor-addressed destination (Solana, Tron, HyperCore) as
|
|
42
|
+
// opposed to a plain viem `Chain`. viem chains carry no `kind` field, so the
|
|
43
|
+
// presence of `kind` is the structural discriminator — and every such
|
|
44
|
+
// destination is solver-mediated (no user-signed destination session, no
|
|
45
|
+
// destination-side validator), which is what every caller keys off.
|
|
46
|
+
function isNonEvmChain(chain) {
|
|
47
|
+
return 'kind' in chain;
|
|
48
|
+
}
|
|
49
|
+
// Numeric chain id for either chain kind. EVM uses viem's `id`; non-EVM
|
|
50
|
+
// derives the synthetic id from the CAIP-2 string. Used for the wire
|
|
51
|
+
// format and for SDK-internal lookups keyed by chain id.
|
|
52
|
+
function getChainId(chain) {
|
|
53
|
+
return isNonEvmChain(chain) ? fromCaip2(chain.caip2) : chain.id;
|
|
54
|
+
}
|
|
55
|
+
export { getChainId, hyperCoreMainnet, isNonEvmChain, solanaMainnet, tronMainnet, };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type ErrorCode = 'VALIDATION_ERROR' | 'INSUFFICIENT_LIQUIDITY' | 'NOT_FOUND' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'CONFLICT' | 'UNPROCESSABLE_CONTENT' | 'TOO_MANY_REQUESTS' | 'SETTLEMENT_QUOTE_ERROR' | 'SETTLEMENT_EXECUTION_ERROR' | 'EXTERNAL_SERVICE_TIMEOUT' | 'RELAYER_MARKET_UNAVAILABLE' | 'INTERNAL_ERROR';
|
|
1
|
+
type ErrorCode = 'VALIDATION_ERROR' | 'INSUFFICIENT_LIQUIDITY' | 'NOT_FOUND' | 'UNAUTHORIZED' | 'FORBIDDEN' | 'KEY_SCOPE_DENIED' | 'CONFLICT' | 'UNPROCESSABLE_CONTENT' | 'TOO_MANY_REQUESTS' | 'SETTLEMENT_QUOTE_ERROR' | 'SETTLEMENT_EXECUTION_ERROR' | 'EXTERNAL_SERVICE_TIMEOUT' | 'RELAYER_MARKET_UNAVAILABLE' | 'INTERNAL_ERROR';
|
|
2
2
|
interface ValidationIssue {
|
|
3
3
|
message: string;
|
|
4
4
|
context?: Record<string, unknown>;
|
|
@@ -37,7 +37,26 @@ declare class UnauthorizedError extends OrchestratorError {
|
|
|
37
37
|
constructor(params: BaseErrorParams);
|
|
38
38
|
}
|
|
39
39
|
declare class ForbiddenError extends OrchestratorError {
|
|
40
|
-
constructor(params: BaseErrorParams
|
|
40
|
+
constructor(params: BaseErrorParams & {
|
|
41
|
+
code?: ErrorCode;
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Thrown when an API key's scope denies the request.
|
|
46
|
+
*
|
|
47
|
+
* Subclass of `ForbiddenError` carrying the failed `scope` and the
|
|
48
|
+
* `required` / `actual` levels — distinct from a generic 403 so integrators
|
|
49
|
+
* can prompt the user to widen the key's scope rather than rotate it.
|
|
50
|
+
*/
|
|
51
|
+
declare class KeyScopeDeniedError extends ForbiddenError {
|
|
52
|
+
readonly scope: string;
|
|
53
|
+
readonly required: string | boolean;
|
|
54
|
+
readonly actual: string | boolean;
|
|
55
|
+
constructor(params: BaseErrorParams & {
|
|
56
|
+
scope: string;
|
|
57
|
+
required: string | boolean;
|
|
58
|
+
actual: string | boolean;
|
|
59
|
+
});
|
|
41
60
|
}
|
|
42
61
|
declare class ConflictError extends OrchestratorError {
|
|
43
62
|
constructor(params: BaseErrorParams);
|
|
@@ -93,5 +112,5 @@ declare function isValidationError(error: unknown): error is ValidationError;
|
|
|
93
112
|
declare function isAuthError(error: unknown): error is UnauthorizedError | ForbiddenError;
|
|
94
113
|
declare function isRetryable(error: unknown): boolean;
|
|
95
114
|
export type { ErrorCode, ErrorEnvelope, ValidationIssue };
|
|
96
|
-
export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
|
|
115
|
+
export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, KeyScopeDeniedError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
|
|
97
116
|
//# sourceMappingURL=error.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../../orchestrator/error.ts"],"names":[],"mappings":"AAAA,KAAK,SAAS,GACV,kBAAkB,GAClB,wBAAwB,GACxB,WAAW,GACX,cAAc,GACd,WAAW,GACX,UAAU,GACV,uBAAuB,GACvB,mBAAmB,GACnB,wBAAwB,GACxB,4BAA4B,GAC5B,0BAA0B,GAC1B,4BAA4B,GAC5B,gBAAgB,CAAA;AAEpB,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAA;CAClC;AAED,UAAU,eAAe;IACvB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB;AAED,cAAM,iBAAkB,SAAQ,KAAK;IACnC,QAAQ,CAAC,IAAI,EAAE,SAAS,GAAG,SAAS,CAAA;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAA;gBAEhB,MAAM,EAAE,eAAe,GAAG;QAAE,IAAI,CAAC,EAAE,SAAS,GAAG,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SAAS,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAUD,iBAAS,kBAAkB,CACzB,QAAQ,EAAE,aAAa,EACvB,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,MAAM,GAClB,iBAAiB,CAoEnB;AAED,iBAAS,mBAAmB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,iBAAiB,CAEvE;AAED,iBAAS,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,gBAAgB,CAEhE;AAED,iBAAS,iBAAiB,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,eAAe,CAEnE;AAED,iBAAS,WAAW,CAClB,KAAK,EAAE,OAAO,GACb,KAAK,IAAI,iBAAiB,GAAG,cAAc,CAE7C;AAED,iBAAS,WAAW,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAM5C;AAED,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,eAAe,EAAE,CAAA;AACzD,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,0BAA0B,EAC1B,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,yBAAyB,EACzB,gBAAgB,EAChB,oBAAoB,EACpB,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,mBAAmB,EACnB,qBAAqB,EACrB,qBAAqB,GACtB,CAAA"}
|
|
@@ -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 {
|
|
@@ -133,6 +151,18 @@ function parseErrorEnvelope(envelope, statusCode, retryAfter) {
|
|
|
133
151
|
return new UnauthorizedError(base);
|
|
134
152
|
case 'FORBIDDEN':
|
|
135
153
|
return new ForbiddenError(base);
|
|
154
|
+
case 'KEY_SCOPE_DENIED': {
|
|
155
|
+
const detail = Array.isArray(envelope.details)
|
|
156
|
+
? envelope.details[0]
|
|
157
|
+
: undefined;
|
|
158
|
+
const context = (detail?.context ?? {});
|
|
159
|
+
return new KeyScopeDeniedError({
|
|
160
|
+
...base,
|
|
161
|
+
scope: context.scope ?? '',
|
|
162
|
+
required: context.required ?? '',
|
|
163
|
+
actual: context.actual ?? '',
|
|
164
|
+
});
|
|
165
|
+
}
|
|
136
166
|
case 'CONFLICT':
|
|
137
167
|
return new ConflictError(base);
|
|
138
168
|
case 'UNPROCESSABLE_CONTENT':
|
|
@@ -170,4 +200,4 @@ function isRetryable(error) {
|
|
|
170
200
|
error instanceof ExternalServiceTimeoutError ||
|
|
171
201
|
error instanceof RelayerMarketUnavailableError);
|
|
172
202
|
}
|
|
173
|
-
export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, ExternalServiceTimeoutError, RelayerMarketUnavailableError, InternalServerError, UnsupportedChainError, UnsupportedTokenError, };
|
|
203
|
+
export { parseErrorEnvelope, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, OrchestratorError, ValidationError, InsufficientLiquidityError, NotFoundError, UnauthorizedError, ForbiddenError, KeyScopeDeniedError, ConflictError, UnprocessableContentError, RateLimitedError, SettlementQuoteError, SettlementExecutionError, 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, isOrchestratorError, isRateLimited, isRetryable, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, 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,
|
|
7
|
-
import {
|
|
7
|
+
import type { 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,
|
|
10
|
-
export {
|
|
10
|
+
export type { ApprovalRequired, 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, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, 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,
|
|
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,KAAK,gBAAgB,EACrB,gBAAgB,EAChB,aAAa,EACb,KAAK,aAAa,EAClB,KAAK,WAAW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,cAAc,EACd,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,aAAa,EACb,YAAY,EACZ,IAAI,EACJ,WAAW,EACX,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,oBAAoB,EACpB,eAAe,EACf,eAAe,EACf,SAAS,EACT,KAAK,EACL,KAAK,EACL,aAAa,EACb,eAAe,EACf,qBAAqB,EACrB,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,gBAAgB,EAChB,aAAa,EACb,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,uBAAuB,EACvB,oBAAoB,EACpB,6BAA6B,EAC7B,YAAY,EACZ,aAAa,EACb,2BAA2B,EAC3B,cAAc,EACd,0BAA0B,EAC1B,mBAAmB,EACnB,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,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, isOrchestratorError, isRateLimited, isRetryable, isValidationError, KeyScopeDeniedError, NotFoundError, OrchestratorError, RateLimitedError, RelayerMarketUnavailableError, SettlementExecutionError, SettlementQuoteError, 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, SettlementExecutionError, SettlementQuoteError, UnauthorizedError, UnprocessableContentError, UnsupportedChainError, UnsupportedTokenError, ValidationError, getOrchestrator, getWethAddress, getTokenSymbol, isOrchestratorError, isRetryable, isAuthError, isValidationError, isRateLimited, 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, };
|