Skip to main content

Namespace: Mina

Table of contents

Type Aliases

Functions

Type Aliases

CurrentTransaction

Ƭ CurrentTransaction: Object

Type declaration

NameType
accountUpdatesAccountUpdate[]
fetchModeFetchMode
isFinalRunOutsideCircuitboolean
numberOfRuns0 | 1 | undefined
sender?PublicKey

Defined in

lib/mina.ts:97


FeePayerSpec

Ƭ FeePayerSpec: PrivateKey | { fee?: number | string | UInt64 ; feePayerKey: PrivateKey ; memo?: string ; nonce?: number } | undefined

Allows you to specify information about the fee payer account and the transaction.

Defined in

lib/mina.ts:110

Functions

BerkeleyQANet

BerkeleyQANet(graphqlEndpoint): Mina

Parameters

NameType
graphqlEndpointstring

Returns

Mina

Defined in

lib/mina.ts:665


LocalBlockchain

LocalBlockchain(__namedParameters?): Object

A mock Mina blockchain running locally and useful for testing.

Parameters

NameType
__namedParametersObject
__namedParameters.accountCreationFeeundefined | string | number
__namedParameters.proofsEnabledundefined | boolean

Returns

Object

NameType
accountCreationFee() => UInt64
addAccount(pk: PublicKey, balance: string) => void
testAccounts{ privateKey: PrivateKey ; publicKey: PublicKey }[]
applyJsonTransaction(json: string) => Account[]
currentSlot() => UInt32
fetchEvents(publicKey: PublicKey, tokenId: Field) => Promise<any[]>
getAccount(publicKey: PublicKey, tokenId: Field) => Account
getActions(publicKey: PublicKey, tokenId: Field) => { actions: string[][] ; hash: string }[]
getNetworkState() => PreconditionBaseTypes<{ blockchainLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceGenesis: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceHardFork: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; minWindowDensity: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; nextEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } }>
hasAccount(publicKey: PublicKey, tokenId: Field) => boolean
incrementGlobalSlot(increment: number | UInt32) => void
sendTransaction(txn: Transaction) => Promise<{ hash: () => string ; wait: () => Promise<void> }>
setBlockchainLength(height: UInt32) => void
setGlobalSlot(slot: number | UInt32) => void
setProofsEnabled(newProofsEnabled: boolean) => void
setTimestamp(ms: UInt64) => void
setTotalCurrency(currency: UInt64) => void
transaction(sender: FeePayerSpec, f: () => void) => Promise<Transaction>

Defined in

lib/mina.ts:286


accountCreationFee

accountCreationFee(): UInt64

Returns the default account creation fee.

Returns

UInt64

Defined in

lib/mina.ts:809


createTransaction

createTransaction(feePayer, f, numberOfRuns, __namedParameters?): Transaction

Parameters

NameType
feePayerFeePayerSpec
f() => unknown
numberOfRunsundefined | 0 | 1
__namedParametersObject
__namedParameters.fetchModeundefined | FetchMode
__namedParameters.isFinalRunOutsideCircuitundefined | boolean
__namedParameters.proofsEnabledundefined | boolean

Returns

Transaction

Defined in

lib/mina.ts:128


currentSlot

currentSlot(): UInt32

Returns

UInt32

The current slot number, according to the active Mina instance.

Defined in

lib/mina.ts:774


currentTransaction

currentTransaction(): undefined | CurrentTransaction

Returns

undefined | CurrentTransaction

Defined in

lib/global-context.ts:6


fetchEvents

fetchEvents(publicKey, tokenId): Promise<any>

Parameters

NameType
publicKeyPublicKey
tokenIdField

Returns

Promise<any>

A list of emitted events associated to the given public key.

Defined in

lib/mina.ts:820


getAccount

getAccount(publicKey, tokenId?): Account

Parameters

NameType
publicKeyPublicKey
tokenId?Field

Returns

Account

The account data associated to the given public key.

Defined in

lib/mina.ts:781


getActions

getActions(publicKey, tokenId): { actions: string[][] ; hash: string }[]

Parameters

NameType
publicKeyPublicKey
tokenIdField

Returns

{ actions: string[][] ; hash: string }[]

A list of emitted sequencing actions associated to the given public key.

Defined in

lib/mina.ts:827


getBalance

getBalance(publicKey, tokenId?): UInt64

Parameters

NameType
publicKeyPublicKey
tokenId?Field

Returns

UInt64

The balance associated to the given public key.

Defined in

lib/mina.ts:802


getNetworkState

getNetworkState(): PreconditionBaseTypes<{ blockchainLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceGenesis: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceHardFork: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; minWindowDensity: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; nextEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } }>

Returns

PreconditionBaseTypes<{ blockchainLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceGenesis: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; globalSlotSinceHardFork: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; minWindowDensity: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; nextEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; snarkedLedgerHash: { isSome: Bool ; value: Field } ; stakingEpochData: { epochLength: { isSome: Bool ; value: { lower: UInt32 ; upper: UInt32 } } ; ledger: { hash: { isSome: Bool ; value: Field } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } } ; lockCheckpoint: { isSome: Bool ; value: Field } ; seed: { isSome: Bool ; value: Field } ; startCheckpoint: { isSome: Bool ; value: Field } } ; timestamp: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } ; totalCurrency: { isSome: Bool ; value: { lower: UInt64 ; upper: UInt64 } } }>

Data associated with the current state of the Mina network.

Defined in

lib/mina.ts:795


hasAccount

hasAccount(publicKey, tokenId?): boolean

Checks if an account exists within the ledger.

Parameters

NameType
publicKeyPublicKey
tokenId?Field

Returns

boolean

Defined in

lib/mina.ts:788


sendTransaction

sendTransaction(txn): Promise<TransactionId>

Parameters

NameType
txnTransaction

Returns

Promise<TransactionId>

Defined in

lib/mina.ts:813


setActiveInstance

setActiveInstance(m): void

Set the currently used Mina instance.

Parameters

NameType
mMina

Returns

void

Defined in

lib/mina.ts:736


transaction

transaction(f): Promise<Transaction>

Construct a smart contract transaction. Within the callback passed to this function, you can call into the methods of smart contracts.

transaction(() => {
myZkapp.update();
someOtherZkapp.someOtherMethod();
})

Parameters

NameType
f() => void

Returns

Promise<Transaction>

A transaction that can subsequently be submitted to the chain.

Defined in

lib/mina.ts:753

transaction(sender, f): Promise<Transaction>

Parameters

NameType
senderFeePayerSpec
f() => void

Returns

Promise<Transaction>

Defined in

lib/mina.ts:754