【发布时间】:2022-08-03 02:30:51
【问题描述】:
我正在使用 Solana 构建 Web3 应用程序。
我正在使用@solana/wallet-adapter 进行钱包连接
代码:
const Wallet = ({ children }) => {
// 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]);
// @solana/wallet-adapter-wallets includes all the adapters but supports tree shaking and lazy loading --
// Only the wallets you configure here will be compiled into your application and only the dependencies
// of wallets that your users connect to will be loaded.
const wallets = useMemo(
() => [
new PhantomWalletAdapter(),
new SlopeWalletAdapter(),
new SolflareWalletAdapter(),
new TorusWalletAdapter(),
new LedgerWalletAdapter(),
new SolletWalletAdapter({ network }),
new SolletExtensionWalletAdapter({ network }),
],[network]);
return (
<ConnectionProvider endpoint={endpoint}>
<WalletProvider wallets={wallets} autoConnect>
<WalletModalProvider>
<WalletMultiButton />
<WalletDisconnectButton />
{children}
</WalletModalProvider>
</WalletProvider>
</ConnectionProvider>
);
};
它是一个基本组件。与@solana/wallet-adapter docs 中介绍的相同
问题:
在连接了一些钱包管理器(比如说 Phantom)之后,我得到了我需要的所有信息。但更换钱包后 - 我在我的应用程序中看不到任何更新。
问题是
我该如何处理?
标签: websocket solana solana-web3js