@glacislabs/stablegenie-zerodelta 4.18.2 → 4.19.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.
@@ -209,6 +209,276 @@ interface ScreeningBucket {
209
209
  /** The three groups, in escalating-permissiveness order. Mirrors the dApp's `SCREENING_BUCKETS`. */
210
210
  declare const SCREENING_BUCKETS: readonly ScreeningBucket[];
211
211
 
212
+ /** One step of zd-api-v2's public `execution.order` (provider fields stripped). */
213
+ interface ZdHeavyStepJson {
214
+ kind: string;
215
+ chainId: number;
216
+ tokenIn?: string;
217
+ tokenOut?: string;
218
+ expectedIn?: string;
219
+ minOut?: string;
220
+ allowances?: {
221
+ pathwayId: number;
222
+ maxShareBps: number;
223
+ params?: string;
224
+ }[];
225
+ token?: string;
226
+ receiver?: string;
227
+ minAmountOut?: string;
228
+ dstChainId?: number;
229
+ receiverChainId?: number;
230
+ bridgeAdapters?: number[];
231
+ maxFee?: string;
232
+ inUnit?: string;
233
+ outUnit?: string;
234
+ minIn?: string;
235
+ amountOut?: string;
236
+ pathwayId?: number;
237
+ arriveStep?: number;
238
+ terms?: {
239
+ nettingDeadline: number;
240
+ dstAsset: string;
241
+ inUnit: string;
242
+ outUnit: string;
243
+ complianceClass?: number;
244
+ };
245
+ }
246
+ /** zd-api-v2's public `execution.order` for a `zdheavy` option. */
247
+ interface ZdHeavyOrderJson {
248
+ protocol?: string;
249
+ chainNumber: number;
250
+ router: string;
251
+ tokenIn: string;
252
+ grossIn: string;
253
+ amountIn: string;
254
+ fee: {
255
+ input: string;
256
+ native: string;
257
+ };
258
+ steps: ZdHeavyStepJson[];
259
+ expiresAt: number;
260
+ expiryDate: number;
261
+ }
262
+ /** What the card holds the bytes to. Everything here comes from the picker and the wallet, except `order` and `rootHash`, which are the same quote option the card was drawn from. */
263
+ interface ZdHeavyExpected {
264
+ /** The source chain picked (HAL-08). */
265
+ chainId: number;
266
+ /** The router `checkZdHeavyRouter` accepted. */
267
+ router: string;
268
+ /** The connected wallet (HAL-09). */
269
+ owner: string;
270
+ /** The receiver the card derived. */
271
+ receiver: string;
272
+ fromToken: string;
273
+ toToken: string;
274
+ toChainId: number;
275
+ /** What was typed, in base units: everything that leaves the wallet (amountIn + fee.input). */
276
+ amountRaw: bigint;
277
+ /** The amount the card shows the user receiving. The signed floor must equal it. */
278
+ finalAmount: bigint;
279
+ order: ZdHeavyOrderJson | undefined;
280
+ rootHash: string | undefined;
281
+ /** The quote's partner marker, or absent for none. */
282
+ partnerId?: string | null;
283
+ /**
284
+ * For a REMOTE_PAYOUT terminal: whether `token` on `chainId` (the chain the payout runs on)
285
+ * delivers the picked `toToken` on `toChainId`. Absent ⇒ every cross-chain payout is refused.
286
+ */
287
+ remotePayoutToken?: (token: string, chainId: number) => boolean;
288
+ nowSec: number;
289
+ }
290
+
291
+ /** One leg boundary on an option's path (zd-dapp `RouteHop`): what the row prints is `ticker`. */
292
+ interface CompareHop {
293
+ address: string;
294
+ chainId: number;
295
+ ticker: string;
296
+ }
297
+ /** One option the gateway returned, as the comparison reads it (zd-dapp `RouteOption`). */
298
+ interface CompareOption {
299
+ /** Stable across re-quotes of the same option (zd-dapp `zdHeavyOptionKey` / the path for ZD Lite). */
300
+ id: string;
301
+ /** zd-api-v2 `label`: `cheapest` | `fastest` | `balanced`, or a ZD Heavy role. */
302
+ label?: string;
303
+ /**
304
+ * Set when the option cannot be signed: a ZD Heavy option's zd-api-v2 `payloadStatus`, or
305
+ * `refused-by-widget` when the route built from it failed one of this widget's own checks.
306
+ */
307
+ unavailable?: string;
308
+ /** Delivered amount in destination units — `finalAmount`, not `toAmount`. */
309
+ amount: number;
310
+ /** The same amount in the destination token's base units. */
311
+ amountRaw: string;
312
+ estimatedDuration: number;
313
+ /** ZeroDelta's fee on the option in USD, or null when it cannot be stated (see `priceCompareOptions`). */
314
+ feeUsd: number | null;
315
+ /** The gateway's `zeroDeltaFeeCentibips` when it is a non-negative integer. */
316
+ feeCentibips?: number;
317
+ /** The fee has a source-chain native part (`zeroDeltaFeeNative` > 0): no single USD figure exists. */
318
+ feeNative?: boolean;
319
+ /** From token → … → to token. */
320
+ hops: CompareHop[];
321
+ /** `transfer`: the dapp's self-executing option. The widget's gateway reads never produce one. */
322
+ kind?: "transfer";
323
+ /** zd-api-v2 `entersNetting`: filled against an opposite order, so the amount depends on a match. */
324
+ entersNetting?: boolean;
325
+ /** The option's gas is sponsored (`gasSponsored`, not sent by zd-api-v2 today). */
326
+ gasSponsored?: boolean;
327
+ }
328
+ /** The slider's range: 3 minutes to 2 hours (Figma "3 min" … "2 hours"). */
329
+ declare const WAIT_MIN_SEC = 180;
330
+ declare const WAIT_MAX_SEC = 7200;
331
+ declare const WAIT_STEP_SEC = 60;
332
+ declare function clampWait(sec: number): number;
333
+ /**
334
+ * The slider's scale is not linear: it is piecewise linear through the points Figma draws, measured on
335
+ * the frames' own pixels (404px track, 400px of it travel): 30 min at 118px (0.295, frame 3084:15345)
336
+ * and 45 min at 189px (0.4725, frames 3082:9147 and 3055:15990), between the two ends. Strictly
337
+ * increasing, so `waitFraction` and `waitFromFraction` are exact inverses.
338
+ */
339
+ type WaitScale = ReadonlyArray<readonly [sec: number, fraction: number]>;
340
+ /**
341
+ * The scale on a track `travelPx` wide (its width less the 2px insets). Figma draws the same PIXEL
342
+ * offsets on the phone track as on the desktop one (30 min at 118px, 45 min at 189px, frames 2172:26912
343
+ * and 3082:9147), so the two inner points keep their desktop pixels and only the stretch up to 2 hours
344
+ * gives way. On a track as wide as the desktop one it is `WAIT_POINTS` itself.
345
+ */
346
+ declare function waitScaleFor(travelPx: number): WaitScale;
347
+ /** How many positions the native range input has: it is linear in the drawn thumb, not in seconds. */
348
+ declare const WAIT_POSITIONS = 1000;
349
+ /** Where `sec` sits on the slider, 0…1. */
350
+ declare function waitFraction(sec: number, points?: WaitScale): number;
351
+ /** The wait at a slider position, 0…1: the inverse of `waitFraction`, not yet snapped to whole minutes. */
352
+ declare function waitFromFraction(fraction: number, points?: WaitScale): number;
353
+ /** A wait snapped to the slider's whole minutes. */
354
+ declare function snapWait(sec: number): number;
355
+ /**
356
+ * The slider's right-hand label: "Up to 45 min". Figma writes minutes as "45 min" and the slider's
357
+ * own end as "2 hours", so a whole number of hours reads like that end label ("Up to 2 hours")
358
+ * and everything else stays in minutes.
359
+ */
360
+ declare function waitLabel(sec: number): string;
361
+ /** The options a holder can pick: every one that can be signed. */
362
+ declare function selectableOptions(options: readonly CompareOption[]): CompareOption[];
363
+ /** The selectable option that delivers the most; the earlier one on a tie. */
364
+ declare function bestOutputOption(options: readonly CompareOption[]): CompareOption | undefined;
365
+ /**
366
+ * The fastest selectable option: the one the gateway labels `fastest`, else the one with the
367
+ * shortest stated time. Undefined when no option states a time.
368
+ */
369
+ declare function fastestOption(options: readonly CompareOption[]): CompareOption | undefined;
370
+ /** The slider's proposed default (Figma 3082:9147): the best-output option's time. */
371
+ declare function proposedWait(options: readonly CompareOption[]): number;
372
+ /**
373
+ * What the slider picks for a wait: the best-output selectable option that arrives within it,
374
+ * else the fastest one. Options beyond the wait stay listed; this only chooses.
375
+ */
376
+ declare function pickForWait(options: readonly CompareOption[], waitSec: number): CompareOption | undefined;
377
+ /** The most cards the modal draws (owner L5, Figma 3084:15345): fastest, the pick for the wait, gasless/netting. */
378
+ declare const MAX_QUOTE_CARDS = 3;
379
+ /**
380
+ * The options the modal draws, in the gateway's order: at most three, the fastest, the one chosen
381
+ * for the wait (`selectedId` when it is selectable, else what the slider would pick) and the
382
+ * gasless one, then the netting one if a slot is left (best output each). One option that is several of
383
+ * these is drawn once, so there can be fewer than three. The rest stay reachable by moving the
384
+ * slider. When nothing can be signed, the first three are drawn so their reasons stay readable.
385
+ */
386
+ declare function visibleOptions(options: readonly CompareOption[], waitSec: number, selectedId?: string | null): CompareOption[];
387
+ /**
388
+ * Time as the cards and the 1:1 marker print it: whole minutes from a minute up ("~1 min", as
389
+ * Figma always writes it), seconds only below one.
390
+ */
391
+ declare function compareDuration(seconds: number): string;
392
+ /**
393
+ * The 1:1 marker. `at`: the earliest selectable option whose output is worth at least the input in
394
+ * USD. `unavailable`: no option reaches it ("1:1 currently unavailable"). `unknown`: a price is
395
+ * missing, so nothing can be said either way and the marker is not drawn.
396
+ */
397
+ type Parity = {
398
+ kind: "at";
399
+ option: CompareOption;
400
+ timeSec: number;
401
+ } | {
402
+ kind: "unavailable";
403
+ } | {
404
+ kind: "unknown";
405
+ };
406
+ declare function parity(options: readonly CompareOption[], inputUsd: number | null | undefined, toUnitUsd: number | null | undefined): Parity;
407
+ /**
408
+ * "Potential extra received": the selected option's output less the fastest option's, in the
409
+ * destination token. Null when it is not more (nothing to show).
410
+ */
411
+ declare function extraVsFastest(options: readonly CompareOption[], selectedId: string | null | undefined): number | null;
412
+ /** Ranking labels, in the order the design assigns them (zd-dapp `RouteBadge`). */
413
+ type RouteBadge = "Best return" | "Fastest" | "Lowest fee";
414
+ /**
415
+ * The pill each option wears (zd-dapp `routeBadges`). A RANKING, so it means nothing over a field of
416
+ * one: with a single option the map is empty and `routeShapeLabel` says what the path IS. Ties go to
417
+ * the earlier option.
418
+ */
419
+ declare function routeBadges(options: readonly CompareOption[]): Map<string, RouteBadge>;
420
+ /** What the path is: `Transfer`, `Direct`, or `Via USDT · USDe` (zd-dapp `routeShapeLabel`). */
421
+ declare function routeShapeLabel(option: CompareOption | undefined): string | null;
422
+ type TagTone = "brand" | "green" | "purple";
423
+ interface CornerTag {
424
+ text: string;
425
+ tone: TagTone;
426
+ }
427
+ /**
428
+ * The tag in an option card's corner (Figma 3082:9147). In order of precedence: `Target 1:1` on
429
+ * the parity option; `Potential best return` on any other netting option; `Fastest` on the option
430
+ * the gateway labels so; `Gasless` on a sponsored one; otherwise the existing ranking
431
+ * (`routeBadges`: Best return / Fastest / Lowest fee, or the path's shape when there is one
432
+ * option). A netting option adds `Netting`. An option that cannot be signed wears none.
433
+ */
434
+ declare function cornerTags(options: readonly CompareOption[], option: CompareOption, parityState: Parity): CornerTag[];
435
+ /**
436
+ * An option's amount as the cards print it: at least two decimals, as Figma draws them
437
+ * ("800.00", "797.50"), and up to six when the options differ further down — two cards must
438
+ * never read the same when the gateway quoted different amounts.
439
+ */
440
+ declare function compareAmount(value: number): string;
441
+ /**
442
+ * ZeroDelta's fee in USD (zd-dapp `orderRoute`): a 0 fee is $0 whatever the price; an unstated fee,
443
+ * a native part, or a non-zero fee with no input price stays null rather than printing `$0.00`.
444
+ */
445
+ declare function compareFeeUsd(option: Pick<CompareOption, "feeCentibips" | "feeNative">, fromUsd?: number | null): number | null;
446
+ /** The options with `feeUsd` stated against the input's USD value (`fromUsd`, display only). */
447
+ declare function priceCompareOptions(options: readonly CompareOption[], fromUsd?: number | null): CompareOption[];
448
+ /** zd-dapp `zdHeavyOptionKey`: the label and router name the same option from one quote to the next. */
449
+ declare const ZD_HEAVY_KEY_PREFIX = "zdheavy:";
450
+ declare function zdHeavyOptionKey(q: Pick<Quote, "label" | "escrowAddress" | "optionId">): string;
451
+ /** zd-dapp `zdHeavyUnavailableStatus`: the status of an option that cannot be signed, or undefined. */
452
+ declare function zdHeavyUnavailableStatus(q: Quote): string | undefined;
453
+ /** What a hop is called when the registry does not list it, and the two ends the caller knows. */
454
+ interface CompareContext {
455
+ tokens?: readonly Token[];
456
+ from: {
457
+ chainId: number;
458
+ address: string;
459
+ ticker: string;
460
+ };
461
+ to: {
462
+ chainId: number;
463
+ address: string;
464
+ ticker: string;
465
+ decimals: number;
466
+ };
467
+ }
468
+ /** zd-dapp `routeHops`: the path a quote option takes, from its order requests or its ZD Heavy steps. */
469
+ declare function compareHops(quote: Quote, ctx: CompareContext): CompareHop[];
470
+ /** One gateway option as a comparison row (zd-dapp `orderRoute`), or null when nothing can be stated. */
471
+ declare function compareOptionOf(quote: Quote, ctx: CompareContext): CompareOption | null;
472
+ /**
473
+ * Every option the gateway returned for this quote, in the gateway's order (zd-dapp `routeOptions`),
474
+ * one row per id. `byIndex[i]` is the row of `gatewayOptions[i]` (null when it was not listed). A flat
475
+ * response yields its own single row.
476
+ */
477
+ declare function compareOptionsOf(quote: Quote, ctx: CompareContext): {
478
+ options: CompareOption[];
479
+ byIndex: (CompareOption | null)[];
480
+ };
481
+
212
482
  type Hex = `0x${string}`;
213
483
  type Address = `0x${string}`;
214
484
  interface Chain {
@@ -306,7 +576,47 @@ interface NormalizedOrder {
306
576
  executionChainId: string;
307
577
  deadline: string;
308
578
  }
309
- interface Quote {
579
+ interface GatewayEvmTx {
580
+ actionType: string;
581
+ chainId: string | number;
582
+ to: string;
583
+ data: string;
584
+ value: string;
585
+ }
586
+ interface QuoteOption {
587
+ protocol?: string;
588
+ payloadStatus?: string;
589
+ execution?: {
590
+ order?: ZdHeavyOrderJson;
591
+ };
592
+ rootHash?: string;
593
+ txData?: GatewayEvmTx[];
594
+ orderRequests?: OrderRequest[] | null;
595
+ estimatedTimeSec?: number;
596
+ estimatedDuration?: number;
597
+ [k: string]: unknown;
598
+ }
599
+ interface Quote extends QuoteOption {
600
+ options?: QuoteOption[];
601
+ /** zd-api-v2: the option's own id (minted anew on every quote). */
602
+ optionId?: string;
603
+ /** zd-api-v2: `cheapest` | `fastest` | `balanced` (or a ZD Heavy role such as `NET`). */
604
+ label?: string;
605
+ /** zd-api-v2: the option is filled by matching it against an opposite order (netting), so its
606
+ * output depends on a match. Present only as `true`, as the ZeroDelta dapp carries it. */
607
+ entersNetting?: boolean;
608
+ /** The option's gas is sponsored: the wallet needs no native token. zd-api-v2 does not send it
609
+ * today; present only as `true`, as the ZeroDelta dapp carries it. */
610
+ gasSponsored?: boolean;
611
+ /**
612
+ * EVERY option the gateway returned, in the gateway's order, each projected exactly as the
613
+ * selected one is (`selectQuoteOption`). Read by the quote comparison (`core/quote-compare.ts`)
614
+ * and by `buildRoute` to offer the other signable options; nothing here is signed unless a route
615
+ * built from it passes every check on its own. Absent on a flat (legacy Lite) response.
616
+ */
617
+ gatewayOptions?: Quote[];
618
+ /** Which entry of `gatewayOptions` this quote is. */
619
+ gatewayOptionIndex?: number;
310
620
  fromChainId: number;
311
621
  toChainId: number;
312
622
  fromToken: string;
@@ -426,6 +736,14 @@ interface RouteLeg {
426
736
  executionChainName: string;
427
737
  }
428
738
  interface RouteResult {
739
+ /** Gateway-built router order, held to selection again before any allowance is sent. */
740
+ zdHeavy?: {
741
+ order: ZdHeavyOrderJson;
742
+ rootHash: string;
743
+ amountRaw: string;
744
+ finalAmount: string;
745
+ floor: string;
746
+ };
429
747
  id: string;
430
748
  recommended: boolean;
431
749
  state: "DIRECT" | "ROUTE" | "SHORT";
@@ -452,6 +770,20 @@ interface RouteResult {
452
770
  };
453
771
  routeLabel: string;
454
772
  deltaLabel: string;
773
+ /**
774
+ * Every option the gateway returned on this route's quote, in its order, as the quote comparison
775
+ * reads them (`core/quote-compare.ts`). Absent on a direct transfer, which never reaches `/quote`.
776
+ * Display and choice only: nothing in it is signed.
777
+ */
778
+ options?: CompareOption[];
779
+ /** Which entry of `options` this route signs. */
780
+ selectedOptionId?: string;
781
+ /**
782
+ * The route built from each OTHER signable option of the same quote, every binding check passed on
783
+ * its own, with this route's `id`. Picking an option signs its alternative instead of this route.
784
+ * An alternative carries `options` but never `alternatives` of its own.
785
+ */
786
+ alternatives?: RouteResult[];
455
787
  /** Every order this route submits, first to last. Length 1 for a direct transfer or a plain swap,
456
788
  * >= 2 for a chained (RWA) quote. Never empty. */
457
789
  legs: RouteLeg[];
@@ -608,6 +940,131 @@ interface EngineConfig {
608
940
  }
609
941
  type FetchQuoteFn = (body: Record<string, unknown>, retries?: number) => Promise<Quote>;
610
942
 
943
+ type PromotionKind = "token" | "pair";
944
+ type PromotionFunder = "issuer" | "zerodelta";
945
+ interface PromotionToken {
946
+ chainId: number;
947
+ address: string;
948
+ symbol: string;
949
+ }
950
+ interface Promotion {
951
+ id: string;
952
+ kind: PromotionKind;
953
+ destination: PromotionToken;
954
+ /** Present on a `pair` promotion only: the token that must be paid. */
955
+ source?: PromotionToken;
956
+ bonusCentibips: number;
957
+ /** Cap on the bonus, in the destination token's base units. */
958
+ maxBonusAmount?: string;
959
+ fundedBy: PromotionFunder;
960
+ funderName?: string;
961
+ startsAt: string;
962
+ endsAt: string;
963
+ }
964
+ declare const CENTIBIPS_PER_UNIT = 1000000;
965
+ /**
966
+ * One row from the wire, or `undefined` when it is malformed or not running at `now`. The gateway
967
+ * already serves only active, registry-checked rows; this is the boundary check applied to every
968
+ * gateway list, so a bad row is dropped rather than drawn.
969
+ */
970
+ declare function parsePromotion(raw: unknown, now?: number): Promotion | undefined;
971
+ /** Every well-formed row running at `now`. Anything but an array is no promotions. */
972
+ declare function parsePromotions(rows: unknown, now?: number): Promotion[];
973
+ /** `10000` → `1%`, `9000` → `0.9%`, `150` → `0.015%`. */
974
+ declare function bonusPercentLabel(centibips: number): string;
975
+ /** Hex addresses compare case-insensitively; base58 keys are case-sensitive. */
976
+ declare function sameAddress(a: string, b: string): boolean;
977
+ interface PromotedNetwork {
978
+ promotion: Promotion;
979
+ chainId: number;
980
+ address: string;
981
+ bonusCentibips: number;
982
+ }
983
+ interface PromotedAsset {
984
+ symbol: string;
985
+ /** The best rate across the asset's networks ("Up to 1% bonus"). */
986
+ maxCentibips: number;
987
+ /** Best first. */
988
+ networks: PromotedNetwork[];
989
+ fundedBy: PromotionFunder;
990
+ }
991
+ /**
992
+ * Token promotions grouped per destination asset, for "Bonus offers" and "Promoted tokens". Grouped
993
+ * by symbol for DISPLAY only; every action below acts on a network row, which carries its own chain
994
+ * and address. Pair promotions are not listed here: they apply to one source only and appear where
995
+ * that pair is chosen.
996
+ */
997
+ declare function promotedAssets(promotions: Promotion[]): PromotedAsset[];
998
+ interface SwapEnds {
999
+ fromChainId?: number;
1000
+ fromAddress?: string;
1001
+ toChainId: number;
1002
+ toAddress: string;
1003
+ }
1004
+ /**
1005
+ * The best promotion that applies to this swap: a `pair` promotion when the paid token is its
1006
+ * source, otherwise a `token` promotion on the destination.
1007
+ */
1008
+ declare function promotionFor(promotions: Promotion[], ends: SwapEnds): Promotion | undefined;
1009
+ /** Pair promotions whose destination is this deployment ("Swap bonus"). */
1010
+ declare function pairPromotionsInto(promotions: Promotion[], chainId: number, address: string): Promotion[];
1011
+ /**
1012
+ * The bonus on `amount` (base units of the destination token), capped by the promotion's
1013
+ * `maxBonusAmount`. An ESTIMATE for display ("≈ +7.20 PYUSD"): the quote decides what is paid.
1014
+ */
1015
+ declare function estimateBonus(amount: bigint, promotion: Pick<Promotion, "bonusCentibips" | "maxBonusAmount">): bigint;
1016
+ /** "Issuer-funded bonus" / "Funded by ZeroDelta" / "Funded by PayPal". */
1017
+ declare function fundedByLabel(p: Pick<Promotion, "fundedBy" | "funderName">): string;
1018
+ /** Both ends are USD stablecoins, so one unit of either is worth about a dollar. */
1019
+ declare function usdStablePair(a: string | undefined, b: string | undefined): boolean;
1020
+ interface BonusInputs {
1021
+ /** The deployment the bonus is paid in. */
1022
+ destination: PromotionToken & {
1023
+ decimals: number;
1024
+ };
1025
+ /** The current quote's delivered amount and the deployment it delivers. */
1026
+ quote?: {
1027
+ amount: number;
1028
+ symbol: string;
1029
+ chainId: number;
1030
+ address: string;
1031
+ } | null;
1032
+ /** What the visitor typed and the token they pay with. */
1033
+ typed?: {
1034
+ amount: string;
1035
+ symbol: string;
1036
+ } | null;
1037
+ }
1038
+ /**
1039
+ * The bonus figure, in the destination's base units, or null when no honest
1040
+ * figure exists and only the percentage may be shown.
1041
+ *
1042
+ * Over the current quote's output when there is one that measures this asset —
1043
+ * the same deployment, or a USD stablecoin into a USD stablecoin, where an
1044
+ * amount of one is an amount of the other. Otherwise over the typed amount, but
1045
+ * only when the paid token and the bonus token are both USD stablecoins. Never
1046
+ * a conversion through a price: an estimate that needed one would be a guess.
1047
+ */
1048
+ declare function bonusFigure(promotion: Pick<Promotion, "bonusCentibips" | "maxBonusAmount">, inputs: BonusInputs): bigint | null;
1049
+ interface InsteadFigures {
1050
+ /** The bonus in the destination's base units. */
1051
+ bonus: bigint;
1052
+ /** What was sent read 1:1 in the destination token, plus the bonus. Independent of the selected option. */
1053
+ total: number;
1054
+ /** The total less the selected option's delivered amount; null when it is not more (or nothing is selected). */
1055
+ more: number | null;
1056
+ }
1057
+ /**
1058
+ * The "Receive X instead?" card's figures (Figma `3086:15522`: 800 sent gives bonus +8.00, total
1059
+ * 808.00; with 799.20 selected, "≈$8.80 more"). An estimate over what was SENT, read at 1:1 in the
1060
+ * bonus token, so, like `bonusFigure`, only between USD stablecoins; null otherwise (the card then
1061
+ * states the rate alone). The total never depends on which option is selected; "more" does.
1062
+ */
1063
+ declare function insteadFigures(promotion: Pick<Promotion, "bonusCentibips" | "maxBonusAmount">, destination: BonusInputs["destination"], typed: {
1064
+ amount: string;
1065
+ symbol: string;
1066
+ } | null | undefined, selectedAmount: number | null): InsteadFigures | null;
1067
+
611
1068
  /**
612
1069
  * The shapes the gateway would refuse anyway, checked here so a bad value costs
613
1070
  * no request.
@@ -1122,6 +1579,12 @@ interface ApiClient {
1122
1579
  */
1123
1580
  fetchPrices?: (symbols: readonly string[]) => Promise<Record<string, number>>;
1124
1581
  fetchQuote: (body: Record<string, unknown>, retries?: number) => Promise<Quote>;
1582
+ /**
1583
+ * The gateway's bonus offers (`GET /promotions`), parsed at the boundary. Display only — whether a
1584
+ * bonus is paid is the quote's to decide. NEVER rejects: any failure is no promotions. Optional on
1585
+ * the type for the same reason `fetchPrices` is.
1586
+ */
1587
+ fetchPromotions?: () => Promise<Promotion[]>;
1125
1588
  /**
1126
1589
  * Standalone KYW screen of ONE address — the direct-settlement gate.
1127
1590
  *
@@ -1178,6 +1641,7 @@ interface BalanceEntry {
1178
1641
  formatted: string;
1179
1642
  }
1180
1643
  interface Verifier {
1644
+ readZdHeavySubmitFee: (chainId: number, to: string, data: string) => Promise<bigint | undefined>;
1181
1645
  payerNonceBaseline: (chainId: number, account: string) => Promise<number | null>;
1182
1646
  verifySubmittedTx: (args: {
1183
1647
  chainId: number;
@@ -1198,4 +1662,4 @@ interface Verifier {
1198
1662
  }
1199
1663
  declare function createVerifier(api: ApiClient, fetchImpl: typeof fetch, rpcOverrides?: Record<number, string>): Verifier;
1200
1664
 
1201
- export { type Destination as $, type Availability as A, type BrokenLane as B, type Compliance as C, type Verifier as D, type EngineConfig as E, type FetchQuoteFn as F, type Address as G, type ApiError as H, BLOCK_LABEL_DEFAULT as I, COMPLIANCE_CHECK_ORDER as J, COMPLIANCE_DENY_LABEL as K, type LaneLimit as L, type CatalogueContext as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, type CatalogueInput as U, type VerifyResult as V, type WalletScreen as W, type ComplianceCheckId as X, type ComplianceDecision as Y, DIRECT_CHECK_IDS as Z, DIRECT_SCOPE_NOTE as _, type Catalogue as a, FLOOR_CATEGORIES as a0, type Hex as a1, type LaneAvailabilityState as a2, type PlannedTxKind as a3, type QuoteBlock as a4, type ResolvedConfig as a5, type RouteHealth as a6, type RouteHealthAvailability as a7, type RouteHealthLane as a8, SCREENING_BUCKETS as a9, hubDeliverableSymbols as aA, isExecutableBridge as aB, isKnownUnbridgeable as aC, isSellableRwa as aD, isSourceToken as aE, laneAvailabilityState as aF, laneKey as aG, laneKeys as aH, laneLimitAmount as aI, laneLimitError as aJ, laneLimitFor as aK, laneLimitHint as aL, laneLimitSymbol as aM, limitedLanes as aN, parseAllowedApiBase as aO, productAssets as aP, registryRpc as aQ, resolveApiBase as aR, resolveConfig as aS, screeningOutcomeOf as aT, sourceKeys as aU, suppressedLanes as aV, tokenKey as aW, txMatchesPlan as aX, unattributedComplianceReasons as aY, type ScreenProvider as aa, type ScreeningBucket as ab, type ScreeningOutcome as ac, TUNABLE_CATEGORIES as ad, type TxPlan as ae, amountFieldError as af, apiError as ag, blockLabelFor as ah, brokenLaneFor as ai, buildCatalogue as aj, canAttachApiKey as ak, categoryLabel as al, classifyQuoteError as am, complianceControlsEvaluated as an, complianceReasonHead as ao, complianceReasonTag as ap, complianceTagOf as aq, createApiClient as ar, createVerifier as as, destinationKeys as at, directComplianceFromScreens as au, distinctScreenedWallets as av, exceedsLaneLimit as aw, executableRoutes as ax, executionChainIds as ay, hasReachableDestination as az, type Chain as b, type ComplianceCheck as c, type ComplianceTone as d, type ComplianceView as e, type ExchangeProduct as f, type RouteLeg as g, type RouteResult as h, type TxHistoryEntry as i, assetClassOf as j, brokenLaneReason as k, complianceChecks as l, complianceControlsLine as m, complianceView as n, counterpartTokens as o, destinationAvailability as p, formatJurisdiction as q, humanizeComplianceReason as r, type ApiClient as s, type SwapInput as t, type PayOption as u, type RwaVault as v, type SolveResult as w, type BalanceTarget as x, type BalanceEntry as y, type PlannedTx as z };
1665
+ export { type CompareContext as $, type Availability as A, type BrokenLane as B, type Compliance as C, type Verifier as D, type EngineConfig as E, type FetchQuoteFn as F, type Promotion as G, type Address as H, type ApiError as I, BLOCK_LABEL_DEFAULT as J, type BonusInputs as K, type LaneLimit as L, CENTIBIPS_PER_UNIT as M, type NormalizedOrder as N, type OrderRequest as O, type Plan as P, type Quote as Q, type Route as R, type SanitizedTxEntry as S, type Token as T, COMPLIANCE_CHECK_ORDER as U, type VerifyResult as V, type WalletScreen as W, COMPLIANCE_DENY_LABEL as X, type CatalogueContext as Y, type ZdHeavyExpected as Z, type CatalogueInput as _, type Catalogue as a, complianceTagOf as a$, type CompareHop as a0, type CompareOption as a1, type ComplianceCheckId as a2, type ComplianceDecision as a3, type CornerTag as a4, DIRECT_CHECK_IDS as a5, DIRECT_SCOPE_NOTE as a6, type Destination as a7, FLOOR_CATEGORIES as a8, type GatewayEvmTx as a9, WAIT_MAX_SEC as aA, WAIT_MIN_SEC as aB, WAIT_POSITIONS as aC, WAIT_STEP_SEC as aD, type WaitScale as aE, ZD_HEAVY_KEY_PREFIX as aF, amountFieldError as aG, apiError as aH, bestOutputOption as aI, blockLabelFor as aJ, bonusFigure as aK, bonusPercentLabel as aL, brokenLaneFor as aM, buildCatalogue as aN, canAttachApiKey as aO, categoryLabel as aP, clampWait as aQ, classifyQuoteError as aR, compareAmount as aS, compareDuration as aT, compareFeeUsd as aU, compareHops as aV, compareOptionOf as aW, compareOptionsOf as aX, complianceControlsEvaluated as aY, complianceReasonHead as aZ, complianceReasonTag as a_, type Hex as aa, type InsteadFigures as ab, type LaneAvailabilityState as ac, MAX_QUOTE_CARDS as ad, type Parity as ae, type PlannedTxKind as af, type PromotedAsset as ag, type PromotedNetwork as ah, type PromotionFunder as ai, type PromotionKind as aj, type PromotionToken as ak, type QuoteBlock as al, type QuoteOption as am, type ResolvedConfig as an, type RouteBadge as ao, type RouteHealth as ap, type RouteHealthAvailability as aq, type RouteHealthLane as ar, SCREENING_BUCKETS as as, type ScreenProvider as at, type ScreeningBucket as au, type ScreeningOutcome as av, type SwapEnds as aw, TUNABLE_CATEGORIES as ax, type TagTone as ay, type TxPlan as az, type Chain as b, cornerTags as b0, createApiClient as b1, createVerifier as b2, destinationKeys as b3, directComplianceFromScreens as b4, distinctScreenedWallets as b5, estimateBonus as b6, exceedsLaneLimit as b7, executableRoutes as b8, executionChainIds as b9, productAssets as bA, promotedAssets as bB, promotionFor as bC, proposedWait as bD, registryRpc as bE, resolveApiBase as bF, resolveConfig as bG, routeBadges as bH, routeShapeLabel as bI, sameAddress as bJ, screeningOutcomeOf as bK, selectableOptions as bL, snapWait as bM, sourceKeys as bN, suppressedLanes as bO, tokenKey as bP, txMatchesPlan as bQ, unattributedComplianceReasons as bR, usdStablePair as bS, visibleOptions as bT, waitFraction as bU, waitFromFraction as bV, waitLabel as bW, waitScaleFor as bX, zdHeavyOptionKey as bY, zdHeavyUnavailableStatus as bZ, extraVsFastest as ba, fastestOption as bb, fundedByLabel as bc, hasReachableDestination as bd, hubDeliverableSymbols as be, insteadFigures as bf, isExecutableBridge as bg, isKnownUnbridgeable as bh, isSellableRwa as bi, isSourceToken as bj, laneAvailabilityState as bk, laneKey as bl, laneKeys as bm, laneLimitAmount as bn, laneLimitError as bo, laneLimitFor as bp, laneLimitHint as bq, laneLimitSymbol as br, limitedLanes as bs, pairPromotionsInto as bt, parity as bu, parseAllowedApiBase as bv, parsePromotion as bw, parsePromotions as bx, pickForWait as by, priceCompareOptions as bz, type ComplianceCheck as c, type ComplianceTone as d, type ComplianceView as e, type ExchangeProduct as f, type RouteLeg as g, type RouteResult as h, type TxHistoryEntry as i, assetClassOf as j, brokenLaneReason as k, complianceChecks as l, complianceControlsLine as m, complianceView as n, counterpartTokens as o, destinationAvailability as p, formatJurisdiction as q, humanizeComplianceReason as r, type ApiClient as s, type SwapInput as t, type PayOption as u, type RwaVault as v, type SolveResult as w, type BalanceTarget as x, type BalanceEntry as y, type PlannedTx as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glacislabs/stablegenie-zerodelta",
3
- "version": "4.18.2",
3
+ "version": "4.19.0",
4
4
  "description": "Lightweight embeddable ZeroDelta payment + swap widget (exact-receive Pay and exact-in Swap). Wallet always owns the final signature.",
5
5
  "type": "module",
6
6
  "license": "MIT",