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: wasm sdk build proof-of-concept #2405

Merged
merged 47 commits into from
Feb 21, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
9b94e8e
build: update wasm-bindgen-cli to 0.2.99
lklimek Dec 17, 2024
a27cdb3
build: bump wasm-bindgen-futures to 0.4.49
lklimek Dec 17, 2024
7475b09
chore(wasm-dpp): fix build
lklimek Dec 17, 2024
068a6fb
chore: dapi-grpc wasm feature
lklimek Dec 19, 2024
3f3f76d
chore: WIP
lklimek Dec 20, 2024
cc1b069
chore: some tests
lklimek Dec 20, 2024
7243de5
chore: experiments
shumkov Jan 2, 2025
c833fb0
chore: fix build issues
lklimek Jan 2, 2025
815a364
feat(wasm-sdk): wasm_channel working on browser
lklimek Jan 2, 2025
aa9ecf8
feat: fetch identity in browser
lklimek Jan 3, 2025
1d3fe75
chore: update quorum keys
lklimek Jan 6, 2025
f6df953
chore: demo fetching contract and identity
shumkov Jan 7, 2025
971c7d2
Merge branch 'v1.8-dev' into feat/wasm-dapi-sdk-client
shumkov Jan 7, 2025
4567c60
chore(wasm): expose more code as bindings
lklimek Jan 8, 2025
0a34d38
deps: rs-tenderdash abci from revision
lklimek Jan 8, 2025
d75387b
Merge remote-tracking branch 'origin/feat/wasm-dapi-sdk-client' into …
shumkov Jan 13, 2025
0417b33
build(dpp): add optimization flags to dpp wasm build script
shumkov Jan 13, 2025
d7c1ebf
deps: change rs-tenderdash-abci version
lklimek Jan 13, 2025
e243d9e
chore: fix build
lklimek Jan 13, 2025
eb29ae9
Merge remote-tracking branch 'origin/feat/wasm-dapi-sdk-client' into …
lklimek Jan 13, 2025
1471068
refactor: replace wasm feature with target_arch
lklimek Jan 13, 2025
fbf6309
chore: remove wasm feature, continued
lklimek Jan 13, 2025
4d4c6a0
chore: replace deprecated FromMilis/ToMilis
lklimek Jan 13, 2025
9df8371
chore(drive-abci): fix build
lklimek Jan 13, 2025
6cb9d19
chore: fix rs-dapi-client build
lklimek Jan 13, 2025
e315a77
Merge remote-tracking branch 'origin/v1.8-dev' into feat/wasm-sdk-poc2
lklimek Jan 13, 2025
f594438
chore: exclude wasm-sdk from cargo.toml
lklimek Jan 13, 2025
cdccee5
chore(drive-abci): fix build and tests
lklimek Jan 13, 2025
96899b5
chore(dpp): fix dpp build with no features
lklimek Jan 13, 2025
5147a41
chore: minor refactor
lklimek Jan 13, 2025
af2a843
Merge remote-tracking branch 'origin/v2.0-dev' into feat/wasm-sdk-poc
lklimek Jan 22, 2025
7b9cac4
chore: fix build error
lklimek Jan 22, 2025
b06ddce
revert(dpp): changes in from_document break tests
lklimek Jan 22, 2025
514e723
revert(dpp): rs-dpp/schema is needed for js packages tests
lklimek Jan 22, 2025
2336773
chore(wasm-sdk): cargo.toml fixes
lklimek Jan 22, 2025
e7213a7
chore: code rabbit review
lklimek Jan 23, 2025
8993532
chore(rs-dapi-client): fix rs-dapi-client tests
lklimek Jan 23, 2025
444014f
fix(dapi-grpc): wasm32 code not generated
lklimek Feb 7, 2025
00239e9
chore: re-enable bls in wasm
lklimek Feb 10, 2025
977d6e0
Merge branch 'v2.0-dev' into feat/wasm-sdk-poc
lklimek Feb 18, 2025
70d9192
fix(dpp): build fails with no-default-features
lklimek Feb 18, 2025
3230757
build: update rs-tenderdash-abci to 1.3.0
lklimek Feb 18, 2025
ab11c4a
Revert "fix(dpp): build fails with no-default-features"
lklimek Feb 18, 2025
889ec67
Merge remote-tracking branch 'origin/v2.0-dev' into feat/wasm-sdk-poc
lklimek Feb 18, 2025
1dcef33
build: update Cargo.lock
lklimek Feb 18, 2025
7f443e0
Merge branch 'v2.0-dev' into feat/wasm-sdk-poc
lklimek Feb 19, 2025
4d5d21d
Merge branch 'v2.0-dev' into feat/wasm-sdk-poc
lklimek Feb 20, 2025
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
Prev Previous commit
Next Next commit
chore(wasm-dpp): fix build
  • Loading branch information
lklimek committed Dec 17, 2024
commit 7475b091887192e98960c52570f6e2006abe1853
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 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 @@ -46,7 +45,7 @@
}
}

pub trait AssetLockProofLike {

Check warning on line 48 in packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs

View workflow job for this annotation

GitHub Actions / Rust packages (wasm-dpp) / Linting

trait `AssetLockProofLike` is never used

warning: trait `AssetLockProofLike` is never used --> packages/wasm-dpp/src/identity/state_transition/asset_lock_proof/mod.rs:48:11 | 48 | pub trait AssetLockProofLike { | ^^^^^^^^^^^^^^^^^^
fn to_object(&self) -> Result<JsValue, JsValue>;
}

Expand Down Expand Up @@ -144,13 +143,13 @@

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
Loading