Skip to content

Commit

Permalink
fix(fix): fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cgilbe27 committed Nov 1, 2023
1 parent 421f90c commit 0e6b712
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions packages/nibijs/src/chain/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const toSdkDec = (dec: string) => {
let decStr = dec.toString()

if (decStr.length === 0) {
console.log(`Expected decimal string but got: ${decStr}`)
console.error(`Expected decimal string but got: ${decStr}`)
return "0"
}

Expand All @@ -44,7 +44,7 @@ export const toSdkDec = (dec: string) => {
}

if (decStr.length === 0) {
console.log(`Expected decimal string but got: ${decStr}`)
console.error(`Expected decimal string but got: ${decStr}`)
return "0"
}

Expand All @@ -56,17 +56,17 @@ export const toSdkDec = (dec: string) => {
// has a decimal place
lenDigitBlock = digitBlocks[1].length
if (lenDigitBlock === 0 || sdkDec.length === 0) {
console.log(`Expected decimal string but got: ${decStr}`)
console.error(`Expected decimal string but got: ${decStr}`)
return "0"
}
sdkDec += digitBlocks[1]
} else if (digitBlocks.length > 2) {
console.log(`Invalid input has more than one decimal point: ${decStr}`)
console.error(`Invalid input has more than one decimal point: ${decStr}`)
return "0"
}

if (lenDigitBlock > PRECISION) {
console.log(
console.error(
`value \${decStr}' exceeds max precision by ${
PRECISION - lenDigitBlock
} decimal places: max precision ${PRECISION}`
Expand All @@ -81,7 +81,7 @@ export const toSdkDec = (dec: string) => {
sdkDec += zeros

if (Number.isNaN(parseInt(sdkDec, 10))) {
console.log(`failed to set decimal string with base 10: ${sdkDec}`)
console.error(`failed to set decimal string with base 10: ${sdkDec}`)
return "0"
}

Expand All @@ -97,12 +97,12 @@ export const fromSdkDec = (sdkDec: string) => {
}

if (sdkDec.indexOf(".") !== -1) {
console.log(`expected a decimal string but got ${sdkDec} containing '.'`)
console.error(`expected a decimal string but got ${sdkDec} containing '.'`)
return 0
}

if (Number.isNaN(parseInt(sdkDec, 10))) {
console.log(`failed to convert ${sdkDec} to a number`)
console.error(`failed to convert ${sdkDec} to a number`)
return 0
}

Expand Down

0 comments on commit 0e6b712

Please sign in to comment.