LocalBlockchain
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;
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;
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:
stringReturns
voidgetNetworkId()
getNetworkId: () => NetworkId;Returns
NetworkIdproofsEnabled
proofsEnabled: boolean;testAccounts
testAccounts: [TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey, TestPublicKey];applyJsonTransaction()
Parameters
• json:
stringReturns
voidcurrentSlot()
Returns
fetchActions()
Parameters
• publicKey:
PublicKey• actionStates?:
ActionStates• tokenId?:
Field=TokenId.defaultReturns
Promise\<{actions:string[][];hash:string; }[]>fetchEvents()
Parameters
• publicKey:
PublicKey• tokenId:
Field=TokenId.defaultReturns
Promise\<any>getAccount()
Parameters
• publicKey:
PublicKey• tokenId:
Field=TokenId.defaultReturns
AccountgetActions()
Parameters
• publicKey:
PublicKey• actionStates?:
ActionStates• tokenId?:
Field=TokenId.defaultReturns
{
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.defaultReturns
booleanincrementGlobalSlot()
Parameters
• increment:
number|UInt32Returns
voidsendTransaction()
Parameters
• txn:
Transaction\<boolean,boolean>Returns
setBlockchainLength()
Parameters
• height:
UInt32Returns
voidsetGlobalSlot()
Parameters
• slot:
number|UInt32Returns
voidsetProofsEnabled()
Parameters
• newProofsEnabled:
booleanReturns
voidsetTotalCurrency()
Parameters
• currency:
UInt64Returns
voidtransaction()
Parameters
• sender:
FeePayerSpec• f
Returns
TransactionPromise\<false,false>