Skip to content

Commit

Permalink
fix: deduct custom outs total to calculate correct change
Browse files Browse the repository at this point in the history
  • Loading branch information
iamcrazycoder committed Jul 27, 2023
1 parent d124da0 commit eed26cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/sdk/src/transactions/OrdTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,10 @@ export class OrdTransaction {
fees = calculateTxFeeWithRate(1, 0, this.feeRate, 1);
}

const change = this.#suitableUnspent.sats - fees;
const customOutsAmount = this.#outs.reduce((acc, cur) => {
return acc + cur.value;
}, 0);
const change = this.#suitableUnspent.sats - fees - customOutsAmount;

const networkObj = getNetwork(this.network);

Expand Down

0 comments on commit eed26cd

Please sign in to comment.