Namespace: Mina
Table of contents
Type Aliases
Functions
- BerkeleyQANet
- LocalBlockchain
- accountCreationFee
- createTransaction
- currentSlot
- currentTransaction
- fetchEvents
- getAccount
- getActions
- getBalance
- getNetworkState
- hasAccount
- sendTransaction
- setActiveInstance
- transaction
Type Aliases
CurrentTransaction
Ƭ CurrentTransaction: Object
Type declaration
Name | Type |
---|---|
accountUpdates | AccountUpdate [] |
fetchMode | FetchMode |
isFinalRunOutsideCircuit | boolean |
numberOfRuns | 0 | 1 | undefined |
sender? | PublicKey |
Defined in
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
Functions
BerkeleyQANet
▸ BerkeleyQANet(graphqlEndpoint
): Mina
Parameters
Name | Type |
---|---|
graphqlEndpoint | string |
Returns
Mina
Defined in
LocalBlockchain
▸ LocalBlockchain(__namedParameters?
): Object
A mock Mina blockchain running locally and useful for testing.
Parameters
Name | Type |
---|---|
__namedParameters | Object |
__namedParameters.accountCreationFee | undefined | string | number |
__namedParameters.proofsEnabled | undefined | boolean |
Returns
Object
Name | Type |
---|---|
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
accountCreationFee
▸ accountCreationFee(): UInt64
Returns the default account creation fee.
Returns
Defined in
createTransaction
▸ createTransaction(feePayer
, f
, numberOfRuns
, __namedParameters?
): Transaction
Parameters
Name | Type |
---|---|
feePayer | FeePayerSpec |
f | () => unknown |
numberOfRuns | undefined | 0 | 1 |
__namedParameters | Object |
__namedParameters.fetchMode | undefined | FetchMode |
__namedParameters.isFinalRunOutsideCircuit | undefined | boolean |
__namedParameters.proofsEnabled | undefined | boolean |
Returns
Transaction
Defined in
currentSlot
▸ currentSlot(): UInt32
Returns
The current slot number, according to the active Mina instance.
Defined in
currentTransaction
▸ currentTransaction(): undefined
| CurrentTransaction
Returns
undefined
| CurrentTransaction
Defined in
fetchEvents
▸ fetchEvents(publicKey
, tokenId
): Promise
<any
>
Parameters
Name | Type |
---|---|
publicKey | PublicKey |
tokenId | Field |
Returns
Promise
<any
>
A list of emitted events associated to the given public key.
Defined in
getAccount
▸ getAccount(publicKey
, tokenId?
): Account
Parameters
Name | Type |
---|---|
publicKey | PublicKey |
tokenId? | Field |
Returns
Account
The account data associated to the given public key.
Defined in
getActions
▸ getActions(publicKey
, tokenId
): { actions
: string
[][] ; hash
: string
}[]
Parameters
Name | Type |
---|---|
publicKey | PublicKey |
tokenId | Field |
Returns
{ actions
: string
[][] ; hash
: string
}[]
A list of emitted sequencing actions associated to the given public key.
Defined in
getBalance
▸ getBalance(publicKey
, tokenId?
): UInt64
Parameters
Name | Type |
---|---|
publicKey | PublicKey |
tokenId? | Field |
Returns
The balance associated to the given public key.
Defined in
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
hasAccount
▸ hasAccount(publicKey
, tokenId?
): boolean
Checks if an account exists within the ledger.
Parameters
Name | Type |
---|---|
publicKey | PublicKey |
tokenId? | Field |
Returns
boolean
Defined in
sendTransaction
▸ sendTransaction(txn
): Promise
<TransactionId
>
Parameters
Name | Type |
---|---|
txn | Transaction |
Returns
Promise
<TransactionId
>
Defined in
setActiveInstance
▸ setActiveInstance(m
): void
Set the currently used Mina instance.
Parameters
Name | Type |
---|---|
m | Mina |
Returns
void
Defined in
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
Name | Type |
---|---|
f | () => void |
Returns
Promise
<Transaction
>
A transaction that can subsequently be submitted to the chain.
Defined in
▸ transaction(sender
, f
): Promise
<Transaction
>
Parameters
Name | Type |
---|---|
sender | FeePayerSpec |
f | () => void |
Returns
Promise
<Transaction
>