@@ -97,6 +97,7 @@ async fn main() -> Result<(), ErrBox> {
97
97
pyth_owner_addr,
98
98
wh_prog,
99
99
is_active,
100
+ ops_owner_addr,
100
101
} => {
101
102
let tx = gen_init_tx (
102
103
payer,
@@ -107,14 +108,15 @@ async fn main() -> Result<(), ErrBox> {
107
108
pyth_owner : pyth_owner_addr,
108
109
is_active : is_active. unwrap_or ( true ) ,
109
110
max_batch_size : P2W_MAX_BATCH_SIZE ,
111
+ ops_owner : ops_owner_addr,
110
112
} ,
111
113
latest_blockhash,
112
114
) ?;
113
115
rpc_client
114
116
. send_and_confirm_transaction_with_spinner ( & tx)
115
117
. await ?;
116
118
println ! (
117
- "Initialized with conifg :\n {:?}" ,
119
+ "Initialized with config :\n {:?}" ,
118
120
get_config_account( & rpc_client, & p2w_addr) . await ?
119
121
) ;
120
122
}
@@ -127,8 +129,17 @@ async fn main() -> Result<(), ErrBox> {
127
129
new_wh_prog,
128
130
new_pyth_owner_addr,
129
131
is_active,
132
+ ops_owner_addr,
133
+ remove_ops_owner,
130
134
} => {
131
135
let old_config = get_config_account ( & rpc_client, & p2w_addr) . await ?;
136
+
137
+ let new_ops_owner = if remove_ops_owner {
138
+ None
139
+ } else {
140
+ ops_owner_addr
141
+ } ;
142
+
132
143
let tx = gen_set_config_tx (
133
144
payer,
134
145
p2w_addr,
@@ -139,14 +150,15 @@ async fn main() -> Result<(), ErrBox> {
139
150
pyth_owner : new_pyth_owner_addr. unwrap_or ( old_config. pyth_owner ) ,
140
151
is_active : is_active. unwrap_or ( old_config. is_active ) ,
141
152
max_batch_size : P2W_MAX_BATCH_SIZE ,
153
+ ops_owner : new_ops_owner,
142
154
} ,
143
155
latest_blockhash,
144
156
) ?;
145
157
rpc_client
146
158
. send_and_confirm_transaction_with_spinner ( & tx)
147
159
. await ?;
148
160
println ! (
149
- "Applied conifg :\n {:?}" ,
161
+ "Applied config :\n {:?}" ,
150
162
get_config_account( & rpc_client, & p2w_addr) . await ?
151
163
) ;
152
164
}
@@ -161,7 +173,7 @@ async fn main() -> Result<(), ErrBox> {
161
173
. send_and_confirm_transaction_with_spinner ( & tx)
162
174
. await ?;
163
175
println ! (
164
- "Applied conifg :\n {:?}" ,
176
+ "Applied config :\n {:?}" ,
165
177
get_config_account( & rpc_client, & p2w_addr) . await ?
166
178
) ;
167
179
}
@@ -196,7 +208,23 @@ async fn main() -> Result<(), ErrBox> {
196
208
)
197
209
. await ?;
198
210
}
199
- Action :: GetEmitter => unreachable ! { } ,
211
+ Action :: GetEmitter => unreachable ! { } , // It is handled early in this function.
212
+ Action :: SetIsActive { ops_owner, new_is_active } => {
213
+ let tx = gen_set_is_active_tx (
214
+ payer,
215
+ p2w_addr,
216
+ read_keypair_file ( & * shellexpand:: tilde ( & ops_owner) ) ?,
217
+ new_is_active. eq_ignore_ascii_case ( "true" ) ,
218
+ latest_blockhash,
219
+ ) ?;
220
+ rpc_client
221
+ . send_and_confirm_transaction_with_spinner ( & tx)
222
+ . await ?;
223
+ println ! (
224
+ "Applied config:\n {:?}" ,
225
+ get_config_account( & rpc_client, & p2w_addr) . await ?
226
+ ) ;
227
+ } ,
200
228
}
201
229
202
230
Ok ( ( ) )
0 commit comments