Skip to main content
Version: 2.4.0

fetchAccount

function fetchAccount(
accountInfo: {
publicKey: string | PublicKey;
tokenId: string | Field;
},
graphqlEndpoint: string,
config: FetchConfig): Promise<
| {
account: Types.Account;
error: undefined;
}
| {
account: undefined;
error: FetchError;
}>

Defined in: lib/mina/v1/fetch.ts:197

Gets account information on the specified publicKey by performing a GraphQL query to the specified endpoint. This will call the 'GetAccountInfo' query which fetches zkapp related account information.

If an error is returned by the specified endpoint, an error is thrown. Otherwise, the data is returned.

Parameters

accountInfo

The public key and token id of the account to fetch

publicKey

string | PublicKey

The specified publicKey to get account information on

tokenId

string | Field

The specified tokenId to get account information on

graphqlEndpoint

string = networkConfig.minaEndpoint

The graphql endpoint to fetch from

config

FetchConfig = {}

An object that exposes an additional timeout and header options

Returns

Promise< | { account: Types.Account; error: undefined; } | { account: undefined; error: FetchError; }>

zkapp information on the specified account or an error is thrown