HasAddress

type HasAddress<TAddress> = Readonly<{
  address: Address<TAddress>;
}>;

Represents any object that exposes a Solana address through an address property.

This is a structural interface that many Kit types already satisfy — for instance, TransactionSigner, AccountMeta and the fee payer of a transaction message. Frameworks that provide their own wrapper classes around addresses can implement this interface so that their values are accepted wherever an address-bearing object is expected — e.g. by the instruction builders of generated program clients.

Type Parameters

Type ParameterDefault typeDescription
TAddress extends stringstringSupply a string literal to define an object having a particular address.

Example

import { Address, HasAddress } from '@solana/addresses';
 
class MyAddressWrapper implements HasAddress {
    constructor(readonly address: Address) {}
}

See

Address

On this page