Skip to main content

fetchAccount

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

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

accountInfo.publicKey: string | PublicKey

accountInfo.tokenId?: string | Field

graphqlEndpoint: string= networkConfig.minaEndpoint

The graphql endpoint to fetch from

__namedParameters= {}

__namedParameters.timeout: undefined | number= defaultTimeout

Returns

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

zkapp information on the specified account or an error is thrown

Source

lib/mina/fetch.ts:171