Skip to content

Commit 3a418e7

Browse files
authored
chore: use ckb 1.0.0 crates (#156)
* chore: use ckb 1.0.0 crates * chore: bump to rc2 * chore: ckb-gen-type-migrate * chore: compatibility fix * chore: ckb-gen-type-migrate * chore: cargo fmt * chore: use released ckb crates 1.0.0 * chore: bump version to 5.0.0 * chore: resolve ci issue * chore: upgrade sha3 dep * chore: clippy
1 parent 647630c commit 3a418e7

36 files changed

+187
-205
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ jobs:
7171
- name: Security Audit & Licenses
7272
run: |
7373
rustup toolchain install stable --profile minimal
74-
cargo deny --version || cargo install cargo-deny@0.17.0
74+
cargo deny --version || cargo install cargo-deny@0.17.0 --locked
7575
make security-audit
7676
make check-crates
7777
make check-licenses

Cargo.toml

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ckb-sdk"
3-
version = "4.4.0"
3+
version = "5.0.0"
44
authors = [
55
"Linfeng Qian <thewawar@gmail.com>",
66
"Nervos Core Dev <dev@nervos.org>",
@@ -32,25 +32,25 @@ dashmap = "5.4"
3232
dyn-clone = "1.0"
3333
async-trait = "0.1"
3434

35-
ckb-types = "0.202.0"
36-
ckb-dao-utils = "0.202.0"
37-
ckb-traits = "0.202.0"
38-
ckb-jsonrpc-types = "0.202.0"
39-
ckb-hash = "0.202.0"
40-
ckb-resource = "0.202.0"
35+
ckb-types = "1.0.0"
36+
ckb-dao-utils = "1.0.0"
37+
ckb-traits = "1.0.0"
38+
ckb-jsonrpc-types = "1.0.0"
39+
ckb-hash = "1.0.0"
40+
ckb-resource = "1.0.0"
4141
ckb-system-scripts-v0_5_4 = { package="ckb-system-scripts", version="=0.5.4" }
4242
ckb-system-scripts-v0_6_0 = { package="ckb-system-scripts", version="=0.6.0" }
43-
ckb-crypto = { version = "=0.202.0", features = ["secp"] }
44-
ckb-script = "0.202.0"
43+
ckb-crypto = "1.0.0"
44+
ckb-script = "1.0.0"
4545
bitflags = "1.3.2"
46-
sha3 = "0.10.1"
46+
sha3 = "0.10.8"
4747
enum-repr-derive = "0.2.0"
4848
hex = "0.4"
4949

5050
# for feature test
5151
rand = { version = "0.7.3", optional = true }
52-
ckb-mock-tx-types = { version = "0.202.0" }
53-
ckb-chain-spec = "0.202.0"
52+
ckb-mock-tx-types = "1.0.0"
53+
ckb-chain-spec = "1.0.0"
5454

5555
sparse-merkle-tree = { version = "0.6", optional = true }
5656
async-iterator = "2.3.0"

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ These features allow for seamless interaction with CKB and facilitate the develo
1515
```toml
1616
# Cargo.toml
1717
[dependencies]
18-
ckb-sdk = "4.4.0"
18+
ckb-sdk = "5"
1919
```
2020

2121
## Build
@@ -124,7 +124,7 @@ let tx_dep_provider = DefaultTransactionDependencyProvider::new(ckb_rpc, 10);
124124
// Build the transaction
125125
let output = CellOutput::new_builder()
126126
.lock(Script::from(&receiver))
127-
.capacity(capacity.0.pack())
127+
.capacity(capacity.0)
128128
.build();
129129
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
130130
let (_tx, _) = builder

examples/chain_transfer_sighash.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
7474
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
7575
Script::new_builder()
7676
.code_hash(SIGHASH_TYPE_HASH.pack())
77-
.hash_type(ScriptHashType::Type.into())
77+
.hash_type(ScriptHashType::Type)
7878
.args(Bytes::from(hash160).pack())
7979
.build()
8080
};
@@ -84,7 +84,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
8484
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
8585
Script::new_builder()
8686
.code_hash(SIGHASH_TYPE_HASH.pack())
87-
.hash_type(ScriptHashType::Type.into())
87+
.hash_type(ScriptHashType::Type)
8888
.args(Bytes::from(hash160).pack())
8989
.build()
9090
};
@@ -177,7 +177,7 @@ fn build_transfer_tx(
177177
// Build the transaction
178178
let output = CellOutput::new_builder()
179179
.lock(Script::from(receiver))
180-
.capacity(capacity.pack())
180+
.capacity(capacity)
181181
.build();
182182
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
183183
let (tx, still_locked_groups) = builder.build_unlocked(

examples/deploy_script_with_type_id.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ fn build_output_and_data(deployer: &Address) -> (CellOutput, Bytes) {
6767
let type_script =
6868
ScriptId::new_type(constants::TYPE_ID_CODE_HASH.clone()).dummy_type_id_script();
6969
let dummy_output = CellOutput::new_builder()
70-
.lock(deployer.into())
70+
.lock(deployer)
7171
.type_(Some(type_script).pack())
7272
.build();
7373
let required_capacity = dummy_output

examples/transfer_from_multisig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ fn build_transfer_tx(
228228
// Build CapacityBalancer
229229
let sender = Script::new_builder()
230230
.code_hash(MultisigScript::V2.script_id().code_hash.pack())
231-
.hash_type(MultisigScript::V2.script_id().hash_type.into())
231+
.hash_type(MultisigScript::V2.script_id().hash_type)
232232
.args(Bytes::from(multisig_config.hash160().as_bytes().to_vec()).pack())
233233
.build();
234234
let sender_addr = Address::new(args.receiver.network(), sender.clone().into(), true);
@@ -254,7 +254,7 @@ fn build_transfer_tx(
254254
let unlockers = build_multisig_unlockers(Vec::new(), multisig_config.clone());
255255
let output = CellOutput::new_builder()
256256
.lock(Script::from(&args.receiver))
257-
.capacity(args.capacity.0.pack())
257+
.capacity(args.capacity.0)
258258
.build();
259259
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
260260
let tx = builder.build_balanced(

examples/transfer_from_omnilock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ fn build_transfer_tx(
266266
// Build CapacityBalancer
267267
let sender = Script::new_builder()
268268
.code_hash(cell.type_hash.pack())
269-
.hash_type(ScriptHashType::Type.into())
269+
.hash_type(ScriptHashType::Type)
270270
.args(omnilock_config.build_args().pack())
271271
.build();
272272
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
@@ -290,7 +290,7 @@ fn build_transfer_tx(
290290
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
291291
let output = CellOutput::new_builder()
292292
.lock(Script::from(&args.receiver))
293-
.capacity(args.capacity.0.pack())
293+
.capacity(args.capacity.0)
294294
.build();
295295
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
296296

examples/transfer_from_omnilock_ethereum.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fn build_transfer_tx(
273273
// Build CapacityBalancer
274274
let sender = Script::new_builder()
275275
.code_hash(cell.type_hash.pack())
276-
.hash_type(ScriptHashType::Type.into())
276+
.hash_type(ScriptHashType::Type)
277277
.args(omnilock_config.build_args().pack())
278278
.build();
279279
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
@@ -297,7 +297,7 @@ fn build_transfer_tx(
297297
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
298298
let output = CellOutput::new_builder()
299299
.lock(Script::from(&args.receiver))
300-
.capacity(args.capacity.0.pack())
300+
.capacity(args.capacity.0)
301301
.build();
302302
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
303303

examples/transfer_from_omnilock_multisig.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -325,7 +325,7 @@ fn build_transfer_tx(
325325
// Build CapacityBalancer
326326
let sender = Script::new_builder()
327327
.code_hash(cell.type_hash.pack())
328-
.hash_type(ScriptHashType::Type.into())
328+
.hash_type(ScriptHashType::Type)
329329
.args(omnilock_config.build_args().pack())
330330
.build();
331331
let placeholder_witness = omnilock_config.placeholder_witness(OmniUnlockMode::Normal)?;
@@ -349,7 +349,7 @@ fn build_transfer_tx(
349349
let unlockers = build_omnilock_unlockers(Vec::new(), omnilock_config.clone(), cell.type_hash);
350350
let output = CellOutput::new_builder()
351351
.lock(Script::from(&args.receiver))
352-
.capacity(args.capacity.0.pack())
352+
.capacity(args.capacity.0)
353353
.build();
354354
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
355355

examples/transfer_from_sighash.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ fn main() -> Result<(), Box<dyn StdErr>> {
5959
let hash160 = blake2b_256(&pubkey.serialize()[..])[0..20].to_vec();
6060
Script::new_builder()
6161
.code_hash(SIGHASH_TYPE_HASH.pack())
62-
.hash_type(ScriptHashType::Type.into())
62+
.hash_type(ScriptHashType::Type)
6363
.args(Bytes::from(hash160).pack())
6464
.build()
6565
};
@@ -116,7 +116,7 @@ fn build_transfer_tx(
116116
// Build the transaction
117117
let output = CellOutput::new_builder()
118118
.lock(Script::from(&args.receiver))
119-
.capacity(args.capacity.0.pack())
119+
.capacity(args.capacity.0)
120120
.build();
121121
let builder = CapacityTransferBuilder::new(vec![(output, Bytes::default())]);
122122
let (tx, still_locked_groups) = builder.build_unlocked(

0 commit comments

Comments
 (0)