Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jordaaash committed Jan 15, 2025
1 parent ea43726 commit dbb6a98
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 18 deletions.
2 changes: 2 additions & 0 deletions packages/core/util/jest.resolver.cjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
/* global module */

module.exports = (path, options) => {
// Call the defaultResolver, so we leverage its cache, error handling, etc.
return options.defaultResolver(path, {
Expand Down
7 changes: 4 additions & 3 deletions packages/core/util/src/signIn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ export function verifySignIn(input: SolanaSignInInput, output: SolanaSignInOutpu
account: { publicKey },
} = output;
const message = deriveSignInMessage(input, output);
return !!message && verifyMessageSignature({ message, signedMessage, signature, publicKey: publicKey as Uint8Array });
return (
!!message && verifyMessageSignature({ message, signedMessage, signature, publicKey: publicKey as Uint8Array })
);
}

/**
Expand Down Expand Up @@ -90,9 +92,8 @@ export function parseSignInMessageText(text: string): SolanaSignInInputWithRequi
if (!groups) return null;

return {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
domain: groups.domain!,
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion

address: groups.address!,
statement: groups.statement,
uri: groups.uri,
Expand Down
5 changes: 0 additions & 5 deletions packages/wallet-adapter/base/src/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,6 @@ export class StandardWalletAdapter extends BaseWalletAdapter implements Standard
},
});

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return bs58.encode(output!.signature);
} else {
const [output] = await (this.#wallet.features as SolanaSignTransactionFeature)[
Expand All @@ -336,7 +335,6 @@ export class StandardWalletAdapter extends BaseWalletAdapter implements Standard
},
});

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return await connection.sendRawTransaction(output!.signedTransaction, {
...sendOptions,
preflightCommitment: getCommitment(sendOptions.preflightCommitment || connection.commitment),
Expand Down Expand Up @@ -374,7 +372,6 @@ export class StandardWalletAdapter extends BaseWalletAdapter implements Standard
),
});

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const serializedTransaction = signedTransactions[0]!.signedTransaction;

return (
Expand Down Expand Up @@ -417,7 +414,6 @@ export class StandardWalletAdapter extends BaseWalletAdapter implements Standard
);

return transactions.map((transaction, index) => {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const signedTransaction = signedTransactions[index]!.signedTransaction;

return (
Expand Down Expand Up @@ -450,7 +446,6 @@ export class StandardWalletAdapter extends BaseWalletAdapter implements Standard
message,
});

// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
return signedMessages[0]!.signature;
} catch (error: any) {
throw new WalletSignMessageError(error?.message, error);
Expand Down
5 changes: 1 addition & 4 deletions packages/wallet-adapter/base/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import bs58 from 'bs58';

/** TODO: docs */
export class SolanaWalletAdapterWalletAccount extends ReadonlyWalletAccount {
// eslint-disable-next-line no-unused-private-class-members
readonly #adapter: Adapter;

constructor({
Expand Down Expand Up @@ -202,7 +203,6 @@ export class SolanaWalletAdapterWallet implements Wallet {
#connected(): void {
const publicKey = this.#adapter.publicKey?.toBytes();
if (publicKey) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const address = this.#adapter.publicKey!.toBase58();
const account = this.#account;
if (
Expand Down Expand Up @@ -270,7 +270,6 @@ export class SolanaWalletAdapterWallet implements Wallet {
const outputs: SolanaSignAndSendTransactionOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const input = inputs[0]!;
if (input.account !== this.#account) throw new Error('invalid account');
if (!isSolanaChain(input.chain)) throw new Error('invalid chain');
Expand Down Expand Up @@ -319,7 +318,6 @@ export class SolanaWalletAdapterWallet implements Wallet {
const outputs: SolanaSignTransactionOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const input = inputs[0]!;
if (input.account !== this.#account) throw new Error('invalid account');
if (input.chain && !isSolanaChain(input.chain)) throw new Error('invalid chain');
Expand Down Expand Up @@ -370,7 +368,6 @@ export class SolanaWalletAdapterWallet implements Wallet {
const outputs: SolanaSignMessageOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const input = inputs[0]!;
if (input.account !== this.#account) throw new Error('invalid account');

Expand Down
2 changes: 1 addition & 1 deletion packages/wallets/ghost/src/solana.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function isSolanaChain(chain: IdentifierString): chain is SolanaChain {
}

export function isVersionedTransaction(
transaction: Transaction | VersionedTransaction
transaction: Transaction | VersionedTransaction
): transaction is VersionedTransaction {
return 'version' in transaction;
}
7 changes: 2 additions & 5 deletions packages/wallets/ghost/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ import {
type SolanaSignTransactionMethod,
type SolanaSignTransactionOutput,
} from '@solana/wallet-standard-features';
import { Transaction, VersionedTransaction } from '@solana/web3.js';
import type { Transaction } from '@solana/web3.js';
import { VersionedTransaction } from '@solana/web3.js';
import type { Wallet } from '@wallet-standard/base';
import {
StandardConnect,
Expand Down Expand Up @@ -151,7 +152,6 @@ export class GhostWallet implements Wallet {
#connected = () => {
const address = this.#ghost.publicKey?.toBase58();
if (address) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const publicKey = this.#ghost.publicKey!.toBytes();

const account = this.#account;
Expand Down Expand Up @@ -197,7 +197,6 @@ export class GhostWallet implements Wallet {
const outputs: SolanaSignAndSendTransactionOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { transaction, account, chain, options } = inputs[0]!;
const { minContextSlot, preflightCommitment, skipPreflight, maxRetries } = options || {};
if (account !== this.#account) throw new Error('invalid account');
Expand Down Expand Up @@ -229,7 +228,6 @@ export class GhostWallet implements Wallet {
const outputs: SolanaSignTransactionOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { transaction, account, chain } = inputs[0]!;
if (account !== this.#account) throw new Error('invalid account');
if (chain && !isSolanaChain(chain)) throw new Error('invalid chain');
Expand Down Expand Up @@ -289,7 +287,6 @@ export class GhostWallet implements Wallet {
const outputs: SolanaSignMessageOutput[] = [];

if (inputs.length === 1) {
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
const { message, account } = inputs[0]!;
if (account !== this.#account) throw new Error('invalid account');

Expand Down

0 comments on commit dbb6a98

Please sign in to comment.