pub(super) mod account_collection;
pub(super) mod account_management;
use crate::sema::solana_accounts::BuiltinAccounts;
use base58::FromBase58;
use num_bigint::{BigInt, Sign};
use num_traits::Zero;
use once_cell::sync::Lazy;
use std::collections::HashMap;
static AVAILABLE_ACCOUNTS: Lazy<HashMap<BigInt, BuiltinAccounts>> = Lazy::new(|| {
HashMap::from([
(BigInt::zero(), BuiltinAccounts::SystemAccount),
(
BigInt::from_bytes_be(
Sign::Plus,
&"ATokenGPvbdGVxr1b2hvZbsiqW5xWH25efTNsLJA8knL"
.from_base58()
.unwrap(),
),
BuiltinAccounts::AssociatedTokenProgram,
),
(
BigInt::from_bytes_be(
Sign::Plus,
&"SysvarRent111111111111111111111111111111111"
.from_base58()
.unwrap(),
),
BuiltinAccounts::RentAccount,
),
(
BigInt::from_bytes_be(
Sign::Plus,
&"TokenkegQfeZyiNwAJbNbGKPFXCWuBvf9Ss623VQ5DA"
.from_base58()
.unwrap(),
),
BuiltinAccounts::TokenProgramId,
),
(
BigInt::from_bytes_be(
Sign::Plus,
&"SysvarC1ock11111111111111111111111111111111"
.from_base58()
.unwrap(),
),
BuiltinAccounts::ClockAccount,
),
])
});
fn account_from_number(num: &BigInt) -> Option<String> {
AVAILABLE_ACCOUNTS.get(num).map(|e| e.to_string())
}