|
31 | 31 | program_option::COption, |
32 | 32 | pubkey::Pubkey, |
33 | 33 | signature::{Keypair, Signer}, |
34 | | - transaction::Transaction, |
35 | 34 | }, |
36 | | - solana_system_interface::{instruction::transfer, program as system_program}, |
| 35 | + solana_system_interface::program as system_program, |
37 | 36 | spl_associated_token_account_interface::address::get_associated_token_address_with_program_id, |
38 | 37 | spl_pod::optional_keys::OptionalNonZeroPubkey, |
39 | 38 | spl_token_2022::extension::confidential_transfer::account_info::{ |
@@ -2155,34 +2154,7 @@ async fn command_unwrap_lamports( |
2155 | 2154 |
|
2156 | 2155 | if config.rpc_client.get_balance(&destination_account).await? == 0 { |
2157 | 2156 | // if it doesn't exist, we gate transfer with a different flag |
2158 | | - if allow_unfunded_recipient { |
2159 | | - println_display( |
2160 | | - config, |
2161 | | - format!("Funding recipient: {}", destination_account,), |
2162 | | - ); |
2163 | | - |
2164 | | - let rent_exempt_lamports = config |
2165 | | - .rpc_client |
2166 | | - .get_minimum_balance_for_rent_exemption(0) |
2167 | | - .await?; |
2168 | | - let fee_payer = config.fee_payer()?; |
2169 | | - let instruction = transfer( |
2170 | | - &fee_payer.pubkey(), |
2171 | | - &destination_account, |
2172 | | - rent_exempt_lamports, |
2173 | | - ); |
2174 | | - let recent_blockhash = config.rpc_client.get_latest_blockhash().await?; |
2175 | | - let transaction = Transaction::new_signed_with_payer( |
2176 | | - &[instruction], |
2177 | | - Some(&fee_payer.pubkey()), |
2178 | | - &[fee_payer], |
2179 | | - recent_blockhash, |
2180 | | - ); |
2181 | | - config |
2182 | | - .rpc_client |
2183 | | - .send_and_confirm_transaction(&transaction) |
2184 | | - .await?; |
2185 | | - } else { |
| 2157 | + if !allow_unfunded_recipient { |
2186 | 2158 | return Err("Error: The recipient address is not funded. \ |
2187 | 2159 | Add `--allow-unfunded-recipient` to complete the transfer." |
2188 | 2160 | .into()); |
|
0 commit comments