StateUtils
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
Inherited from
Properties
args
args:
any
[] =[]
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:31
Inherited from
artifact
static
artifact:Artifact
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:16
Inherited from
stateType?
static
optional
stateType:string
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:17
Inherited from
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
t_spentDataHashes
trustable spent data hashes
Returns
void
loadArtifact()
static
loadArtifact(artifact
): typeofSmartContractLib
Defined in: packages/scrypt-ts-opcat/src/smart-contract/smartContractLib.ts:19
Parameters
artifact
Returns
typeof SmartContractLib