fix: supportsBatching function

This commit is contained in:
Sérgio Salgado 2021-06-07 18:17:06 +01:00
parent 00c38ea721
commit e6be999f02
7 changed files with 21 additions and 7 deletions

View file

@ -10,6 +10,8 @@ const cryptoRec = coinUtils.getCryptoCurrency('BCH')
const configPath = coinUtils.configPath(cryptoRec, options.blockchainDir) const configPath = coinUtils.configPath(cryptoRec, options.blockchainDir)
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = false
function rpcConfig () { function rpcConfig () {
try { try {
const config = jsonRpc.parseConf(configPath) const config = jsonRpc.parseConf(configPath)
@ -131,7 +133,7 @@ function cryptoNetwork (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {

View file

@ -9,6 +9,8 @@ const { utils: coinUtils } = require('lamassu-coins')
const cryptoRec = coinUtils.getCryptoCurrency('BTC') const cryptoRec = coinUtils.getCryptoCurrency('BTC')
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = true
const rpcConfig = jsonRpc.rpcConfig(cryptoRec) const rpcConfig = jsonRpc.rpcConfig(cryptoRec)
function fetch (method, params) { function fetch (method, params) {
@ -172,7 +174,7 @@ function fetchRBF (txId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {

View file

@ -14,6 +14,8 @@ const NAME = 'BitGo'
const SUPPORTED_COINS = ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH'] const SUPPORTED_COINS = ['BTC', 'ZEC', 'LTC', 'BCH', 'DASH']
const BCH_CODES = ['BCH', 'TBCH'] const BCH_CODES = ['BCH', 'TBCH']
const SUPPORTS_BATCHING = false
function buildBitgo (account) { function buildBitgo (account) {
const env = account.environment === 'test' ? 'test' : 'prod' const env = account.environment === 'test' ? 'test' : 'prod'
return new BitGo.BitGo({ accessToken: account.token.trim(), env, userAgent: userAgent }) return new BitGo.BitGo({ accessToken: account.token.trim(), env, userAgent: userAgent })
@ -159,7 +161,7 @@ function cryptoNetwork (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {

View file

@ -9,6 +9,8 @@ const E = require('../../../error')
const cryptoRec = coinUtils.getCryptoCurrency('DASH') const cryptoRec = coinUtils.getCryptoCurrency('DASH')
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = false
const rpcConfig = jsonRpc.rpcConfig(cryptoRec) const rpcConfig = jsonRpc.rpcConfig(cryptoRec)
function fetch (method, params) { function fetch (method, params) {
@ -114,7 +116,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {

View file

@ -17,6 +17,8 @@ const paymentPrefixPath = "m/44'/60'/0'/0'"
const defaultPrefixPath = "m/44'/60'/1'/0'" const defaultPrefixPath = "m/44'/60'/1'/0'"
let lastUsedNonces = {} let lastUsedNonces = {}
const SUPPORTS_BATCHING = false
module.exports = { module.exports = {
NAME, NAME,
balance, balance,
@ -226,5 +228,5 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }

View file

@ -9,6 +9,8 @@ const E = require('../../../error')
const cryptoRec = coinUtils.getCryptoCurrency('LTC') const cryptoRec = coinUtils.getCryptoCurrency('LTC')
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = false
const rpcConfig = jsonRpc.rpcConfig(cryptoRec) const rpcConfig = jsonRpc.rpcConfig(cryptoRec)
function fetch (method, params) { function fetch (method, params) {
@ -114,7 +116,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {

View file

@ -10,6 +10,8 @@ const E = require('../../../error')
const cryptoRec = coinUtils.getCryptoCurrency('ZEC') const cryptoRec = coinUtils.getCryptoCurrency('ZEC')
const unitScale = cryptoRec.unitScale const unitScale = cryptoRec.unitScale
const SUPPORTS_BATCHING = false
const rpcConfig = jsonRpc.rpcConfig(cryptoRec) const rpcConfig = jsonRpc.rpcConfig(cryptoRec)
function fetch (method, params) { function fetch (method, params) {
@ -140,7 +142,7 @@ function newFunding (account, cryptoCode, settings, operatorId) {
function supportsBatching (account, cryptoCode) { function supportsBatching (account, cryptoCode) {
return checkCryptoCode(cryptoCode) return checkCryptoCode(cryptoCode)
.then(() => _.isFunction(sendCoinsBatch)) .then(() => SUPPORTS_BATCHING)
} }
module.exports = { module.exports = {