Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: merge anychain-polkadot #136

Merged
merged 6 commits into from
Oct 9, 2023
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/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:

strategy:
matrix:
rust-version: [1.72.1]
rust-version: [1.73.0]

steps:
- name: Checkout code
Expand Down
13 changes: 7 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
[workspace]
resolver = "2"
members = [
"anychain-core",
"anychain-bitcoin",
Expand Down Expand Up @@ -27,15 +28,15 @@ blake2b_simd = "1.0.0"
bech32 = "0.9.0"
hex = "0.4.2"
libsecp256k1 = "0.7.1"
bls-signatures = "0.13.0"
bls-signatures = "0.14.0"
base58 = { version = "0.2" }
rand = { version = "0.8.5" }
rand_core = { version = "0.6.3", default-features = false }
rlp = { version = "0.5.2", features = ["derive"] }
serde_json = { version = "1.0", default-features = false, features = ["alloc"] }
sha2 = { version = "0.10.2", default-features = false }
serde = { version = "1.0", default-features = false, features = ["alloc", "derive"] }
fvm_shared = "0.8.0"
fvm_shared = "3.3.1"
data-encoding = "2.3.2"
data-encoding-macro = "0.1.12"
fvm_ipld_encoding = "0.2.2"
Expand All @@ -44,21 +45,21 @@ num-traits = "0.2.15"
lazy_static = "1.4.0"
unsigned-varint = "0.7.1"
num-bigint = "0.4.3"
anyhow = "1.0.72"
anyhow = "1.0.75"
forest_encoding = "0.2.2"
cid = "0.8.6"
base64 = "0.13.0"
base64 = "0.21.1"
bytes = "1.0"
protobuf = { version = "3.3.0" }
chrono = "0.4"
ethabi = "17.2.0"
regex = { version = "1.3" }
clap = "4.3.10"
clap = "4.4.6"
primitive-types = { version = "0.11.1", features = ["rlp"] }
rustc-hash = "1.1.0"
hmac = "0.12.1"
bs58 = { version = "0.4", default-features = false, features = ["check"] }
pbkdf2 = { version = "0.11.0", default-features = false }
pbkdf2 = { version = "0.12.1", default-features = false }
unicode-normalization = "0.1.22"
zeroize = { version = "1.5.5", default-features = false }
once_cell = { version = "1.18.0" }
Expand Down
2 changes: 1 addition & 1 deletion anychain-bitcoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-bitcoin"
description = "A Rust library for Bitcoin-focused cryptocurrency wallets, enabling seamless transactions on the Bitcoin blockchain"
version = "0.1.2"
version = "0.1.3"
keywords = ["bitcoin", "blockchain", "cryptocurrency", "wallet", "transactions"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-bitcoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ anychain-bitcoin is a Rust crate that provides a simple and efficient way to int
To use anychain-bitcoin in your Rust project, add the following to your Cargo.toml file:
```toml
[dependencies]
anychain-bitcoin = "0.1.1"
anychain-bitcoin = "0.1.3"
```

Then, import the crate in your code:
Expand Down
2 changes: 1 addition & 1 deletion anychain-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "anychain-core"
version = "0.1.2"
version = "0.1.3"
description = "A core support for cryptocurrency wallets"
categories = ["command-line-utilities", "cryptocurrency"]
keywords = ["bitcoin", "blockchain", "ethereum", "no_std"]
Expand Down
2 changes: 1 addition & 1 deletion anychain-core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ anychain-core is a Rust crate that provides core functionality for working with
To start using anychain-core, add it as a dependency in your Cargo.toml file:
```toml
[dependencies]
anychain-core = "0.1.1"
anychain-core = "0.1.3"
```

Then, import the crate in your Rust code:
Expand Down
2 changes: 1 addition & 1 deletion anychain-ethereum/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-ethereum"
description = "A Rust library for Ethereum-focused cryptocurrency wallets, enabling seamless transactions on the Ethereum blockchain"
version = "0.1.1"
version = "0.1.2"
keywords = ["blockchain", "crypto", "cryptocurrency", "ethereum", "wallet"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-ethereum/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This is the README for the anychain-ethereum crate, a Rust library that provides
To use the anychain-ethereum crate in your Rust project, add the following to your Cargo.toml file:
```toml
[dependencies]
anychain-ethereum = "0.1.1"
anychain-ethereum = "0.1.2"
```

## Usage
Expand Down
2 changes: 1 addition & 1 deletion anychain-filecoin/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-filecoin"
description = "A Rust library for Filecoin-focused cryptocurrency wallets, enabling seamless transactions on the Filecoin blockchain"
version = "0.1.1"
version = "0.1.2"
keywords = ["filecoin", "blockchain", "cryptocurrency", "wallet", "transactions"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-filecoin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ anychain-filecoin is a Rust library that provides a simple and unified interface
Add the following to your Cargo.toml file:
```toml
[dependencies]
anychain-filecoin = "0.1.1"
anychain-filecoin = "0.1.2"
```

Then run cargo build to download and compile the library.
Expand Down
14 changes: 10 additions & 4 deletions anychain-filecoin/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,7 @@ pub mod parameter_json {
use super::FilecoinAmount;
use super::FilecoinTransactionParameters;
use super::RawBytes;
use base64::{engine::general_purpose, Engine as _};
use cid::Cid;
use serde::{de, ser, Deserialize, Deserializer, Serialize, Serializer};

Expand Down Expand Up @@ -420,7 +421,7 @@ pub mod parameter_json {
gas_fee_cap: params.gas_fee_cap.clone(),
gas_premium: params.gas_premium.clone(),
method_num: params.method_num,
params: Some(base64::encode(params.params.bytes())),
params: Some(general_purpose::STANDARD.encode(params.params.bytes())),
cid: Some(params.cid().map_err(ser::Error::custom)?),
}
.serialize(serializer)
Expand All @@ -442,14 +443,17 @@ pub mod parameter_json {
gas_premium: m.gas_premium,
method_num: m.method_num,
params: RawBytes::new(
base64::decode(m.params.unwrap_or_default()).map_err(de::Error::custom)?,
general_purpose::STANDARD
.decode(m.params.unwrap_or_default())
.map_err(de::Error::custom)?,
),
})
}
}

pub mod signature_json {
use super::{FilecoinSignature, FilecoinSignatureType};
use base64::{engine::general_purpose, Engine as _};
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};

// Wrapper for serializing and deserializing a Signature from JSON.
Expand All @@ -476,7 +480,7 @@ pub mod signature_json {
{
JsonHelper {
sig_type: sig.sig_type,
bytes: base64::encode(&sig.bytes),
bytes: general_purpose::STANDARD.encode(&sig.bytes),
}
.serialize(serializer)
}
Expand All @@ -488,7 +492,9 @@ pub mod signature_json {
let JsonHelper { sig_type, bytes } = Deserialize::deserialize(deserializer)?;
Ok(FilecoinSignature {
sig_type,
bytes: base64::decode(bytes).map_err(de::Error::custom)?,
bytes: general_purpose::STANDARD
.decode(bytes)
.map_err(de::Error::custom)?,
})
}

Expand Down
2 changes: 1 addition & 1 deletion anychain-kms/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-kms"
description = "A Rust library providing Key Management Schema for AnyChain. Handles general security and signature algorithms."
version = "0.1.1"
version = "0.1.2"
keywords = ["cryptography", "security", "signature", "algorithm"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-kms/src/bip39/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ pub(crate) fn gen_random_bytes(byte_length: usize) -> Vec<u8> {
pub(crate) fn pbkdf2(input: &[u8], salt: &str) -> Vec<u8> {
let mut seed = vec![0u8; PBKDF2_BYTES];

pbkdf2::pbkdf2::<Hmac<sha2::Sha512>>(input, salt.as_bytes(), PBKDF2_ROUNDS, &mut seed);
let _ = pbkdf2::pbkdf2::<Hmac<sha2::Sha512>>(input, salt.as_bytes(), PBKDF2_ROUNDS, &mut seed);

seed
}
2 changes: 1 addition & 1 deletion anychain-ripple/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-ripple"
description = "A Rust library for interacting with the Ripple blockchain. It provides core functionalities such as transaction signing and serialization, address generation, and network communication."
version = "0.1.3"
version = "0.1.4"
keywords = ["ripple", "blockchain", "cryptocurrency", "wallet", "transactions"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-ripple/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Features
Add the following to your Cargo.toml file:
```toml
[dependencies]
anychain-ripple = "0.1.0"
anychain-ripple = "0.1.4"
```

Then run cargo build to download and compile the anychain-ripple library.
Expand Down
20 changes: 10 additions & 10 deletions anychain-ripple/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,30 +489,30 @@ impl PartialEq for SerializedType {
}
}

impl PartialOrd for SerializedType {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
impl Ord for SerializedType {
fn cmp(&self, other: &Self) -> Ordering {
let typ0 = self.typ() as u32;
let val0 = self.val();
let typ1 = other.typ() as u32;
let val1 = other.val();

if typ0 < typ1 {
Some(Ordering::Less)
Ordering::Less
} else if typ0 > typ1 {
Some(Ordering::Greater)
Ordering::Greater
} else if val0 < val1 {
Some(Ordering::Less)
Ordering::Less
} else if val0 > val1 {
Some(Ordering::Greater)
Ordering::Greater
} else {
Some(Ordering::Equal)
Ordering::Equal
}
}
}

impl Ord for SerializedType {
fn cmp(&self, other: &Self) -> Ordering {
self.partial_cmp(other).unwrap()
impl PartialOrd for SerializedType {
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
Some(self.cmp(other))
}
}

Expand Down
2 changes: 1 addition & 1 deletion anychain-tron/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "anychain-tron"
description = "A Rust library for Tron-focused cryptocurrency wallets, enabling seamless transactions on the Tron blockchain"
version = "0.2.0"
version = "0.2.1"
keywords = ["tron", "blockchain", "cryptocurrency", "wallet", "transactions"]

# Workspace inherited keys
Expand Down
2 changes: 1 addition & 1 deletion anychain-tron/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ anychain-tron is a Rust library that provides a simple and unified interface for
Add the following to your Cargo.toml file:
```toml
[dependencies]
anychain-tron = "0.1.1"
anychain-tron = "0.2.1"
```

Then, run cargo build to download and compile the library.
Expand Down
2 changes: 1 addition & 1 deletion rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[toolchain]
channel = "1.72.1"
channel = "1.73.0"
components = ["clippy", "rustfmt"]
targets = []
profile = "minimal"