@dashevo/wasm-dpp 4.2.0-dev.1 → 4.2.0-dev.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dashevo/wasm-dpp",
3
- "version": "4.2.0-dev.1",
3
+ "version": "4.2.0-dev.5",
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.26.10",
45
45
  "@babel/preset-env": "^7.26.9",
46
46
  "@dashevo/dashcore-lib": "~0.22.0",
47
- "@dashevo/dpns-contract": "4.2.0-dev.1",
47
+ "@dashevo/dpns-contract": "4.2.0-dev.5",
48
48
  "@types/bs58": "^4.0.1",
49
49
  "@types/node": "^20.10.0",
50
50
  "@yarnpkg/pnpify": "^4.0.0-rc.42",
@@ -23,6 +23,7 @@ use dpp::state_transition::batch_transition::document_replace_transition::v0::v0
23
23
  use dpp::state_transition::batch_transition::batched_transition::document_purchase_transition::v0::v0_methods::DocumentPurchaseTransitionV0Methods;
24
24
  use dpp::state_transition::batch_transition::batched_transition::document_transfer_transition::v0::v0_methods::DocumentTransferTransitionV0Methods;
25
25
  use dpp::state_transition::batch_transition::batched_transition::document_update_price_transition::v0::v0_methods::DocumentUpdatePriceTransitionV0Methods;
26
+ use dpp::state_transition::batch_transition::batched_transition::document_index_only_delete_transition::v0::v0_methods::DocumentIndexOnlyDeleteTransitionV0Methods;
26
27
  use dpp::state_transition::batch_transition::document_base_transition::v0::v0_methods::DocumentBaseTransitionV0Methods;
27
28
  use crate::{
28
29
  buffer::Buffer,
@@ -67,6 +68,12 @@ impl DocumentTransitionWasm {
67
68
  DocumentTransition::Transfer(_) => JsValue::null(),
68
69
  DocumentTransition::UpdatePrice(_) => JsValue::null(),
69
70
  DocumentTransition::Purchase(_) => JsValue::null(),
71
+ DocumentTransition::IndexOnlyDelete(index_only_delete) => {
72
+ let json_value = index_only_delete.data().to_json_value().unwrap();
73
+ json_value
74
+ .serialize(&serde_wasm_bindgen::Serializer::json_compatible())
75
+ .unwrap()
76
+ }
70
77
  }
71
78
  }
72
79
 
@@ -110,6 +117,7 @@ impl DocumentTransitionWasm {
110
117
  DocumentTransition::Transfer(_) => None,
111
118
  DocumentTransition::UpdatePrice(update_price) => Some(update_price.price()),
112
119
  DocumentTransition::Purchase(purchase) => Some(purchase.price()),
120
+ DocumentTransition::IndexOnlyDelete(_) => None,
113
121
  }
114
122
  }
115
123
 
@@ -122,6 +130,7 @@ impl DocumentTransitionWasm {
122
130
  DocumentTransition::Transfer(transfer) => Some(transfer.recipient_owner_id().into()),
123
131
  DocumentTransition::UpdatePrice(_) => None,
124
132
  DocumentTransition::Purchase(_) => None,
133
+ DocumentTransition::IndexOnlyDelete(_) => None,
125
134
  }
126
135
  }
127
136
 
@@ -62,7 +62,7 @@ use dpp::consensus::state::data_trigger::DataTriggerError::{
62
62
  DataTriggerConditionError, DataTriggerExecutionError, DataTriggerInvalidResultError,
63
63
  };
64
64
  use wasm_bindgen::{JsError, JsValue};
65
- use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DecimalsOverLimitError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupHasTooFewMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupRequiredPowerIsInvalidError, GroupTotalPowerLessThanRequiredError, InvalidDescriptionLengthError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordCharacterError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, InvalidTokenLanguageCodeError, InvalidTokenNameCharacterError, InvalidTokenNameLengthError, MainGroupIsNotDefinedError, NewTokensDestinationIdentityOptionRequiredError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, RedundantDocumentPaidForByTokenWithContractId, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
65
+ use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, DataContractInvalidRequiredFieldsUpdateError, ContestedUniqueIndexWithUniqueIndexError, DataContractTokenConfigurationUpdateError, DecimalsOverLimitError, DuplicateKeywordsError, GroupExceedsMaxMembersError, GroupHasTooFewMembersError, GroupMemberHasPowerOfZeroError, GroupMemberHasPowerOverLimitError, GroupNonUnilateralMemberPowerHasLessThanRequiredPowerError, GroupPositionDoesNotExistError, GroupRequiredPowerIsInvalidError, GroupTotalPowerLessThanRequiredError, InvalidDescriptionLengthError, InvalidDocumentTypeRequiredSecurityLevelError, InvalidKeywordCharacterError, InvalidKeywordLengthError, InvalidTokenBaseSupplyError, InvalidTokenDistributionFunctionDivideByZeroError, InvalidTokenDistributionFunctionIncoherenceError, InvalidTokenDistributionFunctionInvalidParameterError, InvalidTokenDistributionFunctionInvalidParameterTupleError, InvalidTokenLanguageCodeError, InvalidTokenNameCharacterError, InvalidTokenNameLengthError, MainGroupIsNotDefinedError, NewTokensDestinationIdentityOptionRequiredError, NonContiguousContractGroupPositionsError, NonContiguousContractTokenPositionsError, RedundantDocumentPaidForByTokenWithContractId, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
66
66
  use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedError, DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError};
67
67
  use dpp::consensus::basic::group::GroupActionNotAllowedOnTransitionError;
68
68
  use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, InvalidKeyPurposeForContractBoundsError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError};
@@ -92,6 +92,13 @@ use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized
92
92
  use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
93
93
  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};
94
94
  use dpp::consensus::state::address_funds::{AddressDoesNotExistError, AddressInvalidNonceError, AddressNotEnoughFundsError, AddressesNotEnoughFundsError};
95
+ use dpp::consensus::state::document::referenced_document_type_deletable_error::ReferencedDocumentTypeDeletableError;
96
+ use dpp::consensus::state::document::referenced_identity_key_disabled_error::ReferencedIdentityKeyDisabledError;
97
+ use dpp::consensus::state::document::referenced_identity_key_not_found_error::ReferencedIdentityKeyNotFoundError;
98
+ use dpp::consensus::state::document::referenced_document_property_agreement_invalid_error::ReferencedDocumentPropertyAgreementInvalidError;
99
+ use dpp::consensus::state::document::referenced_document_property_mismatch_error::ReferencedDocumentPropertyMismatchError;
100
+ use dpp::consensus::state::document::referenced_key_id_property_invalid_error::ReferencedKeyIdPropertyInvalidError;
101
+ use dpp::consensus::state::document::referenced_document_type_not_found_error::ReferencedDocumentTypeNotFoundError;
95
102
  use dpp::consensus::state::shielded::insufficient_pool_notes_error::InsufficientPoolNotesError;
96
103
  use dpp::consensus::state::shielded::insufficient_shielded_fee_error::InsufficientShieldedFeeError;
97
104
  use dpp::consensus::state::shielded::invalid_anchor_error::InvalidAnchorError;
@@ -138,6 +145,7 @@ use crate::errors::consensus::state::document::{
138
145
  DocumentAlreadyPresentErrorWasm, DocumentNotFoundErrorWasm, DocumentOwnerIdMismatchErrorWasm,
139
146
  DocumentTimestampWindowViolationErrorWasm, DocumentTimestampsMismatchErrorWasm,
140
147
  DuplicateUniqueIndexErrorWasm, InvalidDocumentRevisionErrorWasm,
148
+ ReferencedEntityNotFoundErrorWasm,
141
149
  };
142
150
  use crate::errors::consensus::state::identity::{
143
151
  IdentityAlreadyExistsErrorWasm, IdentityPublicKeyIsDisabledErrorWasm,
@@ -471,6 +479,30 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
471
479
  StateError::InsufficientShieldedFeeError(e) => {
472
480
  generic_consensus_error!(InsufficientShieldedFeeError, e).into()
473
481
  }
482
+ StateError::ReferencedEntityNotFoundError(e) => {
483
+ ReferencedEntityNotFoundErrorWasm::from(e).into()
484
+ }
485
+ StateError::ReferencedDocumentTypeNotFoundError(e) => {
486
+ generic_consensus_error!(ReferencedDocumentTypeNotFoundError, e).into()
487
+ }
488
+ StateError::ReferencedDocumentTypeDeletableError(e) => {
489
+ generic_consensus_error!(ReferencedDocumentTypeDeletableError, e).into()
490
+ }
491
+ StateError::ReferencedIdentityKeyNotFoundError(e) => {
492
+ generic_consensus_error!(ReferencedIdentityKeyNotFoundError, e).into()
493
+ }
494
+ StateError::ReferencedIdentityKeyDisabledError(e) => {
495
+ generic_consensus_error!(ReferencedIdentityKeyDisabledError, e).into()
496
+ }
497
+ StateError::ReferencedKeyIdPropertyInvalidError(e) => {
498
+ generic_consensus_error!(ReferencedKeyIdPropertyInvalidError, e).into()
499
+ }
500
+ StateError::ReferencedDocumentPropertyAgreementInvalidError(e) => {
501
+ generic_consensus_error!(ReferencedDocumentPropertyAgreementInvalidError, e).into()
502
+ }
503
+ StateError::ReferencedDocumentPropertyMismatchError(e) => {
504
+ generic_consensus_error!(ReferencedDocumentPropertyMismatchError, e).into()
505
+ }
474
506
  }
475
507
  }
476
508
 
@@ -981,6 +1013,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
981
1013
  BasicError::TokenPricingScheduleEmptyError(e) => {
982
1014
  generic_consensus_error!(TokenPricingScheduleEmptyError, e).into()
983
1015
  }
1016
+ BasicError::DataContractInvalidRequiredFieldsUpdateError(e) => {
1017
+ generic_consensus_error!(DataContractInvalidRequiredFieldsUpdateError, e).into()
1018
+ }
984
1019
  }
985
1020
  }
986
1021
 
@@ -6,6 +6,7 @@ mod document_timestamps_are_equal_error;
6
6
  mod document_timestamps_mismatch_error;
7
7
  mod duplicate_unique_index_error;
8
8
  mod invalid_document_revision_error;
9
+ mod referenced_entity_not_found_error;
9
10
 
10
11
  pub use document_already_present_error::*;
11
12
  pub use document_not_found_error::*;
@@ -15,3 +16,4 @@ pub use document_timestamps_are_equal_error::*;
15
16
  pub use document_timestamps_mismatch_error::*;
16
17
  pub use duplicate_unique_index_error::*;
17
18
  pub use invalid_document_revision_error::*;
19
+ pub use referenced_entity_not_found_error::*;
@@ -0,0 +1,44 @@
1
+ use crate::buffer::Buffer;
2
+ use dpp::consensus::codes::ErrorWithCode;
3
+ use dpp::consensus::state::document::referenced_entity_not_found_error::ReferencedEntityNotFoundError;
4
+ use dpp::consensus::ConsensusError;
5
+ use wasm_bindgen::prelude::*;
6
+
7
+ #[wasm_bindgen(js_name=ReferencedEntityNotFoundError)]
8
+ pub struct ReferencedEntityNotFoundErrorWasm {
9
+ inner: ReferencedEntityNotFoundError,
10
+ }
11
+
12
+ impl From<&ReferencedEntityNotFoundError> for ReferencedEntityNotFoundErrorWasm {
13
+ fn from(e: &ReferencedEntityNotFoundError) -> Self {
14
+ Self { inner: e.clone() }
15
+ }
16
+ }
17
+
18
+ #[wasm_bindgen(js_class=ReferencedEntityNotFoundError)]
19
+ impl ReferencedEntityNotFoundErrorWasm {
20
+ #[wasm_bindgen(js_name=getEntityId)]
21
+ pub fn entity_id(&self) -> Buffer {
22
+ Buffer::from_bytes(self.inner.entity_id().as_bytes())
23
+ }
24
+
25
+ #[wasm_bindgen(js_name=getEntityType)]
26
+ pub fn entity_type(&self) -> String {
27
+ self.inner.entity_type().to_string()
28
+ }
29
+
30
+ #[wasm_bindgen(js_name=getPath)]
31
+ pub fn path(&self) -> String {
32
+ self.inner.path().to_string()
33
+ }
34
+
35
+ #[wasm_bindgen(js_name=getCode)]
36
+ pub fn get_code(&self) -> u32 {
37
+ ConsensusError::from(self.inner.clone()).code()
38
+ }
39
+
40
+ #[wasm_bindgen(getter)]
41
+ pub fn message(&self) -> String {
42
+ self.inner.to_string()
43
+ }
44
+ }