@glacislabs/stablegenie-zerodelta 4.12.0 → 4.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- import { T as Token, Q as Quote, N as NormalizedOrder, s as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, t as RwaVault, F as FetchQuoteFn, u as SolveResult, O as OrderRequest, C as Compliance, v as BalanceTarget, w as BalanceEntry, x as ApiClient, P as Plan, y as SwapInput, z as PlannedTx, D as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-D8tr1yY1.cjs';
2
- export { G as Address, H as ApiError, A as Availability, I as BLOCK_LABEL_DEFAULT, B as BrokenLane, J as COMPLIANCE_CHECK_ORDER, K as COMPLIANCE_DENY_LABEL, M as CatalogueContext, U as CatalogueInput, c as ComplianceCheck, X as ComplianceCheckId, Y as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Z as DIRECT_CHECK_IDS, _ as DIRECT_SCOPE_NOTE, $ as Destination, a0 as FLOOR_CATEGORIES, a1 as Hex, a2 as LaneAvailabilityState, L as LaneLimit, a3 as PlannedTxKind, a4 as QuoteBlock, a5 as ResolvedConfig, a6 as RouteHealth, a7 as RouteHealthAvailability, a8 as RouteHealthLane, g as RouteLeg, a9 as SCREENING_BUCKETS, aa as ScreenProvider, ab as ScreeningBucket, ac as ScreeningOutcome, ad as TUNABLE_CATEGORIES, ae as TxPlan, V as VerifyResult, W as WalletScreen, af as amountFieldError, ag as apiError, j as assetClassOf, ah as blockLabelFor, ai as brokenLaneFor, k as brokenLaneReason, aj as buildCatalogue, ak as canAttachApiKey, al as categoryLabel, am as classifyQuoteError, l as complianceChecks, an as complianceControlsEvaluated, m as complianceControlsLine, ao as complianceReasonHead, ap as complianceReasonTag, aq as complianceTagOf, n as complianceView, o as counterpartTokens, ar as createApiClient, as as createVerifier, p as destinationAvailability, at as destinationKeys, au as directComplianceFromScreens, av as distinctScreenedWallets, aw as exceedsLaneLimit, ax as executableRoutes, ay as executionChainIds, q as formatJurisdiction, az as hasReachableDestination, aA as hubDeliverableSymbols, r as humanizeComplianceReason, aB as isExecutableBridge, aC as isKnownUnbridgeable, aD as isSourceToken, aE as laneAvailabilityState, aF as laneKey, aG as laneKeys, aH as laneLimitAmount, aI as laneLimitError, aJ as laneLimitFor, aK as laneLimitHint, aL as laneLimitSymbol, aM as limitedLanes, aN as parseAllowedApiBase, aO as productAssets, aP as registryRpc, aQ as resolveApiBase, aR as resolveConfig, aS as screeningOutcomeOf, aT as sourceKeys, aU as suppressedLanes, aV as tokenKey, aW as txMatchesPlan, aX as unattributedComplianceReasons } from '../verify-D8tr1yY1.cjs';
1
+ import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, C as Compliance, S as SanitizedTxEntry, T as Token, Q as Quote, u as PayOption, h as RouteResult, b as Chain, R as Route, a as Catalogue, v as RwaVault, F as FetchQuoteFn, w as SolveResult, O as OrderRequest, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, D as Verifier, f as ExchangeProduct, i as TxHistoryEntry, E as EngineConfig } from '../verify-Y9jZ83T5.cjs';
2
+ export { G as Address, H as ApiError, A as Availability, I as BLOCK_LABEL_DEFAULT, B as BrokenLane, J as COMPLIANCE_CHECK_ORDER, K as COMPLIANCE_DENY_LABEL, M as CatalogueContext, U as CatalogueInput, c as ComplianceCheck, X as ComplianceCheckId, Y as ComplianceDecision, d as ComplianceTone, e as ComplianceView, Z as DIRECT_CHECK_IDS, _ as DIRECT_SCOPE_NOTE, $ as Destination, a0 as FLOOR_CATEGORIES, a1 as Hex, a2 as LaneAvailabilityState, L as LaneLimit, a3 as PlannedTxKind, a4 as QuoteBlock, a5 as ResolvedConfig, a6 as RouteHealth, a7 as RouteHealthAvailability, a8 as RouteHealthLane, g as RouteLeg, a9 as SCREENING_BUCKETS, aa as ScreenProvider, ab as ScreeningBucket, ac as ScreeningOutcome, ad as TUNABLE_CATEGORIES, ae as TxPlan, V as VerifyResult, W as WalletScreen, af as amountFieldError, ag as apiError, j as assetClassOf, ah as blockLabelFor, ai as brokenLaneFor, k as brokenLaneReason, aj as buildCatalogue, ak as canAttachApiKey, al as categoryLabel, am as classifyQuoteError, l as complianceChecks, an as complianceControlsEvaluated, m as complianceControlsLine, ao as complianceReasonHead, ap as complianceReasonTag, aq as complianceTagOf, n as complianceView, o as counterpartTokens, ar as createApiClient, as as createVerifier, p as destinationAvailability, at as destinationKeys, au as directComplianceFromScreens, av as distinctScreenedWallets, aw as exceedsLaneLimit, ax as executableRoutes, ay as executionChainIds, q as formatJurisdiction, az as hasReachableDestination, aA as hubDeliverableSymbols, r as humanizeComplianceReason, aB as isExecutableBridge, aC as isKnownUnbridgeable, aD as isSourceToken, aE as laneAvailabilityState, aF as laneKey, aG as laneKeys, aH as laneLimitAmount, aI as laneLimitError, aJ as laneLimitFor, aK as laneLimitHint, aL as laneLimitSymbol, aM as limitedLanes, aN as parseAllowedApiBase, aO as productAssets, aP as registryRpc, aQ as resolveApiBase, aR as resolveConfig, aS as screeningOutcomeOf, aT as sourceKeys, aU as suppressedLanes, aV as tokenKey, aW as txMatchesPlan, aX as unattributedComplianceReasons } from '../verify-Y9jZ83T5.cjs';
3
3
 
4
4
  /** Default request base for the widget: the same-origin keyless custody proxy (server injects the
5
5
  * ZeroDelta key). A host may override to `/api/v1` + an apiKey for the demo-first fallback path. */
@@ -53,7 +53,408 @@ declare function symbolKey(value: unknown): string;
53
53
  declare function isAddress(value: unknown): boolean;
54
54
  declare function normalizeAddress(value: unknown): string | null;
55
55
  declare function assertAddress(value: unknown, label: string): string;
56
- declare function resolveSwapReceiver(recipient: unknown, payer: unknown): string;
56
+ declare function resolveSwapReceiver(recipient: unknown, payer: unknown, destinationChainId?: number | string): string;
57
+ declare function isChainAddress(chainId: unknown, value: unknown): boolean;
58
+ declare function chainAddressKey(chainId: unknown, value: unknown): string;
59
+ declare function assertChainAddress(chainId: unknown, value: unknown, label: string): string;
60
+
61
+ declare const SOLANA_CHAIN_ID = 1151111081099710;
62
+ declare function isSolanaChainId(value: unknown): boolean;
63
+ declare function base58Encode(bytes: Uint8Array): string;
64
+ /** Invalid alphabet returns null. Leading zero bytes survive both directions. */
65
+ declare function base58Decode(text: string): Uint8Array | null;
66
+ /** Length only: off-curve program derived accounts are valid recipients too. */
67
+ declare function isSolanaAddress(value: unknown): boolean;
68
+ declare function solanaKeyHex(value: string): string | null;
69
+ declare function hexToSolanaKey(value: string): string | null;
70
+ type SolanaBridge = "cctp" | "layerzero";
71
+ type SolanaAssetPin = Readonly<{
72
+ symbol: string;
73
+ decimals: number;
74
+ bridge: SolanaBridge;
75
+ tokenProgram: string;
76
+ }>;
77
+ declare const SOLANA_DESTINATION_ASSETS: Readonly<Record<string, SolanaAssetPin>>;
78
+ declare function solanaDestinationAsset(mint: unknown): Readonly<{
79
+ symbol: string;
80
+ decimals: number;
81
+ bridge: SolanaBridge;
82
+ tokenProgram: string;
83
+ }> | null;
84
+ /** The pinned bridge for a Solana mint. Registry and quote labels are never consulted. */
85
+ declare function solanaBridgeOf(token: {
86
+ symbol: string;
87
+ address?: string;
88
+ }): SolanaBridge;
89
+ declare function sha256(data: Uint8Array): Uint8Array;
90
+ /** Whether 32 bytes decompress to an ed25519 point — the test Solana uses to reject a PDA candidate. */
91
+ declare function isOnEd25519Curve(bytes: Uint8Array): boolean;
92
+ /** Solana's findProgramAddress: the first off-curve sha256(seeds ‖ bump ‖ program ‖ marker), bump 255 down to 1 like the SDK. */
93
+ declare function findProgramAddress(seeds: Uint8Array[], programId: string): Uint8Array;
94
+ /** The associated token account of `owner` for `mint` under `tokenProgram`. */
95
+ declare function associatedTokenAddress(owner: string, mint: string, tokenProgram: string): string;
96
+ /**
97
+ * The 32 bytes the order must deliver to, derived HERE from the chosen recipient and the pinned asset —
98
+ * never read back from the quote. CCTP mints to the recipient's associated token account; a LayerZero
99
+ * OFT delivers to the wallet itself. Returned as lowercase 0x hex, the form the calldata carries.
100
+ */
101
+ declare function expectedSolanaDelivery(recipient: string, mint: string): string;
102
+ declare function checkSolanaReceiver(request: {
103
+ destinationReceiver?: string;
104
+ destinationReceiverOwner?: string;
105
+ destinationReceiverBase58?: string;
106
+ }, intended: string, mint: string): void;
107
+
108
+ type SolanaRpc = <T = any>(method: string, params: unknown[]) => Promise<T>;
109
+ interface SolanaTransaction {
110
+ actionType: "setup" | "buffer" | "write" | "submit";
111
+ transaction: string;
112
+ instructions?: string[];
113
+ blockhash?: string;
114
+ lastValidBlockHeight?: number;
115
+ buildData?: {
116
+ salt: string;
117
+ messageSentEventData: string;
118
+ };
119
+ }
120
+ interface ExpectedOrder {
121
+ program: string;
122
+ signer: string;
123
+ mint: string;
124
+ owner: string;
125
+ askToken: string;
126
+ minAskTokenAmount: string;
127
+ maxAskTokenAmount: string;
128
+ bidTokenAmount: string;
129
+ destinationReceiver: string;
130
+ destinationChainId: string;
131
+ executionChainId: string;
132
+ deadline: string;
133
+ partnerId: string | null;
134
+ nextOrders: NormalizedOrder[];
135
+ }
136
+ declare function bytesEqual(a: Uint8Array, b: Uint8Array): boolean;
137
+ declare function hexBytes(hex: string): Uint8Array;
138
+ declare function solanaKeyBytes(key: string): Uint8Array;
139
+ declare function base64Decode(text: string): Uint8Array;
140
+ declare function base64Encode(bytes: Uint8Array): string;
141
+ interface ParsedSolanaTransaction {
142
+ bytes: Uint8Array;
143
+ messageOffset: number;
144
+ blockhashOffset: number;
145
+ version: "legacy" | 0;
146
+ requiredSignatures: number;
147
+ signatureOffset: number;
148
+ staticKeys: string[];
149
+ instructions: {
150
+ programIdIndex: number;
151
+ accounts: number[];
152
+ data: Uint8Array;
153
+ }[];
154
+ lookups: {
155
+ address: string;
156
+ writable: number[];
157
+ readonly: number[];
158
+ }[];
159
+ }
160
+ /** Parse offsets without recompiling: every non-signature byte survives round trips exactly. */
161
+ declare function parseSolanaTransaction(input: Uint8Array): ParsedSolanaTransaction;
162
+ declare function serializeSolanaTransaction(tx: ParsedSolanaTransaction): Uint8Array;
163
+ declare function overwriteBlockhash(input: Uint8Array, blockhash: string): Uint8Array;
164
+ declare function placeSignature(input: Uint8Array, publicKey: string, signature: Uint8Array): Uint8Array;
165
+ declare function assertWalletMessage(original: Uint8Array, signed: Uint8Array): void;
166
+ declare const SUBMIT_ORDER_DISCRIMINATOR: readonly [230, 150, 200, 53, 92, 208, 109, 108];
167
+ declare function isSubmitOrder(data: Uint8Array): boolean;
168
+ interface SolanaSubmitOrder {
169
+ owner: Uint8Array;
170
+ askToken: Uint8Array;
171
+ askTokenAmount: bigint;
172
+ bidTokenAmount: bigint;
173
+ destinationReceiver: Uint8Array;
174
+ destinationChainId: bigint;
175
+ executionChainId: bigint;
176
+ deadline: bigint;
177
+ partnerId: Uint8Array | null;
178
+ }
179
+ declare function decodeSolanaSubmitOrder(data: Uint8Array): SolanaSubmitOrder;
180
+ declare function verifySolanaSubmit(p: SolanaSubmitOrder, e: ExpectedOrder): void;
181
+ declare function isPreparationInstruction(data: Uint8Array): boolean;
182
+ declare function verifySolanaTransaction(tx: ParsedSolanaTransaction, expected: ExpectedOrder, keys: readonly string[], mustSubmit: boolean): string | null;
183
+ declare function parseAddressLookupTable(data: Uint8Array): string[];
184
+ interface SolanaRpcAccount {
185
+ owner: string;
186
+ data: [string, string];
187
+ lamports?: number;
188
+ }
189
+ declare function resolveSolanaKeys(tx: ParsedSolanaTransaction, rpc: SolanaRpc): Promise<string[]>;
190
+ /** Strip the submit selector/partner head, replacing its array offset with abi.encode's 0x20. */
191
+ declare function encodeNextSolanaOrders(legs: NormalizedOrder[]): Uint8Array;
192
+ declare function checkSolanaRouteBuffer(account: SolanaRpcAccount | null, expected: ExpectedOrder): void;
193
+ declare function checkSolanaProgram(gateway?: string, pinned?: string, registry?: string): string;
194
+ declare function checkSolanaPlan(txs: readonly SolanaTransaction[]): void;
195
+ declare function deriveSolanaEvent(signer: string, salt: string): Promise<{
196
+ seed: Uint8Array;
197
+ publicKey: string;
198
+ }>;
199
+ declare function cosignSolanaEvent(bytes: Uint8Array, signer: string, build: NonNullable<SolanaTransaction["buildData"]>): Promise<Uint8Array>;
200
+ declare function pollSolanaConfirmation(rpc: SolanaRpc, signature: string): Promise<void>;
201
+
202
+ interface ValidatedSwap {
203
+ fromChainId: number;
204
+ toChainId: number;
205
+ fromToken: string;
206
+ toToken: string;
207
+ amountIn: string;
208
+ }
209
+ declare function validateSwap(swap?: Partial<SwapInput>): ValidatedSwap;
210
+ interface SwapPreview {
211
+ receive: string;
212
+ receiveRaw: string;
213
+ fromAmount: string;
214
+ fromToken: string;
215
+ toToken: string;
216
+ bridge: string;
217
+ feeBps: number;
218
+ estimatedDuration: number;
219
+ /**
220
+ * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
221
+ * purchase is routed via) — or null for a single-order route. Display only: the executed plan
222
+ * re-derives every leg and asserts them continuous before anything is signed.
223
+ */
224
+ via: string | null;
225
+ /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
226
+ * widget's buffer. "0" when the route charges none. Display only. */
227
+ nativeFeeRaw: string;
228
+ }
229
+ declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
230
+ declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
231
+ chainId?: number;
232
+ }): Promise<Plan>;
233
+
234
+ /**
235
+ * The ZeroDelta Solana program every Solana-source transaction must target. Read on-chain 2026-10-27:
236
+ * owned by BPFLoaderUpgradeab1e11111111111111111111111, executable. Never taken from an API response.
237
+ */
238
+ declare const CANONICAL_SOLANA_PROGRAM = "zd1E5feCJLNYaPPsBAYkCPMKGVnipYf8God9h917W33";
239
+ interface SolanaSourceInput {
240
+ fromChainId?: number;
241
+ toChainId: number;
242
+ fromToken: string;
243
+ toToken: string;
244
+ amountIn: string;
245
+ /** The connected EVM wallet owns cancellation and refunds. */
246
+ owner: string;
247
+ /** The connected Solana wallet pays and signs. */
248
+ sender: string;
249
+ recipient?: string;
250
+ deadlineSpanSeconds?: number;
251
+ slippageBps?: number;
252
+ /** Destination raw units. Preserved across re-quotes. */
253
+ minReceiveRaw?: string;
254
+ pinnedProgram?: string;
255
+ /** An optional simulation result; an unknown SOL balance never blocks a payment. */
256
+ cost?: SolanaOrderCost;
257
+ }
258
+ interface NativeSolanaQuoteRequest {
259
+ inputChain: number;
260
+ outputChain: number;
261
+ inputToken: string;
262
+ outputToken: string;
263
+ inputAmount: string;
264
+ owners: {
265
+ evm: string;
266
+ };
267
+ destinationWallet: string;
268
+ sender: string;
269
+ deadline: string;
270
+ }
271
+ interface NativeSolanaOption {
272
+ orderRequests: NormalizedOrder[];
273
+ txData: SolanaTransaction[];
274
+ escrowAddress?: string;
275
+ executionChainId?: string | number;
276
+ finalAmount: string;
277
+ bridge?: string;
278
+ feeBps?: number;
279
+ estimatedTimeSec?: number;
280
+ gasCostSource?: string;
281
+ partnerId?: unknown;
282
+ [key: string]: unknown;
283
+ }
284
+ interface NativeSolanaQuote {
285
+ options: NativeSolanaOption[];
286
+ expiresAt?: string;
287
+ compliance?: unknown;
288
+ complianceStatus?: string;
289
+ complianceDecision?: unknown;
290
+ partnerId?: unknown;
291
+ [key: string]: unknown;
292
+ }
293
+ interface SolanaSourcePreview extends SwapPreview {
294
+ request: NativeSolanaQuoteRequest;
295
+ quote: NativeSolanaQuote;
296
+ option: NativeSolanaOption;
297
+ txData: SolanaTransaction[];
298
+ }
299
+ interface SolanaSourcePlan {
300
+ preview: SolanaSourcePreview;
301
+ expected: ExpectedOrder;
302
+ txData: SolanaTransaction[];
303
+ }
304
+ interface SolanaSigner {
305
+ publicKey: string;
306
+ signTransaction(bytes: Uint8Array): Promise<Uint8Array>;
307
+ }
308
+ type SolanaProgressStage = "idle" | "preparing" | "signing" | "sending" | "ready" | "sent" | "failed";
309
+ interface SolanaProgress {
310
+ stage: SolanaProgressStage;
311
+ index: number;
312
+ total: number;
313
+ signatures: string[];
314
+ inFlight: {
315
+ signature: string;
316
+ at: number;
317
+ } | null;
318
+ }
319
+ declare function quoteSolanaSource(api: ApiClient, input: SolanaSourceInput): Promise<SolanaSourcePreview>;
320
+ /**
321
+ * Price only, before any wallet is connected (the ZeroDelta app quotes the form the same way): the native
322
+ * body without `sender`, `owners` or `destinationWallet`. Display-only — it carries no transactions and
323
+ * nothing built from it is ever signed; the order is always rebuilt by buildSolanaSourcePlan.
324
+ */
325
+ declare function previewSolanaSource(api: ApiClient, input: Pick<SolanaSourceInput, "toChainId" | "fromToken" | "toToken" | "amountIn">): Promise<SwapPreview>;
326
+ /**
327
+ * The gateway's compliance decision on a native (Solana-source) quote, in the shape the panel reads.
328
+ * The native answer carries `compliance` as a bare word ("screened") and the decision object in
329
+ * `complianceDecision` (prod, 2026-10-28), where an EVM quote carries the object in `compliance`.
330
+ * Reading only `compliance` showed "returned no compliance decision" for every Solana payment.
331
+ */
332
+ declare function solanaQuoteCompliance(quote: Pick<NativeSolanaQuote, "compliance" | "complianceDecision"> | null | undefined): Compliance | undefined;
333
+ declare function buildSolanaSourcePlan(api: ApiClient, input: SolanaSourceInput, quoted?: SolanaSourcePreview): Promise<SolanaSourcePlan>;
334
+ declare function createSolanaRpc(api: ApiClient): SolanaRpc;
335
+ declare class SolanaSendError extends Error {
336
+ readonly signature: string;
337
+ readonly sentAt: number;
338
+ constructor(message: string, signature: string, sentAt: number);
339
+ }
340
+ declare function executeSolanaPlan(input: {
341
+ plan: SolanaSourcePlan;
342
+ signer: SolanaSigner;
343
+ rpc: SolanaRpc;
344
+ onProgress?: (progress: SolanaProgress) => void;
345
+ }): Promise<string>;
346
+ /**
347
+ * The ZeroDelta app's two-click flow: the first call signs every PREPARATION transaction back to back
348
+ * (setup, buffer, write — one wallet prompt each) and stops before the submit, answering `prepared`;
349
+ * the next call signs the submit on its own. A plan with nothing to prepare submits on the first call.
350
+ * Same plan, same guards, same in-flight lock as executeSolanaPlan; confirmed steps are never re-signed.
351
+ */
352
+ declare function executeSolanaPlanStaged(input: {
353
+ plan: SolanaSourcePlan;
354
+ signer: SolanaSigner;
355
+ rpc: SolanaRpc;
356
+ onProgress?: (progress: SolanaProgress) => void;
357
+ }): Promise<{
358
+ status: "prepared";
359
+ } | {
360
+ status: "sent";
361
+ signature: string;
362
+ }>;
363
+ /** Whether a plan still has preparation to sign before its submit. */
364
+ declare function solanaPlanNeedsPreparation(plan: SolanaSourcePlan): boolean;
365
+ declare function readSolanaBalance(rpc: SolanaRpc, owner: string, mint: string): Promise<bigint | undefined>;
366
+ interface SolanaOrderCost {
367
+ lamports: number;
368
+ balanceLamports: number;
369
+ sufficient: boolean;
370
+ }
371
+ /** `Transfer: insufficient lamports 5179664, need 5913120` → 5913120, from a simulation's logs. */
372
+ declare function solanaLamportShortfall(logs: unknown): number | null;
373
+ /** The words a payer can act on, for a send the cluster refused because the wallet ran out of SOL. */
374
+ declare const SOL_SHORTFALL_MESSAGE = "Not enough SOL in this wallet for the Solana network fee and account rent. Add a little SOL and try again.";
375
+ declare function simulateSolanaCost(rpc: SolanaRpc, plan: SolanaSourcePlan): Promise<SolanaOrderCost>;
376
+
377
+ /** How many orders one history read asks for — what the panel shows. */
378
+ declare const WALLET_HISTORY_LIMIT = 50;
379
+ /** Hex folds case (EIP-55 is a checksum); base58 is compared exactly — lowercasing it changes the key. */
380
+ declare function historyKey(value: string): string;
381
+ /**
382
+ * One gateway order as a history entry. The row is untrusted input: every field is bounded like a
383
+ * stored entry, symbols and decimals come from the registry by (chain, address) — a Solana-source
384
+ * row carries neither — and a row without a well-formed hash is dropped.
385
+ */
386
+ declare function historyEntryFromOrder(raw: unknown, tokens: readonly Token[]): SanitizedTxEntry | null;
387
+ /**
388
+ * The orders the gateway holds for each connected wallet, newest first. Never rejects: an unreadable
389
+ * history (old proxy without the list, offline, 401) is `null` and the panel keeps its local entries.
390
+ *
391
+ * ⚠️ Every row must name the wallet it was asked for. A proxy that drops the `wallet` filter gets the
392
+ * gateway's UNFILTERED list — every order the key ever priced, other people's included — and without
393
+ * this check the panel would show them as the visitor's own.
394
+ *
395
+ * The gateway indexes an order by its EVM owner (prod, 2026-10-28): an order paid from Solana is under
396
+ * the EVM wallet that owns it, and a Solana address on its own lists nothing today. It is asked anyway,
397
+ * so the panel follows the gateway the day it indexes the paying wallet too.
398
+ */
399
+ declare function fetchWalletHistory(api: ApiClient, wallets: readonly string[]): Promise<SanitizedTxEntry[] | null>;
400
+ /**
401
+ * Local entries and the gateway's, one row per order, newest first. A local entry keeps what it
402
+ * recorded (the kind, the amounts the card showed, the legs) and takes the gateway's delivery; an
403
+ * order only the gateway knows is added; one the gateway has not indexed yet stays as recorded.
404
+ */
405
+ declare function mergeHistory(local: readonly SanitizedTxEntry[], remote: readonly SanitizedTxEntry[] | null, limit?: number): SanitizedTxEntry[];
406
+
407
+ /**
408
+ * Where ONE order is on its journey, as the gateway's tracker reports it (`GET /transactions/{hash}`):
409
+ * `submitted → arrived → filled → delivered` (the dapp's step names). A mined source transaction is
410
+ * only the first step — the destination has received nothing yet — so the card must not say
411
+ * "Confirmed" there and stop (reported 2026-10-27: USDT Arbitrum → USDC Solana read "Confirmed"
412
+ * while LayerZero still had the message in flight).
413
+ *
414
+ * Display only. Nothing here gates a signature, and an unreadable tracker is "not known", never a
415
+ * failure: the order is on-chain either way. "Delivered" is the gateway's word, not a proof the
416
+ * widget checked on the destination chain.
417
+ */
418
+ /** `unavailable`: the tracker never answered for this order (a 404, or a proxy without the route). */
419
+ type DeliveryPhase = "tracking" | "unavailable" | "in-progress" | "attention" | "delivered" | "failed";
420
+ interface DeliveryStep {
421
+ name: string;
422
+ done: boolean;
423
+ }
424
+ interface DeliveryStatus {
425
+ phase: DeliveryPhase;
426
+ /** The gateway's word for the user's journey (`pending`, `fill_failed`…), or "" before it answers. */
427
+ status: string;
428
+ steps: DeliveryStep[];
429
+ }
430
+ declare const TRACKING: DeliveryStatus;
431
+ /**
432
+ * Read the tracker's answer into a phase. Anything unexpected reads as "tracking", never as done.
433
+ *
434
+ * ⚠️ A CHAINED order (the RWA two-leg buy) reports `status: "delivered"` as soon as leg 1 parks the
435
+ * connector in the destination escrow; the user's own outcome is `journeyStatus` (zd-dapp
436
+ * `lib/types.ts`: "render journeyStatus, act on status"). Prod on 2026-10-28 held chained orders
437
+ * with `status: "delivered"` and `journeyStatus: "cancelled"`, which read "Delivered" here before.
438
+ * A chained order with no `journeyStatus` is never reported delivered.
439
+ */
440
+ declare function normalizeDelivery(raw: unknown): DeliveryStatus;
441
+ /** One read of the tracker. A 404 (not indexed yet), a timeout or a malformed body is "tracking". */
442
+ declare function fetchDelivery(api: ApiClient, hash: string): Promise<DeliveryStatus>;
443
+
444
+ /**
445
+ * The precision of the final order's `askTokenAmount`: the deployment of the destination asset on the
446
+ * chain that EXECUTES that order (USDe asks on Ethereum in 18 decimals while delivering 9 on Solana).
447
+ *
448
+ * Nothing here reads `quote.isDirect`, and a missing execution-chain row is refused, never filled with
449
+ * the destination's precision: both let a hostile quote shrink the signed minimum by 10^12 while the
450
+ * card displayed the full amount (security review 2026-10-27). The execution chain is the final
451
+ * order's own field — the one that is encoded — never the quote's top-level echo.
452
+ */
453
+ declare function askTokenDecimals(quote: Quote, tokens: readonly Token[], _from: {
454
+ decimals: number;
455
+ }, to: Token): number;
456
+ /** Compare in the finer precision without truncation on either side. */
457
+ declare function askCovers(ask: bigint, final: bigint, askDecimals: number, finalDecimals: number): boolean;
57
458
 
58
459
  declare function assetDecimals(token: Partial<Token> | undefined | null): number;
59
460
  declare function normalizeDecimalText(value: unknown): string;
@@ -102,7 +503,7 @@ interface DecodedSubmitOrder {
102
503
  /**
103
504
  * Strict inverse of {@link encodeSubmitOrder}, for the pre-sign validator. Returns `null` on ANY
104
505
  * deviation from the exact layout the engine produces — wrong selector, a non-canonical offset,
105
- * a `bytes` member that is not a 20-byte address, trailing bytes — so a tampered plan cannot be
506
+ * a `bytes` member that is not a 20- or 32-byte key, trailing bytes — so a tampered plan cannot be
106
507
  * "close enough". It deliberately decodes only what this widget signs, not the general ABI.
107
508
  */
108
509
  declare function decodeSubmitOrderCalldata(data: string): DecodedSubmitOrder | null;
@@ -321,8 +722,9 @@ interface AssertQuoteArgs {
321
722
  };
322
723
  payer: string;
323
724
  result: SolveResult;
725
+ tokens?: readonly Token[];
324
726
  }
325
- declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
727
+ declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result, tokens }: AssertQuoteArgs): void;
326
728
 
327
729
  /**
328
730
  * The `partnerId` word for this quote's `submitOrder`.
@@ -393,38 +795,6 @@ declare function quotePayOption(api: ApiClient, request: PayRequest, payer: stri
393
795
  address: string;
394
796
  }, wallet?: PaymentWalletContext): Promise<RouteResult>;
395
797
 
396
- interface ValidatedSwap {
397
- fromChainId: number;
398
- toChainId: number;
399
- fromToken: string;
400
- toToken: string;
401
- amountIn: string;
402
- }
403
- declare function validateSwap(swap?: Partial<SwapInput>): ValidatedSwap;
404
- interface SwapPreview {
405
- receive: string;
406
- receiveRaw: string;
407
- fromAmount: string;
408
- fromToken: string;
409
- toToken: string;
410
- bridge: string;
411
- feeBps: number;
412
- estimatedDuration: number;
413
- /**
414
- * What a CHAINED order passes through — leg 1's ask, named from the registry (the USDC a vault
415
- * purchase is routed via) — or null for a single-order route. Display only: the executed plan
416
- * re-derives every leg and asserts them continuous before anything is signed.
417
- */
418
- via: string | null;
419
- /** The quote's `gasCostSource` in wei — the native fee a LayerZero leg attaches, before the
420
- * widget's buffer. "0" when the route charges none. Display only. */
421
- nativeFeeRaw: string;
422
- }
423
- declare function quoteSwapPreview(api: ApiClient, swap: SwapInput, owner?: string): Promise<SwapPreview>;
424
- declare function buildSwapPlan(api: ApiClient, swap: SwapInput, payer: string, wallet?: {
425
- chainId?: number;
426
- }): Promise<Plan>;
427
-
428
798
  declare function isHexAddress(value: unknown): boolean;
429
799
  declare function isHexData(value: unknown): boolean;
430
800
  declare function isHexQuantity(value: unknown): boolean;
@@ -524,10 +894,30 @@ declare const stableGenieIntentSchema: {
524
894
  readonly type: "object";
525
895
  readonly additionalProperties: false;
526
896
  readonly required: readonly ["address", "chainId", "asset", "amount"];
897
+ readonly oneOf: readonly [{
898
+ readonly properties: {
899
+ readonly chainId: {
900
+ readonly const: 1151111081099710;
901
+ };
902
+ readonly address: {
903
+ readonly pattern: "^[1-9A-HJ-NP-Za-km-z]{32,44}$";
904
+ };
905
+ };
906
+ }, {
907
+ readonly properties: {
908
+ readonly chainId: {
909
+ readonly not: {
910
+ readonly const: 1151111081099710;
911
+ };
912
+ };
913
+ readonly address: {
914
+ readonly pattern: "^0x[a-fA-F0-9]{40}$";
915
+ };
916
+ };
917
+ }];
527
918
  readonly properties: {
528
919
  readonly address: {
529
920
  readonly type: "string";
530
- readonly pattern: "^0x[a-fA-F0-9]{40}$";
531
921
  };
532
922
  readonly chainId: {
533
923
  readonly type: "integer";
@@ -595,7 +985,19 @@ interface Engine {
595
985
  * Never rejects: a failed read yields a catalogue with `ready: false`, which callers must treat as
596
986
  * "not known yet" rather than "nothing is supported".
597
987
  */
598
- fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct) => Promise<Catalogue>;
988
+ fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct, options?: {
989
+ solanaSources?: boolean;
990
+ }) => Promise<Catalogue>;
991
+ /** Price a Solana source before any wallet is connected. Display only; nothing built from it is signed. */
992
+ previewSolanaSource: (input: Parameters<typeof previewSolanaSource>[1]) => Promise<SwapPreview>;
993
+ /** Where an order is on its journey, by its source transaction hash. Display only; never rejects. */
994
+ trackDelivery: (hash: string) => Promise<DeliveryStatus>;
995
+ /** The gateway's orders for these wallets (EVM and/or Solana), newest first; null when unreadable. */
996
+ fetchWalletHistory: (wallets: readonly string[]) => Promise<SanitizedTxEntry[] | null>;
997
+ /** The two-click flow: preparation, then the submit on its own click. */
998
+ executeSolanaPlanStaged: (input: Omit<Parameters<typeof executeSolanaPlanStaged>[0], "rpc"> & {
999
+ rpc?: Parameters<typeof executeSolanaPlanStaged>[0]["rpc"];
1000
+ }) => ReturnType<typeof executeSolanaPlanStaged>;
599
1001
  fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
600
1002
  /** Price one funding option a plan left unquoted (`Plan.unquotedOptions`) — see core/plan.ts. */
601
1003
  quotePayOption: (request: PayRequest, payer: string, option: {
@@ -606,6 +1008,13 @@ interface Engine {
606
1008
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
607
1009
  chainId?: number;
608
1010
  }) => Promise<Plan>;
1011
+ quoteSolanaSource: (input: SolanaSourceInput) => Promise<SolanaSourcePreview>;
1012
+ buildSolanaSourcePlan: (input: SolanaSourceInput, preview?: SolanaSourcePreview) => Promise<SolanaSourcePlan>;
1013
+ executeSolanaPlan: (input: Omit<Parameters<typeof executeSolanaPlan>[0], "rpc"> & {
1014
+ rpc?: Parameters<typeof executeSolanaPlan>[0]["rpc"];
1015
+ }) => Promise<string>;
1016
+ readSolanaBalance: (owner: string, mint: string) => Promise<bigint | undefined>;
1017
+ simulateSolanaCost: (plan: SolanaSourcePlan) => ReturnType<typeof simulateSolanaCost>;
609
1018
  payerNonceBaseline: Verifier["payerNonceBaseline"];
610
1019
  verifySubmittedTx: Verifier["verifySubmittedTx"];
611
1020
  readBalances: Verifier["readBalances"];
@@ -620,4 +1029,4 @@ interface Engine {
620
1029
  /** Create an engine bound to a config. Its 60s registry cache is shared with every engine of the same base and key (api.ts › registryCacheFor). */
621
1030
  declare function createEngine(config?: EngineConfig): Engine;
622
1031
 
623
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, FetchQuoteFn, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, SCREEN_CACHE_TTL_MS, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, foldTicker, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quotePartnerId, quotePayOption, quoteSwapPreview, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, withVaultArtwork };
1032
+ export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, BalanceEntry, type BalanceReader, BalanceTarget, type BuildPayOptionsArgs, type BuildRouteArgs, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, CANONICAL_SOLANA_PROGRAM, CHAIN_DISPLAY_NAMES, Catalogue, Chain, Compliance, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, type DeliveryPhase, type DeliveryStatus, type DeliveryStep, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, EXECUTABLE_STABLE_ASSETS, type Engine, EngineConfig, ExchangeProduct, type ExpectedOrder, FetchQuoteFn, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, MAX_UINT64, NO_PARTNER_ID, type NativeFeeCheck, type NativeSolanaOption, type NativeSolanaQuote, type NativeSolanaQuoteRequest, NormalizedOrder, OrderRequest, PREVIEW_OWNER, type ParsedSolanaTransaction, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, RwaVault, SAME_CLASS_STABLE, SCREEN_CACHE_TTL_MS, SOLANA_CHAIN_ID, SOLANA_DESTINATION_ASSETS, SOL_SHORTFALL_MESSAGE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, STABLE_ASSETS, SUBMIT_ORDER_DISCRIMINATOR, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolanaBridge, type SolanaOrderCost, type SolanaProgress, type SolanaProgressStage, type SolanaRpc, type SolanaRpcAccount, SolanaSendError, type SolanaSigner, type SolanaSourceInput, type SolanaSourcePlan, type SolanaSourcePreview, type SolanaSubmitOrder, type SolanaTransaction, type SolveArgs, SolveResult, SwapInput, type SwapPreview, TRACKING, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, WALLET_HISTORY_LIMIT, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, askCovers, askTokenDecimals, assertAddress, assertChainAddress, assertQuoteMatchesSelection, assertWalletMessage, assetDecimals, associatedTokenAddress, base58Decode, base58Encode, base64Decode, base64Encode, buildPayOptions, buildRoute, buildSolanaSourcePlan, buildSwapPlan, bytes32Word, bytesEqual, bytesPayload, chainAddressKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, checkSolanaPlan as checkPlan, checkSolanaPlan, checkSolanaProgram, checkSolanaReceiver, checkSolanaRouteBuffer, cosignSolanaEvent, createEngine, createSolanaRpc, decodeSolanaSubmitOrder, decodeSolanaSubmitOrder as decodeSubmitOrder, decodeSubmitOrderCalldata, deriveSolanaEvent, encodeAllowance, encodeApprove, encodeBalanceOf, encodeNextSolanaOrders, encodeSubmitOrder, encodeTransfer, executeSolanaPlan, executeSolanaPlanStaged, expectedSolanaDelivery, fetchDelivery, fetchPaymentPlan, fetchWalletHistory, finalOf, findProgramAddress, findToken, foldTicker, formatNative, formatUnits, hexBytes, hexToSolanaKey, historyEntryFromOrder, historyKey, isAddress, isChainAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSolanaAddress, isSolanaChainId, isSubmitOrder, maxDeadlineSeconds, maxNativeFeeWei, mergeHistory, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeDelivery, normalizeOrderRequest, normalizeOrderRequests, overwriteBlockhash, parseAddressLookupTable, parseSolanaTransaction, parseUnitsDecimal, placeSignature, planErrorSummary, planMsgValueHex, pollSolanaConfirmation, previewSolanaSource, quotePartnerId, quotePayOption, quoteSolanaSource, quoteSwapPreview, readSolanaBalance, recommendedDeadlineSeconds, requiresNativeBridgeFee, resolveSolanaKeys, resolveSwapReceiver, resolveVaultIcon, routeNativeValue, safeTicker, scaleDecimals, serializeSolanaTransaction, sha256, simulateSolanaCost, solanaBridgeOf, solanaDestinationAsset, solanaKeyBytes, solanaKeyHex, solanaLamportShortfall, solanaPlanNeedsPreparation, solanaQuoteCompliance, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, verifySolanaSubmit as verifySubmit, verifySolanaTransaction as verifyTransaction, withVaultArtwork };