@glacislabs/stablegenie-zerodelta 4.12.0 → 4.13.0
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/LICENSE +21 -21
- package/README.md +223 -223
- package/dist/{chunk-A7ADZJXA.js → chunk-52MY5D3D.js} +1232 -202
- package/dist/{chunk-MA2VYFG3.js → chunk-BYAKXZ5E.js} +756 -54
- package/dist/core/index.cjs +1880 -214
- package/dist/core/index.d.cts +367 -40
- package/dist/core/index.d.ts +367 -40
- package/dist/core/index.js +1 -1
- package/dist/ed25519-FZW4JEOV.js +526 -0
- package/dist/ed25519-GAMEXARB.js +11 -0
- package/dist/index.cjs +2678 -377
- package/dist/index.d.cts +96 -4
- package/dist/index.d.ts +96 -4
- package/dist/index.js +2 -2
- package/dist/{mount-xruGixNZ.d.cts → mount-BR3wWmjt.d.cts} +1 -1
- package/dist/{mount-hxb3zioQ.d.ts → mount-bKSKIGmW.d.ts} +1 -1
- package/dist/mount.cjs +2669 -375
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +12 -9
- package/dist/{verify-D8tr1yY1.d.cts → verify-DdSA23GJ.d.cts} +78 -68
- package/dist/{verify-D8tr1yY1.d.ts → verify-DdSA23GJ.d.ts} +78 -68
- package/package.json +134 -133
package/dist/core/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
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-
|
|
1
|
+
import { N as NormalizedOrder, s as ApiClient, t as SwapInput, P as Plan, Q as Quote, T as Token, 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, C as Compliance, x as BalanceTarget, y as BalanceEntry, z as PlannedTx, D as Verifier, f as ExchangeProduct, i as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-DdSA23GJ.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-DdSA23GJ.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,330 @@ 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
|
+
declare function buildSolanaSourcePlan(api: ApiClient, input: SolanaSourceInput, quoted?: SolanaSourcePreview): Promise<SolanaSourcePlan>;
|
|
327
|
+
declare function createSolanaRpc(api: ApiClient): SolanaRpc;
|
|
328
|
+
declare class SolanaSendError extends Error {
|
|
329
|
+
readonly signature: string;
|
|
330
|
+
readonly sentAt: number;
|
|
331
|
+
constructor(message: string, signature: string, sentAt: number);
|
|
332
|
+
}
|
|
333
|
+
declare function executeSolanaPlan(input: {
|
|
334
|
+
plan: SolanaSourcePlan;
|
|
335
|
+
signer: SolanaSigner;
|
|
336
|
+
rpc: SolanaRpc;
|
|
337
|
+
onProgress?: (progress: SolanaProgress) => void;
|
|
338
|
+
}): Promise<string>;
|
|
339
|
+
/**
|
|
340
|
+
* The ZeroDelta app's two-click flow: the first call signs every PREPARATION transaction back to back
|
|
341
|
+
* (setup, buffer, write — one wallet prompt each) and stops before the submit, answering `prepared`;
|
|
342
|
+
* the next call signs the submit on its own. A plan with nothing to prepare submits on the first call.
|
|
343
|
+
* Same plan, same guards, same in-flight lock as executeSolanaPlan; confirmed steps are never re-signed.
|
|
344
|
+
*/
|
|
345
|
+
declare function executeSolanaPlanStaged(input: {
|
|
346
|
+
plan: SolanaSourcePlan;
|
|
347
|
+
signer: SolanaSigner;
|
|
348
|
+
rpc: SolanaRpc;
|
|
349
|
+
onProgress?: (progress: SolanaProgress) => void;
|
|
350
|
+
}): Promise<{
|
|
351
|
+
status: "prepared";
|
|
352
|
+
} | {
|
|
353
|
+
status: "sent";
|
|
354
|
+
signature: string;
|
|
355
|
+
}>;
|
|
356
|
+
/** Whether a plan still has preparation to sign before its submit. */
|
|
357
|
+
declare function solanaPlanNeedsPreparation(plan: SolanaSourcePlan): boolean;
|
|
358
|
+
declare function readSolanaBalance(rpc: SolanaRpc, owner: string, mint: string): Promise<bigint | undefined>;
|
|
359
|
+
interface SolanaOrderCost {
|
|
360
|
+
lamports: number;
|
|
361
|
+
balanceLamports: number;
|
|
362
|
+
sufficient: boolean;
|
|
363
|
+
}
|
|
364
|
+
declare function simulateSolanaCost(rpc: SolanaRpc, plan: SolanaSourcePlan): Promise<SolanaOrderCost>;
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* The precision of the final order's `askTokenAmount`: the deployment of the destination asset on the
|
|
368
|
+
* chain that EXECUTES that order (USDe asks on Ethereum in 18 decimals while delivering 9 on Solana).
|
|
369
|
+
*
|
|
370
|
+
* Nothing here reads `quote.isDirect`, and a missing execution-chain row is refused, never filled with
|
|
371
|
+
* the destination's precision: both let a hostile quote shrink the signed minimum by 10^12 while the
|
|
372
|
+
* card displayed the full amount (security review 2026-10-27). The execution chain is the final
|
|
373
|
+
* order's own field — the one that is encoded — never the quote's top-level echo.
|
|
374
|
+
*/
|
|
375
|
+
declare function askTokenDecimals(quote: Quote, tokens: readonly Token[], _from: {
|
|
376
|
+
decimals: number;
|
|
377
|
+
}, to: Token): number;
|
|
378
|
+
/** Compare in the finer precision without truncation on either side. */
|
|
379
|
+
declare function askCovers(ask: bigint, final: bigint, askDecimals: number, finalDecimals: number): boolean;
|
|
57
380
|
|
|
58
381
|
declare function assetDecimals(token: Partial<Token> | undefined | null): number;
|
|
59
382
|
declare function normalizeDecimalText(value: unknown): string;
|
|
@@ -102,7 +425,7 @@ interface DecodedSubmitOrder {
|
|
|
102
425
|
/**
|
|
103
426
|
* Strict inverse of {@link encodeSubmitOrder}, for the pre-sign validator. Returns `null` on ANY
|
|
104
427
|
* deviation from the exact layout the engine produces — wrong selector, a non-canonical offset,
|
|
105
|
-
* a `bytes` member that is not a 20-byte
|
|
428
|
+
* a `bytes` member that is not a 20- or 32-byte key, trailing bytes — so a tampered plan cannot be
|
|
106
429
|
* "close enough". It deliberately decodes only what this widget signs, not the general ABI.
|
|
107
430
|
*/
|
|
108
431
|
declare function decodeSubmitOrderCalldata(data: string): DecodedSubmitOrder | null;
|
|
@@ -321,8 +644,9 @@ interface AssertQuoteArgs {
|
|
|
321
644
|
};
|
|
322
645
|
payer: string;
|
|
323
646
|
result: SolveResult;
|
|
647
|
+
tokens?: readonly Token[];
|
|
324
648
|
}
|
|
325
|
-
declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
|
|
649
|
+
declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result, tokens }: AssertQuoteArgs): void;
|
|
326
650
|
|
|
327
651
|
/**
|
|
328
652
|
* The `partnerId` word for this quote's `submitOrder`.
|
|
@@ -393,38 +717,6 @@ declare function quotePayOption(api: ApiClient, request: PayRequest, payer: stri
|
|
|
393
717
|
address: string;
|
|
394
718
|
}, wallet?: PaymentWalletContext): Promise<RouteResult>;
|
|
395
719
|
|
|
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
720
|
declare function isHexAddress(value: unknown): boolean;
|
|
429
721
|
declare function isHexData(value: unknown): boolean;
|
|
430
722
|
declare function isHexQuantity(value: unknown): boolean;
|
|
@@ -524,10 +816,30 @@ declare const stableGenieIntentSchema: {
|
|
|
524
816
|
readonly type: "object";
|
|
525
817
|
readonly additionalProperties: false;
|
|
526
818
|
readonly required: readonly ["address", "chainId", "asset", "amount"];
|
|
819
|
+
readonly oneOf: readonly [{
|
|
820
|
+
readonly properties: {
|
|
821
|
+
readonly chainId: {
|
|
822
|
+
readonly const: 1151111081099710;
|
|
823
|
+
};
|
|
824
|
+
readonly address: {
|
|
825
|
+
readonly pattern: "^[1-9A-HJ-NP-Za-km-z]{32,44}$";
|
|
826
|
+
};
|
|
827
|
+
};
|
|
828
|
+
}, {
|
|
829
|
+
readonly properties: {
|
|
830
|
+
readonly chainId: {
|
|
831
|
+
readonly not: {
|
|
832
|
+
readonly const: 1151111081099710;
|
|
833
|
+
};
|
|
834
|
+
};
|
|
835
|
+
readonly address: {
|
|
836
|
+
readonly pattern: "^0x[a-fA-F0-9]{40}$";
|
|
837
|
+
};
|
|
838
|
+
};
|
|
839
|
+
}];
|
|
527
840
|
readonly properties: {
|
|
528
841
|
readonly address: {
|
|
529
842
|
readonly type: "string";
|
|
530
|
-
readonly pattern: "^0x[a-fA-F0-9]{40}$";
|
|
531
843
|
};
|
|
532
844
|
readonly chainId: {
|
|
533
845
|
readonly type: "integer";
|
|
@@ -595,7 +907,15 @@ interface Engine {
|
|
|
595
907
|
* Never rejects: a failed read yields a catalogue with `ready: false`, which callers must treat as
|
|
596
908
|
* "not known yet" rather than "nothing is supported".
|
|
597
909
|
*/
|
|
598
|
-
fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct
|
|
910
|
+
fetchCatalogue: (allowedAssets?: readonly string[], product?: ExchangeProduct, options?: {
|
|
911
|
+
solanaSources?: boolean;
|
|
912
|
+
}) => Promise<Catalogue>;
|
|
913
|
+
/** Price a Solana source before any wallet is connected. Display only; nothing built from it is signed. */
|
|
914
|
+
previewSolanaSource: (input: Parameters<typeof previewSolanaSource>[1]) => Promise<SwapPreview>;
|
|
915
|
+
/** The two-click flow: preparation, then the submit on its own click. */
|
|
916
|
+
executeSolanaPlanStaged: (input: Omit<Parameters<typeof executeSolanaPlanStaged>[0], "rpc"> & {
|
|
917
|
+
rpc?: Parameters<typeof executeSolanaPlanStaged>[0]["rpc"];
|
|
918
|
+
}) => ReturnType<typeof executeSolanaPlanStaged>;
|
|
599
919
|
fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
|
|
600
920
|
/** Price one funding option a plan left unquoted (`Plan.unquotedOptions`) — see core/plan.ts. */
|
|
601
921
|
quotePayOption: (request: PayRequest, payer: string, option: {
|
|
@@ -606,6 +926,13 @@ interface Engine {
|
|
|
606
926
|
buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
|
|
607
927
|
chainId?: number;
|
|
608
928
|
}) => Promise<Plan>;
|
|
929
|
+
quoteSolanaSource: (input: SolanaSourceInput) => Promise<SolanaSourcePreview>;
|
|
930
|
+
buildSolanaSourcePlan: (input: SolanaSourceInput, preview?: SolanaSourcePreview) => Promise<SolanaSourcePlan>;
|
|
931
|
+
executeSolanaPlan: (input: Omit<Parameters<typeof executeSolanaPlan>[0], "rpc"> & {
|
|
932
|
+
rpc?: Parameters<typeof executeSolanaPlan>[0]["rpc"];
|
|
933
|
+
}) => Promise<string>;
|
|
934
|
+
readSolanaBalance: (owner: string, mint: string) => Promise<bigint | undefined>;
|
|
935
|
+
simulateSolanaCost: (plan: SolanaSourcePlan) => ReturnType<typeof simulateSolanaCost>;
|
|
609
936
|
payerNonceBaseline: Verifier["payerNonceBaseline"];
|
|
610
937
|
verifySubmittedTx: Verifier["verifySubmittedTx"];
|
|
611
938
|
readBalances: Verifier["readBalances"];
|
|
@@ -620,4 +947,4 @@ interface Engine {
|
|
|
620
947
|
/** 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
948
|
declare function createEngine(config?: EngineConfig): Engine;
|
|
622
949
|
|
|
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 };
|
|
950
|
+
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, 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, 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, TRADEABLE_RWA_ASSETS, Token, TxHistoryEntry, type ValidatedSwap, Verifier, 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, fetchPaymentPlan, finalOf, findProgramAddress, findToken, foldTicker, formatNative, formatUnits, hexBytes, hexToSolanaKey, isAddress, isChainAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, isOnEd25519Curve, isPreparationInstruction, isSolanaAddress, isSolanaChainId, isSubmitOrder, maxDeadlineSeconds, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, 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, solanaPlanNeedsPreparation, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, tickerOn, toHexQuantity, tokenEnabled, tokenTicker, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap, vaultIconsBySymbol, verifySolanaSubmit, verifySolanaTransaction, verifySolanaSubmit as verifySubmit, verifySolanaTransaction as verifyTransaction, withVaultArtwork };
|