Skip to content

Commit 4ce4f4c

Browse files
barnjaminbruce-riley
authored andcommitted
SDK: Fix the relay fee amount in Solana NTT (wormhole-foundation#472)
1 parent 566a0e8 commit 4ce4f4c

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

solana/ts/lib/ntt.ts

+5-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,11 @@ export namespace NTT {
184184
const program = getNttProgram(connection, programId.toString(), "1.0.0");
185185

186186
const ix = await program.methods.version().accountsStrict({}).instruction();
187-
const { blockhash } =
188-
await program.provider.connection.getLatestBlockhash();
187+
// Since we don't need the very very very latest blockhash, using finalized
188+
// ensures the blockhash will be found when we immediately simulate the tx
189+
const { blockhash } = await program.provider.connection.getLatestBlockhash(
190+
"finalized"
191+
);
189192
const msg = new TransactionMessage({
190193
payerKey: sender,
191194
recentBlockhash: blockhash,

solana/ts/sdk/ntt.ts

+2-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
AddressLookupTableAccount,
66
Connection,
77
Keypair,
8+
LAMPORTS_PER_SOL,
89
PublicKey,
910
SystemProgram,
1011
Transaction,
@@ -391,7 +392,7 @@ export class SolanaNtt<N extends Network, C extends SolanaChains>
391392
payerAddress,
392393
outboxItem.publicKey,
393394
destination.chain,
394-
Number(fee),
395+
Number(fee) / LAMPORTS_PER_SOL,
395396
// Note: quoter expects gas dropoff to be in terms of gwei
396397
Number(options.gasDropoff ?? 0n) / WEI_PER_GWEI
397398
);

0 commit comments

Comments
 (0)