Skip to main content

CAT20GuardStateLib

@opcat-labs/cat-sdk v1.0.3


@opcat-labs/cat-sdk / CAT20GuardStateLib

Class: CAT20GuardStateLib

Defined in: packages/cat-sdk/src/contracts/cat20/cat20GuardStateLib.ts:11

The CAT20 guard state library

Onchain

Extends

Constructors

new CAT20GuardStateLib()

new CAT20GuardStateLib(...args): CAT20GuardStateLib

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/smartContractLib.d.ts:18

Parameters

args

...SupportedParamType[]

Returns

CAT20GuardStateLib

Inherited from

StateLib<CAT20GuardConstState>.constructor

Other

__state_lib_dummy_private_field__

protected __state_lib_dummy_private_field__: CAT20GuardConstState

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/builtin-libs/stateLib.d.ts:42

Inherited from

StateLib.__state_lib_dummy_private_field__


args

args: any[]

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/smartContractLib.d.ts:17

Inherited from

StateLib.args


artifact

static artifact: Artifact

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/smartContractLib.d.ts:14

Inherited from

StateLib.artifact


stateType?

static optional stateType: string

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/smartContractLib.d.ts:15

Inherited from

StateLib.stateType


checkTokenScriptsUniq()

static checkTokenScriptsUniq(tokenScripts): void

Defined in: packages/cat-sdk/src/contracts/cat20/cat20GuardStateLib.ts:40

Ensure tokenScripts does not have duplicate values

Parameters

tokenScripts

FixedArray\<ByteString, 4>

token scripts

Returns

void


createEmptyState()

static createEmptyState(): CAT20GuardConstState

Defined in: packages/cat-sdk/src/contracts/cat20/cat20GuardStateLib.ts:53

Returns

CAT20GuardConstState


deserializeState()

static deserializeState\<T>(this, serializedState): T

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/builtin-libs/stateLib.d.ts:30

Deserializes a state object from its ByteString representation.

Type Parameters

T extends OpcatState

Type of the state object extending OpcatState

Parameters

this

(...args) => StateLib\<T>

Reference to the StateLib class constructor

serializedState

ByteString

ByteString containing the serialized state data

Returns

T

The deserialized state object of type T

Throws

Error if artifact is not loaded, library is not found, or state type is undefined

Inherited from

StateLib.deserializeState


formalCheckState()

static formalCheckState(_state): ByteString

Defined in: packages/cat-sdk/src/contracts/cat20/cat20GuardStateLib.ts:14

Parameters

_state

CAT20GuardConstState

Returns

ByteString


loadArtifact()

static loadArtifact(artifact): typeof SmartContractLib

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/smartContractLib.d.ts:16

Parameters

artifact

Artifact

Returns

typeof SmartContractLib

Inherited from

StateLib.loadArtifact


stateHash()

static stateHash\<T>(this, state): ByteString

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/builtin-libs/stateLib.d.ts:39

Computes the SHA-256 hash of a serialized state object.

Type Parameters

T extends OpcatState

Type extending OpcatState

Parameters

this

(...args) => StateLib\<T>

state

T

The state object to hash

Returns

ByteString

The hash as a ByteString

Inherited from

StateLib.stateHash

State

serializeState()

static serializeState\<T>(this, state): ByteString

Defined in: node_modules/@opcat-labs/scrypt-ts-opcat/dist/types/smart-contract/builtin-libs/stateLib.d.ts:18

Serializes the given state object into a ByteString using the library's artifact.

Type Parameters

T extends OpcatState

Type of the state object extending OpcatState

Parameters

this

(...args) => StateLib\<T>

Reference to the StateLib class constructor

state

T

State object to be serialized

Returns

ByteString

Serialized state as ByteString

Throws

Error if artifact is not loaded, library not found in artifact, or state type is undefined

Inherited from

StateLib.serializeState