@avalabs/bridge-unified 0.0.0-license-20240801163452 → 0.0.0-tmp-lombard-sdk-integration-20251210211743
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 +81 -13
- package/dist/index.cjs +39 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +283 -56
- package/dist/index.d.ts +283 -56
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/package.json +11 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Address } from 'viem';
|
|
2
|
+
import { Address as Address$1 } from 'abitype';
|
|
3
|
+
import { z } from 'zod';
|
|
2
4
|
|
|
3
5
|
type Chain = {
|
|
4
6
|
chainName: string;
|
|
@@ -7,28 +9,135 @@ type Chain = {
|
|
|
7
9
|
utilityAddresses?: {
|
|
8
10
|
multicall: Address;
|
|
9
11
|
};
|
|
10
|
-
networkToken:
|
|
12
|
+
networkToken: NativeAsset;
|
|
11
13
|
};
|
|
14
|
+
declare enum AvalancheChainIds {
|
|
15
|
+
FUJI = "eip155:43113",
|
|
16
|
+
MAINNET = "eip155:43114"
|
|
17
|
+
}
|
|
18
|
+
declare enum EthereumChainIds {
|
|
19
|
+
MAINNET = "eip155:1",
|
|
20
|
+
SEPOLIA = "eip155:11155111"
|
|
21
|
+
}
|
|
22
|
+
declare enum BitcoinChainIds {
|
|
23
|
+
MAINNET = "bip122:000000000019d6689c085ae165831e93",
|
|
24
|
+
TESTNET = "bip122:000000000933ea01ad0ee984209779ba"
|
|
25
|
+
}
|
|
26
|
+
declare const AVALANCHE_FUJI_CHAIN: Chain;
|
|
27
|
+
declare const AVALANCHE_MAINNET_CHAIN: Chain;
|
|
28
|
+
declare const ETHEREUM_SEPOLIA_CHAIN: Chain;
|
|
29
|
+
declare const ETHEREUM_MAINNET_CHAIN: Chain;
|
|
30
|
+
declare const BITCOIN_TESTNET_CHAIN: Chain;
|
|
31
|
+
declare const BITCOIN_MAINNET_CHAIN: Chain;
|
|
12
32
|
|
|
13
33
|
declare enum Environment {
|
|
34
|
+
DEV = "dev",
|
|
14
35
|
PROD = "production",
|
|
36
|
+
STAGING = "staging",
|
|
15
37
|
TEST = "test"
|
|
16
38
|
}
|
|
17
39
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
40
|
+
/**
|
|
41
|
+
* Custom Bitcoin UTXO interface.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
declare const BitcoinInputUTXO: z.ZodObject<{
|
|
45
|
+
txHash: z.ZodString;
|
|
46
|
+
txHex: z.ZodOptional<z.ZodString>;
|
|
47
|
+
index: z.ZodNumber;
|
|
48
|
+
value: z.ZodNumber;
|
|
49
|
+
script: z.ZodString;
|
|
50
|
+
blockHeight: z.ZodNumber;
|
|
51
|
+
confirmations: z.ZodNumber;
|
|
52
|
+
}, "strip", z.ZodTypeAny, {
|
|
53
|
+
txHash: string;
|
|
54
|
+
value: number;
|
|
55
|
+
index: number;
|
|
56
|
+
script: string;
|
|
57
|
+
blockHeight: number;
|
|
58
|
+
confirmations: number;
|
|
59
|
+
txHex?: string | undefined;
|
|
60
|
+
}, {
|
|
61
|
+
txHash: string;
|
|
62
|
+
value: number;
|
|
63
|
+
index: number;
|
|
64
|
+
script: string;
|
|
65
|
+
blockHeight: number;
|
|
66
|
+
confirmations: number;
|
|
67
|
+
txHex?: string | undefined;
|
|
68
|
+
}>;
|
|
69
|
+
type BitcoinInputUTXO = typeof BitcoinInputUTXO._output;
|
|
70
|
+
declare const BitcoinInputUTXOWithOptionalScript: z.ZodObject<z.objectUtil.extendShape<{
|
|
71
|
+
txHash: z.ZodString;
|
|
72
|
+
txHex: z.ZodOptional<z.ZodString>;
|
|
73
|
+
index: z.ZodNumber;
|
|
74
|
+
value: z.ZodNumber;
|
|
75
|
+
script: z.ZodString;
|
|
76
|
+
blockHeight: z.ZodNumber;
|
|
77
|
+
confirmations: z.ZodNumber;
|
|
78
|
+
}, {
|
|
79
|
+
script: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}>, "strip", z.ZodTypeAny, {
|
|
81
|
+
txHash: string;
|
|
82
|
+
value: number;
|
|
83
|
+
index: number;
|
|
84
|
+
blockHeight: number;
|
|
85
|
+
confirmations: number;
|
|
86
|
+
txHex?: string | undefined;
|
|
87
|
+
script?: string | undefined;
|
|
88
|
+
}, {
|
|
89
|
+
txHash: string;
|
|
90
|
+
value: number;
|
|
91
|
+
index: number;
|
|
92
|
+
blockHeight: number;
|
|
93
|
+
confirmations: number;
|
|
94
|
+
txHex?: string | undefined;
|
|
95
|
+
script?: string | undefined;
|
|
96
|
+
}>;
|
|
97
|
+
type BitcoinInputUTXOWithOptionalScript = typeof BitcoinInputUTXOWithOptionalScript._output;
|
|
98
|
+
/**
|
|
99
|
+
* Used for defining outputs when creating a transaction.
|
|
100
|
+
*/
|
|
101
|
+
declare const BitcoinOutputUTXO: z.ZodObject<{
|
|
102
|
+
address: z.ZodString;
|
|
103
|
+
value: z.ZodNumber;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
value: number;
|
|
106
|
+
address: string;
|
|
107
|
+
}, {
|
|
108
|
+
value: number;
|
|
109
|
+
address: string;
|
|
110
|
+
}>;
|
|
111
|
+
type BitcoinOutputUTXO = typeof BitcoinOutputUTXO._output;
|
|
112
|
+
interface BitcoinTx {
|
|
113
|
+
hash: string;
|
|
114
|
+
fees: number;
|
|
115
|
+
block: number;
|
|
116
|
+
amount: number;
|
|
117
|
+
confirmations: number;
|
|
118
|
+
blockTime: number;
|
|
119
|
+
addresses: string[];
|
|
120
|
+
inputs: {
|
|
121
|
+
txid: string;
|
|
122
|
+
vout: number;
|
|
123
|
+
sequence: number;
|
|
124
|
+
n: number;
|
|
125
|
+
addresses: string[];
|
|
126
|
+
isAddress: boolean;
|
|
127
|
+
value: number;
|
|
128
|
+
}[];
|
|
129
|
+
outputs: {
|
|
130
|
+
addresses: string[];
|
|
131
|
+
value: number;
|
|
132
|
+
n: number;
|
|
133
|
+
spent: boolean;
|
|
134
|
+
hex: string;
|
|
135
|
+
isAddress: boolean;
|
|
136
|
+
}[];
|
|
137
|
+
}
|
|
29
138
|
|
|
30
139
|
type Hex = `0x${string}`;
|
|
31
|
-
type
|
|
140
|
+
type EvmTransactionRequest = {
|
|
32
141
|
type?: number | null;
|
|
33
142
|
data?: Hex | null;
|
|
34
143
|
from: Hex;
|
|
@@ -40,27 +149,58 @@ type TransactionRequest = {
|
|
|
40
149
|
gasLimit?: bigint | null;
|
|
41
150
|
maxPriorityFeePerGas?: bigint | null;
|
|
42
151
|
maxFeePerGas?: bigint | null;
|
|
152
|
+
chainId?: string;
|
|
153
|
+
};
|
|
154
|
+
type EvmDispatch = (signedTxHash: Hex) => Promise<Hex>;
|
|
155
|
+
type EvmSign = (data: EvmTransactionRequest, dispatch: EvmDispatch, step: BridgeStepDetails) => Promise<Hex>;
|
|
156
|
+
type EvmSignMessage = (params: {
|
|
157
|
+
message: string;
|
|
158
|
+
address: Address$1;
|
|
159
|
+
chainId: number;
|
|
160
|
+
}, dispatch: EvmDispatch, step: BridgeStepDetails) => Promise<Hex>;
|
|
161
|
+
type EvmSigner = {
|
|
162
|
+
sign: EvmSign;
|
|
163
|
+
};
|
|
164
|
+
type EvmSignerWithMessage = EvmSigner & {
|
|
165
|
+
signMessage: EvmSignMessage;
|
|
166
|
+
};
|
|
167
|
+
type BtcTransactionRequest = {
|
|
168
|
+
inputs: BitcoinInputUTXO[];
|
|
169
|
+
outputs: BitcoinOutputUTXO[];
|
|
170
|
+
};
|
|
171
|
+
type BtcDispatch = (signedTxHash: string) => Promise<string>;
|
|
172
|
+
type BtcSign = (data: BtcTransactionRequest, dispatch: BtcDispatch, step: BridgeStepDetails) => Promise<string>;
|
|
173
|
+
type BtcSigner = {
|
|
174
|
+
sign: BtcSign;
|
|
43
175
|
};
|
|
44
|
-
type Dispatch = (signedTxHash: Hex) => Promise<Hex>;
|
|
45
|
-
type Signer = (data: TransactionRequest, dispatch: Dispatch) => Promise<Hex>;
|
|
46
176
|
|
|
47
177
|
declare enum ErrorCode {
|
|
48
178
|
BRIDGE_NOT_AVAILABLE = 5001,
|
|
49
179
|
INITIALIZATION_FAILED = 5002,
|
|
50
180
|
INVALID_PARAMS = 5003,
|
|
51
181
|
TIMEOUT = 5004,
|
|
52
|
-
TRANSACTION_REVERTED = 5005
|
|
182
|
+
TRANSACTION_REVERTED = 5005,
|
|
183
|
+
NOTARIZATION_FAILED = 5006
|
|
53
184
|
}
|
|
54
185
|
declare enum ErrorReason {
|
|
55
|
-
|
|
186
|
+
ASSET_NOT_SUPPORTED = "ASSET_NOT_SUPPORTED",
|
|
187
|
+
CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED",
|
|
56
188
|
CONFIG_NOT_AVAILABLE = "CONFIG_NOT_AVAILABLE",
|
|
57
|
-
|
|
189
|
+
CONFIRMATION_COUNT_UNKNOWN = "CONFIRMATION_COUNT_UNKNOWN",
|
|
190
|
+
ENVIRONMENT_NOT_SUPPORTED = "ENVIRONMENT_NOT_SUPPORTED",
|
|
58
191
|
IDENTICAL_CHAINS_PROVIDED = "IDENTICAL_CHAINS_PROVIDED",
|
|
59
|
-
INCORRECT_AMOUNT_PROVIDED = "INCORRECT_AMOUNT_PROVIDED",
|
|
60
192
|
INCORRECT_ADDRESS_PROVIDED = "INCORRECT_ADDRESS_PROVIDED",
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
193
|
+
INCORRECT_AMOUNT_PROVIDED = "INCORRECT_AMOUNT_PROVIDED",
|
|
194
|
+
INCORRECT_HASH_PROVIDED = "INCORRECT_HASH_PROVIDED",
|
|
195
|
+
INCORRECT_PROVIDER_PROVIDED = "INCORRECT_PROVIDER_PROVIDED",
|
|
196
|
+
INCORRECT_SIGNER_PROVIDED = "INCORRECT_SIGNER_PROVIDED",
|
|
197
|
+
INCORRECT_TXHASH_PROVIDED = "INCORRECT_TXHASH_PROVIDED",
|
|
198
|
+
INVALID_PARAMS = "INVALID_PARAMS",
|
|
199
|
+
UNKNOWN = "UNKNOWN",
|
|
200
|
+
VULNERABLE_TOKEN_APPROVAL_ADDRESS = "VULNERABLE_TOKEN_APPROVAL_ADDRESS",
|
|
201
|
+
WARDEN_CONFIG_MISMATCH = "WARDEN_CONFIG_MISMATCH",
|
|
202
|
+
WARDEN_CONFIG_MISSING_NETWORK = "WARDEN_CONFIG_MISSING_NETWORK",
|
|
203
|
+
ADDRESS_IS_BLOCKED = "ADDRESS_IS_BLOCKED"
|
|
64
204
|
}
|
|
65
205
|
|
|
66
206
|
type BridgeTransfer = {
|
|
@@ -69,8 +209,7 @@ type BridgeTransfer = {
|
|
|
69
209
|
fromAddress: string;
|
|
70
210
|
toAddress: string;
|
|
71
211
|
amount: bigint;
|
|
72
|
-
|
|
73
|
-
symbol: string;
|
|
212
|
+
asset: BridgeAsset;
|
|
74
213
|
completedAt?: number;
|
|
75
214
|
errorCode?: ErrorCode;
|
|
76
215
|
bridgeFee: bigint;
|
|
@@ -79,64 +218,143 @@ type BridgeTransfer = {
|
|
|
79
218
|
sourceTxHash: string;
|
|
80
219
|
sourceNetworkFee?: bigint;
|
|
81
220
|
sourceConfirmationCount: number;
|
|
82
|
-
|
|
221
|
+
sourceRequiredConfirmationCount: number;
|
|
83
222
|
targetChain: Chain;
|
|
84
223
|
targetStartedAt?: number;
|
|
85
224
|
targetTxHash?: string;
|
|
86
225
|
targetNetworkFee?: bigint;
|
|
87
226
|
targetConfirmationCount: number;
|
|
88
|
-
|
|
89
|
-
|
|
227
|
+
targetRequiredConfirmationCount: number;
|
|
228
|
+
targetStartBlockNumber?: bigint;
|
|
90
229
|
metadata?: Record<string, unknown>;
|
|
91
230
|
};
|
|
92
231
|
|
|
232
|
+
interface BitcoinFunctions {
|
|
233
|
+
getChainHeight: () => Promise<number>;
|
|
234
|
+
getUTXOs: (address: string, withScripts?: boolean) => Promise<{
|
|
235
|
+
confirmed: BitcoinInputUTXOWithOptionalScript[];
|
|
236
|
+
unconfirmed: BitcoinInputUTXOWithOptionalScript[];
|
|
237
|
+
}>;
|
|
238
|
+
getTransaction: (hash: string) => Promise<BitcoinTx>;
|
|
239
|
+
getFeeRates: () => Promise<{
|
|
240
|
+
low: number;
|
|
241
|
+
medium: number;
|
|
242
|
+
high: number;
|
|
243
|
+
}>;
|
|
244
|
+
getUtxoBalance: (address: string, withScripts?: boolean) => Promise<{
|
|
245
|
+
utxos: BitcoinInputUTXOWithOptionalScript[];
|
|
246
|
+
utxosUnconfirmed: BitcoinInputUTXOWithOptionalScript[];
|
|
247
|
+
}>;
|
|
248
|
+
getScriptsForUtxos: (utxos: BitcoinInputUTXOWithOptionalScript[]) => Promise<BitcoinInputUTXO[]>;
|
|
249
|
+
issueRawTx: (tx: string) => Promise<string>;
|
|
250
|
+
}
|
|
251
|
+
|
|
93
252
|
declare enum BridgeType {
|
|
94
|
-
|
|
253
|
+
AVALANCHE_EVM = "avalanche-evm",
|
|
254
|
+
AVALANCHE_BTC_AVA = "avalanche-btc-ava",
|
|
255
|
+
AVALANCHE_AVA_BTC = "avalanche-ava-btc",
|
|
256
|
+
CCTP = "cctp",
|
|
257
|
+
ICTT_ERC20_ERC20 = "ictt-erc20-erc20",
|
|
258
|
+
LOMBARD_BTC_TO_BTCB = "lombard-btc-to-btcb",
|
|
259
|
+
LOMBARD_BTCB_TO_BTC = "lombard-btcb-to-btc"
|
|
95
260
|
}
|
|
261
|
+
declare const BTC_BRIDGE_TYPES: readonly [BridgeType.AVALANCHE_AVA_BTC, BridgeType.AVALANCHE_BTC_AVA, BridgeType.LOMBARD_BTC_TO_BTCB, BridgeType.LOMBARD_BTCB_TO_BTC];
|
|
262
|
+
declare const EVM_BRIDGE_TYPES: readonly [BridgeType.AVALANCHE_EVM, BridgeType.CCTP, BridgeType.ICTT_ERC20_ERC20];
|
|
263
|
+
type ArrayElement<A> = A extends readonly (infer T)[] ? T : never;
|
|
264
|
+
type EvmBridgeInitializer = {
|
|
265
|
+
type: ArrayElement<typeof EVM_BRIDGE_TYPES>;
|
|
266
|
+
signer: EvmSigner;
|
|
267
|
+
};
|
|
268
|
+
type AvaToBtcBridgeInitializer = {
|
|
269
|
+
type: BridgeType.AVALANCHE_AVA_BTC;
|
|
270
|
+
signer: EvmSigner;
|
|
271
|
+
bitcoinFunctions: BitcoinFunctions;
|
|
272
|
+
};
|
|
273
|
+
type BtcToAvaBridgeInitializer = {
|
|
274
|
+
type: BridgeType.AVALANCHE_BTC_AVA;
|
|
275
|
+
signer: BtcSigner;
|
|
276
|
+
bitcoinFunctions: BitcoinFunctions;
|
|
277
|
+
};
|
|
278
|
+
type LombardBridgeInitializer = {
|
|
279
|
+
type: BridgeType.LOMBARD_BTC_TO_BTCB | BridgeType.LOMBARD_BTCB_TO_BTC;
|
|
280
|
+
evmSigner: EvmSignerWithMessage;
|
|
281
|
+
btcSigner: BtcSigner;
|
|
282
|
+
bitcoinFunctions: BitcoinFunctions;
|
|
283
|
+
};
|
|
284
|
+
type BridgeInitializer = EvmBridgeInitializer | AvaToBtcBridgeInitializer | BtcToAvaBridgeInitializer | LombardBridgeInitializer;
|
|
285
|
+
declare const isLombardBridgeInitializer: (initializer: BridgeInitializer) => initializer is LombardBridgeInitializer;
|
|
286
|
+
declare const isEvmBridgeInitializer: (initializer: BridgeInitializer) => initializer is EvmBridgeInitializer;
|
|
287
|
+
declare const isAvaToBtcBridgeInitializer: (initializer: BridgeInitializer) => initializer is AvaToBtcBridgeInitializer;
|
|
288
|
+
declare const isBtcToAvaBridgeInitializer: (initializer: BridgeInitializer) => initializer is BtcToAvaBridgeInitializer;
|
|
96
289
|
type FeeParams = {
|
|
97
290
|
asset: BridgeAsset;
|
|
98
291
|
amount: bigint;
|
|
99
292
|
sourceChain: Chain;
|
|
100
293
|
targetChain: Chain;
|
|
101
|
-
provider?: Provider;
|
|
102
294
|
};
|
|
103
295
|
declare enum BridgeSignatureReason {
|
|
104
296
|
AllowanceApproval = "allowance-approval",
|
|
105
|
-
TokensTransfer = "tokens-transfer"
|
|
297
|
+
TokensTransfer = "tokens-transfer",
|
|
298
|
+
WrapToken = "wrap-token"
|
|
106
299
|
}
|
|
107
300
|
type BridgeStepDetails = {
|
|
108
301
|
currentSignature: number;
|
|
109
302
|
requiredSignatures: number;
|
|
110
303
|
currentSignatureReason: BridgeSignatureReason;
|
|
111
304
|
};
|
|
305
|
+
type GasSettings = {
|
|
306
|
+
price: bigint;
|
|
307
|
+
tip?: bigint;
|
|
308
|
+
};
|
|
112
309
|
type TransferParams = {
|
|
113
310
|
asset: BridgeAsset;
|
|
114
311
|
amount: bigint;
|
|
115
312
|
fromAddress: string;
|
|
116
|
-
toAddress
|
|
313
|
+
toAddress: string;
|
|
117
314
|
sourceChain: Chain;
|
|
118
315
|
targetChain: Chain;
|
|
119
|
-
|
|
120
|
-
targetProvider?: Provider;
|
|
316
|
+
gasSettings?: GasSettings;
|
|
121
317
|
onStepChange?: (stepDetails: BridgeStepDetails) => void;
|
|
122
|
-
sign?: Signer;
|
|
123
318
|
};
|
|
319
|
+
type GasEstimationParams = Omit<TransferParams, 'onStepChange' | 'toAddress'>;
|
|
124
320
|
type TrackingParams = {
|
|
125
321
|
bridgeTransfer: BridgeTransfer;
|
|
126
|
-
sourceProvider?: Provider;
|
|
127
|
-
targetProvider?: Provider;
|
|
128
322
|
updateListener: (transfer: BridgeTransfer) => void;
|
|
129
323
|
};
|
|
324
|
+
type AnalyzeTxParams = {
|
|
325
|
+
chainId: string;
|
|
326
|
+
from: string;
|
|
327
|
+
to: string;
|
|
328
|
+
tokenTransfers: {
|
|
329
|
+
from?: string;
|
|
330
|
+
to?: string;
|
|
331
|
+
symbol: string;
|
|
332
|
+
}[];
|
|
333
|
+
};
|
|
334
|
+
type AnalyzeTxResult = {
|
|
335
|
+
isBridgeTx: true;
|
|
336
|
+
bridgeType: BridgeType;
|
|
337
|
+
sourceChainId?: string;
|
|
338
|
+
targetChainId?: string;
|
|
339
|
+
} | {
|
|
340
|
+
isBridgeTx: false;
|
|
341
|
+
};
|
|
130
342
|
type BridgeService = {
|
|
131
343
|
type: BridgeType;
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
344
|
+
analyzeTx: (params: AnalyzeTxParams) => AnalyzeTxResult;
|
|
345
|
+
estimateGas: (params: GasEstimationParams) => Promise<bigint>;
|
|
346
|
+
estimateReceiveAmount: (params: GasEstimationParams) => Promise<{
|
|
347
|
+
asset: Asset;
|
|
348
|
+
amount: bigint;
|
|
349
|
+
}>;
|
|
135
350
|
transferAsset: (params: TransferParams) => Promise<BridgeTransfer>;
|
|
136
351
|
trackTransfer: (transfer: TrackingParams) => {
|
|
137
352
|
cancel: () => void;
|
|
138
353
|
result: Promise<BridgeTransfer>;
|
|
139
354
|
};
|
|
355
|
+
getAssets: () => ChainAssetMap;
|
|
356
|
+
getFees: (params: FeeParams) => Promise<AssetFeeMap>;
|
|
357
|
+
getMinimumTransferAmount: (params: FeeParams) => Promise<bigint>;
|
|
140
358
|
};
|
|
141
359
|
type BridgeServiceFactory = (environment: Environment) => Promise<BridgeService>;
|
|
142
360
|
|
|
@@ -144,39 +362,40 @@ declare enum TokenType {
|
|
|
144
362
|
NATIVE = "native",
|
|
145
363
|
ERC20 = "erc20"
|
|
146
364
|
}
|
|
147
|
-
type
|
|
148
|
-
type: TokenType;
|
|
149
|
-
address?: Address;
|
|
365
|
+
type BaseAsset = {
|
|
150
366
|
name: string;
|
|
151
367
|
symbol: string;
|
|
152
368
|
decimals: number;
|
|
153
369
|
};
|
|
370
|
+
type Erc20Asset = BaseAsset & {
|
|
371
|
+
type: TokenType.ERC20;
|
|
372
|
+
address: Address;
|
|
373
|
+
};
|
|
374
|
+
type NativeAsset = BaseAsset & {
|
|
375
|
+
type: TokenType.NATIVE;
|
|
376
|
+
};
|
|
377
|
+
declare const isErc20Asset: (asset: Asset) => asset is Erc20Asset;
|
|
378
|
+
declare const isNativeAsset: (asset: Asset) => asset is NativeAsset;
|
|
379
|
+
type Asset = Erc20Asset | NativeAsset;
|
|
154
380
|
type DestinationInfo = Record<string, BridgeType[]>;
|
|
155
381
|
type BridgeAsset = Asset & {
|
|
156
382
|
destinations: DestinationInfo;
|
|
157
383
|
};
|
|
158
384
|
type ChainAssetMap = Record<string, BridgeAsset[]>;
|
|
159
|
-
type AssetFeeMap = Record<Address, bigint
|
|
385
|
+
type AssetFeeMap = Record<string, Partial<Record<Address | 'NATIVE', bigint>>>;
|
|
160
386
|
|
|
161
387
|
type BridgeServicesMap = Map<BridgeType, BridgeService>;
|
|
162
388
|
type BridgeServiceConfig = {
|
|
163
389
|
environment: Environment;
|
|
164
390
|
enabledBridgeServices: BridgeServicesMap;
|
|
165
391
|
};
|
|
166
|
-
|
|
167
|
-
declare const createUnifiedBridgeService: ({ environment, enabledBridgeServices }: BridgeServiceConfig) => {
|
|
168
|
-
environment: Environment;
|
|
169
|
-
getAssets: () => Promise<ChainAssetMap>;
|
|
170
|
-
getFees: (params: FeeParams) => Promise<AssetFeeMap>;
|
|
171
|
-
estimateGas: (params: TransferParams) => Promise<bigint>;
|
|
392
|
+
type UnifiedBridgeService = Omit<BridgeService, 'type'> & {
|
|
172
393
|
canTransferAsset: (asset: BridgeAsset, targetChainId: string) => boolean;
|
|
173
|
-
|
|
174
|
-
trackTransfer: (params: TrackingParams) => {
|
|
175
|
-
cancel: () => void;
|
|
176
|
-
result: Promise<BridgeTransfer>;
|
|
177
|
-
};
|
|
394
|
+
environment: Environment;
|
|
178
395
|
};
|
|
179
396
|
|
|
397
|
+
declare const createUnifiedBridgeService: ({ environment, enabledBridgeServices }: BridgeServiceConfig) => UnifiedBridgeService;
|
|
398
|
+
|
|
180
399
|
type Caip2ChainId = {
|
|
181
400
|
namespace: string;
|
|
182
401
|
reference: string;
|
|
@@ -184,8 +403,16 @@ type Caip2ChainId = {
|
|
|
184
403
|
declare const _default: {
|
|
185
404
|
toJSON: (identifier: string) => Caip2ChainId;
|
|
186
405
|
toString: ({ namespace, reference }: Caip2ChainId) => string;
|
|
406
|
+
toEip155HexChainId: ({ namespace, reference }: Caip2ChainId) => string;
|
|
187
407
|
};
|
|
188
408
|
|
|
189
|
-
|
|
409
|
+
/**
|
|
410
|
+
* Gets the estimated bridging time in hours for a given Lombard bridge type
|
|
411
|
+
* @param bridgeType - The bridge type (LOMBARD_BTC_TO_BTCB or LOMBARD_BTCB_TO_BTC)
|
|
412
|
+
* @returns The estimated bridging time in hours
|
|
413
|
+
*/
|
|
414
|
+
declare const getEstimatedBridgingTime: (bridgeType: BridgeType) => number | undefined;
|
|
415
|
+
|
|
416
|
+
declare const getEnabledBridgeServices: (environment: Environment, enabledBridgeInitializers: BridgeInitializer[]) => Promise<BridgeServicesMap>;
|
|
190
417
|
|
|
191
|
-
export { Asset, AssetFeeMap, BridgeAsset, BridgeService, BridgeServiceConfig, BridgeServiceFactory, BridgeServicesMap, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, Chain, ChainAssetMap, DestinationInfo,
|
|
418
|
+
export { AVALANCHE_FUJI_CHAIN, AVALANCHE_MAINNET_CHAIN, AnalyzeTxParams, AnalyzeTxResult, ArrayElement, Asset, AssetFeeMap, AvaToBtcBridgeInitializer, AvalancheChainIds, BITCOIN_MAINNET_CHAIN, BITCOIN_TESTNET_CHAIN, BTC_BRIDGE_TYPES, BitcoinChainIds, BitcoinFunctions, BitcoinInputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinTx, BridgeAsset, BridgeInitializer, BridgeService, BridgeServiceConfig, BridgeServiceFactory, BridgeServicesMap, BridgeSignatureReason, BridgeStepDetails, BridgeTransfer, BridgeType, BtcDispatch, BtcSign, BtcSigner, BtcToAvaBridgeInitializer, BtcTransactionRequest, Chain, ChainAssetMap, DestinationInfo, ETHEREUM_MAINNET_CHAIN, ETHEREUM_SEPOLIA_CHAIN, EVM_BRIDGE_TYPES, Environment, Erc20Asset, ErrorCode, ErrorReason, EthereumChainIds, EvmBridgeInitializer, EvmDispatch, EvmSign, EvmSignMessage, EvmSigner, EvmSignerWithMessage, EvmTransactionRequest, FeeParams, GasEstimationParams, GasSettings, Hex, LombardBridgeInitializer, NativeAsset, TokenType, TrackingParams, TransferParams, UnifiedBridgeService, _default as caip2, createUnifiedBridgeService, getEnabledBridgeServices, getEstimatedBridgingTime, isAvaToBtcBridgeInitializer, isBtcToAvaBridgeInitializer, isErc20Asset, isEvmBridgeInitializer, isLombardBridgeInitializer, isNativeAsset };
|