File tree Expand file tree Collapse file tree 4 files changed +10
-9
lines changed
packages/frontend-main/src Expand file tree Collapse file tree 4 files changed +10
-9
lines changed Original file line number Diff line number Diff line change @@ -8,11 +8,9 @@ import { useWallet } from '@/composables/useWallet';
88
99import Input from ' ./Input.vue' ;
1010
11- import { defaultFractionalDigits } from ' @/utility/atomics' ;
12-
1311const emit = defineEmits ([' update:modelValue' , ' onValidityChange' ]);
1412
15- const model = defineModel <number | string >({ default: Decimal .fromAtomics (' 1' , defaultFractionalDigits ).toFloatApproximation () });
13+ const model = defineModel <number | string >({ default: Decimal .fromAtomics (' 1' , 0 ).toFloatApproximation () });
1614
1715const fractionalDigits = useFractionalDigits ();
1816const min = computed (() => Decimal .fromAtomics (' 1' , fractionalDigits ).toFloatApproximation ());
Original file line number Diff line number Diff line change 1- import { defaultFractionalDigits , defaultMinimalCoinDenom } from '@/utility/atomics' ;
1+ import { defaultMinimalCoinDenom } from '@/utility/atomics' ;
22import { getChainConfigLazy } from '@/utility/getChainConfigLazy' ;
33
44export const useFractionalDigits = ( coinMinimalDenom = defaultMinimalCoinDenom ) => {
55 const chainConfig = getChainConfigLazy ( ) ;
6- const currency = chainConfig . value . currencies . find ( c => c . coinMinimalDenom === coinMinimalDenom ) ;
7- return currency ? currency . coinDecimals : defaultFractionalDigits ;
6+ const currency = chainConfig . value . currencies . find (
7+ c => c . coinMinimalDenom === coinMinimalDenom ,
8+ ) ;
9+ if ( ! currency ) {
10+ throw new Error ( `Unknown currency denom: ${ coinMinimalDenom } ` ) ;
11+ }
12+ return currency . coinDecimals ;
813} ;
Original file line number Diff line number Diff line change @@ -3,7 +3,6 @@ import { Decimal } from '@cosmjs/math';
33import { defineStore } from 'pinia' ;
44
55import { envConfigs } from '@/env-config' ;
6- import { defaultFractionalDigits } from '@/utility/atomics' ;
76
87interface Config {
98 selectedChain : keyof typeof envConfigs ;
@@ -15,7 +14,7 @@ interface Config {
1514const defaultConfig : Config = {
1615 envConfigs : envConfigs ,
1716 selectedChain : 'testnet' ,
18- defaultAmountAtomics : Decimal . fromUserInput ( '0. 1' , defaultFractionalDigits ) . atomics ,
17+ defaultAmountAtomics : Decimal . fromUserInput ( '1' , 0 ) . atomics ,
1918 defaultAmountEnabled : false ,
2019} ;
2120
Original file line number Diff line number Diff line change 11import { Decimal } from '@cosmjs/math' ;
22
3- export const defaultFractionalDigits = 6 ;
43export const defaultMinimalCoinDenom = 'uphoton' ;
54
65export const addAtomics = ( firstAtomicsAmount : string , secondAtomicsAmount : string ) => {
You can’t perform that action at this time.
0 commit comments