简体   繁体   English

SOLANA - 如何检查链上的薄荷供应?

[英]SOLANA - How to check for mint supply on chain?

folks, how do I check for the supply of a mint account on-chain?伙计们,我如何检查链上的造币厂帐户的供应情况? I have no idea on how to do this.我不知道该怎么做。 I've tried using:我试过使用:

let mint = Mint::unpack_unchecked(accounts.mint.data).unwrap();

Then I get this error:然后我得到这个错误:

 expected reference `&[u8]`
      found struct `Rc<RefCell<&mut [u8]>>`

Also, in my function, if I try to get accounts.mint.data to &[u8] format by doing this:此外,在我的 function 中,如果我尝试通过以下方式将accounts.mint.data转换为&[u8]格式:

let data = accounts.mint.data.borrow().as_ref();

I get this non-sense error:我得到这个无意义的错误:

consider using a `let` binding to create a longer lived valuerustcE0716
mod.rs(98, 64): temporary value is freed at the end of this statement
mod.rs(99, 51): borrow later used here

Nevermind:没关系:

let mint = Mint::unpack_unchecked(&accounts.mint.data.borrow()).unwrap();

to get the supply, just access mint.supply要获得供应,只需访问mint.supply

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM