Skip to content

Commit

Permalink
remove bs58 dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldelucia committed Jun 27, 2024
1 parent a0d0850 commit c4ff2a8
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 25 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/rs-sdk/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ lru = { version = "0.12.3", optional = true }
bip37-bloom-filter = { git = "https://github.com/dashpay/rs-bip37-bloom-filter", branch = "develop" }
pollster = { version = "0.3.0" }
sha2 = "0.10.8"
bs58 = "0.5.0"

[dev-dependencies]
tokio = { version = "1.36.0", features = ["macros", "rt-multi-thread"] }
Expand Down
41 changes: 18 additions & 23 deletions packages/rs-sdk/src/platform/transition/vote.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use dapi_grpc::platform::VersionedGrpcResponse;
use dpp::identity::hash::IdentityPublicKeyHashMethodsV0;
use dpp::identity::signer::Signer;
use dpp::identity::IdentityPublicKey;
use dpp::platform_value::string_encoding::Encoding;
use dpp::prelude::Identifier;
use dpp::state_transition::masternode_vote_transition::methods::MasternodeVoteTransitionMethodsV0;
use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition;
Expand Down Expand Up @@ -58,17 +57,15 @@ impl<S: Signer> PutVote<S> for Vote {
hasher.update(voter_pro_tx_hash.as_bytes());
hasher.update(pub_key_hash);
let voting_identity_id_hashed = hasher.finalize();
let voting_identity_id_bs58 = bs58::encode(voting_identity_id_hashed).into_string();
let voting_identity_id =
match Identifier::from_string(&voting_identity_id_bs58, Encoding::Base58) {
Ok(id) => id,
Err(e) => {
return Err(Error::Generic(format!(
"Couldn't convert id string to Identifier: {}",
e
)))
}
};
let voting_identity_id = match Identifier::from_bytes(&voting_identity_id_hashed) {
Ok(id) => id,
Err(e) => {
return Err(Error::Generic(format!(
"Couldn't convert id string to Identifier: {}",
e
)))
}
};

let new_masternode_voting_nonce = sdk
.get_identity_nonce(voting_identity_id, true, settings)
Expand Down Expand Up @@ -106,17 +103,15 @@ impl<S: Signer> PutVote<S> for Vote {
hasher.update(voter_pro_tx_hash.as_bytes());
hasher.update(pub_key_hash);
let voting_identity_id_hashed = hasher.finalize();
let voting_identity_id_bs58 = bs58::encode(voting_identity_id_hashed).into_string();
let voting_identity_id =
match Identifier::from_string(&voting_identity_id_bs58, Encoding::Base58) {
Ok(id) => id,
Err(e) => {
return Err(Error::Generic(format!(
"Couldn't convert id string to Identifier: {}",
e
)))
}
};
let voting_identity_id = match Identifier::from_bytes(&voting_identity_id_hashed) {
Ok(id) => id,
Err(e) => {
return Err(Error::Generic(format!(
"Couldn't convert id string to Identifier: {}",
e
)))
}
};

let new_masternode_voting_nonce = sdk
.get_identity_nonce(voting_identity_id, true, settings)
Expand Down

0 comments on commit c4ff2a8

Please sign in to comment.