@btc-vision/transaction 1.0.60 → 1.0.62

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,6 +30,7 @@ export declare class TransactionFactory {
30
30
  createBTCTransfer(parameters: IFundingTransactionParameters): Promise<{
31
31
  estimatedFees: bigint;
32
32
  tx: string;
33
+ nextUTXOs: UTXO[];
33
34
  }>;
34
35
  private createFundTransaction;
35
36
  private calculateNumSignatures;
@@ -1 +1 @@
1
- export declare const version = "1.0.60";
1
+ export declare const version = "1.0.62";
package/build/_version.js CHANGED
@@ -1 +1 @@
1
- export const version = '1.0.60';
1
+ export const version = '1.0.62';
@@ -30,6 +30,7 @@ export declare class TransactionFactory {
30
30
  createBTCTransfer(parameters: IFundingTransactionParameters): Promise<{
31
31
  estimatedFees: bigint;
32
32
  tx: string;
33
+ nextUTXOs: UTXO[];
33
34
  }>;
34
35
  private createFundTransaction;
35
36
  private calculateNumSignatures;
@@ -224,10 +224,14 @@ export class TransactionFactory {
224
224
  };
225
225
  }
226
226
  async createBTCTransfer(parameters) {
227
+ if (!parameters.from) {
228
+ throw new Error('Field "from" not provided.');
229
+ }
227
230
  const resp = await this.createFundTransaction(parameters);
228
231
  return {
229
232
  estimatedFees: resp.estimatedFees,
230
233
  tx: resp.tx.toHex(),
234
+ nextUTXOs: this.getUTXOAsTransaction(resp.tx, parameters.from, 1),
231
235
  };
232
236
  }
233
237
  async createFundTransaction(parameters) {
@@ -158,7 +158,7 @@ export class TransactionBuilder extends TweakedTransaction {
158
158
  });
159
159
  const builtTx = await this.internalBuildTransaction(fakeTx);
160
160
  if (builtTx) {
161
- const tx = fakeTx.extractTransaction(false, true);
161
+ const tx = fakeTx.extractTransaction(true, true);
162
162
  const size = tx.virtualSize();
163
163
  const fee = this.feeRate * size;
164
164
  this.estimatedFees = BigInt(Math.ceil(fee) + 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "module",
3
- "version": "1.0.60",
3
+ "version": "1.0.62",
4
4
  "author": "BlobMaster41",
5
5
  "description": "OPNet transaction library allows you to create and sign transactions for the OPNet network.",
6
6
  "engines": {
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version = '1.0.60';
1
+ export const version = '1.0.62';
@@ -406,12 +406,18 @@ export class TransactionFactory {
406
406
  public async createBTCTransfer(parameters: IFundingTransactionParameters): Promise<{
407
407
  estimatedFees: bigint;
408
408
  tx: string;
409
+ nextUTXOs: UTXO[];
409
410
  }> {
411
+ if(!parameters.from) {
412
+ throw new Error('Field "from" not provided.');
413
+ }
414
+
410
415
  const resp = await this.createFundTransaction(parameters);
411
416
 
412
417
  return {
413
418
  estimatedFees: resp.estimatedFees,
414
419
  tx: resp.tx.toHex(),
420
+ nextUTXOs: this.getUTXOAsTransaction(resp.tx, parameters.from, 1),
415
421
  };
416
422
  }
417
423
 
@@ -345,7 +345,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
345
345
 
346
346
  const builtTx = await this.internalBuildTransaction(fakeTx);
347
347
  if (builtTx) {
348
- const tx = fakeTx.extractTransaction(false, true);
348
+ const tx = fakeTx.extractTransaction(true, true);
349
349
  const size = tx.virtualSize();
350
350
  const fee: number = this.feeRate * size;
351
351