@avalabs/core-bridge-sdk 2.8.0-alpha.197

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (140) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +10 -0
  3. package/dist/index.d.ts +850 -0
  4. package/dist/index.js +1 -0
  5. package/esm/abi/erc20.abi.json.js +1 -0
  6. package/esm/abi/wavax.abi.json.js +1 -0
  7. package/esm/abi/weth.abi.json.js +1 -0
  8. package/esm/constants.js +1 -0
  9. package/esm/contexts/BridgeSDKProvider.d.ts +8 -0
  10. package/esm/contexts/BridgeSDKProvider.js +1 -0
  11. package/esm/contexts/TokenInfoProvider.d.ts +9 -0
  12. package/esm/contexts/TokenInfoProvider.js +1 -0
  13. package/esm/contexts/models.d.ts +26 -0
  14. package/esm/hooks/useBridgeConfig.d.ts +13 -0
  15. package/esm/hooks/useBridgeConfig.js +1 -0
  16. package/esm/hooks/useBridgeConfigUpdater.d.ts +16 -0
  17. package/esm/hooks/useBridgeConfigUpdater.js +1 -0
  18. package/esm/hooks/useBridgeFeeEstimate.d.ts +9 -0
  19. package/esm/hooks/useBridgeFeeEstimate.js +1 -0
  20. package/esm/hooks/useCheckHistoryForNewTxEVM.d.ts +11 -0
  21. package/esm/hooks/useCheckHistoryForNewTxEVM.js +1 -0
  22. package/esm/hooks/useGetAirdropAmount.d.ts +8 -0
  23. package/esm/hooks/useGetAirdropAmount.js +1 -0
  24. package/esm/hooks/useGetTokenBalanceEVM.d.ts +14 -0
  25. package/esm/hooks/useGetTokenBalanceEVM.js +1 -0
  26. package/esm/hooks/useGetTokenBalancesEVM.d.ts +16 -0
  27. package/esm/hooks/useGetTokenBalancesEVM.js +1 -0
  28. package/esm/hooks/useGetTokenSymbolOnNetwork.d.ts +7 -0
  29. package/esm/hooks/useGetTokenSymbolOnNetwork.js +1 -0
  30. package/esm/hooks/useHasEnoughForGas.d.ts +6 -0
  31. package/esm/hooks/useHasEnoughForGas.js +1 -0
  32. package/esm/hooks/useIsAddressSanctioned.d.ts +3 -0
  33. package/esm/hooks/useIsAddressSanctioned.js +1 -0
  34. package/esm/hooks/useMaxTransferAmount.d.ts +13 -0
  35. package/esm/hooks/useMaxTransferAmount.js +1 -0
  36. package/esm/hooks/useMinimumTransferAmount.d.ts +9 -0
  37. package/esm/hooks/useMinimumTransferAmount.js +1 -0
  38. package/esm/hooks/usePrice.d.ts +11 -0
  39. package/esm/hooks/usePrice.js +1 -0
  40. package/esm/hooks/usePriceForChain.d.ts +6 -0
  41. package/esm/hooks/usePriceForChain.js +1 -0
  42. package/esm/hooks/useResetTransactionDetailsFromParams.d.ts +8 -0
  43. package/esm/hooks/useResetTransactionDetailsFromParams.js +1 -0
  44. package/esm/hooks/useSubscribeForNewTransactionFromBridge.d.ts +7 -0
  45. package/esm/hooks/useSubscribeForNewTransactionFromBridge.js +1 -0
  46. package/esm/hooks/useTimer.d.ts +10 -0
  47. package/esm/hooks/useTimer.js +1 -0
  48. package/esm/hooks/useTransferAssetBTC.d.ts +13 -0
  49. package/esm/hooks/useTransferAssetBTC.js +1 -0
  50. package/esm/hooks/useTransferAssetEVM.d.ts +23 -0
  51. package/esm/hooks/useTransferAssetEVM.js +1 -0
  52. package/esm/hooks/useTxTracker.d.ts +31 -0
  53. package/esm/hooks/useTxTracker.js +1 -0
  54. package/esm/hooks/useWaitForConfirmations.d.ts +10 -0
  55. package/esm/hooks/useWaitForConfirmations.js +1 -0
  56. package/esm/index.d.ts +56 -0
  57. package/esm/index.js +1 -0
  58. package/esm/lib/btc/address.d.ts +17 -0
  59. package/esm/lib/btc/address.js +1 -0
  60. package/esm/lib/btc/getBridgeFeeEstimateBTC.d.ts +18 -0
  61. package/esm/lib/btc/getBridgeFeeEstimateBTC.js +1 -0
  62. package/esm/lib/btc/getBtcAsset.d.ts +8 -0
  63. package/esm/lib/btc/getBtcAsset.js +1 -0
  64. package/esm/lib/btc/getBtcTransaction.d.ts +24 -0
  65. package/esm/lib/btc/getBtcTransaction.js +1 -0
  66. package/esm/lib/btc/getBtcTransactionDetails.d.ts +22 -0
  67. package/esm/lib/btc/getBtcTransactionDetails.js +1 -0
  68. package/esm/lib/btc/getMinimumTransferAmount.d.ts +12 -0
  69. package/esm/lib/btc/getMinimumTransferAmount.js +1 -0
  70. package/esm/lib/btc/getTxConfirmations.d.ts +12 -0
  71. package/esm/lib/btc/getTxConfirmations.js +1 -0
  72. package/esm/lib/btc/models.d.ts +5 -0
  73. package/esm/lib/btc/utils.d.ts +6 -0
  74. package/esm/lib/btc/utils.js +1 -0
  75. package/esm/lib/checkHistoryForNewTxEVM.d.ts +15 -0
  76. package/esm/lib/checkHistoryForNewTxEVM.js +1 -0
  77. package/esm/lib/fetchConfig.d.ts +8 -0
  78. package/esm/lib/fetchConfig.js +1 -0
  79. package/esm/lib/fetchTokenBalances.d.ts +10 -0
  80. package/esm/lib/fetchTokenBalances.js +1 -0
  81. package/esm/lib/getAssets.d.ts +14 -0
  82. package/esm/lib/getAssets.js +1 -0
  83. package/esm/lib/getBridgeFeeEstimateEVM.d.ts +20 -0
  84. package/esm/lib/getBridgeFeeEstimateEVM.js +1 -0
  85. package/esm/lib/getDynamicFeeAmount.js +1 -0
  86. package/esm/lib/getMaxTransferAmount.d.ts +16 -0
  87. package/esm/lib/getMaxTransferAmount.js +1 -0
  88. package/esm/lib/getMinimumTransferAmountEVM.js +1 -0
  89. package/esm/lib/hasAddressVulnerableMultichainApproval.js +1 -0
  90. package/esm/lib/models.d.ts +62 -0
  91. package/esm/lib/models.js +1 -0
  92. package/esm/lib/tracker/Tracker.js +1 -0
  93. package/esm/lib/tracker/getBlockNumberBitcoin.js +1 -0
  94. package/esm/lib/tracker/getBlockNumberEVM.js +1 -0
  95. package/esm/lib/tracker/getBridgeFeeActualEVM.js +1 -0
  96. package/esm/lib/tracker/getEVMProvider.js +1 -0
  97. package/esm/lib/tracker/getIntervalTime.js +1 -0
  98. package/esm/lib/tracker/getNetworkFeeEVM.js +1 -0
  99. package/esm/lib/tracker/getSourceTxDataBitcoin.js +1 -0
  100. package/esm/lib/tracker/getSourceTxDataEVM.js +1 -0
  101. package/esm/lib/tracker/getTargetTxDataBitcoin.js +1 -0
  102. package/esm/lib/tracker/getTargetTxDataEVM.js +1 -0
  103. package/esm/lib/tracker/models.d.ts +15 -0
  104. package/esm/lib/tracker/trackBridgeTransaction.d.ts +28 -0
  105. package/esm/lib/tracker/trackBridgeTransaction.js +1 -0
  106. package/esm/lib/transferAssetBTC.d.ts +19 -0
  107. package/esm/lib/transferAssetBTC.js +1 -0
  108. package/esm/lib/transferAssetEVM.d.ts +28 -0
  109. package/esm/lib/transferAssetEVM.js +1 -0
  110. package/esm/lib/unwrapAsset.d.ts +11 -0
  111. package/esm/lib/unwrapAsset.js +1 -0
  112. package/esm/lib/wrapAsset.d.ts +17 -0
  113. package/esm/lib/wrapAsset.js +1 -0
  114. package/esm/runtime/config.d.ts +17 -0
  115. package/esm/runtime/config.js +1 -0
  116. package/esm/runtime/nativeAssets.js +1 -0
  117. package/esm/types/config.d.ts +297 -0
  118. package/esm/types/config.js +1 -0
  119. package/esm/types/tokenInfo.d.ts +7 -0
  120. package/esm/utils/asset.d.ts +7 -0
  121. package/esm/utils/asset.js +1 -0
  122. package/esm/utils/bignumber.d.ts +10 -0
  123. package/esm/utils/bignumber.js +1 -0
  124. package/esm/utils/config.d.ts +15 -0
  125. package/esm/utils/config.js +1 -0
  126. package/esm/utils/estimateGas.d.ts +17 -0
  127. package/esm/utils/estimateGas.js +1 -0
  128. package/esm/utils/formatTokenAmount.d.ts +5 -0
  129. package/esm/utils/formatTokenAmount.js +1 -0
  130. package/esm/utils/getContract.js +1 -0
  131. package/esm/utils/getGasAsset.js +1 -0
  132. package/esm/utils/getNativeSymbol.d.ts +5 -0
  133. package/esm/utils/getNativeSymbol.js +1 -0
  134. package/esm/utils/isAddressBlocklisted.d.ts +9 -0
  135. package/esm/utils/isAddressBlocklisted.js +1 -0
  136. package/esm/utils/loadTokenInfo.js +1 -0
  137. package/esm/utils/usdFormatter.d.ts +3 -0
  138. package/esm/utils/usdFormatter.js +1 -0
  139. package/esm/utils/wrapUtils.js +1 -0
  140. package/package.json +51 -0
@@ -0,0 +1,850 @@
1
+ import Big from 'big.js';
2
+ import { Maybe } from '@avalabs/core-utils-sdk';
3
+ import { TransactionResponse, Block, Provider, JsonRpcProvider, JsonRpcApiProvider, TransactionRequest } from 'ethers';
4
+ import { VsCurrencyType } from '@avalabs/core-coingecko-sdk';
5
+ import { Psbt } from 'bitcoinjs-lib';
6
+ import * as _avalabs_core_wallets_sdk from '@avalabs/core-wallets-sdk';
7
+ import { BitcoinInputUTXO, BitcoinOutputUTXO, BitcoinInputUTXOWithOptionalScript, BitcoinProvider } from '@avalabs/core-wallets-sdk';
8
+ import { BridgeConfig as BridgeConfig$1 } from 'types';
9
+
10
+ declare enum Blockchain {
11
+ AVALANCHE = "avalanche",
12
+ ETHEREUM = "ethereum",
13
+ BITCOIN = "bitcoin",
14
+ UNKNOWN = ""
15
+ }
16
+ declare enum NetworkType {
17
+ MAINNET = "mainnet",
18
+ TESTNET = "testnet"
19
+ }
20
+ declare enum Environment {
21
+ DEV = "development",
22
+ STAGING = "staging",
23
+ TEST = "test",
24
+ PROD = "prod"
25
+ }
26
+ interface RuntimeConfig {
27
+ environment: Environment;
28
+ bridgeUrl: string;
29
+ tokenInfoUrl: string;
30
+ configMismatchThreshold: number;
31
+ wardenConfigURLs: string[];
32
+ avalancheNetworkConfig: AddEthereumChainParameter;
33
+ ethereumNetworkConfig: {
34
+ chainId: number;
35
+ rpcUrls: string[];
36
+ };
37
+ disabledTokensOnNetwork: Partial<Record<Blockchain, string[]>>;
38
+ }
39
+ interface EthereumCriticalConfigBase extends CriticalConfigBase {
40
+ networks: Partial<Record<Blockchain, number | undefined>>;
41
+ walletAddresses: Partial<Record<Blockchain, string>>;
42
+ addressBlocklist: string[];
43
+ }
44
+ interface EthereumStaticFeeCriticalConfig extends EthereumCriticalConfigBase {
45
+ assets: EthereumStaticFeeConfigAssets;
46
+ useNewFeeStructure?: false;
47
+ }
48
+ interface EthereumDynamicFeeCriticalConfig extends EthereumCriticalConfigBase {
49
+ assets: EthereumDynamicFeeConfigAssets;
50
+ useNewFeeStructure: true;
51
+ }
52
+ interface EthereumNonCriticalConfigBase {
53
+ minimumConfirmations: Partial<Record<Blockchain, number | undefined>>;
54
+ currentEthPrice: string;
55
+ currentAvaxPrice: string;
56
+ currentGasPrices: Record<Blockchain.AVALANCHE | Blockchain.ETHEREUM, {
57
+ nextBaseFee: string;
58
+ suggestedTip: string;
59
+ }>;
60
+ /** Timestamp */
61
+ updated: string;
62
+ useChainlinkAssetPriceFeeds?: boolean;
63
+ chainlinkAvaxUsdFeedAddress?: string;
64
+ chainlinkEthUsdFeedAddress?: string;
65
+ chainlinkBtcUsdFeedAddress?: string;
66
+ /** Timestamp */
67
+ startupTime: string;
68
+ }
69
+ interface EthereumStaticFeeNonCriticalConfig extends EthereumNonCriticalConfigBase {
70
+ unwrapFeeApproximation: Record<string, string>;
71
+ wrapFeeApproximation: Record<string, string>;
72
+ }
73
+ interface EthereumDynamicFeeNonCriticalConfig extends EthereumNonCriticalConfigBase {
74
+ unwrapFeeApproximation: Record<string, DynamicFeeEstimation>;
75
+ wrapFeeApproximation: Record<string, DynamicFeeEstimation>;
76
+ }
77
+ interface CriticalConfigBase {
78
+ disableFrontend: boolean;
79
+ operationMode: string;
80
+ operatorEvmAddress?: string;
81
+ operatorAddress: string;
82
+ targetSecretVersion?: number;
83
+ useEip1559TransactionFormat?: boolean;
84
+ }
85
+ interface BitcoinCriticalConfigBase extends CriticalConfigBase {
86
+ addressBlocklist: string[];
87
+ avalancheChainId: number;
88
+ useEip1559TransactionFormat: boolean;
89
+ walletAddresses: {
90
+ avalanche: string;
91
+ btc: string;
92
+ };
93
+ offboardDelaySeconds: number;
94
+ }
95
+ interface BitcoinStaticFeeCriticalConfig extends BitcoinCriticalConfigBase {
96
+ bitcoinAssets: BitcoinStaticFeeConfigAssets;
97
+ useNewFeeStructure?: false;
98
+ }
99
+ interface BitcoinDynamicFeeCriticalConfig extends BitcoinCriticalConfigBase {
100
+ bitcoinAssets: BitcoinDynamicFeeConfigAssets;
101
+ useNewFeeStructure: true;
102
+ }
103
+ interface BitcoinStaticBridgeFeeEstimate {
104
+ wrapFeeAmount: number;
105
+ constUnwrapFeeAmount: number;
106
+ unwrapFeeNumerator: number;
107
+ unwrapFeeDenominator: number;
108
+ dustThreshold: number;
109
+ }
110
+ interface BitcoinDynamicBridgeFeeEstimate {
111
+ dustThreshold: number;
112
+ wrapFeeEstimate: DynamicFeeEstimation;
113
+ unwrapFeeEstimate: {
114
+ bridgeToll: DynamicFeeEstimation;
115
+ estimatedTxFee: {
116
+ constAmount: number;
117
+ numeratorPerSat: number;
118
+ denominatorPerSat: number;
119
+ };
120
+ };
121
+ }
122
+ interface BitcoinNetworkInfoBase {
123
+ minimumConfirmations: number;
124
+ minimumOnboardSize: number;
125
+ currentPrice: string;
126
+ currentFeeRate: {
127
+ feeRate: number;
128
+ source: string;
129
+ };
130
+ currentUtxoStatistics: {
131
+ [hash: string]: {
132
+ mean: string;
133
+ count: string;
134
+ };
135
+ };
136
+ reserveBalance: number;
137
+ networkView: {
138
+ lastIndexedBlock: number;
139
+ lastSeenBlock: number;
140
+ nodeVersion: string;
141
+ };
142
+ }
143
+ interface BitcoinStaticFeeNetworkInfo extends BitcoinNetworkInfoBase {
144
+ currentBridgeFeeEstimate: BitcoinStaticBridgeFeeEstimate;
145
+ }
146
+ interface BitcoinDynamicFeeNetworkInfo extends BitcoinNetworkInfoBase {
147
+ currentBridgeFeeEstimate: BitcoinDynamicBridgeFeeEstimate;
148
+ }
149
+ interface BitcoinNonCriticalConfig<T> {
150
+ networkInfo: {
151
+ btc: T;
152
+ };
153
+ /** Timestamp */
154
+ updated: string;
155
+ }
156
+ interface BitcoinStaticFeeConfig {
157
+ criticalBitcoin: BitcoinStaticFeeCriticalConfig;
158
+ nonCriticalBitcoin: BitcoinNonCriticalConfig<BitcoinStaticFeeNetworkInfo>;
159
+ }
160
+ interface BitcoinDynamicFeeConfig {
161
+ criticalBitcoin: BitcoinDynamicFeeCriticalConfig;
162
+ nonCriticalBitcoin: BitcoinNonCriticalConfig<BitcoinDynamicFeeNetworkInfo>;
163
+ }
164
+ interface EthereumStaticFeeConfig {
165
+ critical: EthereumStaticFeeCriticalConfig;
166
+ nonCritical: EthereumStaticFeeNonCriticalConfig;
167
+ }
168
+ interface EthereumDynamicFeeConfig {
169
+ critical: EthereumDynamicFeeCriticalConfig;
170
+ nonCritical: EthereumDynamicFeeNonCriticalConfig;
171
+ }
172
+ interface AppConfigBase {
173
+ startupTime: string;
174
+ version: string;
175
+ }
176
+ interface AppConfigWithDynamicFeesForEthereum extends AppConfigBase, EthereumDynamicFeeConfig, BitcoinStaticFeeConfig {
177
+ }
178
+ interface AppConfigWithDynamicFeesForBitcoin extends AppConfigBase, EthereumStaticFeeConfig, BitcoinDynamicFeeConfig {
179
+ }
180
+ type AppConfigWithStaticFeesForEthereum = AppConfigWithFullStaticFees | AppConfigWithDynamicFeesForBitcoin;
181
+ type AppConfigWithStaticFeesForBitcoin = AppConfigWithFullStaticFees | AppConfigWithDynamicFeesForEthereum;
182
+ interface AppConfigWithFullDynamicFees extends AppConfigBase, EthereumDynamicFeeConfig, BitcoinDynamicFeeConfig {
183
+ }
184
+ interface AppConfigWithFullStaticFees extends AppConfigBase, EthereumStaticFeeConfig, BitcoinStaticFeeConfig {
185
+ }
186
+ type AppConfig = AppConfigWithFullStaticFees | AppConfigWithFullDynamicFees | AppConfigWithDynamicFeesForEthereum | AppConfigWithDynamicFeesForBitcoin;
187
+ type CriticalConfig = Pick<AppConfig, 'critical' | 'criticalBitcoin'>;
188
+ type NonCriticalConfig = Pick<AppConfig, 'nonCritical' | 'nonCriticalBitcoin'>;
189
+ type BridgeConfig = {
190
+ config?: AppConfig;
191
+ error?: any;
192
+ };
193
+ declare enum AssetType {
194
+ NATIVE = 0,
195
+ ERC20 = 1,
196
+ BTC = 2
197
+ }
198
+ interface Assets {
199
+ [symbol: string]: Asset;
200
+ }
201
+ type EthereumStaticFeeConfigAssets = Record<string, EthereumStaticFeeAssetConfig>;
202
+ type EthereumDynamicFeeConfigAssets = Record<string, EthereumDynamicFeeAssetConfig>;
203
+ type EthereumConfigAssets = EthereumStaticFeeConfigAssets | EthereumDynamicFeeConfigAssets;
204
+ interface BitcoinStaticFeeConfigAsset extends BitcoinConfigAsset {
205
+ offboardFeeDollars: number;
206
+ onboardFeeDollars: number;
207
+ }
208
+ interface BitcoinDynamicFeeConfigAsset extends BitcoinConfigAsset {
209
+ offboardFeeConfiguration: DynamicFeeConfiguration;
210
+ onboardFeeConfiguration: DynamicFeeConfiguration;
211
+ }
212
+ type BitcoinStaticFeeConfigAssets = Record<string, BitcoinStaticFeeConfigAsset>;
213
+ type BitcoinDynamicFeeConfigAssets = Record<string, BitcoinDynamicFeeConfigAsset>;
214
+ type BitcoinConfigAssets = BitcoinStaticFeeConfigAssets | BitcoinDynamicFeeConfigAssets;
215
+ /**
216
+ * Bridge assets can fall into one of these categories
217
+ */
218
+ type Asset = EthereumConfigAsset | NativeAsset | BitcoinConfigAsset;
219
+ /**
220
+ * Must exist on every asset.
221
+ * This data is added to the raw config when it is fetched.
222
+ */
223
+ interface AssetBase {
224
+ symbol: string;
225
+ tokenName: string;
226
+ assetType: AssetType;
227
+ nativeNetwork: Blockchain;
228
+ denomination: number;
229
+ }
230
+ type DynamicFeeConfiguration = {
231
+ feePercentage: number;
232
+ feePercentageDecimals: number;
233
+ maximumFeeDollars: number;
234
+ minimumFeeDollars: number;
235
+ };
236
+ type DynamicFeeEstimation = {
237
+ minimumFeeAmount: string;
238
+ maximumFeeAmount: string;
239
+ feePercentage: number;
240
+ feePercentageDecimals: number;
241
+ };
242
+ interface EthereumAssetConfigBase extends AssetBase {
243
+ avaxPromotionDollarThreshold: number;
244
+ avaxPromotionAmount: string;
245
+ chainlinkFeedAddress?: string;
246
+ chainlinkFeedNetwork?: string;
247
+ ipfsHash?: string;
248
+ transferGasLimit?: number;
249
+ nativeContractAddress: string;
250
+ wrappedContractAddress: string;
251
+ wrappedNetwork: string;
252
+ deprecatedTokenContractAddress?: string;
253
+ offboardFeeProcessThreshold: string;
254
+ }
255
+ interface EthereumStaticFeeAssetConfig extends EthereumAssetConfigBase {
256
+ maximumOnboardFee?: string;
257
+ onboardFeeDollars?: number;
258
+ offboardFeeDollars: number;
259
+ onboardFeePercentage?: string;
260
+ }
261
+ interface EthereumDynamicFeeAssetConfig extends EthereumAssetConfigBase {
262
+ offboardFeeConfiguration: DynamicFeeConfiguration;
263
+ onboardFeeConfiguration: DynamicFeeConfiguration;
264
+ }
265
+ /**
266
+ * For Ethereum <-> Avalanche assets
267
+ */
268
+ type EthereumConfigAsset = EthereumStaticFeeAssetConfig | EthereumDynamicFeeAssetConfig;
269
+ /**
270
+ * For Bitcoin <-> Avalanche assets
271
+ */
272
+ interface BitcoinConfigAsset extends AssetBase {
273
+ additionalTxFeeAmount: number;
274
+ avaxPromotionAmount: string;
275
+ avaxPromotionDollarThreshold: number;
276
+ bech32AddressPrefix: string;
277
+ operatorAddress: string;
278
+ privateKeyPrefix: string;
279
+ reserveBalanceHighWaterMark: number;
280
+ reserveBalanceLowWaterMark: number;
281
+ targetChangeAmount: number;
282
+ wrappedContractAddress: string;
283
+ wrappedNetwork: string;
284
+ }
285
+ /**
286
+ * Currently used only for native Ethereum since it is not provided in the bridge config.
287
+ */
288
+ interface NativeAsset extends AssetBase {
289
+ assetType: AssetType.NATIVE;
290
+ wrappedAssetSymbol: string;
291
+ coingeckoId: string;
292
+ }
293
+ interface AddEthereumChainParameter {
294
+ chainId: string;
295
+ chainName: string;
296
+ nativeCurrency: {
297
+ name: string;
298
+ symbol: string;
299
+ decimals: number;
300
+ };
301
+ rpcUrls: string[];
302
+ blockExplorerUrls?: string[];
303
+ iconUrls?: string[];
304
+ }
305
+
306
+ interface TokenInfo {
307
+ logo: string;
308
+ coingeckoId: string;
309
+ }
310
+ type TokenInfoData = Record<string, TokenInfo>;
311
+
312
+ interface TransactionDetails {
313
+ tokenSymbol: string;
314
+ amount: Big;
315
+ }
316
+ type EthChains = Blockchain.ETHEREUM | Blockchain.AVALANCHE;
317
+ interface BridgeTransaction {
318
+ /** C-chain address */
319
+ addressC: string;
320
+ /** C-chain derived BTC address */
321
+ addressBTC: string;
322
+ /** The amount requested by the user to transfer */
323
+ amount: Big;
324
+ /** Token being transferred */
325
+ symbol: string;
326
+ /**
327
+ * The transaction was successfully created on the target blockchain and
328
+ * bridging is finished.
329
+ */
330
+ complete: boolean;
331
+ completedAt?: number;
332
+ /** Set when there is an error with transaction tracking */
333
+ error?: any;
334
+ /** The network environment */
335
+ environment: 'main' | 'test';
336
+ sourceChain: Blockchain;
337
+ /** When tracking the source confirmations started */
338
+ sourceStartedAt: number;
339
+ sourceTxHash: string;
340
+ sourceNetworkFee?: Big;
341
+ confirmationCount: number;
342
+ requiredConfirmationCount: number;
343
+ targetChain: Blockchain;
344
+ /** When tracking the target transaction started */
345
+ targetStartedAt?: number;
346
+ targetTxHash?: string;
347
+ /**
348
+ * The fee paid to the bridge operators
349
+ * (paid from the transferred asset e.g. LINK or WETH)
350
+ */
351
+ targetBridgeFee?: Big;
352
+ /**
353
+ * The fee paid to the blockchain
354
+ * (paid in the native token e.g. ETH or AVAX)
355
+ */
356
+ targetNetworkFee?: Big;
357
+ /** Block number used to find the target transaction hash */
358
+ startBlockNumber?: number;
359
+ }
360
+ type TxHash = string;
361
+ declare enum WrapStatus {
362
+ INITIAL = 0,
363
+ WAITING_FOR_DEPOSIT_CONFIRMATION = 1,
364
+ WAITING_FOR_DEPOSIT = 2,
365
+ WAITING_FOR_CONFIRMATION = 3,
366
+ COMPLETE = 4,
367
+ VULNERABLE_ADDRESS = 5
368
+ }
369
+
370
+ type EthereumAssets = Record<string, NativeAsset | EthereumConfigAsset>;
371
+ type AvalancheAssets = Record<string, BitcoinConfigAsset | EthereumConfigAsset>;
372
+ interface BridgeSDKState {
373
+ ethereumAssets: EthereumAssets;
374
+ ethereumWrappedAssets: EthereumConfigAssets;
375
+ avalancheAssets: AvalancheAssets;
376
+ sourceAssets: Assets;
377
+ bitcoinAssets: BitcoinConfigAssets;
378
+ bridgeConfig: BridgeConfig;
379
+ setBridgeConfig: (bridgeConfig: BridgeConfig) => void;
380
+ criticalConfig?: CriticalConfig;
381
+ currentBlockchain: Blockchain;
382
+ setCurrentBlockchain: (blockchain: Blockchain) => void;
383
+ targetBlockchain: Blockchain;
384
+ currentAsset?: string;
385
+ currentAssetData?: Asset;
386
+ setCurrentAsset: (symbol: string) => void;
387
+ transactionDetails?: TransactionDetails;
388
+ setTransactionDetails: (transactionDetails: TransactionDetails) => void;
389
+ targetChains: Blockchain[];
390
+ }
391
+
392
+ declare function useBridgeSDK(): BridgeSDKState;
393
+ declare function BridgeSDKProvider({ children }: {
394
+ children: JSX.Element;
395
+ }): JSX.Element;
396
+
397
+ declare const initalState: {};
398
+ declare const TokenInfoProvider: ({ children }: {
399
+ children: any;
400
+ }) => JSX.Element;
401
+ declare function useTokenInfoContext(): TokenInfoData | undefined;
402
+
403
+ /**
404
+ * Get the bridge config from the bridge context. Use
405
+ * useBridgeConfigUpdater() to ensure that the bridge config is
406
+ * periodically re-fetch.
407
+ *
408
+ * @example
409
+ * const { config, error } = useBridgeConfig();
410
+ */
411
+ declare function useBridgeConfig(): BridgeConfig;
412
+
413
+ /**
414
+ * Use to periodically re-fetch the bridge config. This is needed in case any of
415
+ * the wardens returns disableFrontend === true which should shutdown the
416
+ * frontend immediately.
417
+ *
418
+ * @param fetchFn use fetchConfig() by default, this param is provided so it can
419
+ * be customized in the extension.
420
+ *
421
+ * @example
422
+ * useBridgeConfigUpdater(() => fetchConfig("main"));
423
+ */
424
+ declare function useBridgeConfigUpdater(fetchFn: () => Promise<BridgeConfig>): void;
425
+
426
+ declare function isBech32Address(btcAddress: string): boolean;
427
+ /**
428
+ * In addition to Bech32 validation, it makes sure that the address is from the correct network.
429
+ */
430
+ declare function isBech32AddressInNetwork(btcAddress: string, isMainnet: boolean): boolean;
431
+ /**
432
+ * Verify if its a valid base 58 encoded address
433
+ */
434
+ declare function isBase58Address(addr: string): boolean;
435
+ /**
436
+ * Verify if address is valid base58 and matches the network
437
+ * @param addr P2PKH or P2SH address to verify
438
+ * @param isMainnet If true will verify it's a valid mainnet address
439
+ */
440
+ declare function isBase58AddressInNetwork(addr: string, isMainnet: boolean): boolean;
441
+
442
+ type BtcBlockchains = Blockchain.AVALANCHE | Blockchain.BITCOIN;
443
+
444
+ /**
445
+ * Return the estimated bridge fee that will be paid to the bridge operators.
446
+ */
447
+ declare function getBridgeFeeEstimateBTC({ source, config, amount, }: {
448
+ source: BtcBlockchains;
449
+ config: AppConfig;
450
+ amount: Big;
451
+ }): Big;
452
+ /**
453
+ * Legacy (static) fee estimation for BTC
454
+ */
455
+ declare function getStaticBridgeFeeEstimateBTC(source: BtcBlockchains, config: AppConfigWithStaticFeesForBitcoin, amountInSatoshis: number): Big;
456
+
457
+ /**
458
+ * Get the BTC native asset on the bitcoin network.
459
+ */
460
+ declare function getBtcAsset(config: CriticalConfig): BitcoinConfigAsset | undefined;
461
+
462
+ /**
463
+ * Bitcoin to Avalanche
464
+ * @param changeAddress: The user's C-chain derived BTC address. Change UTXO will be sent to this address.
465
+ * @param config: Configuration file for the bridge.
466
+ * @param utxos: The available UTXOs to consume.
467
+ * @param amount: The amount to wrap in satoshis. Must cover the `bridgeFee`.
468
+ * @param feeRate: Fee rate given in satoshis per byte.
469
+ * @throws when the transaction cannot be created
470
+ */
471
+ declare function getBtcTransaction(config: AppConfig, changeAddress: string, utxos: BitcoinInputUTXO[], amount: number, feeRate: number): {
472
+ /** The total fee (bridge fee + tx fee) */
473
+ fee: number;
474
+ tx: Psbt;
475
+ bridgeFee: number;
476
+ receiveAmount: number;
477
+ inputs: BitcoinInputUTXO[];
478
+ outputs: BitcoinOutputUTXO[];
479
+ };
480
+
481
+ /**
482
+ * Bitcoin to Avalanche
483
+ * @param config: Configuration file for the bridge.
484
+ * @param changeAddress: The user's C-chain derived BTC address. Change UTXO will be sent to this address.
485
+ * @param utxos: The available UTXOs to consume.
486
+ * @param amount: The amount to wrap in satoshis. Must cover the `bridgeFee`.
487
+ * @param feeRate: Fee rate given in satoshis per byte.
488
+ * @throws when the transaction is invalid
489
+ */
490
+ declare function getBtcTransactionDetails(config: AppConfig, changeAddress: string, utxos: BitcoinInputUTXOWithOptionalScript[], amount: number, feeRate: number): {
491
+ /** The total fee (bridge fee + tx fee) */
492
+ fee: number;
493
+ bridgeFee: number;
494
+ receiveAmount: number;
495
+ inputs: BitcoinInputUTXOWithOptionalScript[];
496
+ outputs: BitcoinOutputUTXO[];
497
+ };
498
+
499
+ /**
500
+ * Returns the minimum amount (in satoshis) can be sent to the bridge.
501
+ * @param source
502
+ * @param config
503
+ * @param amount
504
+ */
505
+ declare function getMinimumTransferAmount(source: BtcBlockchains, config: AppConfig, amount: number): number;
506
+
507
+ declare function getTxDetails(txHash: string, provider: BitcoinProvider): Promise<_avalabs_core_wallets_sdk.BitcoinTx>;
508
+ /**
509
+ * Get the number of confirmations for a given transaction hash.
510
+ * @param txHash
511
+ * @param config
512
+ */
513
+ declare function getTxConfirmations(txHash: string, provider: BitcoinProvider): Promise<number>;
514
+
515
+ declare function btcToSatoshi(btc: Big): number;
516
+ declare function satoshiToBtc(satoshis: number): Big;
517
+
518
+ type Args = {
519
+ source: EthChains;
520
+ config: AppConfig;
521
+ asset: EthereumConfigAsset;
522
+ amount: Big;
523
+ };
524
+ /**
525
+ * Get Ethereum <-> Avalanche bridge fee estimate.
526
+ */
527
+ declare function getBridgeFeeEstimateEVM({ source, config, asset, amount, }: Args): Big;
528
+ /**
529
+ * Legacy (static) fee estimation for Ethereum
530
+ */
531
+ declare function getStaticBridgeFeeEstimateEVM(source: EthChains, config: AppConfigWithStaticFeesForEthereum, asset: EthereumConfigAsset): Big;
532
+
533
+ interface HistoryTxData {
534
+ transaction?: TransactionResponse;
535
+ block?: Block | null;
536
+ error?: string;
537
+ }
538
+ /**
539
+ * EVM specific function to search for a new bridge transaction.
540
+ */
541
+ declare function checkHistoryForNewTxEVM(network: Blockchain, provider: Provider, config: Maybe<AppConfig>, account: Maybe<string>, asset: Maybe<EthereumConfigAsset>, startBlockNumber: Maybe<number>): Promise<HistoryTxData | undefined>;
542
+
543
+ /**
544
+ * Get the config for working with either mainnet or testnet blockchains.
545
+ */
546
+ declare function fetchConfig(env?: Environment): Promise<BridgeConfig>;
547
+
548
+ /**
549
+ * Fetch token balances for EVM
550
+ */
551
+ declare function fetchTokenBalances(tokens: Record<string, Asset>, blockchain: Blockchain, provider: Provider, account: string, deprecated?: boolean): Promise<Record<string, Big>>;
552
+
553
+ /**
554
+ * Return the assets available for the given chain
555
+ * @param blockchain The blockchain to get asset dict for
556
+ * @param config The config of the bridge
557
+ */
558
+ declare function getAssets(blockchain: Blockchain.AVALANCHE, config: CriticalConfig): AvalancheAssets;
559
+ declare function getAssets(blockchain: Blockchain.BITCOIN, config: CriticalConfig): BitcoinConfigAssets;
560
+ declare function getAssets(blockchain: Blockchain.ETHEREUM, config: CriticalConfig): EthereumAssets;
561
+ declare function getAssets(blockchain: Blockchain, config: CriticalConfig): Assets;
562
+
563
+ type GetMaxTransferAmountParams = {
564
+ currentBlockchain: Blockchain;
565
+ currentAsset: string;
566
+ balance: Big;
567
+ assets: EthereumAssets | AvalancheAssets;
568
+ provider: JsonRpcProvider;
569
+ config: AppConfig;
570
+ };
571
+ declare function getMaxTransferAmount({ currentBlockchain, balance, currentAsset, assets, provider, config, }: GetMaxTransferAmountParams): Promise<Big | null>;
572
+
573
+ interface TrackerArgs {
574
+ bridgeTransaction: BridgeTransaction;
575
+ onBridgeTransactionUpdate: (bridgeTransaction: BridgeTransaction) => void;
576
+ config: AppConfig;
577
+ avalancheProvider: Provider;
578
+ ethereumProvider: Provider;
579
+ bitcoinProvider: BitcoinProvider;
580
+ }
581
+
582
+ interface TrackerSubscription {
583
+ /** Cancel tracking */
584
+ unsubscribe(): void;
585
+ /** A flag to indicate whether this has already been unsubscribed */
586
+ readonly closed: boolean;
587
+ }
588
+ /**
589
+ * Track a bridge transaction to completion.
590
+ *
591
+ * The process consists of two steps:
592
+ * - Ensure that the source blockchain has reached the required number of
593
+ * confirmations.
594
+ * - Watch for the new transaction to be created on the target blockchain.
595
+ *
596
+ * During the process `onBridgeTransactionUpdate` will be called when the state
597
+ * of the `bridgeTransaction` changes e.g. `confirmationCount`
598
+ *
599
+ * When the two steps finish `onBridgeTransactionUpdate` will be called a final
600
+ * time with `complete` set to true.
601
+ *
602
+ * @returns a subscription object that can be used to unsubscribe
603
+ * (e.g. when used in a `useEffect` hook)
604
+ */
605
+ declare function trackBridgeTransaction(args: TrackerArgs): TrackerSubscription;
606
+
607
+ type TransferAssetEVMParams = {
608
+ currentBlockchain: Blockchain.AVALANCHE | Blockchain.ETHEREUM;
609
+ amount: Big;
610
+ account: string;
611
+ asset: Asset;
612
+ avalancheProvider: JsonRpcApiProvider;
613
+ ethereumProvider: JsonRpcApiProvider;
614
+ config: AppConfig;
615
+ onStatusChange: (status: WrapStatus) => void;
616
+ onTxHashChange: (txHash: string) => void;
617
+ signAndSendEVM?: (txData: TransactionRequest) => Promise<TxHash>;
618
+ };
619
+ /**
620
+ * Transfer an ERC20 asset.
621
+ * When currentBlockchain is Avalanche the asset will be transferred to
622
+ * Ethereum and vice versa.
623
+ *
624
+ * @param signAndSendEVM Required when the provider for the currentBlockchain
625
+ * does not support signing transactions.
626
+ */
627
+ declare function transferAssetEVM({ currentBlockchain, amount, account, asset, avalancheProvider, ethereumProvider, config, onStatusChange, onTxHashChange, signAndSendEVM, }: TransferAssetEVMParams): Promise<TxHash>;
628
+
629
+ type BtcTransactionRequest = [
630
+ toAddress: string,
631
+ amount: string,
632
+ feeRate: number
633
+ ];
634
+ type TransferAssetBTCParams = {
635
+ amount: string;
636
+ feeRate: number;
637
+ config: AppConfig;
638
+ onStatusChange: (status: WrapStatus) => void;
639
+ onTxHashChange: (txHash: string) => void;
640
+ signAndSendBTC: (txParams: BtcTransactionRequest) => Promise<TxHash>;
641
+ };
642
+ declare const transferAssetBTC: ({ amount, feeRate, config, onStatusChange, onTxHashChange, signAndSendBTC, }: TransferAssetBTCParams) => Promise<string>;
643
+
644
+ /**
645
+ * Transfer from Avalanche to Ethereum or Bitcoin.
646
+ */
647
+ declare function unwrapAsset(amount: Big, account: string, asset: EthereumConfigAsset | BitcoinConfigAsset, provider: JsonRpcApiProvider, onTxHashChange: (txHash: string) => void, signAndSendEVM?: (txData: TransactionRequest) => Promise<TxHash>): Promise<TxHash>;
648
+
649
+ /**
650
+ * Transfer from Ethereum to Avalanche.
651
+ *
652
+ * @param wrappedAsset - must be provided when asset is of AssetType.NATIVE
653
+ * @param signAndSendEVM - Optional, provide when NOT using Metamask. Some
654
+ * providers like `InfuraProvider` don't support `getSigner` so
655
+ * `signAndSendEVM` is used to manually sign and send the transaction instead of calling
656
+ * `contract.transfer`.
657
+ */
658
+ declare function wrapAsset(amount: Big, account: string, asset: EthereumConfigAsset | NativeAsset, avalancheProvider: JsonRpcApiProvider, ethereumProvider: JsonRpcApiProvider, config: AppConfig, onStatusChange: (status: WrapStatus) => void, onTxHashChange: (txHash: string) => void, signAndSendEVM?: (txData: TransactionRequest) => Promise<TxHash>): Promise<TxHash>;
659
+
660
+ declare function useCheckHistoryForNewTxEVM(network: Blockchain, provider: Provider, account: Maybe<string>, asset: Maybe<EthereumConfigAsset>): {
661
+ checkHistoryForNewTx: () => Promise<HistoryTxData | undefined>;
662
+ startBlockNumber: number | undefined;
663
+ };
664
+
665
+ declare function useGetAirdropAmount(sourceNetwork: Blockchain, assetPrice: Big, transactionDetails: Maybe<TransactionDetails>, assetInfo: Maybe<EthereumConfigAsset | BitcoinConfigAsset>): () => number;
666
+
667
+ /**
668
+ * Fetch the account balance for the token on Ethereum or Avalanche.
669
+ * @param blockchain network to get the balances on
670
+ * @param asset the contract token (skips fetch when not defined)
671
+ * @param deprecated query the deprecated token balance instead of the regular
672
+ */
673
+ declare function useGetTokenBalanceEVM(blockchain: Blockchain.AVALANCHE | Blockchain.ETHEREUM, asset: Maybe<Asset>, provider: Provider, active: boolean, account: Maybe<string>, deprecated?: boolean): Big | undefined;
674
+
675
+ /**
676
+ * Fetch the account balances for the tokens.
677
+ * @param blockchain network to get the balances on
678
+ * @param tokens the list of contract tokens
679
+ * @param deprected query the deprecated token balance instead of the regular
680
+ */
681
+ declare function useGetTokenBalancesEVM(blockchain: Blockchain, tokens: Maybe<Record<string, Asset>>, provider: Provider, active: boolean, account: Maybe<string>, deprecated?: boolean): {
682
+ [key: string]: Big;
683
+ } | undefined;
684
+
685
+ declare function useGetTokenSymbolOnNetwork(): {
686
+ getTokenSymbolOnNetwork: (symbol: string, network: Blockchain) => string;
687
+ };
688
+
689
+ declare function useHasEnoughForGas(account: Maybe<string>, provider: Maybe<Provider>): boolean;
690
+
691
+ declare function useIsAddressSanctioned(address: string): boolean;
692
+
693
+ /**
694
+ * Calculates the approximate maximum abount transfarable for a given asset.
695
+ * For ERC20s it's always the user's max balance
696
+ * For native assets, since gas price is payed with the native asset,
697
+ * it's balance minus approximate transaction fees
698
+ */
699
+ declare function useMaxTransferAmount(balance: Maybe<Big>, account: Maybe<string>, provider: Maybe<JsonRpcProvider>): Big | null;
700
+
701
+ /**
702
+ * Returns the price of the input currency (default is USD)
703
+ * @param assetId id of the asset on coingecko, not matches the symbol
704
+ * @param currency currency you want the result to be in, default is 'usd'
705
+ */
706
+ declare function usePrice(assetId: string | undefined, currency?: VsCurrencyType): Big;
707
+
708
+ declare function usePriceForChain(chain: Blockchain | undefined): Big;
709
+
710
+ declare function useResetTransactionDetailsFromParams(avalancheProvider: Provider, ethereumProvider: Provider, setTransactionDetails: (details: TransactionDetails) => void, assets: Maybe<Assets>): (txHash: string, network: Blockchain) => Promise<void>;
711
+
712
+ declare function useSubscribeForNewTransactionFromBridgeEVM(network: Blockchain, avalancheProvider: Provider, ethereumProvider: Provider, config: Maybe<AppConfig>, asset: Maybe<EthereumConfigAsset>, account: Maybe<string>): TransactionResponse | undefined;
713
+
714
+ declare function useTimer(): {
715
+ isActive: boolean;
716
+ seconds: number;
717
+ start: () => void;
718
+ stop: () => void;
719
+ setTimerSeconds: (startTimestamp: number, endTimestamp?: number) => void;
720
+ started: number;
721
+ };
722
+
723
+ /**
724
+ * Get the bridge fee depending on the selected chain and asset
725
+ * @param amount
726
+ */
727
+ declare function useBridgeFeeEstimate(amount: Big): Big | undefined;
728
+
729
+ /**
730
+ * Transfer an ERC20 asset.
731
+ * When currentBlockchain is Avalanche the asset will be transferred to
732
+ * Ethereum and vice versa.
733
+ *
734
+ * @param signAndSendEVM Required when the provider for the currentBlockchain
735
+ * @param avalancheProvider This can accept either a JsonRpcProvider or BrowserProvider. If a signAndSendEVM param is provided, then this can be a JsonRpcProvider (i.e. a provider without signing capabilities), otherwise this should be a BrowserProvider, or other provider with signing capabilities (via the provider.getSigner method)
736
+ * @param ethereumProvider Same comment as avalancheProvider^
737
+ * does not support signing transactions.
738
+ */
739
+ declare function useTransferAssetEVM(asset: Maybe<EthereumConfigAsset | NativeAsset>, account: Maybe<string>, avalancheProvider: JsonRpcApiProvider, ethereumProvider: JsonRpcApiProvider, signAndSendEVM?: (txData: TransactionRequest) => Promise<TxHash>): {
740
+ transferAsset: (amount: Big) => Promise<string> | undefined;
741
+ status: WrapStatus;
742
+ txHash: string;
743
+ };
744
+
745
+ /**
746
+ * Transfer Bitcoin asset to Avalanche.
747
+ */
748
+ declare function useTransferAssetBTC(signAndSendBTC: (txParams: BtcTransactionRequest) => Promise<TxHash>): {
749
+ transferAsset: (amount: string, feeRate: number) => Promise<string> | undefined;
750
+ status: WrapStatus;
751
+ txHash: string;
752
+ };
753
+
754
+ interface TrackerViewProps {
755
+ sourceNetwork: Blockchain;
756
+ sourceSeconds: number;
757
+ sourceTxHash?: string;
758
+ targetNetwork: Blockchain;
759
+ targetSeconds: number;
760
+ targetTxHash?: string;
761
+ confirmationCount: number;
762
+ requiredConfirmationCount: number;
763
+ complete: boolean;
764
+ gasCost?: Big;
765
+ gasValue?: Big;
766
+ amount?: Big;
767
+ symbol?: string;
768
+ }
769
+ /**
770
+ * @deprecated this hook is buggy, prefer trackBridgeTransaction instead.
771
+ *
772
+ * Track an EVM transaction
773
+ * @param started Start timestamp of the source transaction.
774
+ * @param isHidden Is the screen hidden e.g. document.hidden
775
+ */
776
+ declare function useTxTracker(sourceNetwork: Blockchain, txId: string, started: string, avalancheProvider: Provider, ethereumProvider: Provider, setTransactionDetails: (details: TransactionDetails) => void, config: Maybe<AppConfig>, account: Maybe<string>, transactionDetails: Maybe<TransactionDetails>, ethWrappedAssets: Maybe<EthereumConfigAssets>, isHidden?: boolean): TrackerViewProps;
777
+
778
+ declare function useWaitForConfirmations(requiredConfirmationCount: number, provider: Provider, txHash: Maybe<string>): {
779
+ confirmations: number;
780
+ gasCost: Big | undefined;
781
+ };
782
+
783
+ /**
784
+ * Get the bridge fee depending on the selected chain and asset
785
+ * @param amount
786
+ */
787
+ declare function useMinimumTransferAmount(amount: Big): Big;
788
+
789
+ declare const ETHERSCAN_API_KEY: string | undefined;
790
+ declare const INFURA_API_KEY: string | undefined;
791
+ /**
792
+ * Set the bridge runtime environment.
793
+ */
794
+ declare function setBridgeEnvironment(environment: Environment): void;
795
+ /**
796
+ * Get the runtime config for the current environment.
797
+ * @throws when the environment has not already been initialized by calling
798
+ * `setBridgeEnvironment(env)`
799
+ * @param env optional, provide to get the config for the given Environment.
800
+ */
801
+ declare function getRuntimeConfig(env?: Environment): RuntimeConfig;
802
+
803
+ declare const BIG_TEN: Big;
804
+ declare const BIG_ZERO: Big;
805
+ declare const capped: (value: Big, { max, min }: {
806
+ max: Big;
807
+ min: Big;
808
+ }) => Big;
809
+
810
+ declare function isMainnetConfig(config: AppConfig): boolean;
811
+ /**
812
+ * @returns the number of required confirmations before the bridge will initiate a transfer.
813
+ */
814
+ declare function getMinimumConfirmations(blockchain: Blockchain, config: AppConfig): number;
815
+ /**
816
+ * Compares critical sections of the bridge config.
817
+ */
818
+ declare function hasCriticalChanges(oldConfig: BridgeConfig, newConfig: BridgeConfig): boolean;
819
+ declare function isEthUsingDynamicFees(config: AppConfig): config is AppConfigWithDynamicFeesForEthereum | AppConfigWithFullDynamicFees;
820
+ declare function isBtcUsingDynamicFees(config: AppConfig): config is AppConfigWithDynamicFeesForBitcoin | AppConfigWithFullDynamicFees;
821
+
822
+ declare function formatTokenAmount(amount: Big, denomination?: number): string;
823
+
824
+ declare function getNativeSymbol(chain: Blockchain): string;
825
+
826
+ declare const usdFormatter: Intl.NumberFormat;
827
+
828
+ declare const isAddressBlocklisted: ({ addressEVM, addressBTC, bridgeConfig, }: {
829
+ addressEVM?: string | undefined;
830
+ addressBTC?: string | undefined;
831
+ bridgeConfig: BridgeConfig$1;
832
+ }) => boolean;
833
+
834
+ declare const isNativeAsset: (asset: Asset) => asset is NativeAsset;
835
+ declare const isBtcAsset: (asset: Asset) => asset is BitcoinConfigAsset;
836
+ declare const isEthAsset: (asset: Asset) => asset is EthereumConfigAsset;
837
+
838
+ declare const AVERAGE_TRANSFER_TX_GAS_USAGE = 40000n;
839
+ /**
840
+ * NOTE: These estimates are only supposed to be used to approximate
841
+ * the network fees in the UI.
842
+ *
843
+ * DO NOT use them as `gasLimit` prop on the transactions!
844
+ */
845
+ declare function estimateGas(amount: Big, account: string, asset: Asset, providers: {
846
+ ethereum: JsonRpcApiProvider;
847
+ avalanche: JsonRpcApiProvider;
848
+ }, config: AppConfig, sourceBlockchain: Blockchain, withSigner?: boolean): Promise<bigint | undefined>;
849
+
850
+ export { AVERAGE_TRANSFER_TX_GAS_USAGE, AddEthereumChainParameter, AppConfig, AppConfigWithDynamicFeesForBitcoin, AppConfigWithDynamicFeesForEthereum, AppConfigWithFullDynamicFees, AppConfigWithFullStaticFees, AppConfigWithStaticFeesForBitcoin, AppConfigWithStaticFeesForEthereum, Asset, AssetBase, AssetType, Assets, AvalancheAssets, BIG_TEN, BIG_ZERO, BitcoinConfigAsset, BitcoinConfigAssets, BitcoinDynamicFeeConfig, BitcoinDynamicFeeConfigAsset, BitcoinDynamicFeeConfigAssets, BitcoinDynamicFeeCriticalConfig, BitcoinStaticFeeConfig, BitcoinStaticFeeConfigAsset, BitcoinStaticFeeConfigAssets, BitcoinStaticFeeCriticalConfig, Blockchain, BridgeConfig, BridgeSDKProvider, BridgeSDKState, BridgeTransaction, BtcBlockchains, BtcTransactionRequest, CriticalConfig, DynamicFeeEstimation, ETHERSCAN_API_KEY, Environment, EthChains, EthereumAssetConfigBase, EthereumAssets, EthereumConfigAsset, EthereumConfigAssets, EthereumDynamicFeeAssetConfig, EthereumDynamicFeeConfig, EthereumDynamicFeeConfigAssets, EthereumStaticFeeAssetConfig, EthereumStaticFeeConfig, EthereumStaticFeeConfigAssets, HistoryTxData, INFURA_API_KEY, NativeAsset, NetworkType, NonCriticalConfig, RuntimeConfig, TokenInfo, TokenInfoData, TokenInfoProvider, TrackerSubscription, TrackerViewProps, TransactionDetails, TransferAssetBTCParams, TransferAssetEVMParams, TxHash, WrapStatus, btcToSatoshi, capped, checkHistoryForNewTxEVM, estimateGas, fetchConfig, fetchTokenBalances, formatTokenAmount, getAssets, getBridgeFeeEstimateBTC, getBridgeFeeEstimateEVM, getBtcAsset, getBtcTransaction, getBtcTransactionDetails, getMaxTransferAmount, getMinimumConfirmations, getMinimumTransferAmount, getNativeSymbol, getRuntimeConfig, getStaticBridgeFeeEstimateBTC, getStaticBridgeFeeEstimateEVM, getTxConfirmations, getTxDetails, hasCriticalChanges, initalState, isAddressBlocklisted, isBase58Address, isBase58AddressInNetwork, isBech32Address, isBech32AddressInNetwork, isBtcAsset, isBtcUsingDynamicFees, isEthAsset, isEthUsingDynamicFees, isMainnetConfig, isNativeAsset, satoshiToBtc, setBridgeEnvironment, trackBridgeTransaction, transferAssetBTC, transferAssetEVM, unwrapAsset, usdFormatter, useBridgeConfig, useBridgeConfigUpdater, useBridgeFeeEstimate, useBridgeSDK, useCheckHistoryForNewTxEVM, useGetAirdropAmount, useGetTokenBalanceEVM, useGetTokenBalancesEVM, useGetTokenSymbolOnNetwork, useHasEnoughForGas, useIsAddressSanctioned, useMaxTransferAmount, useMinimumTransferAmount, usePrice, usePriceForChain, useResetTransactionDetailsFromParams, useSubscribeForNewTransactionFromBridgeEVM, useTimer, useTokenInfoContext, useTransferAssetBTC, useTransferAssetEVM, useTxTracker, useWaitForConfirmations, wrapAsset };