@xchainjs/xchain-bsc
Advanced tools
Comparing version 0.4.6 to 0.4.7
@@ -0,5 +1,19 @@ | ||
/** | ||
* Module importing and providing a customized client for the Binance Smart Chain (BSC). | ||
*/ | ||
import { Client as XchainEvmClient } from '@xchainjs/xchain-evm'; | ||
/** | ||
* Customized BSC client extending the base XchainEvmClient. | ||
*/ | ||
export default class Client extends XchainEvmClient { | ||
/** | ||
* Constructor for the BSC client. | ||
* | ||
* @param {Object} config Configuration parameters for the client. Defaults to defaultBscParams if not provided. | ||
*/ | ||
constructor(config?: import("@xchainjs/xchain-evm").EVMClientParams); | ||
} | ||
/** | ||
* Exporting the BSC client. | ||
*/ | ||
export { Client }; |
import { EVMClientParams } from '@xchainjs/xchain-evm'; | ||
import { Asset } from '@xchainjs/xchain-util'; | ||
/** | ||
* Lower fee bound for BSC transactions. | ||
*/ | ||
export declare const LOWER_FEE_BOUND = 2000000000; | ||
/** | ||
* Upper fee bound for BSC transactions. | ||
*/ | ||
export declare const UPPER_FEE_BOUND = 1000000000000; | ||
/** | ||
* Decimal precision for BSC gas asset. | ||
*/ | ||
export declare const BSC_GAS_ASSET_DECIMAL = 18; | ||
/** | ||
* Chain identifier for BSC. | ||
* | ||
* Chain identifier for Binance Smart Chain (BSC). | ||
*/ | ||
export declare const BSCChain: "BSC"; | ||
/** | ||
* Base "chain" asset of Binance smart chain. | ||
* | ||
* Base "chain" asset of Binance Smart Chain (BSC). | ||
*/ | ||
export declare const AssetBSC: Asset; | ||
/** | ||
* Default parameters for the BSC client. | ||
*/ | ||
export declare const defaultBscParams: EVMClientParams; |
@@ -0,2 +1,6 @@ | ||
/** | ||
* This module re-exports the contents of the `client` and `const` modules. | ||
* By re-exporting these modules, consumers can import all the named exports from these modules using a single import statement. | ||
*/ | ||
export * from './client'; | ||
export * from './const'; |
@@ -6,13 +6,23 @@ import { Client as Client$1 } from '@xchainjs/xchain-evm'; | ||
/** | ||
* Module providing configuration parameters and providers for the Binance Smart Chain (BSC) client. | ||
*/ | ||
/** | ||
* Lower fee bound for BSC transactions. | ||
*/ | ||
const LOWER_FEE_BOUND = 2000000000; | ||
/** | ||
* Upper fee bound for BSC transactions. | ||
*/ | ||
const UPPER_FEE_BOUND = 1000000000000; | ||
/** | ||
* Decimal precision for BSC gas asset. | ||
*/ | ||
const BSC_GAS_ASSET_DECIMAL = 18; | ||
/** | ||
* Chain identifier for BSC. | ||
* | ||
* Chain identifier for Binance Smart Chain (BSC). | ||
*/ | ||
const BSCChain = 'BSC'; | ||
/** | ||
* Base "chain" asset of Binance smart chain. | ||
* | ||
* Base "chain" asset of Binance Smart Chain (BSC). | ||
*/ | ||
@@ -25,3 +35,3 @@ const AssetBSC = { | ||
}; | ||
// =====Ethers providers===== | ||
// Ethers providers | ||
const BSC_MAINNET_ETHERS_PROVIDER = new ethers.providers.JsonRpcProvider('https://rpc.ankr.com/bsc'); | ||
@@ -34,4 +44,3 @@ const BSC_TESTNET_ETHERS_PROVIDER = new ethers.providers.JsonRpcProvider('https://bsc-testnet.public.blastapi.io'); | ||
}; | ||
// =====Ethers providers===== | ||
// =====ONLINE providers===== | ||
// ONLINE providers | ||
const BSC_ONLINE_PROVIDER_TESTNET = new EtherscanProvider(BSC_TESTNET_ETHERS_PROVIDER, 'https://api-testnet.bscscan.com', process.env.BSCSCAN_API_KEY || '', BSCChain, AssetBSC, BSC_GAS_ASSET_DECIMAL); | ||
@@ -44,4 +53,3 @@ const BSC_ONLINE_PROVIDER_MAINNET = new EtherscanProvider(BSC_MAINNET_ETHERS_PROVIDER, 'https://api.bscscan.com', process.env.BSCSCAN_API_KEY || '', BSCChain, AssetBSC, BSC_GAS_ASSET_DECIMAL); | ||
}; | ||
// =====ONLINE providers===== | ||
// =====Explorers===== | ||
// Explorers | ||
const BSC_MAINNET_EXPLORER = new ExplorerProvider('https://bscscan.com/', 'https://bscscan.com/address/%%ADDRESS%%', 'https://bscscan.com/tx/%%TX_ID%%'); | ||
@@ -54,3 +62,3 @@ const BSC_TESTNET_EXPLORER = new ExplorerProvider('https://testnet.bscscan.com/', 'https://testnet.bscscan.com/address/%%ADDRESS%%', 'https://testnet.bscscan.com/tx/%%TX_ID%%'); | ||
}; | ||
// =====Explorers===== | ||
// Default parameters | ||
const ethRootDerivationPaths = { | ||
@@ -81,2 +89,5 @@ [Network.Mainnet]: "m/44'/60'/0'/0/", | ||
}; | ||
/** | ||
* Default parameters for the BSC client. | ||
*/ | ||
const defaultBscParams = { | ||
@@ -98,5 +109,16 @@ chain: BSCChain, | ||
/** | ||
* Module importing and providing a customized client for the Binance Smart Chain (BSC). | ||
*/ | ||
/** | ||
* Customized BSC client extending the base XchainEvmClient. | ||
*/ | ||
class Client extends Client$1 { | ||
/** | ||
* Constructor for the BSC client. | ||
* | ||
* @param {Object} config Configuration parameters for the client. Defaults to defaultBscParams if not provided. | ||
*/ | ||
constructor(config = defaultBscParams) { | ||
super(config); | ||
super(config); // Calling the constructor of the base client with the provided configuration or default parameters | ||
} | ||
@@ -103,0 +125,0 @@ } |
@@ -10,13 +10,23 @@ 'use strict'; | ||
/** | ||
* Module providing configuration parameters and providers for the Binance Smart Chain (BSC) client. | ||
*/ | ||
/** | ||
* Lower fee bound for BSC transactions. | ||
*/ | ||
const LOWER_FEE_BOUND = 2000000000; | ||
/** | ||
* Upper fee bound for BSC transactions. | ||
*/ | ||
const UPPER_FEE_BOUND = 1000000000000; | ||
/** | ||
* Decimal precision for BSC gas asset. | ||
*/ | ||
const BSC_GAS_ASSET_DECIMAL = 18; | ||
/** | ||
* Chain identifier for BSC. | ||
* | ||
* Chain identifier for Binance Smart Chain (BSC). | ||
*/ | ||
const BSCChain = 'BSC'; | ||
/** | ||
* Base "chain" asset of Binance smart chain. | ||
* | ||
* Base "chain" asset of Binance Smart Chain (BSC). | ||
*/ | ||
@@ -29,3 +39,3 @@ const AssetBSC = { | ||
}; | ||
// =====Ethers providers===== | ||
// Ethers providers | ||
const BSC_MAINNET_ETHERS_PROVIDER = new ethers.ethers.providers.JsonRpcProvider('https://rpc.ankr.com/bsc'); | ||
@@ -38,4 +48,3 @@ const BSC_TESTNET_ETHERS_PROVIDER = new ethers.ethers.providers.JsonRpcProvider('https://bsc-testnet.public.blastapi.io'); | ||
}; | ||
// =====Ethers providers===== | ||
// =====ONLINE providers===== | ||
// ONLINE providers | ||
const BSC_ONLINE_PROVIDER_TESTNET = new xchainEvmProviders.EtherscanProvider(BSC_TESTNET_ETHERS_PROVIDER, 'https://api-testnet.bscscan.com', process.env.BSCSCAN_API_KEY || '', BSCChain, AssetBSC, BSC_GAS_ASSET_DECIMAL); | ||
@@ -48,4 +57,3 @@ const BSC_ONLINE_PROVIDER_MAINNET = new xchainEvmProviders.EtherscanProvider(BSC_MAINNET_ETHERS_PROVIDER, 'https://api.bscscan.com', process.env.BSCSCAN_API_KEY || '', BSCChain, AssetBSC, BSC_GAS_ASSET_DECIMAL); | ||
}; | ||
// =====ONLINE providers===== | ||
// =====Explorers===== | ||
// Explorers | ||
const BSC_MAINNET_EXPLORER = new xchainClient.ExplorerProvider('https://bscscan.com/', 'https://bscscan.com/address/%%ADDRESS%%', 'https://bscscan.com/tx/%%TX_ID%%'); | ||
@@ -58,3 +66,3 @@ const BSC_TESTNET_EXPLORER = new xchainClient.ExplorerProvider('https://testnet.bscscan.com/', 'https://testnet.bscscan.com/address/%%ADDRESS%%', 'https://testnet.bscscan.com/tx/%%TX_ID%%'); | ||
}; | ||
// =====Explorers===== | ||
// Default parameters | ||
const ethRootDerivationPaths = { | ||
@@ -85,2 +93,5 @@ [xchainClient.Network.Mainnet]: "m/44'/60'/0'/0/", | ||
}; | ||
/** | ||
* Default parameters for the BSC client. | ||
*/ | ||
const defaultBscParams = { | ||
@@ -102,5 +113,16 @@ chain: BSCChain, | ||
/** | ||
* Module importing and providing a customized client for the Binance Smart Chain (BSC). | ||
*/ | ||
/** | ||
* Customized BSC client extending the base XchainEvmClient. | ||
*/ | ||
class Client extends xchainEvm.Client { | ||
/** | ||
* Constructor for the BSC client. | ||
* | ||
* @param {Object} config Configuration parameters for the client. Defaults to defaultBscParams if not provided. | ||
*/ | ||
constructor(config = defaultBscParams) { | ||
super(config); | ||
super(config); // Calling the constructor of the base client with the provided configuration or default parameters | ||
} | ||
@@ -107,0 +129,0 @@ } |
{ | ||
"name": "@xchainjs/xchain-bsc", | ||
"version": "0.4.6", | ||
"version": "0.4.7", | ||
"description": "Binance Smart Chain EVM client for XChainJS", | ||
@@ -27,3 +27,3 @@ "keywords": [ | ||
"scripts": { | ||
"clean": "rimraf lib/**", | ||
"clean": "rimraf --glob ./lib/**", | ||
"build": "yarn clean && rollup -c", | ||
@@ -39,7 +39,7 @@ "test": "jest --passWithNoTests", | ||
"devDependencies": { | ||
"@xchainjs/xchain-client": "^0.16.1", | ||
"@xchainjs/xchain-client": "^0.16.2", | ||
"@xchainjs/xchain-crypto": "^0.3.1", | ||
"@xchainjs/xchain-evm": "^0.4.4", | ||
"@xchainjs/xchain-util": "^0.13.1", | ||
"@xchainjs/xchain-evm-providers": "^0.1.6", | ||
"@xchainjs/xchain-evm": "^0.4.5", | ||
"@xchainjs/xchain-util": "^0.13.3", | ||
"@xchainjs/xchain-evm-providers": "^0.1.7", | ||
"axios": "^1.3.6", | ||
@@ -49,7 +49,7 @@ "ethers": "^5.7.2" | ||
"peerDependencies": { | ||
"@xchainjs/xchain-client": "^0.16.1", | ||
"@xchainjs/xchain-client": "^0.16.2", | ||
"@xchainjs/xchain-crypto": "^0.3.1", | ||
"@xchainjs/xchain-evm": "^0.4.4", | ||
"@xchainjs/xchain-util": "^0.13.1", | ||
"@xchainjs/xchain-evm-providers": "^0.1.6", | ||
"@xchainjs/xchain-evm": "^0.4.5", | ||
"@xchainjs/xchain-util": "^0.13.3", | ||
"@xchainjs/xchain-evm-providers": "^0.1.7", | ||
"axios": "^1.3.6", | ||
@@ -56,0 +56,0 @@ "ethers": "^5.7.2" |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
32297
295