@btc-vision/transaction 1.0.55 → 1.0.56
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/_version.d.ts +1 -1
- package/browser/index.js +1 -1
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/transaction/builders/UnwrapTransaction.js +8 -5
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/transaction/builders/UnwrapTransaction.ts +9 -7
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.0.
|
|
1
|
+
export declare const version = "1.0.56";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.56';
|
|
@@ -83,17 +83,20 @@ export class UnwrapTransaction extends SharedInteractionTransaction {
|
|
|
83
83
|
return refund - this.estimatedFeeLoss;
|
|
84
84
|
}
|
|
85
85
|
mergeVaults() {
|
|
86
|
-
const refund = this.getRefund();
|
|
87
86
|
const totalInputAmount = this.getVaultTotalOutputAmount(this.vaultUTXOs);
|
|
88
|
-
|
|
87
|
+
let refund = this.getRefund();
|
|
88
|
+
let outputLeftAmount = totalInputAmount - refund - this.amount;
|
|
89
|
+
if (outputLeftAmount === currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT) {
|
|
90
|
+
refund += currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT;
|
|
91
|
+
}
|
|
92
|
+
else if (outputLeftAmount < currentConsensusConfig.VAULT_MINIMUM_AMOUNT) {
|
|
93
|
+
throw new Error(`Output left amount is below the minimum amount: ${outputLeftAmount} below ${currentConsensusConfig.VAULT_MINIMUM_AMOUNT}`);
|
|
94
|
+
}
|
|
89
95
|
const outAmount = this.amount + refund - this.estimatedFeeLoss;
|
|
90
96
|
const bestVault = BitcoinUtils.findVaultWithMostPublicKeys(this.vaultUTXOs);
|
|
91
97
|
if (!bestVault) {
|
|
92
98
|
throw new Error('No vaults provided');
|
|
93
99
|
}
|
|
94
|
-
if (outputLeftAmount !== 0n && outputLeftAmount < currentConsensusConfig.VAULT_MINIMUM_AMOUNT) {
|
|
95
|
-
throw new Error(`Output left amount is below the minimum amount: ${outputLeftAmount} below ${currentConsensusConfig.VAULT_MINIMUM_AMOUNT}`);
|
|
96
|
-
}
|
|
97
100
|
let hasConsolidation = outputLeftAmount > currentConsensusConfig.VAULT_MINIMUM_AMOUNT &&
|
|
98
101
|
outputLeftAmount - currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT !== 0n;
|
|
99
102
|
if (hasConsolidation) {
|
package/package.json
CHANGED
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.0.
|
|
1
|
+
export const version = '1.0.56';
|
|
@@ -216,21 +216,23 @@ export class UnwrapTransaction extends SharedInteractionTransaction<TransactionT
|
|
|
216
216
|
* @protected
|
|
217
217
|
*/
|
|
218
218
|
protected mergeVaults(): void {
|
|
219
|
-
const refund: bigint = this.getRefund();
|
|
220
219
|
const totalInputAmount: bigint = this.getVaultTotalOutputAmount(this.vaultUTXOs);
|
|
221
|
-
const outputLeftAmount = totalInputAmount - refund - this.amount;
|
|
222
220
|
|
|
223
|
-
|
|
221
|
+
let refund: bigint = this.getRefund();
|
|
222
|
+
let outputLeftAmount = totalInputAmount - refund - this.amount;
|
|
223
|
+
|
|
224
|
+
if(outputLeftAmount === currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT) {
|
|
225
|
+
refund += currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT;
|
|
226
|
+
} else if (outputLeftAmount < currentConsensusConfig.VAULT_MINIMUM_AMOUNT) {
|
|
227
|
+
throw new Error(`Output left amount is below the minimum amount: ${outputLeftAmount} below ${currentConsensusConfig.VAULT_MINIMUM_AMOUNT}`);
|
|
228
|
+
}
|
|
224
229
|
|
|
230
|
+
const outAmount: bigint = this.amount + refund - this.estimatedFeeLoss;
|
|
225
231
|
const bestVault = BitcoinUtils.findVaultWithMostPublicKeys(this.vaultUTXOs);
|
|
226
232
|
if (!bestVault) {
|
|
227
233
|
throw new Error('No vaults provided');
|
|
228
234
|
}
|
|
229
235
|
|
|
230
|
-
if (outputLeftAmount !== 0n && outputLeftAmount < currentConsensusConfig.VAULT_MINIMUM_AMOUNT) {
|
|
231
|
-
throw new Error(`Output left amount is below the minimum amount: ${outputLeftAmount} below ${currentConsensusConfig.VAULT_MINIMUM_AMOUNT}`);
|
|
232
|
-
}
|
|
233
|
-
|
|
234
236
|
let hasConsolidation: boolean =
|
|
235
237
|
outputLeftAmount > currentConsensusConfig.VAULT_MINIMUM_AMOUNT &&
|
|
236
238
|
outputLeftAmount - currentConsensusConfig.UNWRAP_CONSOLIDATION_PREPAID_FEES_SAT !== 0n;
|