Skip to content

Commit

Permalink
feat: btc env
Browse files Browse the repository at this point in the history
  • Loading branch information
naturexie committed Feb 8, 2025
1 parent 03001a7 commit 36ae3e1
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions hooks/useBtcBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -19,7 +19,7 @@ export function useBtcAction({
const [availableBalance, setAvailableBalance] = useState<number>(0);
const btcSelector = useBtcWalletSelector();
const isBtcTokenId = tokenId == NBTCTokenId;
const env = "mainnet";
const env = NBTC_ENV;
useDebounce(
() => {
if (btcSelector?.account && isBtcTokenId) {
Expand Down
4 changes: 2 additions & 2 deletions store/actions/supply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions store/actions/withdraw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions utils/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion utils/wallet-selector-compat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ import getConfig, {
LOGIC_MEMECONTRACT_NAME,
WALLET_CONNECT_ID,
isTestnet,
NBTC_ENV,
} from "./config";

declare global {
Expand Down Expand Up @@ -160,7 +161,7 @@ export const getWalletSelector = async ({ onAccountChange }: GetWalletSelectorAr
} as any),
setupBTCWallet({
autoConnect: true,
env: "mainnet",
env: NBTC_ENV,
}) as any,
myNearWallet,
setupOKXWallet({}),
Expand Down

0 comments on commit 36ae3e1

Please sign in to comment.