Skip to content

Commit 3a77ef4

Browse files
authored
solana: fix determinePriorityFee method for VersionedTransactions (#665)
We were not resolving the address lookup table accounts
1 parent 5f8ad99 commit 3a77ef4

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

platforms/solana/src/signer.ts

+15-3
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,9 @@ import type {
44
Transaction,
55
TransactionInstruction,
66
VersionedTransaction,
7-
8-
PublicKey} from '@solana/web3.js';
7+
PublicKey,
8+
AddressLookupTableAccount,
9+
} from '@solana/web3.js';
910
import {
1011
ComputeBudgetProgram,
1112
Keypair,
@@ -406,8 +407,19 @@ export async function determinePriorityFee(
406407
// Figure out which accounts need write lock
407408
let lockedWritableAccounts = [];
408409
if (isVersionedTransaction(transaction)) {
410+
const luts = (
411+
await Promise.all(
412+
transaction.message.addressTableLookups.map((acc) =>
413+
connection.getAddressLookupTable(acc.accountKey),
414+
),
415+
)
416+
)
417+
.map((lut) => lut.value)
418+
.filter((val) => val !== null) as AddressLookupTableAccount[];
409419
const msg = transaction.message;
410-
const keys = msg.getAccountKeys();
420+
const keys = msg.getAccountKeys({
421+
addressLookupTableAccounts: luts ?? undefined,
422+
});
411423
lockedWritableAccounts = msg.compiledInstructions
412424
.flatMap((ix) => ix.accountKeyIndexes)
413425
.map((k) => (msg.isAccountWritable(k) ? keys.get(k) : null))

0 commit comments

Comments
 (0)