support sending funds to external wallet

This commit is contained in:
Josh Harvey 2018-05-17 09:35:22 +03:00
parent dd04b9bb91
commit be53de7326
5 changed files with 2446 additions and 1718 deletions

View file

@ -8,7 +8,6 @@ const fs = pify(require('fs'))
const options = require('./options')
const ph = require('./plugin-helper')
const logger = require('./logger')
const FETCH_INTERVAL = 5000
const INSUFFICIENT_FUNDS_CODE = 570
@ -153,6 +152,16 @@ function cryptoNetwork (settings, cryptoCode) {
return wallet.cryptoNetwork(account, cryptoCode)
}
function isStrictAddress (settings, cryptoCode, toAddress) {
// Note: For now, only for wallets that specifically check for this.
return fetchWallet(settings, cryptoCode)
.then(r => {
if (!r.wallet.isStrictAddress) return true
return r.wallet.isStrictAddress(cryptoCode, toAddress)
})
}
const balance = mem(_balance, {
maxAge: FETCH_INTERVAL,
cacheKey: (settings, cryptoCode) => cryptoCode
@ -163,6 +172,7 @@ module.exports = {
sendCoins,
newAddress,
getStatus,
isStrictAddress,
sweep,
isHd,
newFunding,