From b162234cf320b127b86c73fd9a93a58526126d01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gy=C3=B6rgy=20Kurucz?= Date: Tue, 28 Jun 2022 10:39:48 +0200 Subject: [PATCH] fixup! Add wallet adapter for NuFi Co-authored-by: Jordan Sexton --- packages/wallets/nufi/src/adapter.ts | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/wallets/nufi/src/adapter.ts b/packages/wallets/nufi/src/adapter.ts index f671d5f09..b0790b7be 100644 --- a/packages/wallets/nufi/src/adapter.ts +++ b/packages/wallets/nufi/src/adapter.ts @@ -13,8 +13,9 @@ import { WalletReadyState, WalletSignMessageError, WalletSignTransactionError, + WalletSendTransactionError, } from '@solana/wallet-adapter-base'; -import { Connection, PublicKey, SendOptions, Transaction, TransactionSignature } from '@solana/web3.js'; +import { Connection, PublicKey, Transaction, TransactionSignature } from '@solana/web3.js'; interface NufiEvents { connect(): void; @@ -156,16 +157,18 @@ export class NufiWalletAdapter extends BaseMessageSignerWalletAdapter { ): Promise { try { const wallet = this._wallet; - if (wallet) { + if (!wallet) throw new WalletNotConnectedError(); + + try { const { signature } = await wallet.signAndSendTransaction(transaction); return signature; + } catch (error: any) { + throw new WalletSendTransactionError(error?.message, error); } } catch (error: any) { this.emit('error', error); throw error; } - - return await super.sendTransaction(transaction, connection, options); } async signTransaction(transaction: Transaction): Promise {