@dashevo/wasm-dpp 3.1.0-dev.1 → 3.1.0-dev.4
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 -11
- package/babel.config.json +1 -1
- package/dist/wasm/wasm_dpp.d.ts +4859 -4003
- package/dist/wasm/wasm_dpp.js +1666 -1588
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/index.ts +0 -1
- package/lib/wasm/wasm_dpp.d.ts +4859 -4003
- package/package.json +4 -4
- package/scripts/build-wasm.sh +4 -2
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +1 -0
- package/src/data_contract/state_transition/data_contract_update_transition/mod.rs +1 -0
- package/src/document/extended_document.rs +1 -1
- package/src/document/state_transition/batch_transition/mod.rs +1 -0
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_too_many_inputs_error.rs +41 -0
- package/src/errors/consensus/basic/identity/mod.rs +2 -0
- package/src/errors/consensus/consensus_error.rs +44 -3
- package/src/errors/from.rs +1 -1
- package/src/errors/generic_consensus_error.rs +1 -1
- package/src/identity/state_transition/identity_create_transition/transition.rs +1 -0
- package/src/identity/state_transition/identity_credit_transfer_transition/transition.rs +1 -0
- package/src/identity/state_transition/identity_credit_withdrawal_transition/transition.rs +1 -0
- package/src/identity/state_transition/identity_topup_transition/transition.rs +1 -0
- package/src/identity/state_transition/identity_update_transition/transition.rs +1 -0
- package/src/identity/state_transition/transition_types.rs +1 -0
- package/src/state_transition/state_transition_factory.rs +7 -0
- package/src/voting/state_transition/masternode_vote_transition/mod.rs +6 -4
- package/test/integration/dataContract/validation/validateDataContractFactory.spec.js +2 -2
- package/test/integration/document/DocumentFacade.spec.js +1 -1
- package/test/unit/dataContract/DataContract.spec.js +6 -6
- package/test/unit/identity/Identity.spec.js +3 -3
- package/test/unit/identity/IdentityPublicKey.spec.js +2 -2
- package/tsconfig.json +1 -1
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js +0 -253
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validatePublicKeysState.spec.js +0 -100
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/wasm-dpp",
|
|
3
|
-
"version": "3.1.0-dev.
|
|
3
|
+
"version": "3.1.0-dev.4",
|
|
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,11 +44,11 @@
|
|
|
44
44
|
"@babel/core": "^7.26.10",
|
|
45
45
|
"@babel/preset-env": "^7.26.9",
|
|
46
46
|
"@dashevo/dashcore-lib": "~0.22.0",
|
|
47
|
-
"@dashevo/dpns-contract": "3.1.0-dev.
|
|
47
|
+
"@dashevo/dpns-contract": "3.1.0-dev.4",
|
|
48
48
|
"@types/bs58": "^4.0.1",
|
|
49
49
|
"@types/node": "^20.10.0",
|
|
50
50
|
"@yarnpkg/pnpify": "^4.0.0-rc.42",
|
|
51
|
-
"ajv": "^8.
|
|
51
|
+
"ajv": "^8.18.0",
|
|
52
52
|
"assert": "^2.0.0",
|
|
53
53
|
"buffer": "^6.0.3",
|
|
54
54
|
"chai": "^4.3.10",
|
|
@@ -74,7 +74,7 @@
|
|
|
74
74
|
"mocha": "^11.1.0",
|
|
75
75
|
"path-browserify": "^1.0.1",
|
|
76
76
|
"process": "^0.11.10",
|
|
77
|
-
"sinon": "^
|
|
77
|
+
"sinon": "^18.0.1",
|
|
78
78
|
"sinon-chai": "^3.7.0",
|
|
79
79
|
"stream-browserify": "^3.0.0",
|
|
80
80
|
"stream-http": "^3.2.0",
|
package/scripts/build-wasm.sh
CHANGED
|
@@ -16,8 +16,10 @@ fi
|
|
|
16
16
|
OUTPUT_DIR="${PWD}/wasm"
|
|
17
17
|
# shellcheck disable=SC2034
|
|
18
18
|
OUTPUT_FILE="${OUTPUT_DIR}/wasm_dpp_bg.wasm"
|
|
19
|
+
REPO_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/../../.." && pwd)"
|
|
20
|
+
CARGO_OUT_DIR="${CARGO_TARGET_DIR:-$REPO_ROOT/target}"
|
|
19
21
|
BUILD_COMMAND="cargo build --config net.git-fetch-with-cli=true --target=${TARGET} ${PROFILE_ARG}"
|
|
20
|
-
BINDGEN_COMMAND="wasm-bindgen --out-dir=${OUTPUT_DIR} --target=web --omit-default-module-path
|
|
22
|
+
BINDGEN_COMMAND="wasm-bindgen --out-dir=${OUTPUT_DIR} --target=web --omit-default-module-path ${CARGO_OUT_DIR}/${TARGET}/${PROFILE}/wasm_dpp.wasm"
|
|
21
23
|
|
|
22
24
|
if ! [[ -d ${OUTPUT_DIR} ]]; then
|
|
23
25
|
mkdir -p "${OUTPUT_DIR}"
|
|
@@ -49,7 +51,7 @@ fi
|
|
|
49
51
|
|
|
50
52
|
if command -v wasm-opt &> /dev/null; then
|
|
51
53
|
echo "Optimizing wasm using Binaryen"
|
|
52
|
-
|
|
54
|
+
|
|
53
55
|
# Check if we're in a release build (via CARGO_BUILD_PROFILE or GitHub event)
|
|
54
56
|
if [ "${CARGO_BUILD_PROFILE}" = "release" ] || [ "${GITHUB_EVENT_NAME:-}" = "release" ] || [ "${GITHUB_EVENT_NAME:-}" = "workflow_dispatch" ]; then
|
|
55
57
|
echo "Running full optimizations for release build (CARGO_BUILD_PROFILE=${CARGO_BUILD_PROFILE}, GITHUB_EVENT_NAME=${GITHUB_EVENT_NAME:-not_set})"
|
|
@@ -10,6 +10,7 @@ use dpp::errors::consensus::ConsensusError;
|
|
|
10
10
|
use dpp::serialization::{PlatformDeserializable, PlatformSerializable};
|
|
11
11
|
use dpp::state_transition::data_contract_create_transition::accessors::DataContractCreateTransitionAccessorsV0;
|
|
12
12
|
use dpp::state_transition::data_contract_create_transition::DataContractCreateTransition;
|
|
13
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
13
14
|
use dpp::state_transition::{
|
|
14
15
|
StateTransitionIdentitySigned, StateTransitionOwned, StateTransitionSingleSigned,
|
|
15
16
|
};
|
|
@@ -6,6 +6,7 @@ use dpp::consensus::ConsensusError;
|
|
|
6
6
|
use dpp::serialization::{PlatformDeserializable, PlatformSerializable};
|
|
7
7
|
use dpp::state_transition::data_contract_update_transition::accessors::DataContractUpdateTransitionAccessorsV0;
|
|
8
8
|
use dpp::state_transition::data_contract_update_transition::DataContractUpdateTransition;
|
|
9
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
9
10
|
use dpp::state_transition::{StateTransition, StateTransitionValueConvert};
|
|
10
11
|
use dpp::state_transition::{
|
|
11
12
|
StateTransitionIdentitySigned, StateTransitionOwned, StateTransitionSingleSigned,
|
|
@@ -19,7 +19,7 @@ use wasm_bindgen::prelude::*;
|
|
|
19
19
|
|
|
20
20
|
use crate::buffer::Buffer;
|
|
21
21
|
use crate::data_contract::DataContractWasm;
|
|
22
|
-
#[allow(deprecated)] // BinaryType is
|
|
22
|
+
#[allow(deprecated)] // BinaryType is unused in unused code below
|
|
23
23
|
use crate::document::BinaryType;
|
|
24
24
|
use crate::document::{ConversionOptions, DocumentWasm};
|
|
25
25
|
use crate::errors::RustConversionError;
|
|
@@ -14,6 +14,7 @@ use dpp::platform_value::BinaryData;
|
|
|
14
14
|
use dpp::serialization::PlatformSerializable;
|
|
15
15
|
use dpp::state_transition::batch_transition::accessors::DocumentsBatchTransitionAccessorsV0;
|
|
16
16
|
use dpp::state_transition::batch_transition::BatchTransition;
|
|
17
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
17
18
|
use dpp::state_transition::{StateTransition, StateTransitionOwned, StateTransitionSingleSigned};
|
|
18
19
|
use wasm_bindgen::prelude::*;
|
|
19
20
|
|
package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_too_many_inputs_error.rs
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
use dpp::consensus::basic::identity::IdentityAssetLockTransactionTooManyInputsError;
|
|
2
|
+
use dpp::consensus::codes::ErrorWithCode;
|
|
3
|
+
use dpp::consensus::ConsensusError;
|
|
4
|
+
|
|
5
|
+
use wasm_bindgen::prelude::*;
|
|
6
|
+
|
|
7
|
+
#[wasm_bindgen(js_name=IdentityAssetLockTransactionTooManyInputsError)]
|
|
8
|
+
pub struct IdentityAssetLockTransactionTooManyInputsErrorWasm {
|
|
9
|
+
inner: IdentityAssetLockTransactionTooManyInputsError,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl From<&IdentityAssetLockTransactionTooManyInputsError>
|
|
13
|
+
for IdentityAssetLockTransactionTooManyInputsErrorWasm
|
|
14
|
+
{
|
|
15
|
+
fn from(e: &IdentityAssetLockTransactionTooManyInputsError) -> Self {
|
|
16
|
+
Self { inner: e.clone() }
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[wasm_bindgen(js_class=IdentityAssetLockTransactionTooManyInputsError)]
|
|
21
|
+
impl IdentityAssetLockTransactionTooManyInputsErrorWasm {
|
|
22
|
+
#[wasm_bindgen(js_name=getMaxInputs)]
|
|
23
|
+
pub fn get_max_inputs(&self) -> u16 {
|
|
24
|
+
self.inner.max_inputs()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#[wasm_bindgen(js_name=getActualInputs)]
|
|
28
|
+
pub fn get_actual_inputs(&self) -> u16 {
|
|
29
|
+
self.inner.actual_inputs()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
33
|
+
pub fn get_code(&self) -> u32 {
|
|
34
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
#[wasm_bindgen(getter)]
|
|
38
|
+
pub fn message(&self) -> String {
|
|
39
|
+
self.inner.to_string()
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -5,6 +5,7 @@ mod identity_asset_lock_state_transition_replay_error;
|
|
|
5
5
|
mod identity_asset_lock_transaction_is_not_found_error;
|
|
6
6
|
mod identity_asset_lock_transaction_out_point_already_exists_error;
|
|
7
7
|
mod identity_asset_lock_transaction_output_not_found_error;
|
|
8
|
+
mod identity_asset_lock_transaction_too_many_inputs_error;
|
|
8
9
|
mod identity_credit_transfer_to_self_error;
|
|
9
10
|
mod identity_insufficient_balance_error;
|
|
10
11
|
mod invalid_asset_lock_proof_core_chain_height_error;
|
|
@@ -34,6 +35,7 @@ pub use identity_asset_lock_state_transition_replay_error::*;
|
|
|
34
35
|
pub use identity_asset_lock_transaction_is_not_found_error::*;
|
|
35
36
|
pub use identity_asset_lock_transaction_out_point_already_exists_error::*;
|
|
36
37
|
pub use identity_asset_lock_transaction_output_not_found_error::*;
|
|
38
|
+
pub use identity_asset_lock_transaction_too_many_inputs_error::*;
|
|
37
39
|
pub use identity_credit_transfer_to_self_error::*;
|
|
38
40
|
pub use identity_insufficient_balance_error::*;
|
|
39
41
|
pub use invalid_asset_lock_proof_core_chain_height_error::*;
|
|
@@ -12,7 +12,8 @@ use crate::errors::consensus::basic::identity::{
|
|
|
12
12
|
IdentityAssetLockTransactionIsNotFoundErrorWasm,
|
|
13
13
|
IdentityAssetLockTransactionOutPointAlreadyExistsErrorWasm,
|
|
14
14
|
IdentityAssetLockTransactionOutPointNotEnoughBalanceErrorWasm,
|
|
15
|
-
IdentityAssetLockTransactionOutputNotFoundErrorWasm,
|
|
15
|
+
IdentityAssetLockTransactionOutputNotFoundErrorWasm,
|
|
16
|
+
IdentityAssetLockTransactionTooManyInputsErrorWasm, IdentityCreditTransferToSelfErrorWasm,
|
|
16
17
|
IdentityInsufficientBalanceErrorWasm, InvalidAssetLockProofCoreChainHeightErrorWasm,
|
|
17
18
|
InvalidAssetLockProofTransactionHeightErrorWasm,
|
|
18
19
|
InvalidAssetLockTransactionOutputReturnSizeErrorWasm,
|
|
@@ -38,7 +39,8 @@ use dpp::consensus::basic::BasicError::{
|
|
|
38
39
|
IdentityAssetLockStateTransitionReplayError, IdentityAssetLockTransactionIsNotFoundError,
|
|
39
40
|
IdentityAssetLockTransactionOutPointAlreadyConsumedError,
|
|
40
41
|
IdentityAssetLockTransactionOutPointNotEnoughBalanceError,
|
|
41
|
-
IdentityAssetLockTransactionOutputNotFoundError,
|
|
42
|
+
IdentityAssetLockTransactionOutputNotFoundError,
|
|
43
|
+
IdentityAssetLockTransactionTooManyInputsError, IncompatibleProtocolVersionError,
|
|
42
44
|
IncompatibleRe2PatternError, InvalidAssetLockProofCoreChainHeightError,
|
|
43
45
|
InvalidAssetLockProofTransactionHeightError, InvalidAssetLockTransactionOutputReturnSizeError,
|
|
44
46
|
InvalidCreditWithdrawalTransitionCoreFeeError,
|
|
@@ -88,7 +90,12 @@ use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized
|
|
|
88
90
|
use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
|
|
89
91
|
use dpp::consensus::state::token::{IdentityDoesNotHaveEnoughTokenBalanceError, IdentityTokenAccountNotFrozenError, IdentityTokenAccountFrozenError, TokenIsPausedError, IdentityTokenAccountAlreadyFrozenError, UnauthorizedTokenActionError, TokenSettingMaxSupplyToLessThanCurrentSupplyError, TokenMintPastMaxSupplyError, NewTokensDestinationIdentityDoesNotExistError, NewAuthorizedActionTakerIdentityDoesNotExistError, NewAuthorizedActionTakerGroupDoesNotExistError, NewAuthorizedActionTakerMainGroupNotSetError, InvalidGroupPositionError, TokenAlreadyPausedError, TokenNotPausedError, InvalidTokenClaimPropertyMismatch, InvalidTokenClaimNoCurrentRewards, InvalidTokenClaimWrongClaimant, TokenTransferRecipientIdentityNotExistError, PreProgrammedDistributionTimestampInPastError, IdentityHasNotAgreedToPayRequiredTokenAmountError, RequiredTokenPaymentInfoNotSetError, IdentityTryingToPayWithWrongTokenError, TokenDirectPurchaseUserPriceTooLow, TokenAmountUnderMinimumSaleAmount, TokenNotForDirectSale, InvalidTokenPositionStateError};
|
|
90
92
|
use dpp::consensus::state::address_funds::{AddressDoesNotExistError, AddressInvalidNonceError, AddressNotEnoughFundsError, AddressesNotEnoughFundsError};
|
|
91
|
-
use dpp::consensus::
|
|
93
|
+
use dpp::consensus::state::shielded::insufficient_pool_notes_error::InsufficientPoolNotesError;
|
|
94
|
+
use dpp::consensus::state::shielded::insufficient_shielded_fee_error::InsufficientShieldedFeeError;
|
|
95
|
+
use dpp::consensus::state::shielded::invalid_anchor_error::InvalidAnchorError;
|
|
96
|
+
use dpp::consensus::state::shielded::invalid_shielded_proof_error::InvalidShieldedProofError;
|
|
97
|
+
use dpp::consensus::state::shielded::nullifier_already_spent_error::NullifierAlreadySpentError;
|
|
98
|
+
use dpp::consensus::basic::state_transition::{StateTransitionNotActiveError, TransitionOverMaxInputsError, TransitionOverMaxOutputsError, InputWitnessCountMismatchError, TransitionNoInputsError, TransitionNoOutputsError, FeeStrategyEmptyError, FeeStrategyDuplicateError, FeeStrategyIndexOutOfBoundsError, FeeStrategyTooManyStepsError, InputBelowMinimumError, OutputBelowMinimumError, InputOutputBalanceMismatchError, OutputsNotGreaterThanInputsError, WithdrawalBalanceMismatchError, InsufficientFundingAmountError, InputsNotLessThanOutputsError, OutputAddressAlsoInputError, InvalidRemainderOutputCountError, WithdrawalBelowMinAmountError, ShieldedNoActionsError, ShieldedTooManyActionsError, ShieldedEmptyProofError, ShieldedZeroAnchorError, ShieldedInvalidValueBalanceError, ShieldedEncryptedNoteSizeMismatchError};
|
|
92
99
|
use dpp::consensus::state::voting::masternode_incorrect_voter_identity_id_error::MasternodeIncorrectVoterIdentityIdError;
|
|
93
100
|
use dpp::consensus::state::voting::masternode_incorrect_voting_address_error::MasternodeIncorrectVotingAddressError;
|
|
94
101
|
use dpp::consensus::state::voting::masternode_not_found_error::MasternodeNotFoundError;
|
|
@@ -443,6 +450,19 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
443
450
|
StateError::AddressInvalidNonceError(e) => {
|
|
444
451
|
generic_consensus_error!(AddressInvalidNonceError, e).into()
|
|
445
452
|
}
|
|
453
|
+
StateError::InvalidAnchorError(e) => generic_consensus_error!(InvalidAnchorError, e).into(),
|
|
454
|
+
StateError::NullifierAlreadySpentError(e) => {
|
|
455
|
+
generic_consensus_error!(NullifierAlreadySpentError, e).into()
|
|
456
|
+
}
|
|
457
|
+
StateError::InvalidShieldedProofError(e) => {
|
|
458
|
+
generic_consensus_error!(InvalidShieldedProofError, e).into()
|
|
459
|
+
}
|
|
460
|
+
StateError::InsufficientPoolNotesError(e) => {
|
|
461
|
+
generic_consensus_error!(InsufficientPoolNotesError, e).into()
|
|
462
|
+
}
|
|
463
|
+
StateError::InsufficientShieldedFeeError(e) => {
|
|
464
|
+
generic_consensus_error!(InsufficientShieldedFeeError, e).into()
|
|
465
|
+
}
|
|
446
466
|
}
|
|
447
467
|
}
|
|
448
468
|
|
|
@@ -596,6 +616,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
596
616
|
InvalidIdentityAssetLockTransactionError(e) => {
|
|
597
617
|
InvalidIdentityAssetLockTransactionErrorWasm::from(e).into()
|
|
598
618
|
}
|
|
619
|
+
IdentityAssetLockTransactionTooManyInputsError(e) => {
|
|
620
|
+
IdentityAssetLockTransactionTooManyInputsErrorWasm::from(e).into()
|
|
621
|
+
}
|
|
599
622
|
InvalidInstantAssetLockProofError(e) => {
|
|
600
623
|
InvalidInstantAssetLockProofErrorWasm::from(e).into()
|
|
601
624
|
}
|
|
@@ -923,6 +946,24 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
923
946
|
BasicError::WithdrawalBelowMinAmountError(e) => {
|
|
924
947
|
generic_consensus_error!(WithdrawalBelowMinAmountError, e).into()
|
|
925
948
|
}
|
|
949
|
+
BasicError::ShieldedNoActionsError(e) => {
|
|
950
|
+
generic_consensus_error!(ShieldedNoActionsError, e).into()
|
|
951
|
+
}
|
|
952
|
+
BasicError::ShieldedTooManyActionsError(e) => {
|
|
953
|
+
generic_consensus_error!(ShieldedTooManyActionsError, e).into()
|
|
954
|
+
}
|
|
955
|
+
BasicError::ShieldedEmptyProofError(e) => {
|
|
956
|
+
generic_consensus_error!(ShieldedEmptyProofError, e).into()
|
|
957
|
+
}
|
|
958
|
+
BasicError::ShieldedZeroAnchorError(e) => {
|
|
959
|
+
generic_consensus_error!(ShieldedZeroAnchorError, e).into()
|
|
960
|
+
}
|
|
961
|
+
BasicError::ShieldedInvalidValueBalanceError(e) => {
|
|
962
|
+
generic_consensus_error!(ShieldedInvalidValueBalanceError, e).into()
|
|
963
|
+
}
|
|
964
|
+
BasicError::ShieldedEncryptedNoteSizeMismatchError(e) => {
|
|
965
|
+
generic_consensus_error!(ShieldedEncryptedNoteSizeMismatchError, e).into()
|
|
966
|
+
}
|
|
926
967
|
}
|
|
927
968
|
}
|
|
928
969
|
|
package/src/errors/from.rs
CHANGED
|
@@ -39,7 +39,7 @@ pub fn from_dpp_init_error(e: DashPlatformProtocolInitError) -> JsValue {
|
|
|
39
39
|
match e {
|
|
40
40
|
DashPlatformProtocolInitError::SchemaDeserializationError(e) => e.to_string().into(),
|
|
41
41
|
DashPlatformProtocolInitError::InvalidSchemaError(e) => e.to_string().into(),
|
|
42
|
-
// TODO(versioning): add rest
|
|
42
|
+
// TODO(versioning): add rest errors
|
|
43
43
|
_ => JsValue::from_str(&format!("Error conversion not implemented: {e:#}",)),
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -29,6 +29,7 @@ use dpp::platform_value::string_encoding;
|
|
|
29
29
|
use dpp::platform_value::string_encoding::Encoding;
|
|
30
30
|
use dpp::serialization::PlatformSerializable;
|
|
31
31
|
use dpp::state_transition::identity_create_transition::accessors::IdentityCreateTransitionAccessorsV0;
|
|
32
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
32
33
|
use dpp::state_transition::{StateTransition, StateTransitionOwned, StateTransitionSingleSigned};
|
|
33
34
|
use dpp::{
|
|
34
35
|
identity::state_transition::asset_lock_proof::AssetLockProof,
|
|
@@ -19,6 +19,7 @@ use dpp::serialization::PlatformSerializable;
|
|
|
19
19
|
use dpp::state_transition::identity_credit_transfer_transition::accessors::IdentityCreditTransferTransitionAccessorsV0;
|
|
20
20
|
|
|
21
21
|
use dpp::state_transition::identity_credit_transfer_transition::IdentityCreditTransferTransition;
|
|
22
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
22
23
|
use dpp::state_transition::{StateTransition, StateTransitionIdentitySigned};
|
|
23
24
|
use dpp::state_transition::{StateTransitionLike, StateTransitionSingleSigned};
|
|
24
25
|
#[wasm_bindgen(js_name=IdentityCreditTransferTransition)]
|
|
@@ -19,6 +19,7 @@ use dpp::platform_value::{string_encoding, BinaryData};
|
|
|
19
19
|
use dpp::serialization::PlatformSerializable;
|
|
20
20
|
use dpp::state_transition::identity_credit_withdrawal_transition::accessors::IdentityCreditWithdrawalTransitionAccessorsV0;
|
|
21
21
|
use dpp::state_transition::identity_credit_withdrawal_transition::IdentityCreditWithdrawalTransition;
|
|
22
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
22
23
|
use dpp::state_transition::{StateTransition, StateTransitionIdentitySigned};
|
|
23
24
|
use dpp::state_transition::{StateTransitionLike, StateTransitionSingleSigned};
|
|
24
25
|
use dpp::withdrawal::Pooling;
|
|
@@ -28,6 +28,7 @@ use dpp::platform_value::string_encoding::Encoding;
|
|
|
28
28
|
use dpp::serialization::PlatformSerializable;
|
|
29
29
|
use dpp::state_transition::identity_topup_transition::accessors::IdentityTopUpTransitionAccessorsV0;
|
|
30
30
|
use dpp::state_transition::identity_topup_transition::IdentityTopUpTransition;
|
|
31
|
+
use dpp::state_transition::StateTransitionHasUserFeeIncrease;
|
|
31
32
|
use dpp::state_transition::{StateTransition, StateTransitionOwned, StateTransitionSingleSigned};
|
|
32
33
|
use dpp::{
|
|
33
34
|
identifier::Identifier, identity::state_transition::asset_lock_proof::AssetLockProof,
|
|
@@ -18,6 +18,7 @@ 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::StateTransitionHasUserFeeIncrease;
|
|
21
22
|
use dpp::state_transition::StateTransitionIdentitySigned;
|
|
22
23
|
use dpp::state_transition::{StateTransition, StateTransitionOwned, StateTransitionSingleSigned};
|
|
23
24
|
use dpp::version::PlatformVersion;
|
|
@@ -55,6 +55,7 @@ impl From<StateTransitionType> for StateTransitionTypeWasm {
|
|
|
55
55
|
StateTransitionType::AddressCreditWithdrawal => {
|
|
56
56
|
StateTransitionTypeWasm::AddressCreditWithdrawal
|
|
57
57
|
}
|
|
58
|
+
_ => todo!("shielded state transition types not yet implemented in wasm"),
|
|
58
59
|
}
|
|
59
60
|
}
|
|
60
61
|
}
|
|
@@ -79,6 +79,13 @@ impl StateTransitionFactoryWasm {
|
|
|
79
79
|
StateTransition::AddressCreditWithdrawal(st) => {
|
|
80
80
|
serde_wasm_bindgen::to_value(&st).map_err(|e| JsValue::from(e.to_string()))
|
|
81
81
|
}
|
|
82
|
+
StateTransition::Shield(_)
|
|
83
|
+
| StateTransition::ShieldedTransfer(_)
|
|
84
|
+
| StateTransition::Unshield(_)
|
|
85
|
+
| StateTransition::ShieldFromAssetLock(_)
|
|
86
|
+
| StateTransition::ShieldedWithdrawal(_) => {
|
|
87
|
+
todo!("shielded transitions not yet implemented in state_transition_factory")
|
|
88
|
+
}
|
|
82
89
|
},
|
|
83
90
|
Err(dpp::ProtocolError::StateTransitionError(e)) => match e {
|
|
84
91
|
StateTransitionError::InvalidStateTransitionError {
|
|
@@ -223,15 +223,17 @@ impl MasternodeVoteTransitionWasm {
|
|
|
223
223
|
self.0.is_voting_state_transition()
|
|
224
224
|
}
|
|
225
225
|
|
|
226
|
+
/// Masternode vote transitions do not support user fee increase; always returns 0.
|
|
227
|
+
/// This method is kept for API compatibility.
|
|
226
228
|
#[wasm_bindgen(js_name=getUserFeeIncrease)]
|
|
227
229
|
pub fn get_user_fee_increase(&self) -> u16 {
|
|
228
|
-
|
|
230
|
+
0
|
|
229
231
|
}
|
|
230
232
|
|
|
233
|
+
/// Masternode vote transitions do not support user fee increase.
|
|
234
|
+
/// This method is kept for API compatibility and intentionally does nothing.
|
|
231
235
|
#[wasm_bindgen(js_name=setUserFeeIncrease)]
|
|
232
|
-
pub fn set_user_fee_increase(&mut self,
|
|
233
|
-
self.0.set_user_fee_increase(user_fee_increase);
|
|
234
|
-
}
|
|
236
|
+
pub fn set_user_fee_increase(&mut self, _user_fee_increase: u16) {}
|
|
235
237
|
|
|
236
238
|
#[wasm_bindgen(js_name=getIdentityContractNonce)]
|
|
237
239
|
pub fn get_identity_nonce(&self) -> u64 {
|
|
@@ -1610,9 +1610,9 @@ describe.skip('validateDataContractFactory', () => {
|
|
|
1610
1610
|
],
|
|
1611
1611
|
};
|
|
1612
1612
|
|
|
1613
|
-
const
|
|
1613
|
+
const indicesDefinition = rawDataContract.documents.indexedDocument.indices;
|
|
1614
1614
|
|
|
1615
|
-
|
|
1615
|
+
indicesDefinition.push(indexDefinition);
|
|
1616
1616
|
|
|
1617
1617
|
const result = await validateDataContract(rawDataContract);
|
|
1618
1618
|
|
|
@@ -27,7 +27,7 @@ describe('DocumentFacade', () => {
|
|
|
27
27
|
const dataContractObject = dataContractFixture.toObject();
|
|
28
28
|
|
|
29
29
|
dataContract = new DataContract({
|
|
30
|
-
$
|
|
30
|
+
$formatVersion: '0',
|
|
31
31
|
id: dataContractObject.id,
|
|
32
32
|
version: 1,
|
|
33
33
|
ownerId: dataContractObject.ownerId,
|
|
@@ -54,7 +54,7 @@ describe('DataContract', () => {
|
|
|
54
54
|
schemaDefs = { something: { type: 'string' } };
|
|
55
55
|
|
|
56
56
|
dataContract = new DataContract({
|
|
57
|
-
$
|
|
57
|
+
$formatVersion: '0',
|
|
58
58
|
id: contractId,
|
|
59
59
|
version: 1,
|
|
60
60
|
ownerId,
|
|
@@ -65,7 +65,7 @@ describe('DataContract', () => {
|
|
|
65
65
|
describe('constructor', () => {
|
|
66
66
|
it('should create new DataContract', async () => {
|
|
67
67
|
dataContract = new DataContract({
|
|
68
|
-
$
|
|
68
|
+
$formatVersion: '0',
|
|
69
69
|
id: contractId,
|
|
70
70
|
version: 1,
|
|
71
71
|
ownerId,
|
|
@@ -218,9 +218,9 @@ describe('DataContract', () => {
|
|
|
218
218
|
const result = dataContract.toJSON();
|
|
219
219
|
|
|
220
220
|
expect(result).to.deep.equal({
|
|
221
|
-
$
|
|
221
|
+
$formatVersion: '0',
|
|
222
222
|
config: {
|
|
223
|
-
$
|
|
223
|
+
$formatVersion: '0',
|
|
224
224
|
canBeDeleted: false,
|
|
225
225
|
documentsCanBeDeletedContractDefault: true,
|
|
226
226
|
documentsKeepHistoryContractDefault: false,
|
|
@@ -248,9 +248,9 @@ describe('DataContract', () => {
|
|
|
248
248
|
const result = dataContract.toJSON();
|
|
249
249
|
|
|
250
250
|
expect(result).to.deep.equal({
|
|
251
|
-
$
|
|
251
|
+
$formatVersion: '0',
|
|
252
252
|
config: {
|
|
253
|
-
$
|
|
253
|
+
$formatVersion: '0',
|
|
254
254
|
canBeDeleted: false,
|
|
255
255
|
documentsCanBeDeletedContractDefault: true,
|
|
256
256
|
documentsKeepHistoryContractDefault: false,
|
|
@@ -65,7 +65,7 @@ describe('Identity', () => {
|
|
|
65
65
|
|
|
66
66
|
it('should set public keys', () => {
|
|
67
67
|
const rawKey = {
|
|
68
|
-
$
|
|
68
|
+
$formatVersion: '0',
|
|
69
69
|
id: 2,
|
|
70
70
|
type: KeyType.ECDSA_SECP256K1,
|
|
71
71
|
data: Buffer.alloc(36).fill('a'),
|
|
@@ -140,11 +140,11 @@ describe('Identity', () => {
|
|
|
140
140
|
const jsonIdentity = identity.toJSON();
|
|
141
141
|
|
|
142
142
|
expect(jsonIdentity).to.deep.equal({
|
|
143
|
-
$
|
|
143
|
+
$formatVersion: '0',
|
|
144
144
|
id: Identifier.from(rawIdentity.id).toString(),
|
|
145
145
|
publicKeys: [
|
|
146
146
|
{
|
|
147
|
-
$
|
|
147
|
+
$formatVersion: '0',
|
|
148
148
|
id: 0,
|
|
149
149
|
type: KeyType.ECDSA_SECP256K1,
|
|
150
150
|
data: rawIdentity.publicKeys[0].data.toString('base64'),
|
|
@@ -189,7 +189,7 @@ describe('IdentityPublicKey', () => {
|
|
|
189
189
|
const jsonPublicKey = publicKey.toJSON();
|
|
190
190
|
|
|
191
191
|
expect(jsonPublicKey).to.deep.equal({
|
|
192
|
-
$
|
|
192
|
+
$formatVersion: '0',
|
|
193
193
|
id: 0,
|
|
194
194
|
type: IdentityPublicKey.TYPES.ECDSA_SECP256K1,
|
|
195
195
|
data: 'AkVuTKyF3YgKLAQlLEtaUL2HTditwGILfWUVqjzYnIgH',
|
|
@@ -210,7 +210,7 @@ describe('IdentityPublicKey', () => {
|
|
|
210
210
|
const jsonPublicKey = publicKey.toObject();
|
|
211
211
|
|
|
212
212
|
expect(jsonPublicKey).to.deep.equal({
|
|
213
|
-
$
|
|
213
|
+
$formatVersion: '0',
|
|
214
214
|
id: 0,
|
|
215
215
|
type: IdentityPublicKey.TYPES.ECDSA_SECP256K1,
|
|
216
216
|
data: Buffer.from('AkVuTKyF3YgKLAQlLEtaUL2HTditwGILfWUVqjzYnIgH', 'base64'),
|
package/tsconfig.json
CHANGED