0

When I run connection.getAccountInfo(watermelonMint.key); I get a null object, although it should return an AccountInfoObject. Any idea why this is the case? When I look for the address associated with this mint on solana explorer, I get normal statistics (https://explorer.solana.com/address/7vLEZP5JHhKVg3HEGSWcFNaxAKg7L633uMT7ePqmn98V?cluster=devnet)

console.log("Watermelon mint is: ");
console.log(watermelonMint);

returns

Mint {conn: Connection, key: PublicKey}
conn: Connection {_commitment: undefined, _confirmTransactionInitialTimeout: undefined, _rpcEndpoint: 'https://api.devnet.solana.com', _rpcWsEndpoint: 'wss://api.devnet.solana.com/', _rpcClient: ClientBrowser, …}
key: PublicKey
_bn: BN {negative: 0, words: Array(11), length: 10, red: null}
[[Prototype]]: Struct
[[Prototype]]: Object

any idea what could cause this?


Update 1:

basically, Token.getMintInfo(); keeps failing

const token = new Token(conn, mint, TOKEN_PROGRAM_ID, {} as any)
  console.log("Getting token: ", token);
  let out: Promise<MintInfo> = token.getMintInfo();
  console.log("Out is: ", out);
TylerH
  • 20,799
  • 66
  • 75
  • 101
DaveTheAl
  • 1,995
  • 4
  • 35
  • 65

1 Answers1

2

Most likely, mint in "Update 1" is incorrect, or that your connection is improperly defined somewhere. Can you double-check that mint is equal to PublicKey("7vLEZP5JHhKVg3HEGSWcFNaxAKg7L633uMT7ePqmn98V")?

Also, can you make sure to await the response from token.getMintInfo()?

Jon C
  • 7,019
  • 10
  • 17
  • I had mixed up devnet and testnet by having hardcoded strings instead of environment variables. thank you so much! – DaveTheAl Nov 13 '21 at 17:49