Skip to content

Commit

Permalink
feat: handle loadedAddresses field in tx meta responses
Browse files Browse the repository at this point in the history
  • Loading branch information
jstarry committed Aug 10, 2022
1 parent 9348a23 commit e9e6098
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions web3.js/src/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,14 @@ export type TokenBalance = {
*/
export type ParsedConfirmedTransactionMeta = ParsedTransactionMeta;

/**
* Collection of addresses loaded by a transaction using address table lookups
*/
export type LoadedAddresses = {
writable: Array<PublicKey>;
readonly: Array<PublicKey>;
};

/**
* Metadata for a parsed transaction on the ledger
*/
Expand All @@ -824,6 +832,8 @@ export type ParsedTransactionMeta = {
postTokenBalances?: Array<TokenBalance> | null;
/** The error result of transaction processing */
err: TransactionError | null;
/** The collection of addresses loaded using address lookup tables */
loadedAddresses?: LoadedAddresses;
};

export type CompiledInnerInstruction = {
Expand Down Expand Up @@ -1794,6 +1804,11 @@ const TokenBalanceResult = pick({
uiTokenAmount: TokenAmountResult,
});

const LoadedAddressesResult = pick({
writable: array(PublicKeyFromString),
readonly: array(PublicKeyFromString),
});

/**
* @internal
*/
Expand Down Expand Up @@ -1821,6 +1836,7 @@ const ConfirmedTransactionMetaResult = pick({
logMessages: optional(nullable(array(string()))),
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
loadedAddresses: optional(LoadedAddressesResult),
});

/**
Expand All @@ -1844,6 +1860,7 @@ const ParsedConfirmedTransactionMetaResult = pick({
logMessages: optional(nullable(array(string()))),
preTokenBalances: optional(nullable(array(TokenBalanceResult))),
postTokenBalances: optional(nullable(array(TokenBalanceResult))),
loadedAddresses: optional(LoadedAddressesResult),
});

/**
Expand Down

0 comments on commit e9e6098

Please sign in to comment.