Skip to content

Commit

Permalink
fix(frontend): remove circular reference in tokens env file
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonioVentilii committed Nov 15, 2024
1 parent 8c5a293 commit de5c6de
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
9 changes: 0 additions & 9 deletions src/frontend/src/env/tokens.btc.env.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { BTC_MAINNET_ENABLED } from '$env/networks.btc.env';
import { BTC_MAINNET_NETWORK, BTC_REGTEST_NETWORK, BTC_TESTNET_NETWORK } from '$env/networks.env';
import bitcoin from '$icp/assets/bitcoin.svg';
import bitcoinTestnet from '$icp/assets/bitcoin_testnet.svg';
Expand Down Expand Up @@ -52,11 +51,3 @@ export const BTC_REGTEST_TOKEN: Token = {
decimals: BTC_DECIMALS,
icon: bitcoinTestnet
};

// The following tokens are used as fallback for any Bitcoin token defined in the token store.
// That means that the order of the tokens in the array is important, to have a correct fallback chain.
export const SUPPORTED_BITCOIN_TOKENS: [...Token[], Token] = [
...(BTC_MAINNET_ENABLED ? [BTC_MAINNET_TOKEN] : []),
BTC_TESTNET_TOKEN,
BTC_REGTEST_TOKEN
];
12 changes: 11 additions & 1 deletion src/frontend/src/lib/constants/tokens.constants.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
import { SUPPORTED_BITCOIN_TOKENS } from '$env/tokens.btc.env';
import { BTC_MAINNET_ENABLED } from '$env/networks.btc.env';
import { BTC_MAINNET_TOKEN, BTC_REGTEST_TOKEN, BTC_TESTNET_TOKEN } from '$env/tokens.btc.env';
import { SUPPORTED_ETHEREUM_TOKENS } from '$env/tokens.env';
import type { Token } from '$lib/types/token';

export const [DEFAULT_ETHEREUM_TOKEN, _rest] = SUPPORTED_ETHEREUM_TOKENS;

// The following tokens are used as fallback for any Bitcoin token defined in the token store.
// That means that the order of the tokens in the array is important, to have a correct fallback chain.
export const SUPPORTED_BITCOIN_TOKENS: [...Token[], Token] = [
...(BTC_MAINNET_ENABLED ? [BTC_MAINNET_TOKEN] : []),
BTC_TESTNET_TOKEN,
BTC_REGTEST_TOKEN
];

export const [DEFAULT_BITCOIN_TOKEN, _] = SUPPORTED_BITCOIN_TOKENS;

0 comments on commit de5c6de

Please sign in to comment.