@dashevo/wasm-dpp 4.2.0-beta.2 → 4.2.0-beta.3

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-beta.2",
3
+ "version": "4.2.0-beta.3",
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-beta.2",
47
+ "@dashevo/dpns-contract": "4.2.0-beta.3",
48
48
  "@types/bs58": "^4.0.1",
49
49
  "@types/node": "^20.10.0",
50
50
  "@yarnpkg/pnpify": "^4.0.0-rc.42",
@@ -25,6 +25,7 @@ impl TokenClaimTransitionWasm {
25
25
  match self.0.distribution_type() {
26
26
  TokenDistributionType::PreProgrammed => 0,
27
27
  TokenDistributionType::Perpetual => 1,
28
+ TokenDistributionType::OncePerIdentity => 2,
28
29
  }
29
30
  }
30
31
  }
@@ -66,12 +66,12 @@ use dpp::consensus::state::data_trigger::DataTriggerError::{
66
66
  DataTriggerConditionError, DataTriggerExecutionError, DataTriggerInvalidResultError,
67
67
  };
68
68
  use wasm_bindgen::{JsError, JsValue};
69
- 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};
69
+ 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, PreProgrammedDistributionAmountOverLimitError, RedundantDocumentPaidForByTokenWithContractId, TokenPaymentByBurningOnlyAllowedOnInternalTokenError, TooManyKeywordsError, UnknownDocumentActionTokenEffectError, UnknownDocumentCreationRestrictionModeError, UnknownGasFeesPaidByError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
70
70
  use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedError, DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError};
71
71
  use dpp::consensus::basic::group::GroupActionNotAllowedOnTransitionError;
72
72
  use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, InvalidKeyPurposeForContractBoundsError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError};
73
73
  use dpp::consensus::basic::overflow_error::OverflowError;
74
- use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidTokenAmountError, InvalidTokenConfigUpdateNoChangeError, InvalidTokenIdError, InvalidTokenNoteTooBigError, InvalidTokenPositionError, MissingDefaultLocalizationError, TokenNoteOnlyAllowedWhenProposerError, TokenPricingScheduleEmptyError, TokenTransferToOurselfError, InvalidTokenDistributionTimeIntervalNotMinuteAlignedError, InvalidTokenDistributionTimeIntervalTooShortError, InvalidTokenDistributionBlockIntervalTooShortError, InvalidTokenDistributionEpochIntervalTooShortError};
74
+ use dpp::consensus::basic::token::{ChoosingTokenMintRecipientNotAllowedError, ContractHasNoTokensError, DestinationIdentityForTokenMintingNotSetError, InvalidActionIdError, InvalidTokenAmountError, InvalidTokenConfigUpdateNoChangeError, InvalidTokenIdError, InvalidTokenNoteTooBigError, InvalidTokenPositionError, MissingDefaultLocalizationError, TokenNoteOnlyAllowedWhenProposerError, TokenPricingScheduleEmptyError, TokenTransferToOurselfError, InvalidTokenDistributionTimeIntervalNotMinuteAlignedError, InvalidTokenDistributionTimeIntervalTooShortError, InvalidTokenDistributionBlockIntervalTooShortError, InvalidTokenDistributionEpochIntervalTooShortError, InvalidTokenOncePerIdentityDistributionAmountError};
75
75
  use dpp::consensus::state::data_contract::data_contract_not_found_error::DataContractNotFoundError;
76
76
  use dpp::consensus::state::data_contract::data_contract_update_action_not_allowed_error::DataContractUpdateActionNotAllowedError;
77
77
  use dpp::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError;
@@ -90,6 +90,23 @@ use dpp::consensus::basic::contract_group::{
90
90
  InvalidContractGroupDescriptionLengthError, InvalidContractGroupNameLengthError,
91
91
  InvalidContractGroupAdminsError, RedundantContractGroupMembershipError,
92
92
  };
93
+ use dpp::consensus::basic::contract_moderation::{
94
+ ContractModerationReasonTooLongError, ContractModerationSelfTargetError,
95
+ DocumentActionFeesWithoutModerationError,
96
+ InvalidContractModerationConfigError,
97
+ };
98
+ use dpp::consensus::state::contract_moderation::{
99
+ ContractFeeClaimNotAllowedError, ContractFeesAlreadyClaimedThisEpochError,
100
+ ContractFeesNothingToClaimError,
101
+ ContractModerationNotEnabledError, ContractModerationTargetNotAllowedError,
102
+ ContractModerationCounterpartyBarredError, ContractModerationTargetNotFoundError,
103
+ ContractModeratorIdentityNotFoundError,
104
+ ContractSuspensionNotInFutureError,
105
+ ContractUserAlreadyBannedError, ContractUserBannedError, ContractUserNotBannedError,
106
+ ContractUserNotSuspendedError, ContractUserSuspendedError,
107
+ DocumentModerationWindowElapsedError, DocumentTypeNotDeletableByModeratorsError,
108
+ IdentityNotContractModeratorError,
109
+ };
93
110
  use dpp::consensus::state::contract_group::{
94
111
  ContractGroupAdminNotFoundError, ContractGroupAlreadyExistsError, ContractGroupNotFoundError,
95
112
  IdentityNotContractGroupOwnerOrAdminError,
@@ -117,14 +134,20 @@ use dpp::consensus::state::identity::no_transfer_key_for_core_withdrawal_availab
117
134
  use dpp::consensus::state::identity::RecipientIdentityDoesNotExistError;
118
135
  use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_insufficient_error::PrefundedSpecializedBalanceInsufficientError;
119
136
  use dpp::consensus::state::prefunded_specialized_balances::prefunded_specialized_balance_not_found_error::PrefundedSpecializedBalanceNotFoundError;
120
- 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};
137
+ 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, TokenOncePerIdentityDistributionAlreadyClaimedError};
121
138
  use dpp::consensus::state::address_funds::{AddressDoesNotExistError, AddressInvalidNonceError, AddressNotEnoughFundsError, AddressesNotEnoughFundsError};
122
139
  use dpp::consensus::state::document::referenced_document_type_deletable_error::ReferencedDocumentTypeDeletableError;
140
+ use dpp::consensus::state::document::referenced_document_type_not_deletable_error::ReferencedDocumentTypeNotDeletableError;
123
141
  use dpp::consensus::state::document::referenced_identity_key_disabled_error::ReferencedIdentityKeyDisabledError;
124
142
  use dpp::consensus::state::document::referenced_identity_key_not_found_error::ReferencedIdentityKeyNotFoundError;
125
143
  use dpp::consensus::state::document::referenced_document_property_agreement_invalid_error::ReferencedDocumentPropertyAgreementInvalidError;
126
144
  use dpp::consensus::state::document::referenced_document_property_mismatch_error::ReferencedDocumentPropertyMismatchError;
127
145
  use dpp::consensus::state::document::document_immutable_property_changed_error::DocumentImmutablePropertyChangedError;
146
+ use dpp::consensus::state::identity::gas_sponsor_insufficient_balance_error::GasSponsorInsufficientBalanceError;
147
+ use dpp::consensus::state::token::{GasFeesPaidByNotAllowedError, InconsistentGasFeesPaidByInBatchError};
148
+ use dpp::consensus::state::document::document_action_fee_agreement_mismatch_error::DocumentActionFeeAgreementMismatchError;
149
+ use dpp::consensus::state::document::document_action_fee_agreement_not_set_error::DocumentActionFeeAgreementNotSetError;
150
+ use dpp::consensus::state::document::document_action_fee_multiplier_not_tolerated_error::DocumentActionFeeMultiplierNotToleratedError;
128
151
  use dpp::consensus::state::document::referenced_key_id_property_invalid_error::ReferencedKeyIdPropertyInvalidError;
129
152
  use dpp::consensus::state::document::referenced_document_type_not_found_error::ReferencedDocumentTypeNotFoundError;
130
153
  use dpp::consensus::state::shielded::insufficient_pool_notes_error::InsufficientPoolNotesError;
@@ -558,6 +581,81 @@ pub fn from_state_error(state_error: &StateError) -> JsValue {
558
581
  StateError::DocumentImmutablePropertyChangedError(e) => {
559
582
  generic_consensus_error!(DocumentImmutablePropertyChangedError, e).into()
560
583
  }
584
+ StateError::TokenOncePerIdentityDistributionAlreadyClaimedError(e) => {
585
+ generic_consensus_error!(TokenOncePerIdentityDistributionAlreadyClaimedError, e).into()
586
+ }
587
+ StateError::GasFeesPaidByNotAllowedError(e) => {
588
+ generic_consensus_error!(GasFeesPaidByNotAllowedError, e).into()
589
+ }
590
+ StateError::InconsistentGasFeesPaidByInBatchError(e) => {
591
+ generic_consensus_error!(InconsistentGasFeesPaidByInBatchError, e).into()
592
+ }
593
+ StateError::DocumentActionFeeAgreementNotSetError(e) => {
594
+ generic_consensus_error!(DocumentActionFeeAgreementNotSetError, e).into()
595
+ }
596
+ StateError::DocumentActionFeeAgreementMismatchError(e) => {
597
+ generic_consensus_error!(DocumentActionFeeAgreementMismatchError, e).into()
598
+ }
599
+ StateError::DocumentActionFeeMultiplierNotToleratedError(e) => {
600
+ generic_consensus_error!(DocumentActionFeeMultiplierNotToleratedError, e).into()
601
+ }
602
+ StateError::GasSponsorInsufficientBalanceError(e) => {
603
+ generic_consensus_error!(GasSponsorInsufficientBalanceError, e).into()
604
+ }
605
+ StateError::ContractModerationNotEnabledError(e) => {
606
+ generic_consensus_error!(ContractModerationNotEnabledError, e).into()
607
+ }
608
+ StateError::IdentityNotContractModeratorError(e) => {
609
+ generic_consensus_error!(IdentityNotContractModeratorError, e).into()
610
+ }
611
+ StateError::ContractModerationTargetNotAllowedError(e) => {
612
+ generic_consensus_error!(ContractModerationTargetNotAllowedError, e).into()
613
+ }
614
+ StateError::ContractUserAlreadyBannedError(e) => {
615
+ generic_consensus_error!(ContractUserAlreadyBannedError, e).into()
616
+ }
617
+ StateError::ContractUserNotBannedError(e) => {
618
+ generic_consensus_error!(ContractUserNotBannedError, e).into()
619
+ }
620
+ StateError::ContractUserNotSuspendedError(e) => {
621
+ generic_consensus_error!(ContractUserNotSuspendedError, e).into()
622
+ }
623
+ StateError::ContractSuspensionNotInFutureError(e) => {
624
+ generic_consensus_error!(ContractSuspensionNotInFutureError, e).into()
625
+ }
626
+ StateError::ContractUserBannedError(e) => {
627
+ generic_consensus_error!(ContractUserBannedError, e).into()
628
+ }
629
+ StateError::ContractUserSuspendedError(e) => {
630
+ generic_consensus_error!(ContractUserSuspendedError, e).into()
631
+ }
632
+ StateError::ContractModerationTargetNotFoundError(e) => {
633
+ generic_consensus_error!(ContractModerationTargetNotFoundError, e).into()
634
+ }
635
+ StateError::ContractModeratorIdentityNotFoundError(e) => {
636
+ generic_consensus_error!(ContractModeratorIdentityNotFoundError, e).into()
637
+ }
638
+ StateError::ContractModerationCounterpartyBarredError(e) => {
639
+ generic_consensus_error!(ContractModerationCounterpartyBarredError, e).into()
640
+ }
641
+ StateError::ContractFeesAlreadyClaimedThisEpochError(e) => {
642
+ generic_consensus_error!(ContractFeesAlreadyClaimedThisEpochError, e).into()
643
+ }
644
+ StateError::ContractFeesNothingToClaimError(e) => {
645
+ generic_consensus_error!(ContractFeesNothingToClaimError, e).into()
646
+ }
647
+ StateError::ContractFeeClaimNotAllowedError(e) => {
648
+ generic_consensus_error!(ContractFeeClaimNotAllowedError, e).into()
649
+ }
650
+ StateError::ReferencedDocumentTypeNotDeletableError(e) => {
651
+ generic_consensus_error!(ReferencedDocumentTypeNotDeletableError, e).into()
652
+ }
653
+ StateError::DocumentTypeNotDeletableByModeratorsError(e) => {
654
+ generic_consensus_error!(DocumentTypeNotDeletableByModeratorsError, e).into()
655
+ }
656
+ StateError::DocumentModerationWindowElapsedError(e) => {
657
+ generic_consensus_error!(DocumentModerationWindowElapsedError, e).into()
658
+ }
561
659
  }
562
660
  }
563
661
 
@@ -978,6 +1076,9 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
978
1076
  BasicError::InvalidTokenDistributionEpochIntervalTooShortError(e) => {
979
1077
  generic_consensus_error!(InvalidTokenDistributionEpochIntervalTooShortError, e).into()
980
1078
  }
1079
+ BasicError::InvalidTokenOncePerIdentityDistributionAmountError(e) => {
1080
+ generic_consensus_error!(InvalidTokenOncePerIdentityDistributionAmountError, e).into()
1081
+ }
981
1082
  BasicError::RedundantDocumentPaidForByTokenWithContractId(e) => {
982
1083
  generic_consensus_error!(RedundantDocumentPaidForByTokenWithContractId, e).into()
983
1084
  }
@@ -1114,6 +1215,21 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
1114
1215
  BasicError::IdentityKeyLimitsUpdateEmptyError(e) => {
1115
1216
  generic_consensus_error!(IdentityKeyLimitsUpdateEmptyError, e).into()
1116
1217
  }
1218
+ BasicError::PreProgrammedDistributionAmountOverLimitError(e) => {
1219
+ generic_consensus_error!(PreProgrammedDistributionAmountOverLimitError, e).into()
1220
+ }
1221
+ BasicError::InvalidContractModerationConfigError(e) => {
1222
+ generic_consensus_error!(InvalidContractModerationConfigError, e).into()
1223
+ }
1224
+ BasicError::ContractModerationSelfTargetError(e) => {
1225
+ generic_consensus_error!(ContractModerationSelfTargetError, e).into()
1226
+ }
1227
+ BasicError::DocumentActionFeesWithoutModerationError(e) => {
1228
+ generic_consensus_error!(DocumentActionFeesWithoutModerationError, e).into()
1229
+ }
1230
+ BasicError::ContractModerationReasonTooLongError(e) => {
1231
+ generic_consensus_error!(ContractModerationReasonTooLongError, e).into()
1232
+ }
1117
1233
  }
1118
1234
  }
1119
1235
 
@@ -92,6 +92,12 @@ impl StateTransitionFactoryWasm {
92
92
  StateTransition::IdentityKeyLimitsUpdate(_) => Err(JsValue::from_str(
93
93
  "identity key limits update transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
94
94
  )),
95
+ StateTransition::ContractUserModeration(_) => Err(JsValue::from_str(
96
+ "contract user moderation transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
97
+ )),
98
+ StateTransition::ContractFeeClaim(_) => Err(JsValue::from_str(
99
+ "contract fee claim transitions are not supported in wasm-dpp StateTransitionFactory; use wasm-dpp2",
100
+ )),
95
101
  },
96
102
  Err(dpp::ProtocolError::StateTransitionError(e)) => match e {
97
103
  StateTransitionError::InvalidStateTransitionError {