Skip to content

Commit

Permalink
fix(sdk): use dynamic witness generated by payments API to calculate …
Browse files Browse the repository at this point in the history
…fee (#51)

* fix: use payments witness script for fee calculation

* fix: use payments witness for recovery tx

also, set the updated fees to recovery tx

* revert: remove double fee calculation for fund recovery flow
  • Loading branch information
iamcrazycoder authored Aug 24, 2023
1 parent 23e2fab commit cb15c8c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/sdk/src/transactions/OrdTransaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,10 @@ export class OrdTransaction {
totalInputs: 1,
totalOutputs: 1, // change output
satsPerByte: this.feeRate,
type: "taproot" // hardcoding because recovery is only supported by Taproot txs
type: "taproot", // hardcoding because recovery is only supported by Taproot txs
additional: {
witnessScripts: this.#inscribePayTx.witness
}
})
}

Expand Down Expand Up @@ -222,7 +225,7 @@ export class OrdTransaction {
totalOutputs: 1,
satsPerByte: this.feeRate,
type: "taproot", // hardcoding because this process is only supported by Taproot txs
additional: { witnessScripts: [witnessScript] }
additional: { witnessScripts: inscribePayTx.witness }
})

const customOutsAmount = this.#outs.reduce((acc, cur) => {
Expand Down

0 comments on commit cb15c8c

Please sign in to comment.