Skip to content

Errors when calling Nft.TryGetNftData() method #97

Closed Answered by GabrielePicco
BlackDemonZyT asked this question in Q&A
Discussion options

You must be logged in to vote

You are mixing the use of WalletBase and Web3. Web3 is a wrapper that internally have an instance of WalletBase, so either you define your own managing logic, or you attach Web3.cs to a gameObject and use the login function on it (e.g.: LoginWalletAdapter). I suggest the second option.

Otherwise, your code could be:

async void GetNftFromWallet()
    {
        var options = new SolanaWalletAdapterWebGLOptions();
        WalletBase wallet = new SolanaWalletAdapterWebGL(options, RpcCluster.MainNet, "https://api.metaplex.solana.com/", null, true);
        await wallet.Login();

        // Get Tokens of wallet
        var tokens = await wallet.GetTokenAccounts(Commitment.Confirmed);

        /…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by GabrielePicco
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #94 on May 06, 2023 11:46.