8
8
solana_client:: {
9
9
nonblocking:: pubsub_client:: PubsubClient ,
10
10
pubsub_client:: PubsubClientError ,
11
- rpc_config:: {
12
- RpcAccountInfoConfig ,
13
- RpcProgramAccountsConfig ,
14
- } ,
15
- rpc_filter:: {
16
- Memcmp ,
17
- RpcFilterType ,
18
- } ,
11
+ rpc_config:: { RpcAccountInfoConfig , RpcProgramAccountsConfig } ,
12
+ rpc_filter:: { Memcmp , RpcFilterType } ,
19
13
} ,
20
14
solana_sdk:: pubkey:: Pubkey ,
21
- std:: {
22
- fs,
23
- str:: FromStr ,
24
- time:: Duration ,
25
- } ,
15
+ std:: { fs, str:: FromStr , time:: Duration } ,
26
16
tokio:: time:: sleep,
27
17
tokio_stream:: StreamExt ,
28
- wormhole_sdk:: {
29
- vaa:: Body ,
30
- Address ,
31
- Chain ,
32
- } ,
18
+ wormhole_sdk:: { vaa:: Body , Address , Chain } ,
33
19
} ;
34
20
35
21
mod config;
36
22
mod posted_message;
37
23
mod signed_body;
38
24
39
25
struct ListenerConfig {
40
- ws_url : String ,
41
- secret_key : SecretKey ,
42
- wormhole_pid : Pubkey ,
26
+ ws_url : String ,
27
+ secret_key : SecretKey ,
28
+ wormhole_pid : Pubkey ,
43
29
accumulator_address : Pubkey ,
44
30
}
45
31
@@ -58,20 +44,18 @@ async fn run_listener(config: ListenerConfig) -> Result<(), PubsubClientError> {
58
44
. program_subscribe (
59
45
& config. wormhole_pid ,
60
46
Some ( RpcProgramAccountsConfig {
61
- filters : Some ( vec ! [ RpcFilterType :: Memcmp ( Memcmp :: new(
47
+ filters : Some ( vec ! [ RpcFilterType :: Memcmp ( Memcmp :: new(
62
48
0 ,
63
49
solana_client:: rpc_filter:: MemcmpEncodedBytes :: Bytes ( b"msu" . to_vec( ) ) ,
64
50
) ) ] ) ,
65
51
account_config : RpcAccountInfoConfig {
66
- encoding : Some ( UiAccountEncoding :: Base64 ) ,
67
- data_slice : None ,
68
- commitment : Some (
69
- solana_sdk:: commitment_config:: CommitmentConfig :: confirmed ( ) ,
70
- ) ,
52
+ encoding : Some ( UiAccountEncoding :: Base64 ) ,
53
+ data_slice : None ,
54
+ commitment : Some ( solana_sdk:: commitment_config:: CommitmentConfig :: confirmed ( ) ) ,
71
55
min_context_slot : None ,
72
56
} ,
73
- with_context : None ,
74
- sort_results : None ,
57
+ with_context : None ,
58
+ sort_results : None ,
75
59
} ) ,
76
60
)
77
61
. await ?;
@@ -109,13 +93,13 @@ async fn run_listener(config: ListenerConfig) -> Result<(), PubsubClientError> {
109
93
}
110
94
111
95
let body = Body {
112
- timestamp : unreliable_data. submission_time ,
113
- nonce : unreliable_data. nonce ,
114
- emitter_chain : unreliable_data. emitter_chain . into ( ) ,
115
- emitter_address : Address ( unreliable_data. emitter_address ) ,
116
- sequence : unreliable_data. sequence ,
96
+ timestamp : unreliable_data. submission_time ,
97
+ nonce : unreliable_data. nonce ,
98
+ emitter_chain : unreliable_data. emitter_chain . into ( ) ,
99
+ emitter_address : Address ( unreliable_data. emitter_address ) ,
100
+ sequence : unreliable_data. sequence ,
117
101
consistency_level : unreliable_data. consistency_level ,
118
- payload : unreliable_data. payload . clone ( ) ,
102
+ payload : unreliable_data. payload . clone ( ) ,
119
103
} ;
120
104
121
105
match SignedBody :: try_new ( body, config. secret_key ) {
0 commit comments