@dashevo/wasm-dpp 4.1.1 → 4.2.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/dist/wasm/wasm_dpp.d.ts +1099 -978
- package/dist/wasm/wasm_dpp.js +102 -44
- package/dist/wasm/wasm_dpp_bg.js +1 -1
- package/lib/wasm/wasm_dpp.d.ts +1099 -978
- package/package.json +2 -2
- package/src/errors/consensus/consensus_error.rs +36 -1
- package/src/errors/consensus/state/document/mod.rs +2 -0
- package/src/errors/consensus/state/document/referenced_entity_not_found_error.rs +44 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dashevo/wasm-dpp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.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.26.10",
|
|
45
45
|
"@babel/preset-env": "^7.26.9",
|
|
46
46
|
"@dashevo/dashcore-lib": "~0.22.0",
|
|
47
|
-
"@dashevo/dpns-contract": "4.
|
|
47
|
+
"@dashevo/dpns-contract": "4.2.0-dev.2",
|
|
48
48
|
"@types/bs58": "^4.0.1",
|
|
49
49
|
"@types/node": "^20.10.0",
|
|
50
50
|
"@yarnpkg/pnpify": "^4.0.0-rc.42",
|
|
@@ -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};
|
|
@@ -74,8 +74,10 @@ use dpp::consensus::state::data_contract::document_type_update_error::DocumentTy
|
|
|
74
74
|
use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError;
|
|
75
75
|
use dpp::consensus::state::document::document_contest_document_with_same_id_already_present_error::DocumentContestDocumentWithSameIdAlreadyPresentError;
|
|
76
76
|
use dpp::consensus::state::document::document_contest_identity_already_contestant::DocumentContestIdentityAlreadyContestantError;
|
|
77
|
+
use dpp::consensus::state::document::document_contest_index_mismatch_error::DocumentContestIndexMismatchError;
|
|
77
78
|
use dpp::consensus::state::document::document_contest_not_joinable_error::DocumentContestNotJoinableError;
|
|
78
79
|
use dpp::consensus::state::document::document_contest_not_paid_for_error::DocumentContestNotPaidForError;
|
|
80
|
+
use dpp::consensus::state::document::document_contest_not_required_error::DocumentContestNotRequiredError;
|
|
79
81
|
use dpp::consensus::state::document::document_incorrect_purchase_price_error::DocumentIncorrectPurchasePriceError;
|
|
80
82
|
use dpp::consensus::state::document::document_not_for_sale_error::DocumentNotForSaleError;
|
|
81
83
|
use dpp::consensus::state::group::{GroupActionAlreadyCompletedError, GroupActionAlreadySignedByIdentityError, GroupActionDoesNotExistError, IdentityMemberOfGroupNotFoundError, IdentityNotMemberOfGroupError, ModificationOfGroupActionMainParametersNotPermittedError};
|
|
@@ -90,6 +92,11 @@ use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized
|
|
|
90
92
|
use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
|
|
91
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};
|
|
92
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_key_id_property_invalid_error::ReferencedKeyIdPropertyInvalidError;
|
|
99
|
+
use dpp::consensus::state::document::referenced_document_type_not_found_error::ReferencedDocumentTypeNotFoundError;
|
|
93
100
|
use dpp::consensus::state::shielded::insufficient_pool_notes_error::InsufficientPoolNotesError;
|
|
94
101
|
use dpp::consensus::state::shielded::insufficient_shielded_fee_error::InsufficientShieldedFeeError;
|
|
95
102
|
use dpp::consensus::state::shielded::invalid_anchor_error::InvalidAnchorError;
|
|
@@ -136,6 +143,7 @@ use crate::errors::consensus::state::document::{
|
|
|
136
143
|
DocumentAlreadyPresentErrorWasm, DocumentNotFoundErrorWasm, DocumentOwnerIdMismatchErrorWasm,
|
|
137
144
|
DocumentTimestampWindowViolationErrorWasm, DocumentTimestampsMismatchErrorWasm,
|
|
138
145
|
DuplicateUniqueIndexErrorWasm, InvalidDocumentRevisionErrorWasm,
|
|
146
|
+
ReferencedEntityNotFoundErrorWasm,
|
|
139
147
|
};
|
|
140
148
|
use crate::errors::consensus::state::identity::{
|
|
141
149
|
IdentityAlreadyExistsErrorWasm, IdentityPublicKeyIsDisabledErrorWasm,
|
|
@@ -325,6 +333,12 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
325
333
|
StateError::DocumentContestNotPaidForError(e) => {
|
|
326
334
|
generic_consensus_error!(DocumentContestNotPaidForError, e).into()
|
|
327
335
|
}
|
|
336
|
+
StateError::DocumentContestIndexMismatchError(e) => {
|
|
337
|
+
generic_consensus_error!(DocumentContestIndexMismatchError, e).into()
|
|
338
|
+
}
|
|
339
|
+
StateError::DocumentContestNotRequiredError(e) => {
|
|
340
|
+
generic_consensus_error!(DocumentContestNotRequiredError, e).into()
|
|
341
|
+
}
|
|
328
342
|
StateError::RecipientIdentityDoesNotExistError(e) => {
|
|
329
343
|
generic_consensus_error!(RecipientIdentityDoesNotExistError, e).into()
|
|
330
344
|
}
|
|
@@ -463,6 +477,24 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
|
|
|
463
477
|
StateError::InsufficientShieldedFeeError(e) => {
|
|
464
478
|
generic_consensus_error!(InsufficientShieldedFeeError, e).into()
|
|
465
479
|
}
|
|
480
|
+
StateError::ReferencedEntityNotFoundError(e) => {
|
|
481
|
+
ReferencedEntityNotFoundErrorWasm::from(e).into()
|
|
482
|
+
}
|
|
483
|
+
StateError::ReferencedDocumentTypeNotFoundError(e) => {
|
|
484
|
+
generic_consensus_error!(ReferencedDocumentTypeNotFoundError, e).into()
|
|
485
|
+
}
|
|
486
|
+
StateError::ReferencedDocumentTypeDeletableError(e) => {
|
|
487
|
+
generic_consensus_error!(ReferencedDocumentTypeDeletableError, e).into()
|
|
488
|
+
}
|
|
489
|
+
StateError::ReferencedIdentityKeyNotFoundError(e) => {
|
|
490
|
+
generic_consensus_error!(ReferencedIdentityKeyNotFoundError, e).into()
|
|
491
|
+
}
|
|
492
|
+
StateError::ReferencedIdentityKeyDisabledError(e) => {
|
|
493
|
+
generic_consensus_error!(ReferencedIdentityKeyDisabledError, e).into()
|
|
494
|
+
}
|
|
495
|
+
StateError::ReferencedKeyIdPropertyInvalidError(e) => {
|
|
496
|
+
generic_consensus_error!(ReferencedKeyIdPropertyInvalidError, e).into()
|
|
497
|
+
}
|
|
466
498
|
}
|
|
467
499
|
}
|
|
468
500
|
|
|
@@ -973,6 +1005,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
|
|
|
973
1005
|
BasicError::TokenPricingScheduleEmptyError(e) => {
|
|
974
1006
|
generic_consensus_error!(TokenPricingScheduleEmptyError, e).into()
|
|
975
1007
|
}
|
|
1008
|
+
BasicError::DataContractInvalidRequiredFieldsUpdateError(e) => {
|
|
1009
|
+
generic_consensus_error!(DataContractInvalidRequiredFieldsUpdateError, e).into()
|
|
1010
|
+
}
|
|
976
1011
|
}
|
|
977
1012
|
}
|
|
978
1013
|
|
|
@@ -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
|
+
}
|