@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,207 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.knownChainName = exports.chainDisplayName = exports.registerChainNames = exports.relayChainNames = exports.isDepositAddressChain = exports.depositAddressChainIds = exports.relayChainIds = void 0;
4
+ /**
5
+ * Chain identifiers and their human-readable display names, in one place.
6
+ *
7
+ * This module exists to break an import cycle. `relay-quote.ts` imports the
8
+ * step normalizers from `route-steps.ts`, and `route-steps.ts` needs to name
9
+ * Relay's non-Ethereum chains when it labels a leg. Holding the shared lookup
10
+ * here lets both import it without either importing the other.
11
+ *
12
+ * Names are spelled out in full — these strings are shown to someone choosing
13
+ * where their funds leave from, so "The Open Network", never "TON".
14
+ */
15
+ /**
16
+ * Relay's numeric chain identifiers for the non-Ethereum-Virtual-Machine origin
17
+ * chains this bridge supports. These are Relay's OWN identifiers, distinct from
18
+ * any native chain id, and are required verbatim as the request's
19
+ * `originChainId`.
20
+ *
21
+ * Source: https://api.relay.link/chains, where each entry's `vmType` names the
22
+ * ecosystem and each is reported `depositEnabled`.
23
+ */
24
+ exports.relayChainIds = {
25
+ /** Relay's chain id for Solana mainnet (virtual-machine type `svm`). */
26
+ solana: 792703809,
27
+ /**
28
+ * Relay's chain id for Eclipse (virtual-machine type `svm`) — a SECOND chain
29
+ * in the Solana ecosystem, sharing Solana's address encoding, deposit shape
30
+ * and native-asset sentinel while being a different network with a different
31
+ * native asset (Ether, not Sol).
32
+ *
33
+ * Quotable, but see the guard in the interface's Solana signer: sharing an
34
+ * ecosystem means sharing a wallet adapter, and that adapter is bound to ONE
35
+ * Solana network at a time. A deposit for this chain must never be signed
36
+ * against a connection pointed at Solana.
37
+ */
38
+ eclipse: 9286185,
39
+ /** Relay's chain id for Bitcoin mainnet (virtual-machine type `bvm`). */
40
+ bitcoin: 8253038,
41
+ /** Relay's chain id for Tron mainnet (virtual-machine type `tvm`). */
42
+ tron: 728126428,
43
+ /** Relay's chain id for The Open Network (virtual-machine type `tonvm`). */
44
+ ton: 224235520,
45
+ /**
46
+ * Relay's chain id for Hyperliquid (virtual-machine type `hypevm`).
47
+ *
48
+ * BEWARE: 1337 is also the default chain id of a local Ganache development
49
+ * node, so this is the one Relay identifier that can collide with a real
50
+ * Ethereum Virtual Machine chain a developer might be running. Treating a
51
+ * local test chain as Hyperliquid would route it down the HyperCore deposit
52
+ * path, so never feed a local development chain id through
53
+ * `ecosystemByChainId`.
54
+ */
55
+ hyperliquid: 1337,
56
+ };
57
+ /**
58
+ * Chain identifiers for origin chains a reader PAYS BY HAND.
59
+ *
60
+ * WHAT MAKES THESE DIFFERENT FROM EVERY OTHER CHAIN HERE. Every identifier
61
+ * above names a chain this interface can connect a wallet to and sign on.
62
+ * These name chains it cannot. There is no connector, no signer and no
63
+ * transaction: the provider issues an address, the reader sends an ordinary
64
+ * transfer to it from any wallet or any exchange, and the provider's own
65
+ * watcher reports the arrival. The chain identifier exists so the route layer
66
+ * can NAME the chain, price it and draw it — nothing more.
67
+ *
68
+ * THE NUMBERS ARE DERIVED, NOT INVENTED, and the derivation is written down
69
+ * because a chain identifier typed from memory is a hypothesis every later
70
+ * reader will trust. Each is the chain's registered SLIP-0044 coin type with
71
+ * the hardened bit set, exactly as a BIP-44 derivation path writes it:
72
+ * `0x80000000 + coinType`. That puts them above every chain identifier in
73
+ * public use, so one can never collide with a real Ethereum chain and be
74
+ * mistaken for one — which is the failure that matters, because an Ethereum
75
+ * chain has a wallet and would be handed a payload to sign.
76
+ *
77
+ * They are LOCAL identifiers and never travel on a wire. NEAR Intents names
78
+ * Zcash `zec`; `chainIdByNearIntentsChain` is where the two are reconciled.
79
+ */
80
+ exports.depositAddressChainIds = {
81
+ /** Zcash mainnet. SLIP-0044 coin type 133, hardened: 0x80000000 + 133. */
82
+ zcash: 2_147_483_781,
83
+ };
84
+ /**
85
+ * Display names for the chains a reader pays by hand, one entry per member of
86
+ * {@link DepositAddressChain}. Typed on the union rather than on `number` so a
87
+ * chain added to {@link depositAddressChainIds} without a name here is a
88
+ * compile error, not a blank badge.
89
+ */
90
+ const depositAddressChainNamesByChain = {
91
+ zcash: 'Zcash',
92
+ };
93
+ /** {@link depositAddressChainNamesByChain}, keyed by chain id for lookup. */
94
+ const depositAddressChainNames = new Map(Object.keys(exports.depositAddressChainIds).map((chain) => [
95
+ exports.depositAddressChainIds[chain],
96
+ depositAddressChainNamesByChain[chain],
97
+ ]));
98
+ /**
99
+ * Whether a chain identifier names a chain this interface CANNOT SIGN ON.
100
+ *
101
+ * The one predicate every surface asks before offering a wallet. A chain that
102
+ * answers true has no connector, so anything that would connect, switch
103
+ * networks, estimate gas or compose a transaction for it is wrong — the reader
104
+ * is shown an address to pay instead.
105
+ *
106
+ * @param chainId - a chain identifier
107
+ * @returns whether the reader pays this chain by hand
108
+ */
109
+ const isDepositAddressChain = (chainId) => depositAddressChainNames.has(chainId);
110
+ exports.isDepositAddressChain = isDepositAddressChain;
111
+ /**
112
+ * Display names for Relay's non-Ethereum origin chains.
113
+ *
114
+ * An ecosystem label is NOT a chain name, and using one as a name is actively
115
+ * wrong: `svm` holds both Solana and Eclipse, so labelling by ecosystem renders
116
+ * Eclipse as "Solana" — a different network, shown to someone choosing where
117
+ * their funds leave from. Keyed by chain id for exactly that reason.
118
+ */
119
+ exports.relayChainNames = new Map([
120
+ [exports.relayChainIds.solana, 'Solana'],
121
+ [exports.relayChainIds.eclipse, 'Eclipse'],
122
+ [exports.relayChainIds.bitcoin, 'Bitcoin'],
123
+ [exports.relayChainIds.tron, 'Tron'],
124
+ [exports.relayChainIds.ton, 'The Open Network'],
125
+ [exports.relayChainIds.hyperliquid, 'Hyperliquid'],
126
+ ]);
127
+ /**
128
+ * Display names for the Ethereum-Virtual-Machine chains a route can traverse.
129
+ * Only the chains this bridge actually routes through need an entry; anything
130
+ * else falls back to its numeric identifier rather than being dropped.
131
+ */
132
+ const virtualMachineChainNames = new Map([
133
+ [1, 'Ethereum'],
134
+ [56, 'Binance Smart Chain'],
135
+ [369, 'PulseChain'],
136
+ [943, 'PulseChain Testnet V4'],
137
+ [42161, 'Arbitrum One'],
138
+ [11155111, 'Sepolia'],
139
+ ]);
140
+ /**
141
+ * Names registered at startup from the wider chain registry.
142
+ *
143
+ * This package cannot import that registry — it sits below the client that
144
+ * holds it — but it must still be the ONE place a chain name is decided. The
145
+ * alternative was what this replaced: three resolvers, each with different
146
+ * coverage, so the same chain read as "Base" beside one element, "chain 8453"
147
+ * beside another, and vanished entirely from a third. A reader hovering two
148
+ * parts of the same row saw two different answers.
149
+ */
150
+ const registeredChainNames = new Map();
151
+ /**
152
+ * Registers display names for chains this module does not know about.
153
+ *
154
+ * Call once during startup, before anything renders. Entries are merged, and a
155
+ * name declared in `virtualMachineChainNames` above WINS over a registered one:
156
+ * the local table is deliberate ("Binance Smart Chain", not the registry's
157
+ * "BNB Smart Chain"), and a registry that happens to disagree must not quietly
158
+ * rename a chain the product has already named.
159
+ *
160
+ * @param entries - chain id and display name pairs
161
+ */
162
+ const registerChainNames = (entries) => {
163
+ for (const [chainId, name] of entries) {
164
+ if (!name)
165
+ continue;
166
+ registeredChainNames.set(chainId, name);
167
+ }
168
+ };
169
+ exports.registerChainNames = registerChainNames;
170
+ /**
171
+ * Returns a human-readable chain name for the given chain id, covering both
172
+ * Ethereum-Virtual-Machine chains and Relay's non-Ethereum pseudo identifiers.
173
+ *
174
+ * Falls back to the numeric id stringified when the chain is not known — better
175
+ * to show "chain 999" than to silently drop the leg that traverses it.
176
+ *
177
+ * @param chainId - a decimal chain id, Relay's identifier included
178
+ * @returns the display name, or `chain <id>` when unknown
179
+ */
180
+ const chainDisplayName = (chainId) => (0, exports.knownChainName)(chainId) ?? `chain ${chainId}`;
181
+ exports.chainDisplayName = chainDisplayName;
182
+ /**
183
+ * The name this module KNOWS for a chain, or null when it knows none.
184
+ *
185
+ * Same lookup as {@link chainDisplayName} without the placeholder, so a caller
186
+ * with a better fallback of its own can reach one. {@link chainDisplayName} is
187
+ * defined in terms of this, which is the point: the two can never disagree
188
+ * about which chains are known.
189
+ *
190
+ * WHY A CALLER WOULD WANT THIS. The network chips in the token picker have a
191
+ * second name to fall back on — the aggregator's own chain list, which reaches
192
+ * chains this registry has never been told about and says "Unknown network"
193
+ * rather than printing a bare number. Choosing between the two used to be done
194
+ * by comparing `chainDisplayName`'s answer against the literal string
195
+ * `chain <id>`, which is a caller reaching into another function's fallback
196
+ * format: rename the placeholder here and that comparison quietly stops
197
+ * matching, leaving every unknown chain labelled with its number.
198
+ *
199
+ * @param chainId - a decimal chain id, Relay's identifiers included
200
+ * @returns the display name, or null when the chain is not known here
201
+ */
202
+ const knownChainName = (chainId) => virtualMachineChainNames.get(chainId) ??
203
+ exports.relayChainNames.get(chainId) ??
204
+ depositAddressChainNames.get(chainId) ??
205
+ registeredChainNames.get(chainId) ??
206
+ null;
207
+ exports.knownChainName = knownChainName;
@@ -0,0 +1,90 @@
1
+ import { Chains } from './config.js';
2
+ import type { ChainsMetadata } from './types.js';
3
+ /**
4
+ * all of the chains that are enabled in this dapp
5
+ * and their corresponding useful metadata
6
+ *
7
+ * Every entry below sets `name` explicitly to `chainDisplayName(...)` rather
8
+ * than trusting the spread-in viem chain object or typing a string here. Two
9
+ * hand-typed copies of the same name is exactly how chain 943 once read as
10
+ * "PulseChain Testnet V4" in the resolver and "Pulsechain V4" here — one
11
+ * string, two spellings, and only one of them got fixed. Routing every name
12
+ * through `chainDisplayName` leaves nothing to drift a second time.
13
+ *
14
+ * Each `logoURI` is a getter, not a string fixed at import time, so a later
15
+ * `setImageRoot` call (from `image-links.ts`) changes every chain logo. Spread
16
+ * an entry (`{ ...chainsMetadata[chain] }`) and the copy holds the URL as it
17
+ * was at that moment.
18
+ */
19
+ export declare const chainsMetadata: ChainsMetadata;
20
+ /**
21
+ * The RPC endpoints the Gibs interface uses, FOR DEMOS ONLY.
22
+ *
23
+ * Each proxied chain's list starts with valve.city's shared `vk_demo` key and
24
+ * falls through to that chain's public endpoints in {@link chainsMetadata}.
25
+ * Binance Smart Chain has no valve.city entry, so its list is the public one.
26
+ *
27
+ * WHY IT IS A SEPARATE, NAMED LIST. The key is public, so shipping it discloses
28
+ * nothing. But its rate budget is shared by everybody who uses it, and the proxy
29
+ * belongs to the Gibs Finance operator. A wallet that inherits it without
30
+ * choosing it puts its users' reads on somebody else's budget and uptime. So no
31
+ * reader in this package uses it, and `chainsMetadata` does not carry it. A
32
+ * caller who wants it asks for it by this name.
33
+ *
34
+ * Production callers: pass your own viem clients to every reader.
35
+ */
36
+ export declare const demoRpcUrls: Readonly<Record<Chains, readonly string[]>>;
37
+ /**
38
+ * The demo endpoints for one chain, FOR DEMOS ONLY. See {@link demoRpcUrls}.
39
+ *
40
+ * @param chainId - a decimal chain id
41
+ * @returns a copy of the chain's demo endpoints, or an empty list for a chain the bridge does not cross
42
+ */
43
+ export declare const demoRpcUrlsFor: (chainId: number) => string[];
44
+ /**
45
+ * Every chain this bridge itself carries funds across, in the order the
46
+ * metadata declares them.
47
+ *
48
+ * Read from {@link chainsMetadata} rather than typed out, for the reason the
49
+ * whole table above gives: a second hand-written list is how one chain ends up
50
+ * present in one place and missing from another. A control that offers the
51
+ * reader a network to add or remove reads this, so a chain added to the
52
+ * metadata appears in that control without anybody remembering to add it.
53
+ *
54
+ * This is NOT every chain a route can traverse. An aggregator reaches dozens
55
+ * more, and `chain-names.ts` can name them. These five are the ones the
56
+ * transfers archive holds records for.
57
+ */
58
+ export declare const bridgeNetworkChainIds: readonly number[];
59
+ /**
60
+ * The chain identifiers this product treats as TEST networks.
61
+ *
62
+ * THE FLAG IS VIEM'S AND IT IS CHECKED FOR `true`, NOT FOR TRUTHINESS. Each
63
+ * entry above spreads a viem chain definition, and viem sets `testnet: true` on
64
+ * Sepolia and on PulseChain Testnet V4, `testnet: false` on PulseChain, and
65
+ * omits the key entirely on Ethereum and on Binance Smart Chain. So the value
66
+ * has three states, and only one of them is a claim. Testing for `=== true`
67
+ * means a chain whose definition says nothing is treated as a real network —
68
+ * which is the safe direction, because the cost of failing to hide a test
69
+ * network is an extra row and the cost of hiding a real one is a reader who
70
+ * cannot find their money.
71
+ *
72
+ * WHY NOT DERIVE IT FROM THE BRIDGE KEYS. `validBridgeKeys(isProd)` in
73
+ * `config.ts` splits the same five chains into a mainnet set and a testnet set,
74
+ * and subtracting one from the other would give the same two identifiers today.
75
+ * It would also give the wrong answer the moment a real chain gains a pathway
76
+ * that is still behind the testnet switch — the key list records what is
77
+ * ENABLED, and this records what a chain IS. Two different questions.
78
+ *
79
+ * `buildFullChainIdSet` in the interface already gates the pickers on the same
80
+ * flag, and `tokenLists.ts` gates the synthesized native assets on it. This is
81
+ * that decision written down once so a third reader does not restate it.
82
+ */
83
+ export declare const testNetworkChainIds: ReadonlySet<number>;
84
+ /**
85
+ * Whether one chain is a test network.
86
+ *
87
+ * @param chainId - a decimal chain id
88
+ * @returns true only when the chain's own definition claims it is a test network
89
+ */
90
+ export declare const isTestNetwork: (chainId: number) => boolean;
@@ -0,0 +1,357 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.isTestNetwork = exports.testNetworkChainIds = exports.bridgeNetworkChainIds = exports.demoRpcUrlsFor = exports.demoRpcUrls = exports.chainsMetadata = void 0;
37
+ // Relative, not through this package's own name. A self-reference resolves
38
+ // through the `exports` map, which now points at the compiled `dist` — so the
39
+ // same module would be loaded twice, once as source and once as build output,
40
+ // and `Chains.PLS` from one would not be the same object as from the other.
41
+ const chain_names_js_1 = require("./chain-names.js");
42
+ const config_js_1 = require("./config.js");
43
+ const imageLinks = __importStar(require("./image-links.js"));
44
+ // Chain definitions come from viem, not from a wallet-connection library. These
45
+ // five objects are identical in `@reown/appkit/networks`, which is where they used
46
+ // to be imported from — but that made a package with no user interface depend on a
47
+ // wallet modal, and it was never declared in `dependencies`, so the root entry
48
+ // point of this package could not be loaded by anyone outside this repository.
49
+ const chains_1 = require("viem/chains");
50
+ /**
51
+ * Builds an endpoint on valve.city, which proxies four of this dapp's chains.
52
+ *
53
+ * DEMO ONLY. These endpoints live in {@link demoRpcUrls}, never in
54
+ * {@link chainsMetadata}. A third party that hands `chainsMetadata` to viem with
55
+ * a bare `http()` gets the public endpoints below, not this shared key. The Gibs
56
+ * interface asks for the demo list by name (`@gibs/bridge-client`'s
57
+ * `clientFromChain`). Any other caller should pass its own clients.
58
+ *
59
+ * The key in this URL is `vk_demo`, and it is MEANT to be here. It is the
60
+ * proxy's published demo key — it is already listed on chainlist.org, so it is
61
+ * public knowledge and shipping it in a browser bundle discloses nothing. The
62
+ * proxy reflects any `Origin` back, which is what makes it usable at all from
63
+ * an IPFS build: the same bundle is served from gib.show, from ipfs.io, from
64
+ * dweb.link, and from a local node, so an origin-locked key would break every
65
+ * gateway but one.
66
+ *
67
+ * NEVER replace this with the unlimited key from 1Password. That one is a
68
+ * bearer credential, this file compiles into the public bundle, and the two
69
+ * facts together would hand an unmetered proxy to every visitor.
70
+ *
71
+ * Only chains 1, 369, 943 and 11155111 are proxied; the service lists them at
72
+ * its root. Binance Smart Chain is not, which is why it keeps a public endpoint
73
+ * alone. Every chain below keeps its previous endpoints after this one, so a
74
+ * valve.city outage falls through to where it used to go rather than breaking.
75
+ *
76
+ * IT LEADS EVERY LIST IT APPEARS IN, and the measurement that says it may is
77
+ * not a burst — it is the shape this interface actually produces.
78
+ *
79
+ * MEASURED 2026-08-29, against the real cadence rather than a synthetic flood:
80
+ *
81
+ * steady, 1 request per 4 seconds for 3 minutes 45 of 45 answered 200
82
+ * bursts, 8 concurrent, four rounds 30 of 32 answered 200
83
+ * 20 requests at concurrency 1, 2, 4, 6 and 8 20 of 20 every time
84
+ * 20 requests at concurrency 12 19 of 20
85
+ *
86
+ * Four seconds is not arbitrary: `watchBlocks` runs on viem's default poll, one
87
+ * per watched chain, and `clientFromChain` coalesces up to 32 JSON-RPC calls
88
+ * made within 10ms into ONE HTTP POST. So the interface's request rate is about
89
+ * a quarter of a request per second per chain, and the key handles four times
90
+ * that without a single refusal.
91
+ *
92
+ * AN EARLIER READING SAID THE OPPOSITE AND WAS MEASURING SOMETHING ELSE. On
93
+ * 2026-08-27 this key answered 429 for four requests in five — from 40 requests
94
+ * at 12 concurrent, fired four times back to back across four chains, roughly
95
+ * 160 requests with no pause. That exhausts a windowed budget. No browser does
96
+ * it. The reading before THAT one was 40 CONSECUTIVE requests, which cannot see
97
+ * a rate limit at all because it paces itself. Both were honest measurements of
98
+ * the wrong thing.
99
+ *
100
+ * THE PROBE STORM WAS THE REAL CULPRIT. `fallback` used to run `rank: true`,
101
+ * which pings every url on every chain every few seconds forever — on an idle
102
+ * page, every outbound request was one of those. That is what spent the key's
103
+ * budget. It is off now (see `packages/common/src/client.ts`), and the
104
+ * demotion that shipped alongside turning it off was treating the symptom.
105
+ *
106
+ * THE SPARE BEHIND IT IS STILL LOAD-BEARING. `vk_demo` is shared — published on
107
+ * chainlist.org — so the budget is not ours alone and the headroom moves with
108
+ * other people's use. About one burst request in sixteen still meets a 429, and
109
+ * a 429 is an HTTP error, so `fallback` moves to the next entry at once. The
110
+ * cost is one wasted round trip on a small fraction of burst requests, not a
111
+ * failed read. Never leave a proxied chain with valve.city alone.
112
+ *
113
+ * @param chainId - the numeric chain id to proxy
114
+ * @returns the fully qualified JSON-RPC endpoint
115
+ */
116
+ const valveCity = (chainId) => `https://one.valve.city/rpc/vk_demo/evm/${chainId}`;
117
+ /**
118
+ * all of the chains that are enabled in this dapp
119
+ * and their corresponding useful metadata
120
+ *
121
+ * Every entry below sets `name` explicitly to `chainDisplayName(...)` rather
122
+ * than trusting the spread-in viem chain object or typing a string here. Two
123
+ * hand-typed copies of the same name is exactly how chain 943 once read as
124
+ * "PulseChain Testnet V4" in the resolver and "Pulsechain V4" here — one
125
+ * string, two spellings, and only one of them got fixed. Routing every name
126
+ * through `chainDisplayName` leaves nothing to drift a second time.
127
+ *
128
+ * Each `logoURI` is a getter, not a string fixed at import time, so a later
129
+ * `setImageRoot` call (from `image-links.ts`) changes every chain logo. Spread
130
+ * an entry (`{ ...chainsMetadata[chain] }`) and the copy holds the URL as it
131
+ * was at that moment.
132
+ */
133
+ exports.chainsMetadata = {
134
+ [config_js_1.Chains.PLS]: {
135
+ ...chains_1.pulsechain,
136
+ name: (0, chain_names_js_1.chainDisplayName)(chains_1.pulsechain.id),
137
+ chainId: config_js_1.Chains.PLS,
138
+ get logoURI() {
139
+ return imageLinks.network(chains_1.pulsechain.id);
140
+ },
141
+ alt: 'a pink blue and purple hexagon with an ekg line running horizontally',
142
+ rpcUrls: {
143
+ default: {
144
+ http: ['https://rpc.pulsechain.com'],
145
+ },
146
+ },
147
+ contracts: {
148
+ ...chains_1.pulsechain.contracts,
149
+ ensRegistry: {
150
+ address: '0xbd5133993FCDED5945c5539D9f032261F0d13170',
151
+ },
152
+ ensUniversalResolver: {
153
+ address: '0x2FDBb906b4FE68e31D928C1ED0b6a3bD1f204374',
154
+ blockCreated: 19_400_610,
155
+ },
156
+ },
157
+ },
158
+ [config_js_1.Chains.ETH]: {
159
+ ...chains_1.mainnet,
160
+ name: (0, chain_names_js_1.chainDisplayName)(chains_1.mainnet.id),
161
+ chainId: config_js_1.Chains.ETH,
162
+ get logoURI() {
163
+ return imageLinks.network(chains_1.mainnet.id);
164
+ },
165
+ alt: 'two pyramids joined on one side',
166
+ rpcUrls: {
167
+ default: {
168
+ // TWO PUBLIC ENDPOINTS, and {@link demoRpcUrls} puts valve.city in
169
+ // front of them. Both are needed behind it. On 2026-08-25 g4mm4
170
+ // answered nothing at all for hours, and the list was g4mm4 then
171
+ // valve.city — so every read fell through a dead host onto a key that
172
+ // rejects four requests in five. publicnode measured 40 of 40 on
173
+ // 2026-08-27 and costs nothing to carry.
174
+ http: [
175
+ 'https://rpc-ethereum.g4mm4.io',
176
+ 'https://ethereum-rpc.publicnode.com',
177
+ ],
178
+ },
179
+ },
180
+ },
181
+ [config_js_1.Chains.BNB]: {
182
+ ...chains_1.bsc,
183
+ // viem's own default is "BNB Smart Chain" — deferring to the resolver
184
+ // keeps this the product's chosen "Binance Smart Chain" without a second
185
+ // hand-typed copy of that decision living here.
186
+ name: (0, chain_names_js_1.chainDisplayName)(chains_1.bsc.id),
187
+ chainId: config_js_1.Chains.BNB,
188
+ get logoURI() {
189
+ return imageLinks.network(chains_1.bsc.id);
190
+ },
191
+ alt: 'a gold cube with slits in the middle of each side',
192
+ rpcUrls: {
193
+ default: {
194
+ // valve.city does not proxy chain 56 — it answers "Unsupported
195
+ // chain" — so this is the one chain with no entry of ours, which
196
+ // makes a second PUBLIC endpoint the only fallback available. A
197
+ // one-entry list is what took Sepolia down outright (see below).
198
+ // Both measured 40 of 40 on 2026-08-27.
199
+ http: ['https://bsc-rpc.publicnode.com', 'https://bsc-dataseed.binance.org'],
200
+ },
201
+ },
202
+ },
203
+ [config_js_1.Chains.SEP]: {
204
+ ...chains_1.sepolia,
205
+ name: (0, chain_names_js_1.chainDisplayName)(chains_1.sepolia.id),
206
+ chainId: config_js_1.Chains.SEP,
207
+ get logoURI() {
208
+ return imageLinks.network(chains_1.sepolia.id);
209
+ },
210
+ alt: 'two pyramids joined on one side',
211
+ // FOUR endpoints, not one, and the reason is specific: a public endpoint
212
+ // answers a single curl perfectly well and returns 403 under a browser's
213
+ // load — five times on one page render. A rate limit, not a dead host.
214
+ //
215
+ // The transport wraps this list in viem's `fallback()`, which moves on for
216
+ // an HTTP error, and 403 is one. With a single entry there was nowhere to
217
+ // move to, so the whole testnet side simply failed. All three were checked
218
+ // for a correct chain id AND for an allow-origin header, because answering
219
+ // curl is not the same as being reachable from a page.
220
+ rpcUrls: {
221
+ default: {
222
+ // Ordered deliberately, by the operational rule that the most reliable
223
+ // endpoint goes FIRST.
224
+ //
225
+ // valve.city is not here. It sits in front of these three only in
226
+ // {@link demoRpcUrls}. Being ours does not buy it a budget: the SHARED
227
+ // DEMO KEY answered 429 for 32 of 40 burst requests against Sepolia on
228
+ // 2026-08-27, which is why nothing may depend on it alone.
229
+ //
230
+ // These three keep the order an earlier browser measurement earned
231
+ // them. publicnode stays last of the public three because it is the one
232
+ // observed returning 403 under a browser's load — five times on one
233
+ // page render — which a `curl` burst does not reproduce and therefore
234
+ // cannot overturn. It answers fine when the others are busy, so it is
235
+ // demoted rather than dropped.
236
+ http: [
237
+ 'https://sepolia.gateway.tenderly.co',
238
+ 'https://1rpc.io/sepolia',
239
+ 'https://ethereum-sepolia-rpc.publicnode.com',
240
+ ],
241
+ },
242
+ },
243
+ },
244
+ [config_js_1.Chains.V4PLS]: {
245
+ ...chains_1.pulsechainV4,
246
+ name: (0, chain_names_js_1.chainDisplayName)(chains_1.pulsechainV4.id),
247
+ chainId: config_js_1.Chains.V4PLS,
248
+ get logoURI() {
249
+ return imageLinks.network(chains_1.pulsechainV4.id);
250
+ },
251
+ alt: 'a pink blue and purple hexagon with an ekg line running horizontally',
252
+ rpcUrls: {
253
+ default: {
254
+ // Two, for the reason Ethereum has two: g4mm4 is a single host that
255
+ // has gone away before, and valve.city ({@link demoRpcUrls}) alone in
256
+ // front of it is not a fallback. The official testnet node measured 40
257
+ // of 40 on 2026-08-27.
258
+ http: [
259
+ 'https://rpc-testnet-pulsechain.g4mm4.io',
260
+ 'https://rpc.v4.testnet.pulsechain.com',
261
+ ],
262
+ },
263
+ },
264
+ contracts: {
265
+ ...chains_1.pulsechainV4.contracts,
266
+ ensRegistry: {
267
+ address: '0xaDB38309aF7F85034FDC35bd6E6B45d1216CfB56',
268
+ },
269
+ ensUniversalResolver: {
270
+ address: '0xDDFde3fA938dE0cdff82645579d03Ed750DE2e69',
271
+ },
272
+ },
273
+ },
274
+ };
275
+ /**
276
+ * The RPC endpoints the Gibs interface uses, FOR DEMOS ONLY.
277
+ *
278
+ * Each proxied chain's list starts with valve.city's shared `vk_demo` key and
279
+ * falls through to that chain's public endpoints in {@link chainsMetadata}.
280
+ * Binance Smart Chain has no valve.city entry, so its list is the public one.
281
+ *
282
+ * WHY IT IS A SEPARATE, NAMED LIST. The key is public, so shipping it discloses
283
+ * nothing. But its rate budget is shared by everybody who uses it, and the proxy
284
+ * belongs to the Gibs Finance operator. A wallet that inherits it without
285
+ * choosing it puts its users' reads on somebody else's budget and uptime. So no
286
+ * reader in this package uses it, and `chainsMetadata` does not carry it. A
287
+ * caller who wants it asks for it by this name.
288
+ *
289
+ * Production callers: pass your own viem clients to every reader.
290
+ */
291
+ exports.demoRpcUrls = Object.freeze({
292
+ [config_js_1.Chains.PLS]: [valveCity(chains_1.pulsechain.id), ...exports.chainsMetadata[config_js_1.Chains.PLS].rpcUrls.default.http],
293
+ [config_js_1.Chains.ETH]: [valveCity(chains_1.mainnet.id), ...exports.chainsMetadata[config_js_1.Chains.ETH].rpcUrls.default.http],
294
+ [config_js_1.Chains.BNB]: [...exports.chainsMetadata[config_js_1.Chains.BNB].rpcUrls.default.http],
295
+ [config_js_1.Chains.SEP]: [valveCity(chains_1.sepolia.id), ...exports.chainsMetadata[config_js_1.Chains.SEP].rpcUrls.default.http],
296
+ [config_js_1.Chains.V4PLS]: [valveCity(chains_1.pulsechainV4.id), ...exports.chainsMetadata[config_js_1.Chains.V4PLS].rpcUrls.default.http],
297
+ });
298
+ /**
299
+ * The demo endpoints for one chain, FOR DEMOS ONLY. See {@link demoRpcUrls}.
300
+ *
301
+ * @param chainId - a decimal chain id
302
+ * @returns a copy of the chain's demo endpoints, or an empty list for a chain the bridge does not cross
303
+ */
304
+ const demoRpcUrlsFor = (chainId) => [
305
+ ...(exports.demoRpcUrls[(0, config_js_1.toChain)(chainId)] ?? []),
306
+ ];
307
+ exports.demoRpcUrlsFor = demoRpcUrlsFor;
308
+ /**
309
+ * Every chain this bridge itself carries funds across, in the order the
310
+ * metadata declares them.
311
+ *
312
+ * Read from {@link chainsMetadata} rather than typed out, for the reason the
313
+ * whole table above gives: a second hand-written list is how one chain ends up
314
+ * present in one place and missing from another. A control that offers the
315
+ * reader a network to add or remove reads this, so a chain added to the
316
+ * metadata appears in that control without anybody remembering to add it.
317
+ *
318
+ * This is NOT every chain a route can traverse. An aggregator reaches dozens
319
+ * more, and `chain-names.ts` can name them. These five are the ones the
320
+ * transfers archive holds records for.
321
+ */
322
+ exports.bridgeNetworkChainIds = Object.values(exports.chainsMetadata).map((metadata) => Number(metadata.id));
323
+ /**
324
+ * The chain identifiers this product treats as TEST networks.
325
+ *
326
+ * THE FLAG IS VIEM'S AND IT IS CHECKED FOR `true`, NOT FOR TRUTHINESS. Each
327
+ * entry above spreads a viem chain definition, and viem sets `testnet: true` on
328
+ * Sepolia and on PulseChain Testnet V4, `testnet: false` on PulseChain, and
329
+ * omits the key entirely on Ethereum and on Binance Smart Chain. So the value
330
+ * has three states, and only one of them is a claim. Testing for `=== true`
331
+ * means a chain whose definition says nothing is treated as a real network —
332
+ * which is the safe direction, because the cost of failing to hide a test
333
+ * network is an extra row and the cost of hiding a real one is a reader who
334
+ * cannot find their money.
335
+ *
336
+ * WHY NOT DERIVE IT FROM THE BRIDGE KEYS. `validBridgeKeys(isProd)` in
337
+ * `config.ts` splits the same five chains into a mainnet set and a testnet set,
338
+ * and subtracting one from the other would give the same two identifiers today.
339
+ * It would also give the wrong answer the moment a real chain gains a pathway
340
+ * that is still behind the testnet switch — the key list records what is
341
+ * ENABLED, and this records what a chain IS. Two different questions.
342
+ *
343
+ * `buildFullChainIdSet` in the interface already gates the pickers on the same
344
+ * flag, and `tokenLists.ts` gates the synthesized native assets on it. This is
345
+ * that decision written down once so a third reader does not restate it.
346
+ */
347
+ exports.testNetworkChainIds = new Set(Object.values(exports.chainsMetadata)
348
+ .filter((metadata) => metadata.testnet === true)
349
+ .map((metadata) => Number(metadata.id)));
350
+ /**
351
+ * Whether one chain is a test network.
352
+ *
353
+ * @param chainId - a decimal chain id
354
+ * @returns true only when the chain's own definition claims it is a test network
355
+ */
356
+ const isTestNetwork = (chainId) => exports.testNetworkChainIds.has(chainId);
357
+ exports.isTestNetwork = isTestNetwork;