@gibs/bridge-sdk 1.18.0 → 1.20.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 (120) hide show
  1. package/README.md +33 -0
  2. package/dist/abis.js +0 -2
  3. package/dist/bridge-limits.js +0 -38
  4. package/dist/chain-info.js +0 -116
  5. package/dist/chain-names.js +0 -151
  6. package/dist/chains.js +0 -198
  7. package/dist/cjs/abis.js +0 -2
  8. package/dist/cjs/bridge-limits.js +0 -38
  9. package/dist/cjs/chain-info.js +0 -116
  10. package/dist/cjs/chain-names.js +0 -151
  11. package/dist/cjs/chains.js +0 -198
  12. package/dist/cjs/claims.js +0 -60
  13. package/dist/cjs/config.js +1 -208
  14. package/dist/cjs/consolidated-quote.js +2 -464
  15. package/dist/cjs/destination-calldata.js +0 -71
  16. package/dist/cjs/ecosystems.js +0 -183
  17. package/dist/cjs/execution.js +0 -92
  18. package/dist/cjs/fee-type.js +0 -1
  19. package/dist/cjs/hyperliquid-execution.js +0 -98
  20. package/dist/cjs/image-links.js +0 -108
  21. package/dist/cjs/lifi-execution-guard.js +65 -172
  22. package/dist/cjs/near-intents-conformance.js +0 -110
  23. package/dist/cjs/near-intents-route.d.ts +13 -0
  24. package/dist/cjs/near-intents-route.js +7 -140
  25. package/dist/cjs/near-intents.js +0 -562
  26. package/dist/cjs/origin-deposit.js +0 -56
  27. package/dist/cjs/pre-quote.js +0 -80
  28. package/dist/cjs/prices.js +0 -113
  29. package/dist/cjs/providers.js +0 -83
  30. package/dist/cjs/quote-fees.js +0 -80
  31. package/dist/cjs/referral.js +0 -75
  32. package/dist/cjs/relay-currencies.js +0 -31
  33. package/dist/cjs/relay-depository.js +52 -77
  34. package/dist/cjs/relay-quote.js +0 -394
  35. package/dist/cjs/route-steps.js +0 -100
  36. package/dist/cjs/routing/amounts.js +0 -83
  37. package/dist/cjs/routing/candidate-route.d.ts +46 -1
  38. package/dist/cjs/routing/candidate-route.js +12 -40
  39. package/dist/cjs/routing/candidate.js +0 -46
  40. package/dist/cjs/routing/carrier-provider-key.js +0 -27
  41. package/dist/cjs/routing/carriers/omnibridge.js +0 -120
  42. package/dist/cjs/routing/carriers/pulsex-paths.js +0 -57
  43. package/dist/cjs/routing/carriers/pulsex-split.js +0 -92
  44. package/dist/cjs/routing/carriers/pulsex.js +0 -279
  45. package/dist/cjs/routing/carriers/wrap.js +0 -57
  46. package/dist/cjs/routing/composed-route-quality.js +0 -95
  47. package/dist/cjs/routing/entry-chain-anchor.js +0 -27
  48. package/dist/cjs/routing/format.js +0 -50
  49. package/dist/cjs/routing/index.d.ts +1 -1
  50. package/dist/cjs/routing/index.js +3 -30
  51. package/dist/cjs/routing/producers.js +0 -854
  52. package/dist/cjs/routing/providers.js +0 -27
  53. package/dist/cjs/routing/search/compose.js +0 -56
  54. package/dist/cjs/routing/search/graph.js +0 -364
  55. package/dist/cjs/routing/search/plan-route-data.js +5 -510
  56. package/dist/cjs/routing/search/score.js +0 -344
  57. package/dist/cjs/routing/swap-transactions.js +0 -74
  58. package/dist/cjs/routing/usd-value.js +0 -12
  59. package/dist/cjs/settings.js +1 -456
  60. package/dist/cjs/swap-venues.js +0 -17
  61. package/dist/cjs/ton-connect.js +0 -82
  62. package/dist/cjs/ton-execution.js +0 -6
  63. package/dist/cjs/ton.js +0 -42
  64. package/dist/cjs/tron-execution.js +0 -145
  65. package/dist/cjs/types.d.ts +8 -0
  66. package/dist/claims.js +0 -60
  67. package/dist/config.js +1 -211
  68. package/dist/consolidated-quote.js +2 -464
  69. package/dist/destination-calldata.js +0 -71
  70. package/dist/ecosystems.js +0 -183
  71. package/dist/execution.js +0 -92
  72. package/dist/fee-type.js +0 -2
  73. package/dist/hyperliquid-execution.js +0 -98
  74. package/dist/image-links.js +0 -108
  75. package/dist/lifi-execution-guard.js +65 -172
  76. package/dist/near-intents-conformance.js +0 -110
  77. package/dist/near-intents-route.d.ts +13 -0
  78. package/dist/near-intents-route.js +5 -139
  79. package/dist/near-intents.js +0 -562
  80. package/dist/origin-deposit.js +0 -56
  81. package/dist/pre-quote.js +0 -80
  82. package/dist/prices.js +0 -113
  83. package/dist/providers.js +0 -83
  84. package/dist/quote-fees.js +0 -80
  85. package/dist/referral.js +0 -75
  86. package/dist/relay-currencies.js +0 -31
  87. package/dist/relay-depository.js +52 -77
  88. package/dist/relay-quote.js +0 -394
  89. package/dist/route-steps.js +0 -100
  90. package/dist/routing/amounts.js +0 -83
  91. package/dist/routing/candidate-route.d.ts +46 -1
  92. package/dist/routing/candidate-route.js +10 -39
  93. package/dist/routing/candidate.js +0 -46
  94. package/dist/routing/carrier-provider-key.js +0 -27
  95. package/dist/routing/carriers/omnibridge.js +0 -120
  96. package/dist/routing/carriers/pulsex-paths.js +0 -57
  97. package/dist/routing/carriers/pulsex-split.js +0 -92
  98. package/dist/routing/carriers/pulsex.js +0 -279
  99. package/dist/routing/carriers/wrap.js +0 -57
  100. package/dist/routing/composed-route-quality.js +0 -95
  101. package/dist/routing/entry-chain-anchor.js +0 -27
  102. package/dist/routing/format.js +0 -50
  103. package/dist/routing/index.d.ts +1 -1
  104. package/dist/routing/index.js +1 -29
  105. package/dist/routing/producers.js +0 -854
  106. package/dist/routing/providers.js +0 -27
  107. package/dist/routing/search/compose.js +0 -56
  108. package/dist/routing/search/graph.js +0 -364
  109. package/dist/routing/search/plan-route-data.js +6 -511
  110. package/dist/routing/search/score.js +0 -344
  111. package/dist/routing/swap-transactions.js +0 -74
  112. package/dist/routing/usd-value.js +0 -12
  113. package/dist/settings.js +1 -456
  114. package/dist/swap-venues.js +0 -17
  115. package/dist/ton-connect.js +0 -82
  116. package/dist/ton-execution.js +0 -6
  117. package/dist/ton.js +0 -42
  118. package/dist/tron-execution.js +0 -145
  119. package/dist/types.d.ts +8 -0
  120. package/package.json +3 -3
@@ -40,21 +40,8 @@ const config_js_1 = require("./config.js");
40
40
  const fee_type_js_1 = require("./fee-type.js");
41
41
  exports.oneEther = 10n ** 18n;
42
42
  exports.basisPoints = 10000n;
43
- /**
44
- * Returns the bridge pathway (configuration) for a given bridge key, asset in, and whether to use the production pathway
45
- * @param bridgeKey - the bridge key to use
46
- * @param isProd - whether to use the production pathway
47
- * @param assetIn - the asset in to bridge
48
- * @returns the bridge pathway
49
- */
50
43
  const bridgePathway = ({ bridgeKey, isProd, assetIn, }) => (0, config_js_1.pathway)(bridgeKey, isProd, assetIn?.address) ?? null;
51
44
  exports.bridgePathway = bridgePathway;
52
- /**
53
- * Retrieves the amount to bridge from the amount and asset in. If either of them is nil, returns 0n
54
- * @param amountIn - the amount to bridge
55
- * @param assetIn - the asset in to bridge
56
- * @returns the amount to bridge
57
- */
58
45
  const amountToBridge = ({ amountIn, assetIn, }) => {
59
46
  if (!amountIn || amountIn === 0n || !assetIn) {
60
47
  return 0n;
@@ -62,24 +49,12 @@ const amountToBridge = ({ amountIn, assetIn, }) => {
62
49
  return amountIn;
63
50
  };
64
51
  exports.amountToBridge = amountToBridge;
65
- /**
66
- * Calculates the bridge cost from the amount to bridge and bridge fee
67
- * @param amountToBridge - the amount to bridge
68
- * @param bridgeFee - the bridge fee
69
- * @returns the bridge cost
70
- */
71
52
  const bridgeCost = ({ amountToBridge, bridgeFee, }) => {
72
53
  if (bridgeFee === null)
73
54
  return null;
74
55
  return (amountToBridge * bridgeFee) / exports.oneEther;
75
56
  };
76
57
  exports.bridgeCost = bridgeCost;
77
- /**
78
- * Calculates the amount after bridge fee from the amount to bridge and bridge cost
79
- * @param amountToBridge - the amount to bridge
80
- * @param bridgeCost - the bridge cost
81
- * @returns the amount after bridge fee
82
- */
83
58
  const amountAfterBridgeFee = ({ amountToBridge, bridgeCost, }) => {
84
59
  if (bridgeCost === null)
85
60
  return null;
@@ -89,12 +64,6 @@ const amountAfterBridgeFee = ({ amountToBridge, bridgeCost, }) => {
89
64
  return afterFee;
90
65
  };
91
66
  exports.amountAfterBridgeFee = amountAfterBridgeFee;
92
- /**
93
- * Calculates the estimated amount out from the amount after bridge fee and fee
94
- * @param amountAfterBridgeFee - the amount after bridge fee
95
- * @param fee - the fee
96
- * @returns the estimated amount out
97
- */
98
67
  const estimatedAmountOut = ({ amountAfterBridgeFee, fee, }) => {
99
68
  if (typeof fee !== 'bigint')
100
69
  return null;
@@ -105,16 +74,6 @@ const estimatedAmountOut = ({ amountAfterBridgeFee, fee, }) => {
105
74
  return amountAfterBridgeFee - fee;
106
75
  };
107
76
  exports.estimatedAmountOut = estimatedAmountOut;
108
- /**
109
- * Calculates the estimated fee from the amount after bridge fee, fee, percent fee, fee type, limit, and whether to deliver the costs
110
- * @param amountAfterBridgeFee - the amount after bridge fee
111
- * @param fee - the fee
112
- * @param percentFee - the percent fee
113
- * @param feeType - the fee type
114
- * @param limit - the limit
115
- * @param costsToDeliver - whether to deliver the costs
116
- * @returns the estimated fee
117
- */
118
77
  const estimatedFee = ({ amountAfterBridgeFee, fee, percentFee, feeType, limit, costsToDeliver, }) => {
119
78
  const fixedFee = amountAfterBridgeFee ? (amountAfterBridgeFee * percentFee) / exports.oneEther : null;
120
79
  if (!costsToDeliver) {
@@ -134,13 +93,6 @@ const estimatedFee = ({ amountAfterBridgeFee, fee, percentFee, feeType, limit, c
134
93
  return null;
135
94
  };
136
95
  exports.estimatedFee = estimatedFee;
137
- /**
138
- * Calculates the estimated native network cost from the estimated gas and latest base fee per gas
139
- * @param estimatedGas - the estimated gas
140
- * @param latestBaseFeePerGas - the latest base fee per gas
141
- * @param requiresDelivery - whether to deliver the costs
142
- * @returns the estimated native network cost
143
- */
144
96
  const estimatedNativeNetworkCost = ({ estimatedGas, latestBaseFeePerGas, requiresDelivery, }) => {
145
97
  if (!estimatedGas || !latestBaseFeePerGas || !requiresDelivery) {
146
98
  return null;
@@ -148,15 +100,6 @@ const estimatedNativeNetworkCost = ({ estimatedGas, latestBaseFeePerGas, require
148
100
  return BigInt(estimatedGas * latestBaseFeePerGas);
149
101
  };
150
102
  exports.estimatedNativeNetworkCost = estimatedNativeNetworkCost;
151
- /**
152
- * Calculates the estimated token network cost from the estimated native
153
- * network cost, price corrective, decimals, and one token int
154
- * @param estimatedNativeNetworkCost - the estimated native network cost
155
- * @param priceCorrective - the price corrective
156
- * @param decimals - the decimals
157
- * @param oneTokenInt - the one token int
158
- * @returns the estimated token network cost
159
- */
160
103
  const estimatedTokenNetworkCost = ({ estimatedNativeNetworkCost, priceCorrective, decimals, oneTokenInt, }) => {
161
104
  if (!priceCorrective || !oneTokenInt || !estimatedNativeNetworkCost || !decimals) {
162
105
  return null;
@@ -165,22 +108,12 @@ const estimatedTokenNetworkCost = ({ estimatedNativeNetworkCost, priceCorrective
165
108
  return tokenCost;
166
109
  };
167
110
  exports.estimatedTokenNetworkCost = estimatedTokenNetworkCost;
168
- /**
169
- * Calculates one token of the asset in as an int
170
- * @param assetIn - the asset in to bridge
171
- * @returns the one token int
172
- */
173
111
  const oneTokenInt = ({ assetIn }) => {
174
112
  if (!assetIn)
175
113
  return 1n;
176
114
  return 10n ** BigInt(assetIn.decimals);
177
115
  };
178
116
  exports.oneTokenInt = oneTokenInt;
179
- /**
180
- * Returns the limit as a bigint. Nil uses 0n
181
- * @param lim - the limit
182
- * @returns the limit
183
- */
184
117
  const limit = (lim) => {
185
118
  if (!lim) {
186
119
  return 0n;
@@ -188,36 +121,16 @@ const limit = (lim) => {
188
121
  return lim;
189
122
  };
190
123
  exports.limit = limit;
191
- /**
192
- * Returns the network switch asset out address from the asset out, unwrap, and to chain
193
- * @param assetOut - the asset out
194
- * @param unwrap - whether to unwrap
195
- * @param toChain - the chain to switch to
196
- * @returns the network switch asset out address
197
- */
198
124
  const networkSwitchAssetOutAddress = ({ assetOut, unwrap, toChain, }) => {
199
125
  if (!assetOut)
200
126
  return null;
201
127
  if (!unwrap)
202
128
  return assetOut.address;
203
129
  const wrappedNative = config_js_1.nativeAssetOut[toChain];
204
- // Addresses arrive in whatever case their source used (a checksummed literal
205
- // here, a lower-cased list entry there), so equality must ignore case.
206
130
  const isWrappedNative = !!wrappedNative && (0, viem_1.isAddress)(assetOut.address, { strict: false }) && (0, viem_1.isAddressEqual)(wrappedNative, assetOut.address);
207
131
  return isWrappedNative ? viem_1.zeroAddress : assetOut.address;
208
132
  };
209
133
  exports.networkSwitchAssetOutAddress = networkSwitchAssetOutAddress;
210
- /**
211
- * Calculates the desired excess compensation basis points from the path, asset in, asset out, bridge key, fee type, list, and asset out address
212
- * @param path - the path
213
- * @param assetIn - the asset in to bridge
214
- * @param assetOut - the asset out
215
- * @param bridgeKey - the bridge key
216
- * @param feeType - the fee type
217
- * @param list - the list
218
- * @param assetOutAddress - the asset out address
219
- * @returns the desired excess compensation basis points
220
- */
221
134
  const desiredExcessCompensationBasisPoints = ({ path, assetIn, assetOut, bridgeKey, feeType, list, assetOutAddress, }) => {
222
135
  if (!path?.requiresDelivery) {
223
136
  return 0n;
@@ -234,31 +147,6 @@ const desiredExcessCompensationBasisPoints = ({ path, assetIn, assetOut, bridgeK
234
147
  : 10000n;
235
148
  };
236
149
  exports.desiredExcessCompensationBasisPoints = desiredExcessCompensationBasisPoints;
237
- /**
238
- * Works out the Gibs delivery fee for a transfer, as a {@link DeliveryFee}.
239
- *
240
- * Each mode reads the SAME figure the delivered estimate subtracts
241
- * ({@link estimatedFee}), so a route's cost and its delivered value reconcile:
242
- *
243
- * - percent: the arriving value times the rate. The router computes
244
- * `value * multiplier / 1 ether`.
245
- * - fixed: the fixed amount. The router takes `limit` as the fee.
246
- * - gas: the limit. The router takes the gas cost, capped at the limit, so the
247
- * limit is the most the reader pays and the figure the delivered estimate
248
- * already assumes.
249
- *
250
- * `percentFee` must be null when the rate is not known. Passing a zero stand-in
251
- * would state a free delivery.
252
- *
253
- * @param options.shouldDeliver - whether the reader asked for delivery
254
- * @param options.routeOffersDelivery - whether this pathway delivers for a fee at all
255
- * @param options.feeType - the delivery fee mode
256
- * @param options.amountAfterBridgeFee - the value that reaches the destination router, or null
257
- * @param options.percentFee - the percent rate as a fraction of one ether, or null when unknown
258
- * @param options.fixedFee - the fixed fee in base units, or null when unknown
259
- * @param options.limit - the gas mode cap in base units, or null when unknown
260
- * @returns the delivery fee
261
- */
262
150
  const deliveryFee = ({ shouldDeliver, routeOffersDelivery, feeType, amountAfterBridgeFee, percentFee, fixedFee, limit, }) => {
263
151
  if (!shouldDeliver || !routeOffersDelivery) {
264
152
  return { status: 'not-requested' };
@@ -279,18 +167,6 @@ const deliveryFee = ({ shouldDeliver, routeOffersDelivery, feeType, amountAfterB
279
167
  };
280
168
  };
281
169
  exports.deliveryFee = deliveryFee;
282
- /**
283
- * The four-bit fee-type settings word a fee director carries.
284
- *
285
- * - bit 0: fixed fee mode.
286
- * - bit 1: unwrap the delivered token to the native coin.
287
- * - bit 2: exclude the priority fee from the delivery cost. Always set.
288
- * - bit 3: percent fee mode.
289
- *
290
- * @param options.feeType - the delivery fee mode
291
- * @param options.unwrap - whether the delivery unwraps to the native coin
292
- * @returns the settings word for {@link feeDirectorStructEncoded}
293
- */
294
170
  const feeTypeSettings = ({ feeType, unwrap }) => {
295
171
  const fixedBit = feeType === fee_type_js_1.FeeType.FIXED ? 1n : 0n;
296
172
  const unwrapBit = unwrap ? 1n : 0n;
@@ -299,43 +175,12 @@ const feeTypeSettings = ({ feeType, unwrap }) => {
299
175
  return (percentBit << 3n) | (excludePriorityBit << 2n) | (unwrapBit << 1n) | fixedBit;
300
176
  };
301
177
  exports.feeTypeSettings = feeTypeSettings;
302
- /**
303
- * The ERC-20 `approve` call, as a target, a value and calldata. The
304
- * interface's approval broadcast and the SDK's execution planner both build it
305
- * here.
306
- *
307
- * @param options.token - the token to approve
308
- * @param options.spender - the address allowed to pull it
309
- * @param options.amount - the allowance to set
310
- * @returns the call
311
- */
312
178
  const approveCall = ({ token, spender, amount, }) => ({
313
179
  to: token,
314
180
  value: 0n,
315
181
  data: (0, viem_1.encodeFunctionData)({ abi: viem_1.erc20Abi, functionName: 'approve', args: [spender, amount] }),
316
182
  });
317
183
  exports.approveCall = approveCall;
318
- /**
319
- * The `approve` amounts to send, in order, so the spender may pull exactly
320
- * `minimum`. Empty when the allowance on chain already covers it.
321
- *
322
- * EXACT, NEVER UNLIMITED. An unlimited approval lets the spender pull the
323
- * reader's whole balance for as long as the approval stands, so a later fault
324
- * in that contract, or a spender a compromised quote named, costs everything
325
- * rather than one transfer. The owner chose exact approvals everywhere
326
- * (2026-10-07); the interface and the SDK's execution planner both decide
327
- * here.
328
- *
329
- * A SHORT, NON-ZERO ALLOWANCE IS RESET TO ZERO FIRST. Some tokens (Tether on
330
- * Ethereum is the known one) revert an `approve` that changes one non-zero
331
- * allowance into another. Exact approvals leave such remainders more often,
332
- * because an aggregator may spend less than it was allowed. A reset first
333
- * works for every token, at the cost of one extra transaction in that case.
334
- *
335
- * @param options.allowance - the allowance on chain now
336
- * @param options.minimum - the amount the next transaction pulls
337
- * @returns the amounts to approve, in order: none, `[minimum]`, or `[0n, minimum]`
338
- */
339
184
  const approvalAmounts = ({ allowance, minimum, }) => {
340
185
  if (allowance >= minimum)
341
186
  return [];
@@ -344,21 +189,6 @@ const approvalAmounts = ({ allowance, minimum, }) => {
344
189
  return [0n, minimum];
345
190
  };
346
191
  exports.approvalAmounts = approvalAmounts;
347
- /**
348
- * The allowance a direct omnibridge crossing needs, or null when it needs none.
349
- *
350
- * Reads the SAME predicate {@link transactionInputs} uses to pick the call: a
351
- * token the bridge minted ({@link interactingWithBridgeToken}) is burned by
352
- * `transferAndCall` and needs no allowance, and the native coin is sent as
353
- * value. Every other token is pulled by the pathway's `from` mediator through
354
- * `relayTokens` or `relayTokensAndCall`.
355
- *
356
- * @param options.bridgePathway - the crossing's pathway
357
- * @param options.assetIn - the token the crossing spends
358
- * @param options.assetLink - the token's bridge link
359
- * @param options.amountToBridge - the amount the crossing pulls
360
- * @returns the approval the crossing needs, or null
361
- */
362
192
  const omnibridgeApproval = ({ bridgePathway, assetIn, assetLink, amountToBridge, }) => {
363
193
  if (assetIn.address === viem_1.zeroAddress)
364
194
  return null;
@@ -372,12 +202,6 @@ const omnibridgeApproval = ({ bridgePathway, assetIn, assetLink, amountToBridge,
372
202
  };
373
203
  };
374
204
  exports.omnibridgeApproval = omnibridgeApproval;
375
- /**
376
- * Calculates the reasonable fixed fee from the estimated token network cost and desired excess compensation basis points
377
- * @param estimatedTokenNetworkCost - the estimated token network cost
378
- * @param desiredExcessCompensationBasisPoints - the desired excess compensation basis points
379
- * @returns the reasonable fixed fee
380
- */
381
205
  const reasonableFixedFee = ({ estimatedTokenNetworkCost, desiredExcessCompensationBasisPoints, }) => {
382
206
  if (!estimatedTokenNetworkCost) {
383
207
  return null;
@@ -385,23 +209,11 @@ const reasonableFixedFee = ({ estimatedTokenNetworkCost, desiredExcessCompensati
385
209
  return ((estimatedTokenNetworkCost * (25000n + desiredExcessCompensationBasisPoints)) / exports.basisPoints);
386
210
  };
387
211
  exports.reasonableFixedFee = reasonableFixedFee;
388
- /**
389
- * Calculates the reasonable percent on gas limit from the gas tip fee and estimated token network cost
390
- * @param gasTipFee - the gas tip fee
391
- * @param estimatedTokenNetworkCost - the estimated token network cost
392
- * @returns the reasonable percent on gas limit
393
- */
394
212
  const reasonablePercentOnGasLimit = ({ gasTipFee, estimatedTokenNetworkCost, }) => {
395
213
  return ((25000n * ((exports.oneEther + (gasTipFee ?? 0n)) * (estimatedTokenNetworkCost ?? 0n))) /
396
214
  (exports.oneEther * exports.basisPoints));
397
215
  };
398
216
  exports.reasonablePercentOnGasLimit = reasonablePercentOnGasLimit;
399
- /**
400
- * Calculates the reasonable percent fee from the reasonable fixed fee and amount after bridge fee
401
- * @param reasonableFixedFee - the reasonable fixed fee
402
- * @param amountAfterBridgeFee - the amount after bridge fee
403
- * @returns the reasonable percent fee
404
- */
405
217
  const reasonablePercentFee = ({ reasonableFixedFee, amountAfterBridgeFee, }) => {
406
218
  if (!reasonableFixedFee) {
407
219
  return null;
@@ -414,7 +226,7 @@ const reasonablePercentFee = ({ reasonableFixedFee, amountAfterBridgeFee, }) =>
414
226
  const max = 1000n * basisFeeTruncator;
415
227
  const min = 5n * basisFeeTruncator;
416
228
  if (highFee < reasonableFixedFee) {
417
- return max; // 10%
229
+ return max;
418
230
  }
419
231
  const highResPercent = (reasonableFixedFee * exports.oneEther) / amountAfterBridgeFee;
420
232
  if (highResPercent < min) {
@@ -427,12 +239,6 @@ const reasonablePercentFee = ({ reasonableFixedFee, amountAfterBridgeFee, }) =>
427
239
  return basisPoint * basisFeeTruncator;
428
240
  };
429
241
  exports.reasonablePercentFee = reasonablePercentFee;
430
- /**
431
- * Returns whether the asset in address is interacting with a bridge token
432
- * @param assetLink - the asset link
433
- * @param assetInAddress - the asset in address
434
- * @returns whether the asset in address is interacting with a bridge token
435
- */
436
242
  const interactingWithBridgeToken = ({ assetLink, assetInAddress, }) => {
437
243
  const { toForeign, toHome } = assetLink || {};
438
244
  const { foreign } = toForeign || {};
@@ -443,19 +249,6 @@ const interactingWithBridgeToken = ({ assetLink, assetInAddress, }) => {
443
249
  (home && (0, viem_1.getAddress)(home) === (0, viem_1.getAddress)(assetInAddress)));
444
250
  };
445
251
  exports.interactingWithBridgeToken = interactingWithBridgeToken;
446
- /**
447
- * Calculates the fee director struct encoded from the recipient, bridge pathway, fee type, price corrective, gas tip fee, percent fee, fee type settings, limit, and asset out
448
- * @param recipient - the recipient
449
- * @param bridgePathway - the bridge pathway
450
- * @param feeType - the fee type
451
- * @param priceCorrective - the price corrective
452
- * @param gasTipFee - the gas tip fee
453
- * @param percentFee - the percent fee
454
- * @param feeTypeSettings - the fee type settings
455
- * @param limit - the limit
456
- * @param assetOut - the asset out
457
- * @returns the fee director struct encoded
458
- */
459
252
  const feeDirectorStructEncoded = ({ recipient, bridgePathway, feeType, priceCorrective, gasTipFee, percentFee, feeTypeSettings, limit, assetOut, }) => {
460
253
  if (!assetOut || !bridgePathway) {
461
254
  return null;
@@ -482,20 +275,7 @@ const feeDirectorStructEncoded = ({ recipient, bridgePathway, feeType, priceCorr
482
275
  ]);
483
276
  };
484
277
  exports.feeDirectorStructEncoded = feeDirectorStructEncoded;
485
- /**
486
- * Calculates the destination data param from the recipient, bridge pathway, asset in, destination router, fee director struct encoded, asset link, should deliver, and unwrap
487
- * @param recipient - the recipient
488
- * @param bridgePathway - the bridge pathway
489
- * @param assetIn - the asset in to bridge
490
- * @param destinationRouter - the destination router
491
- * @param feeDirectorStructEncoded - the fee director struct encoded
492
- * @param assetLink - the asset link
493
- * @param shouldDeliver - whether to deliver the costs
494
- * @param unwrap - whether to unwrap
495
- * @returns the destination data param
496
- */
497
278
  const destinationDataParam = ({ recipient, bridgePathway, assetIn, destinationRouter, feeDirectorStructEncoded, assetLink, shouldDeliver, unwrap, }) => {
498
- // const recipient = input.recipient.value
499
279
  if (!recipient) {
500
280
  return null;
501
281
  }
@@ -505,8 +285,6 @@ const destinationDataParam = ({ recipient, bridgePathway, assetIn, destinationRo
505
285
  if (!destinationRouter) {
506
286
  return null;
507
287
  }
508
- // Only a delivery needs the fee director. A crossing without delivery sends
509
- // to the recipient, whatever the fee director would have said.
510
288
  if (bridgePathway.requiresDelivery && shouldDeliver && !feeDirectorStructEncoded) {
511
289
  return null;
512
290
  }
@@ -514,12 +292,9 @@ const destinationDataParam = ({ recipient, bridgePathway, assetIn, destinationRo
514
292
  return null;
515
293
  }
516
294
  if (bridgePathway.requiresDelivery) {
517
- // going from home to foreign
518
295
  if (!shouldDeliver) {
519
- // act like a regular bridge
520
296
  return recipient;
521
297
  }
522
- // going from foreign to home
523
298
  if (feeDirectorStructEncoded) {
524
299
  return (0, viem_1.concatHex)([destinationRouter, feeDirectorStructEncoded]);
525
300
  }
@@ -528,37 +303,17 @@ const destinationDataParam = ({ recipient, bridgePathway, assetIn, destinationRo
528
303
  if (!unwrap) {
529
304
  return recipient;
530
305
  }
531
- // unwrap wpls->pls
532
306
  return (0, viem_1.concatHex)([destinationRouter, recipient]);
533
307
  };
534
308
  exports.destinationDataParam = destinationDataParam;
535
- /**
536
- * Converts a desired excess compensation basis point value into a percentage as an integer, with the denominator assumed to be 1e18
537
- * @param desiredExcessCompensationBasisPoints - the desired excess compensation basis points
538
- * @returns the reasonable percent on top of gas fee
539
- */
540
309
  const reasonablePercentOnTopOfGasFee = ({ desiredExcessCompensationBasisPoints, }) => {
541
310
  return desiredExcessCompensationBasisPoints * (exports.oneEther / exports.basisPoints);
542
311
  };
543
312
  exports.reasonablePercentOnTopOfGasFee = reasonablePercentOnTopOfGasFee;
544
- /**
545
- * Calculates the desired compensation ratio from the desired excess compensation basis points
546
- * @param desiredExcessCompensationBasisPoints - the desired excess compensation basis points
547
- * @returns the desired compensation ratio
548
- */
549
313
  const desiredCompensationRatio = ({ desiredExcessCompensationBasisPoints, }) => {
550
314
  return exports.oneEther + (desiredExcessCompensationBasisPoints * exports.oneEther) / exports.basisPoints;
551
315
  };
552
316
  exports.desiredCompensationRatio = desiredCompensationRatio;
553
- /**
554
- * Calculates the available compensation maximum from the amount after bridge fee, percent fee, fee type, fixed fee, and limit
555
- * @param amountAfterBridgeFee - the amount after bridge fee
556
- * @param percentFee - the percent fee
557
- * @param feeType - the fee type
558
- * @param fixedFee - the fixed fee
559
- * @param limit - the limit
560
- * @returns the available compensation maximum
561
- */
562
317
  const availableCompensationMaximum = ({ amountAfterBridgeFee, percentFee, feeType, fixedFee, limit, }) => {
563
318
  if (feeType === fee_type_js_1.FeeType.PERCENT) {
564
319
  if (amountAfterBridgeFee === null)
@@ -574,72 +329,22 @@ const availableCompensationMaximum = ({ amountAfterBridgeFee, percentFee, feeTyp
574
329
  return 0n;
575
330
  };
576
331
  exports.availableCompensationMaximum = availableCompensationMaximum;
577
- /**
578
- * Determines if the bridge is undercompensated based on network costs vs compensation limit using desired compensation rate
579
- * @param estimatedTokenNetworkCost - the estimated token network cost
580
- * @param feeType - the fee type
581
- * @param limit - the maximum compensation limit
582
- * @param amountAfterBridgeFee - the amount after bridge fee
583
- * @param desiredExcessCompensationBasisPoints - the desired excess compensation basis points
584
- * @returns whether the bridge is undercompensated
585
- */
586
332
  const isUndercompensated = ({ estimatedTokenNetworkCost, feeType, limit, amountAfterBridgeFee, desiredExcessCompensationBasisPoints, }) => {
587
- // No undercompensation if no amount to bridge
588
333
  if (!amountAfterBridgeFee || amountAfterBridgeFee <= 0n) {
589
334
  return false;
590
335
  }
591
- // GAS_TIP fee type doesn't have undercompensation issues
592
336
  if (feeType === fee_type_js_1.FeeType.GAS_TIP) {
593
337
  return false;
594
338
  }
595
- // No network cost estimate means we can't determine undercompensation
596
339
  if (!estimatedTokenNetworkCost) {
597
340
  return false;
598
341
  }
599
- // Calculate desired compensation using the actual desired compensation ratio
600
342
  const desiredCompensationRatio = exports.oneEther + (desiredExcessCompensationBasisPoints * exports.oneEther) / exports.basisPoints;
601
343
  const desiredCompensationForNetworkCost = (estimatedTokenNetworkCost * desiredCompensationRatio) / exports.oneEther;
602
- // Undercompensated if desired compensation exceeds the limit
603
344
  return desiredCompensationForNetworkCost > limit;
604
345
  };
605
346
  exports.isUndercompensated = isUndercompensated;
606
- /**
607
- * Why a bridge key must not be built into a transaction for the pair on screen,
608
- * or null when the two agree.
609
- *
610
- * WHY THIS EXISTS, in the reader's words: "i just tried to swap from weth from
611
- * ethereum on pls, to pls, and the calldata that i must have signed was to
612
- * bridge back from pls to eth". A selection of PulseChain on BOTH sides is a
613
- * swap; it has no pathway, so the bridge key kept whatever crossing it last
614
- * held — or the address bar was repaired to a crossing — and the settings
615
- * cascade went on building a real, signable transfer of the reader's bridged
616
- * wrapped ether to Ethereum while the screen still named PulseChain.
617
- *
618
- * Three refusals, and each one is a separate way the two can part company:
619
- *
620
- * - A SAME-CHAIN SELECTION IS NEVER A CROSSING. Origin and destination on one
621
- * chain describes a swap. No omnibridge pathway can serve it, so any pathway
622
- * reached for here belongs to some other journey.
623
- * - THE PATHWAY MUST LEAVE THE CHAIN THE READER'S FUNDS ARE ON. A key whose
624
- * source chain differs spends a token the reader is not looking at.
625
- * - THE PATHWAY MUST LAND WHERE THE READER ASKED. This is the reported defect:
626
- * the destination silently became Ethereum.
627
- *
628
- * `signedCrossing` is `null` for a call no reader composed — the aggregator's
629
- * executor call built by `buildDestinationCalldata`, where the chain pair IS
630
- * the pathway and there is no screen to disagree with. Nullable rather than
631
- * optional so every caller has to decide, and the decision is visible at the
632
- * call site.
633
- *
634
- * @param bridgeKey - the key the pathway was resolved from
635
- * @param signedCrossing - the pair on screen, or null when no surface composed it
636
- * @returns the reason to refuse, or null when the two agree
637
- */
638
347
  const crossingRefusal = ({ bridgeKey, signedCrossing, }) => {
639
- // `undefined` is treated as `null` here, and only here. The field is REQUIRED
640
- // by the type, so no compiled caller can omit it — but a test double that
641
- // returns a partial object can, and a crash inside the settings cascade blanks
642
- // the page rather than refusing a transaction.
643
348
  if (signedCrossing === null || signedCrossing === undefined) {
644
349
  return null;
645
350
  }
@@ -661,20 +366,6 @@ const crossingRefusal = ({ bridgeKey, signedCrossing, }) => {
661
366
  return null;
662
367
  };
663
368
  exports.crossingRefusal = crossingRefusal;
664
- /**
665
- * Throws when the bridge key and the pair on screen describe different journeys.
666
- *
667
- * The LOUD half of {@link crossingRefusal}. {@link transactionInputs} runs
668
- * during render, where a throw would blank the application, so it refuses
669
- * quietly by returning null and the button it feeds stays inert. This is for
670
- * the broadcast funnel, where a disagreement means something reconstructed the
671
- * call another way and the reader is one signature from a transfer they never
672
- * asked for — there, silence is the worse failure.
673
- *
674
- * @param bridgeKey - the key the pathway was resolved from
675
- * @param signedCrossing - the pair on screen, or null when no surface composed it
676
- * @throws when the two describe different journeys
677
- */
678
369
  const assertCrossingAgrees = ({ bridgeKey, signedCrossing, }) => {
679
370
  const refusal = (0, exports.crossingRefusal)({ bridgeKey, signedCrossing });
680
371
  if (refusal !== null) {
@@ -682,28 +373,7 @@ const assertCrossingAgrees = ({ bridgeKey, signedCrossing, }) => {
682
373
  }
683
374
  };
684
375
  exports.assertCrossingAgrees = assertCrossingAgrees;
685
- /**
686
- * Why a same-chain PulseX swap transaction must not be built for the leg on
687
- * screen, or null when they agree. The swap-side sibling of
688
- * {@link crossingRefusal}.
689
- *
690
- * Two refusals, each a separate way the two can part company:
691
- *
692
- * - THE LEG ON SCREEN NAMES A CROSSING. A caller building a swap transaction
693
- * while the reader is looking at a two-chain crossing would sign the wrong
694
- * kind of thing for what is on screen.
695
- * - THE SWAP DOES NOT EXECUTE ON THE CHAIN THE READER IS LOOKING AT. A stale
696
- * candidate built for a chain the address bar has since left.
697
- *
698
- * @param signedLeg - what the surface believes this signature does, or null
699
- * when no surface composed it
700
- * @param chainId - the chain the candidate swap transaction actually executes on
701
- * @returns the reason to refuse, or null when the two agree
702
- */
703
376
  const swapRefusal = ({ signedLeg, chainId, }) => {
704
- // `undefined` treated as `null`, matching `crossingRefusal`'s own guard: the
705
- // field is required by the type, so only a test double or a crash inside the
706
- // cascade could omit it.
707
377
  if (signedLeg === null || signedLeg === undefined) {
708
378
  return null;
709
379
  }
@@ -719,16 +389,6 @@ const swapRefusal = ({ signedLeg, chainId, }) => {
719
389
  return null;
720
390
  };
721
391
  exports.swapRefusal = swapRefusal;
722
- /**
723
- * Throws when the leg on screen and the candidate swap transaction describe
724
- * different journeys. The swap-side sibling of {@link assertCrossingAgrees} —
725
- * loud where {@link swapRefusal} is quiet, for the same reason: this runs one
726
- * step before the wallet, where silence is what lets a reader sign.
727
- *
728
- * @param signedLeg - what the surface believes this signature does, or null
729
- * @param chainId - the chain the candidate swap transaction actually executes on
730
- * @throws when the two describe different journeys
731
- */
732
392
  const assertSwapAgrees = ({ signedLeg, chainId, }) => {
733
393
  const refusal = (0, exports.swapRefusal)({ signedLeg, chainId });
734
394
  if (refusal !== null) {
@@ -736,26 +396,6 @@ const assertSwapAgrees = ({ signedLeg, chainId, }) => {
736
396
  }
737
397
  };
738
398
  exports.assertSwapAgrees = assertSwapAgrees;
739
- /**
740
- * Why a candidate must not be signed for the leg and section a caller is
741
- * about to build calldata for, or null when they agree. The candidate-pick
742
- * sibling of {@link crossingRefusal}/{@link swapRefusal}.
743
- *
744
- * UNLIKE THOSE TWO, A MISSING PICK IS ITSELF A REFUSAL. `crossingRefusal` and
745
- * `swapRefusal` let a null leg through because some calls compose no screen at
746
- * all (the aggregator's own executor call). A candidate-signing sender always
747
- * has a screen — the route the reader picked — so a candidate id with no
748
- * recorded leg is exactly the gap this type exists to close: `candidateId`
749
- * alone used to be treated as sufficient identity, and this function is what
750
- * stops it from being treated that way again.
751
- *
752
- * @param pick - what the route recorded it picked, or null/undefined when the
753
- * producer that built the route never set one
754
- * @param leg - the leg the caller is about to build calldata for
755
- * @param sectionIndex - the route section the caller is about to build
756
- * calldata for
757
- * @returns the reason to refuse, or null when they agree
758
- */
759
399
  const candidatePickRefusal = ({ pick, leg, sectionIndex, }) => {
760
400
  if (pick === null || pick === undefined) {
761
401
  return `Refusing to sign a ${leg} at section ${sectionIndex}: the route named no candidate to sign.`;
@@ -769,20 +409,6 @@ const candidatePickRefusal = ({ pick, leg, sectionIndex, }) => {
769
409
  return null;
770
410
  };
771
411
  exports.candidatePickRefusal = candidatePickRefusal;
772
- /**
773
- * Throws when a candidate pick and the leg/section a caller is about to build
774
- * calldata for describe different signatures. The candidate-pick sibling of
775
- * {@link assertCrossingAgrees}/{@link assertSwapAgrees} — loud where {@link
776
- * candidatePickRefusal} is quiet, for the same reason: this runs one step
777
- * before the wallet, where silence is what lets a reader sign the wrong thing.
778
- *
779
- * @param pick - what the route recorded it picked, or null
780
- * @param leg - the leg the caller is about to build calldata for
781
- * @param sectionIndex - the route section the caller is about to build
782
- * calldata for
783
- * @throws when the pick and the leg/section being built describe different
784
- * signatures
785
- */
786
412
  const assertCandidatePickAgrees = ({ pick, leg, sectionIndex, }) => {
787
413
  const refusal = (0, exports.candidatePickRefusal)({ pick, leg, sectionIndex });
788
414
  if (refusal !== null) {
@@ -790,42 +416,7 @@ const assertCandidatePickAgrees = ({ pick, leg, sectionIndex, }) => {
790
416
  }
791
417
  };
792
418
  exports.assertCandidatePickAgrees = assertCandidatePickAgrees;
793
- /**
794
- * Calculates the same-chain PulseX swap transaction inputs, or null when the
795
- * inputs cannot form a call — including when the leg on screen and the swap's
796
- * own chain disagree. The swap-side sibling of {@link transactionInputs}.
797
- *
798
- * SAME SHAPE AS `transactionInputs`, deliberately: `{ to, value, data } | null`,
799
- * so a caller can dispatch either builder's result through one `sendTransaction`
800
- * without a second shape to handle.
801
- *
802
- * WRAPPING AND UNWRAPPING THE NATIVE COIN USE THE ROUTER'S OWN NATIVE-COIN
803
- * FUNCTIONS, not a separate deposit/withdraw step — one router contract wraps
804
- * on the way in (`swapExactETHForTokens`) and unwraps on the way out
805
- * (`swapExactTokensForETH`), the same contract `swapExactTokensForTokens`
806
- * already targets when neither side is native.
807
- *
808
- * @param signedLeg - what the surface believes this signature does, or null
809
- * @param chainId - the chain the swap actually executes on
810
- * @param routerAddress - the PulseX router this swap is sent to, or null when
811
- * none is deployed for this chain
812
- * @param fromTokenAddress - the input token address, or the zero address for
813
- * the chain's native coin
814
- * @param toTokenAddress - the output token address, or the zero address for
815
- * the chain's native coin
816
- * @param swapPath - the ordered swap path — for a route-search hop, the one
817
- * its quote was priced along (`pulseXSwapPathForHop`),
818
- * already expressed in the router's own token addresses — the wrapped-native
819
- * token stands in for either native end
820
- * @param amountIn - the amount to swap, in the input token's base units
821
- * @param minAmountOut - the minimum acceptable output after slippage, in the
822
- * output token's base units
823
- * @param recipient - the address the swap delivers to
824
- * @param deadline - the unix-seconds deadline the router enforces
825
- * @returns the transaction inputs, or null when the inputs cannot form a call
826
- */
827
419
  const pulseXSwapTransactionInputs = ({ signedLeg, chainId, routerAddress, fromTokenAddress, toTokenAddress, swapPath, amountIn, minAmountOut, recipient, deadline, }) => {
828
- // FIRST, BEFORE ANY ENCODING — see `transactionInputs`'s identical note.
829
420
  if ((0, exports.swapRefusal)({ signedLeg, chainId }) !== null) {
830
421
  return null;
831
422
  }
@@ -843,7 +434,6 @@ const pulseXSwapTransactionInputs = ({ signedLeg, chainId, routerAddress, fromTo
843
434
  }
844
435
  const fromIsNative = fromTokenAddress === viem_1.zeroAddress;
845
436
  const toIsNative = toTokenAddress === viem_1.zeroAddress;
846
- // Native-to-native names no real swap — there is nothing for the router to do.
847
437
  if (fromIsNative && toIsNative) {
848
438
  return null;
849
439
  }
@@ -880,50 +470,26 @@ const pulseXSwapTransactionInputs = ({ signedLeg, chainId, routerAddress, fromTo
880
470
  };
881
471
  };
882
472
  exports.pulseXSwapTransactionInputs = pulseXSwapTransactionInputs;
883
- /**
884
- * Calculates the transaction inputs from the bridge pathway, asset in, recipient, account, asset link, destination data param, amount to bridge, fee director struct encoded, and should deliver
885
- * @param bridgeKey - the key the pathway was resolved from, for {@link crossingRefusal}
886
- * @param signedCrossing - the chain pair on screen, or null when no surface composed it
887
- * @param bridgePathway - the bridge pathway to use
888
- * @param assetIn - the asset in to bridge
889
- * @param recipient - the recipient of the bridge
890
- * @param account - the account to bridge from
891
- * @param assetLink - the asset link to use
892
- * @param destinationDataParam - the destination data param to use
893
- * @param amountToBridge - the amount to bridge
894
- * @param feeDirectorStructEncoded - the fee director struct encoded to use
895
- * @param shouldDeliver - whether to deliver the tokens to the recipient
896
- * @returns the transaction inputs, or null when the inputs cannot form a call —
897
- * including when the pathway crosses somewhere other than the pair on screen
898
- */
899
473
  const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn, recipient, account, assetLink, destinationDataParam, amountToBridge, feeDirectorStructEncoded, shouldDeliver, }) => {
900
- // FIRST, BEFORE ANY ENCODING. Every branch below writes a real mediator call;
901
- // by the time one is chosen the disagreement is already encoded.
902
474
  if ((0, exports.crossingRefusal)({ bridgeKey, signedCrossing }) !== null) {
903
475
  return null;
904
476
  }
905
477
  if (!bridgePathway) {
906
478
  return null;
907
479
  }
908
- // check that recipient is valid
909
480
  if (!recipient || !(0, viem_1.isAddress)(recipient) || recipient === viem_1.zeroAddress) {
910
481
  return null;
911
482
  }
912
- // check that wallet account is valid
913
483
  if (!account || !(0, viem_1.isAddress)(account) || account === viem_1.zeroAddress) {
914
484
  return null;
915
485
  }
916
- // check that asset in is valid
917
486
  if (!assetIn) {
918
487
  return null;
919
488
  }
920
- // check that asset link is valid
921
489
  if (!assetLink) {
922
490
  return null;
923
491
  }
924
492
  let value = 0n;
925
- // we are moving "from" this side, so we need to call a function on the "from" address
926
- // only relevant for the relayTokens(AndCall) pathway outside of native tokens
927
493
  let toAddress = bridgePathway.from;
928
494
  let data = '0x';
929
495
  const inputIsBridgeToken = (0, exports.interactingWithBridgeToken)({
@@ -931,11 +497,8 @@ const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn,
931
497
  assetInAddress: assetIn.address,
932
498
  });
933
499
  if (inputIsBridgeToken) {
934
- // when interacting with a bridged token, we need to call the token address directly
935
500
  toAddress = assetIn.address;
936
501
  value = 0n;
937
- // if we want delivery of the tokens (going from home to foreign) then we need to have the foreign data param
938
- // and it needs to start with the destination router
939
502
  if (!destinationDataParam) {
940
503
  return null;
941
504
  }
@@ -955,7 +518,6 @@ const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn,
955
518
  value = amountToBridge;
956
519
  toAddress = bridgePathway.nativeRouter;
957
520
  if (bridgePathway.feeManager === 'from' && shouldDeliver) {
958
- // transferring native to foreign
959
521
  if (!feeDirectorStructEncoded)
960
522
  return null;
961
523
  if (!bridgePathway.destinationRouter)
@@ -973,7 +535,6 @@ const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn,
973
535
  });
974
536
  }
975
537
  else {
976
- // delivery always occurs when moving from foreign to home
977
538
  data = bridgePathway.usesExtraParam
978
539
  ? (0, viem_1.encodeFunctionData)({
979
540
  abi: abis.nativeRouterExtraInput,
@@ -988,7 +549,6 @@ const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn,
988
549
  }
989
550
  }
990
551
  else {
991
- // tokens native to this side, entering the bridge
992
552
  if (shouldDeliver && bridgePathway.requiresDelivery) {
993
553
  if (!feeDirectorStructEncoded)
994
554
  return null;
@@ -1038,27 +598,12 @@ const transactionInputs = ({ bridgeKey, signedCrossing, bridgePathway, assetIn,
1038
598
  };
1039
599
  };
1040
600
  exports.transactionInputs = transactionInputs;
1041
- /**
1042
- * Calculates the asset out key from the bridge key path, asset in address, and unwrap
1043
- * @param bridgeKeyPath - the bridge key path
1044
- * @param assetInAddress - the asset in address
1045
- * @param unwrap - whether to unwrap
1046
- * @returns the asset out key
1047
- */
1048
601
  const assetOutKey = ({ bridgeKeyPath, assetInAddress, unwrap, }) => {
1049
602
  if (!bridgeKeyPath || !assetInAddress)
1050
603
  return null;
1051
604
  return `${bridgeKeyPath}/${unwrap ? 'native' : 'erc20'}/${assetInAddress.toLowerCase()}`;
1052
605
  };
1053
606
  exports.assetOutKey = assetOutKey;
1054
- /**
1055
- * Returns the asset out from the asset in address, assets out, bridge key path, and unwrap
1056
- * @param assetInAddress - the asset in address
1057
- * @param assetsOut - the assets out
1058
- * @param bridgeKeyPath - the bridge key path
1059
- * @param unwrap - whether to unwrap
1060
- * @returns the asset out
1061
- */
1062
607
  const assetOut = ({ assetInAddress, assetsOut, bridgeKeyPath, unwrap, }) => {
1063
608
  if (!assetInAddress)
1064
609
  return null;