@glacislabs/stablegenie-zerodelta 3.0.2 → 3.1.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/README.md +1 -1
- package/dist/{chunk-TR2XMP7X.js → chunk-NSH3PT2J.js} +6 -4
- package/dist/{chunk-AZPTL3KD.js → chunk-OOURZ5DL.js} +191 -58
- package/dist/core/index.cjs +196 -57
- package/dist/core/index.d.cts +60 -7
- package/dist/core/index.d.ts +60 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +195 -60
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{mount-BC5gY1X6.d.cts → mount-DNvmtX0y.d.cts} +1 -1
- package/dist/{mount-8nchcNbL.d.ts → mount-jxrT-DMe.d.ts} +1 -1
- package/dist/mount.cjs +195 -60
- 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 +6 -6
- package/dist/{verify-DFTuQ2g3.d.cts → verify-7lk90Ado.d.cts} +11 -3
- package/dist/{verify-DFTuQ2g3.d.ts → verify-7lk90Ado.d.ts} +11 -3
- package/package.json +2 -1
package/dist/core/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { a as Token, Q as Quote, N as NormalizedOrder, b as PayOption, R as RouteResult, C as Chain, c as Route, F as FetchQuoteFn, d as SolveResult, O as OrderRequest, B as BalanceTarget, e as BalanceEntry, A as ApiClient, P as Plan, f as SwapInput, g as PlannedTx, h as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-
|
|
2
|
-
export { i as Address, j as ApiError, D as Destination, H as Hex, k as PlannedTxKind, l as QuoteBlock, m as ResolvedConfig, n as TxPlan, V as VerifyResult, o as apiError, p as canAttachApiKey, q as classifyQuoteError, r as createApiClient, s as createVerifier, t as parseAllowedApiBase, u as registryRpc, v as resolveApiBase, w as resolveConfig, x as txMatchesPlan } from '../verify-
|
|
1
|
+
import { a as Token, Q as Quote, N as NormalizedOrder, b as PayOption, R as RouteResult, C as Chain, c as Route, F as FetchQuoteFn, d as SolveResult, O as OrderRequest, B as BalanceTarget, e as BalanceEntry, A as ApiClient, P as Plan, f as SwapInput, g as PlannedTx, h as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-7lk90Ado.js';
|
|
2
|
+
export { i as Address, j as ApiError, D as Destination, H as Hex, k as PlannedTxKind, l as QuoteBlock, m as ResolvedConfig, n as TxPlan, V as VerifyResult, o as apiError, p as canAttachApiKey, q as classifyQuoteError, r as createApiClient, s as createVerifier, t as parseAllowedApiBase, u as registryRpc, v as resolveApiBase, w as resolveConfig, x as txMatchesPlan } from '../verify-7lk90Ado.js';
|
|
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. */
|
|
@@ -10,7 +10,12 @@ declare const API_CACHE_TTL_MS = 60000;
|
|
|
10
10
|
declare const MAX_QUOTE_CANDIDATES = 8;
|
|
11
11
|
declare const QUOTE_BUFFER_BPS = 50;
|
|
12
12
|
declare const LZ_FEE_BUFFER_BPS = 1500n;
|
|
13
|
-
declare const SUBMIT_ORDER_SELECTOR = "
|
|
13
|
+
declare const SUBMIT_ORDER_SELECTOR = "0xaf439ecd";
|
|
14
|
+
/** `partnerId` for orders this widget submits — none. The escrow's only use of the argument is
|
|
15
|
+
* `if (partnerId != bytes32(0)) emit PartnerOrder(partnerId)`; there is no on-chain logic behind
|
|
16
|
+
* it and the gateway issues none, so zero is the value that MEANS "no attribution", not a
|
|
17
|
+
* placeholder. The pre-sign validator binds the encoded word to exactly this. */
|
|
18
|
+
declare const NO_PARTNER_ID: string;
|
|
14
19
|
declare const ERC20_APPROVE_SELECTOR = "0x095ea7b3";
|
|
15
20
|
declare const ERC20_TRANSFER_SELECTOR = "0xa9059cbb";
|
|
16
21
|
declare const ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
|
|
@@ -44,13 +49,48 @@ declare function finalOf(quote: Quote | undefined | null): bigint;
|
|
|
44
49
|
|
|
45
50
|
declare function strip0x(value: unknown): string;
|
|
46
51
|
declare function uintWord(value: bigint | number | string): string;
|
|
52
|
+
declare const MAX_UINT64: bigint;
|
|
53
|
+
/** The escrow declares chain ids and the deadline as uint64. Solidity would silently truncate a
|
|
54
|
+
* wider value into a different chain / deadline, so refuse anything that does not fit. */
|
|
55
|
+
declare function uint64Word(value: bigint | number | string): string;
|
|
56
|
+
declare function bytes32Word(value: string): string;
|
|
47
57
|
declare function addressWord(address: string): string;
|
|
58
|
+
/** ABI `bytes` payload: length word + right-padded content. Used for the escrow's `bytes askToken`
|
|
59
|
+
* and `bytes destinationReceiver` (bytes rather than address so non-EVM destinations fit). */
|
|
48
60
|
declare function bytesPayload(value: string): string;
|
|
49
61
|
declare function encodeApprove(spender: string, amount: bigint | number | string): string;
|
|
50
62
|
declare function encodeTransfer(to: string, amount: bigint | number | string): string;
|
|
51
63
|
declare function encodeAllowance(owner: string, spender: string): string;
|
|
52
64
|
declare function encodeBalanceOf(account: string): string;
|
|
53
|
-
|
|
65
|
+
/**
|
|
66
|
+
* `submitOrder(OrderRequest[] requests, bytes32 partnerId)`.
|
|
67
|
+
* Layout: selector · [offset of `requests` = 0x40] · [partnerId] · [n] · [n element offsets,
|
|
68
|
+
* relative to the first element slot] · tuples. A chained quote is one signature / several legs,
|
|
69
|
+
* so the engine always encodes the whole `orderRequests` list the gateway returned.
|
|
70
|
+
*/
|
|
71
|
+
declare function encodeSubmitOrder(orders: NormalizedOrder[], partnerId?: string): string;
|
|
72
|
+
interface DecodedOrderRequest {
|
|
73
|
+
owner: string;
|
|
74
|
+
bidToken: string;
|
|
75
|
+
bidTokenAmount: bigint;
|
|
76
|
+
askToken: string;
|
|
77
|
+
askTokenAmount: bigint;
|
|
78
|
+
destinationReceiver: string;
|
|
79
|
+
destinationChainId: bigint;
|
|
80
|
+
executionChainId: bigint;
|
|
81
|
+
deadline: bigint;
|
|
82
|
+
}
|
|
83
|
+
interface DecodedSubmitOrder {
|
|
84
|
+
partnerId: string;
|
|
85
|
+
orders: DecodedOrderRequest[];
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Strict inverse of {@link encodeSubmitOrder}, for the pre-sign validator. Returns `null` on ANY
|
|
89
|
+
* deviation from the exact layout the engine produces — wrong selector, a non-canonical offset,
|
|
90
|
+
* a `bytes` member that is not a 20-byte address, trailing bytes — so a tampered plan cannot be
|
|
91
|
+
* "close enough". It deliberately decodes only what this widget signs, not the general ABI.
|
|
92
|
+
*/
|
|
93
|
+
declare function decodeSubmitOrderCalldata(data: string): DecodedSubmitOrder | null;
|
|
54
94
|
declare function toHexQuantity(value: bigint | number | string): string;
|
|
55
95
|
|
|
56
96
|
/**
|
|
@@ -143,10 +183,23 @@ declare function solveExactIn({ option, destination, destinationToken, payer, fe
|
|
|
143
183
|
declare function normalizeOrderRequest(order: OrderRequest, payer: string, destination: {
|
|
144
184
|
address: string;
|
|
145
185
|
chainId: number | string;
|
|
146
|
-
}): NormalizedOrder;
|
|
186
|
+
}, fallbackExecutionChainId?: number | string, deadlineOverride?: string): NormalizedOrder;
|
|
187
|
+
/**
|
|
188
|
+
* Normalize the whole `orderRequests` list of a quote. A chained (RWA) quote is one signature and
|
|
189
|
+
* several legs: leg 1 is the user's order and gets the client-side fills (owner, receiver, a fresh
|
|
190
|
+
* deadline); follow-up legs keep whatever deadline the gateway issued — `0` is its "no separate
|
|
191
|
+
* deadline" marker and must be forwarded verbatim, not replaced.
|
|
192
|
+
*/
|
|
193
|
+
declare function normalizeOrderRequests(requests: OrderRequest[], payer: string, destination: {
|
|
194
|
+
address: string;
|
|
195
|
+
chainId: number | string;
|
|
196
|
+
}, fallbackExecutionChainId?: number | string): NormalizedOrder[];
|
|
147
197
|
interface AssertQuoteArgs {
|
|
148
198
|
quote: Quote;
|
|
199
|
+
/** The first (user-signed) leg. Kept as a separate argument so single-leg callers stay simple. */
|
|
149
200
|
order: NormalizedOrder;
|
|
201
|
+
/** Every leg, first to last. Defaults to `[order]`. */
|
|
202
|
+
orders?: NormalizedOrder[];
|
|
150
203
|
option: PayOption;
|
|
151
204
|
destinationToken: Token;
|
|
152
205
|
destination: {
|
|
@@ -156,7 +209,7 @@ interface AssertQuoteArgs {
|
|
|
156
209
|
payer: string;
|
|
157
210
|
result: SolveResult;
|
|
158
211
|
}
|
|
159
|
-
declare function assertQuoteMatchesSelection({ quote, order, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
|
|
212
|
+
declare function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }: AssertQuoteArgs): void;
|
|
160
213
|
|
|
161
214
|
interface BuildRouteArgs {
|
|
162
215
|
option: PayOption;
|
|
@@ -352,4 +405,4 @@ interface Engine {
|
|
|
352
405
|
/** Create an engine bound to a config. The 60s resource cache is per-engine. */
|
|
353
406
|
declare function createEngine(config?: EngineConfig): Engine;
|
|
354
407
|
|
|
355
|
-
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, DEFAULT_WIDGET_API_BASE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, type Engine, EngineConfig, 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, type NativeFeeCheck, NormalizedOrder, OrderRequest, PREVIEW_OWNER, PayOption, type PayRequest, type PaymentWalletContext, Plan, PlannedTx, QUOTE_BUFFER_BPS, Quote, Route, RouteResult, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, Token, TxHistoryEntry, type ValidatedSwap, Verifier, ZERO_ADDRESS, addressWord, allowanceCovers, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytesPayload, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, createEngine, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
|
|
408
|
+
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, DEFAULT_WIDGET_API_BASE, type DecodedOrderRequest, type DecodedSubmitOrder, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, type Engine, EngineConfig, 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, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, SanitizedTxEntry, type SolveArgs, SolveResult, SwapInput, type SwapPreview, 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, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, requiresNativeBridgeFee, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap };
|
package/dist/core/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { API_CACHE_TTL_MS, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, DEFAULT_WIDGET_API_BASE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, LZ_FEE_BUFFER_BPS, MAX_LZ_MSG_VALUE_WEI, MAX_LZ_MSG_VALUE_WEI_BY_CHAIN, MAX_QUOTE_CANDIDATES, MAX_SAME_CLASS_PAY_BPS, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, createApiClient, createEngine, createVerifier, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, txMatchesPlan, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-
|
|
1
|
+
export { API_CACHE_TTL_MS, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, CANONICAL_DECIMALS, CANONICAL_ESCROW, CANONICAL_INBOUND_BRIDGE, DEFAULT_WIDGET_API_BASE, ERC20_ALLOWANCE_SELECTOR, ERC20_APPROVE_SELECTOR, ERC20_BALANCEOF_SELECTOR, ERC20_TRANSFER_SELECTOR, 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, PREVIEW_OWNER, QUOTE_BUFFER_BPS, SAME_CLASS_STABLE, STABLEGENIE_INTENT_TTL_MS, STABLEGENIE_INTENT_VERSION, STABLEGENIE_SUPPORTED_ASSETS, STABLEGENIE_SUPPORTED_CHAIN_IDS, SUBMIT_ORDER_SELECTOR, SUPPORTED_ASSETS, SUPPORTED_CHAIN_IDS, ZERO_ADDRESS, addressWord, allowanceCovers, apiError, applyLayerZeroBuffer, assertAddress, assertQuoteMatchesSelection, assetDecimals, buildPayOptions, buildRoute, buildSwapPlan, bytes32Word, bytesPayload, canAttachApiKey, chainById, chainNameOf, chainSelectable, checkEscrow, checkNativeFee, classifyQuoteError, createApiClient, createEngine, createVerifier, decodeSubmitOrderCalldata, encodeAllowance, encodeApprove, encodeBalanceOf, encodeSubmitOrder, encodeTransfer, fetchPaymentPlan, finalOf, findToken, formatNative, formatUnits, isAddress, isDeliverable, isHexAddress, isHexData, isHexQuantity, isLayerZeroRoute, maxNativeFeeWei, nativeFeeShortLabel, nativeFeeShortMessage, nativeSymbol, normalizeAddress, normalizeDecimalText, normalizeOrderRequest, normalizeOrderRequests, parseAllowedApiBase, parseUnitsDecimal, planErrorSummary, planMsgValueHex, quoteSwapPreview, registryRpc, requiresNativeBridgeFee, resolveApiBase, resolveConfig, resolveSwapReceiver, routeNativeValue, scaleDecimals, solveExactIn, solveExactOut, stableGenieIntentSchema, strip0x, symbolKey, toHexQuantity, tokenEnabled, txMatchesPlan, uint64Word, uintWord, validateDestination, validatePlannedTransaction, validateSwap } from '../chunk-OOURZ5DL.js';
|
package/dist/index.cjs
CHANGED
|
@@ -16,13 +16,14 @@ function useMergedConfig(local) {
|
|
|
16
16
|
|
|
17
17
|
// src/core/constants.ts
|
|
18
18
|
var DEFAULT_WIDGET_API_BASE = "/api/widget/v1";
|
|
19
|
-
var SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([1, 10, 42161, 8453, 57073, 130, 9745, 146]);
|
|
19
|
+
var SUPPORTED_CHAIN_IDS = /* @__PURE__ */ new Set([1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866]);
|
|
20
20
|
var SUPPORTED_ASSETS = /* @__PURE__ */ new Set(["USDC", "USDT", "USDE", "XAUT"]);
|
|
21
21
|
var API_CACHE_TTL_MS = 6e4;
|
|
22
22
|
var MAX_QUOTE_CANDIDATES = 8;
|
|
23
23
|
var QUOTE_BUFFER_BPS = 50;
|
|
24
24
|
var LZ_FEE_BUFFER_BPS = 1500n;
|
|
25
|
-
var SUBMIT_ORDER_SELECTOR = "
|
|
25
|
+
var SUBMIT_ORDER_SELECTOR = "0xaf439ecd";
|
|
26
|
+
var NO_PARTNER_ID = `0x${"0".repeat(64)}`;
|
|
26
27
|
var ERC20_APPROVE_SELECTOR = "0x095ea7b3";
|
|
27
28
|
var ERC20_TRANSFER_SELECTOR = "0xa9059cbb";
|
|
28
29
|
var ERC20_ALLOWANCE_SELECTOR = "0xdd62ed3e";
|
|
@@ -31,22 +32,24 @@ var ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
|
|
|
31
32
|
var PREVIEW_OWNER = "0x1111111111111111111111111111111111111111";
|
|
32
33
|
var CANONICAL_DECIMALS = { USDC: 6, USDT: 6, USDE: 18, XAUT: 6 };
|
|
33
34
|
var CANONICAL_ESCROW = Object.freeze({
|
|
34
|
-
1: "
|
|
35
|
-
// Ethereum
|
|
36
|
-
10: "
|
|
37
|
-
// Optimism
|
|
38
|
-
130: "
|
|
39
|
-
// Unichain
|
|
40
|
-
146: "
|
|
41
|
-
// Sonic
|
|
42
|
-
8453: "
|
|
43
|
-
// Base
|
|
44
|
-
9745: "
|
|
45
|
-
// Plasma
|
|
46
|
-
57073: "
|
|
47
|
-
// Ink
|
|
48
|
-
42161: "
|
|
49
|
-
// Arbitrum
|
|
35
|
+
1: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
36
|
+
// Ethereum
|
|
37
|
+
10: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
38
|
+
// Optimism
|
|
39
|
+
130: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
40
|
+
// Unichain
|
|
41
|
+
146: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
42
|
+
// Sonic
|
|
43
|
+
8453: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
44
|
+
// Base
|
|
45
|
+
9745: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
46
|
+
// Plasma
|
|
47
|
+
57073: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
48
|
+
// Ink
|
|
49
|
+
42161: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40",
|
|
50
|
+
// Arbitrum
|
|
51
|
+
98866: "0x5e25c8ABc19b88d6A7Ab0D805C77A34987a68b40"
|
|
52
|
+
// Plume
|
|
50
53
|
});
|
|
51
54
|
var MAX_LZ_MSG_VALUE_WEI = 10n ** 18n;
|
|
52
55
|
var MAX_LZ_MSG_VALUE_WEI_BY_CHAIN = {};
|
|
@@ -68,7 +71,8 @@ var BUNDLED_NATIVE_SYMBOL = {
|
|
|
68
71
|
146: "S",
|
|
69
72
|
8453: "ETH",
|
|
70
73
|
57073: "ETH",
|
|
71
|
-
42161: "ETH"
|
|
74
|
+
42161: "ETH",
|
|
75
|
+
98866: "PLUME"
|
|
72
76
|
};
|
|
73
77
|
var BUNDLED_RPC = {
|
|
74
78
|
1: "https://ethereum-rpc.publicnode.com",
|
|
@@ -78,7 +82,8 @@ var BUNDLED_RPC = {
|
|
|
78
82
|
8453: "https://mainnet.base.org",
|
|
79
83
|
9745: "https://rpc.plasma.to",
|
|
80
84
|
57073: "https://rpc-gel.inkonchain.com",
|
|
81
|
-
42161: "https://arb1.arbitrum.io/rpc"
|
|
85
|
+
42161: "https://arb1.arbitrum.io/rpc",
|
|
86
|
+
98866: "https://rpc.plume.org"
|
|
82
87
|
};
|
|
83
88
|
|
|
84
89
|
// src/core/address.ts
|
|
@@ -170,13 +175,25 @@ function uintWord(value) {
|
|
|
170
175
|
if (hex.length > 64) throw new Error("uint256 value is too large.");
|
|
171
176
|
return hex.padStart(64, "0");
|
|
172
177
|
}
|
|
178
|
+
var MAX_UINT64 = (1n << 64n) - 1n;
|
|
179
|
+
function uint64Word(value) {
|
|
180
|
+
const n = BigInt(value || 0);
|
|
181
|
+
if (n < 0n) throw new Error("Cannot encode a negative uint64.");
|
|
182
|
+
if (n > MAX_UINT64) throw new Error("uint64 value is too large.");
|
|
183
|
+
return n.toString(16).padStart(64, "0");
|
|
184
|
+
}
|
|
185
|
+
function bytes32Word(value) {
|
|
186
|
+
const hex = strip0x(value);
|
|
187
|
+
if (!/^[a-fA-F0-9]{64}$/.test(hex)) throw new Error("bytes32 value must be exactly 32 bytes of hex.");
|
|
188
|
+
return hex.toLowerCase();
|
|
189
|
+
}
|
|
173
190
|
function addressWord(address) {
|
|
174
191
|
return strip0x(assertAddress(address, "Address")).padStart(64, "0");
|
|
175
192
|
}
|
|
176
193
|
function bytesPayload(value) {
|
|
177
|
-
const hex = strip0x(value);
|
|
178
|
-
if (hex.length % 2) throw new Error("
|
|
179
|
-
if (!/^[a-fA-F0-9]*$/.test(hex)) throw new Error("
|
|
194
|
+
const hex = strip0x(value || "0x");
|
|
195
|
+
if (hex.length % 2) throw new Error("Bytes payload has an odd-length hex value; refusing to encode.");
|
|
196
|
+
if (!/^[a-fA-F0-9]*$/.test(hex)) throw new Error("Bytes payload is not valid hex.");
|
|
180
197
|
const byteLength = hex.length / 2;
|
|
181
198
|
const paddedLength = Math.ceil(hex.length / 64) * 64;
|
|
182
199
|
return `${uintWord(byteLength)}${hex.padEnd(paddedLength, "0")}`;
|
|
@@ -193,19 +210,96 @@ function encodeAllowance(owner, spender) {
|
|
|
193
210
|
function encodeBalanceOf(account) {
|
|
194
211
|
return `${ERC20_BALANCEOF_SELECTOR}${addressWord(account)}`;
|
|
195
212
|
}
|
|
196
|
-
|
|
197
|
-
|
|
213
|
+
var ORDER_HEAD_WORDS = 9n;
|
|
214
|
+
var ORDER_HEAD_BYTES = ORDER_HEAD_WORDS * 32n;
|
|
215
|
+
function encodeOrderTuple(order) {
|
|
216
|
+
const askToken = bytesPayload(order.askToken);
|
|
217
|
+
const receiver = bytesPayload(order.destinationReceiver);
|
|
218
|
+
const receiverOffset = ORDER_HEAD_BYTES + BigInt(askToken.length / 2);
|
|
219
|
+
const head = [
|
|
198
220
|
addressWord(order.owner),
|
|
199
221
|
addressWord(order.bidToken),
|
|
200
222
|
uintWord(order.bidTokenAmount),
|
|
201
|
-
|
|
223
|
+
uintWord(ORDER_HEAD_BYTES),
|
|
202
224
|
uintWord(order.askTokenAmount),
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
225
|
+
uintWord(receiverOffset),
|
|
226
|
+
uint64Word(order.destinationChainId),
|
|
227
|
+
uint64Word(order.executionChainId),
|
|
228
|
+
uint64Word(order.deadline)
|
|
207
229
|
].join("");
|
|
208
|
-
return
|
|
230
|
+
return `${head}${askToken}${receiver}`;
|
|
231
|
+
}
|
|
232
|
+
function encodeSubmitOrder(orders, partnerId = NO_PARTNER_ID) {
|
|
233
|
+
if (!orders.length) throw new Error("Cannot encode an empty order request array.");
|
|
234
|
+
const tuples = orders.map(encodeOrderTuple);
|
|
235
|
+
let offset = 32n * BigInt(tuples.length);
|
|
236
|
+
const offsets = tuples.map((tuple) => {
|
|
237
|
+
const word = uintWord(offset);
|
|
238
|
+
offset += BigInt(tuple.length / 2);
|
|
239
|
+
return word;
|
|
240
|
+
}).join("");
|
|
241
|
+
return `0x${SUBMIT_ORDER_SELECTOR.slice(2)}${uintWord(64)}${bytes32Word(partnerId)}${uintWord(tuples.length)}${offsets}${tuples.join("")}`;
|
|
242
|
+
}
|
|
243
|
+
var EVM_BYTES_PAYLOAD_BYTES = 64;
|
|
244
|
+
var EVM_ORDER_TUPLE_BYTES = Number(ORDER_HEAD_BYTES) + 2 * EVM_BYTES_PAYLOAD_BYTES;
|
|
245
|
+
var MAX_DECODED_ORDERS = 16;
|
|
246
|
+
function decodeSubmitOrderCalldata(data) {
|
|
247
|
+
const hex = strip0x(String(data || "")).toLowerCase();
|
|
248
|
+
if (hex.length < 8 || hex.length % 2 !== 0 || !/^[a-f0-9]*$/.test(hex)) return null;
|
|
249
|
+
if (`0x${hex.slice(0, 8)}` !== SUBMIT_ORDER_SELECTOR) return null;
|
|
250
|
+
const body = hex.slice(8);
|
|
251
|
+
const totalBytes = body.length / 2;
|
|
252
|
+
const word = (byteOffset) => {
|
|
253
|
+
if (!Number.isSafeInteger(byteOffset) || byteOffset < 0 || byteOffset + 32 > totalBytes) return null;
|
|
254
|
+
return BigInt(`0x${body.slice(byteOffset * 2, byteOffset * 2 + 64)}`);
|
|
255
|
+
};
|
|
256
|
+
const addressAt = (byteOffset) => {
|
|
257
|
+
const w = word(byteOffset);
|
|
258
|
+
if (w === null || w >= 1n << 160n) return null;
|
|
259
|
+
return `0x${w.toString(16).padStart(40, "0")}`;
|
|
260
|
+
};
|
|
261
|
+
const uint64At = (byteOffset) => {
|
|
262
|
+
const w = word(byteOffset);
|
|
263
|
+
return w === null || w > MAX_UINT64 ? null : w;
|
|
264
|
+
};
|
|
265
|
+
const evmBytesAt = (byteOffset) => {
|
|
266
|
+
const len = word(byteOffset);
|
|
267
|
+
if (len !== 20n) return null;
|
|
268
|
+
const content = body.slice((byteOffset + 32) * 2, (byteOffset + 64) * 2);
|
|
269
|
+
if (content.length !== 64 || !content.endsWith("0".repeat(24))) return null;
|
|
270
|
+
return `0x${content.slice(0, 40)}`;
|
|
271
|
+
};
|
|
272
|
+
if (word(0) !== 64n) return null;
|
|
273
|
+
if (word(32) === null) return null;
|
|
274
|
+
const partnerId = `0x${body.slice(64, 128)}`;
|
|
275
|
+
const count = word(64);
|
|
276
|
+
if (count === null || count < 1n || count > BigInt(MAX_DECODED_ORDERS)) return null;
|
|
277
|
+
const n = Number(count);
|
|
278
|
+
const arrayBase = 96;
|
|
279
|
+
if (totalBytes !== arrayBase + 32 * n + EVM_ORDER_TUPLE_BYTES * n) return null;
|
|
280
|
+
const orders = [];
|
|
281
|
+
for (let i = 0; i < n; i += 1) {
|
|
282
|
+
const rel = word(arrayBase + i * 32);
|
|
283
|
+
if (rel === null || rel !== BigInt(32 * n + EVM_ORDER_TUPLE_BYTES * i)) return null;
|
|
284
|
+
const base = arrayBase + Number(rel);
|
|
285
|
+
const owner = addressAt(base);
|
|
286
|
+
const bidToken = addressAt(base + 32);
|
|
287
|
+
const bidTokenAmount = word(base + 64);
|
|
288
|
+
const askOffset = word(base + 96);
|
|
289
|
+
const askTokenAmount = word(base + 128);
|
|
290
|
+
const receiverOffset = word(base + 160);
|
|
291
|
+
const destinationChainId = uint64At(base + 192);
|
|
292
|
+
const executionChainId = uint64At(base + 224);
|
|
293
|
+
const deadline = uint64At(base + 256);
|
|
294
|
+
if (owner === null || bidToken === null || bidTokenAmount === null || askTokenAmount === null || destinationChainId === null || executionChainId === null || deadline === null || askOffset !== ORDER_HEAD_BYTES || receiverOffset !== ORDER_HEAD_BYTES + BigInt(EVM_BYTES_PAYLOAD_BYTES)) {
|
|
295
|
+
return null;
|
|
296
|
+
}
|
|
297
|
+
const askToken = evmBytesAt(base + Number(askOffset));
|
|
298
|
+
const destinationReceiver = evmBytesAt(base + Number(receiverOffset));
|
|
299
|
+
if (askToken === null || destinationReceiver === null) return null;
|
|
300
|
+
orders.push({ owner, bidToken, bidTokenAmount, askToken, askTokenAmount, destinationReceiver, destinationChainId, executionChainId, deadline });
|
|
301
|
+
}
|
|
302
|
+
return { partnerId, orders };
|
|
209
303
|
}
|
|
210
304
|
function toHexQuantity(value) {
|
|
211
305
|
const n = BigInt(value || 0);
|
|
@@ -396,7 +490,7 @@ async function solveExactOut({ option, destination, destinationToken, payer, fet
|
|
|
396
490
|
estimatedDuration: 0,
|
|
397
491
|
gasCostSource: "0",
|
|
398
492
|
gasCostDest: "0",
|
|
399
|
-
|
|
493
|
+
orderRequests: null
|
|
400
494
|
},
|
|
401
495
|
youPayRaw: targetRaw.toString(),
|
|
402
496
|
recipientReceivesRaw: targetRaw.toString(),
|
|
@@ -508,9 +602,13 @@ async function solveExactIn({ option, destination, destinationToken, payer, fetc
|
|
|
508
602
|
}
|
|
509
603
|
|
|
510
604
|
// src/core/order.ts
|
|
511
|
-
|
|
605
|
+
var DEFAULT_DEADLINE_SECONDS = 1800;
|
|
606
|
+
var MAX_DEADLINE_SECONDS = 60 * 60;
|
|
607
|
+
function normalizeOrderRequest(order, payer, destination, fallbackExecutionChainId, deadlineOverride) {
|
|
512
608
|
const apiDeadline = Number(order.deadline);
|
|
513
|
-
const deadline = Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) +
|
|
609
|
+
const deadline = deadlineOverride ?? (Number.isFinite(apiDeadline) && apiDeadline > 0 ? String(order.deadline) : String(Math.floor(Date.now() / 1e3) + DEFAULT_DEADLINE_SECONDS));
|
|
610
|
+
const executionChainId = String(order.executionChainId || fallbackExecutionChainId || "0");
|
|
611
|
+
if (!/^\d+$/.test(executionChainId) || BigInt(executionChainId) <= 0n) throw new Error("ZeroDelta quote did not include an execution chain.");
|
|
514
612
|
return {
|
|
515
613
|
owner: assertAddress(order.owner || payer, "Order owner"),
|
|
516
614
|
bidToken: assertAddress(order.bidToken, "Bid token"),
|
|
@@ -519,26 +617,40 @@ function normalizeOrderRequest(order, payer, destination) {
|
|
|
519
617
|
askTokenAmount: String(order.askTokenAmount || "0"),
|
|
520
618
|
destinationReceiver: assertAddress(order.destinationReceiver || destination.address, "Destination receiver"),
|
|
521
619
|
destinationChainId: String(order.destinationChainId || destination.chainId),
|
|
522
|
-
|
|
523
|
-
|
|
620
|
+
executionChainId,
|
|
621
|
+
deadline
|
|
524
622
|
};
|
|
525
623
|
}
|
|
526
|
-
function
|
|
624
|
+
function normalizeOrderRequests(requests, payer, destination, fallbackExecutionChainId) {
|
|
625
|
+
if (!requests.length) throw new Error("ZeroDelta quote did not include any order requests.");
|
|
626
|
+
return requests.map(
|
|
627
|
+
(request, index) => index === 0 ? normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId) : normalizeOrderRequest(request, payer, destination, fallbackExecutionChainId, String(request.deadline || "0"))
|
|
628
|
+
);
|
|
629
|
+
}
|
|
630
|
+
function assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result }) {
|
|
631
|
+
const list = orders?.length ? orders : [order];
|
|
632
|
+
const sourceOrder = list[0];
|
|
633
|
+
const finalOrder = list[list.length - 1];
|
|
527
634
|
const now = Math.floor(Date.now() / 1e3);
|
|
528
|
-
const deadline = Number(
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
635
|
+
const deadline = Number(sourceOrder.deadline || 0);
|
|
636
|
+
for (const current of list) {
|
|
637
|
+
if (normalizeAddress(current.owner) !== normalizeAddress(payer)) {
|
|
638
|
+
throw new Error("ZeroDelta quote returned an owner that does not match the connected wallet.");
|
|
639
|
+
}
|
|
640
|
+
if (normalizeAddress(current.destinationReceiver) !== normalizeAddress(destination.address)) {
|
|
641
|
+
throw new Error("ZeroDelta quote returned a receiver that does not match the detected destination.");
|
|
642
|
+
}
|
|
643
|
+
if (!/^\d+$/.test(current.executionChainId || "") || BigInt(current.executionChainId) <= 0n) {
|
|
644
|
+
throw new Error("ZeroDelta quote returned an order without an execution chain.");
|
|
645
|
+
}
|
|
534
646
|
}
|
|
535
|
-
if (normalizeAddress(
|
|
647
|
+
if (normalizeAddress(sourceOrder.bidToken) !== normalizeAddress(option.address)) {
|
|
536
648
|
throw new Error("ZeroDelta quote returned a bid token that does not match the selected route.");
|
|
537
649
|
}
|
|
538
|
-
if (normalizeAddress(
|
|
650
|
+
if (normalizeAddress(finalOrder.askToken) !== normalizeAddress(destinationToken.address)) {
|
|
539
651
|
throw new Error("ZeroDelta quote returned an ask token that does not match the destination asset.");
|
|
540
652
|
}
|
|
541
|
-
if (Number(
|
|
653
|
+
if (Number(finalOrder.destinationChainId) !== Number(destination.chainId) || Number(quote.toChainId) !== Number(destination.chainId)) {
|
|
542
654
|
throw new Error("ZeroDelta quote returned a destination chain that does not match the payment request.");
|
|
543
655
|
}
|
|
544
656
|
if (Number(quote.fromChainId) !== Number(option.chainId)) {
|
|
@@ -547,24 +659,38 @@ function assertQuoteMatchesSelection({ quote, order, option, destinationToken, d
|
|
|
547
659
|
if (symbolKey(quote.fromToken) !== option.symbolKey || symbolKey(quote.toToken) !== symbolKey(destinationToken.symbol)) {
|
|
548
660
|
throw new Error("ZeroDelta quote returned token symbols that do not match the selected route.");
|
|
549
661
|
}
|
|
550
|
-
if (BigInt(
|
|
662
|
+
if (BigInt(sourceOrder.bidTokenAmount || "0") !== BigInt(result.youPayRaw || "0")) {
|
|
551
663
|
throw new Error("ZeroDelta quote returned a bid amount that does not match the displayed payment amount.");
|
|
552
664
|
}
|
|
553
|
-
if (BigInt(
|
|
665
|
+
if (BigInt(finalOrder.askTokenAmount || "0") !== BigInt(quote.toAmount || "0")) {
|
|
554
666
|
throw new Error("ZeroDelta quote returned an ask amount that does not match the quoted output.");
|
|
555
667
|
}
|
|
556
|
-
if (BigInt(
|
|
668
|
+
if (BigInt(finalOrder.askTokenAmount || "0") <= 0n || BigInt(quote.toAmount || "0") <= 0n) {
|
|
557
669
|
throw new Error("ZeroDelta quote returned a non-positive output amount.");
|
|
558
670
|
}
|
|
559
|
-
if (BigInt(
|
|
671
|
+
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.targetRaw || "0")) {
|
|
560
672
|
throw new Error("ZeroDelta quote would not cover the requested destination amount.");
|
|
561
673
|
}
|
|
562
|
-
if (BigInt(
|
|
674
|
+
if (BigInt(finalOrder.askTokenAmount || "0") < BigInt(result.recipientReceivesRaw || "0")) {
|
|
563
675
|
throw new Error("ZeroDelta order guarantees less than the displayed receive amount.");
|
|
564
676
|
}
|
|
565
|
-
if (!Number.isFinite(deadline) || deadline <= now || deadline > now +
|
|
677
|
+
if (!Number.isFinite(deadline) || deadline <= now || deadline > now + MAX_DEADLINE_SECONDS) {
|
|
566
678
|
throw new Error("ZeroDelta quote deadline is invalid or too far in the future.");
|
|
567
679
|
}
|
|
680
|
+
for (let index = 1; index < list.length; index += 1) {
|
|
681
|
+
const previous = list[index - 1];
|
|
682
|
+
const current = list[index];
|
|
683
|
+
if (normalizeAddress(previous.askToken) !== normalizeAddress(current.bidToken)) {
|
|
684
|
+
throw new Error("ZeroDelta chained quote returned disconnected order tokens.");
|
|
685
|
+
}
|
|
686
|
+
if (Number(previous.destinationChainId) !== Number(current.executionChainId)) {
|
|
687
|
+
throw new Error("ZeroDelta chained quote returned disconnected execution chains.");
|
|
688
|
+
}
|
|
689
|
+
const followupDeadline = Number(current.deadline || 0);
|
|
690
|
+
if (followupDeadline !== 0 && (!Number.isFinite(followupDeadline) || followupDeadline <= now || followupDeadline > now + MAX_DEADLINE_SECONDS)) {
|
|
691
|
+
throw new Error("ZeroDelta chained quote returned an invalid follow-up deadline.");
|
|
692
|
+
}
|
|
693
|
+
}
|
|
568
694
|
}
|
|
569
695
|
|
|
570
696
|
// src/core/route.ts
|
|
@@ -631,11 +757,13 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
631
757
|
}
|
|
632
758
|
};
|
|
633
759
|
}
|
|
634
|
-
|
|
760
|
+
const requestList = quote.orderRequests?.length ? quote.orderRequests : quote.orderRequest ? [quote.orderRequest] : [];
|
|
761
|
+
if (!requestList.length) throw new Error("ZeroDelta quote did not include an order request.");
|
|
635
762
|
const sourceChain = chainById(chains, option.chainId);
|
|
636
763
|
const escrow = checkEscrow(option.chainId, quote.escrowAddress, sourceChain?.escrowContract);
|
|
637
|
-
const
|
|
638
|
-
|
|
764
|
+
const orders = normalizeOrderRequests(requestList, payer, destination, quote.executionChainId);
|
|
765
|
+
const order = orders[0];
|
|
766
|
+
assertQuoteMatchesSelection({ quote, order, orders, option, destinationToken, destination, payer, result });
|
|
639
767
|
const needsNativeFee = requiresNativeBridgeFee(quote, option);
|
|
640
768
|
if (needsNativeFee) {
|
|
641
769
|
let rawFee;
|
|
@@ -696,7 +824,7 @@ async function buildRoute({ option, destination, destinationToken, chains, payer
|
|
|
696
824
|
label: "Submit ZeroDelta order",
|
|
697
825
|
chainId: option.chainId,
|
|
698
826
|
to: escrow,
|
|
699
|
-
data: encodeSubmitOrder(
|
|
827
|
+
data: encodeSubmitOrder(orders),
|
|
700
828
|
value: toHexQuantity(valueRaw),
|
|
701
829
|
escrow,
|
|
702
830
|
amountRaw: order.bidTokenAmount
|
|
@@ -1136,7 +1264,12 @@ function validatePlannedTransaction(tx, route, expectedRecipient) {
|
|
|
1136
1264
|
if (tx.kind === "submitOrder") {
|
|
1137
1265
|
const expected = planMsgValueHex(route);
|
|
1138
1266
|
if (expected === null || value !== lower(expected)) return false;
|
|
1139
|
-
|
|
1267
|
+
if (selector !== SUBMIT_ORDER_SELECTOR || !isHexAddress(tx.escrow) || lower(tx.to) !== lower(tx.escrow)) return false;
|
|
1268
|
+
const decoded = decodeSubmitOrderCalldata(data);
|
|
1269
|
+
if (!decoded) return false;
|
|
1270
|
+
const first = decoded.orders[0];
|
|
1271
|
+
const last = decoded.orders[decoded.orders.length - 1];
|
|
1272
|
+
return decoded.partnerId === NO_PARTNER_ID && lower(first.bidToken) === lower(route.source.tokenAddress) && rawEquals(first.bidTokenAmount, tx.amountRaw) && lower(last.askToken) === lower(route.receive.tokenAddress) && Number(last.destinationChainId) === Number(route.receive.chainId) && lower(last.destinationReceiver) === lower(expectedRecipient);
|
|
1140
1273
|
}
|
|
1141
1274
|
return false;
|
|
1142
1275
|
}
|
|
@@ -2542,9 +2675,10 @@ var CHAIN_LABELS = {
|
|
|
2542
2675
|
8453: "Base",
|
|
2543
2676
|
9745: "Plasma",
|
|
2544
2677
|
57073: "Ink",
|
|
2545
|
-
42161: "Arbitrum"
|
|
2678
|
+
42161: "Arbitrum",
|
|
2679
|
+
98866: "Plume"
|
|
2546
2680
|
};
|
|
2547
|
-
var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146];
|
|
2681
|
+
var SUPPORTED_CHAINS = [1, 10, 42161, 8453, 57073, 130, 9745, 146, 98866];
|
|
2548
2682
|
var SUPPORTED_ASSETS2 = ["USDC", "USDT", "USDE", "XAUT"];
|
|
2549
2683
|
function Button(props) {
|
|
2550
2684
|
const soft = !!props.softDisabled && !props.disabled;
|
|
@@ -2743,7 +2877,8 @@ var CHAIN_SHORT = {
|
|
|
2743
2877
|
8453: "BASE",
|
|
2744
2878
|
9745: "PLS",
|
|
2745
2879
|
57073: "INK",
|
|
2746
|
-
42161: "ARB"
|
|
2880
|
+
42161: "ARB",
|
|
2881
|
+
98866: "PLM"
|
|
2747
2882
|
};
|
|
2748
2883
|
function isHttpsUrl(u) {
|
|
2749
2884
|
return typeof u === "string" && /^https:\/\//i.test(u);
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieSwap, k as StableGenieSwapProps, l as StableGenieTheme, m as SuccessInfo, n as SupportedAsset, o as darkTheme, p as lightTheme, q as mount, r as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieSwap, k as StableGenieSwapProps, l as StableGenieTheme, m as SuccessInfo, n as SupportedAsset, o as darkTheme, p as lightTheme, q as mount, r as resolveTheme } from './mount-DNvmtX0y.cjs';
|
|
2
2
|
export { Engine, createEngine } from './core/index.cjs';
|
|
3
|
-
export { E as EngineConfig, P as Plan, R as RouteResult, S as SanitizedTxEntry, T as TxHistoryEntry, V as VerifyResult } from './verify-
|
|
3
|
+
export { E as EngineConfig, P as Plan, R as RouteResult, S as SanitizedTxEntry, T as TxHistoryEntry, V as VerifyResult } from './verify-7lk90Ado.cjs';
|
|
4
4
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieSwap, k as StableGenieSwapProps, l as StableGenieTheme, m as SuccessInfo, n as SupportedAsset, o as darkTheme, p as lightTheme, q as mount, r as resolveTheme } from './mount-
|
|
1
|
+
export { B as BankPayoutAccount, E as Eip1193Provider, a as ExchangeMode, L as LinkIdentity, M as MountConfig, P as PaymentIsland, b as PaymentIslandKind, c as PaymentIslandProps, S as SettlementMethod, d as StableGenieConfig, e as StableGenieExchange, f as StableGenieExchangeProps, g as StableGeniePay, h as StableGeniePayProps, i as StableGenieProvider, j as StableGenieSwap, k as StableGenieSwapProps, l as StableGenieTheme, m as SuccessInfo, n as SupportedAsset, o as darkTheme, p as lightTheme, q as mount, r as resolveTheme } from './mount-jxrT-DMe.js';
|
|
2
2
|
export { Engine, createEngine } from './core/index.js';
|
|
3
|
-
export { E as EngineConfig, P as Plan, R as RouteResult, S as SanitizedTxEntry, T as TxHistoryEntry, V as VerifyResult } from './verify-
|
|
3
|
+
export { E as EngineConfig, P as Plan, R as RouteResult, S as SanitizedTxEntry, T as TxHistoryEntry, V as VerifyResult } from './verify-7lk90Ado.js';
|
|
4
4
|
import 'react';
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-
|
|
2
|
-
export { createEngine } from './chunk-
|
|
1
|
+
export { PaymentIsland, StableGenieExchange, StableGeniePay, StableGenieProvider, StableGenieSwap, darkTheme, lightTheme, mount, resolveTheme } from './chunk-NSH3PT2J.js';
|
|
2
|
+
export { createEngine } from './chunk-OOURZ5DL.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, R as RouteResult, S as SanitizedTxEntry } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, R as RouteResult, S as SanitizedTxEntry } from './verify-7lk90Ado.cjs';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { P as Plan, V as VerifyResult, R as RouteResult, S as SanitizedTxEntry } from './verify-
|
|
3
|
+
import { P as Plan, V as VerifyResult, R as RouteResult, S as SanitizedTxEntry } from './verify-7lk90Ado.js';
|
|
4
4
|
|
|
5
5
|
interface Eip1193Provider {
|
|
6
6
|
request(args: {
|