getAddressFromResolvedInstructionAccount

function getAddressFromResolvedInstructionAccount<T>(
    inputName,
    value,
): Address<T>;

Extracts the address from a resolved instruction account.

A resolved instruction account can be an Address, a ProgramDerivedAddress, or a TransactionSigner. This function extracts the underlying address from any of these types.

Type Parameters

Type ParameterDefault typeDescription
T extends stringstringThe address type, defaults to string.

Parameters

ParameterTypeDescription
inputNamestringThe name of the instruction input, used in error messages.
value| Address<T> | readonly [Address<T>, ProgramDerivedAddressBump] | TransactionSigner<T> | null | undefinedThe resolved account value to extract the address from.

Returns

Address<T>

The extracted address.

Throws

Throws a SolanaError if the value is null or undefined.

Example

const address = getAddressFromResolvedInstructionAccount('mint', resolvedMint);

On this page