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