UNPKG

@btc-vision/transaction

Version:

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

50 lines 2.4 kB
import { Network, PublicKey } from '../../../node_modules/@btc-vision/bitcoin/browser/index.js'; import { Feature, Features } from '../Features.js'; import { Generator } from '../Generator.js'; import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js'; /** * @category Generators * @remarks Not fully implemented yet */ export declare class P2WDAGenerator extends Generator { private static readonly P2WDA_VERSION; constructor(senderPubKey: PublicKey, contractSaltPubKey: Uint8Array, network?: Network); /** * Validate that operation data will fit in P2WDA witness fields * * @param dataSize Size of the operation data * @param maxWitnessFields Maximum number of witness fields (default 10) * @param maxBytesPerWitness Maximum bytes per witness field (default 80) * @returns true if data will fit, false otherwise */ static validateWitnessSize(dataSize: number, maxWitnessFields?: number, maxBytesPerWitness?: number): boolean; /** * Compile operation data for P2WDA witness embedding * * This creates a binary structure containing all operation information * without Bitcoin script opcodes. The structure is: * * [version(1)] [header(12)] [contract(32)] [challenge_pubkey(33)] [challenge_solution(32)] * [calldata_length(4)] [calldata] [features_length(2)] [features_data] * * @param calldata The compressed calldata for the contract interaction * @param contractSecret The 32-byte contract secret * @param challenge The challenge solution for epoch rewards * @param maxPriority Maximum priority fee in satoshis * @param featuresRaw Optional features like access lists * @returns Raw operation data ready for signing and compression */ compile(calldata: Uint8Array, contractSecret: Uint8Array, challenge: IChallengeSolution, maxPriority: bigint, featuresRaw?: Feature<Features>[]): Uint8Array; getHeader(maxPriority: bigint, features?: Features[]): Uint8Array; /** * Write features section to the operation data * * Features are encoded as: * [feature_count(2)] [feature1_opcode(1)] [feature1_length(4)] [feature1_data] ... * * @param writer Binary writer to write to * @param features Array of features to encode */ private writeFeatures; } //# sourceMappingURL=P2WDAGenerator.d.ts.map