@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.
- package/LICENSE +9 -0
- package/README.md +10 -0
- package/dist/index.d.ts +850 -0
- package/dist/index.js +1 -0
- package/esm/abi/erc20.abi.json.js +1 -0
- package/esm/abi/wavax.abi.json.js +1 -0
- package/esm/abi/weth.abi.json.js +1 -0
- package/esm/constants.js +1 -0
- package/esm/contexts/BridgeSDKProvider.d.ts +8 -0
- package/esm/contexts/BridgeSDKProvider.js +1 -0
- package/esm/contexts/TokenInfoProvider.d.ts +9 -0
- package/esm/contexts/TokenInfoProvider.js +1 -0
- package/esm/contexts/models.d.ts +26 -0
- package/esm/hooks/useBridgeConfig.d.ts +13 -0
- package/esm/hooks/useBridgeConfig.js +1 -0
- package/esm/hooks/useBridgeConfigUpdater.d.ts +16 -0
- package/esm/hooks/useBridgeConfigUpdater.js +1 -0
- package/esm/hooks/useBridgeFeeEstimate.d.ts +9 -0
- package/esm/hooks/useBridgeFeeEstimate.js +1 -0
- package/esm/hooks/useCheckHistoryForNewTxEVM.d.ts +11 -0
- package/esm/hooks/useCheckHistoryForNewTxEVM.js +1 -0
- package/esm/hooks/useGetAirdropAmount.d.ts +8 -0
- package/esm/hooks/useGetAirdropAmount.js +1 -0
- package/esm/hooks/useGetTokenBalanceEVM.d.ts +14 -0
- package/esm/hooks/useGetTokenBalanceEVM.js +1 -0
- package/esm/hooks/useGetTokenBalancesEVM.d.ts +16 -0
- package/esm/hooks/useGetTokenBalancesEVM.js +1 -0
- package/esm/hooks/useGetTokenSymbolOnNetwork.d.ts +7 -0
- package/esm/hooks/useGetTokenSymbolOnNetwork.js +1 -0
- package/esm/hooks/useHasEnoughForGas.d.ts +6 -0
- package/esm/hooks/useHasEnoughForGas.js +1 -0
- package/esm/hooks/useIsAddressSanctioned.d.ts +3 -0
- package/esm/hooks/useIsAddressSanctioned.js +1 -0
- package/esm/hooks/useMaxTransferAmount.d.ts +13 -0
- package/esm/hooks/useMaxTransferAmount.js +1 -0
- package/esm/hooks/useMinimumTransferAmount.d.ts +9 -0
- package/esm/hooks/useMinimumTransferAmount.js +1 -0
- package/esm/hooks/usePrice.d.ts +11 -0
- package/esm/hooks/usePrice.js +1 -0
- package/esm/hooks/usePriceForChain.d.ts +6 -0
- package/esm/hooks/usePriceForChain.js +1 -0
- package/esm/hooks/useResetTransactionDetailsFromParams.d.ts +8 -0
- package/esm/hooks/useResetTransactionDetailsFromParams.js +1 -0
- package/esm/hooks/useSubscribeForNewTransactionFromBridge.d.ts +7 -0
- package/esm/hooks/useSubscribeForNewTransactionFromBridge.js +1 -0
- package/esm/hooks/useTimer.d.ts +10 -0
- package/esm/hooks/useTimer.js +1 -0
- package/esm/hooks/useTransferAssetBTC.d.ts +13 -0
- package/esm/hooks/useTransferAssetBTC.js +1 -0
- package/esm/hooks/useTransferAssetEVM.d.ts +23 -0
- package/esm/hooks/useTransferAssetEVM.js +1 -0
- package/esm/hooks/useTxTracker.d.ts +31 -0
- package/esm/hooks/useTxTracker.js +1 -0
- package/esm/hooks/useWaitForConfirmations.d.ts +10 -0
- package/esm/hooks/useWaitForConfirmations.js +1 -0
- package/esm/index.d.ts +56 -0
- package/esm/index.js +1 -0
- package/esm/lib/btc/address.d.ts +17 -0
- package/esm/lib/btc/address.js +1 -0
- package/esm/lib/btc/getBridgeFeeEstimateBTC.d.ts +18 -0
- package/esm/lib/btc/getBridgeFeeEstimateBTC.js +1 -0
- package/esm/lib/btc/getBtcAsset.d.ts +8 -0
- package/esm/lib/btc/getBtcAsset.js +1 -0
- package/esm/lib/btc/getBtcTransaction.d.ts +24 -0
- package/esm/lib/btc/getBtcTransaction.js +1 -0
- package/esm/lib/btc/getBtcTransactionDetails.d.ts +22 -0
- package/esm/lib/btc/getBtcTransactionDetails.js +1 -0
- package/esm/lib/btc/getMinimumTransferAmount.d.ts +12 -0
- package/esm/lib/btc/getMinimumTransferAmount.js +1 -0
- package/esm/lib/btc/getTxConfirmations.d.ts +12 -0
- package/esm/lib/btc/getTxConfirmations.js +1 -0
- package/esm/lib/btc/models.d.ts +5 -0
- package/esm/lib/btc/utils.d.ts +6 -0
- package/esm/lib/btc/utils.js +1 -0
- package/esm/lib/checkHistoryForNewTxEVM.d.ts +15 -0
- package/esm/lib/checkHistoryForNewTxEVM.js +1 -0
- package/esm/lib/fetchConfig.d.ts +8 -0
- package/esm/lib/fetchConfig.js +1 -0
- package/esm/lib/fetchTokenBalances.d.ts +10 -0
- package/esm/lib/fetchTokenBalances.js +1 -0
- package/esm/lib/getAssets.d.ts +14 -0
- package/esm/lib/getAssets.js +1 -0
- package/esm/lib/getBridgeFeeEstimateEVM.d.ts +20 -0
- package/esm/lib/getBridgeFeeEstimateEVM.js +1 -0
- package/esm/lib/getDynamicFeeAmount.js +1 -0
- package/esm/lib/getMaxTransferAmount.d.ts +16 -0
- package/esm/lib/getMaxTransferAmount.js +1 -0
- package/esm/lib/getMinimumTransferAmountEVM.js +1 -0
- package/esm/lib/hasAddressVulnerableMultichainApproval.js +1 -0
- package/esm/lib/models.d.ts +62 -0
- package/esm/lib/models.js +1 -0
- package/esm/lib/tracker/Tracker.js +1 -0
- package/esm/lib/tracker/getBlockNumberBitcoin.js +1 -0
- package/esm/lib/tracker/getBlockNumberEVM.js +1 -0
- package/esm/lib/tracker/getBridgeFeeActualEVM.js +1 -0
- package/esm/lib/tracker/getEVMProvider.js +1 -0
- package/esm/lib/tracker/getIntervalTime.js +1 -0
- package/esm/lib/tracker/getNetworkFeeEVM.js +1 -0
- package/esm/lib/tracker/getSourceTxDataBitcoin.js +1 -0
- package/esm/lib/tracker/getSourceTxDataEVM.js +1 -0
- package/esm/lib/tracker/getTargetTxDataBitcoin.js +1 -0
- package/esm/lib/tracker/getTargetTxDataEVM.js +1 -0
- package/esm/lib/tracker/models.d.ts +15 -0
- package/esm/lib/tracker/trackBridgeTransaction.d.ts +28 -0
- package/esm/lib/tracker/trackBridgeTransaction.js +1 -0
- package/esm/lib/transferAssetBTC.d.ts +19 -0
- package/esm/lib/transferAssetBTC.js +1 -0
- package/esm/lib/transferAssetEVM.d.ts +28 -0
- package/esm/lib/transferAssetEVM.js +1 -0
- package/esm/lib/unwrapAsset.d.ts +11 -0
- package/esm/lib/unwrapAsset.js +1 -0
- package/esm/lib/wrapAsset.d.ts +17 -0
- package/esm/lib/wrapAsset.js +1 -0
- package/esm/runtime/config.d.ts +17 -0
- package/esm/runtime/config.js +1 -0
- package/esm/runtime/nativeAssets.js +1 -0
- package/esm/types/config.d.ts +297 -0
- package/esm/types/config.js +1 -0
- package/esm/types/tokenInfo.d.ts +7 -0
- package/esm/utils/asset.d.ts +7 -0
- package/esm/utils/asset.js +1 -0
- package/esm/utils/bignumber.d.ts +10 -0
- package/esm/utils/bignumber.js +1 -0
- package/esm/utils/config.d.ts +15 -0
- package/esm/utils/config.js +1 -0
- package/esm/utils/estimateGas.d.ts +17 -0
- package/esm/utils/estimateGas.js +1 -0
- package/esm/utils/formatTokenAmount.d.ts +5 -0
- package/esm/utils/formatTokenAmount.js +1 -0
- package/esm/utils/getContract.js +1 -0
- package/esm/utils/getGasAsset.js +1 -0
- package/esm/utils/getNativeSymbol.d.ts +5 -0
- package/esm/utils/getNativeSymbol.js +1 -0
- package/esm/utils/isAddressBlocklisted.d.ts +9 -0
- package/esm/utils/isAddressBlocklisted.js +1 -0
- package/esm/utils/loadTokenInfo.js +1 -0
- package/esm/utils/usdFormatter.d.ts +3 -0
- package/esm/utils/usdFormatter.js +1 -0
- package/esm/utils/wrapUtils.js +1 -0
- package/package.json +51 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
import { EthereumConfigAsset, BitcoinConfigAsset } from '../types/config.js';
|
|
3
|
+
import { JsonRpcApiProvider, TransactionRequest } from 'ethers';
|
|
4
|
+
import { TxHash } from './models.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Transfer from Avalanche to Ethereum or Bitcoin.
|
|
8
|
+
*/
|
|
9
|
+
declare function unwrapAsset(amount: Big, account: string, asset: EthereumConfigAsset | BitcoinConfigAsset, provider: JsonRpcApiProvider, onTxHashChange: (txHash: string) => void, signAndSendEVM?: (txData: TransactionRequest) => Promise<TxHash>): Promise<TxHash>;
|
|
10
|
+
|
|
11
|
+
export { unwrapAsset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"../abi/wavax.abi.json.js";import{getContract as r}from"../utils/getContract.js";import{callContractTransactionFn as o}from"../utils/wrapUtils.js";import{bigToBigInt as a}from"@avalabs/core-utils-sdk";async function i(i,s,n,m,p,e){const c=!e,u=r(n.wrappedContractAddress,t,m,s,c),d=a(i,n.denomination),f=await o(u,"unwrap",[d,0],s,m,e);return p(f),f}export{i as unwrapAsset};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
import { EthereumConfigAsset, NativeAsset, AppConfig } from '../types/config.js';
|
|
3
|
+
import { JsonRpcApiProvider, TransactionRequest } from 'ethers';
|
|
4
|
+
import { WrapStatus, TxHash } from './models.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Transfer from Ethereum to Avalanche.
|
|
8
|
+
*
|
|
9
|
+
* @param wrappedAsset - must be provided when asset is of AssetType.NATIVE
|
|
10
|
+
* @param signAndSendEVM - Optional, provide when NOT using Metamask. Some
|
|
11
|
+
* providers like `InfuraProvider` don't support `getSigner` so
|
|
12
|
+
* `signAndSendEVM` is used to manually sign and send the transaction instead of calling
|
|
13
|
+
* `contract.transfer`.
|
|
14
|
+
*/
|
|
15
|
+
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>;
|
|
16
|
+
|
|
17
|
+
export { wrapAsset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bigToBigInt as t}from"@avalabs/core-utils-sdk";import r from"../abi/erc20.abi.json.js";import s from"../abi/weth.abi.json.js";import{Blockchain as o}from"../types/config.js";import{getContract as i}from"../utils/getContract.js";import{callContractTransactionFn as a}from"../utils/wrapUtils.js";import{hasAddressVulnerableMultichainApproval as n}from"./hasAddressVulnerableMultichainApproval.js";import"../utils/bignumber.js";import{isEthAsset as e,isNativeAsset as c}from"../utils/asset.js";import{WrapStatus as m}from"./models.js";async function p(p,l,d,f,A,I,u,w,E){u(m.INITIAL);const O=I.critical.walletAddresses.ethereum||"";if(e(d))return async function(s,o,n,e,c,p,l,d){const f=!d,A=i(n.nativeContractAddress,r,c,o,f),I=t(s,n.denomination);p(m.WAITING_FOR_CONFIRMATION);const u=await a(A,"transfer",[e,I],o,c,d);return l(u),p(m.COMPLETE),u}(p,l,d,O,A,u,w,E);{const e=c(d)?I.critical.assets[d.wrappedAssetSymbol]:void 0;if(!e)throw new Error("missing wrappedAsset");return async function(e,c,p,l,d,f,A,I,u,w,E){const O=!E,T=i(l.nativeContractAddress,r,A,c,O),N=t(e,p.denomination);if(p.nativeNetwork===o.ETHEREUM){if(await n(c,f,A,I))throw u(m.VULNERABLE_ADDRESS),new Error("Address has vulnerable token approvals");u(m.WAITING_FOR_DEPOSIT_CONFIRMATION);const t=i(l.nativeContractAddress,s,A,c,O),r=await a(t,"deposit",[{value:N}],c,A,E);w(r),u(m.WAITING_FOR_DEPOSIT),await A.waitForTransaction(r)}u(m.WAITING_FOR_CONFIRMATION);const j=await a(T,"transfer",[d,N],c,A,E);return w(j),u(m.COMPLETE),j}(p,l,d,e,O,f,A,I,u,w,E)}}export{p as wrapAsset};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Environment, RuntimeConfig } from '../types/config.js';
|
|
2
|
+
|
|
3
|
+
declare const ETHERSCAN_API_KEY: string | undefined;
|
|
4
|
+
declare const INFURA_API_KEY: string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Set the bridge runtime environment.
|
|
7
|
+
*/
|
|
8
|
+
declare function setBridgeEnvironment(environment: Environment): void;
|
|
9
|
+
/**
|
|
10
|
+
* Get the runtime config for the current environment.
|
|
11
|
+
* @throws when the environment has not already been initialized by calling
|
|
12
|
+
* `setBridgeEnvironment(env)`
|
|
13
|
+
* @param env optional, provide to get the config for the given Environment.
|
|
14
|
+
*/
|
|
15
|
+
declare function getRuntimeConfig(env?: Environment): RuntimeConfig;
|
|
16
|
+
|
|
17
|
+
export { ETHERSCAN_API_KEY, INFURA_API_KEY, getRuntimeConfig, setBridgeEnvironment };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Environment as t,Blockchain as e}from"../types/config.js";const a=process.env.ETHERSCAN_API_KEY||process.env.REACT_APP_ETHERSCAN_API_KEY,s=process.env.INFURA_API_KEY||process.env.REACT_APP_INFURA_API_KEY;let n;function o(t){n=g[t]}function r(t){if(t)return g[t];if(!n)throw new Error("No environment set, initialize by calling setBridgeEnvironment");return n}const i={environment:t.DEV,bridgeUrl:"http://localhost:3000",tokenInfoUrl:"https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.test.json",configMismatchThreshold:1,wardenConfigURLs:["https://warden1-avax-dev-storage.s3.amazonaws.com/bridge_settings.json","https://warden2-avax-dev-storage.s3.amazonaws.com/bridge_settings.json","https://warden3-avax-dev-storage.s3.amazonaws.com/bridge_settings.json"],avalancheNetworkConfig:{chainId:"0xa869",chainName:"Avalanche Fuji Testnet",nativeCurrency:{name:"Fuji",symbol:"AVAX",decimals:18},rpcUrls:["https://api.avax-test.network/ext/bc/C/rpc"],blockExplorerUrls:["https://subnets-test.avax.network/c-chain"]},ethereumNetworkConfig:{chainId:11155111,rpcUrls:[`https://sepolia.infura.io/v3/${s}`]},disabledTokensOnNetwork:{[e.AVALANCHE]:[],[e.ETHEREUM]:["FAU"]}},c={...i,environment:t.STAGING,bridgeUrl:"https://bridge.avax-test.network",tokenInfoUrl:"https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.test.json"},m={...c,environment:t.TEST,bridgeUrl:"https://bridge.avax-test.network",tokenInfoUrl:"https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.test.json",configMismatchThreshold:2,wardenConfigURLs:["https://ava-warden-bucket.s3.eu-central-1.amazonaws.com/bridge_settings.json","https://ava-warden-testnet.s3.us-west-1.amazonaws.com/bridge_settings.json","https://avalabs-testnet-cce1-testnet-warden-bucket.s3.ca-central-1.amazonaws.com/bridge_settings.json","https://avalabs-warden-test-blob.s3.amazonaws.com/bridge_settings.json","https://avawarden.s3.amazonaws.com/bridge_settings.json","https://blob-storage-testnet.warden-avascan.info/bridge_settings.json","https://chainstack-ava-warden-testnet.s3.us-west-2.amazonaws.com/bridge_settings.json","https://s3.amazonaws.com/warden-mgmt-prod-testnet.blockdaemon.com/bridge_settings.json"]},d={...m,environment:t.PROD,bridgeUrl:"https://bridge.avax.network",tokenInfoUrl:"https://raw.githubusercontent.com/ava-labs/avalanche-bridge-resources/main/token_list.json",avalancheNetworkConfig:{chainId:"0xa86a",chainName:"Avalanche Mainnet C-Chain",nativeCurrency:{name:"AVAX",symbol:"AVAX",decimals:18},rpcUrls:["https://api.avax.network/ext/bc/C/rpc"],blockExplorerUrls:["https://subnets.avax.network/c-chain"]},ethereumNetworkConfig:{chainId:1,rpcUrls:[`https://mainnet.infura.io/v3/${s}`]},wardenConfigURLs:["https://ava-warden-bucket-prod.s3.eu-central-1.amazonaws.com/bridge_settings.json","https://ava-warden-mainnet.s3.us-west-1.amazonaws.com/bridge_settings.json","https://avalabs-mainnet-cce1-mainnet-warden-bucket.s3.ca-central-1.amazonaws.com/bridge_settings.json","https://avawarden-prod.s3.amazonaws.com/bridge_settings.json","https://blob-storage-mainnet.warden-avascan.info/bridge_settings.json","https://chainstack-ava-warden-mainnet.s3.us-west-2.amazonaws.com/bridge_settings.json","https://s3.amazonaws.com/warden-mgmt-prod-mainnet.blockdaemon.com/bridge_settings.json","https://warden-avax-storage.s3.amazonaws.com/bridge_settings.json"],disabledTokensOnNetwork:{[e.AVALANCHE]:[],[e.ETHEREUM]:["CRV"]}},g={[t.PROD]:d,[t.STAGING]:c,[t.TEST]:m,[t.DEV]:i};export{a as ETHERSCAN_API_KEY,s as INFURA_API_KEY,r as getRuntimeConfig,o as setBridgeEnvironment};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AssetType as e,Blockchain as o}from"../types/config.js";const t={ETH:{symbol:"ETH",tokenName:"Ether",assetType:e.NATIVE,nativeNetwork:o.ETHEREUM,wrappedAssetSymbol:"WETH",denomination:18,coingeckoId:"ethereum"}};export{t as default};
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
declare enum Blockchain {
|
|
2
|
+
AVALANCHE = "avalanche",
|
|
3
|
+
ETHEREUM = "ethereum",
|
|
4
|
+
BITCOIN = "bitcoin",
|
|
5
|
+
UNKNOWN = ""
|
|
6
|
+
}
|
|
7
|
+
declare enum NetworkType {
|
|
8
|
+
MAINNET = "mainnet",
|
|
9
|
+
TESTNET = "testnet"
|
|
10
|
+
}
|
|
11
|
+
declare enum Environment {
|
|
12
|
+
DEV = "development",
|
|
13
|
+
STAGING = "staging",
|
|
14
|
+
TEST = "test",
|
|
15
|
+
PROD = "prod"
|
|
16
|
+
}
|
|
17
|
+
interface RuntimeConfig {
|
|
18
|
+
environment: Environment;
|
|
19
|
+
bridgeUrl: string;
|
|
20
|
+
tokenInfoUrl: string;
|
|
21
|
+
configMismatchThreshold: number;
|
|
22
|
+
wardenConfigURLs: string[];
|
|
23
|
+
avalancheNetworkConfig: AddEthereumChainParameter;
|
|
24
|
+
ethereumNetworkConfig: {
|
|
25
|
+
chainId: number;
|
|
26
|
+
rpcUrls: string[];
|
|
27
|
+
};
|
|
28
|
+
disabledTokensOnNetwork: Partial<Record<Blockchain, string[]>>;
|
|
29
|
+
}
|
|
30
|
+
interface EthereumCriticalConfigBase extends CriticalConfigBase {
|
|
31
|
+
networks: Partial<Record<Blockchain, number | undefined>>;
|
|
32
|
+
walletAddresses: Partial<Record<Blockchain, string>>;
|
|
33
|
+
addressBlocklist: string[];
|
|
34
|
+
}
|
|
35
|
+
interface EthereumStaticFeeCriticalConfig extends EthereumCriticalConfigBase {
|
|
36
|
+
assets: EthereumStaticFeeConfigAssets;
|
|
37
|
+
useNewFeeStructure?: false;
|
|
38
|
+
}
|
|
39
|
+
interface EthereumDynamicFeeCriticalConfig extends EthereumCriticalConfigBase {
|
|
40
|
+
assets: EthereumDynamicFeeConfigAssets;
|
|
41
|
+
useNewFeeStructure: true;
|
|
42
|
+
}
|
|
43
|
+
interface EthereumNonCriticalConfigBase {
|
|
44
|
+
minimumConfirmations: Partial<Record<Blockchain, number | undefined>>;
|
|
45
|
+
currentEthPrice: string;
|
|
46
|
+
currentAvaxPrice: string;
|
|
47
|
+
currentGasPrices: Record<Blockchain.AVALANCHE | Blockchain.ETHEREUM, {
|
|
48
|
+
nextBaseFee: string;
|
|
49
|
+
suggestedTip: string;
|
|
50
|
+
}>;
|
|
51
|
+
/** Timestamp */
|
|
52
|
+
updated: string;
|
|
53
|
+
useChainlinkAssetPriceFeeds?: boolean;
|
|
54
|
+
chainlinkAvaxUsdFeedAddress?: string;
|
|
55
|
+
chainlinkEthUsdFeedAddress?: string;
|
|
56
|
+
chainlinkBtcUsdFeedAddress?: string;
|
|
57
|
+
/** Timestamp */
|
|
58
|
+
startupTime: string;
|
|
59
|
+
}
|
|
60
|
+
interface EthereumStaticFeeNonCriticalConfig extends EthereumNonCriticalConfigBase {
|
|
61
|
+
unwrapFeeApproximation: Record<string, string>;
|
|
62
|
+
wrapFeeApproximation: Record<string, string>;
|
|
63
|
+
}
|
|
64
|
+
interface EthereumDynamicFeeNonCriticalConfig extends EthereumNonCriticalConfigBase {
|
|
65
|
+
unwrapFeeApproximation: Record<string, DynamicFeeEstimation>;
|
|
66
|
+
wrapFeeApproximation: Record<string, DynamicFeeEstimation>;
|
|
67
|
+
}
|
|
68
|
+
interface CriticalConfigBase {
|
|
69
|
+
disableFrontend: boolean;
|
|
70
|
+
operationMode: string;
|
|
71
|
+
operatorEvmAddress?: string;
|
|
72
|
+
operatorAddress: string;
|
|
73
|
+
targetSecretVersion?: number;
|
|
74
|
+
useEip1559TransactionFormat?: boolean;
|
|
75
|
+
}
|
|
76
|
+
interface BitcoinCriticalConfigBase extends CriticalConfigBase {
|
|
77
|
+
addressBlocklist: string[];
|
|
78
|
+
avalancheChainId: number;
|
|
79
|
+
useEip1559TransactionFormat: boolean;
|
|
80
|
+
walletAddresses: {
|
|
81
|
+
avalanche: string;
|
|
82
|
+
btc: string;
|
|
83
|
+
};
|
|
84
|
+
offboardDelaySeconds: number;
|
|
85
|
+
}
|
|
86
|
+
interface BitcoinStaticFeeCriticalConfig extends BitcoinCriticalConfigBase {
|
|
87
|
+
bitcoinAssets: BitcoinStaticFeeConfigAssets;
|
|
88
|
+
useNewFeeStructure?: false;
|
|
89
|
+
}
|
|
90
|
+
interface BitcoinDynamicFeeCriticalConfig extends BitcoinCriticalConfigBase {
|
|
91
|
+
bitcoinAssets: BitcoinDynamicFeeConfigAssets;
|
|
92
|
+
useNewFeeStructure: true;
|
|
93
|
+
}
|
|
94
|
+
interface BitcoinStaticBridgeFeeEstimate {
|
|
95
|
+
wrapFeeAmount: number;
|
|
96
|
+
constUnwrapFeeAmount: number;
|
|
97
|
+
unwrapFeeNumerator: number;
|
|
98
|
+
unwrapFeeDenominator: number;
|
|
99
|
+
dustThreshold: number;
|
|
100
|
+
}
|
|
101
|
+
interface BitcoinDynamicBridgeFeeEstimate {
|
|
102
|
+
dustThreshold: number;
|
|
103
|
+
wrapFeeEstimate: DynamicFeeEstimation;
|
|
104
|
+
unwrapFeeEstimate: {
|
|
105
|
+
bridgeToll: DynamicFeeEstimation;
|
|
106
|
+
estimatedTxFee: {
|
|
107
|
+
constAmount: number;
|
|
108
|
+
numeratorPerSat: number;
|
|
109
|
+
denominatorPerSat: number;
|
|
110
|
+
};
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
interface BitcoinNetworkInfoBase {
|
|
114
|
+
minimumConfirmations: number;
|
|
115
|
+
minimumOnboardSize: number;
|
|
116
|
+
currentPrice: string;
|
|
117
|
+
currentFeeRate: {
|
|
118
|
+
feeRate: number;
|
|
119
|
+
source: string;
|
|
120
|
+
};
|
|
121
|
+
currentUtxoStatistics: {
|
|
122
|
+
[hash: string]: {
|
|
123
|
+
mean: string;
|
|
124
|
+
count: string;
|
|
125
|
+
};
|
|
126
|
+
};
|
|
127
|
+
reserveBalance: number;
|
|
128
|
+
networkView: {
|
|
129
|
+
lastIndexedBlock: number;
|
|
130
|
+
lastSeenBlock: number;
|
|
131
|
+
nodeVersion: string;
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
interface BitcoinStaticFeeNetworkInfo extends BitcoinNetworkInfoBase {
|
|
135
|
+
currentBridgeFeeEstimate: BitcoinStaticBridgeFeeEstimate;
|
|
136
|
+
}
|
|
137
|
+
interface BitcoinDynamicFeeNetworkInfo extends BitcoinNetworkInfoBase {
|
|
138
|
+
currentBridgeFeeEstimate: BitcoinDynamicBridgeFeeEstimate;
|
|
139
|
+
}
|
|
140
|
+
interface BitcoinNonCriticalConfig<T> {
|
|
141
|
+
networkInfo: {
|
|
142
|
+
btc: T;
|
|
143
|
+
};
|
|
144
|
+
/** Timestamp */
|
|
145
|
+
updated: string;
|
|
146
|
+
}
|
|
147
|
+
interface BitcoinStaticFeeConfig {
|
|
148
|
+
criticalBitcoin: BitcoinStaticFeeCriticalConfig;
|
|
149
|
+
nonCriticalBitcoin: BitcoinNonCriticalConfig<BitcoinStaticFeeNetworkInfo>;
|
|
150
|
+
}
|
|
151
|
+
interface BitcoinDynamicFeeConfig {
|
|
152
|
+
criticalBitcoin: BitcoinDynamicFeeCriticalConfig;
|
|
153
|
+
nonCriticalBitcoin: BitcoinNonCriticalConfig<BitcoinDynamicFeeNetworkInfo>;
|
|
154
|
+
}
|
|
155
|
+
interface EthereumStaticFeeConfig {
|
|
156
|
+
critical: EthereumStaticFeeCriticalConfig;
|
|
157
|
+
nonCritical: EthereumStaticFeeNonCriticalConfig;
|
|
158
|
+
}
|
|
159
|
+
interface EthereumDynamicFeeConfig {
|
|
160
|
+
critical: EthereumDynamicFeeCriticalConfig;
|
|
161
|
+
nonCritical: EthereumDynamicFeeNonCriticalConfig;
|
|
162
|
+
}
|
|
163
|
+
interface AppConfigBase {
|
|
164
|
+
startupTime: string;
|
|
165
|
+
version: string;
|
|
166
|
+
}
|
|
167
|
+
interface AppConfigWithDynamicFeesForEthereum extends AppConfigBase, EthereumDynamicFeeConfig, BitcoinStaticFeeConfig {
|
|
168
|
+
}
|
|
169
|
+
interface AppConfigWithDynamicFeesForBitcoin extends AppConfigBase, EthereumStaticFeeConfig, BitcoinDynamicFeeConfig {
|
|
170
|
+
}
|
|
171
|
+
type AppConfigWithStaticFeesForEthereum = AppConfigWithFullStaticFees | AppConfigWithDynamicFeesForBitcoin;
|
|
172
|
+
type AppConfigWithStaticFeesForBitcoin = AppConfigWithFullStaticFees | AppConfigWithDynamicFeesForEthereum;
|
|
173
|
+
interface AppConfigWithFullDynamicFees extends AppConfigBase, EthereumDynamicFeeConfig, BitcoinDynamicFeeConfig {
|
|
174
|
+
}
|
|
175
|
+
interface AppConfigWithFullStaticFees extends AppConfigBase, EthereumStaticFeeConfig, BitcoinStaticFeeConfig {
|
|
176
|
+
}
|
|
177
|
+
type AppConfig = AppConfigWithFullStaticFees | AppConfigWithFullDynamicFees | AppConfigWithDynamicFeesForEthereum | AppConfigWithDynamicFeesForBitcoin;
|
|
178
|
+
type CriticalConfig = Pick<AppConfig, 'critical' | 'criticalBitcoin'>;
|
|
179
|
+
type NonCriticalConfig = Pick<AppConfig, 'nonCritical' | 'nonCriticalBitcoin'>;
|
|
180
|
+
type BridgeConfig = {
|
|
181
|
+
config?: AppConfig;
|
|
182
|
+
error?: any;
|
|
183
|
+
};
|
|
184
|
+
declare enum AssetType {
|
|
185
|
+
NATIVE = 0,
|
|
186
|
+
ERC20 = 1,
|
|
187
|
+
BTC = 2
|
|
188
|
+
}
|
|
189
|
+
interface Assets {
|
|
190
|
+
[symbol: string]: Asset;
|
|
191
|
+
}
|
|
192
|
+
type EthereumStaticFeeConfigAssets = Record<string, EthereumStaticFeeAssetConfig>;
|
|
193
|
+
type EthereumDynamicFeeConfigAssets = Record<string, EthereumDynamicFeeAssetConfig>;
|
|
194
|
+
type EthereumConfigAssets = EthereumStaticFeeConfigAssets | EthereumDynamicFeeConfigAssets;
|
|
195
|
+
interface BitcoinStaticFeeConfigAsset extends BitcoinConfigAsset {
|
|
196
|
+
offboardFeeDollars: number;
|
|
197
|
+
onboardFeeDollars: number;
|
|
198
|
+
}
|
|
199
|
+
interface BitcoinDynamicFeeConfigAsset extends BitcoinConfigAsset {
|
|
200
|
+
offboardFeeConfiguration: DynamicFeeConfiguration;
|
|
201
|
+
onboardFeeConfiguration: DynamicFeeConfiguration;
|
|
202
|
+
}
|
|
203
|
+
type BitcoinStaticFeeConfigAssets = Record<string, BitcoinStaticFeeConfigAsset>;
|
|
204
|
+
type BitcoinDynamicFeeConfigAssets = Record<string, BitcoinDynamicFeeConfigAsset>;
|
|
205
|
+
type BitcoinConfigAssets = BitcoinStaticFeeConfigAssets | BitcoinDynamicFeeConfigAssets;
|
|
206
|
+
/**
|
|
207
|
+
* Bridge assets can fall into one of these categories
|
|
208
|
+
*/
|
|
209
|
+
type Asset = EthereumConfigAsset | NativeAsset | BitcoinConfigAsset;
|
|
210
|
+
/**
|
|
211
|
+
* Must exist on every asset.
|
|
212
|
+
* This data is added to the raw config when it is fetched.
|
|
213
|
+
*/
|
|
214
|
+
interface AssetBase {
|
|
215
|
+
symbol: string;
|
|
216
|
+
tokenName: string;
|
|
217
|
+
assetType: AssetType;
|
|
218
|
+
nativeNetwork: Blockchain;
|
|
219
|
+
denomination: number;
|
|
220
|
+
}
|
|
221
|
+
type DynamicFeeConfiguration = {
|
|
222
|
+
feePercentage: number;
|
|
223
|
+
feePercentageDecimals: number;
|
|
224
|
+
maximumFeeDollars: number;
|
|
225
|
+
minimumFeeDollars: number;
|
|
226
|
+
};
|
|
227
|
+
type DynamicFeeEstimation = {
|
|
228
|
+
minimumFeeAmount: string;
|
|
229
|
+
maximumFeeAmount: string;
|
|
230
|
+
feePercentage: number;
|
|
231
|
+
feePercentageDecimals: number;
|
|
232
|
+
};
|
|
233
|
+
interface EthereumAssetConfigBase extends AssetBase {
|
|
234
|
+
avaxPromotionDollarThreshold: number;
|
|
235
|
+
avaxPromotionAmount: string;
|
|
236
|
+
chainlinkFeedAddress?: string;
|
|
237
|
+
chainlinkFeedNetwork?: string;
|
|
238
|
+
ipfsHash?: string;
|
|
239
|
+
transferGasLimit?: number;
|
|
240
|
+
nativeContractAddress: string;
|
|
241
|
+
wrappedContractAddress: string;
|
|
242
|
+
wrappedNetwork: string;
|
|
243
|
+
deprecatedTokenContractAddress?: string;
|
|
244
|
+
offboardFeeProcessThreshold: string;
|
|
245
|
+
}
|
|
246
|
+
interface EthereumStaticFeeAssetConfig extends EthereumAssetConfigBase {
|
|
247
|
+
maximumOnboardFee?: string;
|
|
248
|
+
onboardFeeDollars?: number;
|
|
249
|
+
offboardFeeDollars: number;
|
|
250
|
+
onboardFeePercentage?: string;
|
|
251
|
+
}
|
|
252
|
+
interface EthereumDynamicFeeAssetConfig extends EthereumAssetConfigBase {
|
|
253
|
+
offboardFeeConfiguration: DynamicFeeConfiguration;
|
|
254
|
+
onboardFeeConfiguration: DynamicFeeConfiguration;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* For Ethereum <-> Avalanche assets
|
|
258
|
+
*/
|
|
259
|
+
type EthereumConfigAsset = EthereumStaticFeeAssetConfig | EthereumDynamicFeeAssetConfig;
|
|
260
|
+
/**
|
|
261
|
+
* For Bitcoin <-> Avalanche assets
|
|
262
|
+
*/
|
|
263
|
+
interface BitcoinConfigAsset extends AssetBase {
|
|
264
|
+
additionalTxFeeAmount: number;
|
|
265
|
+
avaxPromotionAmount: string;
|
|
266
|
+
avaxPromotionDollarThreshold: number;
|
|
267
|
+
bech32AddressPrefix: string;
|
|
268
|
+
operatorAddress: string;
|
|
269
|
+
privateKeyPrefix: string;
|
|
270
|
+
reserveBalanceHighWaterMark: number;
|
|
271
|
+
reserveBalanceLowWaterMark: number;
|
|
272
|
+
targetChangeAmount: number;
|
|
273
|
+
wrappedContractAddress: string;
|
|
274
|
+
wrappedNetwork: string;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* Currently used only for native Ethereum since it is not provided in the bridge config.
|
|
278
|
+
*/
|
|
279
|
+
interface NativeAsset extends AssetBase {
|
|
280
|
+
assetType: AssetType.NATIVE;
|
|
281
|
+
wrappedAssetSymbol: string;
|
|
282
|
+
coingeckoId: string;
|
|
283
|
+
}
|
|
284
|
+
interface AddEthereumChainParameter {
|
|
285
|
+
chainId: string;
|
|
286
|
+
chainName: string;
|
|
287
|
+
nativeCurrency: {
|
|
288
|
+
name: string;
|
|
289
|
+
symbol: string;
|
|
290
|
+
decimals: number;
|
|
291
|
+
};
|
|
292
|
+
rpcUrls: string[];
|
|
293
|
+
blockExplorerUrls?: string[];
|
|
294
|
+
iconUrls?: string[];
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
export { AddEthereumChainParameter, AppConfig, AppConfigWithDynamicFeesForBitcoin, AppConfigWithDynamicFeesForEthereum, AppConfigWithFullDynamicFees, AppConfigWithFullStaticFees, AppConfigWithStaticFeesForBitcoin, AppConfigWithStaticFeesForEthereum, Asset, AssetBase, AssetType, Assets, BitcoinConfigAsset, BitcoinConfigAssets, BitcoinDynamicFeeConfig, BitcoinDynamicFeeConfigAsset, BitcoinDynamicFeeConfigAssets, BitcoinDynamicFeeCriticalConfig, BitcoinStaticFeeConfig, BitcoinStaticFeeConfigAsset, BitcoinStaticFeeConfigAssets, BitcoinStaticFeeCriticalConfig, Blockchain, BridgeConfig, CriticalConfig, DynamicFeeEstimation, Environment, EthereumAssetConfigBase, EthereumConfigAsset, EthereumConfigAssets, EthereumDynamicFeeAssetConfig, EthereumDynamicFeeConfig, EthereumDynamicFeeConfigAssets, EthereumStaticFeeAssetConfig, EthereumStaticFeeConfig, EthereumStaticFeeConfigAssets, NativeAsset, NetworkType, NonCriticalConfig, RuntimeConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var E=(E=>(E.AVALANCHE="avalanche",E.ETHEREUM="ethereum",E.BITCOIN="bitcoin",E.UNKNOWN="",E))(E||{}),T=(E=>(E.MAINNET="mainnet",E.TESTNET="testnet",E))(T||{}),e=(E=>(E.DEV="development",E.STAGING="staging",E.TEST="test",E.PROD="prod",E))(e||{}),t=(E=>(E[E.NATIVE=0]="NATIVE",E[E.ERC20=1]="ERC20",E[E.BTC=2]="BTC",E))(t||{});export{t as AssetType,E as Blockchain,e as Environment,T as NetworkType};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Asset, NativeAsset, BitcoinConfigAsset, EthereumConfigAsset } from '../types/config.js';
|
|
2
|
+
|
|
3
|
+
declare const isNativeAsset: (asset: Asset) => asset is NativeAsset;
|
|
4
|
+
declare const isBtcAsset: (asset: Asset) => asset is BitcoinConfigAsset;
|
|
5
|
+
declare const isEthAsset: (asset: Asset) => asset is EthereumConfigAsset;
|
|
6
|
+
|
|
7
|
+
export { isBtcAsset, isEthAsset, isNativeAsset };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AssetType as s}from"../types/config.js";const e=e=>e.assetType===s.NATIVE,t=e=>e.assetType===s.BTC,p=e=>e.assetType===s.ERC20;export{t as isBtcAsset,p as isEthAsset,e as isNativeAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import t from"big.js";const m=new t(10),n=new t(0),o=(t,{max:m,min:n})=>t.gt(m)?m:t.lt(n)?n:t;export{m as BIG_TEN,n as BIG_ZERO,o as capped};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AppConfig, Blockchain, BridgeConfig, AppConfigWithDynamicFeesForEthereum, AppConfigWithFullDynamicFees, AppConfigWithDynamicFeesForBitcoin } from '../types/config.js';
|
|
2
|
+
|
|
3
|
+
declare function isMainnetConfig(config: AppConfig): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* @returns the number of required confirmations before the bridge will initiate a transfer.
|
|
6
|
+
*/
|
|
7
|
+
declare function getMinimumConfirmations(blockchain: Blockchain, config: AppConfig): number;
|
|
8
|
+
/**
|
|
9
|
+
* Compares critical sections of the bridge config.
|
|
10
|
+
*/
|
|
11
|
+
declare function hasCriticalChanges(oldConfig: BridgeConfig, newConfig: BridgeConfig): boolean;
|
|
12
|
+
declare function isEthUsingDynamicFees(config: AppConfig): config is AppConfigWithDynamicFeesForEthereum | AppConfigWithFullDynamicFees;
|
|
13
|
+
declare function isBtcUsingDynamicFees(config: AppConfig): config is AppConfigWithDynamicFeesForBitcoin | AppConfigWithFullDynamicFees;
|
|
14
|
+
|
|
15
|
+
export { getMinimumConfirmations, hasCriticalChanges, isBtcUsingDynamicFees, isEthUsingDynamicFees, isMainnetConfig };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{AvalancheNetworkIds as n}from"../constants.js";import{Blockchain as i}from"../types/config.js";function t(i){return i.critical.networks.avalanche===n.MAINNET}function r(n,t){return n===i.BITCOIN?t.nonCriticalBitcoin?.networkInfo.btc.minimumConfirmations||0:t.nonCritical.minimumConfirmations[n]||0}function o(n,i){return JSON.stringify(c(n))!==JSON.stringify(c(i))}function c(n){if(!n.config)return;const{critical:i,criticalBitcoin:t}=n.config;return[i,t]}function e(n){return Boolean(n.critical.useNewFeeStructure)}function u(n){return Boolean(n.criticalBitcoin.useNewFeeStructure)}export{r as getMinimumConfirmations,o as hasCriticalChanges,u as isBtcUsingDynamicFees,e as isEthUsingDynamicFees,t as isMainnetConfig};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import Big from 'big.js';
|
|
2
|
+
import { JsonRpcApiProvider } from 'ethers';
|
|
3
|
+
import { Asset, AppConfig, Blockchain } from '../types/config.js';
|
|
4
|
+
|
|
5
|
+
declare const AVERAGE_TRANSFER_TX_GAS_USAGE = 40000n;
|
|
6
|
+
/**
|
|
7
|
+
* NOTE: These estimates are only supposed to be used to approximate
|
|
8
|
+
* the network fees in the UI.
|
|
9
|
+
*
|
|
10
|
+
* DO NOT use them as `gasLimit` prop on the transactions!
|
|
11
|
+
*/
|
|
12
|
+
declare function estimateGas(amount: Big, account: string, asset: Asset, providers: {
|
|
13
|
+
ethereum: JsonRpcApiProvider;
|
|
14
|
+
avalanche: JsonRpcApiProvider;
|
|
15
|
+
}, config: AppConfig, sourceBlockchain: Blockchain, withSigner?: boolean): Promise<bigint | undefined>;
|
|
16
|
+
|
|
17
|
+
export { AVERAGE_TRANSFER_TX_GAS_USAGE, estimateGas };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{bigToBigInt as t}from"@avalabs/core-utils-sdk";import a from"../abi/erc20.abi.json.js";import e from"../abi/weth.abi.json.js";import r from"../abi/wavax.abi.json.js";import{Blockchain as o}from"../types/config.js";import"./bignumber.js";import{isEthAsset as n,isBtcAsset as s,isNativeAsset as i}from"./asset.js";import{getContract as m}from"./getContract.js";const c=40000n;async function p(c,p,f,u,d,w,l=!1){if(n(f)||s(f)){if(w===o.AVALANCHE){const a=m(f.wrappedContractAddress,r,u.avalanche,p,l),e=await a.unwrap.populateTransaction(t(c,f.denomination),0);return u.avalanche.estimateGas({...e,from:p})}if(n(f)){const e=m(f.nativeContractAddress,a,u.ethereum,p,l),r=await e.transfer.populateTransaction(p,t(c,f.denomination));return u.ethereum.estimateGas({...r,from:p})}}else if(i(f)){const r=d.critical.assets[f.wrappedAssetSymbol];if(!r)throw new Error("Cannot estimate gas: missing wrappedAsset");let n=0n;if(f.nativeNetwork===o.ETHEREUM){const a=m(r.nativeContractAddress,e,u.ethereum,p,l),o=await a.deposit.populateTransaction({value:t(c,f.denomination)});n+=await u.ethereum.estimateGas({...o,from:p})}const s=m(r.nativeContractAddress,a,u.ethereum,p,l),i=await s.transfer.populateTransaction(p,t(c,f.denomination));try{n+=await u.ethereum.estimateGas({...i,from:p})}catch{n+=40000n}return n}}export{c as AVERAGE_TRANSFER_TX_GAS_USAGE,p as estimateGas};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function t(t,i=2){return new Intl.NumberFormat("en-US",{minimumFractionDigits:2,maximumFractionDigits:i}).format(t.toNumber())}export{t as formatTokenAmount};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{isAddress as r,ZeroAddress as n,Contract as e,JsonRpcSigner as t}from"ethers";function o(r,n){return new t(r,n)}function i(r,n,e=!1){return e&&n?o(r,n):r}function u(t,o,u,f,a=!1){if(!r(t)||t===n)throw Error(`Invalid 'address' parameter '${t}'.`);return new e(t,o,i(u,f,a))}export{u as getContract,i as getProviderOrSigner,o as getSigner};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Blockchain as o}from"../types/config.js";function r(r){return r===o.AVALANCHE?"AVAX":"ETH"}export{r as getGasAsset};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{Blockchain as r}from"../types/config.js";function e(e){switch(e){case r.AVALANCHE:return"AVAX";case r.BITCOIN:return"BTC";case r.ETHEREUM:return"ETH";default:return"???"}}export{e as getNativeSymbol};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { BridgeConfig } from 'types';
|
|
2
|
+
|
|
3
|
+
declare const isAddressBlocklisted: ({ addressEVM, addressBTC, bridgeConfig, }: {
|
|
4
|
+
addressEVM?: string | undefined;
|
|
5
|
+
addressBTC?: string | undefined;
|
|
6
|
+
bridgeConfig: BridgeConfig;
|
|
7
|
+
}) => boolean;
|
|
8
|
+
|
|
9
|
+
export { isAddressBlocklisted };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=({addressEVM:i,addressBTC:s,bridgeConfig:c})=>!(!i||!c.config?.critical.addressBlocklist.includes(i))||!(!s||!c.config?.criticalBitcoin.addressBlocklist.includes(s));export{i as isAddressBlocklisted};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{getRuntimeConfig as t}from"../runtime/config.js";async function n(){try{const n=await fetch(t().tokenInfoUrl);return await n.json()}catch(t){return{}}}export{n as loadTokenInfo};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=new Intl.NumberFormat(void 0,{style:"currency",currency:"USD",currencyDisplay:"symbol",minimumFractionDigits:2,maximumFractionDigits:2});export{i as usdFormatter};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
async function t(t,i,n,r,e,o){if(o){return a(await t[i].populateTransaction(...n),r,e,o)}return(await t[i](...n)).hash}async function a(t,a,i,n){const r={...t,from:a},e=await i.estimateGas(r),{chainId:o}=await i.getNetwork(),s=await n({...r,chainId:o,gasLimit:e});if("string"==typeof s)return s;throw new Error("Obtained signing result is not supported")}export{t as callContractTransactionFn,a as signAndSendEVMTransaction};
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@avalabs/core-bridge-sdk",
|
|
3
|
+
"version": "2.8.0-alpha.197",
|
|
4
|
+
"license": "Limited Ecosystem License",
|
|
5
|
+
"private": false,
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"access": "restricted"
|
|
8
|
+
},
|
|
9
|
+
"main": "dist/index.js",
|
|
10
|
+
"module": "esm/index.js",
|
|
11
|
+
"typings": "dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"esm"
|
|
15
|
+
],
|
|
16
|
+
"sideEffects": false,
|
|
17
|
+
"scripts": {
|
|
18
|
+
"start": "rollup -c --watch",
|
|
19
|
+
"build": "rollup -c",
|
|
20
|
+
"lint": "eslint --fix -c ./.eslintrc.js \"src/**/*.ts*\"",
|
|
21
|
+
"test": "jest",
|
|
22
|
+
"test:watch": "jest --watch"
|
|
23
|
+
},
|
|
24
|
+
"devDependencies": {
|
|
25
|
+
"@babel/preset-env": "7.22.20",
|
|
26
|
+
"@types/big.js": "6.1.6",
|
|
27
|
+
"@types/jest": "29.5.12",
|
|
28
|
+
"@types/lodash": "4.14.191",
|
|
29
|
+
"@types/react": "18.0.26",
|
|
30
|
+
"big.js": "6.2.1",
|
|
31
|
+
"bitcoinjs-lib": "5.2.0",
|
|
32
|
+
"coinselect": "3.1.13",
|
|
33
|
+
"ethers": "6.7.1",
|
|
34
|
+
"jest": "29.7.0",
|
|
35
|
+
"lodash": "4.17.21",
|
|
36
|
+
"react": "17.0.2",
|
|
37
|
+
"ts-jest": "29.1.2"
|
|
38
|
+
},
|
|
39
|
+
"dependencies": {
|
|
40
|
+
"@avalabs/core-coingecko-sdk": "2.8.0-alpha.197",
|
|
41
|
+
"@avalabs/core-utils-sdk": "2.8.0-alpha.197",
|
|
42
|
+
"@avalabs/core-wallets-sdk": "2.8.0-alpha.197"
|
|
43
|
+
},
|
|
44
|
+
"peerDependencies": {
|
|
45
|
+
"big.js": "^6.2.1",
|
|
46
|
+
"bitcoinjs-lib": "^5.2.0",
|
|
47
|
+
"coinselect": "^3.1.12",
|
|
48
|
+
"ethers": "^6.7.1",
|
|
49
|
+
"react": "^17.0.2"
|
|
50
|
+
}
|
|
51
|
+
}
|