@btc-vision/transaction
Version:
OPNet transaction library allows you to create and sign transactions for the OPNet network.
88 lines • 3.16 kB
TypeScript
import { Psbt } from '../../../node_modules/@btc-vision/bitcoin/browser/index.js';
import { TransactionType } from '../enums/TransactionType.js';
import { IInteractionParameters } from '../interfaces/ITransactionParameters.js';
import { TransactionBuilder } from './TransactionBuilder.js';
import { IChallengeSolution } from '../../epoch/interfaces/IChallengeSolution.js';
import { IP2WSHAddress } from '../mineable/IP2WSHAddress.js';
/**
* P2WDA Interaction Transaction
*
* This transaction type uses the exact same operation data as regular interactions
* (via CalldataGenerator), but embeds it in the witness field instead of a taproot script.
* This achieves 75% cost reduction through the witness discount.
*/
export declare class InteractionTransactionP2WDA extends TransactionBuilder<TransactionType.INTERACTION> {
private static readonly MAX_WITNESS_FIELDS;
private static readonly MAX_BYTES_PER_WITNESS;
readonly type: TransactionType.INTERACTION;
protected readonly epochChallenge: IP2WSHAddress;
/**
* Disable auto refund
* @protected
*/
protected readonly disableAutoRefund: boolean;
private readonly contractSecret;
private readonly calldata;
private readonly challenge;
private readonly randomBytes;
private p2wdaGenerator;
private scriptSigner;
private p2wdaInputIndices;
/**
* The compiled operation data from CalldataGenerator
* This is exactly what would go in a taproot script, but we put it in witness instead
*/
private readonly compiledOperationData;
constructor(parameters: IInteractionParameters);
/**
* Get random bytes (for compatibility if needed elsewhere)
*/
getRndBytes(): Uint8Array;
/**
* Get the challenge (for compatibility if needed elsewhere)
*/
getChallenge(): IChallengeSolution;
/**
* Get contract secret (for compatibility if needed elsewhere)
*/
getContractSecret(): Uint8Array;
/**
* Build the transaction
*/
protected buildTransaction(): Promise<void>;
protected createMineableRewardOutputs(): Promise<void>;
/**
* Sign inputs with P2WDA-specific handling
*/
protected signInputs(transaction: Psbt): Promise<void>;
/**
* Generate features array (same as InteractionTransaction)
*/
private generateFeatures;
/**
* Generate keypair from seed (same as SharedInteractionTransaction)
*/
private generateKeyPairFromSeed;
/**
* Get script signer x-only pubkey (same as SharedInteractionTransaction)
*/
private scriptSignerXOnlyPubKey;
/**
* Validate that input 0 is P2WDA
*/
private validateP2WDAInputs;
/**
* Validate the compiled operation data will fit in witness fields
*/
private validateOperationDataSize;
/**
* Finalize primary P2WDA input with the operation data
* This is where we create the signature and compress everything
*/
private finalizePrimaryP2WDA;
/**
* Split data into 80-byte chunks
*/
private splitIntoWitnessChunks;
}
//# sourceMappingURL=InteractionTransactionP2WDA.d.ts.map