Skip to content

MemoryChain

Defined in: packages/scheme-qorechain/src/memory.ts:30

An in-memory stand-in for the chain: the pqcKeyStatus registry, the KEM key registry, one PQ402Escrow and Perennial vault positions, with real ML-DSA-87 verification. settle repeats the checks of PQ402Escrow.settle and spend those of PerennialVault.spend (including budget mode), without its yield accounting: the buffer is set directly and budget periods do not roll. For tests and the local example only; it proves nothing about the chain.

new MemoryChain(escrow, start?): MemoryChain

Defined in: packages/scheme-qorechain/src/memory.ts:42

`0x${string}`

number = ...

MemoryChain

readonly escrow: `0x${string}`

Defined in: packages/scheme-qorechain/src/memory.ts:43


offline: boolean = false

Defined in: packages/scheme-qorechain/src/memory.ts:40

When true, every read throws, as an unreachable node would.

advance(seconds): void

Defined in: packages/scheme-qorechain/src/memory.ts:101

number

void


deposit(payer, amount): void

Defined in: packages/scheme-qorechain/src/memory.ts:66

`0x${string}`

bigint

void


escrowBalance(escrow, payer): Promise<bigint>

Defined in: packages/scheme-qorechain/src/memory.ts:133

`0x${string}`

`0x${string}`

Promise<bigint>

ChainReader.escrowBalance


kemKey(account): Promise<Uint8Array<ArrayBufferLike>>

Defined in: packages/scheme-qorechain/src/memory.ts:121

The account’s ML-KEM-1024 key from the KEM key registry. Throws when none is registered.

`0x${string}`

Promise<Uint8Array<ArrayBufferLike>>

ChainReader.kemKey


keyStatus(account): Promise<PqcKeyStatus>

Defined in: packages/scheme-qorechain/src/memory.ts:109

The account’s ML-DSA-87 key record from the pqcKeyStatus precompile.

`0x${string}`

Promise<PqcKeyStatus>

ChainReader.keyStatus


nonceUsed(escrow, payer, nonce): Promise<boolean>

Defined in: packages/scheme-qorechain/src/memory.ts:128

`0x${string}`

`0x${string}`

`0x${string}`

Promise<boolean>

ChainReader.nonceUsed


now(): Promise<number>

Defined in: packages/scheme-qorechain/src/memory.ts:138

Timestamp of the latest block, in unix seconds.

Promise<number>

ChainReader.now


openPosition(vault, positionId, beneficiary, buffer, budget?): void

Defined in: packages/scheme-qorechain/src/memory.ts:75

Open a Perennial position whose buffer already holds buffer. With budget, it is in budget mode: budget.perPeriod may be spent per period, from the buffer first and then budget.principal.

`0x${string}`

bigint

`0x${string}`

bigint

bigint

bigint

void


paidTo(payee): bigint

Defined in: packages/scheme-qorechain/src/memory.ts:97

Total received by payee through settlements.

`0x${string}`

bigint


perennialPosition(vault, positionId): Promise<PerennialPosition>

Defined in: packages/scheme-qorechain/src/memory.ts:143

A Perennial position, for the pq-perennial scheme.

`0x${string}`

bigint

Promise<PerennialPosition>

ChainReader.perennialPosition


registerKemKey(account, publicKey): void

Defined in: packages/scheme-qorechain/src/memory.ts:62

`0x${string}`

Uint8Array

void


registerKey(account, publicKey, opts?): void

Defined in: packages/scheme-qorechain/src/memory.ts:49

`0x${string}`

Uint8Array

number

boolean

void


settler(address): Settler

Defined in: packages/scheme-qorechain/src/memory.ts:161

A settler that submits to this in-memory escrow and vault.

`0x${string}`

Settler