Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import "dotenv/config";
import { getKeypairFromEnvironment } from "@solana-developers/helpers";
import axios from "axios";
import {
AddressLookupTableAccount,
Connection,
PublicKey,
VersionedTransaction,
Expand Down Expand Up @@ -39,6 +40,8 @@ function instructionFormat(instruction) {
};
}

let addressLookupTables: { [key: string]: AddressLookupTableAccount[] } = {};

async function run() {

const start = Date.now();
Expand Down Expand Up @@ -127,7 +130,14 @@ async function run() {
// ALT
const addressLookupTableAccounts = await Promise.all(
instructions.addressLookupTableAddresses.map(async (address) => {
if (addressLookupTables[address]) {
return addressLookupTables[address];
}

const result = await connection.getAddressLookupTable(new PublicKey(address));
if (result.value) {
addressLookupTables[address] = result.value;
}
return result.value;
})
);
Expand Down