Kit
Type aliases

MaybeEncodedAccount

MaybeEncodedAccount<TAddress> = MaybeAccount<Uint8Array, TAddress>

Represents an encoded account that may or may not exist on-chain.

When the account exists, it is represented as an Account type having its TData type parameter set to Uint8Array with an additional exists attribute set to true. When it does not exist, it is represented by an object containing only the address of the account and an exists attribute set to false.

Type Parameters

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

Example

// Encoded account exists
const myExistingAccount: MaybeEncodedAccount<'1234..5678'> = {
    exists: true,
    address: address('1234..5678'),
    data: new Uint8Array([1, 2, 3]),
    // ...
};
 
// Encoded account does not exist
const myMissingAccount: MaybeEncodedAccount<'8765..4321'> = {
    exists: false,
    address: address('8765..4321'),
};

On this page