Skip to main content

@midnight-ntwrk/onchain-runtime v0.2.2Readme | API


@midnight-ntwrk/onchain-runtime v0.2.2 / ContractMaintenanceAuthority

Class: ContractMaintenanceAuthority

A committee permitted to make changes to this contract. If a threshold of the public keys in this committee sign off, they can change the rules of this contract, or recompile it for a new version.

If the threshold is greater than the number of committee members, it is impossible for them to sign anything.

Constructors

new ContractMaintenanceAuthority(committee, threshold, counter)

new ContractMaintenanceAuthority(
committee,
threshold,
counter?): ContractMaintenanceAuthority

Constructs a new authority from its components

If not supplied, counter will default to 0n. Values should be non-negative, and at most 2^32 - 1.

At deployment, counter must be 0n, and any subsequent update should set counter to exactly one greater than the current value.

Parameters

committee: string[]

threshold: number

counter?: bigint

Returns

ContractMaintenanceAuthority

Properties

committee

readonly committee: string[];

The committee public keys


counter

readonly counter: bigint;

The replay protection counter


threshold

readonly threshold: number;

How many keys must sign rule changes

Methods

serialize()

serialize(networkid): Uint8Array

Parameters

networkid: NetworkId

Returns

Uint8Array


toString()

toString(compact?): string

Parameters

compact?: boolean

Returns

string


deserialize()

static deserialize(raw, networkid): ContractState

Parameters

raw: Uint8Array

networkid: NetworkId

Returns

ContractState