solana_svm_transaction/svm_message/
sanitized_message.rs1use {
2 crate::{
3 instruction::SVMInstruction, message_address_table_lookup::SVMMessageAddressTableLookup,
4 svm_message::SVMMessage,
5 },
6 solana_sdk::{
7 hash::Hash,
8 message::{AccountKeys, SanitizedMessage},
9 pubkey::Pubkey,
10 },
11};
12
13impl SVMMessage for SanitizedMessage {
15 fn num_total_signatures(&self) -> u64 {
16 SanitizedMessage::num_total_signatures(self)
17 }
18
19 fn num_write_locks(&self) -> u64 {
20 SanitizedMessage::num_write_locks(self)
21 }
22
23 fn recent_blockhash(&self) -> &Hash {
24 SanitizedMessage::recent_blockhash(self)
25 }
26
27 fn num_instructions(&self) -> usize {
28 SanitizedMessage::instructions(self).len()
29 }
30
31 fn instructions_iter(&self) -> impl Iterator<Item = SVMInstruction> {
32 SanitizedMessage::instructions(self)
33 .iter()
34 .map(SVMInstruction::from)
35 }
36
37 fn program_instructions_iter(&self) -> impl Iterator<Item = (&Pubkey, SVMInstruction)> + Clone {
38 SanitizedMessage::program_instructions_iter(self)
39 .map(|(pubkey, ix)| (pubkey, SVMInstruction::from(ix)))
40 }
41
42 fn account_keys(&self) -> AccountKeys {
43 SanitizedMessage::account_keys(self)
44 }
45
46 fn fee_payer(&self) -> &Pubkey {
47 SanitizedMessage::fee_payer(self)
48 }
49
50 fn is_writable(&self, index: usize) -> bool {
51 SanitizedMessage::is_writable(self, index)
52 }
53
54 fn is_signer(&self, index: usize) -> bool {
55 SanitizedMessage::is_signer(self, index)
56 }
57
58 fn is_invoked(&self, key_index: usize) -> bool {
59 SanitizedMessage::is_invoked(self, key_index)
60 }
61
62 fn num_lookup_tables(&self) -> usize {
63 SanitizedMessage::message_address_table_lookups(self).len()
64 }
65
66 fn message_address_table_lookups(&self) -> impl Iterator<Item = SVMMessageAddressTableLookup> {
67 SanitizedMessage::message_address_table_lookups(self)
68 .iter()
69 .map(SVMMessageAddressTableLookup::from)
70 }
71}