Skip to content

Commit

Permalink
fix(sdk): create outputs for minimum amount in utxo splitter (#72)
Browse files Browse the repository at this point in the history
* fix: create outputs for minimum amount in utxo splitter

* feat: add split-utxo npm command to run example

* fix: fetch all inscriptions to find by outpoint
  • Loading branch information
iamcrazycoder authored Sep 28, 2023
1 parent 10adba4 commit 1afa18f
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/node/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"create-psbt": "node create-psbt",
"instant-buy": "node instant-buy",
"publish-collection": "node collections",
"build-psbt": "node build-psbt"
"build-psbt": "node build-psbt",
"split-utxo": "node split-utxo"
},
"author": "",
"license": "ISC",
Expand Down
3 changes: 2 additions & 1 deletion packages/sdk/src/instant-trade/InstantTradeBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ export default class InstantTradeBuilder extends PSBTBuilder {
throw new Error("set inscription outpoint to the class")
}

this.inscription = await this.datasource.getInscription(this.inscriptionOutpoint)
const inscriptions = await this.datasource.getInscriptions({ outpoint: this.inscriptionOutpoint })
this.inscription = inscriptions.find((inscription) => inscription.outpoint === this.inscriptionOutpoint)
if (!this.inscription) {
throw new Error("Inscription not found")
}
Expand Down
2 changes: 1 addition & 1 deletion packages/sdk/src/utxos/UTXOManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class UTXOManager extends PSBTBuilder {

this.outputs.push({
address: destinationAddress || this.address,
value: amount
value: MINIMUM_AMOUNT_IN_SATS
})
}

Expand Down

0 comments on commit 1afa18f

Please sign in to comment.