@gibs/bridge-sdk 1.19.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 (111) hide show
  1. package/dist/abis.js +0 -2
  2. package/dist/bridge-limits.js +0 -38
  3. package/dist/chain-info.js +0 -116
  4. package/dist/chain-names.js +0 -151
  5. package/dist/chains.js +0 -198
  6. package/dist/cjs/abis.js +0 -2
  7. package/dist/cjs/bridge-limits.js +0 -38
  8. package/dist/cjs/chain-info.js +0 -116
  9. package/dist/cjs/chain-names.js +0 -151
  10. package/dist/cjs/chains.js +0 -198
  11. package/dist/cjs/claims.js +0 -60
  12. package/dist/cjs/config.js +1 -208
  13. package/dist/cjs/consolidated-quote.js +0 -465
  14. package/dist/cjs/destination-calldata.js +0 -71
  15. package/dist/cjs/ecosystems.js +0 -183
  16. package/dist/cjs/execution.js +0 -92
  17. package/dist/cjs/fee-type.js +0 -1
  18. package/dist/cjs/hyperliquid-execution.js +0 -98
  19. package/dist/cjs/image-links.js +0 -108
  20. package/dist/cjs/lifi-execution-guard.js +65 -172
  21. package/dist/cjs/near-intents-conformance.js +0 -110
  22. package/dist/cjs/near-intents-route.js +0 -149
  23. package/dist/cjs/near-intents.js +0 -562
  24. package/dist/cjs/origin-deposit.js +0 -56
  25. package/dist/cjs/pre-quote.js +0 -80
  26. package/dist/cjs/prices.js +0 -113
  27. package/dist/cjs/providers.js +0 -83
  28. package/dist/cjs/quote-fees.js +0 -80
  29. package/dist/cjs/referral.js +0 -75
  30. package/dist/cjs/relay-currencies.js +0 -31
  31. package/dist/cjs/relay-depository.js +52 -77
  32. package/dist/cjs/relay-quote.js +0 -394
  33. package/dist/cjs/route-steps.js +0 -100
  34. package/dist/cjs/routing/amounts.js +0 -83
  35. package/dist/cjs/routing/candidate-route.js +0 -73
  36. package/dist/cjs/routing/candidate.js +0 -46
  37. package/dist/cjs/routing/carrier-provider-key.js +0 -27
  38. package/dist/cjs/routing/carriers/omnibridge.js +0 -120
  39. package/dist/cjs/routing/carriers/pulsex-paths.js +0 -57
  40. package/dist/cjs/routing/carriers/pulsex-split.js +0 -92
  41. package/dist/cjs/routing/carriers/pulsex.js +0 -279
  42. package/dist/cjs/routing/carriers/wrap.js +0 -57
  43. package/dist/cjs/routing/composed-route-quality.js +0 -95
  44. package/dist/cjs/routing/entry-chain-anchor.js +0 -27
  45. package/dist/cjs/routing/format.js +0 -50
  46. package/dist/cjs/routing/index.js +0 -28
  47. package/dist/cjs/routing/producers.js +0 -854
  48. package/dist/cjs/routing/providers.js +0 -27
  49. package/dist/cjs/routing/search/compose.js +0 -56
  50. package/dist/cjs/routing/search/graph.js +0 -364
  51. package/dist/cjs/routing/search/plan-route-data.js +0 -508
  52. package/dist/cjs/routing/search/score.js +0 -344
  53. package/dist/cjs/routing/swap-transactions.js +0 -74
  54. package/dist/cjs/routing/usd-value.js +0 -12
  55. package/dist/cjs/settings.js +1 -456
  56. package/dist/cjs/swap-venues.js +0 -17
  57. package/dist/cjs/ton-connect.js +0 -82
  58. package/dist/cjs/ton-execution.js +0 -6
  59. package/dist/cjs/ton.js +0 -42
  60. package/dist/cjs/tron-execution.js +0 -145
  61. package/dist/claims.js +0 -60
  62. package/dist/config.js +1 -211
  63. package/dist/consolidated-quote.js +0 -465
  64. package/dist/destination-calldata.js +0 -71
  65. package/dist/ecosystems.js +0 -183
  66. package/dist/execution.js +0 -92
  67. package/dist/fee-type.js +0 -2
  68. package/dist/hyperliquid-execution.js +0 -98
  69. package/dist/image-links.js +0 -108
  70. package/dist/lifi-execution-guard.js +65 -172
  71. package/dist/near-intents-conformance.js +0 -110
  72. package/dist/near-intents-route.js +0 -149
  73. package/dist/near-intents.js +0 -562
  74. package/dist/origin-deposit.js +0 -56
  75. package/dist/pre-quote.js +0 -80
  76. package/dist/prices.js +0 -113
  77. package/dist/providers.js +0 -83
  78. package/dist/quote-fees.js +0 -80
  79. package/dist/referral.js +0 -75
  80. package/dist/relay-currencies.js +0 -31
  81. package/dist/relay-depository.js +52 -77
  82. package/dist/relay-quote.js +0 -394
  83. package/dist/route-steps.js +0 -100
  84. package/dist/routing/amounts.js +0 -83
  85. package/dist/routing/candidate-route.js +0 -73
  86. package/dist/routing/candidate.js +0 -46
  87. package/dist/routing/carrier-provider-key.js +0 -27
  88. package/dist/routing/carriers/omnibridge.js +0 -120
  89. package/dist/routing/carriers/pulsex-paths.js +0 -57
  90. package/dist/routing/carriers/pulsex-split.js +0 -92
  91. package/dist/routing/carriers/pulsex.js +0 -279
  92. package/dist/routing/carriers/wrap.js +0 -57
  93. package/dist/routing/composed-route-quality.js +0 -95
  94. package/dist/routing/entry-chain-anchor.js +0 -27
  95. package/dist/routing/format.js +0 -50
  96. package/dist/routing/index.js +0 -28
  97. package/dist/routing/producers.js +0 -854
  98. package/dist/routing/providers.js +0 -27
  99. package/dist/routing/search/compose.js +0 -56
  100. package/dist/routing/search/graph.js +0 -364
  101. package/dist/routing/search/plan-route-data.js +0 -508
  102. package/dist/routing/search/score.js +0 -344
  103. package/dist/routing/swap-transactions.js +0 -74
  104. package/dist/routing/usd-value.js +0 -12
  105. package/dist/settings.js +1 -456
  106. package/dist/swap-venues.js +0 -17
  107. package/dist/ton-connect.js +0 -82
  108. package/dist/ton-execution.js +0 -6
  109. package/dist/ton.js +0 -42
  110. package/dist/tron-execution.js +0 -145
  111. package/package.json +3 -3
@@ -1,27 +1,6 @@
1
1
  import { zeroAddress } from 'viem';
2
2
  import { nativeAssetOut, nativeTokenSymbol, toChain } from '../config.js';
3
3
  import { sameAddress } from '../ecosystems.js';
4
- /**
5
- * Builds the ordered anchor list for one destination pair, cheapest and
6
- * shortest first.
7
- *
8
- * The list is ordered, not ranked: a caller asks the aggregator for the first
9
- * entry and moves to the next only on a refusal. That keeps the cost at ONE
10
- * vendor request in the ordinary case, which matters against a limit of
11
- * twelve hundred requests per sixty seconds.
12
- *
13
- * The substitution is narrow ON PURPOSE. Only the chain's wrapped native
14
- * asset gains a second anchor, because only the native coin mints the same
15
- * PulseChain token. A USD Coin pair does not gain an ether anchor here —
16
- * ether would land as bridged ether, a different token, needing a different
17
- * swap path. That is a different DESTINATION PAIR, and choosing between pairs
18
- * is made by the route engine, which holds every destination pair.
19
- *
20
- * @param options.entryChainToken - the destination pair's entry-chain side
21
- * @param options.pulsechainToken - the destination pair's PulseChain side
22
- * @param options.entryChainId - the omnibridge entry chain's decimal id
23
- * @returns the anchors to try, in order; never empty
24
- */
25
4
  export const entryChainAnchorsForPair = ({ entryChainToken, pulsechainToken, entryChainId, }) => {
26
5
  const pairAnchor = {
27
6
  token: entryChainToken,
@@ -30,9 +9,6 @@ export const entryChainAnchorsForPair = ({ entryChainToken, pulsechainToken, ent
30
9
  landsAs: pulsechainToken,
31
10
  };
32
11
  const entryChain = toChain(entryChainId);
33
- // `nativeAssetOut` is typed as a total record and is not one — `toChain` is a
34
- // cast, so an unmapped chain id yields a key that indexes to undefined. The
35
- // runtime check outlives the static type on purpose.
36
12
  const wrappedNativeAddress = nativeAssetOut[entryChain];
37
13
  if (wrappedNativeAddress === undefined ||
38
14
  !sameAddress(entryChainToken.address, wrappedNativeAddress, 'evm')) {
@@ -40,9 +16,6 @@ export const entryChainAnchorsForPair = ({ entryChainToken, pulsechainToken, ent
40
16
  }
41
17
  const nativeAnchor = {
42
18
  token: {
43
- // Decimals and name come from the WRAPPED token rather than from a
44
- // constant, because the wrapped asset mirrors its coin exactly and a
45
- // hard-coded eighteen would be a second source of the same fact.
46
19
  ...entryChainToken,
47
20
  address: zeroAddress,
48
21
  symbol: nativeTokenSymbol[entryChain] ?? entryChainToken.symbol,
@@ -1,55 +1,5 @@
1
- /**
2
- * Formats a United States dollar number to a cent-precise string ("1,234.50",
3
- * or "1.234,50" in German). No leading currency symbol — callers prepend it
4
- * where the design needs one. The single source of truth shared by the raw
5
- * producers (cent-rounding) and the display adapter (final formatting).
6
- *
7
- * `locale` defaults to `'en-US'` so every caller that does not read the
8
- * reader's own language — the raw producers, and every existing test —
9
- * keeps today's exact string. THE DISPLAY ADAPTER (`toRouteView.ts`) is the
10
- * one caller that should pass the reader's own Lingui locale (`i18n.locale`):
11
- * without it, the route strip's dollar figures stayed English-formatted
12
- * inside every other translated screen, the one number on the page that
13
- * never adopted the reader's language. The digit count never moves — only
14
- * `toLocaleString`'s grouping and decimal separators do, per
15
- * `minimumFractionDigits`/`maximumFractionDigits` staying pinned at 2.
16
- *
17
- * @param value - the United States dollar amount as a number
18
- * @param locale - a BCP 47 locale tag to format with; defaults to `'en-US'`
19
- * @returns the formatted two-decimal string, without a leading `$`
20
- */
21
1
  export const formatUsd = (value, locale = 'en-US') => value.toLocaleString(locale, { minimumFractionDigits: 2, maximumFractionDigits: 2 });
22
- /**
23
- * Nullable {@link formatUsd}: null/undefined pass through as null so an unpriced
24
- * value renders as absent rather than "0.00".
25
- *
26
- * @param value - the United States dollar amount, or null/undefined when unknown
27
- * @param locale - a BCP 47 locale tag to format with; defaults to `'en-US'`
28
- * @returns the formatted string, or null when the value is absent
29
- */
30
2
  export const formatUsdNullable = (value, locale) => value === null || value === undefined ? null : formatUsd(value, locale);
31
- /**
32
- * Rounds a United States dollar amount to whole cents.
33
- *
34
- * This replaces cent-rounding that went through the DISPLAY formatter and parsed
35
- * the result back — `Number(formatUsd(value).replace(/,/g, ''))`. That works
36
- * only while the display is pinned to a locale which groups with commas and
37
- * decimalises with a dot. The moment money follows the reader's language, a
38
- * German build formats 1234.56 as "1.234,56", and stripping the commas from THAT
39
- * yields 1.23456: a fee understated by a factor of a thousand, silently, with no
40
- * NaN anywhere to make it visible.
41
- *
42
- * It keeps its OWN formatter rather than borrowing the display one, pinned to a
43
- * fixed locale and with grouping switched off, so the string it parses has no
44
- * separators to strip and no locale to disagree with. That also makes it exact
45
- * rather than merely close: `Math.round(value * 100) / 100` looks equivalent and
46
- * is not, because it rounds the binary double while the formatter rounds the
47
- * decimal the reader typed — they disagree on 1.005, giving 1.00 against 1.01.
48
- * Matching the old behaviour to the cent is the point, so the old engine stays.
49
- *
50
- * @param value - the United States dollar amount
51
- * @returns the amount rounded to two decimal places
52
- */
53
3
  const centRounder = new Intl.NumberFormat('en-US', {
54
4
  minimumFractionDigits: 2,
55
5
  maximumFractionDigits: 2,
@@ -1,9 +1,3 @@
1
- /**
2
- * Framework-agnostic routing core for the Gibs bridge. Holds the raw numeric
3
- * primitives, the candidate shape, and candidate construction — none of which
4
- * depend on React or any display formatting. Display-coupled route builders
5
- * remain in the user interface until the raw-versus-view RouteOption split.
6
- */
7
1
  export { netDeliveredAmount, restateInDecimals, valueEquivalentAmount } from './amounts.js';
8
2
  export { omnibridgeProviderForEntryChain, pulseXConversionSwapPath } from './providers.js';
9
3
  export { buildDirectCrossingCandidate } from './candidate.js';
@@ -13,36 +7,14 @@ export { entryChainAnchorsForPair } from './entry-chain-anchor.js';
13
7
  export { usdValueOfAmount } from './usd-value.js';
14
8
  export { formatUsd, formatUsdNullable } from './format.js';
15
9
  export { BRIDGE_SETTLEMENT_ETA_MINUTES, PULSEX_MARGINAL_REFERENCE_DIVISOR, pulsechainChainId, addUsdValues, providerDisplayName, resolveEntryChainName, buildCandidateRouteData, buildConversionRouteData, buildDirectRouteData, buildPulseXSwapEstimateData, buildPulseXSwapSectionData, buildOutboundRouteData, buildSameChainSwapRouteData, candidateDeliveredUsd, candidateNetValueUsd, candidateOutsideFeesUsd, candidatePaidUsd, } from './producers.js';
16
- // The route-search engine's pure data model: node/edge shapes, path keying,
17
- // signature grouping, and the basis/rankability rules. The SEARCH ORCHESTRATION
18
- // built on top of this (`capabilities.ts`, `enumerate.ts`, `waves.ts`) now
19
- // lives in `@gibs/quotes`'s `search/` directory, carrier-agnostic — see
20
- // `docs/quote-service.md`'s "Carriers" section. This module stays here
21
- // because `search/plan-route-data.ts` (gibs's presentation layer, below)
22
- // calls its functions directly and `bridge-sdk` cannot depend on `@gibs/quotes`
23
- // (which already depends on `bridge-sdk`) without a circular package
24
- // dependency; `@gibs/quotes`'s `types.ts` re-exports the same declarations
25
- // under its `Carrier*` names.
26
10
  export { RANKABLE_ESTIMATE_BASES, assetNodeKey, combineComposedPathBasis, compareRoutePlansByDeliveredAmount, groupHopsBySignature, hopComposedBasis, hopEdgeKey, isConfirmedBasis, isRankableBasis, isRateLimitedCarrier, planComposedBasis, planIsConfirmed, planIsRankable, routePlanPathKey, } from './search/graph.js';
27
11
  export { composableHopBasis, composeRouteDelivery, hopOutputAmount, } from './search/compose.js';
28
12
  export { GAS_TOPUP_PENALTY_FLOOR_USD, GAS_TOPUP_PENALTY_PPM, SIGNATURE_PENALTY_FLOOR_USD, SIGNATURE_PENALTY_PPM, compareRoutePlansByGasAdjustedDeliveredAmount, compareRoutePlansByScoreAdjustedDeliveredAmount, gasAdjustedDeliveredAmount, scoreRoutePlan, sectionIsFundedByLanding, waitPenaltyPpm, zeroGasCostFor, } from './search/score.js';
29
13
  export { WRAP_CARRIER_ID, carrierProviderKey, carrierStepKind } from './carrier-provider-key.js';
30
- // General route search — Phase 1: plan-route-data.ts. Turns a priced
31
- // RoutePlan into the same RouteData/RouteCandidate/RouteScoreInputs shapes
32
- // today's four hand-written producers emit — see that module's head doc.
33
14
  export { buildRouteCandidateFromPlan, buildRouteDataFromPlan, buildRouteScoreInputsFromPlan, deriveDeferredCrossingFromPlan, deriveEntryChainIdFromPlan, deriveOmnibridgeProviderFromPlan, deriveViaChainIdsFromPlan, derivePlanKind, } from './search/plan-route-data.js';
34
- // The route-search maximization ENGINE — carrier registration
35
- // (`buildCapabilityIndex`), the depth-first search (`enumerateRoutes`) and
36
- // the wave-based quoting orchestrator (`searchRouteWaves`) — moved to
37
- // `@gibs/quotes`'s `search/` directory (`docs/quote-service.md`'s
38
- // "Carriers" section). Import `buildCapabilityIndex`, `enumerateRoutes`,
39
- // `searchRouteWaves` and their types from `@gibs/quotes/search`. Gibs's own
40
- // carriers (the omnibridge crossing, PulseX) live in `./carriers/`, below.
41
15
  export { createOmnibridgeCarrier, withOmnibridgeEntryFusing, } from './carriers/omnibridge.js';
42
16
  export { createPulseXCarrier, pulseXRouterForEdge, venueForEdge, pulseXSwapPathForHop, pulseXVenues, pulseXWrappedNativePath, } from './carriers/pulsex.js';
43
17
  export { bestPulseXPathQuote, candidatePulseXPaths, pulseXHubTokens } from './carriers/pulsex-paths.js';
44
18
  export { findSwapVenue, resolveSwapVenues } from '../swap-venues.js';
45
19
  export { createWrapCarrier } from './carriers/wrap.js';
46
- // The same-chain swap and wrap builders. The interface's section signing and
47
- // the SDK's execution planner (`../execution.ts`) share them.
48
20
  export { buildPulseXSwapTransaction, buildWrapTransaction, swapMinimumOut } from './swap-transactions.js';