Closed bytesmix closed 1 year ago
This is the base line requirements to use metaplex with the wallet adapter instead of the keypair. The if statement at the bottom is so that metaplex can establish a connection even if the wallet hasn't yet connected. Without that, it will throw an error when there isn't a connected wallet. This is NOT an end - end solution. It's merely demonstrating the minimum required imports. You will likely need to import other things in addition what I have listed below.
import { Connection } from "@solana/web3.js";
import { Metaplex, walletAdapterIdentity, guestIdentity } from "@metaplex-foundation/js";
import { useWallet } from "solana-wallets-vue";
const wallet = useWallet();
const connection = new Connection("endpoint url here");
const metaplex = Metaplex.make(connection).use(
wallet?.wallet?.value?.adapter ? walletAdapterIdentity(wallet.wallet.value.adapter) : guestIdentity()
);
Hi there 👋 There's an example available that illustrates how to use wallet adapters with the JS SDK.
https://github.com/metaplex-foundation/js-examples/tree/main/connect-wallet
I need to mint using panthom wallet not keypair directly. How can i handle this? please let me know.