72 lines
1.8 KiB
Rust
72 lines
1.8 KiB
Rust
|
|
use borsh_derive::BorshDeserialize;
|
||
|
|
use serde::Deserialize;
|
||
|
|
use solana_program::clock::Slot;
|
||
|
|
use solana_program::program_option::COption;
|
||
|
|
use solana_program::pubkey::Pubkey;
|
||
|
|
use solana_sdk::transaction::TransactionError;
|
||
|
|
|
||
|
|
#[derive(BorshDeserialize, Debug, Deserialize)]
|
||
|
|
pub struct TokenInfo {
|
||
|
|
pub(crate) mint_address: String,
|
||
|
|
pub(crate) decimals: u8,
|
||
|
|
pub(crate) mint_authority: bool,
|
||
|
|
pub(crate) freeze_authority: bool,
|
||
|
|
pub(crate) supply: u64,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(BorshDeserialize, Debug, Deserialize)]
|
||
|
|
pub struct TokenAmount {
|
||
|
|
amount: String,
|
||
|
|
decimals: u8,
|
||
|
|
pub(crate) uiAmount: Option<f64>,
|
||
|
|
uiAmountString: String,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(BorshDeserialize, Debug, Deserialize)]
|
||
|
|
pub struct ParsedAccount {
|
||
|
|
pub(crate) info: TokenInfoWithAmount,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(BorshDeserialize, Debug, Deserialize)]
|
||
|
|
pub struct TokenInfoWithAmount {
|
||
|
|
isNative: bool,
|
||
|
|
mint: String,
|
||
|
|
owner: String,
|
||
|
|
state: String,
|
||
|
|
pub(crate) tokenAmount: TokenAmount,
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(BorshDeserialize, Debug, Deserialize)]
|
||
|
|
pub struct UiParsedTokenAccount {
|
||
|
|
program: String,
|
||
|
|
parsed: ParsedAccount,
|
||
|
|
space: Option<u64>,
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct Transaction {
|
||
|
|
pub(crate) signature: String,
|
||
|
|
pub(crate) slot: Slot,
|
||
|
|
pub(crate) block_time: Option<i64>,
|
||
|
|
pub(crate) status: Option<TransactionError>,
|
||
|
|
pub(crate) account_keys: AccountKeys
|
||
|
|
}
|
||
|
|
|
||
|
|
pub struct AccountKeys {
|
||
|
|
pub(crate) payer: Pubkey,
|
||
|
|
pub(crate) mint_account: Pubkey,
|
||
|
|
pub(crate) rent_account: Pubkey,
|
||
|
|
pub(crate) mint_authority: Pubkey,
|
||
|
|
pub(crate) token_program: Pubkey
|
||
|
|
}
|
||
|
|
|
||
|
|
#[derive(Debug, Clone)]
|
||
|
|
pub struct TokenData {
|
||
|
|
pub(crate) name: String,
|
||
|
|
pub(crate) symbol: String,
|
||
|
|
pub(crate) uri: String,
|
||
|
|
pub(crate) supply: u64,
|
||
|
|
pub(crate) dev_balance: f64,
|
||
|
|
pub(crate) mint_authority: bool,
|
||
|
|
pub(crate) freeze_authority: bool,
|
||
|
|
|
||
|
|
}
|