Skip to main content

Class: Ledger

Represents the Mina ledger.

Table of contents

Constructors

Properties

Methods

Constructors

constructor

new Ledger()

Properties

encoding

Static encoding: Object

Type declaration

NameType
versionBytesRecord<"tokenIdKey" | "receiptChainHash" | "ledgerHash" | "epochSeed" | "stateHash" | "publicKey" | "userCommandMemo", number>
ofBase58(base58: string, versionByte: number) => MlBytes
toBase58(s: MlBytes, versionByte: number) => string

Defined in

snarky.d.ts:1156


hashInputFromJson

Static hashInputFromJson: Object

Type declaration

NameType
accountPrecondition(json: String) => OcamlInput
body(json: String) => OcamlInput
networkPrecondition(json: String) => OcamlInput
packInput(input: OcamlInput) => Field[]
permissions(json: String) => OcamlInput
timing(json: String) => OcamlInput
update(json: String) => OcamlInput

Defined in

snarky.d.ts:1145

Methods

addAccount

addAccount(publicKey, balance): void

Adds an account and its balance to the ledger.

Parameters

NameType
publicKeyPublicKey_
balancestring

Returns

void

Defined in

snarky.d.ts:1062


applyJsonTransaction

applyJsonTransaction(txJson, accountCreationFee, networkState): Account[]

Applies a JSON transaction to the ledger.

Parameters

NameType
txJsonstring
accountCreationFeestring
networkStatestring

Returns

Account[]

Defined in

snarky.d.ts:1067


getAccount

getAccount(publicKey, tokenId): undefined | Account

Returns an account.

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

undefined | Account

Defined in

snarky.d.ts:1076


checkAccountUpdateSignature

Static checkAccountUpdateSignature(updateJson, commitment): boolean

Parameters

NameType
updateJsonstring
commitmentField

Returns

boolean

Defined in

snarky.d.ts:1136


create

Static create(genesisAccounts): Ledger

Creates a fresh ledger.

Parameters

NameType
genesisAccounts{ balance: string ; publicKey: PublicKey_ }[]

Returns

Ledger

Defined in

snarky.d.ts:1055


createTokenAccount

Static createTokenAccount(publicKey, tokenId): string

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

string

Defined in

snarky.d.ts:1124


customTokenId

Static customTokenId(publicKey, tokenId): Field

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

Field

Defined in

snarky.d.ts:1122


customTokenIdChecked

Static customTokenIdChecked(publicKey, tokenId): Field

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

Field

Defined in

snarky.d.ts:1123


dummySignature

Static dummySignature(): string

Returns a dummy signature.

Returns

string

Defined in

snarky.d.ts:1106


fieldOfBase58

Static fieldOfBase58(fieldBase58): Field

Parameters

NameType
fieldBase58string

Returns

Field

Defined in

snarky.d.ts:1131


fieldToBase58

Static fieldToBase58(field): string

Parameters

NameType
fieldField

Returns

string

Defined in

snarky.d.ts:1130


fieldsOfJson

Static fieldsOfJson(json): Field[]

Parameters

NameType
jsonstring

Returns

Field[]

Defined in

snarky.d.ts:1141


hashAccountUpdateFromFields

Static hashAccountUpdateFromFields(fields): Field

Parameters

NameType
fieldsField[]

Returns

Field

Defined in

snarky.d.ts:1142


hashAccountUpdateFromJson

Static hashAccountUpdateFromJson(json): Field

Parameters

NameType
jsonstring

Returns

Field

Defined in

snarky.d.ts:1143


memoHashBase58

Static memoHashBase58(memoBase58): Field

Parameters

NameType
memoBase58string

Returns

Field

Defined in

snarky.d.ts:1134


memoToBase58

Static memoToBase58(memoString): string

Parameters

NameType
memoStringstring

Returns

string

Defined in

snarky.d.ts:1133


privateKeyOfString

Static privateKeyOfString(privateKeyBase58): Scalar

Parameters

NameType
privateKeyBase58string

Returns

Scalar

Defined in

snarky.d.ts:1129


privateKeyToString

Static privateKeyToString(privateKey): string

Parameters

NameType
privateKeyObject
privateKey.sScalar

Returns

string

Defined in

snarky.d.ts:1128


publicKeyOfString

Static publicKeyOfString(publicKeyBase58): PublicKey_

Parameters

NameType
publicKeyBase58string

Returns

PublicKey_

Defined in

snarky.d.ts:1127


publicKeyToString

Static publicKeyToString(publicKey): string

Parameters

NameType
publicKeyPublicKey_

Returns

string

Defined in

snarky.d.ts:1126


signAccountUpdate

Static signAccountUpdate(txJson, privateKey, i): string

Signs an account update.

Parameters

NameType
txJsonstring
privateKeyObject
privateKey.sScalar
inumber

Returns

string

Defined in

snarky.d.ts:1116


signFeePayer

Static signFeePayer(txJson, privateKey): string

Signs a transaction as the fee payer.

Parameters

NameType
txJsonstring
privateKeyObject
privateKey.sScalar

Returns

string

Defined in

snarky.d.ts:1111


signFieldElement

Static signFieldElement(messageHash, privateKey): string

Signs a Field element.

Parameters

NameType
messageHashField
privateKeyObject
privateKey.sScalar

Returns

string

Defined in

snarky.d.ts:1098


transactionCommitments

Static transactionCommitments(txJson): Object

Returns the commitment of a JSON transaction.

Parameters

NameType
txJsonstring

Returns

Object

NameType
commitmentField
feePayerHashField
fullCommitmentField

Defined in

snarky.d.ts:1081


zkappPublicInput

Static zkappPublicInput(txJson, accountUpdateIndex): Object

Returns the public input of a zkApp transaction.

Parameters

NameType
txJsonstring
accountUpdateIndexnumber

Returns

Object

NameType
accountUpdateField
callsField

Defined in

snarky.d.ts:1090