@glacislabs/stablegenie-zerodelta 4.2.1 → 4.4.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/dist/{chunk-FDCSZ3OY.js → chunk-53K3BXT5.js} +114 -13
- package/dist/{chunk-OOESQYM3.js → chunk-NYIORRFU.js} +115 -31
- package/dist/core/index.cjs +124 -12
- package/dist/core/index.d.cts +31 -7
- package/dist/core/index.d.ts +31 -7
- package/dist/core/index.js +1 -1
- package/dist/index.cjs +227 -42
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +2 -2
- package/dist/{mount-Bver3O2z.d.ts → mount-Blg-caPn.d.ts} +1 -1
- package/dist/{mount-Dtbtdry1.d.cts → mount-D8hY-a-s.d.cts} +1 -1
- package/dist/mount.cjs +227 -42
- package/dist/mount.d.cts +2 -2
- package/dist/mount.d.ts +2 -2
- package/dist/mount.js +2 -2
- package/dist/standalone.global.js +12 -6
- package/dist/{verify-57gjg_dM.d.cts → verify-C1VaWfiy.d.cts} +155 -9
- package/dist/{verify-57gjg_dM.d.ts → verify-C1VaWfiy.d.ts} +155 -9
- package/package.json +1 -1
|
@@ -300,6 +300,15 @@ interface Quote {
|
|
|
300
300
|
bridge?: string;
|
|
301
301
|
feeBps?: number;
|
|
302
302
|
estimatedDuration?: number;
|
|
303
|
+
/** How long the order should live, in seconds from quote time, for the lane the gateway just
|
|
304
|
+
* priced — derived server-side from this lane's `estimatedDuration`. Absent on a gateway that
|
|
305
|
+
* predates the field, in which case the widget keeps its own flat default. Advisory: the
|
|
306
|
+
* deadline is still the client's to sign, and `orderRequests[].deadline` still comes back "0".
|
|
307
|
+
* See `recommendedDeadlineSeconds` in `core/order.ts`. */
|
|
308
|
+
recommendedDeadlineSeconds?: number;
|
|
309
|
+
/** The same value as an absolute unix second (decimal string). Informational — the widget builds
|
|
310
|
+
* the deadline from the span so it is measured against the signer's own clock. */
|
|
311
|
+
recommendedDeadline?: string;
|
|
303
312
|
gasCostSource?: string;
|
|
304
313
|
gasCostDest?: string;
|
|
305
314
|
/** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
|
|
@@ -649,6 +658,30 @@ interface BrokenLane {
|
|
|
649
658
|
message: string;
|
|
650
659
|
kind?: string;
|
|
651
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* A lane the gateway says is tradeable only up to a measured amount right now — availability state
|
|
663
|
+
* `limited`, as {@link destinationAvailability}'s callers consume it. See `limitedLanes` in
|
|
664
|
+
* `core/route-health.ts`, which is the only producer.
|
|
665
|
+
*
|
|
666
|
+
* The limit names ONE hop of the lane: `bid` is the hop the payer's own amount travels (so the amount
|
|
667
|
+
* field can be checked against it before a quote is asked for); `ask` is the payout hop, which the
|
|
668
|
+
* payer does not type in the same units and which is therefore shown, never enforced, here.
|
|
669
|
+
*/
|
|
670
|
+
interface LaneLimit {
|
|
671
|
+
side: "bid" | "ask";
|
|
672
|
+
/** The gateway's name for the hop's token. Untrusted display text — print it through
|
|
673
|
+
* `laneLimitSymbol`, never directly. */
|
|
674
|
+
token: string;
|
|
675
|
+
fromChainId: number;
|
|
676
|
+
toChainId: number;
|
|
677
|
+
/** The most the hop can carry right now, in BASE UNITS of the hop's token (a decimal integer string). */
|
|
678
|
+
maxAmount: string;
|
|
679
|
+
/** Decimals `maxAmount` is denominated in. */
|
|
680
|
+
decimals: number;
|
|
681
|
+
/** The code `/quote` answers the lane with above the limit, e.g. `BRIDGE_RATE_LIMITED`. */
|
|
682
|
+
code: string;
|
|
683
|
+
measuredAt?: string;
|
|
684
|
+
}
|
|
652
685
|
interface CatalogueContext {
|
|
653
686
|
/** From {@link sourceKeys}. */
|
|
654
687
|
source: ReadonlySet<string>;
|
|
@@ -695,6 +728,12 @@ type Availability = "available" | "hub-only" | "unreachable";
|
|
|
695
728
|
* the destination alone would remove working routes to fix one broken one.
|
|
696
729
|
*/
|
|
697
730
|
declare function brokenLaneFor(token: Pick<Token, "chainId" | "address">, source: Pick<Token, "chainId" | "address"> | undefined, brokenLanes: ReadonlyMap<string, BrokenLane> | undefined): BrokenLane | undefined;
|
|
731
|
+
/**
|
|
732
|
+
* The published size limit for this exact (source, destination) pair, if the lane is `limited`.
|
|
733
|
+
* Keyed on both ends for the same reason {@link brokenLaneFor} is: a limit is a property of the
|
|
734
|
+
* hops a lane crosses, and the same destination reached from another source crosses other hops.
|
|
735
|
+
*/
|
|
736
|
+
declare function laneLimitFor(token: Pick<Token, "chainId" | "address">, source: Pick<Token, "chainId" | "address"> | null | undefined, limitedLanes: ReadonlyMap<string, LaneLimit> | undefined): LaneLimit | undefined;
|
|
698
737
|
/**
|
|
699
738
|
* Whether an ask token can actually be delivered on its own chain.
|
|
700
739
|
*
|
|
@@ -729,6 +768,9 @@ interface CatalogueInput {
|
|
|
729
768
|
supportedChainIds: ReadonlySet<number>;
|
|
730
769
|
/** Measured refusals; omit or pass an empty map to suppress nothing. */
|
|
731
770
|
brokenLanes?: ReadonlyMap<string, BrokenLane>;
|
|
771
|
+
/** Published size limits (`limitedLanes`); omit or pass an empty map to limit nothing. Carried
|
|
772
|
+
* through untouched — a limited lane stays offered, so it changes no verdict here. */
|
|
773
|
+
limitedLanes?: ReadonlyMap<string, LaneLimit>;
|
|
732
774
|
/** Vault artwork by symbol key (see `core/rwa-icons.ts`). Carried through untouched. */
|
|
733
775
|
vaultIcons?: ReadonlyMap<string, string>;
|
|
734
776
|
}
|
|
@@ -764,6 +806,12 @@ interface Catalogue extends CatalogueContext {
|
|
|
764
806
|
* published none.
|
|
765
807
|
*/
|
|
766
808
|
vaultIcons: ReadonlyMap<string, string>;
|
|
809
|
+
/**
|
|
810
|
+
* Lanes that are offered but tradeable only up to a measured amount right now, keyed by
|
|
811
|
+
* {@link laneKey}. Read it with {@link laneLimitFor}. Empty when the gateway publishes no
|
|
812
|
+
* availability (an older gateway), is in observe mode, or the health read failed.
|
|
813
|
+
*/
|
|
814
|
+
limitedLanes: ReadonlyMap<string, LaneLimit>;
|
|
767
815
|
}
|
|
768
816
|
/**
|
|
769
817
|
* Build the selectable catalogue from the live registry.
|
|
@@ -775,6 +823,24 @@ interface Catalogue extends CatalogueContext {
|
|
|
775
823
|
*/
|
|
776
824
|
declare function buildCatalogue(input: CatalogueInput): Catalogue;
|
|
777
825
|
|
|
826
|
+
/** A lane's availability as the gateway publishes it. Permissive: this is untrusted API data. */
|
|
827
|
+
interface RouteHealthAvailability {
|
|
828
|
+
state?: string;
|
|
829
|
+
code?: string;
|
|
830
|
+
message?: string;
|
|
831
|
+
limit?: {
|
|
832
|
+
side?: string;
|
|
833
|
+
token?: string;
|
|
834
|
+
fromChainId?: number | string;
|
|
835
|
+
toChainId?: number | string;
|
|
836
|
+
/** Base units of the hop's token. */
|
|
837
|
+
maxAmount?: string;
|
|
838
|
+
decimals?: number;
|
|
839
|
+
measuredAt?: string;
|
|
840
|
+
[k: string]: unknown;
|
|
841
|
+
};
|
|
842
|
+
[k: string]: unknown;
|
|
843
|
+
}
|
|
778
844
|
/** One lane as the gateway reports it. Permissive on purpose — this is untrusted API data and the
|
|
779
845
|
* projection below reads only what it needs. */
|
|
780
846
|
interface RouteHealthLane {
|
|
@@ -784,6 +850,8 @@ interface RouteHealthLane {
|
|
|
784
850
|
kind?: string;
|
|
785
851
|
code?: string;
|
|
786
852
|
message?: string;
|
|
853
|
+
/** Absent on a gateway that predates lane availability. */
|
|
854
|
+
availability?: RouteHealthAvailability;
|
|
787
855
|
[k: string]: unknown;
|
|
788
856
|
}
|
|
789
857
|
interface RouteHealth {
|
|
@@ -795,6 +863,9 @@ interface RouteHealth {
|
|
|
795
863
|
degraded?: number;
|
|
796
864
|
broken?: number;
|
|
797
865
|
unknown?: number;
|
|
866
|
+
available?: number;
|
|
867
|
+
limited?: number;
|
|
868
|
+
unavailable?: number;
|
|
798
869
|
total?: number;
|
|
799
870
|
};
|
|
800
871
|
measuredAt?: string;
|
|
@@ -802,6 +873,16 @@ interface RouteHealth {
|
|
|
802
873
|
lanes?: RouteHealthLane[];
|
|
803
874
|
[k: string]: unknown;
|
|
804
875
|
}
|
|
876
|
+
/** The three availability states a lane can publish. */
|
|
877
|
+
type LaneAvailabilityState = "available" | "limited" | "unavailable";
|
|
878
|
+
/**
|
|
879
|
+
* The availability state a lane publishes, or `null` when it publishes none this client understands.
|
|
880
|
+
*
|
|
881
|
+
* `null` covers an absent field (an older gateway) AND a malformed or unrecognised one. Both fall back
|
|
882
|
+
* to the status rule rather than to "available": a garbled field must not quietly un-hide a lane its
|
|
883
|
+
* status still condemns, and a state this build has never heard of is not an answer it can act on.
|
|
884
|
+
*/
|
|
885
|
+
declare function laneAvailabilityState(lane: RouteHealthLane | undefined | null): LaneAvailabilityState | null;
|
|
805
886
|
/**
|
|
806
887
|
* The lanes the picker must stop offering, keyed by `laneKey`.
|
|
807
888
|
*
|
|
@@ -810,16 +891,66 @@ interface RouteHealth {
|
|
|
810
891
|
* - the response arrived;
|
|
811
892
|
* - the gateway says `mode: "enforce"`. In observe mode the data exists for operators, and acting
|
|
812
893
|
* on it would defeat the shadow-period rollout the mode flag exists to provide;
|
|
813
|
-
* - the lane
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
894
|
+
* - the lane is withheld by ONE of two rules, chosen per lane:
|
|
895
|
+
*
|
|
896
|
+
* • it publishes `availability` → withheld iff `availability.state === "unavailable"`. A `limited`
|
|
897
|
+
* lane stays selectable and is offered with its limit (see {@link limitedLanes}).
|
|
898
|
+
*
|
|
899
|
+
* • it does not (a gateway that predates the field) → the original rule, unchanged: the status is
|
|
900
|
+
* `broken`, OR it is `unknown` with kind `firewalled`. DEGRADED lanes stay SELECTABLE — the
|
|
901
|
+
* measured answer there is "it works, but mind the size", and removing it would take a working
|
|
902
|
+
* route away. Every OTHER unknown stays selectable too: "we have not measured it" is not
|
|
903
|
+
* evidence. The firewalled kind is the one unknown that is a certainty rather than an absence of
|
|
904
|
+
* one — an operator is refusing the lane through the route firewall, the gateway answers "not
|
|
905
|
+
* tradeable" on sight, and the prober files it as unknown only so that lifting the rule does not
|
|
906
|
+
* leave a demotion behind. Until 2026-09-09 that status kept every such lane selectable here:
|
|
907
|
+
* 139 lanes into USDtb on prod, each one an error when picked.
|
|
821
908
|
*/
|
|
822
909
|
declare function suppressedLanes(health: RouteHealth | undefined | null): ReadonlyMap<string, BrokenLane>;
|
|
910
|
+
/**
|
|
911
|
+
* Lanes that are offered, but tradeable only up to a measured amount right now, keyed by `laneKey`.
|
|
912
|
+
*
|
|
913
|
+
* Empty — limit nothing — unless the response arrived, the gateway says `mode: "enforce"` (observe
|
|
914
|
+
* mode publishes the same objects, and they are not to be acted on), and the lane's availability is
|
|
915
|
+
* `limited` with a well-formed `limit`. A limited lane whose limit cannot be read is left OUT rather
|
|
916
|
+
* than guessed at: a limit this client invented would refuse amounts the gateway would quote, and
|
|
917
|
+
* the gateway refuses a genuinely oversized order on its own, with the limit in `fieldErrors`.
|
|
918
|
+
*/
|
|
919
|
+
declare function limitedLanes(health: RouteHealth | undefined | null): ReadonlyMap<string, LaneLimit>;
|
|
920
|
+
/**
|
|
921
|
+
* Whether `amount` — decimal text as the payer typed it, in the BID token's own units — is above a
|
|
922
|
+
* bid-side limit.
|
|
923
|
+
*
|
|
924
|
+
* `false` whenever it cannot tell: no limit, a payout-side (`ask`) limit, which is not denominated in
|
|
925
|
+
* what the payer types, or an amount that does not parse. Calling an amount this client could not
|
|
926
|
+
* read "over the limit" would withhold a quote the gateway might serve; the gateway refuses a
|
|
927
|
+
* genuinely oversized order on its own.
|
|
928
|
+
*
|
|
929
|
+
* Compared at the finer of the two scales, so neither side is rounded: the limit is denominated in
|
|
930
|
+
* the hop token's decimals, which are not guaranteed to be the bid deployment's.
|
|
931
|
+
*/
|
|
932
|
+
declare function exceedsLaneLimit(limit: LaneLimit | undefined | null, amount: string, bidDecimals: number): boolean;
|
|
933
|
+
/** The limit as a human amount, rounded DOWN — a displayed maximum must never exceed the real one. */
|
|
934
|
+
declare function laneLimitAmount(limit: LaneLimit): string;
|
|
935
|
+
/**
|
|
936
|
+
* The symbol to print beside a limit.
|
|
937
|
+
*
|
|
938
|
+
* A bid-side limit is on the payer's own token, so the caller's ticker for the bid deployment wins —
|
|
939
|
+
* it is the name already printed on the amount field. Otherwise the gateway's `token` is printed only
|
|
940
|
+
* if it is a plain ticker (see `safeTicker`); a value that is not is dropped rather than rendered.
|
|
941
|
+
*/
|
|
942
|
+
declare function laneLimitSymbol(limit: LaneLimit, bidTicker?: string): string;
|
|
943
|
+
/** The line a picker row and the amount field show for a limited lane: `Max 14 USDtb right now`. */
|
|
944
|
+
declare function laneLimitHint(limit: LaneLimit, symbol: string): string;
|
|
945
|
+
/**
|
|
946
|
+
* The inline amount error for an amount above a bid-side limit: `Maximum: 14 USDtb right now`.
|
|
947
|
+
*
|
|
948
|
+
* Worded as the gateway's own `fieldErrors` entry for the same refusal, so a payer reads the same
|
|
949
|
+
* sentence whether the widget caught the amount first or `/quote` did. The one difference is the
|
|
950
|
+
* amount: the gateway prints every decimal of the raw limit (an 18-decimal limiter reading can run to
|
|
951
|
+
* twenty digits), this rounds it DOWN to six — see {@link laneLimitAmount}.
|
|
952
|
+
*/
|
|
953
|
+
declare function laneLimitError(limit: LaneLimit, symbol: string): string;
|
|
823
954
|
/** A one-line reason a pair is hidden, for the picker row and the refusal panel. Never the raw
|
|
824
955
|
* gateway message: that text is untrusted and can carry infrastructure detail. */
|
|
825
956
|
declare function brokenLaneReason(lane: BrokenLane | undefined): string;
|
|
@@ -855,9 +986,14 @@ interface ApiError extends Error {
|
|
|
855
986
|
code?: string;
|
|
856
987
|
status?: number;
|
|
857
988
|
reasons?: string[];
|
|
989
|
+
/** Per-field validation errors. `field` names the request field, e.g. `fromAmount` for a trade
|
|
990
|
+
* below the minimum size (`BELOW_MIN_TRADE_SIZE`) or above a bridge's current limit (`BRIDGE_RATE_LIMITED`). */
|
|
858
991
|
fieldErrors?: Array<{
|
|
992
|
+
field?: string;
|
|
859
993
|
message?: string;
|
|
860
994
|
}>;
|
|
995
|
+
/** The size limits behind a `BRIDGE_RATE_LIMITED` refusal, as the gateway reports them. Untrusted. */
|
|
996
|
+
limits?: unknown[];
|
|
861
997
|
blocked?: boolean;
|
|
862
998
|
blockedCategory?: string;
|
|
863
999
|
blockedReason?: string;
|
|
@@ -870,6 +1006,16 @@ interface QuoteBlock {
|
|
|
870
1006
|
message: string;
|
|
871
1007
|
}
|
|
872
1008
|
declare function classifyQuoteError(error: any): QuoteBlock | null;
|
|
1009
|
+
/**
|
|
1010
|
+
* The gateway's error for the AMOUNT the payer typed, if the refusal names it — for rendering inline
|
|
1011
|
+
* under the amount field instead of as a generic quote failure.
|
|
1012
|
+
*
|
|
1013
|
+
* Answers the `fieldErrors` entry on `fromAmount`: a trade below the minimum size, or above a bridge's
|
|
1014
|
+
* current limit ("Maximum: 14 USDtb right now"). Either one is fixed by changing the amount and by
|
|
1015
|
+
* nothing else, so a "try again" affordance next to it would only re-ask the same question. The text is
|
|
1016
|
+
* untrusted and passes the same scrub as every other displayed message; null when there is none.
|
|
1017
|
+
*/
|
|
1018
|
+
declare function amountFieldError(error: unknown): string | null;
|
|
873
1019
|
interface ApiClient {
|
|
874
1020
|
apiRequest: <T = any>(path: string, init?: RequestInit & {
|
|
875
1021
|
timeoutMs?: number;
|
|
@@ -943,4 +1089,4 @@ interface Verifier {
|
|
|
943
1089
|
}
|
|
944
1090
|
declare function createVerifier(api: ApiClient, fetchImpl: typeof fetch, rpcOverrides?: Record<number, string>): Verifier;
|
|
945
1091
|
|
|
946
|
-
export {
|
|
1092
|
+
export { FLOOR_CATEGORIES as $, type Availability as A, type BrokenLane as B, type Compliance as C, type Address as D, type EngineConfig as E, type FetchQuoteFn as F, type ApiError as G, BLOCK_LABEL_DEFAULT as H, COMPLIANCE_CHECK_ORDER as I, COMPLIANCE_DENY_LABEL as J, type CatalogueContext as K, type LaneLimit as L, type CatalogueInput 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 ComplianceCheckId as U, type VerifyResult as V, type WalletScreen as W, type ComplianceDecision as X, DIRECT_CHECK_IDS as Y, DIRECT_SCOPE_NOTE as Z, type Destination as _, type Catalogue as a, type Hex as a0, type LaneAvailabilityState as a1, type PlannedTxKind as a2, type QuoteBlock as a3, type ResolvedConfig as a4, type RouteHealth as a5, type RouteHealthAvailability as a6, type RouteHealthLane as a7, SCREENING_BUCKETS as a8, type ScreenProvider as a9, isExecutableBridge as aA, isKnownUnbridgeable as aB, isSourceToken as aC, laneAvailabilityState as aD, laneKey as aE, laneKeys as aF, laneLimitAmount as aG, laneLimitError as aH, laneLimitFor as aI, laneLimitHint as aJ, laneLimitSymbol as aK, limitedLanes as aL, parseAllowedApiBase as aM, productAssets as aN, registryRpc as aO, resolveApiBase as aP, resolveConfig as aQ, screeningOutcomeOf as aR, sourceKeys as aS, suppressedLanes as aT, tokenKey as aU, txMatchesPlan as aV, unattributedComplianceReasons as aW, type ScreeningBucket as aa, type ScreeningOutcome as ab, TUNABLE_CATEGORIES as ac, type TxPlan as ad, amountFieldError as ae, apiError as af, blockLabelFor as ag, brokenLaneFor as ah, buildCatalogue as ai, canAttachApiKey as aj, categoryLabel as ak, classifyQuoteError as al, complianceControlsEvaluated as am, complianceReasonHead as an, complianceReasonTag as ao, complianceTagOf as ap, createApiClient as aq, createVerifier as ar, destinationKeys as as, directComplianceFromScreens as at, distinctScreenedWallets as au, exceedsLaneLimit as av, executableRoutes as aw, executionChainIds as ax, hasReachableDestination as ay, hubDeliverableSymbols 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, humanizeComplianceReason as q, type PayOption as r, type RwaVault as s, type SolveResult as t, type BalanceTarget as u, type BalanceEntry as v, type ApiClient as w, type SwapInput as x, type PlannedTx as y, type Verifier as z };
|
|
@@ -300,6 +300,15 @@ interface Quote {
|
|
|
300
300
|
bridge?: string;
|
|
301
301
|
feeBps?: number;
|
|
302
302
|
estimatedDuration?: number;
|
|
303
|
+
/** How long the order should live, in seconds from quote time, for the lane the gateway just
|
|
304
|
+
* priced — derived server-side from this lane's `estimatedDuration`. Absent on a gateway that
|
|
305
|
+
* predates the field, in which case the widget keeps its own flat default. Advisory: the
|
|
306
|
+
* deadline is still the client's to sign, and `orderRequests[].deadline` still comes back "0".
|
|
307
|
+
* See `recommendedDeadlineSeconds` in `core/order.ts`. */
|
|
308
|
+
recommendedDeadlineSeconds?: number;
|
|
309
|
+
/** The same value as an absolute unix second (decimal string). Informational — the widget builds
|
|
310
|
+
* the deadline from the span so it is measured against the signer's own clock. */
|
|
311
|
+
recommendedDeadline?: string;
|
|
303
312
|
gasCostSource?: string;
|
|
304
313
|
gasCostDest?: string;
|
|
305
314
|
/** The gateway's compliance decision for this quote's wallet pair. Absent = gate not configured. */
|
|
@@ -649,6 +658,30 @@ interface BrokenLane {
|
|
|
649
658
|
message: string;
|
|
650
659
|
kind?: string;
|
|
651
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* A lane the gateway says is tradeable only up to a measured amount right now — availability state
|
|
663
|
+
* `limited`, as {@link destinationAvailability}'s callers consume it. See `limitedLanes` in
|
|
664
|
+
* `core/route-health.ts`, which is the only producer.
|
|
665
|
+
*
|
|
666
|
+
* The limit names ONE hop of the lane: `bid` is the hop the payer's own amount travels (so the amount
|
|
667
|
+
* field can be checked against it before a quote is asked for); `ask` is the payout hop, which the
|
|
668
|
+
* payer does not type in the same units and which is therefore shown, never enforced, here.
|
|
669
|
+
*/
|
|
670
|
+
interface LaneLimit {
|
|
671
|
+
side: "bid" | "ask";
|
|
672
|
+
/** The gateway's name for the hop's token. Untrusted display text — print it through
|
|
673
|
+
* `laneLimitSymbol`, never directly. */
|
|
674
|
+
token: string;
|
|
675
|
+
fromChainId: number;
|
|
676
|
+
toChainId: number;
|
|
677
|
+
/** The most the hop can carry right now, in BASE UNITS of the hop's token (a decimal integer string). */
|
|
678
|
+
maxAmount: string;
|
|
679
|
+
/** Decimals `maxAmount` is denominated in. */
|
|
680
|
+
decimals: number;
|
|
681
|
+
/** The code `/quote` answers the lane with above the limit, e.g. `BRIDGE_RATE_LIMITED`. */
|
|
682
|
+
code: string;
|
|
683
|
+
measuredAt?: string;
|
|
684
|
+
}
|
|
652
685
|
interface CatalogueContext {
|
|
653
686
|
/** From {@link sourceKeys}. */
|
|
654
687
|
source: ReadonlySet<string>;
|
|
@@ -695,6 +728,12 @@ type Availability = "available" | "hub-only" | "unreachable";
|
|
|
695
728
|
* the destination alone would remove working routes to fix one broken one.
|
|
696
729
|
*/
|
|
697
730
|
declare function brokenLaneFor(token: Pick<Token, "chainId" | "address">, source: Pick<Token, "chainId" | "address"> | undefined, brokenLanes: ReadonlyMap<string, BrokenLane> | undefined): BrokenLane | undefined;
|
|
731
|
+
/**
|
|
732
|
+
* The published size limit for this exact (source, destination) pair, if the lane is `limited`.
|
|
733
|
+
* Keyed on both ends for the same reason {@link brokenLaneFor} is: a limit is a property of the
|
|
734
|
+
* hops a lane crosses, and the same destination reached from another source crosses other hops.
|
|
735
|
+
*/
|
|
736
|
+
declare function laneLimitFor(token: Pick<Token, "chainId" | "address">, source: Pick<Token, "chainId" | "address"> | null | undefined, limitedLanes: ReadonlyMap<string, LaneLimit> | undefined): LaneLimit | undefined;
|
|
698
737
|
/**
|
|
699
738
|
* Whether an ask token can actually be delivered on its own chain.
|
|
700
739
|
*
|
|
@@ -729,6 +768,9 @@ interface CatalogueInput {
|
|
|
729
768
|
supportedChainIds: ReadonlySet<number>;
|
|
730
769
|
/** Measured refusals; omit or pass an empty map to suppress nothing. */
|
|
731
770
|
brokenLanes?: ReadonlyMap<string, BrokenLane>;
|
|
771
|
+
/** Published size limits (`limitedLanes`); omit or pass an empty map to limit nothing. Carried
|
|
772
|
+
* through untouched — a limited lane stays offered, so it changes no verdict here. */
|
|
773
|
+
limitedLanes?: ReadonlyMap<string, LaneLimit>;
|
|
732
774
|
/** Vault artwork by symbol key (see `core/rwa-icons.ts`). Carried through untouched. */
|
|
733
775
|
vaultIcons?: ReadonlyMap<string, string>;
|
|
734
776
|
}
|
|
@@ -764,6 +806,12 @@ interface Catalogue extends CatalogueContext {
|
|
|
764
806
|
* published none.
|
|
765
807
|
*/
|
|
766
808
|
vaultIcons: ReadonlyMap<string, string>;
|
|
809
|
+
/**
|
|
810
|
+
* Lanes that are offered but tradeable only up to a measured amount right now, keyed by
|
|
811
|
+
* {@link laneKey}. Read it with {@link laneLimitFor}. Empty when the gateway publishes no
|
|
812
|
+
* availability (an older gateway), is in observe mode, or the health read failed.
|
|
813
|
+
*/
|
|
814
|
+
limitedLanes: ReadonlyMap<string, LaneLimit>;
|
|
767
815
|
}
|
|
768
816
|
/**
|
|
769
817
|
* Build the selectable catalogue from the live registry.
|
|
@@ -775,6 +823,24 @@ interface Catalogue extends CatalogueContext {
|
|
|
775
823
|
*/
|
|
776
824
|
declare function buildCatalogue(input: CatalogueInput): Catalogue;
|
|
777
825
|
|
|
826
|
+
/** A lane's availability as the gateway publishes it. Permissive: this is untrusted API data. */
|
|
827
|
+
interface RouteHealthAvailability {
|
|
828
|
+
state?: string;
|
|
829
|
+
code?: string;
|
|
830
|
+
message?: string;
|
|
831
|
+
limit?: {
|
|
832
|
+
side?: string;
|
|
833
|
+
token?: string;
|
|
834
|
+
fromChainId?: number | string;
|
|
835
|
+
toChainId?: number | string;
|
|
836
|
+
/** Base units of the hop's token. */
|
|
837
|
+
maxAmount?: string;
|
|
838
|
+
decimals?: number;
|
|
839
|
+
measuredAt?: string;
|
|
840
|
+
[k: string]: unknown;
|
|
841
|
+
};
|
|
842
|
+
[k: string]: unknown;
|
|
843
|
+
}
|
|
778
844
|
/** One lane as the gateway reports it. Permissive on purpose — this is untrusted API data and the
|
|
779
845
|
* projection below reads only what it needs. */
|
|
780
846
|
interface RouteHealthLane {
|
|
@@ -784,6 +850,8 @@ interface RouteHealthLane {
|
|
|
784
850
|
kind?: string;
|
|
785
851
|
code?: string;
|
|
786
852
|
message?: string;
|
|
853
|
+
/** Absent on a gateway that predates lane availability. */
|
|
854
|
+
availability?: RouteHealthAvailability;
|
|
787
855
|
[k: string]: unknown;
|
|
788
856
|
}
|
|
789
857
|
interface RouteHealth {
|
|
@@ -795,6 +863,9 @@ interface RouteHealth {
|
|
|
795
863
|
degraded?: number;
|
|
796
864
|
broken?: number;
|
|
797
865
|
unknown?: number;
|
|
866
|
+
available?: number;
|
|
867
|
+
limited?: number;
|
|
868
|
+
unavailable?: number;
|
|
798
869
|
total?: number;
|
|
799
870
|
};
|
|
800
871
|
measuredAt?: string;
|
|
@@ -802,6 +873,16 @@ interface RouteHealth {
|
|
|
802
873
|
lanes?: RouteHealthLane[];
|
|
803
874
|
[k: string]: unknown;
|
|
804
875
|
}
|
|
876
|
+
/** The three availability states a lane can publish. */
|
|
877
|
+
type LaneAvailabilityState = "available" | "limited" | "unavailable";
|
|
878
|
+
/**
|
|
879
|
+
* The availability state a lane publishes, or `null` when it publishes none this client understands.
|
|
880
|
+
*
|
|
881
|
+
* `null` covers an absent field (an older gateway) AND a malformed or unrecognised one. Both fall back
|
|
882
|
+
* to the status rule rather than to "available": a garbled field must not quietly un-hide a lane its
|
|
883
|
+
* status still condemns, and a state this build has never heard of is not an answer it can act on.
|
|
884
|
+
*/
|
|
885
|
+
declare function laneAvailabilityState(lane: RouteHealthLane | undefined | null): LaneAvailabilityState | null;
|
|
805
886
|
/**
|
|
806
887
|
* The lanes the picker must stop offering, keyed by `laneKey`.
|
|
807
888
|
*
|
|
@@ -810,16 +891,66 @@ interface RouteHealth {
|
|
|
810
891
|
* - the response arrived;
|
|
811
892
|
* - the gateway says `mode: "enforce"`. In observe mode the data exists for operators, and acting
|
|
812
893
|
* on it would defeat the shadow-period rollout the mode flag exists to provide;
|
|
813
|
-
* - the lane
|
|
814
|
-
*
|
|
815
|
-
*
|
|
816
|
-
*
|
|
817
|
-
*
|
|
818
|
-
*
|
|
819
|
-
*
|
|
820
|
-
*
|
|
894
|
+
* - the lane is withheld by ONE of two rules, chosen per lane:
|
|
895
|
+
*
|
|
896
|
+
* • it publishes `availability` → withheld iff `availability.state === "unavailable"`. A `limited`
|
|
897
|
+
* lane stays selectable and is offered with its limit (see {@link limitedLanes}).
|
|
898
|
+
*
|
|
899
|
+
* • it does not (a gateway that predates the field) → the original rule, unchanged: the status is
|
|
900
|
+
* `broken`, OR it is `unknown` with kind `firewalled`. DEGRADED lanes stay SELECTABLE — the
|
|
901
|
+
* measured answer there is "it works, but mind the size", and removing it would take a working
|
|
902
|
+
* route away. Every OTHER unknown stays selectable too: "we have not measured it" is not
|
|
903
|
+
* evidence. The firewalled kind is the one unknown that is a certainty rather than an absence of
|
|
904
|
+
* one — an operator is refusing the lane through the route firewall, the gateway answers "not
|
|
905
|
+
* tradeable" on sight, and the prober files it as unknown only so that lifting the rule does not
|
|
906
|
+
* leave a demotion behind. Until 2026-09-09 that status kept every such lane selectable here:
|
|
907
|
+
* 139 lanes into USDtb on prod, each one an error when picked.
|
|
821
908
|
*/
|
|
822
909
|
declare function suppressedLanes(health: RouteHealth | undefined | null): ReadonlyMap<string, BrokenLane>;
|
|
910
|
+
/**
|
|
911
|
+
* Lanes that are offered, but tradeable only up to a measured amount right now, keyed by `laneKey`.
|
|
912
|
+
*
|
|
913
|
+
* Empty — limit nothing — unless the response arrived, the gateway says `mode: "enforce"` (observe
|
|
914
|
+
* mode publishes the same objects, and they are not to be acted on), and the lane's availability is
|
|
915
|
+
* `limited` with a well-formed `limit`. A limited lane whose limit cannot be read is left OUT rather
|
|
916
|
+
* than guessed at: a limit this client invented would refuse amounts the gateway would quote, and
|
|
917
|
+
* the gateway refuses a genuinely oversized order on its own, with the limit in `fieldErrors`.
|
|
918
|
+
*/
|
|
919
|
+
declare function limitedLanes(health: RouteHealth | undefined | null): ReadonlyMap<string, LaneLimit>;
|
|
920
|
+
/**
|
|
921
|
+
* Whether `amount` — decimal text as the payer typed it, in the BID token's own units — is above a
|
|
922
|
+
* bid-side limit.
|
|
923
|
+
*
|
|
924
|
+
* `false` whenever it cannot tell: no limit, a payout-side (`ask`) limit, which is not denominated in
|
|
925
|
+
* what the payer types, or an amount that does not parse. Calling an amount this client could not
|
|
926
|
+
* read "over the limit" would withhold a quote the gateway might serve; the gateway refuses a
|
|
927
|
+
* genuinely oversized order on its own.
|
|
928
|
+
*
|
|
929
|
+
* Compared at the finer of the two scales, so neither side is rounded: the limit is denominated in
|
|
930
|
+
* the hop token's decimals, which are not guaranteed to be the bid deployment's.
|
|
931
|
+
*/
|
|
932
|
+
declare function exceedsLaneLimit(limit: LaneLimit | undefined | null, amount: string, bidDecimals: number): boolean;
|
|
933
|
+
/** The limit as a human amount, rounded DOWN — a displayed maximum must never exceed the real one. */
|
|
934
|
+
declare function laneLimitAmount(limit: LaneLimit): string;
|
|
935
|
+
/**
|
|
936
|
+
* The symbol to print beside a limit.
|
|
937
|
+
*
|
|
938
|
+
* A bid-side limit is on the payer's own token, so the caller's ticker for the bid deployment wins —
|
|
939
|
+
* it is the name already printed on the amount field. Otherwise the gateway's `token` is printed only
|
|
940
|
+
* if it is a plain ticker (see `safeTicker`); a value that is not is dropped rather than rendered.
|
|
941
|
+
*/
|
|
942
|
+
declare function laneLimitSymbol(limit: LaneLimit, bidTicker?: string): string;
|
|
943
|
+
/** The line a picker row and the amount field show for a limited lane: `Max 14 USDtb right now`. */
|
|
944
|
+
declare function laneLimitHint(limit: LaneLimit, symbol: string): string;
|
|
945
|
+
/**
|
|
946
|
+
* The inline amount error for an amount above a bid-side limit: `Maximum: 14 USDtb right now`.
|
|
947
|
+
*
|
|
948
|
+
* Worded as the gateway's own `fieldErrors` entry for the same refusal, so a payer reads the same
|
|
949
|
+
* sentence whether the widget caught the amount first or `/quote` did. The one difference is the
|
|
950
|
+
* amount: the gateway prints every decimal of the raw limit (an 18-decimal limiter reading can run to
|
|
951
|
+
* twenty digits), this rounds it DOWN to six — see {@link laneLimitAmount}.
|
|
952
|
+
*/
|
|
953
|
+
declare function laneLimitError(limit: LaneLimit, symbol: string): string;
|
|
823
954
|
/** A one-line reason a pair is hidden, for the picker row and the refusal panel. Never the raw
|
|
824
955
|
* gateway message: that text is untrusted and can carry infrastructure detail. */
|
|
825
956
|
declare function brokenLaneReason(lane: BrokenLane | undefined): string;
|
|
@@ -855,9 +986,14 @@ interface ApiError extends Error {
|
|
|
855
986
|
code?: string;
|
|
856
987
|
status?: number;
|
|
857
988
|
reasons?: string[];
|
|
989
|
+
/** Per-field validation errors. `field` names the request field, e.g. `fromAmount` for a trade
|
|
990
|
+
* below the minimum size (`BELOW_MIN_TRADE_SIZE`) or above a bridge's current limit (`BRIDGE_RATE_LIMITED`). */
|
|
858
991
|
fieldErrors?: Array<{
|
|
992
|
+
field?: string;
|
|
859
993
|
message?: string;
|
|
860
994
|
}>;
|
|
995
|
+
/** The size limits behind a `BRIDGE_RATE_LIMITED` refusal, as the gateway reports them. Untrusted. */
|
|
996
|
+
limits?: unknown[];
|
|
861
997
|
blocked?: boolean;
|
|
862
998
|
blockedCategory?: string;
|
|
863
999
|
blockedReason?: string;
|
|
@@ -870,6 +1006,16 @@ interface QuoteBlock {
|
|
|
870
1006
|
message: string;
|
|
871
1007
|
}
|
|
872
1008
|
declare function classifyQuoteError(error: any): QuoteBlock | null;
|
|
1009
|
+
/**
|
|
1010
|
+
* The gateway's error for the AMOUNT the payer typed, if the refusal names it — for rendering inline
|
|
1011
|
+
* under the amount field instead of as a generic quote failure.
|
|
1012
|
+
*
|
|
1013
|
+
* Answers the `fieldErrors` entry on `fromAmount`: a trade below the minimum size, or above a bridge's
|
|
1014
|
+
* current limit ("Maximum: 14 USDtb right now"). Either one is fixed by changing the amount and by
|
|
1015
|
+
* nothing else, so a "try again" affordance next to it would only re-ask the same question. The text is
|
|
1016
|
+
* untrusted and passes the same scrub as every other displayed message; null when there is none.
|
|
1017
|
+
*/
|
|
1018
|
+
declare function amountFieldError(error: unknown): string | null;
|
|
873
1019
|
interface ApiClient {
|
|
874
1020
|
apiRequest: <T = any>(path: string, init?: RequestInit & {
|
|
875
1021
|
timeoutMs?: number;
|
|
@@ -943,4 +1089,4 @@ interface Verifier {
|
|
|
943
1089
|
}
|
|
944
1090
|
declare function createVerifier(api: ApiClient, fetchImpl: typeof fetch, rpcOverrides?: Record<number, string>): Verifier;
|
|
945
1091
|
|
|
946
|
-
export {
|
|
1092
|
+
export { FLOOR_CATEGORIES as $, type Availability as A, type BrokenLane as B, type Compliance as C, type Address as D, type EngineConfig as E, type FetchQuoteFn as F, type ApiError as G, BLOCK_LABEL_DEFAULT as H, COMPLIANCE_CHECK_ORDER as I, COMPLIANCE_DENY_LABEL as J, type CatalogueContext as K, type LaneLimit as L, type CatalogueInput 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 ComplianceCheckId as U, type VerifyResult as V, type WalletScreen as W, type ComplianceDecision as X, DIRECT_CHECK_IDS as Y, DIRECT_SCOPE_NOTE as Z, type Destination as _, type Catalogue as a, type Hex as a0, type LaneAvailabilityState as a1, type PlannedTxKind as a2, type QuoteBlock as a3, type ResolvedConfig as a4, type RouteHealth as a5, type RouteHealthAvailability as a6, type RouteHealthLane as a7, SCREENING_BUCKETS as a8, type ScreenProvider as a9, isExecutableBridge as aA, isKnownUnbridgeable as aB, isSourceToken as aC, laneAvailabilityState as aD, laneKey as aE, laneKeys as aF, laneLimitAmount as aG, laneLimitError as aH, laneLimitFor as aI, laneLimitHint as aJ, laneLimitSymbol as aK, limitedLanes as aL, parseAllowedApiBase as aM, productAssets as aN, registryRpc as aO, resolveApiBase as aP, resolveConfig as aQ, screeningOutcomeOf as aR, sourceKeys as aS, suppressedLanes as aT, tokenKey as aU, txMatchesPlan as aV, unattributedComplianceReasons as aW, type ScreeningBucket as aa, type ScreeningOutcome as ab, TUNABLE_CATEGORIES as ac, type TxPlan as ad, amountFieldError as ae, apiError as af, blockLabelFor as ag, brokenLaneFor as ah, buildCatalogue as ai, canAttachApiKey as aj, categoryLabel as ak, classifyQuoteError as al, complianceControlsEvaluated as am, complianceReasonHead as an, complianceReasonTag as ao, complianceTagOf as ap, createApiClient as aq, createVerifier as ar, destinationKeys as as, directComplianceFromScreens as at, distinctScreenedWallets as au, exceedsLaneLimit as av, executableRoutes as aw, executionChainIds as ax, hasReachableDestination as ay, hubDeliverableSymbols 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, humanizeComplianceReason as q, type PayOption as r, type RwaVault as s, type SolveResult as t, type BalanceTarget as u, type BalanceEntry as v, type ApiClient as w, type SwapInput as x, type PlannedTx as y, type Verifier as z };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@glacislabs/stablegenie-zerodelta",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.4.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",
|