@dashevo/wasm-dpp 2.2.0-dev.2 → 3.0.0-dev.11
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 +1 -1
- package/dist/errors/patchConsensusErrors.js +3 -3
- package/dist/wasm/wasm_dpp.d.ts +2203 -1933
- package/dist/wasm/wasm_dpp.js +1504 -1360
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/errors/patchConsensusErrors.ts +3 -3
- package/lib/wasm/wasm_dpp.d.ts +2203 -1933
- package/package.json +2 -2
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +5 -3
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +5 -3
- package/src/document/state_transition/batch_transition/mod.rs +3 -3
- package/src/errors/consensus/basic/identity/invalid_credit_withdrawal_transition_core_fee_error.rs +36 -0
- package/src/errors/consensus/basic/identity/invalid_credit_withdrawal_transition_output_script_error.rs +31 -0
- package/src/errors/consensus/basic/identity/mod.rs +6 -6
- package/src/errors/consensus/basic/identity/not_implemented_credit_withdrawal_transition_pooling_error.rs +36 -0
- package/src/errors/consensus/consensus_error.rs +91 -18
- package/src/errors/consensus/signature/mod.rs +2 -0
- package/src/errors/consensus/signature/uncompressed_public_key_not_allowed_error.rs +34 -0
- package/src/identity/state_transition/identity_create_transition/to_object.rs +1 -0
- package/src/identity/state_transition/identity_create_transition/transition.rs +4 -3
- package/src/identity/state_transition/identity_credit_transfer_transition/to_object.rs +1 -1
- package/src/identity/state_transition/identity_credit_transfer_transition/transition.rs +4 -3
- package/src/identity/state_transition/identity_credit_withdrawal_transition/to_object.rs +1 -1
- package/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs +4 -3
- package/src/identity/state_transition/identity_topup_transition/to_object.rs +1 -0
- package/src/identity/state_transition/identity_topup_transition/transition.rs +3 -2
- package/src/identity/state_transition/identity_update_transition/to_object.rs +1 -1
- package/src/identity/state_transition/identity_update_transition/transition.rs +6 -5
- package/src/identity/state_transition/transition_types.rs +24 -0
- package/src/state_transition/state_transition_factory.rs +18 -0
- package/src/voting/state_transition/masternode_vote_transition/mod.rs +7 -3
- package/src/voting/state_transition/masternode_vote_transition/to_object.rs +1 -1
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +0 -36
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs +0 -31
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_pooling_error.rs +0 -36
|
@@ -18,8 +18,8 @@ use dpp::serialization::PlatformSerializable;
|
|
|
18
18
|
use dpp::state_transition::identity_update_transition::accessors::IdentityUpdateTransitionAccessorsV0;
|
|
19
19
|
use dpp::state_transition::identity_update_transition::IdentityUpdateTransition;
|
|
20
20
|
use dpp::state_transition::public_key_in_creation::IdentityPublicKeyInCreation;
|
|
21
|
-
use dpp::state_transition::StateTransition;
|
|
22
21
|
use dpp::state_transition::StateTransitionIdentitySigned;
|
|
22
|
+
use dpp::state_transition::{StateTransition, StateTransitionOwned, StateTransitionSingleSigned};
|
|
23
23
|
use dpp::version::PlatformVersion;
|
|
24
24
|
use dpp::{identifier::Identifier, state_transition::StateTransitionLike};
|
|
25
25
|
use serde::{Deserialize, Serialize};
|
|
@@ -157,7 +157,7 @@ impl IdentityUpdateTransitionWasm {
|
|
|
157
157
|
|
|
158
158
|
#[wasm_bindgen(js_name=getOwnerId)]
|
|
159
159
|
pub fn get_owner_id(&self) -> IdentifierWrapper {
|
|
160
|
-
|
|
160
|
+
self.0.owner_id().to_owned().into()
|
|
161
161
|
}
|
|
162
162
|
|
|
163
163
|
#[wasm_bindgen(js_name=getUserFeeIncrease)]
|
|
@@ -408,7 +408,8 @@ impl IdentityUpdateTransitionWasm {
|
|
|
408
408
|
.sign_by_private_key(private_key.as_slice(), key_type, &bls_adapter)
|
|
409
409
|
.with_js_error()?;
|
|
410
410
|
|
|
411
|
-
self.0
|
|
411
|
+
self.0
|
|
412
|
+
.set_signature(wrapper.signature().unwrap().to_owned());
|
|
412
413
|
|
|
413
414
|
Ok(())
|
|
414
415
|
}
|
|
@@ -462,7 +463,7 @@ impl IdentityUpdateTransitionWasm {
|
|
|
462
463
|
)
|
|
463
464
|
.with_js_error()?;
|
|
464
465
|
|
|
465
|
-
let signature = state_transition.signature().to_owned();
|
|
466
|
+
let signature = state_transition.signature().unwrap().to_owned();
|
|
466
467
|
let signature_public_key_id = state_transition.signature_public_key_id().unwrap_or(0);
|
|
467
468
|
|
|
468
469
|
self.0.set_signature(signature);
|
|
@@ -480,7 +481,7 @@ impl IdentityUpdateTransitionWasm {
|
|
|
480
481
|
let bls_adapter = BlsAdapter(bls);
|
|
481
482
|
|
|
482
483
|
let verification_result = StateTransition::IdentityUpdate(self.0.clone())
|
|
483
|
-
.
|
|
484
|
+
.verify_identity_signed_signature(&identity_public_key.to_owned().into(), &bls_adapter);
|
|
484
485
|
|
|
485
486
|
match verification_result {
|
|
486
487
|
Ok(()) => Ok(true),
|
|
@@ -13,6 +13,12 @@ pub enum StateTransitionTypeWasm {
|
|
|
13
13
|
IdentityCreditWithdrawal = 6,
|
|
14
14
|
IdentityCreditTransfer = 7,
|
|
15
15
|
MasternodeVote = 8,
|
|
16
|
+
IdentityCreditTransferToAddresses = 9,
|
|
17
|
+
IdentityCreateFromAddresses = 10,
|
|
18
|
+
IdentityTopUpFromAddresses = 11,
|
|
19
|
+
AddressFundsTransfer = 12,
|
|
20
|
+
AddressFundingFromAssetLock = 13,
|
|
21
|
+
AddressCreditWithdrawal = 14,
|
|
16
22
|
}
|
|
17
23
|
|
|
18
24
|
impl From<StateTransitionType> for StateTransitionTypeWasm {
|
|
@@ -31,6 +37,24 @@ impl From<StateTransitionType> for StateTransitionTypeWasm {
|
|
|
31
37
|
StateTransitionTypeWasm::IdentityCreditTransfer
|
|
32
38
|
}
|
|
33
39
|
StateTransitionType::MasternodeVote => StateTransitionTypeWasm::MasternodeVote,
|
|
40
|
+
StateTransitionType::IdentityCreditTransferToAddresses => {
|
|
41
|
+
StateTransitionTypeWasm::IdentityCreditTransferToAddresses
|
|
42
|
+
}
|
|
43
|
+
StateTransitionType::IdentityCreateFromAddresses => {
|
|
44
|
+
StateTransitionTypeWasm::IdentityCreateFromAddresses
|
|
45
|
+
}
|
|
46
|
+
StateTransitionType::IdentityTopUpFromAddresses => {
|
|
47
|
+
StateTransitionTypeWasm::IdentityTopUpFromAddresses
|
|
48
|
+
}
|
|
49
|
+
StateTransitionType::AddressFundsTransfer => {
|
|
50
|
+
StateTransitionTypeWasm::AddressFundsTransfer
|
|
51
|
+
}
|
|
52
|
+
StateTransitionType::AddressFundingFromAssetLock => {
|
|
53
|
+
StateTransitionTypeWasm::AddressFundingFromAssetLock
|
|
54
|
+
}
|
|
55
|
+
StateTransitionType::AddressCreditWithdrawal => {
|
|
56
|
+
StateTransitionTypeWasm::AddressCreditWithdrawal
|
|
57
|
+
}
|
|
34
58
|
}
|
|
35
59
|
}
|
|
36
60
|
}
|
|
@@ -61,6 +61,24 @@ impl StateTransitionFactoryWasm {
|
|
|
61
61
|
StateTransition::MasternodeVote(st) => {
|
|
62
62
|
Ok(MasternodeVoteTransitionWasm::from(st).into())
|
|
63
63
|
}
|
|
64
|
+
StateTransition::IdentityCreditTransferToAddresses(st) => {
|
|
65
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
66
|
+
}
|
|
67
|
+
StateTransition::IdentityCreateFromAddresses(st) => {
|
|
68
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
69
|
+
}
|
|
70
|
+
StateTransition::IdentityTopUpFromAddresses(st) => {
|
|
71
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
72
|
+
}
|
|
73
|
+
StateTransition::AddressFundsTransfer(st) => {
|
|
74
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
75
|
+
}
|
|
76
|
+
StateTransition::AddressFundingFromAssetLock(st) => {
|
|
77
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
78
|
+
}
|
|
79
|
+
StateTransition::AddressCreditWithdrawal(st) => {
|
|
80
|
+
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
81
|
+
}
|
|
64
82
|
},
|
|
65
83
|
Err(dpp::ProtocolError::StateTransitionError(e)) => match e {
|
|
66
84
|
StateTransitionError::InvalidStateTransitionError {
|
|
@@ -13,7 +13,10 @@ use dpp::platform_value::{string_encoding, BinaryData};
|
|
|
13
13
|
use dpp::serialization::PlatformSerializable;
|
|
14
14
|
use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0;
|
|
15
15
|
use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition;
|
|
16
|
-
use dpp::state_transition::{
|
|
16
|
+
use dpp::state_transition::{
|
|
17
|
+
StateTransition, StateTransitionIdentitySigned, StateTransitionLike, StateTransitionOwned,
|
|
18
|
+
StateTransitionSingleSigned,
|
|
19
|
+
};
|
|
17
20
|
use dpp::version::PlatformVersion;
|
|
18
21
|
use dpp::voting::vote_polls::VotePoll;
|
|
19
22
|
use dpp::voting::votes::resource_vote::accessors::v0::ResourceVoteGettersV0;
|
|
@@ -333,7 +336,8 @@ impl MasternodeVoteTransitionWasm {
|
|
|
333
336
|
.sign_by_private_key(private_key.as_slice(), key_type, &bls_adapter)
|
|
334
337
|
.with_js_error()?;
|
|
335
338
|
|
|
336
|
-
self.0
|
|
339
|
+
self.0
|
|
340
|
+
.set_signature(wrapper.signature().unwrap().to_owned());
|
|
337
341
|
|
|
338
342
|
Ok(())
|
|
339
343
|
}
|
|
@@ -368,7 +372,7 @@ impl MasternodeVoteTransitionWasm {
|
|
|
368
372
|
)
|
|
369
373
|
.with_js_error()?;
|
|
370
374
|
|
|
371
|
-
let signature = state_transition.signature().to_owned();
|
|
375
|
+
let signature = state_transition.signature().unwrap().to_owned();
|
|
372
376
|
let signature_public_key_id = state_transition.signature_public_key_id().unwrap_or(0);
|
|
373
377
|
|
|
374
378
|
self.0.set_signature(signature);
|
|
@@ -2,7 +2,7 @@ use dpp::identity::KeyID;
|
|
|
2
2
|
|
|
3
3
|
use dpp::state_transition::masternode_vote_transition::accessors::MasternodeVoteTransitionAccessorsV0;
|
|
4
4
|
use dpp::state_transition::masternode_vote_transition::MasternodeVoteTransition;
|
|
5
|
-
use dpp::state_transition::StateTransitionIdentitySigned;
|
|
5
|
+
use dpp::state_transition::{StateTransitionIdentitySigned, StateTransitionSingleSigned};
|
|
6
6
|
use dpp::voting::votes::Vote;
|
|
7
7
|
use dpp::{identifier::Identifier, state_transition::StateTransitionLike};
|
|
8
8
|
use serde::Deserialize;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
use dpp::consensus::basic::identity::InvalidIdentityCreditWithdrawalTransitionCoreFeeError;
|
|
2
|
-
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
-
use dpp::consensus::ConsensusError;
|
|
4
|
-
|
|
5
|
-
use wasm_bindgen::prelude::*;
|
|
6
|
-
|
|
7
|
-
#[wasm_bindgen(js_name=InvalidIdentityCreditWithdrawalTransitionCoreFeeError)]
|
|
8
|
-
pub struct InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm {
|
|
9
|
-
inner: InvalidIdentityCreditWithdrawalTransitionCoreFeeError,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
impl From<&InvalidIdentityCreditWithdrawalTransitionCoreFeeError>
|
|
13
|
-
for InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm
|
|
14
|
-
{
|
|
15
|
-
fn from(e: &InvalidIdentityCreditWithdrawalTransitionCoreFeeError) -> Self {
|
|
16
|
-
Self { inner: e.clone() }
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#[wasm_bindgen(js_class=InvalidIdentityCreditWithdrawalTransitionCoreFeeError)]
|
|
21
|
-
impl InvalidIdentityCreditWithdrawalTransitionCoreFeeErrorWasm {
|
|
22
|
-
#[wasm_bindgen(js_name=getCoreFee)]
|
|
23
|
-
pub fn core_fee_per_byte(&self) -> u32 {
|
|
24
|
-
self.inner.core_fee_per_byte()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
#[wasm_bindgen(js_name=getCode)]
|
|
28
|
-
pub fn get_code(&self) -> u32 {
|
|
29
|
-
ConsensusError::from(self.inner.clone()).code()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#[wasm_bindgen(getter)]
|
|
33
|
-
pub fn message(&self) -> String {
|
|
34
|
-
self.inner.to_string()
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
use dpp::consensus::basic::identity::InvalidIdentityCreditWithdrawalTransitionOutputScriptError;
|
|
2
|
-
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
-
use dpp::consensus::ConsensusError;
|
|
4
|
-
|
|
5
|
-
use wasm_bindgen::prelude::*;
|
|
6
|
-
|
|
7
|
-
#[wasm_bindgen(js_name=InvalidIdentityCreditWithdrawalTransitionOutputScriptError)]
|
|
8
|
-
pub struct InvalidIdentityCreditWithdrawalTransitionOutputScriptErrorWasm {
|
|
9
|
-
inner: InvalidIdentityCreditWithdrawalTransitionOutputScriptError,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
impl From<&InvalidIdentityCreditWithdrawalTransitionOutputScriptError>
|
|
13
|
-
for InvalidIdentityCreditWithdrawalTransitionOutputScriptErrorWasm
|
|
14
|
-
{
|
|
15
|
-
fn from(e: &InvalidIdentityCreditWithdrawalTransitionOutputScriptError) -> Self {
|
|
16
|
-
Self { inner: e.clone() }
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#[wasm_bindgen(js_class=InvalidIdentityCreditWithdrawalTransitionOutputScriptError)]
|
|
21
|
-
impl InvalidIdentityCreditWithdrawalTransitionOutputScriptErrorWasm {
|
|
22
|
-
#[wasm_bindgen(js_name=getCode)]
|
|
23
|
-
pub fn code(&self) -> u32 {
|
|
24
|
-
ConsensusError::from(self.inner.clone()).code()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
#[wasm_bindgen(getter)]
|
|
28
|
-
pub fn message(&self) -> String {
|
|
29
|
-
self.inner.to_string()
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
use dpp::consensus::basic::identity::NotImplementedIdentityCreditWithdrawalTransitionPoolingError;
|
|
2
|
-
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
-
use dpp::consensus::ConsensusError;
|
|
4
|
-
|
|
5
|
-
use wasm_bindgen::prelude::*;
|
|
6
|
-
|
|
7
|
-
#[wasm_bindgen(js_name=NotImplementedIdentityCreditWithdrawalTransitionPoolingError)]
|
|
8
|
-
pub struct NotImplementedIdentityCreditWithdrawalTransitionPoolingErrorWasm {
|
|
9
|
-
inner: NotImplementedIdentityCreditWithdrawalTransitionPoolingError,
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
impl From<&NotImplementedIdentityCreditWithdrawalTransitionPoolingError>
|
|
13
|
-
for NotImplementedIdentityCreditWithdrawalTransitionPoolingErrorWasm
|
|
14
|
-
{
|
|
15
|
-
fn from(e: &NotImplementedIdentityCreditWithdrawalTransitionPoolingError) -> Self {
|
|
16
|
-
Self { inner: e.clone() }
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
#[wasm_bindgen(js_class=NotImplementedIdentityCreditWithdrawalTransitionPoolingError)]
|
|
21
|
-
impl NotImplementedIdentityCreditWithdrawalTransitionPoolingErrorWasm {
|
|
22
|
-
#[wasm_bindgen(js_name=getPooling)]
|
|
23
|
-
pub fn pooling(&self) -> u8 {
|
|
24
|
-
self.inner.pooling()
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
#[wasm_bindgen(js_name=getCode)]
|
|
28
|
-
pub fn code(&self) -> u32 {
|
|
29
|
-
ConsensusError::from(self.inner.clone()).code()
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
#[wasm_bindgen(getter)]
|
|
33
|
-
pub fn message(&self) -> String {
|
|
34
|
-
self.inner.to_string()
|
|
35
|
-
}
|
|
36
|
-
}
|