Skip to main content

Account

getAccountByName()

In the sample wasmkit.config.js file, the accounts are defined as below:


_12
const testnet_accounts = [
_12
{
_12
name: 'account_0',
_12
address: 'juno1evpfprq0mre5n0zysj6cf74xl6psk96gus7dp5',
_12
mnemonic: 'omit sphere nurse rib tribe suffer web account catch brain hybrid zero act gold coral shell voyage matter nose stick crucial fog judge text'
_12
},
_12
{
_12
name: 'account_1',
_12
address: 'juno1njamu5g4n0vahggrxn4ma2s4vws5x4w3u64z8h',
_12
mnemonic: 'student prison fresh dwarf ecology birth govern river tissue wreck hope autumn basic trust divert dismiss buzz play pistol focus long armed flag bicycle'
_12
}
_12
];

These accounts can be easily accessed inside the scripts or in repl using the method, getAccountByName(<account_name>), for example:


_10
const { getAccountByName } = require("wasmkit");
_10
_10
const account_0 = getAccountByName("account_0");
_10
const account_1 = getAccountByName("account_1");
_10
_10
console.log(account_0.name); // account_0
_10
console.log(account_0.address); // juno1evpfprq0mre5n0zysj6cf74xl6psk96gus7dp5
_10
console.log(account_0.mnemonic); // omit sphere nurse rib tribe suffer web account catch brain hybrid zero act gold coral shell voyage matter nose stick crucial fog judge text

createAccounts()

This method is used to generate new accounts and then can be filled with some balance using a testnet faucet https://stakely.io/en/faucet/juno (faucet are only for testnets).


_10
const { createAccounts } = require("wasmkit");
_10
_10
const res = await createAccounts(1); // array of one account object
_10
const res = await createAccounts(3); // array of three account objects