remove unused components
This commit is contained in:
1 parent
0a93f8a5c7
commit
45351034ea
2 files changed
-109
No files matched your search
@@ -1,54 +0,0 @@
|
|||||||
import { Stack } from "@mui/material";
|
|
||||||
import { useMemo } from "react";
|
|
||||||
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
|
|
||||||
import { WalletAdapterNetwork } from "@solana/wallet-adapter-base";
|
|
||||||
import {
|
|
||||||
UnsafeBurnerWalletAdapter,
|
|
||||||
PhantomWalletAdapter,
|
|
||||||
} from "@solana/wallet-adapter-wallets";
|
|
||||||
|
|
||||||
import {
|
|
||||||
WalletModalProvider,
|
|
||||||
WalletMultiButton,
|
|
||||||
WalletDisconnectButton,
|
|
||||||
} from "@solana/wallet-adapter-react-ui";
|
|
||||||
import { clusterApiUrl } from "@solana/web3.js";
|
|
||||||
|
|
||||||
// Default styles that can be overridden by your app
|
|
||||||
import "@solana/wallet-adapter-react-ui/styles.css";
|
|
||||||
|
|
||||||
export const Wallet = () => {
|
|
||||||
// The network can be set to 'devnet', 'testnet', or 'mainnet-beta'.
|
|
||||||
const network = WalletAdapterNetwork.Devnet;
|
|
||||||
|
|
||||||
// You can also provide a custom RPC endpoint.
|
|
||||||
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
|
|
||||||
|
|
||||||
const wallets = useMemo(
|
|
||||||
() => [new UnsafeBurnerWalletAdapter(), new PhantomWalletAdapter()],
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
[network]
|
|
||||||
);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ConnectionProvider endpoint={endpoint}>
|
|
||||||
<WalletProvider
|
|
||||||
wallets={wallets}
|
|
||||||
autoConnect
|
|
||||||
>
|
|
||||||
<WalletModalProvider>
|
|
||||||
<Stack
|
|
||||||
direction="row"
|
|
||||||
spacing={2}
|
|
||||||
>
|
|
||||||
<WalletMultiButton />
|
|
||||||
<WalletDisconnectButton />
|
|
||||||
</Stack>
|
|
||||||
{/* Your app's components go here, nested within the context providers. */}
|
|
||||||
</WalletModalProvider>
|
|
||||||
</WalletProvider>
|
|
||||||
</ConnectionProvider>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Wallet;
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
import {
|
|
||||||
WalletNotConnectedError,
|
|
||||||
WalletAdapterNetwork,
|
|
||||||
} from "@solana/wallet-adapter-base";
|
|
||||||
|
|
||||||
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
|
|
||||||
import { Keypair, SystemProgram, Transaction } from "@solana/web3.js";
|
|
||||||
import { ConnectionProvider, WalletProvider } from "@solana/wallet-adapter-react";
|
|
||||||
import { clusterApiUrl } from "@solana/web3.js";
|
|
||||||
import { useMemo, useEffect } from "react";
|
|
||||||
import {
|
|
||||||
UnsafeBurnerWalletAdapter,
|
|
||||||
PhantomWalletAdapter,
|
|
||||||
} from "@solana/wallet-adapter-wallets";
|
|
||||||
const Wallet = () => {
|
|
||||||
const { connection } = useConnection();
|
|
||||||
const { publicKey, sendTransaction } = useWallet();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
try {
|
|
||||||
if (!publicKey) return;
|
|
||||||
const getBalance = async () => {
|
|
||||||
const balance = await connection.getBalance(publicKey);
|
|
||||||
console.log({ balance });
|
|
||||||
};
|
|
||||||
getBalance();
|
|
||||||
} catch (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
}, [connection, publicKey]);
|
|
||||||
return <div>Wallet</div>;
|
|
||||||
};
|
|
||||||
|
|
||||||
const Provider = () => {
|
|
||||||
const network = WalletAdapterNetwork.Devnet;
|
|
||||||
const wallets = useMemo(
|
|
||||||
() => [new UnsafeBurnerWalletAdapter(), new PhantomWalletAdapter()],
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
[network]
|
|
||||||
);
|
|
||||||
const endpoint = useMemo(() => clusterApiUrl(network), [network]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ConnectionProvider endpoint={endpoint}>
|
|
||||||
<WalletProvider
|
|
||||||
wallets={wallets}
|
|
||||||
autoConnect
|
|
||||||
>
|
|
||||||
<Wallet />
|
|
||||||
</WalletProvider>
|
|
||||||
</ConnectionProvider>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default Provider;
|
|
||||||
Reference in new issue
Block a user