Commit 3521bf77 authored by tom's avatar tom

fix getNativeCoinValue util

parent f3412634
import config from 'configs/app/config';
export const getNativeCoinValue = (value: string | Array<unknown>) => { export const getNativeCoinValue = (value: string | Array<unknown>) => {
const _value = Array.isArray(value) ? value[0] : value; const _value = Array.isArray(value) ? value[0] : value;
...@@ -7,7 +5,7 @@ export const getNativeCoinValue = (value: string | Array<unknown>) => { ...@@ -7,7 +5,7 @@ export const getNativeCoinValue = (value: string | Array<unknown>) => {
return BigInt(0); return BigInt(0);
} }
return BigInt(Number(_value) * 10 ** config.network.currency.decimals); return BigInt(Number(_value));
}; };
export const addZeroesAllowed = (valueType: string) => { export const addZeroesAllowed = (valueType: string) => {
...@@ -15,7 +13,7 @@ export const addZeroesAllowed = (valueType: string) => { ...@@ -15,7 +13,7 @@ export const addZeroesAllowed = (valueType: string) => {
return false; return false;
} }
const REGEXP = /u?int(\d+)/i; const REGEXP = /^u?int(\d+)/i;
const match = valueType.match(REGEXP); const match = valueType.match(REGEXP);
const power = match?.[1]; const power = match?.[1];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment