@gibs/bridge-sdk 1.13.1 → 1.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +244 -18
- package/abis/package.json +6 -0
- package/bridge-limits/package.json +6 -0
- package/chain-info/package.json +6 -0
- package/chain-names/package.json +6 -0
- package/chains/package.json +6 -0
- package/claims/package.json +6 -0
- package/config/package.json +6 -0
- package/consolidated-quote/package.json +6 -0
- package/destination-calldata/package.json +6 -0
- package/dist/chain-info.d.ts +1 -1
- package/dist/chain-info.js +11 -12
- package/dist/chains.d.ts +25 -0
- package/dist/chains.js +55 -20
- package/dist/cjs/abis.d.ts +1 -0
- package/dist/cjs/abis.js +19 -0
- package/dist/cjs/bridge-limits.d.ts +103 -0
- package/dist/cjs/bridge-limits.js +89 -0
- package/dist/cjs/chain-info.d.ts +169 -0
- package/dist/cjs/chain-info.js +452 -0
- package/dist/cjs/chain-names.d.ts +160 -0
- package/dist/cjs/chain-names.js +207 -0
- package/dist/cjs/chains.d.ts +90 -0
- package/dist/cjs/chains.js +357 -0
- package/dist/cjs/claims.d.ts +198 -0
- package/dist/cjs/claims.js +182 -0
- package/dist/cjs/config.d.ts +240 -0
- package/dist/cjs/config.js +537 -0
- package/dist/cjs/consolidated-quote.d.ts +648 -0
- package/dist/cjs/consolidated-quote.js +1048 -0
- package/dist/cjs/destination-calldata.d.ts +118 -0
- package/dist/cjs/destination-calldata.js +156 -0
- package/dist/cjs/ecosystems.d.ts +217 -0
- package/dist/cjs/ecosystems.js +298 -0
- package/dist/cjs/execution.d.ts +346 -0
- package/dist/cjs/execution.js +468 -0
- package/dist/cjs/fee-type.d.ts +10 -0
- package/dist/cjs/fee-type.js +10 -0
- package/dist/cjs/hyperliquid-execution.d.ts +152 -0
- package/dist/cjs/hyperliquid-execution.js +175 -0
- package/dist/cjs/image-links.d.ts +117 -0
- package/dist/cjs/image-links.js +153 -0
- package/dist/cjs/index.d.ts +23 -0
- package/dist/cjs/index.js +39 -0
- package/dist/cjs/lifi-execution-guard.d.ts +210 -0
- package/dist/cjs/lifi-execution-guard.js +409 -0
- package/dist/cjs/near-intents-conformance.d.ts +85 -0
- package/dist/cjs/near-intents-conformance.js +337 -0
- package/dist/cjs/near-intents-route.d.ts +47 -0
- package/dist/cjs/near-intents-route.js +303 -0
- package/dist/cjs/near-intents.d.ts +524 -0
- package/dist/cjs/near-intents.js +1071 -0
- package/dist/cjs/origin-deposit.d.ts +326 -0
- package/dist/cjs/origin-deposit.js +82 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/pre-quote.d.ts +198 -0
- package/dist/cjs/pre-quote.js +180 -0
- package/dist/cjs/prices.d.ts +107 -0
- package/dist/cjs/prices.js +172 -0
- package/dist/cjs/providers.d.ts +238 -0
- package/dist/cjs/providers.js +171 -0
- package/dist/cjs/quote-fees.d.ts +102 -0
- package/dist/cjs/quote-fees.js +201 -0
- package/dist/cjs/referral.d.ts +85 -0
- package/dist/cjs/referral.js +85 -0
- package/dist/cjs/relay-currencies.d.ts +47 -0
- package/dist/cjs/relay-currencies.js +95 -0
- package/dist/cjs/relay-depository.d.ts +2 -0
- package/dist/cjs/relay-depository.js +85 -0
- package/dist/cjs/relay-quote.d.ts +301 -0
- package/dist/cjs/relay-quote.js +996 -0
- package/dist/cjs/route-steps.d.ts +138 -0
- package/dist/cjs/route-steps.js +310 -0
- package/dist/cjs/routing/amounts.d.ts +80 -0
- package/dist/cjs/routing/amounts.js +126 -0
- package/dist/cjs/routing/candidate-route.d.ts +43 -0
- package/dist/cjs/routing/candidate-route.js +50 -0
- package/dist/cjs/routing/candidate.d.ts +237 -0
- package/dist/cjs/routing/candidate.js +100 -0
- package/dist/cjs/routing/carriers/ask-answer.d.ts +77 -0
- package/dist/cjs/routing/carriers/ask-answer.js +2 -0
- package/dist/cjs/routing/carriers/omnibridge.d.ts +137 -0
- package/dist/cjs/routing/carriers/omnibridge.js +459 -0
- package/dist/cjs/routing/carriers/pulsex-paths.d.ts +80 -0
- package/dist/cjs/routing/carriers/pulsex-paths.js +97 -0
- package/dist/cjs/routing/carriers/pulsex-split.d.ts +175 -0
- package/dist/cjs/routing/carriers/pulsex-split.js +193 -0
- package/dist/cjs/routing/carriers/pulsex.d.ts +159 -0
- package/dist/cjs/routing/carriers/pulsex.js +565 -0
- package/dist/cjs/routing/carriers/wrap.d.ts +25 -0
- package/dist/cjs/routing/carriers/wrap.js +119 -0
- package/dist/cjs/routing/composed-route-quality.d.ts +125 -0
- package/dist/cjs/routing/composed-route-quality.js +144 -0
- package/dist/cjs/routing/entry-chain-anchor.d.ts +88 -0
- package/dist/cjs/routing/entry-chain-anchor.js +59 -0
- package/dist/cjs/routing/format.d.ts +31 -0
- package/dist/cjs/routing/format.js +64 -0
- package/dist/cjs/routing/index.d.ts +38 -0
- package/dist/cjs/routing/index.js +134 -0
- package/dist/cjs/routing/producers.d.ts +770 -0
- package/dist/cjs/routing/producers.js +1617 -0
- package/dist/cjs/routing/providers.d.ts +31 -0
- package/dist/cjs/routing/providers.js +48 -0
- package/dist/cjs/routing/route-data.d.ts +355 -0
- package/dist/cjs/routing/route-data.js +2 -0
- package/dist/cjs/routing/search/compose.d.ts +168 -0
- package/dist/cjs/routing/search/compose.js +104 -0
- package/dist/cjs/routing/search/graph.d.ts +668 -0
- package/dist/cjs/routing/search/graph.js +461 -0
- package/dist/cjs/routing/search/plan-route-data.d.ts +269 -0
- package/dist/cjs/routing/search/plan-route-data.js +848 -0
- package/dist/cjs/routing/search/score.d.ts +356 -0
- package/dist/cjs/routing/search/score.js +445 -0
- package/dist/cjs/routing/swap-transactions.d.ts +91 -0
- package/dist/cjs/routing/swap-transactions.js +131 -0
- package/dist/cjs/routing/usd-value.d.ts +17 -0
- package/dist/cjs/routing/usd-value.js +29 -0
- package/dist/cjs/settings.d.ts +785 -0
- package/dist/cjs/settings.js +1074 -0
- package/dist/cjs/ton-connect.d.ts +98 -0
- package/dist/cjs/ton-connect.js +206 -0
- package/dist/cjs/ton-execution.d.ts +7 -0
- package/dist/cjs/ton-execution.js +23 -0
- package/dist/cjs/ton.d.ts +37 -0
- package/dist/cjs/ton.js +83 -0
- package/dist/cjs/tron-execution.d.ts +146 -0
- package/dist/cjs/tron-execution.js +248 -0
- package/dist/cjs/types.d.ts +51 -0
- package/dist/cjs/types.js +2 -0
- package/dist/claims.d.ts +198 -0
- package/dist/claims.js +140 -0
- package/dist/config.d.ts +24 -0
- package/dist/config.js +39 -5
- package/dist/consolidated-quote.d.ts +109 -15
- package/dist/consolidated-quote.js +310 -52
- package/dist/execution.d.ts +346 -0
- package/dist/execution.js +428 -0
- package/dist/hyperliquid-execution.js +2 -3
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/lifi-execution-guard.d.ts +13 -2
- package/dist/lifi-execution-guard.js +4 -0
- package/dist/near-intents.js +2 -3
- package/dist/pre-quote.d.ts +6 -6
- package/dist/pre-quote.js +10 -14
- package/dist/providers.d.ts +17 -0
- package/dist/providers.js +6 -0
- package/dist/referral.d.ts +12 -4
- package/dist/referral.js +12 -4
- package/dist/relay-depository.d.ts +2 -0
- package/dist/relay-depository.js +82 -0
- package/dist/relay-quote.js +2 -3
- package/dist/routing/candidate.d.ts +3 -3
- package/dist/routing/candidate.js +3 -3
- package/dist/routing/carriers/ask-answer.d.ts +17 -0
- package/dist/routing/carriers/omnibridge.js +23 -21
- package/dist/routing/carriers/pulsex-paths.d.ts +80 -0
- package/dist/routing/carriers/pulsex-paths.js +92 -0
- package/dist/routing/carriers/pulsex-split.d.ts +175 -0
- package/dist/routing/carriers/pulsex-split.js +185 -0
- package/dist/routing/carriers/pulsex.d.ts +31 -21
- package/dist/routing/carriers/pulsex.js +141 -71
- package/dist/routing/composed-route-quality.d.ts +28 -6
- package/dist/routing/composed-route-quality.js +36 -5
- package/dist/routing/entry-chain-anchor.d.ts +1 -1
- package/dist/routing/entry-chain-anchor.js +1 -1
- package/dist/routing/index.d.ts +6 -2
- package/dist/routing/index.js +6 -2
- package/dist/routing/producers.js +1 -1
- package/dist/routing/providers.d.ts +5 -0
- package/dist/routing/providers.js +5 -0
- package/dist/routing/search/graph.d.ts +15 -0
- package/dist/routing/search/plan-route-data.d.ts +25 -0
- package/dist/routing/search/plan-route-data.js +43 -7
- package/dist/routing/search/score.d.ts +3 -0
- package/dist/routing/search/score.js +11 -3
- package/dist/routing/swap-transactions.d.ts +91 -0
- package/dist/routing/swap-transactions.js +125 -0
- package/dist/settings.d.ts +94 -1
- package/dist/settings.js +95 -3
- package/dist/ton-connect.d.ts +98 -0
- package/dist/ton-connect.js +200 -0
- package/dist/ton-execution.d.ts +4 -114
- package/dist/ton-execution.js +4 -244
- package/dist/ton.d.ts +37 -0
- package/dist/ton.js +65 -0
- package/docs/examples/example-a-ether-to-pulse.ts +300 -0
- package/docs/examples/example-b-token-pulsechain-to-ethereum.ts +270 -0
- package/docs/examples/shared.ts +261 -0
- package/docs/examples/tsconfig.json +18 -0
- package/docs/integration-guide.md +617 -0
- package/ecosystems/package.json +6 -0
- package/execution/package.json +6 -0
- package/fee-type/package.json +6 -0
- package/hyperliquid-execution/package.json +6 -0
- package/image-links/package.json +6 -0
- package/lifi-execution-guard/package.json +6 -0
- package/llms.txt +75 -10
- package/near-intents/package.json +6 -0
- package/near-intents-route/package.json +6 -0
- package/origin-deposit/package.json +6 -0
- package/package.json +817 -10
- package/pre-quote/package.json +6 -0
- package/prices/package.json +6 -0
- package/providers/package.json +6 -0
- package/quote-fees/package.json +6 -0
- package/referral/package.json +6 -0
- package/relay-currencies/package.json +6 -0
- package/relay-quote/package.json +6 -0
- package/route-steps/package.json +6 -0
- package/routing/package.json +6 -0
- package/settings/package.json +6 -0
- package/ton/package.json +6 -0
- package/ton-connect/package.json +6 -0
- package/ton-execution/package.json +6 -0
- package/tron-execution/package.json +6 -0
- package/types/package.json +6 -0
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { PlannedTx } from './execution.js';
|
|
3
|
+
/**
|
|
4
|
+
* MANUAL CLAIMS. A home-to-foreign crossing (PulseChain to Ethereum, for
|
|
5
|
+
* example) ends with a release on the destination chain. When nobody delivers
|
|
6
|
+
* it, the reader claims it by hand: they send the validators' signatures and
|
|
7
|
+
* the encoded message to the destination bridge. This module builds that
|
|
8
|
+
* transaction from the bridge indexer's `UserRequest` record.
|
|
9
|
+
*
|
|
10
|
+
* THE INDEXER ASSUMPTION. The indexer collects the signatures in
|
|
11
|
+
* `handleSignedFor` (`packages/indexer/src/index.ts`, the handler for
|
|
12
|
+
* `HomeAMB:SignedForUserRequest` and `HomeAMB:SignedForAffirmation`). It does
|
|
13
|
+
* not read the signature from the event. It decodes the TRANSACTION's own
|
|
14
|
+
* input as `submitSignature(bytes signature, bytes message)`. That works only
|
|
15
|
+
* when a validator sends `submitSignature` straight to the home bridge from
|
|
16
|
+
* its own account.
|
|
17
|
+
*
|
|
18
|
+
* When a validator signs some other way (through a multisig wallet, a proxy,
|
|
19
|
+
* a batching contract, or any call whose top-level input is not
|
|
20
|
+
* `submitSignature`), the decode fails and the handler drops that signature.
|
|
21
|
+
* It still counts it: `confirmedSignatures` goes up by one, but `signatures`
|
|
22
|
+
* stays one short. `finishedSigning` does NOT stay false. The separate
|
|
23
|
+
* `HomeAMB:CollectedSignatures` event sets it to true regardless. So the
|
|
24
|
+
* record says "signed" while it holds too few signatures, and a claim built
|
|
25
|
+
* from it reverts on the destination bridge, which checks the count against
|
|
26
|
+
* its required-signature threshold. {@link buildClaimTransaction} refuses
|
|
27
|
+
* that record with `signatures-incomplete` rather than build a claim that
|
|
28
|
+
* cannot succeed.
|
|
29
|
+
*/
|
|
30
|
+
/** A signature split into the three parts the destination bridge reads, each as hex without a `0x` prefix. */
|
|
31
|
+
export type SignatureParts = {
|
|
32
|
+
readonly v: string;
|
|
33
|
+
readonly r: string;
|
|
34
|
+
readonly s: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Splits one 65-byte validator signature into its `v`, `r` and `s` parts.
|
|
38
|
+
*
|
|
39
|
+
* @param rawSignature - the signature as the indexer stores it, with or without a `0x` prefix
|
|
40
|
+
* @returns the three parts, hex without prefixes
|
|
41
|
+
*/
|
|
42
|
+
export declare const signatureToVRS: (rawSignature: string) => SignatureParts;
|
|
43
|
+
/**
|
|
44
|
+
* Packs signatures in the layout the bridge's `executeSignatures` reads: one
|
|
45
|
+
* count byte, then every `v`, then every `r`, then every `s`.
|
|
46
|
+
*
|
|
47
|
+
* @param signatures - the split signatures, in the order the validators signed
|
|
48
|
+
* @returns the packed signatures as one hex string
|
|
49
|
+
*/
|
|
50
|
+
export declare const packSignatures: (signatures: readonly SignatureParts[]) => Hex;
|
|
51
|
+
/**
|
|
52
|
+
* The calldata for a release that pays no delivery tip: a direct call to the
|
|
53
|
+
* destination bridge.
|
|
54
|
+
*
|
|
55
|
+
* @param options.encodedData - the bridge message, `UserRequest.encodedData`
|
|
56
|
+
* @param options.encodedSignatures - the output of {@link packSignatures}
|
|
57
|
+
* @returns the calldata for `safeExecuteSignaturesWithAutoGasLimit`
|
|
58
|
+
*/
|
|
59
|
+
export declare const encodeReleaseWithoutTipData: ({ encodedData, encodedSignatures, }: {
|
|
60
|
+
encodedData: Hex;
|
|
61
|
+
encodedSignatures: Hex;
|
|
62
|
+
}) => Hex;
|
|
63
|
+
/**
|
|
64
|
+
* The calldata for a release sent through the pathway's destination output
|
|
65
|
+
* router, the path a fee-director (delivery) request uses.
|
|
66
|
+
*
|
|
67
|
+
* @param options.validator - the pathway's validator contract
|
|
68
|
+
* @param options.encodedData - the bridge message, `UserRequest.encodedData`
|
|
69
|
+
* @param options.encodedSignatures - the output of {@link packSignatures}
|
|
70
|
+
* @returns the calldata for the router's `safeExecuteSignaturesWithAutoGasLimit`
|
|
71
|
+
*/
|
|
72
|
+
export declare const encodeReleaseToRouterData: ({ validator, encodedData, encodedSignatures, }: {
|
|
73
|
+
validator: Hex;
|
|
74
|
+
encodedData: Hex;
|
|
75
|
+
encodedSignatures: Hex;
|
|
76
|
+
}) => Hex;
|
|
77
|
+
/**
|
|
78
|
+
* Where a claim is sent.
|
|
79
|
+
*
|
|
80
|
+
* - `direct` sends it to the destination bridge and pays no delivery tip.
|
|
81
|
+
* - `router` sends it through the pathway's destination output router, which
|
|
82
|
+
* pays the tip a fee-director request carries. Read both addresses from the
|
|
83
|
+
* pathway (`pathway(bridgeKey)`'s `destinationRouter` and `validator`).
|
|
84
|
+
*/
|
|
85
|
+
export type ClaimRoute = {
|
|
86
|
+
readonly kind: 'direct';
|
|
87
|
+
} | {
|
|
88
|
+
readonly kind: 'router';
|
|
89
|
+
readonly destinationRouter: Hex;
|
|
90
|
+
readonly validator: Hex;
|
|
91
|
+
};
|
|
92
|
+
/**
|
|
93
|
+
* The one place a claim's target and calldata come from. The interface's
|
|
94
|
+
* release hook and {@link buildClaimTransaction} both call it.
|
|
95
|
+
*
|
|
96
|
+
* @param options.encodedData - the bridge message
|
|
97
|
+
* @param options.signatures - the raw validator signatures, in signing order
|
|
98
|
+
* @param options.destinationAmbAddress - the destination bridge, used by the `direct` route
|
|
99
|
+
* @param options.via - which contract receives the claim
|
|
100
|
+
* @returns the target contract and the calldata
|
|
101
|
+
*/
|
|
102
|
+
export declare const claimCall: ({ encodedData, signatures, destinationAmbAddress, via, }: {
|
|
103
|
+
readonly encodedData: Hex;
|
|
104
|
+
readonly signatures: readonly string[];
|
|
105
|
+
readonly destinationAmbAddress: Hex;
|
|
106
|
+
readonly via: ClaimRoute;
|
|
107
|
+
}) => {
|
|
108
|
+
readonly to: Hex;
|
|
109
|
+
readonly data: Hex;
|
|
110
|
+
};
|
|
111
|
+
/**
|
|
112
|
+
* The bridge indexer's `UserRequest` fields a claim reads. The names match the
|
|
113
|
+
* indexer's GraphQL type, so a caller passes the record it fetched as it is.
|
|
114
|
+
* The indexer sends its big-integer scalars as decimal strings, so the counts
|
|
115
|
+
* and the chain id accept a string as well.
|
|
116
|
+
*/
|
|
117
|
+
export type ClaimableUserRequest = {
|
|
118
|
+
/** `'signature'` for a home-to-foreign request. Only those are claimed by hand. */
|
|
119
|
+
readonly type: string;
|
|
120
|
+
readonly encodedData: string;
|
|
121
|
+
/** The JSON list of raw validator signatures, or null on a request type that collects none. */
|
|
122
|
+
readonly signatures?: unknown;
|
|
123
|
+
/** How many `SignedFor` events the indexer counted for this request. */
|
|
124
|
+
readonly confirmedSignatures: bigint | number | string;
|
|
125
|
+
/**
|
|
126
|
+
* The bridge's required-signature threshold in force for this request, as
|
|
127
|
+
* the indexer links it. When absent, the builder demands every counted
|
|
128
|
+
* signature, which is stricter than the bridge.
|
|
129
|
+
*/
|
|
130
|
+
readonly requiredSignatures?: {
|
|
131
|
+
readonly value: bigint | number | string;
|
|
132
|
+
} | null;
|
|
133
|
+
readonly destinationAmbAddress: string;
|
|
134
|
+
readonly destinationChainId: bigint | number | string;
|
|
135
|
+
/** True once the indexer saw `CollectedSignatures` (or the delivery itself). */
|
|
136
|
+
readonly finishedSigning: boolean;
|
|
137
|
+
/** True once the release executed on the destination chain. */
|
|
138
|
+
readonly delivered: boolean;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Why a request cannot be claimed. Each case names a different action for the
|
|
142
|
+
* reader:
|
|
143
|
+
*
|
|
144
|
+
* - `wrong-type` — not a signature request. An affirmation request is
|
|
145
|
+
* executed by the validators themselves; there is nothing to claim.
|
|
146
|
+
* - `already-delivered` — the release already executed. A claim would revert.
|
|
147
|
+
* - `not-signed-yet` — the validators have not finished signing. Wait.
|
|
148
|
+
* - `signatures-incomplete` — the indexer stored fewer signatures than the
|
|
149
|
+
* bridge needs (the threshold, or every counted signature when the request
|
|
150
|
+
* carries no threshold). See this module's note on the `submitSignature`
|
|
151
|
+
* assumption. Waiting does not fix this one.
|
|
152
|
+
* - `malformed-request` — a field is not the shape the indexer documents.
|
|
153
|
+
*/
|
|
154
|
+
export type ClaimRefusal = {
|
|
155
|
+
readonly reason: 'wrong-type';
|
|
156
|
+
readonly type: string;
|
|
157
|
+
} | {
|
|
158
|
+
readonly reason: 'already-delivered';
|
|
159
|
+
} | {
|
|
160
|
+
readonly reason: 'not-signed-yet';
|
|
161
|
+
} | {
|
|
162
|
+
readonly reason: 'signatures-incomplete';
|
|
163
|
+
readonly stored: number;
|
|
164
|
+
readonly needed: number;
|
|
165
|
+
} | {
|
|
166
|
+
readonly reason: 'malformed-request';
|
|
167
|
+
readonly field: string;
|
|
168
|
+
};
|
|
169
|
+
/** A claim transaction, or the typed reason none can be built. */
|
|
170
|
+
export type ClaimPlan = {
|
|
171
|
+
readonly kind: 'claim';
|
|
172
|
+
readonly transaction: PlannedTx;
|
|
173
|
+
} | {
|
|
174
|
+
readonly kind: 'refused';
|
|
175
|
+
readonly refusal: ClaimRefusal;
|
|
176
|
+
};
|
|
177
|
+
/**
|
|
178
|
+
* Builds the manual-claim transaction for one bridge request, or refuses with
|
|
179
|
+
* a typed reason.
|
|
180
|
+
*
|
|
181
|
+
* The checks run in this order: request type, delivery, signing, then the
|
|
182
|
+
* stored signature count. A delivered request is refused before the signing
|
|
183
|
+
* check, because delivery also sets `finishedSigning`.
|
|
184
|
+
*
|
|
185
|
+
* ASSUMPTION: the signatures are only complete when every validator sent
|
|
186
|
+
* `submitSignature` directly to the home bridge. The indexer drops a
|
|
187
|
+
* signature sent any other way; see this module's head note. This builder
|
|
188
|
+
* catches the drop by comparing the stored list with the required-signature
|
|
189
|
+
* threshold, or with `confirmedSignatures` when the record carries no threshold.
|
|
190
|
+
*
|
|
191
|
+
* @param options.request - the indexer's `UserRequest` record
|
|
192
|
+
* @param options.via - the claim target; see {@link ClaimRoute}
|
|
193
|
+
* @returns a `claim` plan whose transaction runs on the destination chain, or a refusal
|
|
194
|
+
*/
|
|
195
|
+
export declare const buildClaimTransaction: ({ request, via, }: {
|
|
196
|
+
readonly request: ClaimableUserRequest;
|
|
197
|
+
readonly via: ClaimRoute;
|
|
198
|
+
}) => ClaimPlan;
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.buildClaimTransaction = exports.claimCall = exports.encodeReleaseToRouterData = exports.encodeReleaseWithoutTipData = exports.packSignatures = exports.signatureToVRS = void 0;
|
|
37
|
+
const viem_1 = require("viem");
|
|
38
|
+
const abis = __importStar(require("./abis.js"));
|
|
39
|
+
const strip0x = (input) => input.replace(/^0x/, '');
|
|
40
|
+
/**
|
|
41
|
+
* Splits one 65-byte validator signature into its `v`, `r` and `s` parts.
|
|
42
|
+
*
|
|
43
|
+
* @param rawSignature - the signature as the indexer stores it, with or without a `0x` prefix
|
|
44
|
+
* @returns the three parts, hex without prefixes
|
|
45
|
+
*/
|
|
46
|
+
const signatureToVRS = (rawSignature) => {
|
|
47
|
+
const signature = strip0x(rawSignature);
|
|
48
|
+
const word = 32;
|
|
49
|
+
const word2 = word * 2;
|
|
50
|
+
const word4 = word2 * 2;
|
|
51
|
+
const r = signature.slice(0, word2);
|
|
52
|
+
const s = signature.slice(word2, word4);
|
|
53
|
+
const v = signature.slice(word4);
|
|
54
|
+
return { v, r, s };
|
|
55
|
+
};
|
|
56
|
+
exports.signatureToVRS = signatureToVRS;
|
|
57
|
+
/**
|
|
58
|
+
* Packs signatures in the layout the bridge's `executeSignatures` reads: one
|
|
59
|
+
* count byte, then every `v`, then every `r`, then every `s`.
|
|
60
|
+
*
|
|
61
|
+
* @param signatures - the split signatures, in the order the validators signed
|
|
62
|
+
* @returns the packed signatures as one hex string
|
|
63
|
+
*/
|
|
64
|
+
const packSignatures = (signatures) => {
|
|
65
|
+
const length = strip0x((0, viem_1.numberToHex)(signatures.length));
|
|
66
|
+
const countByte = length.length === 1 ? `0${length}` : length;
|
|
67
|
+
const v = signatures.map((signature) => signature.v).join('');
|
|
68
|
+
const r = signatures.map((signature) => signature.r).join('');
|
|
69
|
+
const s = signatures.map((signature) => signature.s).join('');
|
|
70
|
+
return `0x${countByte}${v}${r}${s}`;
|
|
71
|
+
};
|
|
72
|
+
exports.packSignatures = packSignatures;
|
|
73
|
+
/**
|
|
74
|
+
* The calldata for a release that pays no delivery tip: a direct call to the
|
|
75
|
+
* destination bridge.
|
|
76
|
+
*
|
|
77
|
+
* @param options.encodedData - the bridge message, `UserRequest.encodedData`
|
|
78
|
+
* @param options.encodedSignatures - the output of {@link packSignatures}
|
|
79
|
+
* @returns the calldata for `safeExecuteSignaturesWithAutoGasLimit`
|
|
80
|
+
*/
|
|
81
|
+
const encodeReleaseWithoutTipData = ({ encodedData, encodedSignatures, }) => (0, viem_1.encodeFunctionData)({
|
|
82
|
+
abi: abis.relayTokensDirect,
|
|
83
|
+
functionName: 'safeExecuteSignaturesWithAutoGasLimit',
|
|
84
|
+
args: [encodedData, encodedSignatures],
|
|
85
|
+
});
|
|
86
|
+
exports.encodeReleaseWithoutTipData = encodeReleaseWithoutTipData;
|
|
87
|
+
/**
|
|
88
|
+
* The calldata for a release sent through the pathway's destination output
|
|
89
|
+
* router, the path a fee-director (delivery) request uses.
|
|
90
|
+
*
|
|
91
|
+
* @param options.validator - the pathway's validator contract
|
|
92
|
+
* @param options.encodedData - the bridge message, `UserRequest.encodedData`
|
|
93
|
+
* @param options.encodedSignatures - the output of {@link packSignatures}
|
|
94
|
+
* @returns the calldata for the router's `safeExecuteSignaturesWithAutoGasLimit`
|
|
95
|
+
*/
|
|
96
|
+
const encodeReleaseToRouterData = ({ validator, encodedData, encodedSignatures, }) => (0, viem_1.encodeFunctionData)({
|
|
97
|
+
abi: abis.outputRouter,
|
|
98
|
+
functionName: 'safeExecuteSignaturesWithAutoGasLimit',
|
|
99
|
+
args: [validator, encodedData, encodedSignatures],
|
|
100
|
+
});
|
|
101
|
+
exports.encodeReleaseToRouterData = encodeReleaseToRouterData;
|
|
102
|
+
/**
|
|
103
|
+
* The one place a claim's target and calldata come from. The interface's
|
|
104
|
+
* release hook and {@link buildClaimTransaction} both call it.
|
|
105
|
+
*
|
|
106
|
+
* @param options.encodedData - the bridge message
|
|
107
|
+
* @param options.signatures - the raw validator signatures, in signing order
|
|
108
|
+
* @param options.destinationAmbAddress - the destination bridge, used by the `direct` route
|
|
109
|
+
* @param options.via - which contract receives the claim
|
|
110
|
+
* @returns the target contract and the calldata
|
|
111
|
+
*/
|
|
112
|
+
const claimCall = ({ encodedData, signatures, destinationAmbAddress, via, }) => {
|
|
113
|
+
const encodedSignatures = (0, exports.packSignatures)(signatures.map(exports.signatureToVRS));
|
|
114
|
+
if (via.kind === 'router') {
|
|
115
|
+
return {
|
|
116
|
+
to: via.destinationRouter,
|
|
117
|
+
data: (0, exports.encodeReleaseToRouterData)({ validator: via.validator, encodedData, encodedSignatures }),
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
return { to: destinationAmbAddress, data: (0, exports.encodeReleaseWithoutTipData)({ encodedData, encodedSignatures }) };
|
|
121
|
+
};
|
|
122
|
+
exports.claimCall = claimCall;
|
|
123
|
+
const isSignatureList = (value) => Array.isArray(value) && value.every((entry) => typeof entry === 'string' && (0, viem_1.isHex)(entry));
|
|
124
|
+
const refused = (refusal) => ({ kind: 'refused', refusal });
|
|
125
|
+
/**
|
|
126
|
+
* Builds the manual-claim transaction for one bridge request, or refuses with
|
|
127
|
+
* a typed reason.
|
|
128
|
+
*
|
|
129
|
+
* The checks run in this order: request type, delivery, signing, then the
|
|
130
|
+
* stored signature count. A delivered request is refused before the signing
|
|
131
|
+
* check, because delivery also sets `finishedSigning`.
|
|
132
|
+
*
|
|
133
|
+
* ASSUMPTION: the signatures are only complete when every validator sent
|
|
134
|
+
* `submitSignature` directly to the home bridge. The indexer drops a
|
|
135
|
+
* signature sent any other way; see this module's head note. This builder
|
|
136
|
+
* catches the drop by comparing the stored list with the required-signature
|
|
137
|
+
* threshold, or with `confirmedSignatures` when the record carries no threshold.
|
|
138
|
+
*
|
|
139
|
+
* @param options.request - the indexer's `UserRequest` record
|
|
140
|
+
* @param options.via - the claim target; see {@link ClaimRoute}
|
|
141
|
+
* @returns a `claim` plan whose transaction runs on the destination chain, or a refusal
|
|
142
|
+
*/
|
|
143
|
+
const buildClaimTransaction = ({ request, via, }) => {
|
|
144
|
+
if (request.type !== 'signature')
|
|
145
|
+
return refused({ reason: 'wrong-type', type: request.type });
|
|
146
|
+
if (request.delivered)
|
|
147
|
+
return refused({ reason: 'already-delivered' });
|
|
148
|
+
if (!request.finishedSigning)
|
|
149
|
+
return refused({ reason: 'not-signed-yet' });
|
|
150
|
+
if (!isSignatureList(request.signatures))
|
|
151
|
+
return refused({ reason: 'malformed-request', field: 'signatures' });
|
|
152
|
+
if (!(0, viem_1.isHex)(request.encodedData))
|
|
153
|
+
return refused({ reason: 'malformed-request', field: 'encodedData' });
|
|
154
|
+
if (!(0, viem_1.isHex)(request.destinationAmbAddress)) {
|
|
155
|
+
return refused({ reason: 'malformed-request', field: 'destinationAmbAddress' });
|
|
156
|
+
}
|
|
157
|
+
const needed = Number(request.requiredSignatures?.value ?? request.confirmedSignatures);
|
|
158
|
+
const stored = request.signatures.length;
|
|
159
|
+
if (stored < needed)
|
|
160
|
+
return refused({ reason: 'signatures-incomplete', stored, needed });
|
|
161
|
+
const { to, data } = (0, exports.claimCall)({
|
|
162
|
+
encodedData: request.encodedData,
|
|
163
|
+
signatures: request.signatures,
|
|
164
|
+
destinationAmbAddress: request.destinationAmbAddress,
|
|
165
|
+
via,
|
|
166
|
+
});
|
|
167
|
+
return {
|
|
168
|
+
kind: 'claim',
|
|
169
|
+
transaction: {
|
|
170
|
+
chainId: Number(request.destinationChainId),
|
|
171
|
+
kind: 'claim',
|
|
172
|
+
to,
|
|
173
|
+
data,
|
|
174
|
+
value: 0n,
|
|
175
|
+
// The calldata itself asks the bridge to pick its own gas limit
|
|
176
|
+
// (`safeExecuteSignaturesWithAutoGasLimit`); the wallet estimates the rest.
|
|
177
|
+
gasLimit: null,
|
|
178
|
+
waitForReceipt: false,
|
|
179
|
+
},
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
exports.buildClaimTransaction = buildClaimTransaction;
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
import { type Hex } from 'viem';
|
|
2
|
+
import type { BridgeKey, Token, TokenOut } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Add here your chain id as hex, be sure to add your chain in the chainsMetadata object too
|
|
5
|
+
*/
|
|
6
|
+
export declare enum Chains {
|
|
7
|
+
PLS = "0x171",
|
|
8
|
+
ETH = "0x1",
|
|
9
|
+
BNB = "0x38",
|
|
10
|
+
SEP = "0xaa36a7",
|
|
11
|
+
V4PLS = "0x3af"
|
|
12
|
+
}
|
|
13
|
+
/** The key of a chain - human readable for query params */
|
|
14
|
+
export type ChainKey = keyof typeof Chains;
|
|
15
|
+
/** A map of chain ids to chain keys */
|
|
16
|
+
export declare const chainIdToKey: Map<Chains, "PLS" | "ETH" | "BNB" | "SEP" | "V4PLS">;
|
|
17
|
+
/**
|
|
18
|
+
* Converts a chain id to a chain key
|
|
19
|
+
* @param chainId - the chain id
|
|
20
|
+
* @returns the chain key
|
|
21
|
+
*/
|
|
22
|
+
export declare const toChain: (chainId: number | string) => Chains;
|
|
23
|
+
/**
|
|
24
|
+
* Converts a chain id to a chain key
|
|
25
|
+
* @param chainId - the chain id
|
|
26
|
+
* @returns the chain key
|
|
27
|
+
*/
|
|
28
|
+
export declare const toChainKey: (chainId: number | string) => "PLS" | "ETH" | "BNB" | "SEP" | "V4PLS" | undefined;
|
|
29
|
+
export declare const Providers: {
|
|
30
|
+
readonly PULSECHAIN: "pulsechain";
|
|
31
|
+
readonly TOKENSEX: "tokensex";
|
|
32
|
+
};
|
|
33
|
+
export type Provider = (typeof Providers)[keyof typeof Providers];
|
|
34
|
+
/** A map of chains to native asset out addresses */
|
|
35
|
+
export declare const nativeAssetOut: Record<Chains, Hex>;
|
|
36
|
+
/**
|
|
37
|
+
* Four PulseChain mainnet tokens that no other constant in this package
|
|
38
|
+
* names. The PulseX carrier routes swaps through them
|
|
39
|
+
* (`routing/carriers/pulsex-paths.ts`), and the interface builds its
|
|
40
|
+
* PulseChain hub nodes from the two stablecoins.
|
|
41
|
+
*
|
|
42
|
+
* Each address was already in the repository before it moved here: USDC and
|
|
43
|
+
* USDT from the interface's `HUB_STABLECOIN_ADDRESSES`
|
|
44
|
+
* (`packages/ui/src/lib/state/useRouteSearch.ts`), PLSX and HEX from
|
|
45
|
+
* `scripts/route-parity-corpus.ts`. Each one was read on chain again on
|
|
46
|
+
* 2026-10-06 (`symbol()`, `decimals()`): PLSX 18, HEX 8, USDC 6, USDT 6.
|
|
47
|
+
* `getAddress` checksums them at load, so a mistyped character fails the
|
|
48
|
+
* build rather than silently matching nothing.
|
|
49
|
+
*/
|
|
50
|
+
export declare const pulsechainTokenAddresses: Readonly<{
|
|
51
|
+
/** PulseX, the exchange's own token. */
|
|
52
|
+
PLSX: `0x${string}`;
|
|
53
|
+
/** HEX. */
|
|
54
|
+
HEX: `0x${string}`;
|
|
55
|
+
/** USD Coin, bridged from Ethereum. */
|
|
56
|
+
USDC: `0x${string}`;
|
|
57
|
+
/** Tether USD, bridged from Ethereum. */
|
|
58
|
+
USDT: `0x${string}`;
|
|
59
|
+
}>;
|
|
60
|
+
/** A map of chains to deprecated native asset out addresses */
|
|
61
|
+
export declare const deprecatedNativeAssetOut: Partial<Record<Chains, Set<Hex>>>;
|
|
62
|
+
/** A map of chains to uni v2 router addresses */
|
|
63
|
+
export declare const uniV2Routers: Record<Chains, Hex[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Each {@link uniV2Routers} entry's OWN factory address, same index, same
|
|
66
|
+
* chain — `router.factory()` read live from `one.valve.city` on 2026-09-24.
|
|
67
|
+
* Only PulseChain mainnet is filled: PulseX carries funds nowhere else
|
|
68
|
+
* (`routing/carriers/pulsex.ts`'s own `pulseXCarries`), so no other chain's
|
|
69
|
+
* factory has ever been needed or verified.
|
|
70
|
+
*
|
|
71
|
+
* MEASURED, NOT ASSUMED (owner Rule 13). Reading each factory's `getPair`
|
|
72
|
+
* and the resulting pool's `getReserves`, then recomputing `getAmountsOut`
|
|
73
|
+
* from the standard constant-product formula, showed the SAME fee ratio for
|
|
74
|
+
* both — `9971/10000` (0.29%) — to the base unit, on both a one-hop and a
|
|
75
|
+
* two-hop path. "V1 and V2 differ" was the assumption going in; measurement
|
|
76
|
+
* said otherwise, so `routing/carriers/pulsex.ts`'s `exact` uses one shared
|
|
77
|
+
* fee constant rather than two.
|
|
78
|
+
*
|
|
79
|
+
* `0x1715a3E4A142d8b698131108995174F37aEBA10D` (the V1 factory, index 0) is
|
|
80
|
+
* NOT a copy-paste of the omnibridge's Ethereum mediator address from
|
|
81
|
+
* `pathways` above — it is the same string on a DIFFERENT chain (PulseChain,
|
|
82
|
+
* not Ethereum), confirmed by reading it fresh from `one.valve.city/…/evm/369`.
|
|
83
|
+
* Two unrelated contracts landing on the same address on two different
|
|
84
|
+
* chains is possible (a shared deployer at a matching nonce, or a CREATE2
|
|
85
|
+
* salt collision) and worth this note so a future reader does not assume a
|
|
86
|
+
* transcription error and "fix" it back to something wrong.
|
|
87
|
+
*/
|
|
88
|
+
export declare const uniV2Factories: Record<Chains, Hex[]>;
|
|
89
|
+
/** A map of chains to native token symbols */
|
|
90
|
+
export declare const nativeTokenSymbol: Record<Chains, string>;
|
|
91
|
+
/** A map of chains to native token names */
|
|
92
|
+
export declare const nativeTokenName: Record<Chains, string>;
|
|
93
|
+
/** The pathway of a bridge */
|
|
94
|
+
export type Pathway = {
|
|
95
|
+
from: Hex;
|
|
96
|
+
to: Hex;
|
|
97
|
+
destinationRouter: Hex | null;
|
|
98
|
+
nativeRouter: Hex;
|
|
99
|
+
validator: Hex;
|
|
100
|
+
usesExtraParam: boolean;
|
|
101
|
+
feeManager: 'from' | 'to';
|
|
102
|
+
toHome: boolean;
|
|
103
|
+
requiresDelivery: boolean;
|
|
104
|
+
bridgedNativeAssetOut: Hex;
|
|
105
|
+
settingOverrides?: Record<Hex, Partial<Pathway>>;
|
|
106
|
+
};
|
|
107
|
+
/** A map of providers to pathways */
|
|
108
|
+
export type DeepPathwayConfig = Record<Provider, Partial<Record<Chains, Partial<Record<Chains, Pathway>>>>>;
|
|
109
|
+
export declare const pathways: DeepPathwayConfig;
|
|
110
|
+
export declare const testnetPathways: DeepPathwayConfig;
|
|
111
|
+
/** Returns the valid bridge keys for the given is prod */
|
|
112
|
+
export declare const validBridgeKeys: (isProd: boolean) => BridgeKey[];
|
|
113
|
+
/**
|
|
114
|
+
* Whether a chain belongs to the testnet pathway map rather than the mainnet one.
|
|
115
|
+
* @param chain - the chain to classify
|
|
116
|
+
* @returns true for Sepolia and PulseChain testnet V4
|
|
117
|
+
*/
|
|
118
|
+
export declare const isTestnetChain: (chain: Chains) => boolean;
|
|
119
|
+
/**
|
|
120
|
+
* Infers the bridge key from the current key, provider, from chain, and to chain.
|
|
121
|
+
*
|
|
122
|
+
* A chain the provider does not serve falls back to the provider's first chain,
|
|
123
|
+
* so a provider switch lands on a real pathway. That fallback never crosses
|
|
124
|
+
* between the testnet and mainnet maps: when testnets are off and a requested
|
|
125
|
+
* chain is a testnet chain, this returns null rather than a mainnet key for a
|
|
126
|
+
* testnet pair.
|
|
127
|
+
*
|
|
128
|
+
* @param options.currentKey - the current bridge key
|
|
129
|
+
* @param options.provider - the provider
|
|
130
|
+
* @param options.fromChain - the from chain (defaults to the current key's)
|
|
131
|
+
* @param options.toChain - the to chain (defaults to the current key's)
|
|
132
|
+
* @param options.isProd - true leaves testnet pathways out (default false: both maps)
|
|
133
|
+
* @returns the inferred bridge key, or null when no pathway can honour the request
|
|
134
|
+
*/
|
|
135
|
+
export declare const inferBridgeKey: ({ currentKey, provider, fromChain, toChain, isProd, }: {
|
|
136
|
+
currentKey: BridgeKey;
|
|
137
|
+
provider: Provider;
|
|
138
|
+
fromChain?: Chains;
|
|
139
|
+
toChain?: Chains;
|
|
140
|
+
isProd?: boolean;
|
|
141
|
+
}) => BridgeKey | null;
|
|
142
|
+
/**
|
|
143
|
+
* Returns the pathway for the given bridge key, is prod, and asset in address
|
|
144
|
+
* @param bridgeKey - the bridge key
|
|
145
|
+
* @param isProd - whether to use the production pathway
|
|
146
|
+
* @param assetInAddress - the asset in address
|
|
147
|
+
* @returns the pathway
|
|
148
|
+
*/
|
|
149
|
+
/**
|
|
150
|
+
* The pathway group for one provider on one chain, honouring the testnet map.
|
|
151
|
+
*
|
|
152
|
+
* Exists because {@link pathway} already knew that testnet pathways live in a
|
|
153
|
+
* SECOND map and are only in play off production, while other callers reached
|
|
154
|
+
* straight into `pathways` and therefore could not see a testnet route at all.
|
|
155
|
+
* That is the sort of knowledge that has to live in one place: duplicated, one
|
|
156
|
+
* copy silently lags the other, and the symptom is a thrown "no pathway found"
|
|
157
|
+
* on a route the rest of the application considers perfectly valid.
|
|
158
|
+
*
|
|
159
|
+
* @param provider - the bridge provider
|
|
160
|
+
* @param chain - the chain being bridged FROM
|
|
161
|
+
* @param isProd - whether this is a production build; testnets are off when true
|
|
162
|
+
* @returns the group keyed by destination chain, or undefined when unknown
|
|
163
|
+
*/
|
|
164
|
+
export declare const pathwayGroup: (provider: Provider, chain: Chains, isProd: boolean) => Partial<Record<Chains, Pathway>> | undefined;
|
|
165
|
+
export declare const pathway: (bridgeKey: BridgeKey | null, isProd: boolean, assetInAddress?: string | Hex | null | undefined) => Pathway | undefined;
|
|
166
|
+
/**
|
|
167
|
+
* Returns the default asset in for the given bridge key and is prod
|
|
168
|
+
* @param bridgeKey - the bridge key
|
|
169
|
+
* @param isProd - whether to use the production pathway
|
|
170
|
+
* @returns the default asset in
|
|
171
|
+
*/
|
|
172
|
+
export declare const defaultAssetIn: ($bridgeKey: BridgeKey | null, isProd: boolean) => `0x${string}` | null | undefined;
|
|
173
|
+
/** Which pathway maps a lookup reads. */
|
|
174
|
+
export type PathwayLookupOptions = {
|
|
175
|
+
/**
|
|
176
|
+
* true reads the mainnet map alone; false (the default) also reads the
|
|
177
|
+
* testnet map, which is what every caller did before this option existed.
|
|
178
|
+
*/
|
|
179
|
+
isProd?: boolean;
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Returns whether the given asset is the native asset for the given bridge key.
|
|
183
|
+
*
|
|
184
|
+
* Never throws. A token whose address is not known yet (a {@link TokenOut} for a
|
|
185
|
+
* not-yet-bridged token), an address that is not a valid address, and a bridge
|
|
186
|
+
* key with no pathway each answer false.
|
|
187
|
+
*
|
|
188
|
+
* @param asset - the asset
|
|
189
|
+
* @param bridgeKey - the bridge key
|
|
190
|
+
* @param options - which pathway maps to read; see {@link PathwayLookupOptions}
|
|
191
|
+
* @returns whether the given asset is the native asset for the given bridge key
|
|
192
|
+
*/
|
|
193
|
+
export declare const isNative: (asset: Token | TokenOut | null, bridgeKey: BridgeKey | null, options?: PathwayLookupOptions) => boolean;
|
|
194
|
+
/**
|
|
195
|
+
* Returns whether the given asset is unwrappable for the given bridge key.
|
|
196
|
+
*
|
|
197
|
+
* Never throws: a missing or malformed address and a bridge key with no
|
|
198
|
+
* pathway each answer false.
|
|
199
|
+
*
|
|
200
|
+
* @param bridgeKey - the bridge key
|
|
201
|
+
* @param assetIn - the asset in
|
|
202
|
+
* @param options - which pathway maps to read; see {@link PathwayLookupOptions}
|
|
203
|
+
* @returns whether the given asset is unwrappable for the given bridge key
|
|
204
|
+
*/
|
|
205
|
+
export declare const isUnwrappable: (bridgeKey: BridgeKey | null, assetIn: {
|
|
206
|
+
address: string | null;
|
|
207
|
+
} | null, options?: PathwayLookupOptions) => boolean;
|
|
208
|
+
/**
|
|
209
|
+
* Returns whether the given asset can be unwrapped for the given bridge key
|
|
210
|
+
* @param bridgeKey - the bridge key
|
|
211
|
+
* @param assetIn - the asset in
|
|
212
|
+
* @param options - which pathway maps to read; see {@link PathwayLookupOptions}
|
|
213
|
+
* @returns boolean
|
|
214
|
+
*/
|
|
215
|
+
export declare const canChangeUnwrap: (bridgeKey: BridgeKey, assetIn: Token | null, options?: PathwayLookupOptions) => boolean;
|
|
216
|
+
export declare const chains: {
|
|
217
|
+
readonly ethereum: 1;
|
|
218
|
+
readonly bsc: 56;
|
|
219
|
+
readonly pulsechain: 369;
|
|
220
|
+
readonly pulsechainV4: 943;
|
|
221
|
+
readonly sepolia: 11155111;
|
|
222
|
+
};
|
|
223
|
+
export declare const chainIds: (1 | 56 | 369 | 943 | 11155111)[];
|
|
224
|
+
/** Start blocks aligned with when bridge validators began operating — canonical reference for all ponder indexers in this monorepo. */
|
|
225
|
+
export declare const startBlocks: Record<keyof typeof chains, number>;
|
|
226
|
+
export type ChainId = (typeof chainIds)[number];
|
|
227
|
+
export type Side = 'home' | 'foreign';
|
|
228
|
+
export type MinimalKey = `${ChainId}-${Hex}`;
|
|
229
|
+
export type PathwayInfo = {
|
|
230
|
+
pair: string;
|
|
231
|
+
key: string;
|
|
232
|
+
home: Hex;
|
|
233
|
+
foreign: Hex;
|
|
234
|
+
};
|
|
235
|
+
export type ProviderHomeChainEntry = Partial<Record<ChainId, PathwayInfo[]>>;
|
|
236
|
+
export type ProviderEntries = Partial<Record<ChainId, ProviderHomeChainEntry>>;
|
|
237
|
+
export type BridgeConfig = Record<Provider, ProviderEntries>;
|
|
238
|
+
export declare const bridgeConfigs: BridgeConfig;
|
|
239
|
+
export declare const HOME_TO_FOREIGN_FEE: `0x${string}`;
|
|
240
|
+
export declare const FOREIGN_TO_HOME_FEE: `0x${string}`;
|