Skip to content

Commit

Permalink
feat: add solflare metamask snap adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
gin-lsl committed May 20, 2024
1 parent 7b38bd7 commit a7207da
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
12 changes: 11 additions & 1 deletion packages/solana/src/wallets/built-in.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import {
metadata_Trust,
metadata_WalletConnect,
} from '@ant-design/web3-assets';
import { CoinbaseWalletAdapter, TrustWalletAdapter } from '@solana/wallet-adapter-wallets';
import {
CoinbaseWalletAdapter,
SolflareWalletAdapter,
TrustWalletAdapter,
} from '@solana/wallet-adapter-wallets';

import { WalletConnectWalletAdapter } from '../wallet-connect-adapter';
import { StandardWalletFactory, WalletConnectWalletFactory, WalletFactory } from './factory';
Expand All @@ -17,10 +21,16 @@ export const CoinbaseWallet = WalletFactory(
metadata_CoinbaseWallet,
);
export const TrustWallet = WalletFactory(() => new TrustWalletAdapter(), metadata_Trust);
/** Solflare with MetaMask Snap */
export const SolflareSnapWallet = WalletFactory(
() => new SolflareWalletAdapter(),
metadata_Solflare,
);

export const PhantomWallet = StandardWalletFactory(metadata_Phantom);
export const OKXWallet = StandardWalletFactory(metadata_OkxWallet);
export const BackpackWallet = StandardWalletFactory(metadata_Backpack);
/** Solflare Wallet (Standard Wallet) */
export const SolflareWallet = StandardWalletFactory(metadata_Solflare);

export const WalletConnectWallet = WalletConnectWalletFactory(
Expand Down
3 changes: 2 additions & 1 deletion packages/web3/src/solana/demos/recommend.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
OKXWallet,
PhantomWallet,
SolanaWeb3ConfigProvider,
SolflareSnapWallet,
WalletConnectWallet,
} from '@ant-design/web3-solana';

Expand All @@ -12,7 +13,7 @@ const App: React.FC = () => {
<SolanaWeb3ConfigProvider
autoAddRegisteredWallets
balance
wallets={[PhantomWallet(), OKXWallet(), WalletConnectWallet()]}
wallets={[PhantomWallet(), OKXWallet(), WalletConnectWallet(), SolflareSnapWallet()]}
walletConnect={{ projectId: YOUR_WALLET_CONNECT_PROJECT_ID }}
>
<Connector modalProps={{ mode: 'simple', group: false }}>
Expand Down

0 comments on commit a7207da

Please sign in to comment.