Skip to content

Commit 437b0e2

Browse files
use re-exports from multikey
1 parent 5cfcf0d commit 437b0e2

File tree

8 files changed

+27
-17
lines changed

8 files changed

+27
-17
lines changed

Cargo.toml

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,7 @@ default = ["serde"]
1313
dag_cbor = ["serde_cbor", "serde_cbor/tags"]
1414

1515
[dependencies]
16-
multibase = { version = "1.0", git = "https://github.com/cryptidtech/rust-multibase.git" }
17-
multicodec = { version = "1.0", git = "https://github.com/cryptidtech/rust-multicodec.git" }
18-
multihash = { version = "1.0", git = "https://github.com/DougAnderson444/multihash.git", branch = "hash-impl" }
1916
multikey = { version = "1.0", git = "https://github.com/DougAnderson444/multikey.git", branch = "deps" }
20-
multisig = { version = "1.0", git = "https://github.com/DougAnderson444/multisig.git" }
21-
multitrait = { version = "1.0", git = "https://github.com/cryptidtech/multitrait.git" }
22-
multiutil = { version = "1.0", git = "https://github.com/cryptidtech/multiutil.git" }
2317
rand = "0.8"
2418
serde = { version = "1.0", default-features = false, features = [
2519
"alloc",

src/cid.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Idnetifier: Apache-2.0
2+
use super::*;
23
use crate::{error::CidError, Error};
34
use core::fmt;
45
use multibase::Base;

src/error.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
// SPDX-License-Idnetifier: Apache-2.0
2+
use super::*;
23

34
/// Errors created by this library
45
#[derive(Clone, Debug, thiserror::Error)]

src/lib.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ pub mod prelude {
3333
pub use multicodec::Codec;
3434
pub use multiutil::BaseEncoded;
3535
}
36+
37+
// Re-export all multi* crates to avoid dependency conflicts
38+
//pub use multicrates::{multibase, multicodec, multihash, multisig, multitrait, multiutil};
39+
pub use multikey::multicrates::*;

src/serde/de.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
// SPDX-License-Idnetifier: Apache-2.0
2+
use super::{multicodec, multihash};
23
use crate::{vlad, Cid, Vlad};
4+
35
use core::fmt;
46
use multicodec::Codec;
57
use multihash::Multihash;
6-
use multikey::Nonce;
78
#[cfg(feature = "dag_cbor")]
8-
use multitrait::TryDecodeFrom;
9+
use multikey::multicrates::multitrait::TryDecodeFrom;
10+
use multikey::Nonce;
911
use serde::{
1012
de::{Error, MapAccess, Visitor},
1113
Deserialize, Deserializer,

src/serde/mod.rs

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,15 @@
33
mod de;
44
mod ser;
55

6+
use super::*;
7+
68
#[cfg(test)]
79
mod tests {
8-
use crate::{cid, vlad};
10+
use super::*;
11+
use crate::{
12+
cid::{self, Cid, EncodedCid},
13+
vlad::{self, EncodedVlad, Vlad},
14+
};
915
use multicodec::Codec;
1016
use multihash::mh;
1117
use multikey::nonce;
@@ -427,13 +433,13 @@ mod tests {
427433

428434
#[test]
429435
fn test_null_cid_serde_compact() {
430-
let c = cid::Cid::null();
436+
let c = Cid::null();
431437
assert_tokens(&c.compact(), &[Token::BorrowedBytes(&[1, 0, 0, 0])]);
432438
}
433439

434440
#[test]
435441
fn test_null_cid_serde_readable() {
436-
let c = cid::Cid::null();
442+
let c = Cid::null();
437443
assert_tokens(
438444
&c.readable(),
439445
&[
@@ -462,13 +468,13 @@ mod tests {
462468

463469
#[test]
464470
fn test_encoded_null_cid_serde_readable() {
465-
let c: cid::EncodedCid = cid::Cid::null().into();
471+
let c: EncodedCid = Cid::null().into();
466472
assert_tokens(&c.readable(), &[Token::BorrowedStr("z2UzHM")]);
467473
}
468474

469475
#[test]
470476
fn test_null_vlad_serde_compact() {
471-
let v = vlad::Vlad::null();
477+
let v = Vlad::null();
472478
assert_tokens(
473479
&v.compact(),
474480
&[Token::BorrowedBytes(&[135, 36, 187, 36, 0, 1, 0, 0, 0])],
@@ -477,7 +483,7 @@ mod tests {
477483

478484
#[test]
479485
fn test_null_vlad_serde_readable() {
480-
let v = vlad::Vlad::null();
486+
let v = Vlad::null();
481487
assert_tokens(
482488
&v.readable(),
483489
&[
@@ -520,7 +526,7 @@ mod tests {
520526

521527
#[test]
522528
fn test_encoded_null_vlad_serde_readable() {
523-
let v: vlad::EncodedVlad = vlad::Vlad::null().into();
529+
let v: EncodedVlad = Vlad::null().into();
524530
assert_tokens(&v.readable(), &[Token::BorrowedStr("bq4slwjaaaeaaaaa")]);
525531
}
526532
}

src/serde/ser.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ impl ser::Serialize for Cid {
1717
} else {
1818
#[cfg(feature = "dag_cbor")]
1919
{
20-
use multicodec::Codec;
21-
20+
use multikey::multicrates::multicodec::Codec;
21+
2222
// build the byte string for DAG-CBOR according to the spec
2323
// https://github.com/ipld/specs/blob/master/block-layer/codecs/dag-cbor.md#links
2424
let mut v = Vec::new();

src/vlad.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
// SPDX-License-Idnetifier: Apache-2.0
2+
use super::*;
23
use crate::{error::VladError, Cid, Error};
4+
35
use core::fmt;
46
use multibase::Base;
57
use multicodec::Codec;

0 commit comments

Comments
 (0)