Skip to content

Commit

Permalink
chore(wasm-dpp): fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
lklimek committed Dec 17, 2024
1 parent a27cdb3 commit 7475b09
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 41 deletions.
12 changes: 5 additions & 7 deletions packages/wasm-dpp/src/identity/factory_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use dpp::identity::{IdentityPublicKey, KeyID};
use dpp::serialization::ValueConvertible;
use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation;
use std::collections::BTreeMap;
use wasm_bindgen::__rt::Ref;
use wasm_bindgen::{JsCast, JsValue};

pub fn parse_public_keys(
Expand Down Expand Up @@ -47,11 +46,10 @@ pub fn parse_create_identity_update_transition_keys(
let keys: Vec<IdentityPublicKeyInCreation> = add_public_keys_array
.iter()
.map(|key| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
&key,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
&key,
"IdentityPublicKeyWithWitness",
)?;

Ok(public_key.clone().into())
})
Expand All @@ -74,7 +72,7 @@ pub fn parse_create_identity_update_transition_keys(
let keys: Vec<KeyID> = disable_public_keys_array
.iter()
.map(|key| {
let public_key_wasm: Ref<IdentityPublicKeyWasm> =
let public_key_wasm =
generic_of_js_val::<IdentityPublicKeyWasm>(&key, "IdentityPublicKey")?;
Ok(public_key_wasm.get_id())
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ pub use chain::*;
pub use instant::*;
use std::convert::TryInto;
use wasm_bindgen::JsCast;
use wasm_bindgen::__rt::Ref;

use dpp::identity::errors::UnknownAssetLockProofTypeError;
use wasm_bindgen::prelude::*;
Expand Down Expand Up @@ -144,13 +143,13 @@ pub fn create_asset_lock_proof_from_wasm_instance(

match lock_type {
AssetLockProofType::Instant => {
let instant: Ref<InstantAssetLockProofWasm> =
let instant =
generic_of_js_val::<InstantAssetLockProofWasm>(js_value, "InstantAssetLockProof")?;

Ok(AssetLockProof::Instant(instant.clone().into()))
}
AssetLockProofType::Chain => {
let chain: Ref<ChainAssetLockProofWasm> =
let chain =
generic_of_js_val::<ChainAssetLockProofWasm>(js_value, "ChainAssetLockProof")?;

Ok(AssetLockProof::Chain(chain.clone().into()))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use std::default::Default;

use wasm_bindgen::__rt::Ref;
use wasm_bindgen::prelude::*;

use crate::bls_adapter::BlsAdapter;
Expand Down Expand Up @@ -101,11 +100,10 @@ impl IdentityCreateTransitionWasm {
let public_keys = public_keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand All @@ -120,11 +118,10 @@ impl IdentityCreateTransitionWasm {
let mut public_keys = public_keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,12 @@
use std::convert::TryInto;
use std::default::Default;

use serde::{Deserialize, Serialize};

use wasm_bindgen::__rt::Ref;
use wasm_bindgen::prelude::*;

use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};
use crate::errors::from_dpp_err;
use crate::identifier::IdentifierWrapper;

use crate::utils::{generic_of_js_val, WithJsError};
use crate::{
buffer::Buffer,
identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm,
identity::IdentityPublicKeyWasm, with_js_error,
};

use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};

use crate::utils::{generic_of_js_val, WithJsError};

use crate::errors::from_dpp_err;
use dpp::errors::consensus::signature::SignatureError;
use dpp::errors::consensus::ConsensusError;
use dpp::errors::ProtocolError;
Expand All @@ -34,6 +22,10 @@ use dpp::state_transition::StateTransition;
use dpp::state_transition::StateTransitionIdentitySigned;
use dpp::version::PlatformVersion;
use dpp::{identifier::Identifier, state_transition::StateTransitionLike};
use serde::{Deserialize, Serialize};
use std::convert::TryInto;
use std::default::Default;
use wasm_bindgen::prelude::*;

#[wasm_bindgen(js_name=IdentityUpdateTransition)]
#[derive(Clone)]
Expand Down Expand Up @@ -93,11 +85,10 @@ impl IdentityUpdateTransitionWasm {
keys_to_add = keys
.iter()
.map(|value| {
let public_key: Ref<IdentityPublicKeyWithWitnessWasm> =
generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
value,
"IdentityPublicKeyWithWitness",
)?;
Ok(public_key.clone().into())
})
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
Expand Down

0 comments on commit 7475b09

Please sign in to comment.