getAccount
Example
Section titled “Example”Default
If you have a mnemonic secret loaded into process.env.ACCOUNT_MNEMONIC then you can call the following to get that private key loaded into an account object:
const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)If that code runs against LocalNet then a wallet called ACCOUNT will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
account
The details of the account to get, either the name identifier (string) or an object with:
config: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName) ORname: string: The name identifier of the account (deprecated) And optionallyfundWith: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
algod
An algod client
kmdClient
An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
Call Signature
Section titled “Call Signature”getAccount(
account,algod,kmdClient?):Promise<Account|SigningAccount>
Defined in: algokit-utils-ts/src/account/get-account.ts:40
Parameters
Section titled “Parameters”account
Section titled “account”string | { fundWith?: AlgoAmount; name: string; }
The details of the account to get, either the name identifier (string) or an object with:
name: The name identifier of the accountfundWith: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
AlgodClient
An algod client
kmdClient?
Section titled “kmdClient?”KmdClient
An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
Returns
Section titled “Returns”Promise<Account | SigningAccount>
The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
Example
Section titled “Example”Default
If you have a mnemonic secret loaded into process.env.ACCOUNT_MNEMONIC then you can call the following to get that private key loaded into an account object:
const account = await getAccount('ACCOUNT', algod)If that code runs against LocalNet then a wallet called ACCOUNT will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.
Call Signature
Section titled “Call Signature”getAccount(
account,algod,kmdClient?):Promise<Account|SigningAccount>
Defined in: algokit-utils-ts/src/account/get-account.ts:67
Parameters
Section titled “Parameters”account
Section titled “account”The details of the account to get, an object with:
config: Account configuration. To get from environment use getAccountConfigFromEnvironment(accountName)fundWith: The amount to fund the account with when it gets created (when targeting LocalNet), if not specified then 1000 ALGO will be funded from the dispenser account
config
Section titled “config”fundWith?
Section titled “fundWith?”AlgodClient
An algod client
kmdClient?
Section titled “kmdClient?”KmdClient
An optional KMD client to use to create an account (when targeting LocalNet), if not specified then a default KMD client will be loaded from environment variables
Returns
Section titled “Returns”Promise<Account | SigningAccount>
The requested account with private key loaded from the environment variables or when targeting LocalNet from KMD (idempotently creating and funding the account)
Example
Section titled “Example”Default
If you have a mnemonic secret loaded into process.env.ACCOUNT_MNEMONIC then you can call the following to get that private key loaded into an account object:
const account = await getAccount({config: getAccountConfigFromEnvironment('ACCOUNT')}, algod)If that code runs against LocalNet then a wallet called ACCOUNT will automatically be created with an account that is automatically funded with 1000 (default) ALGO from the default LocalNet dispenser.