@btc-vision/transaction 1.0.87 → 1.0.89

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.
@@ -1,135 +1,135 @@
1
- import { Address } from '@btc-vision/bsi-binary';
2
- import { ChainId } from '../network/ChainId.js';
3
-
4
- // Addresses Regtest
5
- export const FACTORY_ADDRESS_REGTEST: Address = 'bcrt1qxtpreq8zg7pp9wm550kjrhaa2r5kj6lhph9he5';
6
- export const POOL_ADDRESS_REGTEST: Address = 'bcrt1qqg2a8076rwuruzetdyquj8fh5jxtc22pmh9vep';
7
- export const WBTC_ADDRESS_REGTEST: Address = 'bcrt1qdr7sjgtnudda8zrfklw8l5cnrxum5hns7e46hf';
8
- export const MOTO_ADDRESS_REGTEST: Address = 'bcrt1q8reuxx9naek4mqesrfsgdpjv3q7a5g2llkh6ua';
9
- export const ROUTER_ADDRESS_REGTEST: Address = 'bcrt1qplnz54sca73t8a03nh494jatr9ffjg6ecarrj8';
10
-
11
- // Addresses Testnet
12
- export const FACTORY_ADDRESS_TESTNET: Address = 'tb1qgev5kldhp5zvg6j8t9vl6x4phkrwn8nk9felxh';
13
- export const POOL_ADDRESS_TESTNET: Address = 'tb1q6a7yw353hjmresphupytw5vczpqxtg4yrupayk';
14
- export const WBTC_ADDRESS_TESTNET: Address = 'tb1qp28xna6pv47x6wflcplhu0a9hkld5shtvjx6xv';
15
- export const MOTO_ADDRESS_TESTNET: Address = 'tb1q4tyhf8hpu04qjj3qaag20knun0spctultxzakw';
16
- export const ROUTER_ADDRESS_TESTNET: Address = 'tb1qnh9mj95nnej25dwhjvvsppwmdm0myhxv7tllgt';
17
-
18
- // Addresses Fractal
19
- export const FACTORY_ADDRESS_FRACTAL: Address = 'bc1qr4g85824m58wu0zffjtnf56n425fp0e8azhc7q';
20
- export const POOL_ADDRESS_FRACTAL: Address = 'bc1qv55cht4zzlt29ea7vdgwsedsn63a2sxtkgpv6h';
21
- export const WBTC_ADDRESS_FRACTAL: Address = 'u fou';
22
- export const MOTO_ADDRESS_FRACTAL: Address = 'bc1qfzq6w5uvgg5489egv0lj4shlqx4dagqt0ewdnu';
23
- export const ROUTER_ADDRESS_FRACTAL: Address = 'bc1q9w2zvmkzlezt2fu34u57y9vuw6rll5sp2090kn';
24
-
25
- export enum OPNetNetwork {
26
- Mainnet = 'mainnet',
27
- Testnet = 'testnet',
28
- Regtest = 'regtest',
29
- }
30
-
31
- export interface OPNetTokenMetadata {
32
- readonly factory: Address;
33
- readonly pool: Address;
34
- readonly wbtc: Address;
35
- readonly moto: Address;
36
- readonly router: Address;
37
- }
38
-
39
- export class OPNetTokenAddressManager {
40
- private readonly metadata: {
41
- [key in ChainId]: { [key in OPNetNetwork]?: OPNetTokenMetadata };
42
- } = {
43
- [ChainId.Bitcoin]: {
44
- [OPNetNetwork.Testnet]: {
45
- factory: FACTORY_ADDRESS_TESTNET,
46
- pool: POOL_ADDRESS_TESTNET,
47
- wbtc: WBTC_ADDRESS_TESTNET,
48
- moto: MOTO_ADDRESS_TESTNET,
49
- router: ROUTER_ADDRESS_TESTNET,
50
- },
51
- [OPNetNetwork.Regtest]: {
52
- factory: FACTORY_ADDRESS_REGTEST,
53
- pool: POOL_ADDRESS_REGTEST,
54
- wbtc: WBTC_ADDRESS_REGTEST,
55
- moto: MOTO_ADDRESS_REGTEST,
56
- router: ROUTER_ADDRESS_REGTEST,
57
- },
58
- },
59
- [ChainId.Fractal]: {
60
- [OPNetNetwork.Mainnet]: {
61
- factory: FACTORY_ADDRESS_FRACTAL,
62
- pool: POOL_ADDRESS_FRACTAL,
63
- wbtc: WBTC_ADDRESS_FRACTAL,
64
- moto: MOTO_ADDRESS_FRACTAL,
65
- router: ROUTER_ADDRESS_FRACTAL,
66
- },
67
- },
68
- };
69
-
70
- public getFactoryAddress(network: OPNetNetwork, chainId: ChainId): Address {
71
- const address = this.metadata[chainId][network]?.factory;
72
-
73
- if (!address) {
74
- throw new Error(
75
- `Factory address not found for network ${network} and chainId ${chainId}`,
76
- );
77
- }
78
-
79
- return address;
80
- }
81
-
82
- public getPoolAddress(network: OPNetNetwork, chainId: ChainId): Address {
83
- const address = this.metadata[chainId][network]?.pool;
84
-
85
- if (!address) {
86
- throw new Error(`Pool address not found for network ${network} and chainId ${chainId}`);
87
- }
88
-
89
- return address;
90
- }
91
-
92
- public getWBTCAddress(network: OPNetNetwork, chainId: ChainId): Address {
93
- const address = this.metadata[chainId][network]?.wbtc;
94
-
95
- if (!address) {
96
- throw new Error(`WBTC address not found for network ${network} and chainId ${chainId}`);
97
- }
98
-
99
- return address;
100
- }
101
-
102
- public getMOTOAddress(network: OPNetNetwork, chainId: ChainId): Address {
103
- const address = this.metadata[chainId][network]?.moto;
104
-
105
- if (!address) {
106
- throw new Error(`MOTO address not found for network ${network} and chainId ${chainId}`);
107
- }
108
-
109
- return address;
110
- }
111
-
112
- public getRouterAddress(network: OPNetNetwork, chainId: ChainId): Address {
113
- const address = this.metadata[chainId][network]?.router;
114
-
115
- if (!address) {
116
- throw new Error(
117
- `Router address not found for network ${network} and chainId ${chainId}`,
118
- );
119
- }
120
-
121
- return address;
122
- }
123
-
124
- public getAddresses(network: OPNetNetwork, chainId: ChainId): OPNetTokenMetadata {
125
- const metadata = this.metadata[chainId][network];
126
-
127
- if (!metadata) {
128
- throw new Error(`Metadata not found for network ${network} and chainId ${chainId}`);
129
- }
130
-
131
- return metadata;
132
- }
133
- }
134
-
135
- export const OPNetMetadata: OPNetTokenAddressManager = new OPNetTokenAddressManager();
1
+ import { Address } from '@btc-vision/bsi-binary';
2
+ import { ChainId } from '../network/ChainId.js';
3
+
4
+ // Addresses Regtest
5
+ export const FACTORY_ADDRESS_REGTEST: Address = 'bcrt1qxtpreq8zg7pp9wm550kjrhaa2r5kj6lhph9he5';
6
+ export const POOL_ADDRESS_REGTEST: Address = 'bcrt1qqg2a8076rwuruzetdyquj8fh5jxtc22pmh9vep';
7
+ export const WBTC_ADDRESS_REGTEST: Address = 'bcrt1qdr7sjgtnudda8zrfklw8l5cnrxum5hns7e46hf';
8
+ export const MOTO_ADDRESS_REGTEST: Address = 'bcrt1q8reuxx9naek4mqesrfsgdpjv3q7a5g2llkh6ua';
9
+ export const ROUTER_ADDRESS_REGTEST: Address = 'bcrt1qplnz54sca73t8a03nh494jatr9ffjg6ecarrj8';
10
+
11
+ // Addresses Testnet
12
+ export const FACTORY_ADDRESS_TESTNET: Address = 'tb1qgev5kldhp5zvg6j8t9vl6x4phkrwn8nk9felxh';
13
+ export const POOL_ADDRESS_TESTNET: Address = 'tb1q6a7yw353hjmresphupytw5vczpqxtg4yrupayk';
14
+ export const WBTC_ADDRESS_TESTNET: Address = 'tb1qp28xna6pv47x6wflcplhu0a9hkld5shtvjx6xv';
15
+ export const MOTO_ADDRESS_TESTNET: Address = 'tb1q4tyhf8hpu04qjj3qaag20knun0spctultxzakw';
16
+ export const ROUTER_ADDRESS_TESTNET: Address = 'tb1qnh9mj95nnej25dwhjvvsppwmdm0myhxv7tllgt';
17
+
18
+ // Addresses Fractal
19
+ export const FACTORY_ADDRESS_FRACTAL: Address = 'bc1qr4g85824m58wu0zffjtnf56n425fp0e8azhc7q';
20
+ export const POOL_ADDRESS_FRACTAL: Address = 'bc1qv55cht4zzlt29ea7vdgwsedsn63a2sxtkgpv6h';
21
+ export const WBTC_ADDRESS_FRACTAL: Address = 'bc1qdtzlucslvrvu4useyh9r69supqrw3w4xn9t4yv';
22
+ export const MOTO_ADDRESS_FRACTAL: Address = 'bc1qfzq6w5uvgg5489egv0lj4shlqx4dagqt0ewdnu';
23
+ export const ROUTER_ADDRESS_FRACTAL: Address = 'bc1q9w2zvmkzlezt2fu34u57y9vuw6rll5sp2090kn';
24
+
25
+ export enum OPNetNetwork {
26
+ Mainnet = 'mainnet',
27
+ Testnet = 'testnet',
28
+ Regtest = 'regtest',
29
+ }
30
+
31
+ export interface OPNetTokenMetadata {
32
+ readonly factory: Address;
33
+ readonly pool: Address;
34
+ readonly wbtc: Address;
35
+ readonly moto: Address;
36
+ readonly router: Address;
37
+ }
38
+
39
+ export class OPNetTokenAddressManager {
40
+ private readonly metadata: {
41
+ [key in ChainId]: { [key in OPNetNetwork]?: OPNetTokenMetadata };
42
+ } = {
43
+ [ChainId.Bitcoin]: {
44
+ [OPNetNetwork.Testnet]: {
45
+ factory: FACTORY_ADDRESS_TESTNET,
46
+ pool: POOL_ADDRESS_TESTNET,
47
+ wbtc: WBTC_ADDRESS_TESTNET,
48
+ moto: MOTO_ADDRESS_TESTNET,
49
+ router: ROUTER_ADDRESS_TESTNET,
50
+ },
51
+ [OPNetNetwork.Regtest]: {
52
+ factory: FACTORY_ADDRESS_REGTEST,
53
+ pool: POOL_ADDRESS_REGTEST,
54
+ wbtc: WBTC_ADDRESS_REGTEST,
55
+ moto: MOTO_ADDRESS_REGTEST,
56
+ router: ROUTER_ADDRESS_REGTEST,
57
+ },
58
+ },
59
+ [ChainId.Fractal]: {
60
+ [OPNetNetwork.Mainnet]: {
61
+ factory: FACTORY_ADDRESS_FRACTAL,
62
+ pool: POOL_ADDRESS_FRACTAL,
63
+ wbtc: WBTC_ADDRESS_FRACTAL,
64
+ moto: MOTO_ADDRESS_FRACTAL,
65
+ router: ROUTER_ADDRESS_FRACTAL,
66
+ },
67
+ },
68
+ };
69
+
70
+ public getFactoryAddress(network: OPNetNetwork, chainId: ChainId): Address {
71
+ const address = this.metadata[chainId][network]?.factory;
72
+
73
+ if (!address) {
74
+ throw new Error(
75
+ `Factory address not found for network ${network} and chainId ${chainId}`,
76
+ );
77
+ }
78
+
79
+ return address;
80
+ }
81
+
82
+ public getPoolAddress(network: OPNetNetwork, chainId: ChainId): Address {
83
+ const address = this.metadata[chainId][network]?.pool;
84
+
85
+ if (!address) {
86
+ throw new Error(`Pool address not found for network ${network} and chainId ${chainId}`);
87
+ }
88
+
89
+ return address;
90
+ }
91
+
92
+ public getWBTCAddress(network: OPNetNetwork, chainId: ChainId): Address {
93
+ const address = this.metadata[chainId][network]?.wbtc;
94
+
95
+ if (!address) {
96
+ throw new Error(`WBTC address not found for network ${network} and chainId ${chainId}`);
97
+ }
98
+
99
+ return address;
100
+ }
101
+
102
+ public getMOTOAddress(network: OPNetNetwork, chainId: ChainId): Address {
103
+ const address = this.metadata[chainId][network]?.moto;
104
+
105
+ if (!address) {
106
+ throw new Error(`MOTO address not found for network ${network} and chainId ${chainId}`);
107
+ }
108
+
109
+ return address;
110
+ }
111
+
112
+ public getRouterAddress(network: OPNetNetwork, chainId: ChainId): Address {
113
+ const address = this.metadata[chainId][network]?.router;
114
+
115
+ if (!address) {
116
+ throw new Error(
117
+ `Router address not found for network ${network} and chainId ${chainId}`,
118
+ );
119
+ }
120
+
121
+ return address;
122
+ }
123
+
124
+ public getAddresses(network: OPNetNetwork, chainId: ChainId): OPNetTokenMetadata {
125
+ const metadata = this.metadata[chainId][network];
126
+
127
+ if (!metadata) {
128
+ throw new Error(`Metadata not found for network ${network} and chainId ${chainId}`);
129
+ }
130
+
131
+ return metadata;
132
+ }
133
+ }
134
+
135
+ export const OPNetMetadata: OPNetTokenAddressManager = new OPNetTokenAddressManager();
@@ -19,6 +19,8 @@ import { VaultUTXOs } from './processor/PsbtTransaction.js';
19
19
  import { UnwrapSegwitTransaction } from './builders/UnwrapSegwitTransaction.js';
20
20
  import { UnwrapTransaction } from './builders/UnwrapTransaction.js';
21
21
  import { currentConsensus, currentConsensusConfig } from '../consensus/ConsensusConfig.js';
22
+ import { TransactionBuilder } from './builders/TransactionBuilder.js';
23
+ import { TransactionType } from './enums/TransactionType.js';
22
24
 
23
25
  export interface DeploymentResult {
24
26
  readonly transaction: [string, string];
@@ -37,6 +39,20 @@ export interface WrapResult {
37
39
  readonly utxos: UTXO[];
38
40
  }
39
41
 
42
+ export interface FundingTransactionResponse {
43
+ readonly tx: Transaction;
44
+ readonly original: FundingTransaction;
45
+ readonly estimatedFees: bigint;
46
+ readonly nextUTXOs: UTXO[];
47
+ }
48
+
49
+ export interface BitcoinTransferResponse {
50
+ readonly tx: string;
51
+ readonly original: FundingTransaction;
52
+ readonly estimatedFees: bigint;
53
+ readonly nextUTXOs: UTXO[];
54
+ }
55
+
40
56
  export interface UnwrapResult {
41
57
  readonly fundingTransaction: string;
42
58
  readonly psbt: string;
@@ -403,11 +419,9 @@ export class TransactionFactory {
403
419
  * @param {IFundingTransactionParameters} parameters - The funding transaction parameters
404
420
  * @returns {Promise<{ estimatedFees: bigint; tx: string }>} - The signed transaction
405
421
  */
406
- public async createBTCTransfer(parameters: IFundingTransactionParameters): Promise<{
407
- estimatedFees: bigint;
408
- tx: string;
409
- nextUTXOs: UTXO[];
410
- }> {
422
+ public async createBTCTransfer(
423
+ parameters: IFundingTransactionParameters,
424
+ ): Promise<BitcoinTransferResponse> {
411
425
  if (!parameters.from) {
412
426
  throw new Error('Field "from" not provided.');
413
427
  }
@@ -416,16 +430,45 @@ export class TransactionFactory {
416
430
 
417
431
  return {
418
432
  estimatedFees: resp.estimatedFees,
433
+ original: resp.original,
419
434
  tx: resp.tx.toHex(),
420
- nextUTXOs: this.getUTXOAsTransaction(resp.tx, parameters.from, 1),
435
+ nextUTXOs: this.getAllNewUTXOs(resp.original, resp.tx, parameters.from),
421
436
  };
422
437
  }
423
438
 
424
- private async createFundTransaction(parameters: IFundingTransactionParameters): Promise<{
425
- tx: Transaction;
426
- original: FundingTransaction;
427
- estimatedFees: bigint;
428
- }> {
439
+ /**
440
+ * Get all new UTXOs of a generated transaction.
441
+ * @param {TransactionBuilder<TransactionType>} original - The original transaction
442
+ * @param {Transaction} tx - The transaction
443
+ * @param {Address} to - The address to filter
444
+ */
445
+ public getAllNewUTXOs(
446
+ original: TransactionBuilder<TransactionType>,
447
+ tx: Transaction,
448
+ to: Address,
449
+ ): UTXO[] {
450
+ const outputs = original.getOutputs();
451
+
452
+ const utxos: UTXO[] = [];
453
+ for (let i = 0; i < tx.outs.length; i++) {
454
+ const output = outputs[i];
455
+ if ('address' in output) {
456
+ if (output.address !== to) continue;
457
+ } else {
458
+ continue;
459
+ }
460
+
461
+ utxos.push(...this.getUTXOAsTransaction(tx, to, i));
462
+ }
463
+
464
+ return utxos;
465
+ }
466
+
467
+ private async createFundTransaction(
468
+ parameters: IFundingTransactionParameters,
469
+ ): Promise<FundingTransactionResponse> {
470
+ if (!parameters.to) throw new Error('Field "to" not provided.');
471
+
429
472
  const fundingTransaction: FundingTransaction = new FundingTransaction(parameters);
430
473
  const signedTransaction: Transaction = await fundingTransaction.signTransaction();
431
474
  if (!signedTransaction) {
@@ -435,7 +478,8 @@ export class TransactionFactory {
435
478
  return {
436
479
  tx: signedTransaction,
437
480
  original: fundingTransaction,
438
- estimatedFees: await fundingTransaction.estimateTransactionFees(),
481
+ estimatedFees: fundingTransaction.estimatedFees,
482
+ nextUTXOs: this.getUTXOAsTransaction(signedTransaction, parameters.to, 0),
439
483
  };
440
484
  }
441
485
 
@@ -6,12 +6,14 @@ import { TransactionBuilder } from './TransactionBuilder.js';
6
6
  export class FundingTransaction extends TransactionBuilder<TransactionType.FUNDING> {
7
7
  public readonly type: TransactionType.FUNDING = TransactionType.FUNDING;
8
8
 
9
- protected childTransactionRequiredFees: bigint;
9
+ protected amount: bigint;
10
+ protected splitInputsInto: number;
10
11
 
11
12
  constructor(parameters: IFundingTransactionParameters) {
12
13
  super(parameters);
13
14
 
14
- this.childTransactionRequiredFees = parameters.amount;
15
+ this.amount = parameters.amount;
16
+ this.splitInputsInto = parameters.splitInputsInto ?? 1;
15
17
 
16
18
  this.internalInit();
17
19
  }
@@ -23,17 +25,42 @@ export class FundingTransaction extends TransactionBuilder<TransactionType.FUNDI
23
25
 
24
26
  this.addInputsFromUTXO();
25
27
 
26
- const amountSpent: bigint =
27
- this.getTransactionOPNetFee() + this.childTransactionRequiredFees;
28
+ let amountSpent: bigint = this.amount;
29
+ if (this.getTransactionOPNetFee() === TransactionBuilder.MINIMUM_DUST) {
30
+ if (amountSpent < TransactionBuilder.MINIMUM_DUST) {
31
+ amountSpent += TransactionBuilder.MINIMUM_DUST;
32
+ }
33
+ } else {
34
+ amountSpent += this.getTransactionOPNetFee();
35
+ }
28
36
 
29
- this.addOutput({
30
- value: Number(amountSpent),
31
- address: this.to,
32
- });
37
+ if (this.splitInputsInto > 1) {
38
+ await this.splitInputs(amountSpent);
39
+ } else {
40
+ this.addOutput({
41
+ value: Number(amountSpent),
42
+ address: this.to,
43
+ });
44
+ }
33
45
 
34
46
  await this.addRefundOutput(amountSpent);
35
47
  }
36
48
 
49
+ protected async splitInputs(amountSpent: bigint): Promise<void> {
50
+ if (!this.to) {
51
+ throw new Error('Recipient address is required');
52
+ }
53
+
54
+ const splitAmount = amountSpent / BigInt(this.splitInputsInto);
55
+
56
+ for (let i = 0; i < this.splitInputsInto; i++) {
57
+ this.addOutput({
58
+ value: Number(splitAmount),
59
+ address: this.to,
60
+ });
61
+ }
62
+ }
63
+
37
64
  protected override getSignerKey(): Signer {
38
65
  return this.signer;
39
66
  }
@@ -115,10 +115,14 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
115
115
  this.signer = parameters.signer;
116
116
  this.network = parameters.network;
117
117
  this.feeRate = parameters.feeRate;
118
- this.priorityFee = parameters.priorityFee;
118
+ this.priorityFee = parameters.priorityFee ?? 0n;
119
119
  this.utxos = parameters.utxos;
120
120
  this.to = parameters.to || undefined;
121
121
 
122
+ if (!this.utxos.length) {
123
+ throw new Error('No UTXOs specified');
124
+ }
125
+
122
126
  this.from = TransactionBuilder.getFrom(
123
127
  parameters.from,
124
128
  this.signer as ECPairInterface,
@@ -192,7 +196,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
192
196
  signer: this.signer,
193
197
  network: this.network,
194
198
  feeRate: this.feeRate,
195
- priorityFee: this.priorityFee,
199
+ priorityFee: this.priorityFee ?? 0n,
196
200
  from: this.from,
197
201
  amount: this.estimatedFees,
198
202
  };
@@ -372,6 +376,27 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
372
376
  this.transaction = psbt;
373
377
  }
374
378
 
379
+ /**
380
+ * Returns the inputs of the transaction.
381
+ * @protected
382
+ * @returns {PsbtInputExtended[]}
383
+ */
384
+ public getInputs(): PsbtInputExtended[] {
385
+ return this.inputs;
386
+ }
387
+
388
+ /**
389
+ * Returns the outputs of the transaction.
390
+ * @protected
391
+ * @returns {PsbtOutputExtended[]}
392
+ */
393
+ public getOutputs(): PsbtOutputExtended[] {
394
+ const outputs: PsbtOutputExtended[] = [...this.outputs];
395
+ if (this.feeOutput) outputs.push(this.feeOutput);
396
+
397
+ return outputs;
398
+ }
399
+
375
400
  /**
376
401
  * @description Adds the refund output to the transaction
377
402
  * @param {bigint} amountSpent - The amount spent
@@ -381,6 +406,7 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
381
406
  protected async addRefundOutput(amountSpent: bigint): Promise<void> {
382
407
  /** Add the refund output */
383
408
  const sendBackAmount: bigint = this.totalInputAmount - amountSpent;
409
+
384
410
  if (sendBackAmount >= TransactionBuilder.MINIMUM_DUST) {
385
411
  if (AddressVerificator.isValidP2TRAddress(this.from, this.network)) {
386
412
  await this.setFeeOutput({
@@ -548,27 +574,6 @@ export abstract class TransactionBuilder<T extends TransactionType> extends Twea
548
574
  return this.tapData.output;
549
575
  }
550
576
 
551
- /**
552
- * Returns the inputs of the transaction.
553
- * @protected
554
- * @returns {PsbtInputExtended[]}
555
- */
556
- protected getInputs(): PsbtInputExtended[] {
557
- return this.inputs;
558
- }
559
-
560
- /**
561
- * Returns the outputs of the transaction.
562
- * @protected
563
- * @returns {PsbtOutputExtended[]}
564
- */
565
- protected getOutputs(): PsbtOutputExtended[] {
566
- const outputs: PsbtOutputExtended[] = [...this.outputs];
567
- if (this.feeOutput) outputs.push(this.feeOutput);
568
-
569
- return outputs;
570
- }
571
-
572
577
  /**
573
578
  * Verifies that the utxos are valid.
574
579
  * @protected
@@ -1,59 +1,61 @@
1
- import { UTXO } from '../../utxo/interfaces/IUTXO.js';
2
- import { Address } from '@btc-vision/bsi-binary';
3
- import { WrappedGeneration } from '../../wbtc/WrappedGenerationParameters.js';
4
- import { ITweakedTransactionData } from '../shared/TweakedTransaction.js';
5
- import { VaultUTXOs } from '../processor/PsbtTransaction.js';
6
- import { ChainId } from '../../network/ChainId.js';
7
-
8
- export interface ITransactionParameters extends ITweakedTransactionData {
9
- readonly from?: Address;
10
- readonly to?: Address | undefined;
11
- utxos: UTXO[];
12
-
13
- nonWitnessUtxo?: Buffer | undefined;
14
- estimatedFees?: bigint;
15
-
16
- chainId?: ChainId;
17
-
18
- readonly feeRate: number;
19
- readonly priorityFee: bigint;
20
- }
21
-
22
- export interface IFundingTransactionParameters extends ITransactionParameters {
23
- amount: bigint;
24
- }
25
-
26
- export interface SharedInteractionParameters extends ITransactionParameters {
27
- calldata?: Buffer | undefined;
28
- disableAutoRefund?: boolean;
29
-
30
- readonly randomBytes?: Buffer;
31
- }
32
-
33
- export interface IInteractionParameters extends SharedInteractionParameters {
34
- readonly calldata: Buffer;
35
-
36
- readonly to: Address;
37
- }
38
-
39
- export interface IWrapParameters extends SharedInteractionParameters {
40
- readonly to?: Address;
41
-
42
- readonly from: Address;
43
- readonly amount: bigint;
44
- readonly receiver?: Address;
45
-
46
- readonly generationParameters: WrappedGeneration;
47
- }
48
-
49
- export interface IUnwrapParameters extends SharedInteractionParameters {
50
- readonly unwrapUTXOs: VaultUTXOs[];
51
- readonly amount: bigint;
52
- }
53
-
54
- export interface IDeploymentParameters extends ITransactionParameters {
55
- readonly bytecode: Buffer;
56
-
57
- readonly to?: undefined;
58
- readonly randomBytes?: Buffer;
59
- }
1
+ import { UTXO } from '../../utxo/interfaces/IUTXO.js';
2
+ import { Address } from '@btc-vision/bsi-binary';
3
+ import { WrappedGeneration } from '../../wbtc/WrappedGenerationParameters.js';
4
+ import { ITweakedTransactionData } from '../shared/TweakedTransaction.js';
5
+ import { VaultUTXOs } from '../processor/PsbtTransaction.js';
6
+ import { ChainId } from '../../network/ChainId.js';
7
+
8
+ export interface ITransactionParameters extends ITweakedTransactionData {
9
+ readonly from?: Address;
10
+ readonly to?: Address | undefined;
11
+ utxos: UTXO[];
12
+
13
+ nonWitnessUtxo?: Buffer | undefined;
14
+ estimatedFees?: bigint;
15
+
16
+ chainId?: ChainId;
17
+
18
+ readonly feeRate: number;
19
+ readonly priorityFee?: bigint;
20
+ }
21
+
22
+ export interface IFundingTransactionParameters extends ITransactionParameters {
23
+ amount: bigint;
24
+
25
+ splitInputsInto?: number;
26
+ }
27
+
28
+ export interface SharedInteractionParameters extends ITransactionParameters {
29
+ calldata?: Buffer | undefined;
30
+ disableAutoRefund?: boolean;
31
+
32
+ readonly randomBytes?: Buffer;
33
+ }
34
+
35
+ export interface IInteractionParameters extends SharedInteractionParameters {
36
+ readonly calldata: Buffer;
37
+
38
+ readonly to: Address;
39
+ }
40
+
41
+ export interface IWrapParameters extends SharedInteractionParameters {
42
+ readonly to?: Address;
43
+
44
+ readonly from: Address;
45
+ readonly amount: bigint;
46
+ readonly receiver?: Address;
47
+
48
+ readonly generationParameters: WrappedGeneration;
49
+ }
50
+
51
+ export interface IUnwrapParameters extends SharedInteractionParameters {
52
+ readonly unwrapUTXOs: VaultUTXOs[];
53
+ readonly amount: bigint;
54
+ }
55
+
56
+ export interface IDeploymentParameters extends ITransactionParameters {
57
+ readonly bytecode: Buffer;
58
+
59
+ readonly to?: undefined;
60
+ readonly randomBytes?: Buffer;
61
+ }