@glacislabs/stablegenie-zerodelta 3.0.1 → 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.
@@ -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, A as ApiClient, P as Plan, e as SwapInput, f as PlannedTx, g as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-CaO0OD4Z.cjs';
2
- export { h as Address, i as ApiError, B as BalanceEntry, j as BalanceTarget, 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-CaO0OD4Z.cjs';
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.cjs';
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.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. */
@@ -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 = "0xbbd71141";
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
- declare function encodeSubmitOrder(order: NormalizedOrder): string;
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;
@@ -180,11 +233,15 @@ interface PayRequest {
180
233
  asset: string;
181
234
  amount: string;
182
235
  }
236
+ interface PaymentWalletContext {
237
+ chainId?: number;
238
+ /** Host-approved assets that may fund this payment. Direct settlement remains available. */
239
+ fundingAssets?: string[];
240
+ }
241
+ type BalanceReader = (account: string, targets: BalanceTarget[]) => Promise<Record<string, BalanceEntry>>;
183
242
  declare function validateDestination(destination: PayRequest): void;
184
243
  declare function planErrorSummary(errors: unknown[]): string;
185
- declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: {
186
- chainId?: number;
187
- }): Promise<Plan>;
244
+ declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: PaymentWalletContext, readBalances?: BalanceReader): Promise<Plan>;
188
245
 
189
246
  interface ValidatedSwap {
190
247
  fromChainId: number;
@@ -334,9 +391,7 @@ interface Engine {
334
391
  fetchTokens: ApiClient["fetchTokens"];
335
392
  fetchRoutes: ApiClient["fetchRoutes"];
336
393
  fetchQuote: ApiClient["fetchQuote"];
337
- fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: {
338
- chainId?: number;
339
- }) => Promise<Plan>;
394
+ fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
340
395
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
341
396
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
342
397
  chainId?: number;
@@ -350,4 +405,4 @@ interface Engine {
350
405
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
351
406
  declare function createEngine(config?: EngineConfig): Engine;
352
407
 
353
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, 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, 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 };
@@ -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, A as ApiClient, P as Plan, e as SwapInput, f as PlannedTx, g as Verifier, T as TxHistoryEntry, S as SanitizedTxEntry, E as EngineConfig } from '../verify-CaO0OD4Z.js';
2
- export { h as Address, i as ApiError, B as BalanceEntry, j as BalanceTarget, 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-CaO0OD4Z.js';
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 = "0xbbd71141";
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
- declare function encodeSubmitOrder(order: NormalizedOrder): string;
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;
@@ -180,11 +233,15 @@ interface PayRequest {
180
233
  asset: string;
181
234
  amount: string;
182
235
  }
236
+ interface PaymentWalletContext {
237
+ chainId?: number;
238
+ /** Host-approved assets that may fund this payment. Direct settlement remains available. */
239
+ fundingAssets?: string[];
240
+ }
241
+ type BalanceReader = (account: string, targets: BalanceTarget[]) => Promise<Record<string, BalanceEntry>>;
183
242
  declare function validateDestination(destination: PayRequest): void;
184
243
  declare function planErrorSummary(errors: unknown[]): string;
185
- declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: {
186
- chainId?: number;
187
- }): Promise<Plan>;
244
+ declare function fetchPaymentPlan(api: ApiClient, request: PayRequest, payer: string, wallet?: PaymentWalletContext, readBalances?: BalanceReader): Promise<Plan>;
188
245
 
189
246
  interface ValidatedSwap {
190
247
  fromChainId: number;
@@ -334,9 +391,7 @@ interface Engine {
334
391
  fetchTokens: ApiClient["fetchTokens"];
335
392
  fetchRoutes: ApiClient["fetchRoutes"];
336
393
  fetchQuote: ApiClient["fetchQuote"];
337
- fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: {
338
- chainId?: number;
339
- }) => Promise<Plan>;
394
+ fetchPaymentPlan: (request: PayRequest, payer: string, wallet?: PaymentWalletContext) => Promise<Plan>;
340
395
  quoteSwapPreview: (swap: SwapInput, owner?: string) => Promise<SwapPreview>;
341
396
  buildSwapPlan: (swap: SwapInput, payer: string, wallet?: {
342
397
  chainId?: number;
@@ -350,4 +405,4 @@ interface Engine {
350
405
  /** Create an engine bound to a config. The 60s resource cache is per-engine. */
351
406
  declare function createEngine(config?: EngineConfig): Engine;
352
407
 
353
- export { API_CACHE_TTL_MS, ApiClient, type AssertQuoteArgs, BUNDLED_NATIVE_SYMBOL, BUNDLED_RPC, 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, 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 };
@@ -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-VL5MWEY2.js';
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';