Skip to content

Commit

Permalink
feat: accept impl Into<VersionedTransaction> for ergonomics
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverNChalk committed Oct 9, 2024
1 parent 0c88ecb commit 43b7698
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions crates/svm-test/src/svm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -121,10 +121,10 @@ where
#[allow(clippy::result_large_err)]
pub fn simulate_transaction(
&mut self,
tx: VersionedTransaction,
tx: impl Into<VersionedTransaction>,
) -> Result<(TransactionMetadata, Vec<(Pubkey, AccountSharedData)>), FailedTransactionMetadata>
{
let tx = self.sanitize_and_load_accounts(tx);
let tx = self.sanitize_and_load_accounts(tx.into());

self.inner
.simulate_transaction(tx.to_versioned_transaction())
Expand All @@ -133,9 +133,9 @@ where
#[allow(clippy::result_large_err)]
pub fn execute_transaction(
&mut self,
tx: VersionedTransaction,
tx: impl Into<VersionedTransaction>,
) -> Result<TransactionMetadata, FailedTransactionMetadata> {
let tx = self.sanitize_and_load_accounts(tx);
let tx = self.sanitize_and_load_accounts(tx.into());

self.inner.send_transaction(tx.to_versioned_transaction())
}
Expand Down
2 changes: 1 addition & 1 deletion crates/svm-test/src/utils/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod load_elf;
mod locate_manifest;
mod pack_to_vec;
mod read_json_gz;
#[cfg(feature = "spl-token")]
#[cfg(feature = "spl")]
pub mod spl_token;
mod test_payer;
mod write_on_drop;
Expand Down
2 changes: 1 addition & 1 deletion crates/svm-test/tests/program_unit_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn memo() {
);

// Simulate (run without updating state).
let (meta, accounts) = svm.simulate_transaction(tx.into()).unwrap();
let (meta, accounts) = svm.simulate_transaction(tx).unwrap();

// Assert.
expect![[r#"
Expand Down

0 comments on commit 43b7698

Please sign in to comment.