Skip to content

Commit 8370d08

Browse files
authored
Add setting to show giga-wei as nano-ETH (#3119)
Resolves #3108
1 parent 9c1da48 commit 8370d08

File tree

4 files changed

+6
-2
lines changed

4 files changed

+6
-2
lines changed

configs/app/chain.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ const chain = Object.freeze({
3939
currency: {
4040
name: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_NAME'),
4141
weiName: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME'),
42+
gweiName: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_GWEI_NAME'),
4243
symbol: getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL'),
4344
decimals: Number(getEnvValue('NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS')) || DEFAULT_CURRENCY_DECIMALS,
4445
},

deploy/tools/envs-validator/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -842,6 +842,7 @@ const schema = yup
842842
}),
843843
NEXT_PUBLIC_NETWORK_CURRENCY_NAME: yup.string(),
844844
NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME: yup.string(),
845+
NEXT_PUBLIC_NETWORK_CURRENCY_GWEI_NAME: yup.string(),
845846
NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL: yup.string(),
846847
NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS: yup.number().integer().positive(),
847848
NEXT_PUBLIC_NETWORK_SECONDARY_COIN_SYMBOL: yup.string(),

docs/ENVS.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,8 @@ All json-like values should be single-quoted. If it contains a hash (`#`) or a d
108108
| NEXT_PUBLIC_NETWORK_ID | `number` | Chain id, see [https://chainlist.org](https://chainlist.org) for the reference | Required | - | `99` | v1.0.x+ |
109109
| NEXT_PUBLIC_NETWORK_RPC_URL | `string \| Array<string>` | 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+ |
110110
| NEXT_PUBLIC_NETWORK_CURRENCY_NAME | `string` | Network currency name | - | - | `Ether` | v1.0.x+ |
111-
| NEXT_PUBLIC_NETWORK_CURRENCY_WEI_NAME | `string` | Name of network currency subdenomination | - | `wei` | `duck` | v1.23.0+ |
111+
| 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+ |
112+
| 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` | <upcoming> |
112113
| NEXT_PUBLIC_NETWORK_CURRENCY_SYMBOL | `string` | Network currency symbol | - | - | `ETH` | v1.0.x+ |
113114
| NEXT_PUBLIC_NETWORK_CURRENCY_DECIMALS | `string` | Network currency decimals | - | `18` | `6` | v1.0.x+ |
114115
| NEXT_PUBLIC_NETWORK_SECONDARY_COIN_SYMBOL | `string` | Network secondary coin symbol. | - | - | `GNO` | v1.29.0+ |

lib/units.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,10 @@ import type { Unit } from 'types/unit';
33
import config from 'configs/app';
44

55
const weiName = config.chain.currency.weiName || 'wei';
6+
const gweiName = config.chain.currency.gweiName || `G${ weiName }`;
67

78
export const currencyUnits: Record<Unit, string> = {
89
wei: weiName,
9-
gwei: `G${ weiName }`,
10+
gwei: gweiName,
1011
ether: config.chain.currency.symbol || 'ETH',
1112
};

0 commit comments

Comments
 (0)