web3 - Solana Web3.js:获取 Mint 帐户的“null”,尽管它应该返回一个“AccountInfo”对象
问题描述
当我运行时,connection.getAccountInfo(watermelonMint.key);
我得到一个null
对象,尽管它应该返回一个AccountInfoObject
. 知道为什么会这样吗?当我在 solana explorer 上查找与此铸币厂相关的地址时,我得到了正常的统计数据(https://explorer.solana.com/address/7vLEZP5JHhKVg3HEGSWcFNaxAKg7L633uMT7ePqmn98V?cluster=devnet)
console.log("Watermelon mint is: ");
console.log(watermelonMint);
返回
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
知道是什么原因造成的吗?
更新1:
基本上,Token.getMintInfo();
一直失败
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);
解决方案
最有可能的是,mint
在“更新 1”中不正确,或者您的连接在某处未正确定义。您可以仔细检查mint
是否等于PublicKey("7vLEZP5JHhKVg3HEGSWcFNaxAKg7L633uMT7ePqmn98V")
?
另外,你能确定await
来自的回应token.getMintInfo()
吗?
推荐阅读
- php - Laravel 邮件程序缓慢(1-2 秒)性能
- kotlin - MockK:为泛型函数中的不同类型参数返回不同的结果
- android - 建立从 Android 到 MySQL 的连接
- android - 如何在并行 android 中运行多个 kotlin couroutines?
- wordpress - 404 图像的 WordPress 后备
- php - 无法从 cron 作业运行 laravel 计划在 cpanel 中不起作用
- redis - Redis,试图找出存储数据的最佳方式,以便分页显示
- mysql - 如何重新排列结果中的列?MySQL 工作台
- php - 未找到列:1054 Champ '0' inconnu dans field list
- python - 如何用pytorch实现Softmax回归?