clone-solana-rpc 2.2.12

Solana RPC
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use {
    clone_solana_inline_spl::{token::GenericTokenAccount, token_2022::Account},
    clone_solana_rpc_client_api::filter::RpcFilterType,
    clone_solana_sdk::account::{AccountSharedData, ReadableAccount},
};

pub fn filter_allows(filter: &RpcFilterType, account: &AccountSharedData) -> bool {
    match filter {
        RpcFilterType::DataSize(size) => account.data().len() as u64 == *size,
        RpcFilterType::Memcmp(compare) => compare.bytes_match(account.data()),
        RpcFilterType::TokenAccountState => Account::valid_account_data(account.data()),
    }
}