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:1257


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:1246

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:1162


applyJsonTransaction

applyJsonTransaction(txJson, accountCreationFee, networkState): void

Applies a JSON transaction to the ledger.

Parameters

NameType
txJsonstring
accountCreationFeestring
networkStatestring

Returns

void

Defined in

snarky.d.ts:1167


getAccount

getAccount(publicKey, tokenId): undefined | Account

Returns an account.

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

undefined | Account

Defined in

snarky.d.ts:1176


checkAccountUpdateSignature

Static checkAccountUpdateSignature(updateJson, commitment): boolean

Parameters

NameType
updateJsonstring
commitmentField

Returns

boolean

Defined in

snarky.d.ts:1237


create

Static create(genesisAccounts): Ledger

Creates a fresh ledger.

Parameters

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

Returns

Ledger

Defined in

snarky.d.ts:1155


createTokenAccount

Static createTokenAccount(publicKey, tokenId): string

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

string

Defined in

snarky.d.ts:1225


customTokenId

Static customTokenId(publicKey, tokenId): Field

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

Field

Defined in

snarky.d.ts:1223


customTokenIdChecked

Static customTokenIdChecked(publicKey, tokenId): Field

Parameters

NameType
publicKeyPublicKey_
tokenIdField

Returns

Field

Defined in

snarky.d.ts:1224


dummySignature

Static dummySignature(): string

Returns a dummy signature.

Returns

string

Defined in

snarky.d.ts:1207


fieldOfBase58

Static fieldOfBase58(fieldBase58): Field

Parameters

NameType
fieldBase58string

Returns

Field

Defined in

snarky.d.ts:1232


fieldToBase58

Static fieldToBase58(field): string

Parameters

NameType
fieldField

Returns

string

Defined in

snarky.d.ts:1231


fieldsOfJson

Static fieldsOfJson(json): Field[]

Parameters

NameType
jsonstring

Returns

Field[]

Defined in

snarky.d.ts:1242


hashAccountUpdateFromFields

Static hashAccountUpdateFromFields(fields): Field

Parameters

NameType
fieldsField[]

Returns

Field

Defined in

snarky.d.ts:1243


hashAccountUpdateFromJson

Static hashAccountUpdateFromJson(json): Field

Parameters

NameType
jsonstring

Returns

Field

Defined in

snarky.d.ts:1244


memoHashBase58

Static memoHashBase58(memoBase58): Field

Parameters

NameType
memoBase58string

Returns

Field

Defined in

snarky.d.ts:1235


memoToBase58

Static memoToBase58(memoString): string

Parameters

NameType
memoStringstring

Returns

string

Defined in

snarky.d.ts:1234


privateKeyOfString

Static privateKeyOfString(privateKeyBase58): Scalar

Parameters

NameType
privateKeyBase58string

Returns

Scalar

Defined in

snarky.d.ts:1230


privateKeyToString

Static privateKeyToString(privateKey): string

Parameters

NameType
privateKeyObject
privateKey.sScalar

Returns

string

Defined in

snarky.d.ts:1229


publicKeyOfString

Static publicKeyOfString(publicKeyBase58): PublicKey_

Parameters

NameType
publicKeyBase58string

Returns

PublicKey_

Defined in

snarky.d.ts:1228


publicKeyToString

Static publicKeyToString(publicKey): string

Parameters

NameType
publicKeyPublicKey_

Returns

string

Defined in

snarky.d.ts:1227


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:1212


signFieldElement

Static signFieldElement(messageHash, privateKey, isMainnet): string

Signs a Field element.

Parameters

NameType
messageHashField
privateKeyObject
privateKey.sScalar
isMainnetboolean

Returns

string

Defined in

snarky.d.ts:1198


signOtherAccountUpdate

Static signOtherAccountUpdate(txJson, privateKey, i): string

Signs an account update.

Parameters

NameType
txJsonstring
privateKeyObject
privateKey.sScalar
inumber

Returns

string

Defined in

snarky.d.ts:1217


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:1181


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:1190