Files
darkfi/src
parazyd c6e4e3f3b4 service/sol: Implement function for fetching SPL Token balance.
It can be used as follows:

fn main() {
    let main_pk = Pubkey::from_str("mainWallet").unwrap();
    let mint_pk = Pubkey::from_str("usdcMint").unwrap();
    let (tokn_pk, _) = get_associated_token_account(&main_pk, &mint_pk);
    let (bal, dec) = get_account_token_balance(
        "https://api.mainnet-beta.solana.com".to_string(),
        &tokn_pk,
        &mint_pk
    ).unwrap();

    println!("Balance:  {}", bal);
    println!("Decimals: {}", dec);
    println!("UI representation: {}", bal / u64::pow(10, dec as u32));
}
2021-09-28 15:46:14 +02:00
..
2021-09-23 17:44:07 +02:00
2021-09-23 17:44:07 +02:00
2021-09-23 17:44:07 +02:00
2021-09-23 17:44:07 +02:00
2021-07-16 11:25:56 +02:00
2021-09-23 17:44:07 +02:00
2021-05-21 13:44:06 +02:00
2021-02-23 15:27:14 +01:00
2021-09-25 20:34:47 +02:00
2021-09-23 22:52:28 +02:00
2021-09-23 17:44:07 +02:00
2021-09-23 17:44:07 +02:00