Skip to content

Commit

Permalink
BNB Beacon chain support removed
Browse files Browse the repository at this point in the history
  • Loading branch information
0xp3gasus committed Oct 13, 2024
1 parent 4df7cf9 commit bdf0764
Show file tree
Hide file tree
Showing 9 changed files with 7 additions and 27 deletions.
6 changes: 6 additions & 0 deletions .changeset/famous-lizards-doubt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@xchainjs/xchain-thorchain-query': patch
'@xchainjs/xchain-thorchain-amm': patch
---

BNB Beacon chain support removed
1 change: 0 additions & 1 deletion packages/xchain-thorchain-amm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
},
"dependencies": {
"@xchainjs/xchain-avax": "workspace:*",
"@xchainjs/xchain-binance": "workspace:*",
"@xchainjs/xchain-bitcoin": "workspace:*",
"@xchainjs/xchain-bitcoincash": "workspace:*",
"@xchainjs/xchain-bsc": "workspace:*",
Expand Down
2 changes: 0 additions & 2 deletions packages/xchain-thorchain-amm/src/thorchain-amm.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Client as AvaxClient, defaultAvaxParams } from '@xchainjs/xchain-avax'
import { Client as BnbClient } from '@xchainjs/xchain-binance'
import { Client as BtcClient, defaultBTCParams as defaultBtcParams } from '@xchainjs/xchain-bitcoin'
import { Client as BchClient, defaultBchParams } from '@xchainjs/xchain-bitcoincash'
import { Client as BscClient, defaultBscParams } from '@xchainjs/xchain-bsc'
Expand Down Expand Up @@ -95,7 +94,6 @@ export class ThorchainAMM {
AVAX: new AvaxClient({ ...defaultAvaxParams, network: Network.Mainnet }),
BSC: new BscClient({ ...defaultBscParams, network: Network.Mainnet }),
GAIA: new GaiaClient({ network: Network.Mainnet }),
BNB: new BnbClient({ network: Network.Mainnet }),
THOR: new ThorClient({ ...defaultThorParams, network: Network.Mainnet }),
}),
) {
Expand Down
5 changes: 1 addition & 4 deletions packages/xchain-thorchain-amm/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { AVAXChain, AssetAVAX, Client as AvaxClient, defaultAvaxParams } from '@xchainjs/xchain-avax'
import { AssetBNB, BNBChain, Client as BnbClient } from '@xchainjs/xchain-binance'
import { BTCChain, Client as BtcClient, defaultBTCParams as defaultBtcParams } from '@xchainjs/xchain-bitcoin'
import { BCHChain, Client as BchClient, defaultBchParams } from '@xchainjs/xchain-bitcoincash'
import { AssetBSC, BSCChain, Client as BscClient, defaultBscParams } from '@xchainjs/xchain-bsc'
Expand Down Expand Up @@ -59,7 +58,7 @@ export const isTokenCryptoAmount = (amount: CryptoAmount): amount is TokenCrypto
* @returns true if chain is EVM, otherwise, false
*/
export const isProtocolBFTChain = (chain: Chain): boolean => {
return [AssetBNB.chain, AssetATOM.chain].includes(chain)
return [AssetATOM.chain].includes(chain)
}

export const validateAddress = (network: Network, chain: Chain, address: Address): boolean => {
Expand All @@ -80,8 +79,6 @@ export const validateAddress = (network: Network, chain: Chain, address: Address
return new BscClient({ ...defaultBscParams, network }).validateAddress(address)
case GAIAChain:
return new GaiaClient({ network }).validateAddress(address)
case BNBChain:
return new BnbClient({ network }).validateAddress(address)
case THORChain:
return new ThorClient({ ...defaultThorParams, network }).validateAddress(address)
default:
Expand Down
4 changes: 0 additions & 4 deletions packages/xchain-thorchain-query/src/chain-defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ const DefaultChainAttributes: Record<Chain, ChainAttributes> = {
blockReward: 0, // No block reward for Gaia
avgBlockTimeInSecs: 6, // Average block time for Gaia in seconds
},
BNB: {
blockReward: 0, // No block reward for Binance Coin
avgBlockTimeInSecs: 6, // Average block time for Binance Coin in seconds
},
THOR: {
blockReward: 0, // No block reward for THORChain
avgBlockTimeInSecs: 6, // Average block time for THORChain in seconds
Expand Down
6 changes: 0 additions & 6 deletions packages/xchain-thorchain-query/src/thorchain-query.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ import {
getSaver,
} from './types'
import {
AssetBNB,
AssetRuneNative,
BNBChain,
GAIAChain,
Expand Down Expand Up @@ -624,11 +623,6 @@ export class ThorchainQuery {
const assetDecimals = await this.thorchainCache.midgardQuery.getDecimalForAsset(asset)
// Determine the dust values based on the asset's chain
switch (asset.chain) {
case 'BNB':
return {
asset: new AssetCryptoAmount(assetToBase(assetAmount(0.000001, assetDecimals)), AssetBNB),
rune: new AssetCryptoAmount(assetToBase(assetAmount(0)), AssetRuneNative),
}
case 'BTC':
case `BCH`:
case `LTC`:
Expand Down
1 change: 0 additions & 1 deletion packages/xchain-thorchain-query/src/utils/const.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { AnyAsset, Asset, TokenAsset, assetFromStringEx, assetToString } from '@xchainjs/xchain-util'

export const AssetBNB = assetFromStringEx('BNB.BNB') as Asset
export const AssetAVAX = assetFromStringEx('AVAX.AVAX') as Asset
export const AssetBTC = assetFromStringEx('BTC.BTC') as Asset
export const AssetBCH = assetFromStringEx('BCH.BCH') as Asset
Expand Down
8 changes: 0 additions & 8 deletions packages/xchain-thorchain-query/src/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
AssetATOM,
AssetAVAX,
AssetBCH,
AssetBNB,
AssetBSC,
AssetBTC,
AssetDOGE,
Expand Down Expand Up @@ -61,8 +60,6 @@ export const getCryptoAmountWithNotation = <T extends CompatibleAsset>(
*/
export const getChainAsset = (chain: Chain): Asset => {
switch (chain) {
case BNBChain:
return AssetBNB
case BTCChain:
return AssetBTC
case ETHChain:
Expand Down Expand Up @@ -122,8 +119,6 @@ export const calcNetworkFee = (asset: CompatibleAsset, inbound: InboundDetail):
case DOGEChain:
// NOTE: UTXO chains estimate fees with a 250 byte size
return new AssetCryptoAmount(baseAmount(inbound.gasRate.multipliedBy(inbound.outboundTxSize)), AssetDOGE)
case BNBChain:
return new AssetCryptoAmount(baseAmount(inbound.gasRate), AssetBNB)
case ETHChain:
const gasRateinETHGwei = inbound.gasRate
const gasRateinETHWei = baseAmount(gasRateinETHGwei.multipliedBy(10 ** 9), 18)
Expand Down Expand Up @@ -173,9 +168,6 @@ export const calcOutboundFee = (asset: CompatibleAsset, inbound: InboundDetail):
case DOGEChain:
// NOTE: UTXO chains estimate fees with a 250 byte size
return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetDOGE)
case BNBChain:
//flat fee
return new AssetCryptoAmount(baseAmount(inbound.outboundFee), AssetBNB)
case ETHChain:
return new AssetCryptoAmount(baseAmount(inbound.outboundFee.multipliedBy(10 ** 9), 18), AssetETH)
case AVAXChain:
Expand Down
1 change: 0 additions & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4724,7 +4724,6 @@ __metadata:
dependencies:
"@ledgerhq/hw-transport-node-hid": "npm:6.28.6"
"@xchainjs/xchain-avax": "workspace:*"
"@xchainjs/xchain-binance": "workspace:*"
"@xchainjs/xchain-bitcoin": "workspace:*"
"@xchainjs/xchain-bitcoincash": "workspace:*"
"@xchainjs/xchain-bsc": "workspace:*"
Expand Down

0 comments on commit bdf0764

Please sign in to comment.