Skip to content

Commit

Permalink
fix: remove skip preflight from cli (coral-xyz#2492)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: acheron <acheroncrypto@gmail.com>
  • Loading branch information
Arrowana and acheroncrypto authored May 16, 2023
1 parent 89e94d1 commit b7bada1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 31 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- ts: Narrowed `AccountClient` type to it's appropriate account type ([#2440](https://github.com/coral-xyz/anchor/pull/2440))
- lang: Fix inability to use identifiers `program_id`, `accounts`, `ix_data`, `remaining_accounts` in instruction arguments ([#2464](https://github.com/coral-xyz/anchor/pull/2464))
- cli: Fix incorrect `metadata.address` generation in IDL after deploying with a custom keypair ([#2485](https://github.com/coral-xyz/anchor/pull/2485))
- cli: IDL commands no longer hang when the payer doesn't have funds to pay for the transaction fee ([#2492](https://github.com/coral-xyz/anchor/pull/2492))

### Breaking

Expand Down
37 changes: 6 additions & 31 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ use semver::{Version, VersionReq};
use serde::{Deserialize, Serialize};
use serde_json::{json, Map, Value as JsonValue};
use solana_client::rpc_client::RpcClient;
use solana_client::rpc_config::RpcSendTransactionConfig;
use solana_program::instruction::{AccountMeta, Instruction};
use solana_sdk::account_utils::StateMut;
use solana_sdk::bpf_loader;
Expand Down Expand Up @@ -1931,13 +1930,9 @@ fn idl_set_buffer(cfg_override: &ConfigOverride, program_id: Pubkey, buffer: Pub
);

// Send the transaction.
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::confirmed(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;

Ok(())
Expand Down Expand Up @@ -2020,13 +2015,9 @@ fn idl_set_authority(
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::confirmed(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;

println!("Authority update complete.");
Expand Down Expand Up @@ -2077,13 +2068,9 @@ fn idl_close_account(cfg: &Config, program_id: &Pubkey, idl_address: Pubkey) ->
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::confirmed(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;

Ok(())
Expand Down Expand Up @@ -2141,13 +2128,9 @@ fn idl_write(cfg: &Config, program_id: &Pubkey, idl: &Idl, idl_address: Pubkey)
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::confirmed(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;
offset += MAX_WRITE_SIZE;
}
Expand Down Expand Up @@ -3175,13 +3158,9 @@ fn create_idl_account(
&[&keypair],
latest_hash,
);
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::finalized(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;
}

Expand Down Expand Up @@ -3243,13 +3222,9 @@ fn create_idl_buffer(
);

// Send the transaction.
client.send_and_confirm_transaction_with_spinner_and_config(
client.send_and_confirm_transaction_with_spinner_and_commitment(
&tx,
CommitmentConfig::confirmed(),
RpcSendTransactionConfig {
skip_preflight: true,
..RpcSendTransactionConfig::default()
},
)?;

Ok(buffer.pubkey())
Expand Down

0 comments on commit b7bada1

Please sign in to comment.