cashscript
Advanced tools
Comparing version 0.6.0 to 0.6.1
@@ -216,3 +216,3 @@ "use strict"; | ||
? this.hardcodedFee | ||
: Math.ceil(utils_2.getTxSizeWithoutInputs(this.outputs) * this.feePerByte); | ||
: utils_2.getTxSizeWithoutInputs(this.outputs) * this.feePerByte; | ||
// Select and gather UTXOs and calculate fees and available funds | ||
@@ -224,3 +224,3 @@ let satsAvailable = 0; | ||
if (!this.hardcodedFee) | ||
fee += this.inputs.length * inputSize; | ||
fee += this.inputs.length * inputSize * this.feePerByte; | ||
satsAvailable = this.inputs.reduce((acc, input) => acc + input.satoshis, 0); | ||
@@ -238,3 +238,3 @@ } | ||
if (!this.hardcodedFee) | ||
fee += inputSize; | ||
fee += inputSize * this.feePerByte; | ||
if (satsAvailable > amount + fee) | ||
@@ -244,2 +244,4 @@ break; | ||
} | ||
// Fee per byte can be a decimal number, but we need the total fee to be an integer | ||
fee = Math.ceil(fee); | ||
// Calculate change and check available funds | ||
@@ -246,0 +248,0 @@ let change = satsAvailable - amount - fee; |
@@ -210,3 +210,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
? this.hardcodedFee | ||
: Math.ceil(getTxSizeWithoutInputs(this.outputs) * this.feePerByte); | ||
: getTxSizeWithoutInputs(this.outputs) * this.feePerByte; | ||
// Select and gather UTXOs and calculate fees and available funds | ||
@@ -218,3 +218,3 @@ let satsAvailable = 0; | ||
if (!this.hardcodedFee) | ||
fee += this.inputs.length * inputSize; | ||
fee += this.inputs.length * inputSize * this.feePerByte; | ||
satsAvailable = this.inputs.reduce((acc, input) => acc + input.satoshis, 0); | ||
@@ -232,3 +232,3 @@ } | ||
if (!this.hardcodedFee) | ||
fee += inputSize; | ||
fee += inputSize * this.feePerByte; | ||
if (satsAvailable > amount + fee) | ||
@@ -238,2 +238,4 @@ break; | ||
} | ||
// Fee per byte can be a decimal number, but we need the total fee to be an integer | ||
fee = Math.ceil(fee); | ||
// Calculate change and check available funds | ||
@@ -240,0 +242,0 @@ let change = satsAvailable - amount - fee; |
{ | ||
"name": "cashscript", | ||
"version": "0.6.0", | ||
"version": "0.6.1", | ||
"description": "Easily write and interact with Bitcoin Cash contracts", | ||
@@ -45,3 +45,3 @@ "keywords": [ | ||
"@bitauth/libauth": "^1.18.1", | ||
"@cashscript/utils": "^0.6.0", | ||
"@cashscript/utils": "^0.6.1", | ||
"bip68": "^1.0.4", | ||
@@ -48,0 +48,0 @@ "bitcoin-rpc-promise-retry": "^1.3.0", |
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
132969
2796
Updated@cashscript/utils@^0.6.1