I'm trying to get list of owned tokens from a wallet address. In the solana web3 documentation, there is a property of Connecton
called getTokenAccountsByOwner
, but I'm getting type error: mintAddress.toBase58 is not a function
.
Here's the code I use:
const solanaWeb3 = require('@solana/web3.js');
const { Connection, programs } = require('@metaplex/js');
const axios = require('axios');
..
console.log(solanaConnection.getTokenLargestAccounts('2MTPtFo78QzWJaK9PGk9pZm9dFrVVSBGCRWPpND25GAe'));