Skip to main content

StateUtils

scrypt-ts-opcat v1.0.1


scrypt-ts-opcat / StateUtils

Class: StateUtils

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/stateUtils.ts:18

Verifies that the hash of a raw state matches the corresponding spent data hash in the transaction.

Param

The index of the input being verified

Param

The hash of the serialized raw state to check

Param

Trustable spent data hashes from the transaction

Throws

Throws an assertion error if the state hash doesn't match the spent data hash

Onchain

Extends

Constructors

new StateUtils()

new StateUtils(...args): StateUtils

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

Parameters

args

...SupportedParamType[]

Returns

StateUtils

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

checkInputState()

static checkInputState(t_inputIndex, stateHash, t_spentDataHashes): void

Defined in: packages/scrypt-ts-opcat/src/smart-contract/builtin-libs/stateUtils.ts:26

Check if the dataHash of the passed-in raw state matches the spent data hash

Parameters

t_inputIndex

UInt32

trustable input index

stateHash

ByteString

t_spentDataHashes

ByteString

trustable spent data hashes

Returns

void


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