Skip to content

Commit

Permalink
Merge branch 'origin/murisi/remove-sdk-lifetimes' (#2225)
Browse files Browse the repository at this point in the history
  • Loading branch information
murisi committed Nov 28, 2023
2 parents 5e90dc0 + 8afe908 commit e41fe22
Show file tree
Hide file tree
Showing 20 changed files with 486 additions and 497 deletions.
2 changes: 2 additions & 0 deletions .changelog/unreleased/SDK/2225-remove-sdk-lifetimes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Removed uses of lifetimes in the SDKs Namada trait and implementation
([\#2225](https://github.com/anoma/namada/pull/2225))
2 changes: 1 addition & 1 deletion apps/src/bin/namada-client/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ async fn main() -> Result<()> {
CliApi::handle_client_command::<HttpClient, _>(
None,
cli::namada_client_cli()?,
&CliIo,
CliIo,
)
.await
}
2 changes: 1 addition & 1 deletion apps/src/bin/namada-relayer/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,5 @@ async fn main() -> Result<()> {

let cmd = cli::namada_relayer_cli()?;
// run the CLI
CliApi::handle_relayer_command::<HttpClient>(None, cmd, &CliIo).await
CliApi::handle_relayer_command::<HttpClient>(None, cmd, CliIo).await
}
33 changes: 23 additions & 10 deletions apps/src/lib/bench_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ pub use namada_sdk::tx::{
TX_WITHDRAW_WASM, VP_USER_WASM,
};
use namada_sdk::wallet::Wallet;
use namada_sdk::NamadaImpl;
use namada_sdk::{Namada, NamadaImpl};
use namada_test_utils::tx_data::TxWriteData;
use rand_core::OsRng;
use sha2::{Digest, Sha256};
Expand Down Expand Up @@ -815,11 +815,11 @@ impl Default for BenchShieldedCtx {

impl BenchShieldedCtx {
pub fn generate_masp_tx(
&mut self,
mut self,
amount: Amount,
source: TransferSource,
target: TransferTarget,
) -> Tx {
) -> (Self, Tx) {
let denominated_amount = DenominatedAmount {
amount,
denom: 0.into(),
Expand All @@ -836,12 +836,13 @@ impl BenchShieldedCtx {
&[],
))
.unwrap();
let native_token = self.shell.wl_storage.storage.native_token.clone();
let namada = NamadaImpl::native_new(
&self.shell,
&mut self.wallet,
&mut self.shielded,
&StdIo,
self.shell.wl_storage.storage.native_token.clone(),
self.shell,
self.wallet,
self.shielded,
StdIo,
native_token,
);
let shielded = async_runtime
.block_on(
Expand Down Expand Up @@ -873,7 +874,7 @@ impl BenchShieldedCtx {
)
});

self.shell.generate_tx(
let tx = namada.client().generate_tx(
TX_TRANSFER_WASM,
Transfer {
source: source.effective_address(),
Expand All @@ -886,6 +887,18 @@ impl BenchShieldedCtx {
shielded,
None,
vec![&defaults::albert_keypair()],
)
);
let NamadaImpl {
client,
wallet,
shielded,
..
} = namada;
let ctx = Self {
shielded: shielded.into_inner(),
shell: client,
wallet: wallet.into_inner(),
};
(ctx, tx)
}
}
Loading

0 comments on commit e41fe22

Please sign in to comment.