Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
217 changes: 152 additions & 65 deletions Cargo.lock

Large diffs are not rendered by default.

28 changes: 13 additions & 15 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ edition = "2021"
description = "ckb command line interface"

[dependencies]
ckb-jsonrpc-types = "=0.202.0"
ckb-hash = "=0.202.0"
ckb-crypto = { version = "=0.202.0", features = ["secp"] }
ckb-build-info = "=0.202.0"
ckb-types = "=0.202.0"
ckb-util = "=0.202.0"
ckb-error = "=0.202.0"
ckb-script = "=0.202.0"
ckb-chain-spec = "=0.202.0"
ckb-sdk = { version = "4.2.0", features = ["native-tls-vendored"] }
ckb-mock-tx-types = "=0.202.0"
ckb-jsonrpc-types = "1.0"
ckb-hash = "1.0"
ckb-crypto = { version = "1.0", features = ["secp"] }
ckb-build-info = "1.0"
ckb-types = "1.0"
ckb-util = "1.0"
ckb-error = "1.0"
ckb-script = "1.0"
ckb-chain-spec = "1.0"
ckb-channel = "1.0"
ckb-sdk = { version = "5.0", features = ["native-tls-vendored"] }
ckb-mock-tx-types = "1.0"
ckb-signer = { path = "ckb-signer", version = "0.4.1" }
plugin-protocol = { path = "plugin-protocol", package = "ckb-cli-plugin-protocol", version = "=1.3.1" }
jsonrpc-core-client = "18"
Expand Down Expand Up @@ -66,9 +67,6 @@ tokio = { version = "1", features = ["net", "io-util", "rt"] }
futures = "0.3"
async-trait = "0.1.88"

# remove this line when ckb-vm stick the version of ckb-vm-definitions
# ckb-vm-definitions = "=0.21.3"

[target.'cfg(unix)'.dependencies]
tui = "0.6.0"
termion = "1.5"
Expand All @@ -77,7 +75,7 @@ termion = "1.5"
rand = "0.7"

[build-dependencies]
ckb-build-info = "=0.202.0"
ckb-build-info = "1.0"

[workspace]
members = ["ckb-signer", "plugin-protocol"]
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ ci: fmt clippy test security-audit check-crates check-licenses
git diff --exit-code Cargo.lock

integration:
bash devtools/ci/integration.sh v0.200.0 $(ARGS)
bash devtools/ci/integration.sh v0.203.0 $(ARGS)

integration-spec:
@if [ -z "$(SPEC)" ]; then \
echo "Usage: make integration-spec SPEC=pattern"; \
echo "Example: make integration-spec SPEC=deploy_type_id"; \
exit 1; \
fi
bash devtools/ci/integration.sh v0.200.0 --spec=$(SPEC)
bash devtools/ci/integration.sh v0.203.0 --spec=$(SPEC)

prod: ## Build binary with release profile.
cargo build --locked --release
Expand Down
8 changes: 4 additions & 4 deletions ckb-signer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ thiserror = "1.0.30"
parking_lot = "0.11"
anyhow = "1.0.63"

ckb-types = "=0.202.0"
ckb-hash = "=0.202.0"
ckb-crypto = { version = "=0.202.0", features = ["secp"] }
ckb-sdk = { version = "4.2.0", features = ["native-tls-vendored"] }
ckb-types = "1.0"
ckb-hash = "1.0"
ckb-crypto = { version = "1.0", features = ["secp"] }
ckb-sdk = { version = "5.0", features = ["native-tls-vendored"] }
4 changes: 2 additions & 2 deletions plugin-protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ description = "ckb-cli plugin protocol"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
ckb-types = "=0.202.0"
ckb-jsonrpc-types = "=0.202.0"
ckb-types = "1.0"
ckb-jsonrpc-types = "1.0"
serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0"
Expand Down
2 changes: 1 addition & 1 deletion src/plugin/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ use std::thread::{self, JoinHandle};
use bitcoin::bip32::DerivationPath;
use crossbeam_channel::bounded;

use ckb_channel::Request;
use ckb_sdk::util::serialize_signature;
use ckb_signer::{DerivedKeySet, Key, KeyStore, MasterPrivKey};
use ckb_types::core::service::Request;
use plugin_protocol::{JsonrpcError, KeyStoreRequest, PluginRequest, PluginResponse};

use super::manager::PluginHandler;
Expand Down
3 changes: 2 additions & 1 deletion src/plugin/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ use std::thread::{self, JoinHandle};
use bitcoin::bip32::{ChildNumber, DerivationPath};
use crossbeam_channel::{bounded, select, Sender};

use ckb_channel::Request;
use ckb_jsonrpc_types::{BlockNumber, HeaderView, JsonBytes, Script};
use ckb_signer::{DerivedKeySet, MasterPrivKey, CKB_ROOT_PATH};
use ckb_types::{bytes::Bytes, core::service::Request, H160, H256};
use ckb_types::{bytes::Bytes, H160, H256};

use super::builtin::{DefaultIndexer, DefaultKeyStore, ERROR_KEYSTORE_REQUIRE_PASSWORD};
use crate::utils::other::read_password;
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/dao/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ impl<'a> DAOSubCommand<'a> {
) -> Result<Vec<LiveCellInfo>, String> {
let dao_type_script = Script::new_builder()
.code_hash(DAO_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.build();
let mut query = CellQueryOptions::new_lock(lock);
query.secondary_script = Some(dao_type_script);
Expand Down
6 changes: 3 additions & 3 deletions src/subcommands/deploy/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -821,7 +821,7 @@ fn load_cell_info(
) -> Result<(H256, Bytes, json_types::CellOutput)> {
let out_point = packed::OutPoint::new_builder()
.tx_hash(tx_hash.pack())
.index(index.pack())
.index(index)
.build();
let cell_with_status = rpc_client
.get_live_cell(out_point, true, None)
Expand Down Expand Up @@ -869,7 +869,7 @@ fn load_dep_groups(
} => {
let out_point = packed::OutPoint::new_builder()
.tx_hash(tx_hash.pack())
.index(index.pack())
.index(index)
.build();
Some((&config.name, out_point))
}
Expand All @@ -888,7 +888,7 @@ fn load_dep_groups(
.map(|cell_recipe| {
packed::OutPoint::new_builder()
.tx_hash(cell_recipe.tx_hash.pack())
.index(cell_recipe.index.pack())
.index(cell_recipe.index)
.build()
})
.or_else(|| refs_map.get(cell_name).cloned())
Expand Down
8 changes: 4 additions & 4 deletions src/subcommands/deploy/state_change.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl ChangeInfo for CellChange {
let type_script_opt = type_id_args.map(|type_id_args| {
packed::Script::new_builder()
.code_hash(TYPE_ID_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(type_id_args.to_vec()).pack())
.build()
});
Expand Down Expand Up @@ -259,7 +259,7 @@ impl CellChange {
});
let type_script = packed::Script::new_builder()
.code_hash(TYPE_ID_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(args.to_vec()).pack())
.build();
Some(type_script.calc_script_hash().unpack())
Expand Down Expand Up @@ -382,7 +382,7 @@ impl ChangeInfo for DepGroupChange {
let type_script_opt = type_id_args.map(|type_id_args| {
packed::Script::new_builder()
.code_hash(TYPE_ID_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(type_id_args.to_vec()).pack())
.build()
});
Expand Down Expand Up @@ -466,7 +466,7 @@ impl DepGroupChange {
};
let type_script = packed::Script::new_builder()
.code_hash(TYPE_ID_CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(args.to_vec()).pack())
.build();
Some(type_script.calc_script_hash().unpack())
Expand Down
4 changes: 2 additions & 2 deletions src/subcommands/mock_tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ impl CliSubCommand for MockTxSubCommand<'_> {
let sample_script = || {
Script::new_builder()
.code_hash(SIGHASH_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(lock_arg.as_bytes().to_vec()).pack())
.build()
};
Expand Down Expand Up @@ -227,7 +227,7 @@ impl CliSubCommand for MockTxSubCommand<'_> {
let tx = TransactionBuilder::default()
.input(input)
.output(output)
.output_data(Default::default())
.output_data(ckb_types::packed::Bytes::default())
.witness(Bytes::from("abc").pack())
.build()
.data();
Expand Down
31 changes: 23 additions & 8 deletions src/subcommands/molecule.rs
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,8 @@ impl From<packed::CellbaseWitness> for CellbaseWitness {
impl From<CellbaseWitness> for packed::CellbaseWitness {
fn from(json: CellbaseWitness) -> Self {
packed::CellbaseWitness::new_builder()
.lock(json.lock.into())
.message(json.message.into())
.lock(json.lock)
.message(json.message)
.build()
}
}
Expand Down Expand Up @@ -390,11 +390,26 @@ impl From<RawTransaction> for packed::RawTransaction {
fn from(json: RawTransaction) -> Self {
packed::RawTransaction::new_builder()
.version(json.version.pack())
.cell_deps(json.cell_deps.into_iter().map(Into::into).pack())
.header_deps(json.header_deps.iter().map(Pack::pack).pack())
.inputs(json.inputs.into_iter().map(Into::into).pack())
.outputs(json.outputs.into_iter().map(Into::into).pack())
.outputs_data(json.outputs_data.into_iter().map(Into::into).pack())
.cell_deps(
json.cell_deps
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
.header_deps(
json.header_deps
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
.inputs(json.inputs.into_iter().map(Into::into).collect::<Vec<_>>())
.outputs(json.outputs.into_iter().map(Into::into).collect::<Vec<_>>())
.outputs_data(
json.outputs_data
.into_iter()
.map(Into::into)
.collect::<Vec<_>>(),
)
.build()
}
}
Expand Down Expand Up @@ -443,7 +458,7 @@ impl From<RawHeader> for packed::RawHeader {
.proposals_hash(json.proposals_hash.pack())
.compact_target(json.compact_target.pack())
.extra_hash(json.extra_hash.pack())
.dao(json.dao.into())
.dao(json.dao)
.build()
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,7 +659,7 @@ impl CliSubCommand for RpcSubCommand<'_> {

let out_point = packed::OutPoint::new_builder()
.tx_hash(tx_hash.pack())
.index(index.pack())
.index(index)
.build();
if is_raw_data {
let resp = {
Expand Down
27 changes: 12 additions & 15 deletions src/subcommands/sudt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<'a> SudtSubCommand<'a> {
script_args[20..40].copy_from_slice(&owner_script_hash.as_slice()[0..20]);
let script = Script::new_builder()
.code_hash(script_id.code_hash.pack())
.hash_type(script_id.hash_type.into())
.hash_type(script_id.hash_type)
.args(Bytes::from(script_args).pack())
.build();
(TransferAction::Create, script)
Expand Down Expand Up @@ -373,7 +373,7 @@ impl<'a> SudtSubCommand<'a> {
let type_script = udt_type.build_script(&udt_script_id, &owner_script_hash);
let cheque_sender_script_hash = Script::new_builder()
.code_hash(SIGHASH_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(sender_account.as_bytes().to_vec()).pack())
.build()
.calc_script_hash();
Expand All @@ -389,7 +389,7 @@ impl<'a> SudtSubCommand<'a> {
.copy_from_slice(&cheque_sender_script_hash.as_slice()[0..20]);
let script = Script::new_builder()
.code_hash(script_id.code_hash.pack())
.hash_type(script_id.hash_type.into())
.hash_type(script_id.hash_type)
.args(Bytes::from(script_args).pack())
.build();
(TransferAction::Create, script)
Expand Down Expand Up @@ -553,7 +553,7 @@ impl<'a> SudtSubCommand<'a> {
H160::from_slice(capacity_provider.payload().args().as_ref()).unwrap();
let acp_lock = Script::new_builder()
.code_hash(acp_script_id.code_hash.pack())
.hash_type(acp_script_id.hash_type.into())
.hash_type(acp_script_id.hash_type)
.args(to.payload().args().pack())
.build();
let acp_address = {
Expand All @@ -575,10 +575,7 @@ impl<'a> SudtSubCommand<'a> {
.occupied_capacity(Capacity::bytes(output_data.len()).unwrap())
.unwrap()
.as_u64();
let output = base_output
.as_builder()
.capacity(occupied_capacity.pack())
.build();
let output = base_output.as_builder().capacity(occupied_capacity).build();
let builder = CapacityTransferBuilder::new(vec![(output, output_data)]);
let mut udt_builder = UdtTxBuilder {
plugin_mgr: self.plugin_mgr,
Expand Down Expand Up @@ -655,18 +652,18 @@ impl<'a> SudtSubCommand<'a> {
.copy_from_slice(&sender_script.calc_script_hash().as_slice()[0..20]);
Script::new_builder()
.code_hash(cheque_script_id.code_hash.pack())
.hash_type(cheque_script_id.hash_type.into())
.hash_type(cheque_script_id.hash_type)
.args(Bytes::from(script_args).pack())
.build()
};
let receiver_acp_script = Script::new_builder()
.code_hash(acp_script_id.code_hash.pack())
.hash_type(acp_script_id.hash_type.into())
.hash_type(acp_script_id.hash_type)
.args(receiver_script.args())
.build();
let type_script = Script::new_builder()
.code_hash(udt_script_id.code_hash.pack())
.hash_type(udt_script_id.hash_type.into())
.hash_type(udt_script_id.hash_type)
.args(owner_script.calc_script_hash().as_bytes().pack())
.build();

Expand Down Expand Up @@ -790,13 +787,13 @@ impl<'a> SudtSubCommand<'a> {
.copy_from_slice(&sender_script.calc_script_hash().as_slice()[0..20]);
Script::new_builder()
.code_hash(cheque_script_id.code_hash.pack())
.hash_type(cheque_script_id.hash_type.into())
.hash_type(cheque_script_id.hash_type)
.args(Bytes::from(script_args).pack())
.build()
};
let type_script = Script::new_builder()
.code_hash(udt_script_id.code_hash.pack())
.hash_type(udt_script_id.hash_type.into())
.hash_type(udt_script_id.hash_type)
.args(owner_script.calc_script_hash().as_bytes().pack())
.build();

Expand Down Expand Up @@ -1093,7 +1090,7 @@ impl CliSubCommand for SudtSubCommand<'_> {
let acp_script_id = get_script_id(&cell_deps, CellDepName::Acp)?;
let acp_script = Script::new_builder()
.code_hash(acp_script_id.code_hash.pack())
.hash_type(acp_script_id.hash_type.into())
.hash_type(acp_script_id.hash_type)
.args(sighash_addr.payload().args().pack())
.build();
let acp_payload = AddressPayload::from(acp_script);
Expand All @@ -1117,7 +1114,7 @@ impl CliSubCommand for SudtSubCommand<'_> {
script_args[20..40].copy_from_slice(&sender_script_hash.as_slice()[0..20]);
let cheque_script = Script::new_builder()
.code_hash(cheque_script_id.code_hash.pack())
.hash_type(cheque_script_id.hash_type.into())
.hash_type(cheque_script_id.hash_type)
.args(Bytes::from(script_args).pack())
.build();
let cheque_payload = AddressPayload::from(cheque_script);
Expand Down
3 changes: 2 additions & 1 deletion src/subcommands/tui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ use tui::{Frame, Terminal};
// use chrono::{Local, DateTime, TimeZone};
use ckb_sdk::{constants::ONE_CKB, Address, NetworkType};
use ckb_types::{
core::{service::Request, BlockView},
core::BlockView,
prelude::*,
H256,
};
use ckb_channel::Request;

use crate::utils::{
genesis_info::GenesisInfo,
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/tx.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ impl CliSubCommand for TxSubCommand<'_> {
let genesis_info = get_genesis_info(&self.genesis_info, self.rpc_client)?;
let out_point = OutPoint::new_builder()
.tx_hash(tx_hash.pack())
.index(index.pack())
.index(index)
.build();
let get_live_cell = |out_point, with_data| {
get_live_cell(self.rpc_client, out_point, with_data).map(|(output, _)| output)
Expand Down
2 changes: 1 addition & 1 deletion src/subcommands/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ message = "0x"
let with_data = m.is_present("with-data");
let out_point = packed::OutPoint::new_builder()
.tx_hash(tx_hash.pack())
.index(index.pack())
.index(index)
.build();
let cell_with_status = self.rpc_client.get_live_cell(out_point, true, None)?;
if cell_with_status.status != "live" {
Expand Down
Loading
Loading