opnet
Version:
The perfect library for building Bitcoin-based applications.
14 lines (13 loc) • 560 B
JavaScript
import { fromHex } from '@btc-vision/bitcoin';
import { MempoolOPNetTransactionData } from './MempoolOPNetTransactionData.js';
export class MempoolDeploymentTransactionData extends MempoolOPNetTransactionData {
bytecode;
constructor(data) {
super(data);
if (data.bytecode === undefined) {
throw new Error('Bytecode is required for deployment transactions.');
}
const bytecodeHex = data.bytecode.startsWith('0x') ? data.bytecode.slice(2) : data.bytecode;
this.bytecode = fromHex(bytecodeHex);
}
}