diff --git a/.changeset/slimy-rockets-watch.md b/.changeset/slimy-rockets-watch.md new file mode 100644 index 00000000..10201d25 --- /dev/null +++ b/.changeset/slimy-rockets-watch.md @@ -0,0 +1,5 @@ +--- +"@rgbpp-sdk/btc": patch +--- + +Fix the message of INSUFFICIENT_UTXO error when collection failed diff --git a/packages/btc/src/transaction/build.ts b/packages/btc/src/transaction/build.ts index 9e8451c6..9ff8de23 100644 --- a/packages/btc/src/transaction/build.ts +++ b/packages/btc/src/transaction/build.ts @@ -310,7 +310,7 @@ export class TxBuilder { // If not collected enough satoshi, throw error const insufficientBalance = collected < targetAmount; if (insufficientBalance) { - const recommendedDeposit = collected - targetAmount + this.minUtxoSatoshi; + const recommendedDeposit = targetAmount - collected + this.minUtxoSatoshi; throw TxBuildError.withComment( ErrorCodes.INSUFFICIENT_UTXO, `expected: ${targetAmount}, actual: ${collected}. You may wanna deposit more satoshi to prevent the error, for example: ${recommendedDeposit}`,