UNPKG

@btc-vision/transaction

Version:

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

133 lines 4.81 kB
import { P2TRPayment, Psbt, PsbtInput, Signer, Taptree } from '../../../node_modules/@btc-vision/bitcoin/browser/index.js'; import { UniversalSigner } from '@btc-vision/ecpair'; import { TransactionBuilder } from './TransactionBuilder.js'; import { TapPayment } from '../shared/TweakedTransaction.js'; import { TransactionType } from '../enums/TransactionType.js'; import { CalldataGenerator } from '../../generators/builders/CalldataGenerator.js'; import { SharedInteractionParameters } from '../interfaces/ITransactionParameters.js'; import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js'; import { IP2WSHAddress } from '../mineable/IP2WSHAddress.js'; /** * Shared interaction transaction * @class SharedInteractionTransaction */ export declare abstract class SharedInteractionTransaction<T extends TransactionType> extends TransactionBuilder<T> { static readonly MAXIMUM_CALLDATA_SIZE: number; /** * Random salt for the interaction * @type {Uint8Array} */ readonly randomBytes: Uint8Array; protected targetScriptRedeem: P2TRPayment | null; protected leftOverFundsScriptRedeem: P2TRPayment | null; protected abstract readonly compiledTargetScript: Uint8Array; protected abstract readonly scriptTree: Taptree; protected readonly challenge: IChallengeSolution; protected readonly epochChallenge: IP2WSHAddress; protected calldataGenerator: CalldataGenerator; /** * Calldata for the interaction * @protected */ protected readonly calldata: Uint8Array; /** * Contract secret for the interaction * @protected */ protected abstract readonly contractSecret: Uint8Array; /** * Script signer for the interaction * @protected */ protected readonly scriptSigner: Signer | UniversalSigner; /** * Disable auto refund * @protected */ protected readonly disableAutoRefund: boolean; protected constructor(parameters: SharedInteractionParameters); exportCompiledTargetScript(): Uint8Array; /** * Get the contract secret * @returns {Uint8Array} The contract secret */ getContractSecret(): Uint8Array; /** * Get the random bytes used for the interaction * @returns {Uint8Array} The random bytes */ getRndBytes(): Uint8Array; /** * Get the preimage */ getChallenge(): IChallengeSolution; /** * Get the internal pubkey as an x-only key * @protected * @returns {Uint8Array} The internal pubkey as an x-only key */ protected scriptSignerXOnlyPubKey(): Uint8Array; /** * Generate a key pair from the seed * @protected * * @returns {UniversalSigner} The key pair */ protected generateKeyPairFromSeed(): UniversalSigner; /** * Build the transaction * @protected * * @throws {Error} If the left over funds script redeem is required * @throws {Error} If the left over funds script redeem version is required * @throws {Error} If the left over funds script redeem output is required * @throws {Error} If the to address is required */ protected buildTransaction(): Promise<void>; /** * Sign the inputs * @param {Psbt} transaction The transaction to sign * @protected */ protected signInputs(transaction: Psbt): Promise<void>; protected generateScriptAddress(): TapPayment; protected generateTapData(): TapPayment; /** * Generate the script solution * @param {PsbtInput} input The input * @protected * * @returns {Uint8Array[]} The script solution */ protected getScriptSolution(input: PsbtInput): Uint8Array[]; /** * Get the script tree * @private * * @returns {Taptree} The script tree */ protected getScriptTree(): Taptree; /** * Transaction finalizer * @param {number} _inputIndex The input index * @param {PsbtInput} input The input */ protected customFinalizer: (_inputIndex: number, input: PsbtInput) => { finalScriptWitness: Uint8Array<ArrayBufferLike>; }; protected signInputsWalletBased(transaction: Psbt): Promise<void>; protected signInputsNonWalletBased(transaction: Psbt): Promise<void>; protected createMineableRewardOutputs(): Promise<void>; /** * Generate the redeem scripts * @private * * @throws {Error} If the public keys are required * @throws {Error} If the leaf script is required * @throws {Error} If the leaf script version is required * @throws {Error} If the leaf script output is required * @throws {Error} If the target script redeem is required */ private generateRedeemScripts; } //# sourceMappingURL=SharedInteractionTransaction.d.ts.map