format for latest standard
This commit is contained in:
parent
4108efd9c7
commit
c2af183911
77 changed files with 1697 additions and 1693 deletions
|
|
@ -12,27 +12,26 @@ function highConfidence (confidence, txref) {
|
|||
|
||||
function authorize (account, toAddress, cryptoAtoms, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (cryptoCode !== 'BTC') throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
.then(() => {
|
||||
if (cryptoCode !== 'BTC') throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
|
||||
const query = qs.stringify({
|
||||
token: account.token,
|
||||
includeConfidence: true
|
||||
const query = qs.stringify({
|
||||
token: account.token,
|
||||
includeConfidence: true
|
||||
})
|
||||
|
||||
const confidence = account.confidenceFactor
|
||||
|
||||
const url = `https://api.blockcypher.com/v1/btc/main/addrs/${toAddress}?${query}`
|
||||
|
||||
return axios.get(url)
|
||||
.then(r => {
|
||||
const data = r.data
|
||||
const sumTxRefs = txrefs => _.sumBy(txref => highConfidence(confidence, txref), txrefs)
|
||||
|
||||
const authorizedValue = sumTxRefs(data.txrefs) + sumTxRefs(data.unconfirmed_txrefs)
|
||||
|
||||
return cryptoAtoms.lte(authorizedValue)
|
||||
})
|
||||
})
|
||||
|
||||
const confidence = account.confidenceFactor
|
||||
|
||||
const url = `https://api.blockcypher.com/v1/btc/main/addrs/${toAddress}?${query}`
|
||||
|
||||
return axios.get(url)
|
||||
.then(r => {
|
||||
const data = r.data
|
||||
const sumTxRefs = txrefs => _.sumBy(txref => highConfidence(confidence, txref), txrefs)
|
||||
|
||||
const authorizedValue = sumTxRefs(data.txrefs) + sumTxRefs(data.unconfirmed_txrefs)
|
||||
|
||||
return cryptoAtoms.lte(authorizedValue)
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@ module.exports = {authorize}
|
|||
|
||||
function authorize (account, toAddress, cryptoAtoms, cryptoCode) {
|
||||
return Promise.resolve()
|
||||
.then(() => {
|
||||
if (cryptoCode !== 'BTC') throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
.then(() => {
|
||||
if (cryptoCode !== 'BTC') throw new Error('Unsupported crypto: ' + cryptoCode)
|
||||
|
||||
const isAuthorized = false
|
||||
return isAuthorized
|
||||
})
|
||||
const isAuthorized = false
|
||||
return isAuthorized
|
||||
})
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue