diff --git a/hooks/useBtcBalance.ts b/hooks/useBtcBalance.ts index d073ed5d..173f9d88 100644 --- a/hooks/useBtcBalance.ts +++ b/hooks/useBtcBalance.ts @@ -3,7 +3,7 @@ import { useDebounce } from "react-use"; import Decimal from "decimal.js"; import { useBtcWalletSelector, getBtcBalance, getDepositAmount } from "btc-wallet"; import { expandToken, shrinkToken } from "../store/helper"; -import { NBTCTokenId } from "../utils/config"; +import { NBTCTokenId, NBTC_ENV } from "../utils/config"; export function useBtcAction({ tokenId, @@ -19,7 +19,7 @@ export function useBtcAction({ const [availableBalance, setAvailableBalance] = useState(0); const btcSelector = useBtcWalletSelector(); const isBtcTokenId = tokenId == NBTCTokenId; - const env = "mainnet"; + const env = NBTC_ENV; useDebounce( () => { if (btcSelector?.account && isBtcTokenId) { diff --git a/store/actions/supply.ts b/store/actions/supply.ts index 9359901e..144ad64c 100644 --- a/store/actions/supply.ts +++ b/store/actions/supply.ts @@ -2,7 +2,7 @@ import Decimal from "decimal.js"; import { executeBTCDepositAndAction } from "btc-wallet"; import { decimalMin, getBurrow } from "../../utils"; import { expandTokenDecimal } from "../helper"; -import { NBTCTokenId } from "../../utils/config"; +import { NBTCTokenId, NBTC_ENV } from "../../utils/config"; import { ChangeMethodsToken } from "../../interfaces"; import { getTokenContract, getMetadata, prepareAndExecuteTokenTransactions } from "../tokens"; import getBalance from "../../api/get-balance"; @@ -55,7 +55,7 @@ export async function supply({ amount: expandedAmount.toFixed(0), msg: useAsCollateral ? JSON.stringify({ Execute: collateralActions }) : "", }, - env: "mainnet", + env: NBTC_ENV, registerDeposit: "100000000000000000000000", }); } catch (error) { diff --git a/store/actions/withdraw.ts b/store/actions/withdraw.ts index 484a7633..9481105a 100644 --- a/store/actions/withdraw.ts +++ b/store/actions/withdraw.ts @@ -20,7 +20,7 @@ import { transformAssets } from "../../transformers/asstets"; import getAccount from "../../api/get-account"; import { transformAccount } from "../../transformers/account"; import { computeWithdrawMaxAmount } from "../../redux/selectors/getWithdrawMaxAmount"; -import getConfig, { NBTCTokenId } from "../../utils/config"; +import getConfig, { NBTCTokenId, NBTC_ENV } from "../../utils/config"; import { shadow_action_withdraw } from "./shadow"; import { store } from "../../redux/store"; @@ -175,7 +175,7 @@ export async function withdraw({ ); withdraw_to_btc = await getWithdrawTransaction({ amount: withdrawAmount, - env: "mainnet", + env: NBTC_ENV, }); } await prepareAndExecuteTransactions(transactions, isMeme, withdraw_to_btc); diff --git a/utils/config.ts b/utils/config.ts index 21605292..ac17c575 100644 --- a/utils/config.ts +++ b/utils/config.ts @@ -63,6 +63,7 @@ export const NBTCTokenId = { testnet: "nbtc-dev.testnet", mainnet: "nbtc.bridge.near", }[defaultNetwork]; +export const NBTC_ENV = "mainnet"; export const MARGIN_WHITELIST = [ "lini.near", "juaner.near", diff --git a/utils/wallet-selector-compat.ts b/utils/wallet-selector-compat.ts index 28dbc240..65623ae8 100644 --- a/utils/wallet-selector-compat.ts +++ b/utils/wallet-selector-compat.ts @@ -40,6 +40,7 @@ import getConfig, { LOGIC_MEMECONTRACT_NAME, WALLET_CONNECT_ID, isTestnet, + NBTC_ENV, } from "./config"; declare global { @@ -160,7 +161,7 @@ export const getWalletSelector = async ({ onAccountChange }: GetWalletSelectorAr } as any), setupBTCWallet({ autoConnect: true, - env: "mainnet", + env: NBTC_ENV, }) as any, myNearWallet, setupOKXWallet({}),