Changeset View
Changeset View
Standalone View
Standalone View
web/cashtab/src/utils/validation.js
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | export const isValidTokenInitialQty = (tokenInitialQty, tokenDecimals) => { | ||||
const tokenIntialQtyBig = new BigNumber(tokenInitialQty); | const tokenIntialQtyBig = new BigNumber(tokenInitialQty); | ||||
return ( | return ( | ||||
tokenIntialQtyBig.gte(minimumQty) && | tokenIntialQtyBig.gte(minimumQty) && | ||||
tokenIntialQtyBig.lt(100000000000) && | tokenIntialQtyBig.lt(100000000000) && | ||||
tokenIntialQtyBig.dp() <= tokenDecimals | tokenIntialQtyBig.dp() <= tokenDecimals | ||||
); | ); | ||||
}; | }; | ||||
export const formatSavedBalance = swBalance => { | |||||
try { | |||||
if (swBalance == (undefined || null)) { | |||||
return 'N/A'; | |||||
} else { | |||||
return new Number(swBalance).toLocaleString('en-US', { | |||||
maximumFractionDigits: 2, | |||||
}); | |||||
} | |||||
} catch (err) { | |||||
return 'N/A'; | |||||
} | |||||
}; | |||||
export const isValidTokenDocumentUrl = tokenDocumentUrl => { | export const isValidTokenDocumentUrl = tokenDocumentUrl => { | ||||
return ( | return ( | ||||
typeof tokenDocumentUrl === 'string' && | typeof tokenDocumentUrl === 'string' && | ||||
tokenDocumentUrl.length >= 0 && | tokenDocumentUrl.length >= 0 && | ||||
tokenDocumentUrl.length < 68 | tokenDocumentUrl.length < 68 | ||||
); | ); | ||||
}; | }; | ||||
Show All 26 Lines |