diff --git a/configs/app/chain.ts b/configs/app/chain.ts index 5dfa4c3f1b..42d7338a02 100644 --- a/configs/app/chain.ts +++ b/configs/app/chain.ts @@ -39,6 +39,7 @@ const chain = Object.freeze({ currency: { name: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_NAME'), weiName: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME'), + gweiName: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_GWEI_NAME'), symbol: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL'), decimals: Number(getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS')) || DEFAULT_CURRENCY_DECIMALS, }, diff --git a/deploy/tools/envs-validator/schema.ts b/deploy/tools/envs-validator/schema.ts index fb093ab18d..b75822a53d 100644 --- a/deploy/tools/envs-validator/schema.ts +++ b/deploy/tools/envs-validator/schema.ts @@ -810,6 +810,7 @@ const schema = yup }), NEXT_PUBLIC_NETWORK_CURRENCY_NAME: yup.string(), NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME: yup.string(), + NEXT_PUBLIC_NETWORK_CURRENCY_GWEI_NAME: yup.string(), NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL: yup.string(), NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS: yup.number().integer().positive(), NEXT_PUBLIC_NETWORK_SECONDARY_COIN_SYMBOL: yup.string(), diff --git a/docs/ENVS.md b/docs/ENVS.md index 6154aeb215..86a64e3081 100644 --- a/docs/ENVS.md +++ b/docs/ENVS.md @@ -108,7 +108,8 @@ All json-like values should be single-quoted. If it contains a hash (`#`) or a d | NEXT_PUBLIC_NETWORK_ID | `number` | Chain id, see [https://chainlist.org](https://chainlist.org) for the reference | Required | - | `99` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_RPC_URL | `string \| Array` | Chain public RPC server url, see [https://chainlist.org](https://chainlist.org) for the reference. Can contain a single string value, or an array of urls. | - | - | `https://core.poa.network` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_CURRENCY_NAME | `string` | Network currency name | - | - | `Ether` | v1.0.x+ | -| NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME | `string` | Name of network currency subdenomination | - | `wei` | `duck` | v1.23.0+ | +| NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME | `string` | Name of the smallest unit of the native currency (e.g., 'wei' for Ethereum, where 1 ETH = 10^18 wei). Used for displaying gas prices and transaction fees in the smallest denomination. | - | `wei` | `duck` | v1.23.0+ | +| NEXT_PUBLIC_NETWORK_CURRENCY_GWEI_NAME | `string` | Name of the giga-unit of the native currency (e.g., 'gwei' for Ethereum, where 1 gwei = 10^9 of the smallest unit). Used for displaying gas prices in a more readable format throughout the UI. | - | `gwei` | `gduck` | | | NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL | `string` | Network currency symbol | - | - | `ETH` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS | `string` | Network currency decimals | - | `18` | `6` | v1.0.x+ | | NEXT_PUBLIC_NETWORK_SECONDARY_COIN_SYMBOL | `string` | Network secondary coin symbol. | - | - | `GNO` | v1.29.0+ | diff --git a/lib/units.ts b/lib/units.ts index 546e4308ee..8d3853aefd 100644 --- a/lib/units.ts +++ b/lib/units.ts @@ -3,9 +3,10 @@ import type { Unit } from 'types/unit'; import config from 'configs/app'; const weiName = config.chain.currency.weiName || 'wei'; +const gweiName = config.chain.currency.gweiName || `G${ weiName }`; export const currencyUnits: Record = { wei: weiName, - gwei: `G${ weiName }`, + gwei: gweiName, ether: config.chain.currency.symbol || 'ETH', };