Skip to main content

TxHashPreimageUtils

scrypt-ts-opcat v1.0.1


scrypt-ts-opcat / TxHashPreimageUtils

Class: TxHashPreimageUtils

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/txHashPreimageUtils.ts:15

Utility class for working with transaction hash preimages in Bitcoin smart contracts. Provides methods to:

  • Calculate transaction hash from preimage data
  • Extract individual input/output byte strings from preimage

Extends

Constructors

new TxHashPreimageUtils()

new TxHashPreimageUtils(...args): TxHashPreimageUtils

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:32

Parameters

args

...SupportedParamType[]

Returns

TxHashPreimageUtils

Inherited from

SmartContractLib.constructor

Properties

args

args: any[] = []

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:31

Inherited from

SmartContractLib.args


artifact

static artifact: Artifact

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:16

Inherited from

SmartContractLib.artifact


stateType?

static optional stateType: string

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:17

Inherited from

SmartContractLib.stateType

Methods

getInputByteString()

static getInputByteString(txHashPreimage, inputIndex): ByteString

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/txHashPreimageUtils.ts:37

Extracts the byte string of a specific input from the transaction hash preimage.

Parameters

txHashPreimage

TxHashPreimage

The transaction hash preimage containing input data.

inputIndex

bigint

The index of the input to extract.

Returns

ByteString

The byte string representing the specified input.


getOutputByteString()

static getOutputByteString(txHashPreimage, outputIndex): ByteString

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/txHashPreimageUtils.ts:48

Extracts the byte string of a specific output from the transaction hash preimage.

Parameters

txHashPreimage

TxHashPreimage

The transaction hash preimage containing output list.

outputIndex

bigint

The index of the output to extract.

Returns

ByteString

The byte string of the specified output.


getTxHashFromTxHashPreimage()

static getTxHashFromTxHashPreimage(txHashPreimage): ByteString

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/txHashPreimageUtils.ts:17

Parameters

txHashPreimage

TxHashPreimage

Returns

ByteString


loadArtifact()

static loadArtifact(artifact): typeof SmartContractLib

Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:19

Parameters

artifact

Artifact

Returns

typeof SmartContractLib

Inherited from

SmartContractLib.loadArtifact