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 any object exposing an address property — such as a TransactionSigner, an account meta, or a framework's address wrapper class (see HasAddress). 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| InstructionAccountInput<T> | InstructionSignerInput<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.value);

On this page