Skip to content

Commit

Permalink
add DEFAULT_BBN_GAS_PRICE
Browse files Browse the repository at this point in the history
  • Loading branch information
jrwbabylonlab committed Jan 13, 2025
1 parent 1c6e18a commit f0cd8c0
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/config/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ import { Network } from "@/utils/wallet/btc_wallet_provider";

import { network } from "./network/btc";

// Default gas price for BABY
const DEFAULT_BBN_GAS_PRICE = 0.002;

// shouldDisplayTestingMsg function is used to check if the application is running in testing mode or not.
// Default to true if the environment variable is not set.
export const shouldDisplayTestingMsg = (): boolean => {
Expand All @@ -25,10 +28,11 @@ export const getBtcNetwork = (): Network => {
export const IS_FIXED_TERM_FIELD =
process.env.NEXT_PUBLIC_FIXED_STAKING_TERM === "true";

// BBN_GAS_PRICE is used to get the gas price for BABY
export const BBN_GAS_PRICE = (() => {
const price = Number(process.env.NEXT_PUBLIC_BBN_GAS_PRICE) || 0.002;
const price = parseFloat(process.env.NEXT_PUBLIC_BBN_GAS_PRICE || "");
if (isNaN(price) || price <= 0 || price >= 1) {
return 0.002; // fallback to default if invalid
return DEFAULT_BBN_GAS_PRICE; // fallback to default if invalid
}
return price;
})();

0 comments on commit f0cd8c0

Please sign in to comment.