@btc-vision/transaction
Version:
OPNet transaction library allows you to create and sign transactions for the OPNet network.
17 lines (16 loc) • 566 B
JavaScript
import { networks, script } from '@btc-vision/bitcoin';
import { Generator } from '../Generator.js';
export class CustomGenerator extends Generator {
constructor(senderPubKey, network = networks.bitcoin) {
super(senderPubKey, undefined, network);
}
compile(compiledData) {
const asm = compiledData.flat();
const compiled = script.compile(asm);
const decompiled = script.decompile(compiled);
if (!decompiled) {
throw new Error('Failed to decompile script??');
}
return compiled;
}
}