-
Notifications
You must be signed in to change notification settings - Fork 52
/
Copy pathadmin.rs
75 lines (62 loc) · 2.21 KB
/
admin.rs
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
use anchor_lang::{prelude::Pubkey, system_program::System, Id, InstructionData, ToAccountMetas};
use example_native_token_transfers::instructions::SetPeerArgs;
use solana_sdk::instruction::Instruction;
use crate::sdk::accounts::NTT;
pub struct SetPeer {
pub payer: Pubkey,
pub owner: Pubkey,
pub mint: Pubkey,
}
pub fn set_peer(ntt: &NTT, accounts: SetPeer, args: SetPeerArgs) -> Instruction {
let chain_id = args.chain_id.id;
let data = example_native_token_transfers::instruction::SetPeer { args };
let accounts = example_native_token_transfers::accounts::SetPeer {
config: ntt.config(),
owner: accounts.owner,
payer: accounts.payer,
peer: ntt.peer(chain_id),
inbox_rate_limit: ntt.inbox_rate_limit(chain_id),
system_program: System::id(),
};
Instruction {
program_id: example_native_token_transfers::ID,
accounts: accounts.to_account_metas(None),
data: data.data(),
}
}
pub struct SetPaused {
pub owner: Pubkey,
}
pub fn set_paused(ntt: &NTT, accounts: SetPaused, pause: bool) -> Instruction {
let data = example_native_token_transfers::instruction::SetPaused { pause };
let accounts = example_native_token_transfers::accounts::SetPaused {
owner: accounts.owner,
config: ntt.config(),
};
Instruction {
program_id: example_native_token_transfers::ID,
accounts: accounts.to_account_metas(None),
data: data.data(),
}
}
pub struct RegisterTransceiver {
pub payer: Pubkey,
pub owner: Pubkey,
pub transceiver: Pubkey,
}
pub fn register_transceiver(ntt: &NTT, accounts: RegisterTransceiver) -> Instruction {
let data = example_native_token_transfers::instruction::RegisterTransceiver {};
let accounts = example_native_token_transfers::accounts::RegisterTransceiver {
config: ntt.config(),
owner: accounts.owner,
payer: accounts.payer,
transceiver: accounts.transceiver,
registered_transceiver: ntt.registered_transceiver(&accounts.transceiver),
system_program: System::id(),
};
Instruction {
program_id: ntt.program,
accounts: accounts.to_account_metas(None),
data: data.data(),
}
}