1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
use borsh::{BorshDeserialize, BorshSerialize};
use solana_client::rpc_client::RpcClient;
use solana_program::pubkey::Pubkey;
use tabled::Tabled;
#[derive(BorshDeserialize, BorshSerialize, Tabled)]
pub struct MintWrapper {
pub base: Pubkey,
pub bump: u8,
pub hard_cap: u64,
pub admin: Pubkey,
pub pending_admin: Pubkey,
pub token_mint: Pubkey,
pub num_minters: u64,
pub total_allowance: u64,
pub total_minted: u64,
}
impl MintWrapper {
pub fn get_info(rpc_client: &RpcClient, pubkey: &Pubkey) -> Self {
let data_slice = &rpc_client.get_account_data(pubkey).unwrap()[8..];
MintWrapper::try_from_slice(data_slice).unwrap()
}
pub fn new() -> Self {
Self {
base: Default::default(),
bump: 0,
hard_cap: 0,
admin: Default::default(),
pending_admin: Default::default(),
token_mint: Default::default(),
num_minters: 0,
total_allowance: 0,
total_minted: 0
}
}
}
#[derive(BorshDeserialize, BorshSerialize, Tabled)]
pub struct Minter {
pub mint_wrapper: Pubkey,
pub minter_authority: Pubkey,
pub bump: u8,
pub index: u64,
pub allowance: u64,
pub total_minted: u64,
}
impl Minter {
pub fn get_info(rpc_client: &RpcClient, pubkey: &Pubkey) -> Self {
let data_slice = &rpc_client.get_account_data(pubkey).unwrap()[8..];
Minter::try_from_slice(data_slice).unwrap()
}
pub fn new() -> Self {
Self {
mint_wrapper: Default::default(),
minter_authority: Default::default(),
bump: 0,
index: 0,
allowance: 0,
total_minted: 0
}
}
}