@gibs/bridge-sdk 1.13.1 → 1.17.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.
Files changed (217) hide show
  1. package/README.md +244 -18
  2. package/abis/package.json +6 -0
  3. package/bridge-limits/package.json +6 -0
  4. package/chain-info/package.json +6 -0
  5. package/chain-names/package.json +6 -0
  6. package/chains/package.json +6 -0
  7. package/claims/package.json +6 -0
  8. package/config/package.json +6 -0
  9. package/consolidated-quote/package.json +6 -0
  10. package/destination-calldata/package.json +6 -0
  11. package/dist/chain-info.d.ts +1 -1
  12. package/dist/chain-info.js +11 -12
  13. package/dist/chains.d.ts +25 -0
  14. package/dist/chains.js +55 -20
  15. package/dist/cjs/abis.d.ts +1 -0
  16. package/dist/cjs/abis.js +19 -0
  17. package/dist/cjs/bridge-limits.d.ts +103 -0
  18. package/dist/cjs/bridge-limits.js +89 -0
  19. package/dist/cjs/chain-info.d.ts +169 -0
  20. package/dist/cjs/chain-info.js +452 -0
  21. package/dist/cjs/chain-names.d.ts +160 -0
  22. package/dist/cjs/chain-names.js +207 -0
  23. package/dist/cjs/chains.d.ts +90 -0
  24. package/dist/cjs/chains.js +357 -0
  25. package/dist/cjs/claims.d.ts +198 -0
  26. package/dist/cjs/claims.js +182 -0
  27. package/dist/cjs/config.d.ts +240 -0
  28. package/dist/cjs/config.js +537 -0
  29. package/dist/cjs/consolidated-quote.d.ts +648 -0
  30. package/dist/cjs/consolidated-quote.js +1048 -0
  31. package/dist/cjs/destination-calldata.d.ts +118 -0
  32. package/dist/cjs/destination-calldata.js +156 -0
  33. package/dist/cjs/ecosystems.d.ts +217 -0
  34. package/dist/cjs/ecosystems.js +298 -0
  35. package/dist/cjs/execution.d.ts +346 -0
  36. package/dist/cjs/execution.js +468 -0
  37. package/dist/cjs/fee-type.d.ts +10 -0
  38. package/dist/cjs/fee-type.js +10 -0
  39. package/dist/cjs/hyperliquid-execution.d.ts +152 -0
  40. package/dist/cjs/hyperliquid-execution.js +175 -0
  41. package/dist/cjs/image-links.d.ts +117 -0
  42. package/dist/cjs/image-links.js +153 -0
  43. package/dist/cjs/index.d.ts +23 -0
  44. package/dist/cjs/index.js +39 -0
  45. package/dist/cjs/lifi-execution-guard.d.ts +210 -0
  46. package/dist/cjs/lifi-execution-guard.js +409 -0
  47. package/dist/cjs/near-intents-conformance.d.ts +85 -0
  48. package/dist/cjs/near-intents-conformance.js +337 -0
  49. package/dist/cjs/near-intents-route.d.ts +47 -0
  50. package/dist/cjs/near-intents-route.js +303 -0
  51. package/dist/cjs/near-intents.d.ts +524 -0
  52. package/dist/cjs/near-intents.js +1071 -0
  53. package/dist/cjs/origin-deposit.d.ts +326 -0
  54. package/dist/cjs/origin-deposit.js +82 -0
  55. package/dist/cjs/package.json +3 -0
  56. package/dist/cjs/pre-quote.d.ts +198 -0
  57. package/dist/cjs/pre-quote.js +180 -0
  58. package/dist/cjs/prices.d.ts +107 -0
  59. package/dist/cjs/prices.js +172 -0
  60. package/dist/cjs/providers.d.ts +238 -0
  61. package/dist/cjs/providers.js +171 -0
  62. package/dist/cjs/quote-fees.d.ts +102 -0
  63. package/dist/cjs/quote-fees.js +201 -0
  64. package/dist/cjs/referral.d.ts +85 -0
  65. package/dist/cjs/referral.js +85 -0
  66. package/dist/cjs/relay-currencies.d.ts +47 -0
  67. package/dist/cjs/relay-currencies.js +95 -0
  68. package/dist/cjs/relay-depository.d.ts +2 -0
  69. package/dist/cjs/relay-depository.js +85 -0
  70. package/dist/cjs/relay-quote.d.ts +301 -0
  71. package/dist/cjs/relay-quote.js +996 -0
  72. package/dist/cjs/route-steps.d.ts +138 -0
  73. package/dist/cjs/route-steps.js +310 -0
  74. package/dist/cjs/routing/amounts.d.ts +80 -0
  75. package/dist/cjs/routing/amounts.js +126 -0
  76. package/dist/cjs/routing/candidate-route.d.ts +43 -0
  77. package/dist/cjs/routing/candidate-route.js +50 -0
  78. package/dist/cjs/routing/candidate.d.ts +237 -0
  79. package/dist/cjs/routing/candidate.js +100 -0
  80. package/dist/cjs/routing/carriers/ask-answer.d.ts +77 -0
  81. package/dist/cjs/routing/carriers/ask-answer.js +2 -0
  82. package/dist/cjs/routing/carriers/omnibridge.d.ts +137 -0
  83. package/dist/cjs/routing/carriers/omnibridge.js +459 -0
  84. package/dist/cjs/routing/carriers/pulsex-paths.d.ts +80 -0
  85. package/dist/cjs/routing/carriers/pulsex-paths.js +97 -0
  86. package/dist/cjs/routing/carriers/pulsex-split.d.ts +175 -0
  87. package/dist/cjs/routing/carriers/pulsex-split.js +193 -0
  88. package/dist/cjs/routing/carriers/pulsex.d.ts +159 -0
  89. package/dist/cjs/routing/carriers/pulsex.js +565 -0
  90. package/dist/cjs/routing/carriers/wrap.d.ts +25 -0
  91. package/dist/cjs/routing/carriers/wrap.js +119 -0
  92. package/dist/cjs/routing/composed-route-quality.d.ts +125 -0
  93. package/dist/cjs/routing/composed-route-quality.js +144 -0
  94. package/dist/cjs/routing/entry-chain-anchor.d.ts +88 -0
  95. package/dist/cjs/routing/entry-chain-anchor.js +59 -0
  96. package/dist/cjs/routing/format.d.ts +31 -0
  97. package/dist/cjs/routing/format.js +64 -0
  98. package/dist/cjs/routing/index.d.ts +38 -0
  99. package/dist/cjs/routing/index.js +134 -0
  100. package/dist/cjs/routing/producers.d.ts +770 -0
  101. package/dist/cjs/routing/producers.js +1617 -0
  102. package/dist/cjs/routing/providers.d.ts +31 -0
  103. package/dist/cjs/routing/providers.js +48 -0
  104. package/dist/cjs/routing/route-data.d.ts +355 -0
  105. package/dist/cjs/routing/route-data.js +2 -0
  106. package/dist/cjs/routing/search/compose.d.ts +168 -0
  107. package/dist/cjs/routing/search/compose.js +104 -0
  108. package/dist/cjs/routing/search/graph.d.ts +668 -0
  109. package/dist/cjs/routing/search/graph.js +461 -0
  110. package/dist/cjs/routing/search/plan-route-data.d.ts +269 -0
  111. package/dist/cjs/routing/search/plan-route-data.js +848 -0
  112. package/dist/cjs/routing/search/score.d.ts +356 -0
  113. package/dist/cjs/routing/search/score.js +445 -0
  114. package/dist/cjs/routing/swap-transactions.d.ts +91 -0
  115. package/dist/cjs/routing/swap-transactions.js +131 -0
  116. package/dist/cjs/routing/usd-value.d.ts +17 -0
  117. package/dist/cjs/routing/usd-value.js +29 -0
  118. package/dist/cjs/settings.d.ts +785 -0
  119. package/dist/cjs/settings.js +1074 -0
  120. package/dist/cjs/ton-connect.d.ts +98 -0
  121. package/dist/cjs/ton-connect.js +206 -0
  122. package/dist/cjs/ton-execution.d.ts +7 -0
  123. package/dist/cjs/ton-execution.js +23 -0
  124. package/dist/cjs/ton.d.ts +37 -0
  125. package/dist/cjs/ton.js +83 -0
  126. package/dist/cjs/tron-execution.d.ts +146 -0
  127. package/dist/cjs/tron-execution.js +248 -0
  128. package/dist/cjs/types.d.ts +51 -0
  129. package/dist/cjs/types.js +2 -0
  130. package/dist/claims.d.ts +198 -0
  131. package/dist/claims.js +140 -0
  132. package/dist/config.d.ts +24 -0
  133. package/dist/config.js +39 -5
  134. package/dist/consolidated-quote.d.ts +109 -15
  135. package/dist/consolidated-quote.js +310 -52
  136. package/dist/execution.d.ts +346 -0
  137. package/dist/execution.js +428 -0
  138. package/dist/hyperliquid-execution.js +2 -3
  139. package/dist/index.d.ts +3 -0
  140. package/dist/index.js +3 -0
  141. package/dist/lifi-execution-guard.d.ts +13 -2
  142. package/dist/lifi-execution-guard.js +4 -0
  143. package/dist/near-intents.js +2 -3
  144. package/dist/pre-quote.d.ts +6 -6
  145. package/dist/pre-quote.js +10 -14
  146. package/dist/providers.d.ts +17 -0
  147. package/dist/providers.js +6 -0
  148. package/dist/referral.d.ts +12 -4
  149. package/dist/referral.js +12 -4
  150. package/dist/relay-depository.d.ts +2 -0
  151. package/dist/relay-depository.js +82 -0
  152. package/dist/relay-quote.js +2 -3
  153. package/dist/routing/candidate.d.ts +3 -3
  154. package/dist/routing/candidate.js +3 -3
  155. package/dist/routing/carriers/ask-answer.d.ts +17 -0
  156. package/dist/routing/carriers/omnibridge.js +23 -21
  157. package/dist/routing/carriers/pulsex-paths.d.ts +80 -0
  158. package/dist/routing/carriers/pulsex-paths.js +92 -0
  159. package/dist/routing/carriers/pulsex-split.d.ts +175 -0
  160. package/dist/routing/carriers/pulsex-split.js +185 -0
  161. package/dist/routing/carriers/pulsex.d.ts +31 -21
  162. package/dist/routing/carriers/pulsex.js +141 -71
  163. package/dist/routing/composed-route-quality.d.ts +28 -6
  164. package/dist/routing/composed-route-quality.js +36 -5
  165. package/dist/routing/entry-chain-anchor.d.ts +1 -1
  166. package/dist/routing/entry-chain-anchor.js +1 -1
  167. package/dist/routing/index.d.ts +6 -2
  168. package/dist/routing/index.js +6 -2
  169. package/dist/routing/producers.js +1 -1
  170. package/dist/routing/providers.d.ts +5 -0
  171. package/dist/routing/providers.js +5 -0
  172. package/dist/routing/search/graph.d.ts +15 -0
  173. package/dist/routing/search/plan-route-data.d.ts +25 -0
  174. package/dist/routing/search/plan-route-data.js +43 -7
  175. package/dist/routing/search/score.d.ts +3 -0
  176. package/dist/routing/search/score.js +11 -3
  177. package/dist/routing/swap-transactions.d.ts +91 -0
  178. package/dist/routing/swap-transactions.js +125 -0
  179. package/dist/settings.d.ts +94 -1
  180. package/dist/settings.js +95 -3
  181. package/dist/ton-connect.d.ts +98 -0
  182. package/dist/ton-connect.js +200 -0
  183. package/dist/ton-execution.d.ts +4 -114
  184. package/dist/ton-execution.js +4 -244
  185. package/dist/ton.d.ts +37 -0
  186. package/dist/ton.js +65 -0
  187. package/docs/examples/example-a-ether-to-pulse.ts +300 -0
  188. package/docs/examples/example-b-token-pulsechain-to-ethereum.ts +270 -0
  189. package/docs/examples/shared.ts +261 -0
  190. package/docs/examples/tsconfig.json +18 -0
  191. package/docs/integration-guide.md +617 -0
  192. package/ecosystems/package.json +6 -0
  193. package/execution/package.json +6 -0
  194. package/fee-type/package.json +6 -0
  195. package/hyperliquid-execution/package.json +6 -0
  196. package/image-links/package.json +6 -0
  197. package/lifi-execution-guard/package.json +6 -0
  198. package/llms.txt +75 -10
  199. package/near-intents/package.json +6 -0
  200. package/near-intents-route/package.json +6 -0
  201. package/origin-deposit/package.json +6 -0
  202. package/package.json +817 -10
  203. package/pre-quote/package.json +6 -0
  204. package/prices/package.json +6 -0
  205. package/providers/package.json +6 -0
  206. package/quote-fees/package.json +6 -0
  207. package/referral/package.json +6 -0
  208. package/relay-currencies/package.json +6 -0
  209. package/relay-quote/package.json +6 -0
  210. package/route-steps/package.json +6 -0
  211. package/routing/package.json +6 -0
  212. package/settings/package.json +6 -0
  213. package/ton/package.json +6 -0
  214. package/ton-connect/package.json +6 -0
  215. package/ton-execution/package.json +6 -0
  216. package/tron-execution/package.json +6 -0
  217. package/types/package.json +6 -0
@@ -0,0 +1,648 @@
1
+ import { type Hex } from 'viem';
2
+ import type { DestinationCall } from './destination-calldata.js';
3
+ import type { Ecosystem } from './ecosystems.js';
4
+ import { type EvmDeposit, type OriginDeposit } from './origin-deposit.js';
5
+ import type { ProviderId, ProviderQuoteContext } from './providers.js';
6
+ import { type QuoteFee } from './quote-fees.js';
7
+ import type { ApprovalRequirement } from './settings.js';
8
+ import type { RouteStep, Token } from './types.js';
9
+ /**
10
+ * Gibs Finance's own LI.FI `integrator` label.
11
+ *
12
+ * NOT A DEFAULT. A request that leaves
13
+ * {@link ConsolidatedQuoteRequest.lifiIntegrator} out sends no `integrator`
14
+ * at all. An integrator label is attribution: LI.FI records the traffic under
15
+ * it, and pays any `fee` to the account behind it. A wallet that builds on this
16
+ * package must not attribute its users' routes to Gibs Finance without
17
+ * choosing to. The Gibs interface passes this value explicitly.
18
+ */
19
+ export declare const lifiIntegrator = "gibs.finance";
20
+ /**
21
+ * The referral fee Gibs Finance charges on its own LI.FI routes (0.001 = 0.1%).
22
+ * No builder applies it. A request carries a fee only when it sets `lifiFee`.
23
+ */
24
+ export declare const lifiReferralFeePercent = 0.001;
25
+ /**
26
+ * LI.FI's HTTP origin when the interface's `PUBLIC_LIFI_API_URL` build flag is
27
+ * unset. Points straight at LI.FI rather than through the server-side proxy,
28
+ * so local development and the anonymous IPFS build still get real quotes —
29
+ * at LI.FI's shared, unauthenticated tier — with no configuration at all.
30
+ */
31
+ export declare const lifiDefaultApiOrigin = "https://li.quest";
32
+ /**
33
+ * Every LI.FI endpoint address this codebase calls, built from one origin.
34
+ *
35
+ * @see {@link lifiEndpoints}
36
+ */
37
+ export type LifiEndpoints = {
38
+ /** The plain quote endpoint: carry funds and stop. A GET; parameters ride in the query string. */
39
+ readonly quote: string;
40
+ /** Quote endpoint that accepts destination contract calls. A POST. */
41
+ readonly contractCallsQuote: string;
42
+ /** Chain listing endpoint. */
43
+ readonly chains: string;
44
+ /** Builds the per-chain token listing address. */
45
+ readonly tokens: (chainId: number) => string;
46
+ /** Builds the status-poll address for an origin transaction. */
47
+ readonly status: (params: {
48
+ txHash: string;
49
+ fromChainId?: number;
50
+ toChainId?: number;
51
+ }) => string;
52
+ };
53
+ /**
54
+ * Builds every LI.FI endpoint address from one origin — THE ONE PLACE the
55
+ * `/v1/...` paths are spelled, so a caller pointed at a different origin (the
56
+ * server-side proxy at `https://lifi.gibs.finance`, or LI.FI itself) never
57
+ * duplicates them by hand.
58
+ *
59
+ * `apiOrigin` is the scheme-plus-host ONLY (e.g. `https://lifi.gibs.finance`),
60
+ * never a path — a trailing slash is trimmed, but this throws for anything
61
+ * that is not an absolute `http:`/`https:` URL, so a malformed configuration
62
+ * fails at startup rather than silently building a broken address.
63
+ *
64
+ * @param apiOrigin - the scheme-plus-host to reach LI.FI's `/v1` interface through
65
+ * @returns a frozen object of every endpoint this codebase calls
66
+ */
67
+ export declare const lifiEndpoints: (apiOrigin: string) => LifiEndpoints;
68
+ /** Quote endpoint that accepts destination contract calls, at {@link lifiDefaultApiOrigin}. */
69
+ export declare const lifiContractCallsQuoteUrl: string;
70
+ /**
71
+ * The plain quote endpoint, at {@link lifiDefaultApiOrigin}: carry funds and stop.
72
+ *
73
+ * WHICH ENDPOINT A ROUTE USES IS DECIDED BY WHETHER ANYTHING RUNS ON ARRIVAL,
74
+ * not by which chains the provider covers. A crossing into the omnibridge needs
75
+ * a call made on the entry chain, so it goes to
76
+ * {@link lifiContractCallsQuoteUrl} and arrives as one signature. A route the
77
+ * omnibridge does not touch has nothing to run on arrival, so it asks here.
78
+ *
79
+ * A GET, unlike its sibling — the parameters are a query string.
80
+ */
81
+ export declare const lifiQuoteUrl: string;
82
+ /**
83
+ * Builds the headers for a LI.FI request.
84
+ *
85
+ * CARRIES NO API KEY. LI.FI's own documentation forbids setting
86
+ * `x-lifi-api-key` in a browser — "Never expose your x-lifi-api-key in
87
+ * client-side environments such as browser-based JavaScript" — so this
88
+ * codebase never attaches one here. The key lives on the server-side proxy
89
+ * (`https://lifi.gibs.finance`) that fronts `lifiApiOrigin`, added to the
90
+ * outbound request there, never in this bundle. LI.FI answers every endpoint
91
+ * with no key at a lower, shared rate limit, so a request built from this is a
92
+ * normal operating state, not a degraded one.
93
+ *
94
+ * ONE HELPER FOR EVERY LI.FI ENDPOINT — the plain quote, the contract-calls
95
+ * quote, `/v1/chains`, `/v1/tokens`, and `/v1/status` all build their headers
96
+ * through this, rather than each call site duplicating the content-type.
97
+ */
98
+ export declare const lifiRequestHeaders: () => Record<string, string>;
99
+ /**
100
+ * Provider-agnostic input for a consolidated quote: bridge `toAmount` of the
101
+ * Ethereum-side token onto Ethereum and have the aggregator's executor perform
102
+ * `destinationCall` to relay it onward through the omnibridge.
103
+ */
104
+ /**
105
+ * The virtual-machine family of a NON-ETHEREUM origin chain. The destination
106
+ * half of a consolidated route is always an Ethereum Virtual Machine entry
107
+ * chain (Ethereum or Binance Smart Chain), so only the origin can differ, and
108
+ * "Ethereum origin" is spelled by leaving this field UNSET, never by setting
109
+ * it to `'evm'`.
110
+ *
111
+ * - `svm` — Solana Virtual Machine (base58 addresses, native lamports)
112
+ * - `bvm` — Bitcoin Virtual Machine (bech32/base58 addresses, native satoshis)
113
+ * - `tvm` — Tron Virtual Machine (base58check addresses, native sun)
114
+ * - `tonvm` — The Open Network (base64url or raw addresses, native nanotons)
115
+ * - `hypevm` — Hyperliquid (Ethereum-style accounts, HyperCore token identifiers)
116
+ * - `zcash` — a pay-by-hand origin (no wallet, no signer; see `chain-names.ts`)
117
+ *
118
+ * EXCLUDES `'evm'` ON PURPOSE. `Ecosystem` (this type's source union) includes
119
+ * `'evm'`, and until this exclusion the field's own type allowed a request to
120
+ * set `originVmType: 'evm'` explicitly — a request that CONTRADICTS "absent
121
+ * means Ethereum" without being rejected by anything. `isNonEthereumVirtualMachineOrigin`
122
+ * and every other reader here treat "absent" and "'evm'" as the same state,
123
+ * but a caller that built the request the other way used `recipient` as the
124
+ * Ethereum identity instead of the connected account, silently. Excluding
125
+ * `'evm'` from the type makes that request impossible to construct, rather
126
+ * than merely unlikely — the same shape of fix `near-intents.ts` applies to
127
+ * its own request-building for exactly this reason.
128
+ */
129
+ export type OriginVmType = Exclude<Ecosystem, 'evm'>;
130
+ export type ConsolidatedQuoteRequest = {
131
+ /** Chain the user's funds start on (any aggregator-supported chain) */
132
+ fromChainId: number;
133
+ /**
134
+ * Token the user pays with on the origin chain (zero address for an Ethereum
135
+ * Virtual Machine native asset). Typed as `string` rather than `Hex` so a
136
+ * non-Ethereum native currency address can flow through unchanged — a Solana
137
+ * base58 mint or the Bitcoin native-currency string Relay expects. Existing
138
+ * Ethereum Virtual Machine callers are unaffected: `Hex` is a subset of
139
+ * `string`, so this is a safe widening.
140
+ */
141
+ fromTokenAddress: string;
142
+ /**
143
+ * The user's address on the origin chain. Typed as `string` rather than `Hex`
144
+ * for the same reason as `fromTokenAddress`: a non-Ethereum origin carries a
145
+ * base58 (Solana) or bech32 (Bitcoin) address here. Ethereum Virtual Machine
146
+ * callers pass the same `0x` address they always have.
147
+ *
148
+ * A CHAIN THE READER PAYS BY HAND HAS NO ORIGIN ADDRESS, because no wallet
149
+ * connects to it (see `isDepositAddressChain`). Nothing reads this field for
150
+ * such a route; the refund account travels in
151
+ * {@link ConsolidatedQuoteRequest.connectedEthereumAccount} instead, under a
152
+ * name that says what it is.
153
+ */
154
+ fromAddress: string;
155
+ /**
156
+ * The reader's CONNECTED Ethereum account, exactly as the wallet connection
157
+ * reports it — never a value from any field the reader can type or a link
158
+ * can seed.
159
+ *
160
+ * Read only for an origin the reader pays by hand. There the NEAR Intents
161
+ * builder names it, lower-cased, as the refund account inside NEAR Intents:
162
+ * the reader holds no origin-chain address to refund to, and an Ethereum key
163
+ * controls the implicit NEAR account of the same name. The service accepts
164
+ * any string shaped like a NEAR account name, so its acceptance proves
165
+ * nothing — this field's source is the only proof the refund reaches the
166
+ * reader. Absent, a pay-by-hand route builds no request at all. See
167
+ * `docs/near-implicit-account-refunds.md`.
168
+ */
169
+ connectedEthereumAccount?: Hex;
170
+ /** Ethereum-side token the omnibridge mapping accepts */
171
+ toTokenAddress: Hex;
172
+ /** Guaranteed minimum amount of the Ethereum-side token arriving, in base units */
173
+ toAmount: bigint;
174
+ /**
175
+ * The omnibridge entry call the executor performs with exactly `toAmount`.
176
+ *
177
+ * ABSENT ON A ROUTE THAT DOES NOT TOUCH THE OMNIBRIDGE. Every route this type
178
+ * described used to end on PulseChain, so an entry call was always part of
179
+ * the answer: the aggregator carried funds to Ethereum or Binance Smart
180
+ * Chain, and this call handed them to the bridge. A route between two chains
181
+ * the bridge's own contracts do not run on has no such leg — the provider
182
+ * delivers to the recipient and the journey is over — so this is optional and
183
+ * its absence is what distinguishes the two kinds.
184
+ */
185
+ destinationCall?: DestinationCall;
186
+ /**
187
+ * What the reader is spending, in the origin token's base units.
188
+ *
189
+ * Carried only for a route with no {@link destinationCall}, and it is what
190
+ * makes that route a different QUESTION rather than the same one with a
191
+ * missing field. A route into the omnibridge is solved BACKWARDS: the entry
192
+ * call must receive an exact amount, so the provider is asked for an exact
193
+ * OUTPUT and works out the input. A direct route has no such constraint — the
194
+ * reader says what they are sending — so the provider is asked for an exact
195
+ * INPUT and the delivered amount is whatever the market gives.
196
+ */
197
+ fromAmount?: bigint;
198
+ /**
199
+ * Where the bridged tokens are delivered on PulseChain. Already encoded inside
200
+ * `destinationCall`; carried here as well so the resume record and the
201
+ * confirmation surface can show the destination without decoding calldata.
202
+ */
203
+ recipient: Hex;
204
+ /** Where tokens land on Ethereum if the destination call reverts */
205
+ fallbackAddress: Hex;
206
+ /** Maximum slippage as a fraction (e.g. 0.005); provider default when omitted */
207
+ slippage?: number;
208
+ /**
209
+ * The omnibridge entry chain the aggregator bridges to (Ethereum or Binance
210
+ * Smart Chain). Defaults to Ethereum when omitted, preserving the original
211
+ * single-entry behavior.
212
+ */
213
+ toChainId?: number;
214
+ /**
215
+ * Virtual-machine family of the ORIGIN chain. Defaults to Ethereum Virtual
216
+ * Machine semantics when absent, so every existing caller behaves exactly as
217
+ * before. Set to `svm` or `bvm` for a non-Ethereum origin: this is what gates
218
+ * the provider that may quote the route (only Relay can cross ecosystems) and
219
+ * what selects the origin-side refund address inside the Relay request
220
+ * builder.
221
+ */
222
+ originVmType?: OriginVmType;
223
+ /**
224
+ * Bitcoin pay-to-script-hash public key. Relay requires it via the request's
225
+ * `additionalData.userPublicKey` to construct a Bitcoin deposit. Only consulted
226
+ * for a Bitcoin origin (`originVmType` of `bvm`); ignored otherwise.
227
+ */
228
+ bitcoinPublicKey?: string;
229
+ /**
230
+ * Solana fee-payer address. Relay accepts it as `depositFeePayer` to sponsor
231
+ * the deposit transaction's fee on Solana. Only consulted for a Solana origin
232
+ * (`originVmType` of `svm`); ignored otherwise.
233
+ */
234
+ solanaFeePayer?: string;
235
+ /**
236
+ * LI.FI referral fee as a decimal fraction (e.g. 0.001 = 0.1%). When set and
237
+ * positive, forwarded as the `fee` parameter in LI.FI quote requests. Omitted
238
+ * when zero or absent so no fee is charged on unannotated requests.
239
+ */
240
+ lifiFee?: number;
241
+ /**
242
+ * The LI.FI `integrator` label. Left out or `null`, the field is not sent; a
243
+ * string is sent as-is. REQUIRED (as a string)
244
+ * whenever {@link lifiFee} is positive: LI.FI pays a fee to the account behind
245
+ * the integrator label, so a fee needs a label that is yours.
246
+ */
247
+ lifiIntegrator?: string | null;
248
+ /**
249
+ * The Relay `referrer`. Left out or `null`, the field is not sent: Relay
250
+ * reads any `referrer` as "a referrer was supplied" and then requires an API
251
+ * key, so a default would break a caller who has none. A string is sent as-is.
252
+ */
253
+ relayReferrer?: string | null;
254
+ /**
255
+ * Relay app-fee configuration. When set, the Relay quote builder attaches the
256
+ * fee recipient and basis-point amount to the request. Wired in Task 5.
257
+ */
258
+ relayAppFee?: {
259
+ recipient: Hex;
260
+ basisPoints: bigint;
261
+ };
262
+ };
263
+ /**
264
+ * Whether a consolidated quote request originates on a non-Ethereum-Virtual-
265
+ * Machine chain. A missing `originVmType` is treated as Ethereum Virtual
266
+ * Machine, so existing callers are never classified non-Ethereum.
267
+ *
268
+ * Deliberately expressed as "anything that is not Ethereum" rather than as a
269
+ * list of the non-Ethereum families. The two behaviors this gates — excluding a
270
+ * route from LI.FI, and refunding on the ORIGIN chain instead of to an Ethereum
271
+ * fallback address — are both wrong by default for an unlisted ecosystem, and a
272
+ * positive list fails open: a newly registered family would be handed to LI.FI
273
+ * with a non-Ethereum address cast to `Hex`, and would name an Ethereum address
274
+ * as its origin-chain refund target. Inverting the test makes every future
275
+ * ecosystem safe on arrival.
276
+ *
277
+ * Hyperliquid counts as non-Ethereum here despite using Ethereum-style account
278
+ * addresses: Relay's origin for it is HyperCore, whose deposit is a signed
279
+ * typed-data action posted to an API rather than a broadcast transaction, and
280
+ * which LI.FI does not carry.
281
+ *
282
+ * @param request - the consolidated quote request to classify
283
+ * @returns true when the origin is any ecosystem other than Ethereum
284
+ */
285
+ export declare const isNonEthereumVirtualMachineOrigin: (request: Pick<ConsolidatedQuoteRequest, "originVmType">) => boolean;
286
+ /** One destination contract call in the LI.FI request body. */
287
+ export type LifiContractCall = {
288
+ fromAmount: string;
289
+ fromTokenAddress: Hex;
290
+ toContractAddress: Hex;
291
+ toContractCallData: Hex;
292
+ toContractGasLimit: string;
293
+ toApprovalAddress?: Hex;
294
+ };
295
+ /** The JSON body for `POST /v1/quote/contractCalls`. */
296
+ export type LifiContractCallsRequestBody = {
297
+ fromChain: number;
298
+ fromToken: Hex;
299
+ fromAddress: Hex;
300
+ toChain: number;
301
+ toToken: Hex;
302
+ toAmount: string;
303
+ toFallbackAddress: Hex;
304
+ /** Present only when the request names a `lifiIntegrator`. */
305
+ integrator?: string;
306
+ /** Referral fee as a decimal fraction (e.g. 0.001 = 0.1%). Omitted when not charging a fee. */
307
+ fee?: number;
308
+ slippage?: number;
309
+ contractCalls: LifiContractCall[];
310
+ };
311
+ /**
312
+ * The attribution fields of a LI.FI request: the `integrator` label and, when
313
+ * one is charged, the referral `fee`. Shared by both LI.FI builders so the two
314
+ * endpoints can never attribute or charge differently.
315
+ *
316
+ * @param request - the consolidated request's attribution fields
317
+ * @returns the fields to merge into the request; empty when none apply
318
+ * @throws when a positive `lifiFee` arrives without an explicit `lifiIntegrator`
319
+ * string — LI.FI would have nobody of yours to pay it to
320
+ */
321
+ export declare const lifiAttribution: (request: Pick<ConsolidatedQuoteRequest, "lifiFee" | "lifiIntegrator">) => {
322
+ integrator?: string;
323
+ fee?: number;
324
+ };
325
+ /**
326
+ * Builds the LI.FI contract-calls quote request from a provider-agnostic
327
+ * consolidated request. LI.FI quotes backwards from `toAmount` (the guaranteed
328
+ * minimum arriving on Ethereum), which is what makes the fixed amount inside
329
+ * the destination calldata safe.
330
+ *
331
+ * @returns the request body, or null when the inputs cannot form a valid call
332
+ */
333
+ /**
334
+ * Builds the query string for LI.FI's plain `GET /v1/quote`.
335
+ *
336
+ * THE ROUTE THIS EXISTS FOR. A crossing with no omnibridge leg had exactly one
337
+ * bidder — Relay — because our only LI.FI endpoint was the contract-calls one,
338
+ * which cannot express a route that calls nothing. Every any-to-any quote was
339
+ * therefore a price with nothing to rank it against.
340
+ *
341
+ * SOLVED FORWARDS, WHICH IS THE OPPOSITE OF ITS SIBLING. An omnibridge route is
342
+ * asked for an exact OUTPUT, because the entry call must receive an exact
343
+ * amount. Here the reader names what they spend and the delivered amount is
344
+ * whatever the market gives, so `fromAmount` is the input and the answer's
345
+ * `toAmount` is the thing that differs between providers. Ranking two forward
346
+ * quotes on what they cost compares two identical numbers — see
347
+ * `orderQuotesByCost` in the interface, which ranks these on what ARRIVES.
348
+ *
349
+ * Returns null for a request carrying a `destinationCall`: that route belongs
350
+ * to the other endpoint, and sending it here would quote a crossing that stops
351
+ * on the entry chain and never enters the bridge.
352
+ *
353
+ * @param request - the consolidated request to express
354
+ * @returns the query string, or null when this endpoint cannot express it
355
+ * @throws when `lifiFee` is positive and `lifiIntegrator` is not a string — see {@link lifiAttribution}
356
+ */
357
+ export declare const buildLifiQuoteRequest: (request: ConsolidatedQuoteRequest) => string | null;
358
+ export declare const buildLifiContractCallsRequest: (request: ConsolidatedQuoteRequest) => LifiContractCallsRequestBody | null;
359
+ /** Aggregators that can quote the consolidated route. Alias of the registry's id. */
360
+ export type ConsolidatedProvider = ProviderId;
361
+ /**
362
+ * A provider-agnostic, normalized consolidated quote. The guaranteed minimum
363
+ * arriving on Ethereum is NOT in here — the response echoes it as zero because
364
+ * the destination contract call consumes it; callers already hold it on the
365
+ * request they quoted with.
366
+ */
367
+ export type ConsolidatedQuote = {
368
+ provider: ConsolidatedProvider;
369
+ /** The provider's quote identifier, kept for support and resume records */
370
+ quoteId: string;
371
+ /** Bridging tool the provider selected (e.g. stargateV2) */
372
+ tool: string;
373
+ /** Human-readable tool name for display */
374
+ toolName: string;
375
+ /** Amount of the origin token the user pays, in base units */
376
+ fromAmount: bigint;
377
+ /**
378
+ * What the route delivers, in the destination token's base units, when the
379
+ * provider is the only one who knows.
380
+ *
381
+ * Absent on an omnibridge route and deliberately so: that route asks for an
382
+ * exact OUTPUT, so the caller already named the delivered amount and reading
383
+ * it back off the answer would be asking the provider to confirm arithmetic
384
+ * the caller did. A DIRECT route asks for an exact INPUT, so the delivered
385
+ * amount exists nowhere until the provider says it.
386
+ */
387
+ toAmount?: bigint;
388
+ /** United States dollar value of `fromAmount`, as reported by the provider */
389
+ fromAmountUsd: string | null;
390
+ /**
391
+ * United States dollar value of {@link toAmount}, as reported by the SAME
392
+ * provider that valued `fromAmount`.
393
+ *
394
+ * WHY THE PROVIDER'S OWN NUMBER AND NOT A PRICE FEED. A route's cost is the
395
+ * gap between what was paid and what arrived, and that gap is only a cost if
396
+ * both figures come from one feed — two feeds disagree by more than a small
397
+ * route's whole fee, which is how a zero-fee crossing once reported a loss.
398
+ * The provider prices both sides in one answer, so the difference is the
399
+ * route and nothing else.
400
+ *
401
+ * Absent on an omnibridge route for the same reason as {@link toAmount}: the
402
+ * provider's delivered side there is the ENTRY chain's tokens, not what
403
+ * finally lands on PulseChain, so its valuation answers a different question.
404
+ */
405
+ toAmountUsd?: string;
406
+ /** Contract the user must approve for token spends on the origin chain, null for native */
407
+ approvalAddress: Hex | null;
408
+ /** Provider's estimate of seconds until the route completes */
409
+ executionDurationSeconds: number;
410
+ /**
411
+ * Ordered list of normalized route legs the UI can display as a "steps" view.
412
+ * Empty when the provider response carries no per-leg breakdown — never undefined.
413
+ */
414
+ steps: RouteStep[];
415
+ /** The signable origin deposit for the user to submit on the source chain */
416
+ originDeposit: OriginDeposit;
417
+ /**
418
+ * What the route charges, normalized across providers.
419
+ *
420
+ * Read `includedInFromAmount` before totalling: a charge marked false is paid
421
+ * ON TOP of `fromAmount`, so `fromAmount` alone is not what the route costs.
422
+ * See `totalQuoteCostUsd`. Empty when the provider reported no breakdown -
423
+ * never undefined.
424
+ */
425
+ fees: QuoteFee[];
426
+ };
427
+ /**
428
+ * Narrows a quote's origin deposit to the Ethereum-Virtual-Machine variant.
429
+ * Throws when the deposit is not Ethereum, because the Ethereum-only execute
430
+ * path must never silently proceed on a Solana or Bitcoin payload.
431
+ */
432
+ export declare const evmDepositOf: (quote: ConsolidatedQuote) => EvmDeposit;
433
+ /** Why an aggregator's origin deposit is refused before anything is approved or sent. */
434
+ export type AggregatorOriginRefusal = {
435
+ reason: 'not-evm-deposit';
436
+ depositFamily: string;
437
+ } | {
438
+ reason: 'chain-mismatch';
439
+ depositChainId: number;
440
+ requestChainId: number;
441
+ } | {
442
+ reason: 'unverified-provider';
443
+ provider: string;
444
+ } | {
445
+ reason: 'unverified-chain';
446
+ provider: string;
447
+ chainId: number;
448
+ } | {
449
+ reason: 'spender-not-allowed';
450
+ provider: string;
451
+ spender: Hex;
452
+ } | {
453
+ reason: 'deposit-target-not-allowed';
454
+ provider: string;
455
+ target: Hex;
456
+ } | {
457
+ reason: 'deposit-shape';
458
+ provider: string;
459
+ detail: string;
460
+ } | {
461
+ reason: 'amount-mismatch';
462
+ provider: string;
463
+ /** Which figure disagreed: the quote's own, the native value, or the amount inside the calldata. */
464
+ field: 'quote-from-amount' | 'deposit-value' | 'calldata-amount';
465
+ expected: bigint;
466
+ actual: bigint;
467
+ } | {
468
+ reason: 'recipient-mismatch';
469
+ provider: string;
470
+ /** Which address disagreed: the native payee, the transfer payee, or the token a deposit names. */
471
+ field: 'deposit-to' | 'transfer-to' | 'calldata-token';
472
+ expected: string;
473
+ actual: string;
474
+ } | {
475
+ reason: 'lifi-guard';
476
+ detail: string;
477
+ };
478
+ /**
479
+ * What an aggregator's Ethereum origin deposit asks the wallet to send: the
480
+ * approval it needs first, if any, and the deposit itself. Both are checked
481
+ * before they are returned.
482
+ */
483
+ export type AggregatorOriginCalls = {
484
+ kind: 'calls';
485
+ approval: ApprovalRequirement | null;
486
+ deposit: EvmDeposit;
487
+ } | {
488
+ kind: 'refused';
489
+ refusal: AggregatorOriginRefusal;
490
+ };
491
+ /**
492
+ * Reads the approval and the deposit off an aggregator quote with an Ethereum
493
+ * origin, after checking both against what this code knows about the
494
+ * provider. The interface's aggregator press (`stores/consolidated-execute.ts`)
495
+ * and the SDK's execution planner both read them here, so neither can sign a
496
+ * call the other would refuse.
497
+ *
498
+ * WHAT IS CHECKED, BEFORE ANYTHING IS APPROVED OR SENT:
499
+ * - Every provider: when the request names the amount to send
500
+ * (`request.fromAmount`), the quote's own `fromAmount` must equal it.
501
+ * - LI.FI: `verifyLifiEvmExecution`: the Diamond for the chain, a known
502
+ * facet call, calldata that matches the request, and the decoded amount
503
+ * pulled from the reader equal to the amount to send.
504
+ * - Relay: the deposit target and the spender are Relay's depository for the
505
+ * chain (`relayDepositoryByChainId`). A native deposit carries the amount
506
+ * as `value` through `depositNative`; a token deposit carries no value and
507
+ * is `depositErc20` for the request's token and the amount.
508
+ * - NEAR Intents: no spender, and a plain payment of the amount to send to the
509
+ * quote's own deposit address (`quote.quoteId`), native or `transfer`.
510
+ * - Any other provider is refused. Its spender is unknown.
511
+ *
512
+ * The approval is for exactly the amount to send (the request's, else the
513
+ * quote's when the route is solved backwards and the request names none), on
514
+ * the request's origin chain. The native coin needs none.
515
+ *
516
+ * @param options.quote - the live quote to sign
517
+ * @param options.request - the request it answered
518
+ * @returns the checked approval and deposit, or why they are refused
519
+ */
520
+ export declare const aggregatorOriginCalls: ({ quote, request, }: {
521
+ quote: ConsolidatedQuote;
522
+ request: ConsolidatedQuoteRequest;
523
+ }) => AggregatorOriginCalls;
524
+ /**
525
+ * Normalizes a quote response from the contract-calls endpoint.
526
+ *
527
+ * A present but malformed `transactionRequest.value` fails the parse — silently
528
+ * sending zero native value would produce a transaction that under-pays the
529
+ * provider's bridging fee.
530
+ *
531
+ * REQUIRES `context.request` — see {@link lifiEvmDeposit}. Every live caller
532
+ * (`providers.ts`'s registry entry, the interface's `consolidated-quote.ts`
533
+ * store) supplies it; a caller that omits it gets a thrown
534
+ * {@link LifiExecutionRefusedError} rather than a silently unchecked
535
+ * execution transaction.
536
+ *
537
+ * @returns the normalized quote, or null when the payload shape is unexpected
538
+ * @throws {LifiExecutionRefusedError} when the response's execution
539
+ * transaction disagrees with `context.request` — see `lifi-execution-guard.ts`
540
+ */
541
+ export declare const parseLifiContractCallsQuote: (payload: unknown, context?: ProviderQuoteContext) => ConsolidatedQuote | null;
542
+ /**
543
+ * Normalizes a quote response from LI.FI's plain `GET /v1/quote`.
544
+ *
545
+ * `request` IS REQUIRED FOR AN ETHEREUM ORIGIN, though its type stays
546
+ * optional — omitting it there throws {@link LifiExecutionRefusedError}
547
+ * rather than returning an unverified deposit; see `lifiEvmDeposit`'s doc
548
+ * comment for why the type cannot say so directly. It is genuinely optional
549
+ * for a Solana or Bitcoin origin, which never reach the execution guard.
550
+ *
551
+ * @param payload - the raw JSON body from `GET /v1/quote`
552
+ * @param options.originEcosystem - the virtual-machine family the route starts from
553
+ * @param options.request - the consolidated request this response answers
554
+ * @returns the normalized quote, or null when the payload does not match that ecosystem
555
+ * @throws {LifiExecutionRefusedError} for an Ethereum origin, when `request`
556
+ * is absent or the execution transaction disagrees with it
557
+ */
558
+ export declare const parseLifiQuote: (payload: unknown, { originEcosystem, request }: {
559
+ originEcosystem: Ecosystem;
560
+ request?: ConsolidatedQuoteRequest;
561
+ }) => ConsolidatedQuote | null;
562
+ declare const consolidatedStatusValues: readonly ["NOT_FOUND", "INVALID", "PENDING", "DONE", "FAILED"];
563
+ /** Transfer status values reported by the provider's status endpoint. */
564
+ export type ConsolidatedStatusValue = (typeof consolidatedStatusValues)[number];
565
+ /** Normalized status of an in-flight consolidated bridge. */
566
+ export type ConsolidatedStatus = {
567
+ status: ConsolidatedStatusValue;
568
+ /** Provider-specific refinement (e.g. WAIT_DESTINATION_TRANSACTION, REFUNDED) */
569
+ substatus: string | null;
570
+ /** The Ethereum-side transaction hash, once the provider has executed it */
571
+ receivingTxHash: Hex | null;
572
+ /**
573
+ * Where a refund was credited, when the provider says it refunded into an
574
+ * account of its own that the reader must withdraw from. Absent or null for
575
+ * every other answer, including a refund sent straight back to the origin
576
+ * chain, which leaves the reader nothing to do.
577
+ */
578
+ refund?: ConsolidatedAccountRefund | null;
579
+ };
580
+ /**
581
+ * A refund the provider credited to an account inside its own settlement
582
+ * contract rather than sending back on chain. NEAR Intents does this for a
583
+ * pay-by-hand origin with no wallet here: the refund lands in the ledger entry
584
+ * named for the reader's lower-cased Ethereum address, and the reader has to
585
+ * withdraw it from there.
586
+ */
587
+ export type ConsolidatedAccountRefund = {
588
+ /** The ledger account the refund was credited to, lower case. */
589
+ account: string;
590
+ /** The provider's own identifier for the refunded asset, e.g. `nep141:zec.omft.near`. */
591
+ assetId: string;
592
+ /** How much was refunded, in that asset's base units, as a decimal string. */
593
+ baseUnits: string;
594
+ };
595
+ /**
596
+ * Builds the status-poll address for an origin transaction, at
597
+ * {@link lifiDefaultApiOrigin}. Chain hints narrow the provider's lookup and
598
+ * are recommended when known. `txHash` is typed as `string` rather than `Hex`
599
+ * because a non-Ethereum origin (Solana base58 signature, Bitcoin transaction
600
+ * id) is not `0x`-prefixed.
601
+ */
602
+ export declare const lifiStatusUrl: ({ txHash, fromChainId, toChainId, }: {
603
+ txHash: string;
604
+ fromChainId?: number;
605
+ toChainId?: number;
606
+ }) => string;
607
+ /**
608
+ * Normalizes a status response for an in-flight consolidated bridge.
609
+ *
610
+ * The receiving hash gates the handover from provider polling to the
611
+ * omnibridge indexer, so it must be a full 32-byte transaction hash — an
612
+ * empty or malformed value collapses to null rather than masquerading as a
613
+ * real transaction.
614
+ *
615
+ * @returns the normalized status, or null when the payload shape is unexpected
616
+ */
617
+ export declare const parseLifiStatus: (payload: unknown) => ConsolidatedStatus | null;
618
+ /**
619
+ * Chain listing endpoint, at {@link lifiDefaultApiOrigin}. Deliberately
620
+ * carries no query parameters: the `chainTypes` filter requires an API key on
621
+ * the anonymous tier (verified live 2026-06-12, error code 1010), and the
622
+ * default response is EVM-only.
623
+ */
624
+ export declare const lifiChainsUrl: string;
625
+ /** A chain the aggregator can originate a consolidated route from. */
626
+ export type ConsolidatedOriginChain = {
627
+ id: number;
628
+ name: string;
629
+ logoURI: string | null;
630
+ };
631
+ /**
632
+ * Normalizes a `GET /v1/chains` response body to mainnet EVM chains.
633
+ *
634
+ * @returns the chain list, or null when the payload shape is unexpected
635
+ */
636
+ export declare const parseLifiChains: (payload: unknown) => ConsolidatedOriginChain[] | null;
637
+ /** Builds the per-chain token listing URL, at {@link lifiDefaultApiOrigin}. */
638
+ export declare const lifiTokensUrl: (chainId: number) => string;
639
+ /**
640
+ * Normalizes a `GET /v1/tokens?chains=<id>` response body into the shared
641
+ * token shape used across the bridge frontend. Malformed entries are skipped
642
+ * rather than failing the whole list; `logoURI` is optional on the live
643
+ * interface.
644
+ *
645
+ * @returns the token list, or null when the payload shape is unexpected
646
+ */
647
+ export declare const parseLifiTokens: (payload: unknown, chainId: number) => Token[] | null;
648
+ export {};