@@ -15,14 +15,10 @@ use {
15
15
Action ,
16
16
Cli ,
17
17
} ,
18
- pyth_solana_receiver:: {
19
- sdk:: {
20
- deserialize_accumulator_update_data,
21
- get_treasury_address,
22
- DEFAULT_TREASURY_ID ,
23
- } ,
24
- PostUpdateAtomicParams ,
25
- PostUpdateParams ,
18
+ pyth_solana_receiver:: sdk:: {
19
+ deserialize_accumulator_update_data,
20
+ get_treasury_address,
21
+ DEFAULT_TREASURY_ID ,
26
22
} ,
27
23
pyth_solana_receiver_sdk:: config:: DataSource ,
28
24
pythnet_sdk:: wire:: v1:: MerklePriceUpdate ,
@@ -177,24 +173,18 @@ fn main() -> Result<()> {
177
173
let payer =
178
174
read_keypair_file ( & * shellexpand:: tilde ( & keypair) ) . expect ( "Keypair not found" ) ;
179
175
180
- let initialize_pyth_receiver_accounts =
181
- pyth_solana_receiver:: accounts:: Initialize :: populate ( & payer. pubkey ( ) )
182
- . to_account_metas ( None ) ;
183
- let initialize_pyth_receiver_instruction = Instruction {
184
- program_id : pyth_solana_receiver:: ID ,
185
- accounts : initialize_pyth_receiver_accounts,
186
- data : pyth_solana_receiver:: instruction:: Initialize {
187
- initial_config : pyth_solana_receiver_sdk:: config:: Config {
176
+ let initialize_pyth_receiver_instruction =
177
+ pyth_solana_receiver:: instruction:: Initialize :: populate (
178
+ & payer. pubkey ( ) ,
179
+ pyth_solana_receiver_sdk:: config:: Config {
188
180
governance_authority : payer. pubkey ( ) ,
189
181
target_governance_authority : None ,
190
182
wormhole,
191
183
valid_data_sources : vec ! [ DataSource { chain, emitter } ] ,
192
184
single_update_fee_in_lamports : fee,
193
185
minimum_signatures : 5 ,
194
186
} ,
195
- }
196
- . data ( ) ,
197
- } ;
187
+ ) ;
198
188
199
189
// We need to send some rent to the treasury account, otherwise it won't be able to accept incoming transfers
200
190
let pay_treasury_rent = system_instruction:: transfer (
@@ -262,29 +252,16 @@ pub fn process_post_price_update_atomic(
262
252
let request_compute_units_instruction: Instruction =
263
253
ComputeBudgetInstruction :: set_compute_unit_limit ( 400_000 ) ;
264
254
265
-
266
- let post_update_accounts = pyth_solana_receiver:: accounts:: PostUpdateAtomic :: populate (
255
+ let post_update_instruction = pyth_solana_receiver:: instruction:: PostUpdateAtomic :: populate (
267
256
payer. pubkey ( ) ,
268
257
payer. pubkey ( ) ,
269
258
price_update_keypair. pubkey ( ) ,
270
259
* wormhole,
271
260
header. guardian_set_index ,
261
+ serde_wormhole:: to_vec ( & ( header, body) ) . unwrap ( ) ,
262
+ merkle_price_update. clone ( ) ,
272
263
DEFAULT_TREASURY_ID ,
273
- )
274
- . to_account_metas ( None ) ;
275
-
276
- let post_update_instruction = Instruction {
277
- program_id : pyth_solana_receiver:: id ( ) ,
278
- accounts : post_update_accounts,
279
- data : pyth_solana_receiver:: instruction:: PostUpdateAtomic {
280
- params : PostUpdateAtomicParams {
281
- merkle_price_update : merkle_price_update. clone ( ) ,
282
- vaa : serde_wormhole:: to_vec ( & ( header, body) ) . unwrap ( ) ,
283
- treasury_id : DEFAULT_TREASURY_ID ,
284
- } ,
285
- }
286
- . data ( ) ,
287
- } ;
264
+ ) ;
288
265
289
266
process_transaction (
290
267
rpc_client,
@@ -472,24 +449,13 @@ pub fn process_write_encoded_vaa_and_post_price_update(
472
449
473
450
let price_update_keypair = Keypair :: new ( ) ;
474
451
475
- let post_update_accounts = pyth_solana_receiver:: accounts :: PostUpdate :: populate (
452
+ let post_update_instructions = pyth_solana_receiver:: instruction :: PostUpdate :: populate (
476
453
payer. pubkey ( ) ,
477
454
payer. pubkey ( ) ,
478
455
encoded_vaa_keypair. pubkey ( ) ,
479
456
price_update_keypair. pubkey ( ) ,
480
- )
481
- . to_account_metas ( None ) ;
482
- let post_update_instructions = Instruction {
483
- program_id : pyth_solana_receiver:: id ( ) ,
484
- accounts : post_update_accounts,
485
- data : pyth_solana_receiver:: instruction:: PostUpdate {
486
- params : PostUpdateParams {
487
- merkle_price_update : merkle_price_update. clone ( ) ,
488
- treasury_id : DEFAULT_TREASURY_ID ,
489
- } ,
490
- }
491
- . data ( ) ,
492
- } ;
457
+ merkle_price_update. clone ( ) ,
458
+ ) ;
493
459
494
460
// 2nd transaction
495
461
process_transaction (
0 commit comments