UNPKG

@btc-vision/transaction

Version:

OPNet transaction library allows you to create and sign transactions for the OPNet network.

27 lines 940 B
import { networks, script, } from '@btc-vision/bitcoin'; import { Generator } from '../Generator.js'; /** * Class to generate bitcoin script for interaction transactions */ export class CustomGenerator extends Generator { constructor(senderPubKey, network = networks.bitcoin) { super(senderPubKey, undefined, network); } /** * Compile an interaction bitcoin script * @param compiledData - The compiled data * @returns {Uint8Array} - The compiled script * @throws {Error} - If something goes wrong */ compile(compiledData) { const asm = compiledData.flat(); const compiled = script.compile(asm); /** Verify the validity of the script */ const decompiled = script.decompile(compiled); if (!decompiled) { throw new Error('Failed to decompile script??'); } return compiled; } } //# sourceMappingURL=CustomGenerator.js.map