Skip to content

Commit

Permalink
fixup! Add wallet adapter for NuFi
Browse files Browse the repository at this point in the history
  • Loading branch information
gyorgy-kurucz-vacuum committed Jun 28, 2022
1 parent 1a089bf commit e635f13
Showing 1 changed file with 2 additions and 20 deletions.
22 changes: 2 additions & 20 deletions packages/wallets/nufi/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,21 +159,8 @@ export class NufiWalletAdapter extends BaseMessageSignerWalletAdapter {

if (!wallet.isConnected) {
try {
await new Promise<void>((resolve, reject) => {
const connect = () => {
wallet.off('connect', connect);
resolve();
};

wallet.on('connect', connect);

wallet.connect().catch((reason: any) => {
wallet.off('connect', connect);
reject(reason);
});
});
await wallet.connect();
} catch (error: any) {
if (error instanceof WalletError) throw error;
throw new WalletConnectionError(error?.message, error);
}
}
Expand Down Expand Up @@ -226,12 +213,7 @@ export class NufiWalletAdapter extends BaseMessageSignerWalletAdapter {
): Promise<TransactionSignature> {
try {
const wallet = this._wallet;
// Partial signers are not handled, so if they are provided, don't use `signAndSendTransaction`
if (wallet && !options?.signers) {
transaction.feePayer = transaction.feePayer || this.publicKey || undefined;
transaction.recentBlockhash =
transaction.recentBlockhash || (await connection.getRecentBlockhash('finalized')).blockhash;

if (wallet) {
const { signature } = await wallet.signAndSendTransaction(transaction);
return signature;
}
Expand Down

0 comments on commit e635f13

Please sign in to comment.