Skip to content

AccountManager

Manages Algorand accounts, including creation, funding, and key management.

const accountManager = algorand.account;

Creates a new random account.

const account = await algorand.account.random();

Returns: Promise<TransactionSignerAccount> - The newly created account.

Restores an account from a 25-word mnemonic.

ParameterTypeDescription
mnemonicstring25-word Algorand mnemonic
const account = algorand.account.fromMnemonic('abandon abandon ...');

Gets an account from KMD by name.

ParameterTypeDescription
namestringAccount name in KMD
predicate(account) => booleanOptional filter
const account = await algorand.account.fromKmd('my-account');

ensureFunded(account, dispenser, minBalance)

Section titled “ensureFunded(account, dispenser, minBalance)”

Ensures an account has a minimum balance by funding it from a dispenser.

ParameterTypeDescription
accountstring | TransactionSignerAccountAccount to fund
dispenserTransactionSignerAccountFunding source
minBalanceAlgoAmountMinimum balance required
await algorand.account.ensureFunded(myAccount, algorand.account.localNetDispenser(), (1).algo());

Returns the default LocalNet dispenser account.

const dispenser = algorand.account.localNetDispenser();

Returns a TestNet dispenser from environment variables.

const dispenser = await algorand.account.dispenserFromEnvironment();