UNPKG

opnet

Version:

The perfect library for building Bitcoin-based applications.

70 lines (69 loc) 3.1 kB
import { Network, PsbtOutputExtended, Signer } from '@btc-vision/bitcoin'; import { Address, BinaryReader, LoadedStorage, RawChallenge, SupportedTransactionVersion, UTXO } from '@btc-vision/transaction'; import { ECPairInterface } from 'ecpair'; import { BitcoinFees } from '../block/BlockGasParameters.js'; import { AbstractRpcProvider } from '../providers/AbstractRpcProvider.js'; import { ContractDecodedObjectResult, DecodedOutput } from './Contract.js'; import { IAccessList } from './interfaces/IAccessList.js'; import { EventList, ICallResultData } from './interfaces/ICallResult.js'; import { OPNetEvent } from './OPNetEvent.js'; export interface TransactionParameters { readonly signer?: Signer | ECPairInterface; readonly refundTo: string; readonly priorityFee?: bigint; feeRate?: number; readonly utxos?: UTXO[]; readonly maximumAllowedSatToSpend: bigint; readonly network: Network; readonly extraInputs?: UTXO[]; readonly extraOutputs?: PsbtOutputExtended[]; readonly minGas?: bigint; readonly note?: string | Buffer; readonly p2wda?: boolean; readonly from?: Address; readonly txVersion?: SupportedTransactionVersion; readonly anchor?: boolean; readonly dontIncludeAccessList?: boolean; } export interface InteractionTransactionReceipt { readonly transactionId: string; readonly newUTXOs: UTXO[]; readonly peerAcknowledgements: number; readonly estimatedFees: bigint; readonly challengeSolution: RawChallenge; } export declare class CallResult<T extends ContractDecodedObjectResult = {}, U extends OPNetEvent<ContractDecodedObjectResult>[] = OPNetEvent<ContractDecodedObjectResult>[]> implements Omit<ICallResultData, 'estimatedGas' | 'events' | 'specialGas'> { #private; readonly result: BinaryReader; readonly accessList: IAccessList; readonly revert: string | undefined; calldata: Buffer | undefined; loadedStorage: LoadedStorage | undefined; readonly estimatedGas: bigint | undefined; readonly refundedGas: bigint | undefined; properties: T; estimatedSatGas: bigint; estimatedRefundedGasInSat: bigint; events: U; to: string | undefined; address: Address | undefined; constructor(callResult: ICallResultData, provider: AbstractRpcProvider); get rawEvents(): EventList; static decodeRevertData(revertDataBytes: Uint8Array | Buffer): string; private static startsWithErrorSelector; private static areBytesEqual; private static bytesToHexString; setTo(to: string, address: Address): void; sendTransaction(interactionParams: TransactionParameters, amountAddition?: bigint): Promise<InteractionTransactionReceipt>; setGasEstimation(estimatedGas: bigint, refundedGas: bigint): void; setBitcoinFee(fees: BitcoinFees): void; setDecoded(decoded: DecodedOutput): void; setEvents(events: U): void; setCalldata(calldata: Buffer): void; private acquire; private bigintMax; private getValuesFromAccessList; private contractToString; private parseEvents; private base64ToUint8Array; }