@xchainjs/xchain-bitcoin
Advanced tools
Comparing version 0.22.3 to 0.22.4
@@ -122,5 +122,7 @@ import { ExplorerProvider, Network, standardFeeRates, FeeOption, calcFees, UTXOClient, checkFeeBounds } from '@xchainjs/xchain-client'; | ||
const getFee = (inputs, feeRate, data = null) => { | ||
const inputSizeBasedOnInputs = inputs.length > 0 | ||
? inputs.reduce((a, x) => a + inputBytes(x), 0) + inputs.length // +1 byte for each input signature | ||
: (TX_INPUT_BASE + TX_INPUT_PUBKEYHASH) * 2 + 2; // By default 2 UTXOs // Temporal solution until issue addressed https://github.com/xchainjs/xchainjs-lib/issues/850 | ||
let sum = TX_EMPTY_SIZE + | ||
inputs.reduce((a, x) => a + inputBytes(x), 0) + | ||
inputs.length + // +1 byte for each input signature | ||
inputSizeBasedOnInputs + | ||
TX_OUTPUT_BASE + | ||
@@ -354,8 +356,3 @@ TX_OUTPUT_PUBKEYHASH + | ||
checkFeeBounds(this.feeBounds, feeRate); | ||
/** | ||
* do not spend pending UTXOs when adding a memo | ||
* https://github.com/xchainjs/xchainjs-lib/issues/330 | ||
*/ | ||
const spendPendingUTXO = !params.memo; | ||
const { psbt } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate, sender: this.getAddress(fromAddressIndex), spendPendingUTXO })); | ||
const { psbt } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate, sender: this.getAddress(fromAddressIndex) })); | ||
const btcKeys = this.getBtcKeys(this.phrase, fromAddressIndex); | ||
@@ -376,3 +373,3 @@ psbt.signAllInputs(btcKeys); // Sign all inputs | ||
} | ||
buildTx({ amount, recipient, memo, feeRate, sender, spendPendingUTXO = false, // default: prevent spending uncomfirmed UTXOs | ||
buildTx({ amount, recipient, memo, feeRate, sender, spendPendingUTXO = true, // default: prevent spending uncomfirmed UTXOs | ||
}) { | ||
@@ -379,0 +376,0 @@ return __awaiter(this, void 0, void 0, function* () { |
@@ -150,5 +150,7 @@ 'use strict'; | ||
const getFee = (inputs, feeRate, data = null) => { | ||
const inputSizeBasedOnInputs = inputs.length > 0 | ||
? inputs.reduce((a, x) => a + inputBytes(x), 0) + inputs.length // +1 byte for each input signature | ||
: (TX_INPUT_BASE + TX_INPUT_PUBKEYHASH) * 2 + 2; // By default 2 UTXOs // Temporal solution until issue addressed https://github.com/xchainjs/xchainjs-lib/issues/850 | ||
let sum = TX_EMPTY_SIZE + | ||
inputs.reduce((a, x) => a + inputBytes(x), 0) + | ||
inputs.length + // +1 byte for each input signature | ||
inputSizeBasedOnInputs + | ||
TX_OUTPUT_BASE + | ||
@@ -382,8 +384,3 @@ TX_OUTPUT_PUBKEYHASH + | ||
xchainClient.checkFeeBounds(this.feeBounds, feeRate); | ||
/** | ||
* do not spend pending UTXOs when adding a memo | ||
* https://github.com/xchainjs/xchainjs-lib/issues/330 | ||
*/ | ||
const spendPendingUTXO = !params.memo; | ||
const { psbt } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate, sender: this.getAddress(fromAddressIndex), spendPendingUTXO })); | ||
const { psbt } = yield this.buildTx(Object.assign(Object.assign({}, params), { feeRate, sender: this.getAddress(fromAddressIndex) })); | ||
const btcKeys = this.getBtcKeys(this.phrase, fromAddressIndex); | ||
@@ -404,3 +401,3 @@ psbt.signAllInputs(btcKeys); // Sign all inputs | ||
} | ||
buildTx({ amount, recipient, memo, feeRate, sender, spendPendingUTXO = false, // default: prevent spending uncomfirmed UTXOs | ||
buildTx({ amount, recipient, memo, feeRate, sender, spendPendingUTXO = true, // default: prevent spending uncomfirmed UTXOs | ||
}) { | ||
@@ -407,0 +404,0 @@ return __awaiter(this, void 0, void 0, function* () { |
{ | ||
"name": "@xchainjs/xchain-bitcoin", | ||
"version": "0.22.3", | ||
"version": "0.22.4", | ||
"description": "Custom Bitcoin client and utilities used by XChainJS clients", | ||
@@ -40,3 +40,3 @@ "keywords": [ | ||
"@xchainjs/xchain-util": "^0.13.1", | ||
"@xchainjs/xchain-utxo-providers": "^0.2.2", | ||
"@xchainjs/xchain-utxo-providers": "^0.2.4", | ||
"axios": "^1.3.6", | ||
@@ -52,3 +52,3 @@ "axios-mock-adapter": "^1.20.0", | ||
"@xchainjs/xchain-util": "^0.13.1", | ||
"@xchainjs/xchain-utxo-providers": "^0.2.2", | ||
"@xchainjs/xchain-utxo-providers": "^0.2.4", | ||
"axios": "^1.3.6", | ||
@@ -55,0 +55,0 @@ "bitcoinjs-lib": "5.2.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
103972
1087