fix: allow 0 balances (#46)

Fix #45
This commit is contained in:
Marvin ROGER 2018-07-27 10:41:16 +02:00 committed by GitHub
commit 299bb3891d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 2705 additions and 2 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -38,6 +38,7 @@ export function checkNumber(candidate: any) {
* @returns Valid * @returns Valid
*/ */
export function checkAmount(amount: string) { export function checkAmount(amount: string) {
if (amount === '0') return true;
if (!checkString(amount) || !/^[1-9]{1}[0-9]{0,38}$/.test(amount)) return false; if (!checkString(amount) || !/^[1-9]{1}[0-9]{0,38}$/.test(amount)) return false;
const candidate = new BigNumber(amount); const candidate = new BigNumber(amount);