@btc-vision/transaction 1.5.1 → 1.5.2
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.
- package/browser/_version.d.ts +1 -1
- package/browser/index.js +1 -1
- package/browser/transaction/builders/SharedInteractionTransaction.d.ts +0 -1
- package/browser/transaction/interfaces/ITransactionParameters.d.ts +1 -0
- package/build/_version.d.ts +1 -1
- package/build/_version.js +1 -1
- package/build/transaction/builders/InteractionTransaction.js +7 -1
- package/build/transaction/builders/SharedInteractionTransaction.d.ts +0 -1
- package/build/transaction/builders/SharedInteractionTransaction.js +1 -9
- package/build/transaction/interfaces/ITransactionParameters.d.ts +1 -0
- package/package.json +1 -1
- package/src/_version.ts +1 -1
- package/src/transaction/builders/InteractionTransaction.ts +9 -1
- package/src/transaction/builders/SharedInteractionTransaction.ts +4 -3
- package/src/transaction/interfaces/ITransactionParameters.ts +1 -0
|
@@ -23,7 +23,6 @@ export declare abstract class SharedInteractionTransaction<T extends Transaction
|
|
|
23
23
|
getContractSecret(): Buffer;
|
|
24
24
|
getRndBytes(): Buffer;
|
|
25
25
|
getPreimage(): Buffer;
|
|
26
|
-
protected generateSecret(): Buffer;
|
|
27
26
|
protected scriptSignerXOnlyPubKey(): Buffer;
|
|
28
27
|
protected generateKeyPairFromSeed(): ECPairInterface;
|
|
29
28
|
protected buildTransaction(): Promise<void>;
|
|
@@ -36,6 +36,7 @@ export interface SharedInteractionParameters extends ITransactionParameters {
|
|
|
36
36
|
export interface IInteractionParameters extends SharedInteractionParameters {
|
|
37
37
|
readonly calldata: Buffer;
|
|
38
38
|
readonly to: string;
|
|
39
|
+
readonly contract?: string;
|
|
39
40
|
}
|
|
40
41
|
export interface IDeploymentParameters extends Omit<ITransactionParameters, 'to'> {
|
|
41
42
|
readonly bytecode: Buffer;
|
package/build/_version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.
|
|
1
|
+
export declare const version = "1.5.2";
|
package/build/_version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.5.2';
|
|
@@ -6,7 +6,13 @@ export class InteractionTransaction extends SharedInteractionTransaction {
|
|
|
6
6
|
super(parameters);
|
|
7
7
|
this.type = TransactionType.INTERACTION;
|
|
8
8
|
this.tapLeafScript = null;
|
|
9
|
-
|
|
9
|
+
if (!parameters.contract) {
|
|
10
|
+
throw new Error('parameters.contract is required for interaction transaction.');
|
|
11
|
+
}
|
|
12
|
+
this.contractSecret = Buffer.from(parameters.contract.replace('0x', ''), 'hex');
|
|
13
|
+
if (this.contractSecret.length !== 32) {
|
|
14
|
+
throw new Error('Invalid contract secret length. Expected 32 bytes.');
|
|
15
|
+
}
|
|
10
16
|
this.compiledTargetScript = this.calldataGenerator.compile(this.calldata, this.contractSecret, this.preimage, this.priorityFee, this.generateFeatures(parameters));
|
|
11
17
|
this.scriptTree = this.getScriptTree();
|
|
12
18
|
this.internalInit();
|
|
@@ -23,7 +23,6 @@ export declare abstract class SharedInteractionTransaction<T extends Transaction
|
|
|
23
23
|
getContractSecret(): Buffer;
|
|
24
24
|
getRndBytes(): Buffer;
|
|
25
25
|
getPreimage(): Buffer;
|
|
26
|
-
protected generateSecret(): Buffer;
|
|
27
26
|
protected scriptSignerXOnlyPubKey(): Buffer;
|
|
28
27
|
protected generateKeyPairFromSeed(): ECPairInterface;
|
|
29
28
|
protected buildTransaction(): Promise<void>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PaymentType, toXOnly } from '@btc-vision/bitcoin';
|
|
2
2
|
import { MINIMUM_AMOUNT_CA, MINIMUM_AMOUNT_REWARD, TransactionBuilder } from './TransactionBuilder.js';
|
|
3
3
|
import { CalldataGenerator } from '../../generators/builders/CalldataGenerator.js';
|
|
4
4
|
import { Compressor } from '../../bytecode/Compressor.js';
|
|
@@ -48,14 +48,6 @@ export class SharedInteractionTransaction extends TransactionBuilder {
|
|
|
48
48
|
getPreimage() {
|
|
49
49
|
return this.preimage;
|
|
50
50
|
}
|
|
51
|
-
generateSecret() {
|
|
52
|
-
if (!this.to)
|
|
53
|
-
throw new Error('To address is required');
|
|
54
|
-
if (this.to.startsWith('0x')) {
|
|
55
|
-
throw new Error(`Legacy not support at this time. Reserved for future use.`);
|
|
56
|
-
}
|
|
57
|
-
return address.fromBech32(this.to).data;
|
|
58
|
-
}
|
|
59
51
|
scriptSignerXOnlyPubKey() {
|
|
60
52
|
return toXOnly(Buffer.from(this.scriptSigner.publicKey));
|
|
61
53
|
}
|
|
@@ -36,6 +36,7 @@ export interface SharedInteractionParameters extends ITransactionParameters {
|
|
|
36
36
|
export interface IInteractionParameters extends SharedInteractionParameters {
|
|
37
37
|
readonly calldata: Buffer;
|
|
38
38
|
readonly to: string;
|
|
39
|
+
readonly contract?: string;
|
|
39
40
|
}
|
|
40
41
|
export interface IDeploymentParameters extends Omit<ITransactionParameters, 'to'> {
|
|
41
42
|
readonly bytecode: Buffer;
|
package/package.json
CHANGED
package/src/_version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const version = '1.
|
|
1
|
+
export const version = '1.5.2';
|
|
@@ -26,7 +26,15 @@ export class InteractionTransaction extends SharedInteractionTransaction<Transac
|
|
|
26
26
|
public constructor(parameters: IInteractionParameters) {
|
|
27
27
|
super(parameters);
|
|
28
28
|
|
|
29
|
-
|
|
29
|
+
if (!parameters.contract) {
|
|
30
|
+
throw new Error('parameters.contract is required for interaction transaction.');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
this.contractSecret = Buffer.from(parameters.contract.replace('0x', ''), 'hex');
|
|
34
|
+
|
|
35
|
+
if (this.contractSecret.length !== 32) {
|
|
36
|
+
throw new Error('Invalid contract secret length. Expected 32 bytes.');
|
|
37
|
+
}
|
|
30
38
|
|
|
31
39
|
this.compiledTargetScript = this.calldataGenerator.compile(
|
|
32
40
|
this.calldata,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { P2TRPayment, PaymentType, Psbt, PsbtInput, Signer, Taptree, toXOnly } from '@btc-vision/bitcoin';
|
|
2
2
|
import { ECPairInterface } from 'ecpair';
|
|
3
3
|
import { MINIMUM_AMOUNT_CA, MINIMUM_AMOUNT_REWARD, TransactionBuilder } from './TransactionBuilder.js';
|
|
4
4
|
import { TransactionType } from '../enums/TransactionType.js';
|
|
@@ -120,7 +120,8 @@ export abstract class SharedInteractionTransaction<
|
|
|
120
120
|
* @returns {Buffer} The secret
|
|
121
121
|
* @throws {Error} If the to address is invalid
|
|
122
122
|
*/
|
|
123
|
-
|
|
123
|
+
|
|
124
|
+
/*protected generateSecret(): Buffer {
|
|
124
125
|
if (!this.to) throw new Error('To address is required');
|
|
125
126
|
|
|
126
127
|
if (this.to.startsWith('0x')) {
|
|
@@ -128,7 +129,7 @@ export abstract class SharedInteractionTransaction<
|
|
|
128
129
|
}
|
|
129
130
|
|
|
130
131
|
return address.fromBech32(this.to).data;
|
|
131
|
-
}
|
|
132
|
+
}*/
|
|
132
133
|
|
|
133
134
|
/**
|
|
134
135
|
* Get the internal pubkey as an x-only key
|