@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.
- package/README.md +33 -0
- package/dist/abis.js +0 -2
- package/dist/bridge-limits.js +0 -38
- package/dist/chain-info.js +0 -116
- package/dist/chain-names.js +0 -151
- package/dist/chains.js +0 -198
- package/dist/cjs/abis.js +0 -2
- package/dist/cjs/bridge-limits.js +0 -38
- package/dist/cjs/chain-info.js +0 -116
- package/dist/cjs/chain-names.js +0 -151
- package/dist/cjs/chains.js +0 -198
- package/dist/cjs/claims.js +0 -60
- package/dist/cjs/config.js +1 -208
- package/dist/cjs/consolidated-quote.js +2 -464
- package/dist/cjs/destination-calldata.js +0 -71
- package/dist/cjs/ecosystems.js +0 -183
- package/dist/cjs/execution.js +0 -92
- package/dist/cjs/fee-type.js +0 -1
- package/dist/cjs/hyperliquid-execution.js +0 -98
- package/dist/cjs/image-links.js +0 -108
- package/dist/cjs/lifi-execution-guard.js +65 -172
- package/dist/cjs/near-intents-conformance.js +0 -110
- package/dist/cjs/near-intents-route.d.ts +13 -0
- package/dist/cjs/near-intents-route.js +7 -140
- package/dist/cjs/near-intents.js +0 -562
- package/dist/cjs/origin-deposit.js +0 -56
- package/dist/cjs/pre-quote.js +0 -80
- package/dist/cjs/prices.js +0 -113
- package/dist/cjs/providers.js +0 -83
- package/dist/cjs/quote-fees.js +0 -80
- package/dist/cjs/referral.js +0 -75
- package/dist/cjs/relay-currencies.js +0 -31
- package/dist/cjs/relay-depository.js +52 -77
- package/dist/cjs/relay-quote.js +0 -394
- package/dist/cjs/route-steps.js +0 -100
- package/dist/cjs/routing/amounts.js +0 -83
- package/dist/cjs/routing/candidate-route.d.ts +46 -1
- package/dist/cjs/routing/candidate-route.js +12 -40
- package/dist/cjs/routing/candidate.js +0 -46
- package/dist/cjs/routing/carrier-provider-key.js +0 -27
- package/dist/cjs/routing/carriers/omnibridge.js +0 -120
- package/dist/cjs/routing/carriers/pulsex-paths.js +0 -57
- package/dist/cjs/routing/carriers/pulsex-split.js +0 -92
- package/dist/cjs/routing/carriers/pulsex.js +0 -279
- package/dist/cjs/routing/carriers/wrap.js +0 -57
- package/dist/cjs/routing/composed-route-quality.js +0 -95
- package/dist/cjs/routing/entry-chain-anchor.js +0 -27
- package/dist/cjs/routing/format.js +0 -50
- package/dist/cjs/routing/index.d.ts +1 -1
- package/dist/cjs/routing/index.js +3 -30
- package/dist/cjs/routing/producers.js +0 -854
- package/dist/cjs/routing/providers.js +0 -27
- package/dist/cjs/routing/search/compose.js +0 -56
- package/dist/cjs/routing/search/graph.js +0 -364
- package/dist/cjs/routing/search/plan-route-data.js +5 -510
- package/dist/cjs/routing/search/score.js +0 -344
- package/dist/cjs/routing/swap-transactions.js +0 -74
- package/dist/cjs/routing/usd-value.js +0 -12
- package/dist/cjs/settings.js +1 -456
- package/dist/cjs/swap-venues.js +0 -17
- package/dist/cjs/ton-connect.js +0 -82
- package/dist/cjs/ton-execution.js +0 -6
- package/dist/cjs/ton.js +0 -42
- package/dist/cjs/tron-execution.js +0 -145
- package/dist/cjs/types.d.ts +8 -0
- package/dist/claims.js +0 -60
- package/dist/config.js +1 -211
- package/dist/consolidated-quote.js +2 -464
- package/dist/destination-calldata.js +0 -71
- package/dist/ecosystems.js +0 -183
- package/dist/execution.js +0 -92
- package/dist/fee-type.js +0 -2
- package/dist/hyperliquid-execution.js +0 -98
- package/dist/image-links.js +0 -108
- package/dist/lifi-execution-guard.js +65 -172
- package/dist/near-intents-conformance.js +0 -110
- package/dist/near-intents-route.d.ts +13 -0
- package/dist/near-intents-route.js +5 -139
- package/dist/near-intents.js +0 -562
- package/dist/origin-deposit.js +0 -56
- package/dist/pre-quote.js +0 -80
- package/dist/prices.js +0 -113
- package/dist/providers.js +0 -83
- package/dist/quote-fees.js +0 -80
- package/dist/referral.js +0 -75
- package/dist/relay-currencies.js +0 -31
- package/dist/relay-depository.js +52 -77
- package/dist/relay-quote.js +0 -394
- package/dist/route-steps.js +0 -100
- package/dist/routing/amounts.js +0 -83
- package/dist/routing/candidate-route.d.ts +46 -1
- package/dist/routing/candidate-route.js +10 -39
- package/dist/routing/candidate.js +0 -46
- package/dist/routing/carrier-provider-key.js +0 -27
- package/dist/routing/carriers/omnibridge.js +0 -120
- package/dist/routing/carriers/pulsex-paths.js +0 -57
- package/dist/routing/carriers/pulsex-split.js +0 -92
- package/dist/routing/carriers/pulsex.js +0 -279
- package/dist/routing/carriers/wrap.js +0 -57
- package/dist/routing/composed-route-quality.js +0 -95
- package/dist/routing/entry-chain-anchor.js +0 -27
- package/dist/routing/format.js +0 -50
- package/dist/routing/index.d.ts +1 -1
- package/dist/routing/index.js +1 -29
- package/dist/routing/producers.js +0 -854
- package/dist/routing/providers.js +0 -27
- package/dist/routing/search/compose.js +0 -56
- package/dist/routing/search/graph.js +0 -364
- package/dist/routing/search/plan-route-data.js +6 -511
- package/dist/routing/search/score.js +0 -344
- package/dist/routing/swap-transactions.js +0 -74
- package/dist/routing/usd-value.js +0 -12
- package/dist/settings.js +1 -456
- package/dist/swap-venues.js +0 -17
- package/dist/ton-connect.js +0 -82
- package/dist/ton-execution.js +0 -6
- package/dist/ton.js +0 -42
- package/dist/tron-execution.js +0 -145
- package/dist/types.d.ts +8 -0
- package/package.json +3 -3
package/dist/referral.js
CHANGED
|
@@ -1,80 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Referral configuration — the one place to set who gets paid.
|
|
3
|
-
*
|
|
4
|
-
* This module exists so the payout address is a single named edit rather than a
|
|
5
|
-
* constant buried among API urls. It deliberately imports nothing but a type, so
|
|
6
|
-
* the interface can read the address without pulling in a quote builder.
|
|
7
|
-
*/
|
|
8
|
-
/**
|
|
9
|
-
* Gibs Finance's own integrator identifier with LI.FI and Relay. LI.FI pays its
|
|
10
|
-
* integrator share against this string — the payout account is configured on
|
|
11
|
-
* LI.FI's side, which is why LI.FI needs no address here and Relay does.
|
|
12
|
-
*
|
|
13
|
-
* This is Gibs Finance's identity, not a setting for other consumers. The
|
|
14
|
-
* Relay API key that used to live beside it moved into the Gibs interface's
|
|
15
|
-
* own configuration (`packages/ui/src/lib/config.ts`): this package ships no
|
|
16
|
-
* key. Pass your own identifiers on each request — see the README.
|
|
17
|
-
*/
|
|
18
1
|
export const referralIntegrator = 'gibs.finance';
|
|
19
|
-
/**
|
|
20
|
-
* Resolves one attribution field (a LI.FI `integrator`, a Relay `referrer`)
|
|
21
|
-
* from a caller's override and this package's default for it.
|
|
22
|
-
*
|
|
23
|
-
* Three states, not two:
|
|
24
|
-
* - `undefined` (left out): the package default — which may itself be
|
|
25
|
-
* `undefined`, meaning the field is not sent.
|
|
26
|
-
* - `null`: the field is OMITTED from the request. Never sent as `''`: Relay
|
|
27
|
-
* reads any `referrer`, an empty one included, as "a referrer was supplied".
|
|
28
|
-
* - a string: sent as-is.
|
|
29
|
-
*
|
|
30
|
-
* @param override - the caller's value for the field
|
|
31
|
-
* @param packageDefault - the value used when the caller leaves the field out
|
|
32
|
-
* @returns the value to send, or undefined to omit the field
|
|
33
|
-
*/
|
|
34
2
|
export const resolveAttribution = (override, packageDefault) => (override === null ? undefined : (override ?? packageDefault));
|
|
35
|
-
/**
|
|
36
|
-
* Gibs Finance's payout address for Relay application fees.
|
|
37
|
-
*
|
|
38
|
-
* NO BUILDER APPLIES IT. A Relay request carries an `appFees` entry only when
|
|
39
|
-
* the caller passes `relayAppFee`. The Gibs interface passes this address
|
|
40
|
-
* explicitly; any other caller passes its own, or nothing.
|
|
41
|
-
*
|
|
42
|
-
* Set to the owner's receiving wallet. Setting it back to `null` is a working
|
|
43
|
-
* state rather than a broken one, and is the way to stop collecting: Relay
|
|
44
|
-
* rejects a fee entry that names no recipient, so the fee is omitted from the
|
|
45
|
-
* request entirely and nothing is charged. Every consumer already reads it this
|
|
46
|
-
* way — see {@link referralIsCollectable}.
|
|
47
|
-
*
|
|
48
|
-
* The literal is stored CHECKSUMMED (mixed case). That is not decoration: the
|
|
49
|
-
* mixed case IS the checksum, so a typo in the address fails `getAddress`
|
|
50
|
-
* instead of silently paying a wrong-but-valid account. Verified against viem's
|
|
51
|
-
* `getAddress` before being written here.
|
|
52
|
-
*
|
|
53
|
-
* One address serves every chain: Relay pays application fees on the DESTINATION
|
|
54
|
-
* chain, and every destination this app bridges to is Ethereum-style, so an
|
|
55
|
-
* ordinary Ethereum address receives from all of them.
|
|
56
|
-
*/
|
|
57
3
|
export const relayReferralRecipient = '0xAF2ce0189f46f5663715b0b9ED2a10eA924AB9B0';
|
|
58
|
-
/**
|
|
59
|
-
* The application fee the Gibs interface charges, in basis points. Ten basis
|
|
60
|
-
* points is one tenth of one percent. The interface can override it per
|
|
61
|
-
* provider in stored settings; this is the value a reader who has never touched
|
|
62
|
-
* the setting gets.
|
|
63
|
-
*
|
|
64
|
-
* NO BUILDER APPLIES IT. It reaches a request only when a caller passes it as
|
|
65
|
-
* `relayAppFee.basisPoints` (Relay) or converts it to `lifiFee` (LI.FI).
|
|
66
|
-
*/
|
|
67
4
|
export const defaultReferralFeeBasisPoints = 10n;
|
|
68
|
-
/**
|
|
69
|
-
* Whether a referral fee will ACTUALLY be collected, as opposed to merely being
|
|
70
|
-
* switched on.
|
|
71
|
-
*
|
|
72
|
-
* The distinction is the point of this helper. Relay's fee needs three things to
|
|
73
|
-
* be true at once, and the interface used to show a percentage whenever the
|
|
74
|
-
* first was true — so the fee row read "0.10%" while the missing recipient meant
|
|
75
|
-
* nothing was charged at all. Ask this rather than reading `enabled` alone.
|
|
76
|
-
*
|
|
77
|
-
* @param options - the switch state, the fee size, and the payout address
|
|
78
|
-
* @returns true only when a fee will reach a recipient
|
|
79
|
-
*/
|
|
80
5
|
export const referralIsCollectable = ({ enabled, basisPoints, recipient, }) => enabled && basisPoints > 0n && recipient !== null;
|
package/dist/relay-currencies.js
CHANGED
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Relay currencies endpoint. Anonymous access works at the same 50-requests-per-
|
|
3
|
-
* minute tier as the quote endpoint; used to discover the source tokens a
|
|
4
|
-
* non-Ethereum origin chain (Solana, Bitcoin) can bridge from.
|
|
5
|
-
*/
|
|
6
1
|
export const relayCurrenciesUrl = 'https://api.relay.link/currencies/v2';
|
|
7
|
-
/**
|
|
8
|
-
* Builds the Relay currencies request body.
|
|
9
|
-
*
|
|
10
|
-
* @returns the request body, or null when no chain ids are supplied
|
|
11
|
-
*/
|
|
12
2
|
export const buildRelayCurrenciesRequest = ({ chainIds, limit, }) => {
|
|
13
3
|
if (chainIds.length === 0) {
|
|
14
4
|
return null;
|
|
@@ -21,20 +11,7 @@ const asRecord = (value) => {
|
|
|
21
11
|
}
|
|
22
12
|
return value;
|
|
23
13
|
};
|
|
24
|
-
/**
|
|
25
|
-
* Relay's own chain registry — the provider's word on which chains it
|
|
26
|
-
* supports AT ALL, distinct from `/currencies/v2` (which chains currently
|
|
27
|
-
* have priced currencies). A chain absent here can never be asked about, on
|
|
28
|
-
* `/currencies/v2` or `/quote` alike; see `parseRelayChains`.
|
|
29
|
-
*/
|
|
30
14
|
export const relayChainsUrl = 'https://api.relay.link/chains';
|
|
31
|
-
/**
|
|
32
|
-
* Normalizes a `GET /chains` response body to the chain ids Relay lists.
|
|
33
|
-
* Mirrors `parseLifiChains` (`consolidated-quote.ts`) for LI.FI's own chain
|
|
34
|
-
* list: read the provider's own registry, never a hand-written exclusion.
|
|
35
|
-
*
|
|
36
|
-
* @returns the chain ids Relay lists, or null when the payload shape is unexpected
|
|
37
|
-
*/
|
|
38
15
|
export const parseRelayChains = (payload) => {
|
|
39
16
|
const body = asRecord(payload);
|
|
40
17
|
if (body === null || !Array.isArray(body.chains)) {
|
|
@@ -49,14 +26,6 @@ export const parseRelayChains = (payload) => {
|
|
|
49
26
|
}
|
|
50
27
|
return ids;
|
|
51
28
|
};
|
|
52
|
-
/**
|
|
53
|
-
* Maps Relay's flat `/currencies/v2` array onto the shared `Token` shape. A
|
|
54
|
-
* Relay currency's `address` is already a string (a Solana mint or a Bitcoin
|
|
55
|
-
* native address), so no widening is needed. Malformed entries are skipped
|
|
56
|
-
* rather than failing the whole list.
|
|
57
|
-
*
|
|
58
|
-
* @returns the tokens, or an empty list when the payload is not an array
|
|
59
|
-
*/
|
|
60
29
|
export const parseRelayCurrencies = (payload) => {
|
|
61
30
|
if (!Array.isArray(payload)) {
|
|
62
31
|
return [];
|
package/dist/relay-depository.js
CHANGED
|
@@ -1,82 +1,57 @@
|
|
|
1
1
|
import { getAddress } from 'viem';
|
|
2
|
-
/**
|
|
3
|
-
* Relay's deposit contract (its "depository") on each Ethereum-style chain:
|
|
4
|
-
* the ONLY address a Relay origin deposit may be sent to, and the only
|
|
5
|
-
* address it may ask the reader to approve.
|
|
6
|
-
*
|
|
7
|
-
* WHY A FIXED TABLE. A quote that names its own spender cannot be trusted to
|
|
8
|
-
* name an honest one: a compromised quote host could name any contract. This
|
|
9
|
-
* table ships with the code and changes only through a release.
|
|
10
|
-
*
|
|
11
|
-
* SOURCE. Relay's Chains API, `GET https://api.relay.link/chains`, field
|
|
12
|
-
* `chains[].protocol.v2.depository`, read 2026-10-07 for every chain whose
|
|
13
|
-
* `vmType` is `evm`. Relay's documentation says its depository addresses are
|
|
14
|
-
* published only through that API
|
|
15
|
-
* (https://docs.relay.link/references/protocol/addresses). A live quote the
|
|
16
|
-
* same day (Ethereum USDC to Base, `POST /quote/v2`) approved and deposited to
|
|
17
|
-
* exactly the Ethereum entry below.
|
|
18
|
-
*
|
|
19
|
-
* NOT THE `contracts` BLOCK. The same API also lists `relayReceiver`,
|
|
20
|
-
* `approvalProxy` and `erc20Router` under `chains[].contracts`. The live
|
|
21
|
-
* quote used none of them, so they are left out: an address the quote does
|
|
22
|
-
* not use is not one this table should accept.
|
|
23
|
-
*
|
|
24
|
-
* A CHAIN NOT LISTED IS REFUSED. If Relay adds a chain or moves a depository,
|
|
25
|
-
* deposits there are refused until this table is updated.
|
|
26
|
-
*/
|
|
27
2
|
const common = getAddress('0x4cd00e387622c35bddb9b4c962c136462338bc31');
|
|
28
3
|
const alternate = getAddress('0x59916da825d2d2ec1bf878d71c88826f6633ecca');
|
|
29
4
|
export const relayDepositoryByChainId = new Map([
|
|
30
|
-
[1, common],
|
|
31
|
-
[10, common],
|
|
32
|
-
[25, alternate],
|
|
33
|
-
[56, common],
|
|
34
|
-
[100, common],
|
|
35
|
-
[130, common],
|
|
36
|
-
[137, common],
|
|
37
|
-
[143, common],
|
|
38
|
-
[146, common],
|
|
39
|
-
[169, common],
|
|
40
|
-
[196, common],
|
|
41
|
-
[288, common],
|
|
42
|
-
[324, common],
|
|
43
|
-
[360, common],
|
|
44
|
-
[480, common],
|
|
45
|
-
[747, common],
|
|
46
|
-
[988, common],
|
|
47
|
-
[999, common],
|
|
48
|
-
[1088, alternate],
|
|
49
|
-
[1135, common],
|
|
50
|
-
[1868, common],
|
|
51
|
-
[2020, common],
|
|
52
|
-
[2741, common],
|
|
53
|
-
[2818, common],
|
|
54
|
-
[4217, common],
|
|
55
|
-
[4326, common],
|
|
56
|
-
[4663, common],
|
|
57
|
-
[5000, alternate],
|
|
58
|
-
[5031, common],
|
|
59
|
-
[5042, common],
|
|
60
|
-
[5330, common],
|
|
61
|
-
[8453, common],
|
|
62
|
-
[9745, common],
|
|
63
|
-
[33139, common],
|
|
64
|
-
[34443, common],
|
|
65
|
-
[42018, common],
|
|
66
|
-
[42161, common],
|
|
67
|
-
[42220, common],
|
|
68
|
-
[43114, common],
|
|
69
|
-
[48900, common],
|
|
70
|
-
[57073, common],
|
|
71
|
-
[59144, alternate],
|
|
72
|
-
[60808, common],
|
|
73
|
-
[80094, common],
|
|
74
|
-
[81457, common],
|
|
75
|
-
[97477, common],
|
|
76
|
-
[98866, common],
|
|
77
|
-
[534352, common],
|
|
78
|
-
[685689, common],
|
|
79
|
-
[747474, common],
|
|
80
|
-
[5064014, common],
|
|
81
|
-
[7777777, common],
|
|
5
|
+
[1, common],
|
|
6
|
+
[10, common],
|
|
7
|
+
[25, alternate],
|
|
8
|
+
[56, common],
|
|
9
|
+
[100, common],
|
|
10
|
+
[130, common],
|
|
11
|
+
[137, common],
|
|
12
|
+
[143, common],
|
|
13
|
+
[146, common],
|
|
14
|
+
[169, common],
|
|
15
|
+
[196, common],
|
|
16
|
+
[288, common],
|
|
17
|
+
[324, common],
|
|
18
|
+
[360, common],
|
|
19
|
+
[480, common],
|
|
20
|
+
[747, common],
|
|
21
|
+
[988, common],
|
|
22
|
+
[999, common],
|
|
23
|
+
[1088, alternate],
|
|
24
|
+
[1135, common],
|
|
25
|
+
[1868, common],
|
|
26
|
+
[2020, common],
|
|
27
|
+
[2741, common],
|
|
28
|
+
[2818, common],
|
|
29
|
+
[4217, common],
|
|
30
|
+
[4326, common],
|
|
31
|
+
[4663, common],
|
|
32
|
+
[5000, alternate],
|
|
33
|
+
[5031, common],
|
|
34
|
+
[5042, common],
|
|
35
|
+
[5330, common],
|
|
36
|
+
[8453, common],
|
|
37
|
+
[9745, common],
|
|
38
|
+
[33139, common],
|
|
39
|
+
[34443, common],
|
|
40
|
+
[42018, common],
|
|
41
|
+
[42161, common],
|
|
42
|
+
[42220, common],
|
|
43
|
+
[43114, common],
|
|
44
|
+
[48900, common],
|
|
45
|
+
[57073, common],
|
|
46
|
+
[59144, alternate],
|
|
47
|
+
[60808, common],
|
|
48
|
+
[80094, common],
|
|
49
|
+
[81457, common],
|
|
50
|
+
[97477, common],
|
|
51
|
+
[98866, common],
|
|
52
|
+
[534352, common],
|
|
53
|
+
[685689, common],
|
|
54
|
+
[747474, common],
|
|
55
|
+
[5064014, common],
|
|
56
|
+
[7777777, common],
|
|
82
57
|
]);
|