From 6e0f1bf89333ff0ccb43c85f2ec0b6f5a697981b Mon Sep 17 00:00:00 2001 From: Atif Nazir Date: Sat, 13 Nov 2021 23:33:04 +0000 Subject: [PATCH] Bugfix: Dogecoin network fee calculation --- package.json | 2 +- src/constants.js | 18 ++++++++++++++---- src/sweeper.js | 4 ++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index ac21e2c..432f655 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "blockio-basic-multisig-sweep", - "version": "1.1.0", + "version": "1.1.1", "description": "", "main": "example.js", "scripts": { diff --git a/src/constants.js b/src/constants.js index f05c00f..e1630d4 100644 --- a/src/constants.js +++ b/src/constants.js @@ -3,7 +3,6 @@ module.exports = { P2SH: 'P2SH', P2WSH: 'WITNESS_V0', COIN: '100000000', - FEE_RATE: 20, // LTC and BTC, not DOGE N: 100, MAX_TX_INPUTS: 500, BLOCKCHAIN_PROVIDER_DEFAULT: 'sochain', @@ -37,18 +36,29 @@ module.exports = { DOGE: 'DOGE', DOGETEST: 'DOGETEST' }, + FEE_RATE: { + BTC: 20, + LTC: 20, + DOGE: 2000, + BTCTEST: 20, + LTCTEST: 20, + DOGETEST: 2000 + }, DUST: { BTC: 546, LTC: 1000, - DOGE: 1000000 // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md + DOGE: 1000000, // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md + BTCTEST: 546, + LTCTEST: 1000, + DOGETEST: 1000000 // https://github.com/dogecoin/dogecoin/blob/v1.14.5/doc/fee-recommendation.md }, NETWORK_FEE_MAX: { BTC: (250 * 100000), // 0.25 BTC BTCTEST: (250 * 100000), // 0.25 BTCTEST LTC: (50 * 100000), // 0.05 LTC LTCTEST: (50 * 100000), // 0.05 LTCTEST - DOGE: (200 * 100000000), // 200 DOGE - DOGETEST: (200 * 100000000) // 200 DOGETEST + DOGE: (2 * 100000000), // 2.00 DOGE + DOGETEST: (2 * 100000000) // 2.00 DOGETEST }, TX_BROADCAST_APPROVAL_TEXT: 'I have verified this transaction, and I want to broadcast it now' } diff --git a/src/sweeper.js b/src/sweeper.js index 0a50af0..5f6c437 100644 --- a/src/sweeper.js +++ b/src/sweeper.js @@ -20,11 +20,11 @@ function BlockIoSweep (network, bip32_private_key_1, private_key_2, destination_ if (options && typeof (options) === 'object') { this.provider = options.provider || BlockIoSweep.DEFAULT_BLOCKCHAIN_PROVIDER - this.feeRate = options.feeRate || BlockIoSweep.DEFAULT_FEE_RATE + this.feeRate = options.feeRate || BlockIoSweep.DEFAULT_FEE_RATE[network] this.maxTxInputs = options.maxTxInputs || BlockIoSweep.DEFAULT_MAX_TX_INPUTS } else { this.provider = BlockIoSweep.DEFAULT_BLOCKCHAIN_PROVIDER - this.feeRate = BlockIoSweep.DEFAULT_FEE_RATE + this.feeRate = BlockIoSweep.DEFAULT_FEE_RATE[network] this.maxTxInputs = BlockIoSweep.DEFAULT_MAX_TX_INPUTS } this.providerService = new ProviderService(this.provider, this.network)