@dashevo/wasm-dpp 1.7.1 → 1.8.0-dev.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Cargo.toml +4 -4
- package/README.md +1 -1
- package/dist/index.js +1 -1
- package/dist/wasm/wasm_dpp.d.ts +1391 -4683
- package/dist/wasm/wasm_dpp.js +2250 -2463
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/index.ts +1 -1
- package/lib/wasm/wasm_dpp.d.ts +1391 -4683
- package/package.json +2 -2
- package/scripts/build-wasm.sh +6 -5
- package/src/identity/factory_utils.rs +5 -7
- package/src/identity/state_transition/asset_lock_proof/mod.rs +2 -3
- package/src/identity/state_transition/identity_create_transition/identity_create_transition.rs +8 -11
- package/src/identity/state_transition/identity_update_transition/identity_update_transition.rs +11 -20
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/wasm-dpp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-dev.2",
|
|
4
4
|
"description": "The JavaScript implementation of the Dash Platform Protocol",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"@babel/core": "^7.23.3",
|
|
45
45
|
"@babel/preset-env": "^7.23.3",
|
|
46
46
|
"@dashevo/dashcore-lib": "~0.22.0",
|
|
47
|
-
"@dashevo/dpns-contract": "1.
|
|
47
|
+
"@dashevo/dpns-contract": "1.8.0-dev.2",
|
|
48
48
|
"@types/bs58": "^4.0.1",
|
|
49
49
|
"@types/node": "^14.6.0",
|
|
50
50
|
"@yarnpkg/pnpify": "^4.0.0-rc.42",
|
package/scripts/build-wasm.sh
CHANGED
|
@@ -47,8 +47,9 @@ fi
|
|
|
47
47
|
# EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry" cargo build --target=wasm32-unknown-emscripten --release
|
|
48
48
|
# EMCC_CFLAGS="-s ERROR_ON_UNDEFINED_SYMBOLS=0 --no-entry" wasm-bindgen --out-dir=wasm --target=web --omit-default-module-path ../../target/wasm32-unknown-emscripten/release/wasm_dpp.wasm
|
|
49
49
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
50
|
+
if command -v wasm-opt &> /dev/null; then
|
|
51
|
+
echo "Optimizing wasm using Binaryen"
|
|
52
|
+
wasm-opt -Oz "$OUTPUT_FILE" -o "$OUTPUT_FILE"
|
|
53
|
+
else
|
|
54
|
+
echo "wasm-opt command not found. Skipping wasm optimization."
|
|
55
|
+
fi
|
|
@@ -9,7 +9,6 @@ use dpp::identity::{IdentityPublicKey, KeyID};
|
|
|
9
9
|
use dpp::serialization::ValueConvertible;
|
|
10
10
|
use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation;
|
|
11
11
|
use std::collections::BTreeMap;
|
|
12
|
-
use wasm_bindgen::__rt::Ref;
|
|
13
12
|
use wasm_bindgen::{JsCast, JsValue};
|
|
14
13
|
|
|
15
14
|
pub fn parse_public_keys(
|
|
@@ -47,11 +46,10 @@ pub fn parse_create_identity_update_transition_keys(
|
|
|
47
46
|
let keys: Vec<IdentityPublicKeyInCreation> = add_public_keys_array
|
|
48
47
|
.iter()
|
|
49
48
|
.map(|key| {
|
|
50
|
-
let public_key
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
)?;
|
|
49
|
+
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
|
|
50
|
+
&key,
|
|
51
|
+
"IdentityPublicKeyWithWitness",
|
|
52
|
+
)?;
|
|
55
53
|
|
|
56
54
|
Ok(public_key.clone().into())
|
|
57
55
|
})
|
|
@@ -74,7 +72,7 @@ pub fn parse_create_identity_update_transition_keys(
|
|
|
74
72
|
let keys: Vec<KeyID> = disable_public_keys_array
|
|
75
73
|
.iter()
|
|
76
74
|
.map(|key| {
|
|
77
|
-
let public_key_wasm
|
|
75
|
+
let public_key_wasm =
|
|
78
76
|
generic_of_js_val::<IdentityPublicKeyWasm>(&key, "IdentityPublicKey")?;
|
|
79
77
|
Ok(public_key_wasm.get_id())
|
|
80
78
|
})
|
|
@@ -5,7 +5,6 @@ pub use chain::*;
|
|
|
5
5
|
pub use instant::*;
|
|
6
6
|
use std::convert::TryInto;
|
|
7
7
|
use wasm_bindgen::JsCast;
|
|
8
|
-
use wasm_bindgen::__rt::Ref;
|
|
9
8
|
|
|
10
9
|
use dpp::identity::errors::UnknownAssetLockProofTypeError;
|
|
11
10
|
use wasm_bindgen::prelude::*;
|
|
@@ -144,13 +143,13 @@ pub fn create_asset_lock_proof_from_wasm_instance(
|
|
|
144
143
|
|
|
145
144
|
match lock_type {
|
|
146
145
|
AssetLockProofType::Instant => {
|
|
147
|
-
let instant
|
|
146
|
+
let instant =
|
|
148
147
|
generic_of_js_val::<InstantAssetLockProofWasm>(js_value, "InstantAssetLockProof")?;
|
|
149
148
|
|
|
150
149
|
Ok(AssetLockProof::Instant(instant.clone().into()))
|
|
151
150
|
}
|
|
152
151
|
AssetLockProofType::Chain => {
|
|
153
|
-
let chain
|
|
152
|
+
let chain =
|
|
154
153
|
generic_of_js_val::<ChainAssetLockProofWasm>(js_value, "ChainAssetLockProof")?;
|
|
155
154
|
|
|
156
155
|
Ok(AssetLockProof::Chain(chain.clone().into()))
|
package/src/identity/state_transition/identity_create_transition/identity_create_transition.rs
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
use std::default::Default;
|
|
2
2
|
|
|
3
|
-
use wasm_bindgen::__rt::Ref;
|
|
4
3
|
use wasm_bindgen::prelude::*;
|
|
5
4
|
|
|
6
5
|
use crate::bls_adapter::BlsAdapter;
|
|
@@ -101,11 +100,10 @@ impl IdentityCreateTransitionWasm {
|
|
|
101
100
|
let public_keys = public_keys
|
|
102
101
|
.iter()
|
|
103
102
|
.map(|value| {
|
|
104
|
-
let public_key
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
)?;
|
|
103
|
+
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
|
|
104
|
+
value,
|
|
105
|
+
"IdentityPublicKeyWithWitness",
|
|
106
|
+
)?;
|
|
109
107
|
Ok(public_key.clone().into())
|
|
110
108
|
})
|
|
111
109
|
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
|
|
@@ -120,11 +118,10 @@ impl IdentityCreateTransitionWasm {
|
|
|
120
118
|
let mut public_keys = public_keys
|
|
121
119
|
.iter()
|
|
122
120
|
.map(|value| {
|
|
123
|
-
let public_key
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
)?;
|
|
121
|
+
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
|
|
122
|
+
value,
|
|
123
|
+
"IdentityPublicKeyWithWitness",
|
|
124
|
+
)?;
|
|
128
125
|
Ok(public_key.clone().into())
|
|
129
126
|
})
|
|
130
127
|
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
|
package/src/identity/state_transition/identity_update_transition/identity_update_transition.rs
CHANGED
|
@@ -1,24 +1,12 @@
|
|
|
1
|
-
use
|
|
2
|
-
use
|
|
3
|
-
|
|
4
|
-
use serde::{Deserialize, Serialize};
|
|
5
|
-
|
|
6
|
-
use wasm_bindgen::__rt::Ref;
|
|
7
|
-
use wasm_bindgen::prelude::*;
|
|
8
|
-
|
|
1
|
+
use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};
|
|
2
|
+
use crate::errors::from_dpp_err;
|
|
9
3
|
use crate::identifier::IdentifierWrapper;
|
|
10
|
-
|
|
4
|
+
use crate::utils::{generic_of_js_val, WithJsError};
|
|
11
5
|
use crate::{
|
|
12
6
|
buffer::Buffer,
|
|
13
7
|
identity::state_transition::identity_public_key_transitions::IdentityPublicKeyWithWitnessWasm,
|
|
14
8
|
identity::IdentityPublicKeyWasm, with_js_error,
|
|
15
9
|
};
|
|
16
|
-
|
|
17
|
-
use crate::bls_adapter::{BlsAdapter, JsBlsAdapter};
|
|
18
|
-
|
|
19
|
-
use crate::utils::{generic_of_js_val, WithJsError};
|
|
20
|
-
|
|
21
|
-
use crate::errors::from_dpp_err;
|
|
22
10
|
use dpp::errors::consensus::signature::SignatureError;
|
|
23
11
|
use dpp::errors::consensus::ConsensusError;
|
|
24
12
|
use dpp::errors::ProtocolError;
|
|
@@ -34,6 +22,10 @@ use dpp::state_transition::StateTransition;
|
|
|
34
22
|
use dpp::state_transition::StateTransitionIdentitySigned;
|
|
35
23
|
use dpp::version::PlatformVersion;
|
|
36
24
|
use dpp::{identifier::Identifier, state_transition::StateTransitionLike};
|
|
25
|
+
use serde::{Deserialize, Serialize};
|
|
26
|
+
use std::convert::TryInto;
|
|
27
|
+
use std::default::Default;
|
|
28
|
+
use wasm_bindgen::prelude::*;
|
|
37
29
|
|
|
38
30
|
#[wasm_bindgen(js_name=IdentityUpdateTransition)]
|
|
39
31
|
#[derive(Clone)]
|
|
@@ -93,11 +85,10 @@ impl IdentityUpdateTransitionWasm {
|
|
|
93
85
|
keys_to_add = keys
|
|
94
86
|
.iter()
|
|
95
87
|
.map(|value| {
|
|
96
|
-
let public_key
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
)?;
|
|
88
|
+
let public_key = generic_of_js_val::<IdentityPublicKeyWithWitnessWasm>(
|
|
89
|
+
value,
|
|
90
|
+
"IdentityPublicKeyWithWitness",
|
|
91
|
+
)?;
|
|
101
92
|
Ok(public_key.clone().into())
|
|
102
93
|
})
|
|
103
94
|
.collect::<Result<Vec<IdentityPublicKeyInCreation>, JsValue>>()?;
|