Kit
Functions

assertAccountsDecoded

Call Signature

assertAccountsDecoded<TData, TAddress>(accounts): asserts accounts is Account<TData, TAddress>[]

Asserts that all input accounts store decoded data, ie. not a Uint8Array.

As with assertAccountDecoded it does not check the shape of the data matches the decoded type, only that it is not a Uint8Array.

Type Parameters

Type ParameterDefault type
TData extends object-
TAddress extends stringstring

Parameters

ParameterType
accountsAccount<ReadonlyUint8Array | TData, TAddress>[]

Returns

asserts accounts is Account<TData, TAddress>[]

Example

type MyAccountData = { name: string; age: number };
 
const myAccounts: Account<MyAccountData | Uint8Array, Address>[];
assertAccountsDecoded(myAccounts);
 
// now the account data can be used as MyAccountData
for (const a of account) {
    account.data satisfies MyAccountData;
}

Call Signature

assertAccountsDecoded<TData, TAddress>(accounts): asserts accounts is MaybeAccount<TData, TAddress>[]

Asserts that all input accounts store decoded data, ie. not a Uint8Array.

As with assertAccountDecoded it does not check the shape of the data matches the decoded type, only that it is not a Uint8Array.

Type Parameters

Type ParameterDefault type
TData extends object-
TAddress extends stringstring

Parameters

ParameterType
accountsMaybeAccount<ReadonlyUint8Array | TData, TAddress>[]

Returns

asserts accounts is MaybeAccount<TData, TAddress>[]

Example

type MyAccountData = { name: string; age: number };
 
const myAccounts: Account<MyAccountData | Uint8Array, Address>[];
assertAccountsDecoded(myAccounts);
 
// now the account data can be used as MyAccountData
for (const a of account) {
    account.data satisfies MyAccountData;
}

On this page