fix: mempool flag and error handling
This commit is contained in:
parent
6dbb3bad34
commit
4d520f2c24
2 changed files with 12 additions and 12 deletions
|
|
@ -140,23 +140,23 @@ function getWalletScore (tx, pi) {
|
||||||
: _.assign(tx, {
|
: _.assign(tx, {
|
||||||
walletScore: highestScore.score,
|
walletScore: highestScore.score,
|
||||||
error: 'Address score is above defined threshold',
|
error: 'Address score is above defined threshold',
|
||||||
errorCode: 'operatorCancel',
|
errorCode: 'scoreThresholdReached',
|
||||||
dispense: true
|
dispense: true
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.catch(error => _.assign(tx, {
|
.catch(error => _.assign(tx, {
|
||||||
walletScore: 10,
|
walletScore: 10,
|
||||||
error: `Failure getting address score: ${error?.message}`,
|
error: `Failure getting address score: ${error.message}`,
|
||||||
errorCode: 'operatorCancel',
|
errorCode: 'ciphertraceError',
|
||||||
dispense: true
|
dispense: true
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_.includes(tx.status, statuses) && !_.isNil(tx.walletScore)) {
|
if (_.includes(tx.status, statuses) && !_.isNil(tx.walletScore) && _.get('errorCode', tx) !== 'ciphertraceError') {
|
||||||
return pi.isValidWalletScore(tx.walletScore)
|
return pi.isValidWalletScore(tx.walletScore)
|
||||||
.then(isValid => isValid ? tx : _.assign(tx, {
|
.then(isValid => isValid ? tx : _.assign(tx, {
|
||||||
error: 'Address score is above defined threshold',
|
error: 'Address score is above defined threshold',
|
||||||
errorCode: 'operatorCancel',
|
errorCode: 'scoreThresholdReached',
|
||||||
dispense: true
|
dispense: true
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ function getClient(account) {
|
||||||
|
|
||||||
const apiVersion = ctv1.slice(-2)
|
const apiVersion = ctv1.slice(-2)
|
||||||
const authHeader = {
|
const authHeader = {
|
||||||
"Authorization": account.authorizationValue
|
'Authorization': account.authorizationValue
|
||||||
}
|
}
|
||||||
return { apiVersion, authHeader }
|
return { apiVersion, authHeader }
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ function getTransactionHash(account, cryptoCode, receivingAddress) {
|
||||||
|
|
||||||
const { apiVersion, authHeader } = client
|
const { apiVersion, authHeader } = client
|
||||||
|
|
||||||
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}`, {
|
return axios.get(`https://rest.ciphertrace.com/api/${apiVersion}/${_.toLower(cryptoCode) !== 'btc' ? `${_.toLower(cryptoCode)}_` : ``}address/search?features=tx&address=${receivingAddress}&mempool=true`, {
|
||||||
headers: authHeader
|
headers: authHeader
|
||||||
})
|
})
|
||||||
.then(res => {
|
.then(res => {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue