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