Skip to main content

ContractState

For the complete documentation index, see llms.txt

@midnight/ledger v8.0.3


@midnight/ledger / ContractState

Class: ContractState

컨트랙트의 상태로, 주로 컨트랙트에서 직접 접근 가능한 data와 호출 가능한 ContractOperation의 맵으로 구성됩니다. 키 목록은 operations로 접근하고, 개별 연산은 operation으로 읽고 setOperation으로 설정할 수 있습니다.

Constructors

Constructor

new ContractState(): ContractState;

빈 컨트랙트 상태를 생성합니다.

Returns

ContractState

Properties

balance

balance: Map<TokenType, bigint>;

이 컨트랙트가 보유한 공개 잔액입니다.


data

data: ChargedState;

컨트랙트 기본 상태의 현재 값입니다.


maintenanceAuthority

maintenanceAuthority: ContractMaintenanceAuthority;

이 컨트랙트에 연결된 유지보수 권한입니다.

Methods

operation()

operation(operation): undefined | ContractOperation;

특정 진입점 이름에 해당하는 연산을 가져옵니다.

Parameters

operation

string | Uint8Array<ArrayBufferLike>

Returns

undefined | ContractOperation


operations()

operations(): (string | Uint8Array<ArrayBufferLike>)[];

이 컨트랙트에 현재 등록된 진입점 목록을 반환합니다.

Returns

(string | Uint8Array<ArrayBufferLike>)[]


query()

query(query, cost_model): GatherResult[];

현재 상태에 대해 일련의 연산을 실행하고 결과를 반환합니다.

Parameters

query

Op<null>[]

cost_model

CostModel

Returns

GatherResult[]


serialize()

serialize(): Uint8Array;

Returns

Uint8Array


setOperation()

setOperation(operation, value): void;

특정 진입점 이름에 주어진 연산을 설정합니다.

Parameters

operation

string | Uint8Array<ArrayBufferLike>

value

ContractOperation

Returns

void


toString()

toString(compact?): string;

Parameters

compact?

boolean

Returns

string


deserialize()

static deserialize(raw): ContractState;

Parameters

raw

Uint8Array

Returns

ContractState