fix: parse address before get tx status
This commit is contained in:
parent
d0b960fd6a
commit
81ef96a670
1 changed files with 4 additions and 3 deletions
|
|
@ -269,6 +269,7 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
return 'notSeen'
|
||||
}
|
||||
const externalCryptoCode = coinUtils.getExternalCryptoCode(cryptoCode)
|
||||
const address = coinUtils.parseUrl(address)
|
||||
return checkCryptoCode(cryptoCode)
|
||||
.then(() => getGaloyAccount(account.apiKey))
|
||||
.then(galoyAccount => {
|
||||
|
|
@ -278,13 +279,13 @@ function getStatus (account, tx, requested, settings, operatorId) {
|
|||
wallet.id === account.walletId)(galoyAccount.wallets)
|
||||
)
|
||||
const transactions = wallet.transactions.edges
|
||||
if (isLightning(toAddress)) {
|
||||
const paymentHash = invoice.decode(toAddress).paymentHash.toString('hex')
|
||||
if (isLightning(address)) {
|
||||
const paymentHash = invoice.decode(address).paymentHash.toString('hex')
|
||||
const transaction = _.head(_.filter(tx => tx.node.initiationVia.paymentHash === paymentHash && tx.node.direction === 'RECEIVE')(transactions))
|
||||
return { receivedCryptoAtoms: cryptoAtoms, status: mapStatus(transaction) }
|
||||
}
|
||||
// On-chain tx
|
||||
const transaction = _.head(_.filter(tx => tx.node.initiationVia.address === toAddress)(transactions))
|
||||
const transaction = _.head(_.filter(tx => tx.node.initiationVia.address === address)(transactions))
|
||||
return { receivedCryptoAtoms: cryptoAtoms, status: mapStatus(transaction) }
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue