Skip to content

Commit

Permalink
fixup! Add wallet adapter for NuFi
Browse files Browse the repository at this point in the history
Co-authored-by: Jordan Sexton <[email protected]>
  • Loading branch information
gyorgy-kurucz-vacuum and jordaaash committed Jun 28, 2022
1 parent 4c9e965 commit b162234
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions packages/wallets/nufi/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -156,16 +157,18 @@ export class NufiWalletAdapter extends BaseMessageSignerWalletAdapter {
): Promise<TransactionSignature> {
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<Transaction> {
Expand Down

0 comments on commit b162234

Please sign in to comment.