Skip to content

Commit 798fb04

Browse files
authored
fix: ledger send transaction logic (#11)
1 parent d734979 commit 798fb04

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

scripts/lib/helpers.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
PublicKey,
1212
Transaction,
1313
TransactionInstruction,
14+
sendAndConfirmRawTransaction,
1415
sendAndConfirmTransaction,
1516
} from "@solana/web3.js";
1617
import { LedgerNodeWallet } from "./ledger";
@@ -169,9 +170,14 @@ export async function executeOrPropose(
169170
);
170171
} else {
171172
const tx = new Transaction().add(instruction);
172-
const sig = await sendAndConfirmTransaction(connection, tx, [
173-
(wallet as Wallet).payer,
174-
]);
173+
const { blockhash } = await connection.getLatestBlockhash();
174+
tx.recentBlockhash = blockhash;
175+
tx.feePayer = wallet.publicKey;
176+
await wallet.signTransaction(tx);
177+
const sig = await sendAndConfirmRawTransaction(
178+
connection,
179+
tx.serialize()
180+
);
175181
console.log(`Signature: ${sig}`);
176182
}
177183
} catch (err) {

0 commit comments

Comments
 (0)