@gibs/bridge-sdk 1.13.1 → 1.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +295 -18
- package/abis/package.json +6 -0
- package/bridge-limits/package.json +6 -0
- package/chain-info/package.json +6 -0
- package/chain-names/package.json +6 -0
- package/chains/package.json +6 -0
- package/claims/package.json +6 -0
- package/config/package.json +6 -0
- package/consolidated-quote/package.json +6 -0
- package/destination-calldata/package.json +6 -0
- package/dist/chain-info.d.ts +1 -1
- package/dist/chain-info.js +11 -12
- package/dist/chains.d.ts +25 -0
- package/dist/chains.js +55 -20
- package/dist/cjs/abis.d.ts +1 -0
- package/dist/cjs/abis.js +19 -0
- package/dist/cjs/bridge-limits.d.ts +103 -0
- package/dist/cjs/bridge-limits.js +89 -0
- package/dist/cjs/chain-info.d.ts +169 -0
- package/dist/cjs/chain-info.js +452 -0
- package/dist/cjs/chain-names.d.ts +160 -0
- package/dist/cjs/chain-names.js +207 -0
- package/dist/cjs/chains.d.ts +90 -0
- package/dist/cjs/chains.js +357 -0
- package/dist/cjs/claims.d.ts +198 -0
- package/dist/cjs/claims.js +182 -0
- package/dist/cjs/config.d.ts +255 -0
- package/dist/cjs/config.js +569 -0
- package/dist/cjs/consolidated-quote.d.ts +648 -0
- package/dist/cjs/consolidated-quote.js +1048 -0
- package/dist/cjs/destination-calldata.d.ts +118 -0
- package/dist/cjs/destination-calldata.js +156 -0
- package/dist/cjs/ecosystems.d.ts +217 -0
- package/dist/cjs/ecosystems.js +298 -0
- package/dist/cjs/execution.d.ts +359 -0
- package/dist/cjs/execution.js +495 -0
- package/dist/cjs/fee-type.d.ts +10 -0
- package/dist/cjs/fee-type.js +10 -0
- package/dist/cjs/hyperliquid-execution.d.ts +152 -0
- package/dist/cjs/hyperliquid-execution.js +175 -0
- package/dist/cjs/image-links.d.ts +117 -0
- package/dist/cjs/image-links.js +153 -0
- package/dist/cjs/index.d.ts +24 -0
- package/dist/cjs/index.js +40 -0
- package/dist/cjs/lifi-execution-guard.d.ts +210 -0
- package/dist/cjs/lifi-execution-guard.js +409 -0
- package/dist/cjs/near-intents-conformance.d.ts +85 -0
- package/dist/cjs/near-intents-conformance.js +337 -0
- package/dist/cjs/near-intents-route.d.ts +47 -0
- package/dist/cjs/near-intents-route.js +303 -0
- package/dist/cjs/near-intents.d.ts +524 -0
- package/dist/cjs/near-intents.js +1071 -0
- package/dist/cjs/origin-deposit.d.ts +326 -0
- package/dist/cjs/origin-deposit.js +82 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pre-quote.d.ts +198 -0
- package/dist/cjs/pre-quote.js +180 -0
- package/dist/cjs/prices.d.ts +117 -0
- package/dist/cjs/prices.js +224 -0
- package/dist/cjs/providers.d.ts +238 -0
- package/dist/cjs/providers.js +171 -0
- package/dist/cjs/quote-fees.d.ts +102 -0
- package/dist/cjs/quote-fees.js +201 -0
- package/dist/cjs/referral.d.ts +85 -0
- package/dist/cjs/referral.js +85 -0
- package/dist/cjs/relay-currencies.d.ts +47 -0
- package/dist/cjs/relay-currencies.js +95 -0
- package/dist/cjs/relay-depository.d.ts +2 -0
- package/dist/cjs/relay-depository.js +85 -0
- package/dist/cjs/relay-quote.d.ts +301 -0
- package/dist/cjs/relay-quote.js +996 -0
- package/dist/cjs/route-steps.d.ts +138 -0
- package/dist/cjs/route-steps.js +310 -0
- package/dist/cjs/routing/amounts.d.ts +80 -0
- package/dist/cjs/routing/amounts.js +126 -0
- package/dist/cjs/routing/candidate-route.d.ts +43 -0
- package/dist/cjs/routing/candidate-route.js +50 -0
- package/dist/cjs/routing/candidate.d.ts +237 -0
- package/dist/cjs/routing/candidate.js +100 -0
- package/dist/cjs/routing/carrier-provider-key.d.ts +31 -0
- package/dist/cjs/routing/carrier-provider-key.js +42 -0
- package/dist/cjs/routing/carriers/ask-answer.d.ts +77 -0
- package/dist/cjs/routing/carriers/ask-answer.js +2 -0
- package/dist/cjs/routing/carriers/omnibridge.d.ts +137 -0
- package/dist/cjs/routing/carriers/omnibridge.js +459 -0
- package/dist/cjs/routing/carriers/pulsex-paths.d.ts +80 -0
- package/dist/cjs/routing/carriers/pulsex-paths.js +97 -0
- package/dist/cjs/routing/carriers/pulsex-split.d.ts +175 -0
- package/dist/cjs/routing/carriers/pulsex-split.js +193 -0
- package/dist/cjs/routing/carriers/pulsex.d.ts +184 -0
- package/dist/cjs/routing/carriers/pulsex.js +615 -0
- package/dist/cjs/routing/carriers/wrap.d.ts +25 -0
- package/dist/cjs/routing/carriers/wrap.js +119 -0
- package/dist/cjs/routing/composed-route-quality.d.ts +125 -0
- package/dist/cjs/routing/composed-route-quality.js +144 -0
- package/dist/cjs/routing/entry-chain-anchor.d.ts +88 -0
- package/dist/cjs/routing/entry-chain-anchor.js +59 -0
- package/dist/cjs/routing/format.d.ts +31 -0
- package/dist/cjs/routing/format.js +64 -0
- package/dist/cjs/routing/index.d.ts +42 -0
- package/dist/cjs/routing/index.js +142 -0
- package/dist/cjs/routing/producers.d.ts +770 -0
- package/dist/cjs/routing/producers.js +1617 -0
- package/dist/cjs/routing/providers.d.ts +31 -0
- package/dist/cjs/routing/providers.js +48 -0
- package/dist/cjs/routing/route-data.d.ts +397 -0
- package/dist/cjs/routing/route-data.js +2 -0
- package/dist/cjs/routing/search/compose.d.ts +168 -0
- package/dist/cjs/routing/search/compose.js +104 -0
- package/dist/cjs/routing/search/graph.d.ts +668 -0
- package/dist/cjs/routing/search/graph.js +461 -0
- package/dist/cjs/routing/search/plan-route-data.d.ts +285 -0
- package/dist/cjs/routing/search/plan-route-data.js +871 -0
- package/dist/cjs/routing/search/score.d.ts +356 -0
- package/dist/cjs/routing/search/score.js +445 -0
- package/dist/cjs/routing/swap-transactions.d.ts +95 -0
- package/dist/cjs/routing/swap-transactions.js +133 -0
- package/dist/cjs/routing/usd-value.d.ts +17 -0
- package/dist/cjs/routing/usd-value.js +29 -0
- package/dist/cjs/settings.d.ts +785 -0
- package/dist/cjs/settings.js +1074 -0
- package/dist/cjs/swap-venues.d.ts +43 -0
- package/dist/cjs/swap-venues.js +29 -0
- package/dist/cjs/ton-connect.d.ts +98 -0
- package/dist/cjs/ton-connect.js +206 -0
- package/dist/cjs/ton-execution.d.ts +7 -0
- package/dist/cjs/ton-execution.js +23 -0
- package/dist/cjs/ton.d.ts +37 -0
- package/dist/cjs/ton.js +83 -0
- package/dist/cjs/tron-execution.d.ts +146 -0
- package/dist/cjs/tron-execution.js +248 -0
- package/dist/cjs/types.d.ts +51 -0
- package/dist/cjs/types.js +2 -0
- package/dist/claims.d.ts +198 -0
- package/dist/claims.js +140 -0
- package/dist/config.d.ts +42 -3
- package/dist/config.js +87 -21
- package/dist/consolidated-quote.d.ts +109 -15
- package/dist/consolidated-quote.js +310 -52
- package/dist/execution.d.ts +359 -0
- package/dist/execution.js +455 -0
- package/dist/hyperliquid-execution.js +2 -3
- package/dist/index.d.ts +4 -0
- package/dist/index.js +4 -0
- package/dist/lifi-execution-guard.d.ts +13 -2
- package/dist/lifi-execution-guard.js +4 -0
- package/dist/near-intents.js +2 -3
- package/dist/pre-quote.d.ts +6 -6
- package/dist/pre-quote.js +10 -14
- package/dist/prices.d.ts +10 -0
- package/dist/prices.js +52 -1
- package/dist/providers.d.ts +17 -0
- package/dist/providers.js +6 -0
- package/dist/referral.d.ts +12 -4
- package/dist/referral.js +12 -4
- package/dist/relay-depository.d.ts +2 -0
- package/dist/relay-depository.js +82 -0
- package/dist/relay-quote.js +2 -3
- package/dist/routing/candidate.d.ts +3 -3
- package/dist/routing/candidate.js +3 -3
- package/dist/routing/carrier-provider-key.d.ts +31 -0
- package/dist/routing/carrier-provider-key.js +37 -0
- package/dist/routing/carriers/ask-answer.d.ts +17 -0
- package/dist/routing/carriers/omnibridge.js +23 -21
- package/dist/routing/carriers/pulsex-paths.d.ts +80 -0
- package/dist/routing/carriers/pulsex-paths.js +92 -0
- package/dist/routing/carriers/pulsex-split.d.ts +175 -0
- package/dist/routing/carriers/pulsex-split.js +185 -0
- package/dist/routing/carriers/pulsex.d.ts +81 -46
- package/dist/routing/carriers/pulsex.js +267 -148
- package/dist/routing/composed-route-quality.d.ts +28 -6
- package/dist/routing/composed-route-quality.js +36 -5
- package/dist/routing/entry-chain-anchor.d.ts +1 -1
- package/dist/routing/entry-chain-anchor.js +1 -1
- package/dist/routing/index.d.ts +11 -3
- package/dist/routing/index.js +8 -2
- package/dist/routing/producers.js +1 -1
- package/dist/routing/providers.d.ts +5 -0
- package/dist/routing/providers.js +5 -0
- package/dist/routing/route-data.d.ts +47 -5
- package/dist/routing/search/graph.d.ts +15 -0
- package/dist/routing/search/plan-route-data.d.ts +42 -1
- package/dist/routing/search/plan-route-data.js +68 -9
- package/dist/routing/search/score.d.ts +3 -0
- package/dist/routing/search/score.js +11 -3
- package/dist/routing/swap-transactions.d.ts +95 -0
- package/dist/routing/swap-transactions.js +127 -0
- package/dist/settings.d.ts +94 -1
- package/dist/settings.js +95 -3
- package/dist/swap-venues.d.ts +43 -0
- package/dist/swap-venues.js +24 -0
- package/dist/ton-connect.d.ts +98 -0
- package/dist/ton-connect.js +200 -0
- package/dist/ton-execution.d.ts +4 -114
- package/dist/ton-execution.js +4 -244
- package/dist/ton.d.ts +37 -0
- package/dist/ton.js +65 -0
- package/docs/examples/example-a-ether-to-pulse.ts +300 -0
- package/docs/examples/example-b-token-pulsechain-to-ethereum.ts +270 -0
- package/docs/examples/shared.ts +261 -0
- package/docs/examples/tsconfig.json +18 -0
- package/docs/integration-guide.md +617 -0
- package/ecosystems/package.json +6 -0
- package/execution/package.json +6 -0
- package/fee-type/package.json +6 -0
- package/hyperliquid-execution/package.json +6 -0
- package/image-links/package.json +6 -0
- package/lifi-execution-guard/package.json +6 -0
- package/llms.txt +75 -10
- package/near-intents/package.json +6 -0
- package/near-intents-route/package.json +6 -0
- package/origin-deposit/package.json +6 -0
- package/package.json +817 -10
- package/pre-quote/package.json +6 -0
- package/prices/package.json +6 -0
- package/providers/package.json +6 -0
- package/quote-fees/package.json +6 -0
- package/referral/package.json +6 -0
- package/relay-currencies/package.json +6 -0
- package/relay-quote/package.json +6 -0
- package/route-steps/package.json +6 -0
- package/routing/package.json +6 -0
- package/settings/package.json +6 -0
- package/ton/package.json +6 -0
- package/ton-connect/package.json +6 -0
- package/ton-execution/package.json +6 -0
- package/tron-execution/package.json +6 -0
- package/types/package.json +6 -0
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import { type ProviderKey } from '../../providers.js';
|
|
2
|
+
import type { Provider } from '../../config.js';
|
|
3
|
+
import type { QuoteFee } from '../../quote-fees.js';
|
|
4
|
+
import type { Token } from '../../types.js';
|
|
5
|
+
import type { DeferredCrossing, RouteCandidate } from '../candidate.js';
|
|
6
|
+
import type { RouteData, RouteGasByChain, RouteKind } from '../route-data.js';
|
|
7
|
+
import type { RouteScoreInputs } from './score.js';
|
|
8
|
+
import { type AssetNode, type RoutePlan } from './graph.js';
|
|
9
|
+
/**
|
|
10
|
+
* Resolves a graph node to the full display token a `RouteTokenRef` needs.
|
|
11
|
+
*
|
|
12
|
+
* `AssetNode` (`./graph.js`) is deliberately opaque about symbol, name and
|
|
13
|
+
* logo — see that module's own doc for why a coin and its wrapped form stay
|
|
14
|
+
* two distinct nodes there. Whoever built the plan already resolved every
|
|
15
|
+
* node against a live capability index and therefore already has this
|
|
16
|
+
* mapping; this module never invents one.
|
|
17
|
+
*/
|
|
18
|
+
export type ResolveNodeToken = (node: AssetNode) => Token;
|
|
19
|
+
/**
|
|
20
|
+
* The plan's omnibridge provider, or null when the plan crosses no bridge
|
|
21
|
+
* hop at all — exactly the derivation `RouteCandidate.plan`'s own TSDoc
|
|
22
|
+
* (`../candidate.ts`) promises: "that same hop's `carrier`... the `to` node's
|
|
23
|
+
* `chainId` of the plan's LAST hop whose carrier is `'pulsechain'` or
|
|
24
|
+
* `'tokensex'`." Reading the LAST such hop, not the first, matters for a
|
|
25
|
+
* plan with two bridge crossings (an outbound leg out of PulseChain followed
|
|
26
|
+
* later by a separate inbound one) — not a shape any of today's four
|
|
27
|
+
* builders draws, but one the general search can.
|
|
28
|
+
*
|
|
29
|
+
* @param plan - the plan to derive from
|
|
30
|
+
* @returns the omnibridge provider, or null
|
|
31
|
+
*/
|
|
32
|
+
export declare const deriveOmnibridgeProviderFromPlan: (plan: RoutePlan) => Provider | null;
|
|
33
|
+
/**
|
|
34
|
+
* The plan's entry chain id — the chain the plan's FIRST hop lands on, when
|
|
35
|
+
* that hop is carried by an aggregator (LI.FI, Relay or NEAR Intents); null
|
|
36
|
+
* when the plan's first hop IS the omnibridge itself (a direct, same-chain
|
|
37
|
+
* crossing — `buildDirectCrossingCandidate`'s shape) or is a PulseX swap.
|
|
38
|
+
*
|
|
39
|
+
* MATCHES `RouteCandidate.entryChainId`'S EXISTING MEANING throughout the
|
|
40
|
+
* candidate-based builders — "the chain the omnibridge leg starts on" — for
|
|
41
|
+
* every candidate that carries one, including a candidate whose aggregator
|
|
42
|
+
* reaches its OWN destination with no further bridge hop at all (today's
|
|
43
|
+
* `makeCandidate` test fixtures set `entryChainId` to the destination chain
|
|
44
|
+
* in exactly that case, because it is still where the aggregator's own leg
|
|
45
|
+
* lands).
|
|
46
|
+
*
|
|
47
|
+
* @param plan - the plan to derive from
|
|
48
|
+
* @returns the entry chain id, or null for a direct crossing or a swap-only plan
|
|
49
|
+
*/
|
|
50
|
+
export declare const deriveEntryChainIdFromPlan: (plan: RoutePlan) => number | null;
|
|
51
|
+
/**
|
|
52
|
+
* The decimal chain ids every INTERMEDIATE hop of the plan passes through,
|
|
53
|
+
* origin and destination excluded — `RouteData.viaChainIds`'s own contract.
|
|
54
|
+
* Undefined (never an empty array) when the plan has nothing to report, per
|
|
55
|
+
* that field's own "ABSENT... on any route with no intermediate chain" doc.
|
|
56
|
+
*
|
|
57
|
+
* @param plan - the plan to derive from
|
|
58
|
+
* @returns the via chain ids in hop order, or undefined
|
|
59
|
+
*/
|
|
60
|
+
export declare const deriveViaChainIdsFromPlan: (plan: RoutePlan) => number[] | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* The plan's `RouteKind`, per the route-search design's section 1: `'direct'`
|
|
63
|
+
* when signature 1 IS the omnibridge crossing itself (no aggregator prefix —
|
|
64
|
+
* `buildDirectCrossingCandidate`'s shape, and `buildOutboundRouteData`'s
|
|
65
|
+
* shape), `'conversion'` when the LAST hop is a PulseX swap
|
|
66
|
+
* (`buildConversionRouteData`'s shape), `'aggregated'` otherwise (an
|
|
67
|
+
* aggregator carries signature 1, fused with a bridge hop or not —
|
|
68
|
+
* `buildNearIntentsTwoStepRouteData`'s shape, and the general
|
|
69
|
+
* aggregator-fused shape).
|
|
70
|
+
*
|
|
71
|
+
* DIVERGES FROM TODAY'S LITERAL OUTPUT FOR ONE CASE, DELIBERATELY: a
|
|
72
|
+
* same-chain candidate built by `buildDirectCrossingCandidate` and rendered
|
|
73
|
+
* through `buildCandidateRouteData` today always comes back `kind:
|
|
74
|
+
* 'aggregated'`, because that builder hard-codes `'aggregated'`
|
|
75
|
+
* unconditionally — an artifact of `RouteCandidate.entryChainId` being
|
|
76
|
+
* non-nullable, so `buildCandidateRouteData` always assumes an
|
|
77
|
+
* aggregator-entry shape even for a candidate with no aggregator leg at all.
|
|
78
|
+
* This function instead answers `'direct'` for that exact plan, matching how
|
|
79
|
+
* `buildDirectRouteData` (the OTHER, non-candidate 'direct' family) already
|
|
80
|
+
* represents the identical real-world same-chain crossing. See this
|
|
81
|
+
* module's test file for the specific case.
|
|
82
|
+
*
|
|
83
|
+
* @param plan - the plan to derive from
|
|
84
|
+
* @returns the route's kind
|
|
85
|
+
*/
|
|
86
|
+
export declare const derivePlanKind: (plan: RoutePlan) => RouteKind;
|
|
87
|
+
/**
|
|
88
|
+
* The plan's headline provider — the omnibridge crossing it out when it
|
|
89
|
+
* crosses one, or whichever carrier performs signature 1 when it does not.
|
|
90
|
+
* Matches every existing builder's own headline choice: the omnibridge when
|
|
91
|
+
* present (`buildCandidateRouteData`, `buildNearIntentsTwoStepRouteData`,
|
|
92
|
+
* `buildOutboundRouteData`), the aggregator's own key as the fallback
|
|
93
|
+
* (`buildCandidateRouteData`'s no-omnibridge branch).
|
|
94
|
+
*
|
|
95
|
+
* @param plan - the plan to derive from
|
|
96
|
+
* @returns the headline provider key
|
|
97
|
+
*/
|
|
98
|
+
export declare const deriveHeadlineProviderKeyFromPlan: (plan: RoutePlan) => ProviderKey;
|
|
99
|
+
/**
|
|
100
|
+
* The anchor a two-signature plan leaves the reader holding between its
|
|
101
|
+
* first and second groups — `RouteCandidate.plan`'s own TSDoc: "the anchor
|
|
102
|
+
* the reader is left holding between signatures... taken from the first hop
|
|
103
|
+
* of the second group." Reuses `describeDeferredCrossing`
|
|
104
|
+
* (`../../near-intents-route.js`) rather than re-validating the same
|
|
105
|
+
* "positive amount, resolved token" rule a second time.
|
|
106
|
+
*
|
|
107
|
+
* Null when the plan has only one signature group (there is no deferred
|
|
108
|
+
* crossing to describe) or the plan is malformed (a signature group naming
|
|
109
|
+
* hop indices the plan does not have).
|
|
110
|
+
*
|
|
111
|
+
* @param plan - the plan to derive from
|
|
112
|
+
* @param resolveToken - resolves a graph node to its full display token
|
|
113
|
+
* @param anchorUsdValue - the anchor's own carrier's valuation of the
|
|
114
|
+
* landing, exactly as `DeferredCrossing.anchorUsdValue` expects — supplied
|
|
115
|
+
* by the caller, since a plan carries no United States dollar figures.
|
|
116
|
+
* @returns the deferred crossing, or null
|
|
117
|
+
*/
|
|
118
|
+
export declare const deriveDeferredCrossingFromPlan: (plan: RoutePlan, resolveToken: ResolveNodeToken, anchorUsdValue: string | null) => DeferredCrossing | null;
|
|
119
|
+
/**
|
|
120
|
+
* The caller-supplied dollar figures and breakdown for ONE signature group —
|
|
121
|
+
* everything about a section this module cannot derive from the plan's
|
|
122
|
+
* structure alone (see this module's head doc).
|
|
123
|
+
*/
|
|
124
|
+
export type PlanSectionPricing = {
|
|
125
|
+
/**
|
|
126
|
+
* What this section leaves the user holding, in United States dollars, or
|
|
127
|
+
* null when unpriced — `RouteLandingData.usdValue` for this section.
|
|
128
|
+
*/
|
|
129
|
+
landingUsdValue: number | null;
|
|
130
|
+
/** This section's own cost, in United States dollars, or null when unpriced. */
|
|
131
|
+
feeUsdValue: number | null;
|
|
132
|
+
/**
|
|
133
|
+
* Each hop's own share of `feeUsdValue`, one entry per hop of the group in
|
|
134
|
+
* order, or omitted when the caller cannot price every hop.
|
|
135
|
+
*
|
|
136
|
+
* WHY A FUSED SECTION NEEDS THIS. One signature can carry two legs: an
|
|
137
|
+
* aggregator lands on the bridge's entry chain and makes the entry call in
|
|
138
|
+
* the same transaction. With no per-hop figure, a display that splits the
|
|
139
|
+
* section into legs can only put the whole cost on the first leg, so the
|
|
140
|
+
* aggregator wore the bridge's fee and the bridge leg read as free. The
|
|
141
|
+
* caller passes shares that add up to `feeUsdValue`, or nothing.
|
|
142
|
+
*/
|
|
143
|
+
hopFeeUsdValues?: readonly (number | null)[];
|
|
144
|
+
/**
|
|
145
|
+
* The gas split of `feeUsdValue`, from a producer that prices network gas
|
|
146
|
+
* apart: `feeExcludingGasUsdValue` is the cost without gas, `gasUsdValue` the
|
|
147
|
+
* signature's gas (null when unknown). `hopFeeExcludingGasUsdValues` splits
|
|
148
|
+
* the first the way `hopFeeUsdValues` splits the all-in figure. The gas sits
|
|
149
|
+
* on the section's first hop.
|
|
150
|
+
*/
|
|
151
|
+
feeExcludingGasUsdValue?: number | null;
|
|
152
|
+
gasUsdValue?: number | null;
|
|
153
|
+
hopFeeExcludingGasUsdValues?: readonly (number | null)[];
|
|
154
|
+
/** The itemized charges behind `feeUsdValue`, passed straight through to `RouteSectionData.fees`. */
|
|
155
|
+
fees?: readonly QuoteFee[];
|
|
156
|
+
/** Estimated duration for this signature in minutes, or null/undefined to omit. */
|
|
157
|
+
etaMinutes?: number | null;
|
|
158
|
+
/** Estimated duration for this signature in seconds, or null/undefined to omit. */
|
|
159
|
+
etaSeconds?: number | null;
|
|
160
|
+
/** Explanation shown for a deferred section; omitted lets the display adapter supply its default. */
|
|
161
|
+
deferredNote?: string;
|
|
162
|
+
/**
|
|
163
|
+
* Overrides this section's `landing.amount`. Omitted (the default) uses
|
|
164
|
+
* the plan's own composed estimate — the group's last hop's
|
|
165
|
+
* `outcome.deliveredAmount` — which is always present, per design section
|
|
166
|
+
* 3 ("only signature 1 must be binding... every later hop['s] outcome" is
|
|
167
|
+
* still an estimate, never absent). Pass `null` explicitly ONLY to
|
|
168
|
+
* reproduce a builder that states no figure at all for a leg it has not
|
|
169
|
+
* yet quoted by ANY means, composed or otherwise — `buildOutboundRouteData`'s
|
|
170
|
+
* deferred section is the one target shape that does this; see this
|
|
171
|
+
* module's test file for why that is a real, if now avoidable, gap rather
|
|
172
|
+
* than a rule to keep by default.
|
|
173
|
+
*/
|
|
174
|
+
landingAmountOverride?: bigint | null;
|
|
175
|
+
};
|
|
176
|
+
/** Everything {@link buildRouteDataFromPlan} needs beyond the plan's own structure. */
|
|
177
|
+
export type PlanRouteDataInputs = {
|
|
178
|
+
/** The priced plan to render. */
|
|
179
|
+
plan: RoutePlan;
|
|
180
|
+
/** Resolves a graph node to its full display token. */
|
|
181
|
+
resolveToken: ResolveNodeToken;
|
|
182
|
+
/** Stable identity for the route's sections, mirroring `RouteCandidate.id`. */
|
|
183
|
+
routeId: string;
|
|
184
|
+
/** One entry per signature group, in `plan.signatures` order. */
|
|
185
|
+
sections: readonly PlanSectionPricing[];
|
|
186
|
+
/** The route's aggregate all-in cost in United States dollars, or null/undefined. */
|
|
187
|
+
totalCostUsdValue?: number | null;
|
|
188
|
+
/** The all-in cost without network gas, or null/undefined. */
|
|
189
|
+
costExcludingGasUsdValue?: number | null;
|
|
190
|
+
/** The route's network gas in dollars, or null/undefined when unknown. */
|
|
191
|
+
gasCostUsdValue?: number | null;
|
|
192
|
+
/** The gas by signing chain, in signing order. */
|
|
193
|
+
gasByChain?: readonly RouteGasByChain[];
|
|
194
|
+
/** The route's net United States dollar outcome — the figure routes are ranked on. */
|
|
195
|
+
netValueUsd?: number | null;
|
|
196
|
+
/** Estimated end-to-end duration in minutes, or null/undefined. */
|
|
197
|
+
etaMinutes?: number | null;
|
|
198
|
+
};
|
|
199
|
+
/**
|
|
200
|
+
* Turns a priced {@link RoutePlan} into a raw {@link RouteData} — one section
|
|
201
|
+
* per signature group, `deferred` on every group after the first, each
|
|
202
|
+
* section's hops and token flow drawn structurally from the plan, and the
|
|
203
|
+
* dollar figures overlaid from `inputs.sections`. See this module's head doc
|
|
204
|
+
* for why the dollar figures are caller-supplied rather than derived here.
|
|
205
|
+
*
|
|
206
|
+
* NEVER SHOWS AN UNPRICED HEADLINE FIGURE, AND MARKS EVERY OTHER ESTIMATE AS
|
|
207
|
+
* ONE — PHASE 3. A section (and the route's own `output`) whose last hop is
|
|
208
|
+
* grounded on `EstimateBasis` `'unpriced'` lands on `amount: null`, whatever
|
|
209
|
+
* the caller's own pricing says, per {@link sectionLandingAmount}'s own doc.
|
|
210
|
+
* Every OTHER estimate (`'probe-rate'`, `'priced-conversion'`) still shows
|
|
211
|
+
* its figure, with `estimateBasis` set to that basis so a reader is never
|
|
212
|
+
* shown a composed/probed number as if it were a confirmed quote — see
|
|
213
|
+
* `RouteOutputData.estimateBasis`'s own doc (`../route-data.ts`) for the
|
|
214
|
+
* full rule this reads off {@link hopEstimateBasis}.
|
|
215
|
+
*
|
|
216
|
+
* @param inputs - the plan, a token resolver, an id, and per-section pricing
|
|
217
|
+
* @returns the raw route data
|
|
218
|
+
*/
|
|
219
|
+
export declare const buildRouteDataFromPlan: (inputs: PlanRouteDataInputs) => RouteData;
|
|
220
|
+
/** Everything {@link buildRouteCandidateFromPlan} needs beyond the plan's own structure. */
|
|
221
|
+
export type PlanCandidateInputs = {
|
|
222
|
+
/** The priced plan to build a candidate for. */
|
|
223
|
+
plan: RoutePlan;
|
|
224
|
+
/** Resolves a graph node to its full display token. */
|
|
225
|
+
resolveToken: ResolveNodeToken;
|
|
226
|
+
/** Stable identity for the candidate, mirroring today's `candidate.id`. */
|
|
227
|
+
id: string;
|
|
228
|
+
/** The base-unit amount entering the plan's first hop. */
|
|
229
|
+
inputAmount: bigint;
|
|
230
|
+
/** What the reader pays for the plan's first hop, exactly as its own carrier reported it. */
|
|
231
|
+
paidUsdValue: string | null;
|
|
232
|
+
/**
|
|
233
|
+
* What the plan's LAST hop's own carrier valued its delivered side at —
|
|
234
|
+
* read only when the plan crosses no bridge hop, mirroring
|
|
235
|
+
* `candidateDeliveredUsd`'s no-omnibridge branch.
|
|
236
|
+
*/
|
|
237
|
+
lastHopDeliveredUsdValue: string | null;
|
|
238
|
+
/** Per-destination-token United States dollar price, or null. */
|
|
239
|
+
destinationUsdPrice: number | null;
|
|
240
|
+
/** The omnibridge crossing fee, in destination-token base units. */
|
|
241
|
+
omnibridgeFeeAmount?: bigint;
|
|
242
|
+
/** The anchor's own carrier's valuation of the deferred-crossing landing, when the plan defers one. */
|
|
243
|
+
anchorUsdValue?: string | null;
|
|
244
|
+
/** The reader's typed amount, when it differs from `inputAmount` (see `RouteCandidate.requestedAmount`). */
|
|
245
|
+
requestedAmount?: bigint | null;
|
|
246
|
+
/** Charges the plan's carriers report outside `fromAmount`. */
|
|
247
|
+
fees?: readonly QuoteFee[];
|
|
248
|
+
/** The plan's first hop's own carrier-claimed execution duration, in seconds. */
|
|
249
|
+
executionDurationSeconds?: number;
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Turns a priced {@link RoutePlan} into a {@link RouteCandidate}, filling
|
|
253
|
+
* `plan` and deriving `deferredCrossing`, `entryChainId` and
|
|
254
|
+
* `omnibridgeProvider` from it exactly as `RouteCandidate.plan`'s own TSDoc
|
|
255
|
+
* (`../candidate.ts`) promises.
|
|
256
|
+
*
|
|
257
|
+
* @param inputs - the plan, a token resolver, an id, and the caller's pricing
|
|
258
|
+
* @returns the route candidate
|
|
259
|
+
*/
|
|
260
|
+
export declare const buildRouteCandidateFromPlan: (inputs: PlanCandidateInputs) => RouteCandidate;
|
|
261
|
+
/**
|
|
262
|
+
* Everything {@link buildRouteScoreInputsFromPlan} needs beyond the plan's
|
|
263
|
+
* own structure and `gaslessIntermediateChainCount`, which the design's own
|
|
264
|
+
* `RouteScoreInputs` doc says is "an input from the interface" — a live
|
|
265
|
+
* wallet balance read this pure module cannot perform.
|
|
266
|
+
*/
|
|
267
|
+
export type PlanValuation = PlanCandidateInputs & {
|
|
268
|
+
/** Each hop's own carrier-claimed execution duration, in seconds, in hop order. */
|
|
269
|
+
legClaimedDurationsSeconds: readonly (number | null | undefined)[];
|
|
270
|
+
};
|
|
271
|
+
/**
|
|
272
|
+
* Turns a priced {@link RoutePlan} into {@link RouteScoreInputs} — reusing
|
|
273
|
+
* `candidateDeliveredUsd`, `candidatePaidUsd` and `candidateOutsideFeesUsd`
|
|
274
|
+
* (`../producers.js`) against the SAME candidate
|
|
275
|
+
* {@link buildRouteCandidateFromPlan} builds, exactly as `RouteScoreInputs`'
|
|
276
|
+
* own doc in `score.ts` asks: "generalized to the plan's LAST hop and FIRST
|
|
277
|
+
* hop respectively... import and reuse them; do not write a second
|
|
278
|
+
* valuation."
|
|
279
|
+
*
|
|
280
|
+
* @param valuation - the plan, a token resolver, an id, and the caller's pricing
|
|
281
|
+
* @param gaslessIntermediateChainCount - intermediate chains the connected
|
|
282
|
+
* account holds no gas on — supplied by the caller, never computed here
|
|
283
|
+
* @returns the plan's score inputs
|
|
284
|
+
*/
|
|
285
|
+
export declare const buildRouteScoreInputsFromPlan: (valuation: PlanValuation, gaslessIntermediateChainCount: number) => RouteScoreInputs;
|