From 1d78cee269c2a0668276e108ef65a3481daf1d73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?C=E2=97=8ESIM=E2=97=8E?= <89115113+cosimo-rip@users.noreply.github.com> Date: Mon, 20 Mar 2023 11:48:15 -0400 Subject: [PATCH] Fix signing failures with Phantom Wallet 23.3.3+ --- src/lib/anchorUtils.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/lib/anchorUtils.ts b/src/lib/anchorUtils.ts index 645e2dd..d6741ce 100644 --- a/src/lib/anchorUtils.ts +++ b/src/lib/anchorUtils.ts @@ -44,14 +44,20 @@ export const customProviderFactory = ( tx.feePayer = anchorWallet?.publicKey; tx.recentBlockhash = (await connection.getRecentBlockhash()).blockhash; - await anchorWallet?.signTransaction(tx); + let signedTx = await anchorWallet?.signTransaction(tx); + if (signedTx === undefined) { + return ''; + } + signers .filter((s): s is Signer => s !== undefined) .forEach((kp) => { - tx.partialSign(kp); + if (signedTx) { + signedTx.partialSign(kp); + } }); - const rawTx = tx.serialize(); + const rawTx = signedTx.serialize(); const signature = await connection.sendRawTransaction(rawTx); // Await for 30 seconds