Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions packages/wallet-adapter/base/src/wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import {
type StandardEventsNames,
type StandardEventsOnMethod,
} from '@wallet-standard/features';
import { arraysEqual, bytesEqual, ReadonlyWalletAccount } from '@wallet-standard/wallet';
import { arraysEqual, bytesEqual, ReadonlyWalletAccount, walletAccountsEqual } from '@wallet-standard/wallet';
import bs58 from 'bs58';

/** TODO: docs */
Expand Down Expand Up @@ -162,7 +162,12 @@ export class SolanaWalletAdapterWallet implements Wallet {
};
}

return { ...features, ...signTransactionFeature, ...signMessageFeature };
return {
...features,
...signTransactionFeature,
...signMessageFeature,
...signInFeature,
};
}

get accounts() {
Expand Down Expand Up @@ -272,7 +277,7 @@ export class SolanaWalletAdapterWallet implements Wallet {
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 (!walletAccountsEqual(input.account, this.#account)) throw new Error('invalid account');
if (!isSolanaChain(input.chain)) throw new Error('invalid chain');
const transaction = this.#deserializeTransaction(input.transaction);
const { commitment, preflightCommitment, skipPreflight, maxRetries, minContextSlot } = input.options || {};
Expand Down Expand Up @@ -321,7 +326,7 @@ export class SolanaWalletAdapterWallet implements Wallet {
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 (!walletAccountsEqual(input.account, this.#account)) throw new Error('invalid account');
if (input.chain && !isSolanaChain(input.chain)) throw new Error('invalid chain');
const transaction = this.#deserializeTransaction(input.transaction);

Expand All @@ -339,7 +344,7 @@ export class SolanaWalletAdapterWallet implements Wallet {
outputs.push({ signedTransaction: serializedTransaction });
} else if (inputs.length > 1) {
for (const input of inputs) {
if (input.account !== this.#account) throw new Error('invalid account');
if (!walletAccountsEqual(input.account, this.#account)) throw new Error('invalid account');
if (input.chain && !isSolanaChain(input.chain)) throw new Error('invalid chain');
}
const transactions = inputs.map(({ transaction }) => this.#deserializeTransaction(transaction));
Expand Down Expand Up @@ -372,7 +377,7 @@ export class SolanaWalletAdapterWallet implements Wallet {
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 (!walletAccountsEqual(input.account, this.#account)) throw new Error('invalid account');

const signature = await this.#adapter.signMessage(input.message);

Expand Down