diff --git a/sdk/package.json b/sdk/package.json index 0c6ebc6e..871470ff 100644 --- a/sdk/package.json +++ b/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@gobob/bob-sdk", - "version": "2.2.1", + "version": "2.2.2", "main": "dist/index.js", "types": "dist/index.d.ts", "scripts": { diff --git a/sdk/src/gateway/client.ts b/sdk/src/gateway/client.ts index da15ff54..5c9df2b0 100644 --- a/sdk/src/gateway/client.ts +++ b/sdk/src/gateway/client.ts @@ -206,8 +206,9 @@ export class GatewayApiClient { * * @param uuid The id given by the {@link startOrder} method. * @param bitcoinTxHex The hex encoded Bitcoin transaction. + * @returns {Promise} The Bitcoin txid. */ - async finalizeOrder(uuid: string, bitcoinTxHex: string) { + async finalizeOrder(uuid: string, bitcoinTxHex: string): Promise { const response = await fetch(`${this.baseUrl}/order/${uuid}`, { method: "PATCH", headers: { @@ -220,6 +221,8 @@ export class GatewayApiClient { if (!response.ok) { throw new Error("Failed to update order"); } + + return await response.json(); } /** diff --git a/sdk/src/wallet/utxo.ts b/sdk/src/wallet/utxo.ts index 47ac5bb4..c119d443 100644 --- a/sdk/src/wallet/utxo.ts +++ b/sdk/src/wallet/utxo.ts @@ -167,14 +167,14 @@ export function getInputFromUtxoAndTx( amount: output.amount!, }, }; - const witnessMixin = transaction.hasWitnesses ? witnessUtxo : nonWitnessUtxo; + const witnessMixin = transaction.hasWitnesses ? { ...witnessUtxo, ...nonWitnessUtxo } : nonWitnessUtxo; // Construct inputs based on the script type const input = { txid: utxo.txid, index: utxo.vout, ...scriptMixin, // Maybe adds the redeemScript and/or witnessScript - ...witnessMixin, // Adds the witnessUtxo or nonWitnessUtxo + ...witnessMixin, // Adds the witnessUtxo and/or nonWitnessUtxo }; return input;