From 7f27ab5e3e33ae60e6d0adbedfcc9cc4fe0b946a Mon Sep 17 00:00:00 2001 From: Guillermo Bescos Date: Mon, 16 Sep 2024 16:56:08 +0100 Subject: [PATCH] close vaa too --- staking/cli/src/instructions.rs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/staking/cli/src/instructions.rs b/staking/cli/src/instructions.rs index 9ed21d86..b9d2eb86 100644 --- a/staking/cli/src/instructions.rs +++ b/staking/cli/src/instructions.rs @@ -339,6 +339,22 @@ pub fn write_encoded_vaa( ); } +pub fn close_encoded_vaa(rpc_client: &RpcClient, payer: &Keypair, encoded_vaa: Pubkey) { + let close_encoded_vaa_accounts = wormhole_core_bridge_solana::accounts::CloseEncodedVaa { + write_authority: payer.pubkey(), + encoded_vaa, + } + .to_account_metas(None); + + let close_encoded_vaa_instruction = Instruction { + program_id: wormhole_core_bridge_solana::ID, + accounts: close_encoded_vaa_accounts, + data: wormhole_core_bridge_solana::instruction::CloseEncodedVaa {}.data(), + }; + + process_transaction(rpc_client, &[close_encoded_vaa_instruction], &[payer]); +} + pub fn initialize_reward_custody(rpc_client: &RpcClient, payer: &Keypair) { let pool_config = get_pool_config_address(); @@ -517,6 +533,7 @@ pub fn fetch_publisher_caps_and_advance( advance(rpc_client, payer, publisher_caps); close_publisher_caps(rpc_client, payer, publisher_caps); + close_encoded_vaa(rpc_client, payer, encoded_vaa); } pub fn update_delegation_fee(rpc_client: &RpcClient, payer: &Keypair, delegation_fee: u64) {