2025-04-23 15:23:56 +02:00
|
|
|
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>,
|
|
|
|
|
}
|
|
|
|
|
|
2025-04-24 14:04:56 +02:00
|
|
|
#[derive( Debug)]
|
2025-04-23 15:23:56 +02:00
|
|
|
pub struct Transaction {
|
|
|
|
|
pub(crate) signature: String,
|
|
|
|
|
pub(crate) slot: Slot,
|
|
|
|
|
pub(crate) block_time: Option<i64>,
|
|
|
|
|
pub(crate) status: Option<TransactionError>,
|
2025-04-24 14:04:56 +02:00
|
|
|
pub(crate) account_keys: AccountKeys,
|
2025-04-23 15:23:56 +02:00
|
|
|
}
|
|
|
|
|
|
2025-04-24 14:04:56 +02:00
|
|
|
#[derive(Debug)]
|
2025-04-23 15:23:56 +02:00
|
|
|
pub struct AccountKeys {
|
|
|
|
|
pub(crate) payer: Pubkey,
|
|
|
|
|
pub(crate) mint_account: Pubkey,
|
|
|
|
|
pub(crate) rent_account: Pubkey,
|
|
|
|
|
pub(crate) mint_authority: Pubkey,
|
2025-04-24 14:04:56 +02:00
|
|
|
pub(crate) token_program: Pubkey,
|
2025-04-23 15:23:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[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,
|
2025-04-24 14:04:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Deserialize)]
|
|
|
|
|
pub struct TokenSocials {
|
|
|
|
|
pub(crate) createdOn: String,
|
|
|
|
|
pub(crate) description: String,
|
|
|
|
|
pub(crate) image: String,
|
|
|
|
|
pub(crate) name: String,
|
|
|
|
|
pub(crate) symbol: String,
|
|
|
|
|
pub(crate) twitter: String,
|
|
|
|
|
pub(crate) website: String
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Default for TokenSocials {
|
|
|
|
|
fn default() -> Self {
|
|
|
|
|
Self {
|
|
|
|
|
createdOn: "".to_string(),
|
|
|
|
|
description: "".to_string(),
|
|
|
|
|
image: "".to_string(),
|
|
|
|
|
name: "".to_string(),
|
|
|
|
|
symbol: "".to_string(),
|
|
|
|
|
twitter: "".to_string(),
|
|
|
|
|
website: "".to_string(),
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2025-04-23 15:23:56 +02:00
|
|
|
|