diff --git a/Cargo.lock b/Cargo.lock index dd13286b..812dd5f0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -763,7 +763,7 @@ dependencies = [ [[package]] name = "ckb-sdk" version = "3.1.1" -source = "git+https://github.com/eval-exec/ckb-sdk-rust?branch=exec/bump-ckb-v0.116.0#673eb60034b5e0f1a0ebff25781d9ddfdd1bd028" +source = "git+https://github.com/eval-exec/ckb-sdk-rust?branch=exec/bump-ckb-v0.116.0#51c2f4407da3654dde9ac3825f165be1d40ebd13" dependencies = [ "anyhow", "bech32 0.8.1", diff --git a/src/subcommands/deploy/mod.rs b/src/subcommands/deploy/mod.rs index 5aa8fc3b..4d8e4b89 100644 --- a/src/subcommands/deploy/mod.rs +++ b/src/subcommands/deploy/mod.rs @@ -791,7 +791,7 @@ fn load_cell_info( .index(index.pack()) .build(); let cell_with_status = rpc_client - .get_live_cell(out_point, true) + .get_live_cell(out_point, true, None) .map_err(Error::msg)?; if cell_with_status.status != "live" { return Err(anyhow!( diff --git a/src/subcommands/mock_tx.rs b/src/subcommands/mock_tx.rs index b0beeb7f..634b09f8 100644 --- a/src/subcommands/mock_tx.rs +++ b/src/subcommands/mock_tx.rs @@ -458,7 +458,7 @@ impl<'a> MockResourceLoader for Loader<'a> { ) -> Result)>, String> { let output: Option = self .rpc_client - .get_live_cell(out_point.clone(), true) + .get_live_cell(out_point.clone(), true, None) .map(|resp| resp.cell.map(|info| info.output.into()))?; if let Some(output) = output { Ok(self diff --git a/src/subcommands/rpc.rs b/src/subcommands/rpc.rs index 8bbd2be0..432e94f0 100644 --- a/src/subcommands/rpc.rs +++ b/src/subcommands/rpc.rs @@ -121,7 +121,12 @@ impl<'a> RpcSubCommand<'a> { .arg( Arg::with_name("with-data") .long("with-data") - .about("Get live cell with data") + .about("get live cell with data") + ) + .arg( + Arg::with_name("include-tx-pool") + .long("include-tx-pool") + .about("check if it's a live cell in tx pool") ), App::new("get_tip_block_number").about("Get tip block number"), App::new("get_tip_header").about("Get tip header") @@ -649,6 +654,7 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { FixedHashParser::::default().from_matches(m, "tx-hash")?; let index: u32 = FromStrParser::::default().from_matches(m, "index")?; let with_data = m.is_present("with-data"); + let include_tx_pool = m.is_present("include-tx-pool"); let out_point = packed::OutPoint::new_builder() .tx_hash(tx_hash.pack()) @@ -657,11 +663,15 @@ impl<'a> CliSubCommand for RpcSubCommand<'a> { if is_raw_data { let resp = self .raw_rpc_client - .get_live_cell(out_point.into(), with_data) + .get_live_cell(out_point.into(), with_data, Some(include_tx_pool)) .map_err(|err| err.to_string())?; Ok(Output::new_output(resp)) } else { - let resp = self.rpc_client.get_live_cell(out_point, with_data)?; + let resp = self.rpc_client.get_live_cell( + out_point, + with_data, + Some(include_tx_pool), + )?; Ok(Output::new_output(resp)) } } diff --git a/src/subcommands/util.rs b/src/subcommands/util.rs index d4f6960e..87c5b8df 100644 --- a/src/subcommands/util.rs +++ b/src/subcommands/util.rs @@ -739,7 +739,7 @@ message = "0x" .tx_hash(tx_hash.pack()) .index(index.pack()) .build(); - let cell_with_status = self.rpc_client.get_live_cell(out_point, true)?; + let cell_with_status = self.rpc_client.get_live_cell(out_point, true, None)?; if cell_with_status.status != "live" { Ok(Output::new_output(cell_with_status)) } else { diff --git a/src/utils/other.rs b/src/utils/other.rs index 90ee628a..12e8ad9d 100644 --- a/src/utils/other.rs +++ b/src/utils/other.rs @@ -216,7 +216,7 @@ pub fn get_live_cell_internal( out_point: OutPoint, with_data: bool, ) -> Result<(CellOutput, Bytes), String> { - let cell = client.get_live_cell(out_point.clone(), with_data)?; + let cell = client.get_live_cell(out_point.clone(), with_data, None)?; if cell.status != "live" { return Err(format!( "Invalid cell status: {}, out_point: {}", diff --git a/src/utils/rpc/client.rs b/src/utils/rpc/client.rs index 4ee18759..6c618475 100644 --- a/src/utils/rpc/client.rs +++ b/src/utils/rpc/client.rs @@ -145,14 +145,15 @@ impl HttpRpcClient { .map(|opt| opt.map(Into::into)) .map_err(|err| err.to_string()) } - // TODO: Make `cell::CellData` public + pub fn get_live_cell( &mut self, out_point: packed::OutPoint, with_data: bool, + include_tx_pool: Option, ) -> Result { self.client - .get_live_cell(out_point.into(), with_data) + .get_live_cell(out_point.into(), with_data, include_tx_pool) .map_err(|err| err.to_string()) } pub fn get_tip_block_number(&mut self) -> Result {