Created
April 9, 2022 03:11
-
-
Save alecchendev/9479d963bb12d9898b3a5ae2e9fe78be to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import Pack trait | |
use solana_program::{ | |
program_pack::Pack, | |
}; | |
// import type | |
use spl_token::{ | |
state::Mint, | |
} | |
// code inside of `process_instruction` | |
// mint_account is of type `AccountInfo` retrieved previously | |
let mint = Mint::unpack_from_slice(&mint_account.try_borrow_data()?)?; | |
msg!("mint decimals: {}", mint.decimals); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment