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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ jobs:
- name: Security Audit & Licenses
run: |
rustup toolchain install stable --profile minimal
cargo deny --version || cargo install cargo-deny@0.17.0
cargo deny --version || cargo install cargo-deny@0.17.0 --locked
make security-audit
make check-crates
make check-licenses
Expand Down
24 changes: 12 additions & 12 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ckb-sdk"
version = "4.4.0"
version = "5.0.0"
authors = [
"Linfeng Qian <thewawar@gmail.com>",
"Nervos Core Dev <dev@nervos.org>",
Expand Down Expand Up @@ -32,25 +32,25 @@ dashmap = "5.4"
dyn-clone = "1.0"
async-trait = "0.1"

ckb-types = "0.202.0"
ckb-dao-utils = "0.202.0"
ckb-traits = "0.202.0"
ckb-jsonrpc-types = "0.202.0"
ckb-hash = "0.202.0"
ckb-resource = "0.202.0"
ckb-types = "1.0.0"
ckb-dao-utils = "1.0.0"
ckb-traits = "1.0.0"
ckb-jsonrpc-types = "1.0.0"
ckb-hash = "1.0.0"
ckb-resource = "1.0.0"
ckb-system-scripts-v0_5_4 = { package="ckb-system-scripts", version="=0.5.4" }
ckb-system-scripts-v0_6_0 = { package="ckb-system-scripts", version="=0.6.0" }
ckb-crypto = { version = "=0.202.0", features = ["secp"] }
ckb-script = "0.202.0"
ckb-crypto = "1.0.0"
ckb-script = "1.0.0"
bitflags = "1.3.2"
sha3 = "0.10.1"
sha3 = "0.10.8"
enum-repr-derive = "0.2.0"
hex = "0.4"

# for feature test
rand = { version = "0.7.3", optional = true }
ckb-mock-tx-types = { version = "0.202.0" }
ckb-chain-spec = "0.202.0"
ckb-mock-tx-types = "1.0.0"
ckb-chain-spec = "1.0.0"

sparse-merkle-tree = { version = "0.6", optional = true }
async-iterator = "2.3.0"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ These features allow for seamless interaction with CKB and facilitate the develo
```toml
# Cargo.toml
[dependencies]
ckb-sdk = "4.4.0"
ckb-sdk = "5"
```

## Build
Expand Down Expand Up @@ -124,7 +124,7 @@ let tx_dep_provider = DefaultTransactionDependencyProvider::new(ckb_rpc, 10);
// Build the transaction
let output = CellOutput::new_builder()
.lock(Script::from(&receiver))
.capacity(capacity.0.pack())
.capacity(capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
let (_tx, _) = builder
Expand Down
6 changes: 3 additions & 3 deletions examples/chain_transfer_sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
Script::new_builder()
.code_hash(SIGHASH_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(hash160).pack())
.build()
};
Expand All @@ -84,7 +84,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
Script::new_builder()
.code_hash(SIGHASH_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(hash160).pack())
.build()
};
Expand Down Expand Up @@ -177,7 +177,7 @@ fn build_transfer_tx(
// Build the transaction
let output = CellOutput::new_builder()
.lock(Script::from(receiver))
.capacity(capacity.pack())
.capacity(capacity)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
let (tx, still_locked_groups) = builder.build_unlocked(
Expand Down
2 changes: 1 addition & 1 deletion examples/deploy_script_with_type_id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ fn build_output_and_data(deployer: &Address) -> (CellOutput, Bytes) {
let type_script =
ScriptId::new_type(constants::TYPE_ID_CODE_HASH.clone()).dummy_type_id_script();
let dummy_output = CellOutput::new_builder()
.lock(deployer.into())
.lock(deployer)
.type_(Some(type_script).pack())
.build();
let required_capacity = dummy_output
Expand Down
4 changes: 2 additions & 2 deletions examples/transfer_from_multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ fn build_transfer_tx(
// Build CapacityBalancer
let sender = Script::new_builder()
.code_hash(MultisigScript::V2.script_id().code_hash.pack())
.hash_type(MultisigScript::V2.script_id().hash_type.into())
.hash_type(MultisigScript::V2.script_id().hash_type)
.args(Bytes::from(multisig_config.hash160().as_bytes().to_vec()).pack())
.build();
let sender_addr = Address::new(args.receiver.network(), sender.clone().into(), true);
Expand All @@ -254,7 +254,7 @@ fn build_transfer_tx(
let unlockers = build_multisig_unlockers(Vec::new(), multisig_config.clone());
let output = CellOutput::new_builder()
.lock(Script::from(&args.receiver))
.capacity(args.capacity.0.pack())
.capacity(args.capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
let tx = builder.build_balanced(
Expand Down
4 changes: 2 additions & 2 deletions examples/transfer_from_omnilock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,7 @@ fn build_transfer_tx(
// Build CapacityBalancer
let sender = Script::new_builder()
.code_hash(cell.type_hash.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(omnilock_config.build_args().pack())
.build();
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
Expand All @@ -290,7 +290,7 @@ fn build_transfer_tx(
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
let output = CellOutput::new_builder()
.lock(Script::from(&args.receiver))
.capacity(args.capacity.0.pack())
.capacity(args.capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);

Expand Down
4 changes: 2 additions & 2 deletions examples/transfer_from_omnilock_ethereum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ fn build_transfer_tx(
// Build CapacityBalancer
let sender = Script::new_builder()
.code_hash(cell.type_hash.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(omnilock_config.build_args().pack())
.build();
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
Expand All @@ -297,7 +297,7 @@ fn build_transfer_tx(
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
let output = CellOutput::new_builder()
.lock(Script::from(&args.receiver))
.capacity(args.capacity.0.pack())
.capacity(args.capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);

Expand Down
4 changes: 2 additions & 2 deletions examples/transfer_from_omnilock_multisig.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ fn build_transfer_tx(
// Build CapacityBalancer
let sender = Script::new_builder()
.code_hash(cell.type_hash.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(omnilock_config.build_args().pack())
.build();
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
Expand All @@ -349,7 +349,7 @@ fn build_transfer_tx(
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
let output = CellOutput::new_builder()
.lock(Script::from(&args.receiver))
.capacity(args.capacity.0.pack())
.capacity(args.capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);

Expand Down
4 changes: 2 additions & 2 deletions examples/transfer_from_sighash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
Script::new_builder()
.code_hash(SIGHASH_TYPE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(Bytes::from(hash160).pack())
.build()
};
Expand Down Expand Up @@ -116,7 +116,7 @@ fn build_transfer_tx(
// Build the transaction
let output = CellOutput::new_builder()
.lock(Script::from(&args.receiver))
.capacity(args.capacity.0.pack())
.capacity(args.capacity.0)
.build();
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
let (tx, still_locked_groups) = builder.build_unlocked(
Expand Down
10 changes: 5 additions & 5 deletions src/test_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ impl Context {
{
let cell_dep = CellDep::new_builder()
.out_point(OutPoint::new(tx.hash(), idx as u32))
.dep_type(DepType::Code.into())
.dep_type(DepType::Code)
.build();
ctx.add_cell_dep(cell_dep, output, data.raw_data(), Some(block_hash.clone()));
}
Expand All @@ -146,7 +146,7 @@ impl Context {
let group_out_point = ctx.deploy_cell(out_points.as_bytes());
let cell_dep = CellDep::new_builder()
.out_point(group_out_point)
.dep_type(DepType::DepGroup.into())
.dep_type(DepType::DepGroup)
.build();
let script_id = ScriptId::new_data1(data_hash);
ctx.add_cell_dep_map(script_id, cell_dep);
Expand Down Expand Up @@ -204,7 +204,7 @@ impl Context {
.as_u64()
});
let output = CellOutput::new_builder()
.capacity(capacity.pack())
.capacity(capacity)
.lock(lock_script)
.build();
self.add_live_cell(input, output, Bytes::default(), None)
Expand All @@ -216,7 +216,7 @@ impl Context {
let out_point = random_out_point();
let cell_dep = CellDep::new_builder()
.out_point(out_point.clone())
.dep_type(DepType::Code.into())
.dep_type(DepType::Code)
.build();
let output = CellOutput::default();
self.add_cell_dep(cell_dep, output, data, None);
Expand Down Expand Up @@ -374,7 +374,7 @@ impl Context {
ckb2023: CKB2023::new_dev_default(),
})
.build();
let tip = HeaderBuilder::default().number(0.pack()).build();
let tip = HeaderBuilder::default().number(0).build();
let tx_verify_env = TxVerifyEnv::new_submit(&tip);

let verifier = TransactionScriptsVerifier::new(
Expand Down
24 changes: 12 additions & 12 deletions src/tests/ckb_indexer_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn test_cells_search_mode_default_partitial() {
// default with partitial args
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -60,7 +60,7 @@ fn test_cells_search_mode_prefix_partitial() {
// prefix with partitial args
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -82,7 +82,7 @@ fn test_cells_search_mode_exact_partitial() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();
// exact with partitial args
Expand All @@ -104,7 +104,7 @@ fn test_cells_search_mode_exact() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[..].pack())
.build();

Expand All @@ -127,7 +127,7 @@ fn test_get_transactions_search_mode_default() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -150,7 +150,7 @@ fn test_get_transactions_search_mode_prefix_partial() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -172,7 +172,7 @@ fn test_get_transactions_search_mode_exact_partitial() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -195,7 +195,7 @@ fn test_get_transactions_search_mode_exact_full() {
// exact search
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[..].pack())
.build();

Expand All @@ -217,7 +217,7 @@ fn test_get_cells_capacity_search_mode_default() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -238,7 +238,7 @@ fn test_get_cells_capacity_search_mode_prefix_partial() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();

Expand All @@ -259,7 +259,7 @@ fn test_get_cells_capacity_search_mode_exact_partital() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[0..2].pack())
.build();
// exact with partitial args
Expand All @@ -280,7 +280,7 @@ fn test_get_cells_capacity_search_mode_exact() {
let block_range = Some(ValueRangeOption::new(0, 1));
let script = ckb_types::packed::Script::new_builder()
.code_hash(CODE_HASH.pack())
.hash_type(ScriptHashType::Type.into())
.hash_type(ScriptHashType::Type)
.args(ARGS[..].pack())
.build();

Expand Down
Loading