opnet
Version:
The perfect library for building Bitcoin-based applications.
32 lines (31 loc) • 1.25 kB
JavaScript
import { Address } from '@btc-vision/transaction';
import { Buffer } from 'buffer';
import { TransactionBase } from '../Transaction.js';
export class InteractionTransaction extends TransactionBase {
calldata;
senderPubKeyHash;
contractSecret;
interactionPubKey;
wasCompressed;
from;
contractAddress;
contractPublicKey;
constructor(transaction, network) {
super(transaction, network);
this.contractPublicKey = new Address(Buffer.from(transaction.contractPublicKey, 'base64'));
if (transaction.calldata) {
this.calldata = Buffer.from(transaction.calldata, 'base64');
}
this.senderPubKeyHash = Buffer.from(transaction.senderPubKeyHash, 'base64');
this.contractSecret = Buffer.from(transaction.contractSecret, 'base64');
this.interactionPubKey = Buffer.from(transaction.interactionPubKey, 'base64');
this.wasCompressed = transaction.wasCompressed || false;
this.contractAddress = transaction.contractAddress;
try {
if (transaction.from) {
this.from = new Address(Buffer.from(transaction.from, 'base64'), Buffer.from(transaction.fromLegacy, 'base64'));
}
}
catch { }
}
}