Skip to main content

getAccount

A builder function that returns the interaction to get an account by address.

Consider using the pre-built interaction 'fcl.account(address)' if you do not need to pair with any other builders.

Account address is a unique account identifier. Be mindful about the '0x' prefix, you should use the prefix as a default representation but be careful and safely handle user inputs without the prefix.

Import

You can import the entire package and access the function:


_10
import * as sdk from "@onflow/sdk"
_10
_10
sdk.getAccount(addr)

Or import directly the specific function:


_10
import { getAccount } from "@onflow/sdk"
_10
_10
getAccount(addr)

Usage


_10
import * as fcl from "@onflow/fcl";
_10
_10
// somewhere in an async function
_10
// fcl.account is the same as this function
_10
const getAccount = async (address) => {
_10
const account = await fcl.send([fcl.getAccount(address)]).then(fcl.decode);
_10
return account;
_10
};

Parameters

addr

  • Type: string

Returns

InteractionBuilderFn


_10
export type InteractionBuilderFn = (
_10
ix: Interaction
_10
) => Interaction | Promise<Interaction>


Rate this page