Support ZEC

This commit is contained in:
Josh Harvey 2017-06-24 01:33:10 +03:00
parent 9b51565303
commit 45e6e2b82d
10 changed files with 105 additions and 47 deletions

View file

@ -15,6 +15,7 @@ function balance (account, cryptoCode) {
.then(() => {
if (cryptoCode === 'BTC') return BN(1e8 * 10)
if (cryptoCode === 'ETH') return BN(1e18 * 10)
if (cryptoCode === 'ZEC') return BN(1e8 * 10)
throw new Error('Unsupported crypto: ' + cryptoCode)
})
}
@ -24,6 +25,7 @@ function pendingBalance (account, cryptoCode) {
.then(() => {
if (cryptoCode === 'BTC') return BN(1e8 * 10.1)
if (cryptoCode === 'ETH') return BN(1e18 * 10.1)
if (cryptoCode === 'ZEC') return BN(1e8 * 10.1)
throw new Error('Unsupported crypto: ' + cryptoCode)
})
}
@ -33,16 +35,18 @@ function confirmedBalance (account, cryptoCode) {
.then(() => {
if (cryptoCode === 'BTC') return BN(1e8 * 10)
if (cryptoCode === 'ETH') return BN(1e18 * 10)
if (cryptoCode === 'ZEC') return BN(1e8 * 10)
throw new Error('Unsupported crypto: ' + cryptoCode)
})
}
// Note: This makes it easier to test insufficient funds errors
let sendCount = 0
let sendCount = 100
function isInsufficient (cryptoAtoms, cryptoCode) {
if (cryptoCode === 'BTC') return cryptoAtoms.gt(1e5 * 10 * sendCount)
if (cryptoCode === 'ETH') return cryptoAtoms.gt(1e18 * 0.25 * sendCount)
if (cryptoCode === 'ZEC') return cryptoAtoms.gt(1e5 * 0.25 * sendCount)
throw new Error('Unsupported crypto: ' + cryptoCode)
}