LocalBlockchain
function LocalBlockchain(__namedParameters: {
"enforceTransactionLimits": true;
"proofsEnabled": true;
}): Promise<{
"addAccount": (publicKey: PublicKey, balance: string) => void;
"getNetworkId": () => NetworkId;
"proofsEnabled": boolean;
"testAccounts": [TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey];
"applyJsonTransaction": void;
"currentSlot": UInt32;
"fetchActions": Promise<{
"actions": string[][];
"hash": string;
}[]>;
"fetchEvents": Promise<any>;
"getAccount": Account;
"getActions": {
"actions": string[][];
"hash": string;
}[];
"getNetworkConstants": {
"accountCreationFee": UInt64;
"genesisTimestamp": UInt64;
"slotTime": UInt64;
};
"getNetworkState": PreconditionBaseTypes<{}>;
"hasAccount": boolean;
"incrementGlobalSlot": void;
"resetProofsEnabled": void;
"sendTransaction": PendingTransactionPromise;
"setBlockchainLength": void;
"setGlobalSlot": void;
"setProofsEnabled": void;
"setTotalCurrency": void;
"transaction": TransactionPromise<false, false>;
}>
A mock Mina blockchain running locally and useful for testing.
Parameters
• __namedParameters= {}
• __namedParameters.enforceTransactionLimits: undefined
| boolean
= true
• __namedParameters.proofsEnabled: undefined
| boolean
= true
Returns
Promise
\<{
"addAccount"
: (publicKey
: PublicKey
, balance
: string
) => void
;
"getNetworkId"
: () => NetworkId
;
"proofsEnabled"
: boolean
;
"testAccounts"
: [TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
, TestPublicKey
];
"applyJsonTransaction"
: void
;
"currentSlot"
: UInt32
;
"fetchActions"
: Promise
\<{
"actions"
: string
[][];
"hash"
: string
;
}[]>;
"fetchEvents"
: Promise
\<any
>;
"getAccount"
: Account
;
"getActions"
: {
"actions"
: string
[][];
"hash"
: string
;
}[];
"getNetworkConstants"
: {
"accountCreationFee"
: UInt64
;
"genesisTimestamp"
: UInt64
;
"slotTime"
: UInt64
;
};
"getNetworkState"
: PreconditionBaseTypes
\<{}>;
"hasAccount"
: boolean
;
"incrementGlobalSlot"
: void
;
"resetProofsEnabled"
: void
;
"sendTransaction"
: PendingTransactionPromise
;
"setBlockchainLength"
: void
;
"setGlobalSlot"
: void
;
"setProofsEnabled"
: void
;
"setTotalCurrency"
: void
;
"transaction"
: TransactionPromise
\<false
, false
>;
}>
addAccount()
addAccount: (publicKey: PublicKey, balance: string) => void;
Parameters
• publicKey:
PublicKey
• balance:
string
Returns
void
getNetworkId()
getNetworkId: () => NetworkId;
Returns
NetworkId
proofsEnabled
proofsEnabled: boolean;
testAccounts
testAccounts: [TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey];
applyJsonTransaction()
Parameters
• json:
string
Returns
void
currentSlot()
Returns
fetchActions()
Parameters
• publicKey:
PublicKey
• actionStates?:
ActionStates
• tokenId?:
Field
=TokenId.default
Returns
Promise
\<{"actions"
:string
[][];"hash"
:string
; }[]>fetchEvents()
Parameters
• publicKey:
PublicKey
• tokenId:
Field
=TokenId.default
Returns
Promise
\<any
>getAccount()
Parameters
• publicKey:
PublicKey
• tokenId:
Field
=TokenId.default
Returns
Account
getActions()
Parameters
• publicKey:
PublicKey
• actionStates?:
ActionStates
• tokenId?:
Field
=TokenId.default
Returns
{
"actions"
:string
[][];"hash"
:string
; }[]getNetworkConstants()
Returns
{
"accountCreationFee": UInt64;
"genesisTimestamp": UInt64;
"slotTime": UInt64;
}accountCreationFee
accountCreationFee: UInt64;
genesisTimestamp
genesisTimestamp: UInt64;
slotTime
slotTime: UInt64;
Duration of 1 slot in millisecondw
getNetworkState()
Returns
PreconditionBaseTypes
\<{}>hasAccount()
Parameters
• publicKey:
PublicKey
• tokenId:
Field
=TokenId.default
Returns
boolean
incrementGlobalSlot()
Parameters
• increment:
number
|UInt32
Returns
void
resetProofsEnabled()
Returns
void
sendTransaction()
Parameters
• txn:
Transaction
\<boolean
,boolean
>Returns
setBlockchainLength()
Parameters
• height:
UInt32
Returns
void
setGlobalSlot()
Parameters
• slot:
number
|UInt32
Returns
void
setProofsEnabled()
Parameters
• newProofsEnabled:
boolean
Returns
void
setTotalCurrency()
Parameters
• currency:
UInt64
Returns
void
transaction()
Parameters
• sender:
FeePayerSpec
• f
Returns
TransactionPromise
\<false
,false
>