fix: insufficient funds and small mistakes
This commit is contained in:
parent
f8a8ea2842
commit
347b240280
2 changed files with 4 additions and 3 deletions
|
|
@ -25,14 +25,14 @@ function defaultWallet (account) {
|
|||
const mnemonic = account.mnemonic
|
||||
if (!mnemonic) throw new Error('No mnemonic seed!')
|
||||
|
||||
return TronWeb.fromMnemonic(mnemonic.replace(/[\r\n]/gm, ' ').trim(), `${DEFAULT_PREFIX_PATH}\/0`)
|
||||
return TronWeb.fromMnemonic(mnemonic.replace(/[\r\n]/gm, ' ').trim(), `${DEFAULT_PREFIX_PATH}/0`)
|
||||
}
|
||||
|
||||
function paymentWallet (account, index) {
|
||||
const mnemonic = account.mnemonic
|
||||
if (!mnemonic) throw new Error('No mnemonic seed!')
|
||||
|
||||
return TronWeb.fromMnemonic(mnemonic.replace(/[\r\n]/gm, ' ').trim(), `${PAYMENT_PREFIX_PATH}\/${index}`)
|
||||
return TronWeb.fromMnemonic(mnemonic.replace(/[\r\n]/gm, ' ').trim(), `${PAYMENT_PREFIX_PATH}/${index}`)
|
||||
}
|
||||
|
||||
function newAddress (account, info, tx, settings, operatorId) {
|
||||
|
|
@ -168,6 +168,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
.then(code => confirmedBalance(toAddress, code))
|
||||
.then((confirmed) => {
|
||||
if (confirmed.gte(requested)) return { receivedCryptoAtoms: confirmed, status: 'confirmed' }
|
||||
if (confirmed.gt(0)) return { receivedCryptoAtoms: confirmed, status: 'insufficientFunds' }
|
||||
return { receivedCryptoAtoms: 0, status: 'notSeen' }
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue