@dashevo/wasm-dpp 0.23.0-dev.15 → 0.24.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/.eslintignore +1 -0
- package/Cargo.toml +25 -0
- package/README.md +21 -6
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/index.js.LICENSE.txt +8 -0
- package/dist/lib/patchIdentifier.d.ts +2 -0
- package/dist/wasm/wasm_dpp.d.ts +2850 -0
- package/index.ts +30 -0
- package/karma.conf.js +6 -3
- package/lib/patchIdentifier.ts +37 -0
- package/lib/test/.eslintrc +9 -0
- package/lib/test/bootstrap.js +27 -0
- package/lib/test/expect/expectError.js +34 -0
- package/lib/test/karma/loader.js +6 -0
- package/lib/test/utils/generateRandomIdentifierAsync.js +14 -0
- package/package.json +31 -55
- package/scripts/build.sh +69 -0
- package/scripts/clean.sh +4 -0
- package/src/bls_adapter.rs +71 -0
- package/src/buffer.rs +15 -0
- package/src/dash_platform_protocol.rs +26 -0
- package/src/data_contract/data_contract.rs +290 -0
- package/src/data_contract/errors/data_contract_already_exists.rs +1 -0
- package/src/data_contract/errors/invalid_data_contract.rs +29 -0
- package/src/data_contract/errors/invalid_document_type.rs +33 -0
- package/src/data_contract/errors/mod.rs +37 -0
- package/src/data_contract/index.rs +61 -0
- package/src/data_contract/mod.rs +10 -0
- package/src/data_contract/state_transition/data_contract_create_transition/apply.rs +44 -0
- package/src/data_contract/state_transition/data_contract_create_transition/mod.rs +138 -0
- package/src/data_contract/state_transition/data_contract_create_transition/validation.rs +24 -0
- package/src/data_contract/state_transition/mod.rs +3 -0
- package/src/data_contract_factory/data_contract_factory.rs +155 -0
- package/src/data_contract_factory/mod.rs +1 -0
- package/src/document/errors/document_already_exists_error.rs +28 -0
- package/src/document/errors/document_not_provided_error.rs +28 -0
- package/src/document/errors/invalid_action_name_error.rs +24 -0
- package/src/document/errors/invalid_document_action_error.rs +28 -0
- package/src/document/errors/invalid_document_error.rs +32 -0
- package/src/document/errors/invalid_initial_revision_error.rs +25 -0
- package/src/document/errors/mismatch_owners_ids_error.rs +27 -0
- package/src/document/errors/mod.rs +55 -0
- package/src/document/errors/no_documents_supplied_error.rs +22 -0
- package/src/document/mod.rs +158 -0
- package/src/document/state_transition/document_batch_transition/document_transition/document_create_transition.rs +22 -0
- package/src/document/state_transition/document_batch_transition/document_transition/document_delete_transition.rs +22 -0
- package/src/document/state_transition/document_batch_transition/document_transition/document_update_transition.rs +22 -0
- package/src/document/state_transition/document_batch_transition/document_transition/mod.rs +24 -0
- package/src/document/state_transition/document_batch_transition/mod.rs +1 -0
- package/src/document/state_transition/mod.rs +1 -0
- package/src/errors/consensus/basic/data_contract/data_contract_have_new_unique_index_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/data_contract_immutable_properties_update_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/data_contract_invalid_index_definition_update_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/data_contract_max_depth_exceed_error.rs +26 -0
- package/src/errors/consensus/basic/data_contract/data_contract_unique_indices_changed_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/duplicate_index_name_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/incompatible_data_contract_schema_error.rs +66 -0
- package/src/errors/consensus/basic/data_contract/incompatible_re2_pattern_error.rs +43 -0
- package/src/errors/consensus/basic/data_contract/index_error/duplicate_index_error.rs +39 -0
- package/src/errors/consensus/basic/data_contract/index_error/invalid_compound_index_error.rs +39 -0
- package/src/errors/consensus/basic/data_contract/index_error/invalid_index_property_type_error.rs +59 -0
- package/src/errors/consensus/basic/data_contract/index_error/invalid_indexed_property_constraint_error.rs +67 -0
- package/src/errors/consensus/basic/data_contract/index_error/mod.rs +15 -0
- package/src/errors/consensus/basic/data_contract/index_error/system_property_index_already_present_error.rs +51 -0
- package/src/errors/consensus/basic/data_contract/index_error/undefined_index_property_error.rs +51 -0
- package/src/errors/consensus/basic/data_contract/index_error/unique_indices_limit_reached_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/invalid_data_contract_id_error.rs +37 -0
- package/src/errors/consensus/basic/data_contract/invalid_data_contract_version_error.rs +36 -0
- package/src/errors/consensus/basic/data_contract/invalid_json_schema_ref_error.rs +26 -0
- package/src/errors/consensus/basic/data_contract/mod.rs +25 -0
- package/src/errors/consensus/basic/decode/mod.rs +5 -0
- package/src/errors/consensus/basic/decode/protocol_version_parsing_error.rs +29 -0
- package/src/errors/consensus/basic/decode/serialized_object_parsing_error.rs +29 -0
- package/src/errors/consensus/basic/document/data_contract_not_present_error.rs +32 -0
- package/src/errors/consensus/basic/document/duplicate_document_transitions_with_ids_error.rs +36 -0
- package/src/errors/consensus/basic/document/inconsistent_compound_index_data_error.rs +40 -0
- package/src/errors/consensus/basic/document/invalid_document_transition_action_error.rs +26 -0
- package/src/errors/consensus/basic/document/invalid_document_transition_id_error.rs +38 -0
- package/src/errors/consensus/basic/document/invalid_document_type_error.rs +39 -0
- package/src/errors/consensus/basic/document/missing_data_contract_id_error.rs +20 -0
- package/src/errors/consensus/basic/document/missing_document_transition_action_error.rs +20 -0
- package/src/errors/consensus/basic/document/missing_document_type_error.rs +20 -0
- package/src/errors/consensus/basic/document/mod.rs +19 -0
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_error.rs +32 -0
- package/src/errors/consensus/basic/identity/duplicated_identity_public_key_id_error.rs +32 -0
- package/src/errors/consensus/basic/identity/identity_asset_lock_proof_locked_transaction_mismatch_error.rs +38 -0
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_is_not_found_error.rs +31 -0
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_out_point_already_exists_error.rs +37 -0
- package/src/errors/consensus/basic/identity/identity_asset_lock_transaction_output_not_found_error.rs +29 -0
- package/src/errors/consensus/basic/identity/identity_insufficient_balance_error.rs +33 -0
- package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_core_chain_height_error.rs +34 -0
- package/src/errors/consensus/basic/identity/invalid_asset_lock_proof_transaction_height_error.rs +34 -0
- package/src/errors/consensus/basic/identity/invalid_asset_lock_transaction_output_return_size_error.rs +29 -0
- package/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_error.rs +60 -0
- package/src/errors/consensus/basic/identity/invalid_identity_asset_lock_transaction_output_error.rs +29 -0
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_core_fee_error.rs +29 -0
- package/src/errors/consensus/basic/identity/invalid_identity_credit_withdrawal_transition_output_script_error.rs +32 -0
- package/src/errors/consensus/basic/identity/invalid_identity_key_signature_error.rs +29 -0
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_data_error.rs +39 -0
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_security_level_error.rs +42 -0
- package/src/errors/consensus/basic/identity/invalid_identity_public_key_type_error.rs +30 -0
- package/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_error.rs +22 -0
- package/src/errors/consensus/basic/identity/invalid_instant_asset_lock_proof_signature_error.rs +24 -0
- package/src/errors/consensus/basic/identity/missing_master_public_key_error.rs +22 -0
- package/src/errors/consensus/basic/identity/missing_public_key_error.rs +29 -0
- package/src/errors/consensus/basic/identity/mod.rs +45 -0
- package/src/errors/consensus/basic/incompatible_protocol_version_error.rs +32 -0
- package/src/errors/consensus/basic/invalid_identifier_error.rs +36 -0
- package/src/errors/consensus/basic/invalid_signature_public_key_security_level_error.rs +41 -0
- package/src/errors/consensus/basic/invalid_state_transition_signature_error.rs +20 -0
- package/src/errors/consensus/basic/json_schema_compilation_error.rs +26 -0
- package/src/errors/consensus/basic/json_schema_error.rs +274 -0
- package/src/errors/consensus/basic/mod.rs +30 -0
- package/src/errors/consensus/basic/public_key_is_disabled_error.rs +30 -0
- package/src/errors/consensus/basic/public_key_security_level_not_met_error.rs +41 -0
- package/src/errors/consensus/basic/state_transition/invalid_state_transition_type_error.rs +29 -0
- package/src/errors/consensus/basic/state_transition/missing_state_transition_type_error.rs +20 -0
- package/src/errors/consensus/basic/state_transition/mod.rs +7 -0
- package/src/errors/consensus/basic/state_transition/state_transition_max_size_exceeded_error.rs +36 -0
- package/src/errors/consensus/basic/test_consensus_error.rs +21 -0
- package/src/errors/consensus/basic/unsupported_protocol_version_error.rs +32 -0
- package/src/errors/consensus/basic/wrong_public_key_purpose_error.rs +37 -0
- package/src/errors/consensus/fee/balance_is_not_enough_error.rs +32 -0
- package/src/errors/consensus/fee/mod.rs +3 -0
- package/src/errors/consensus/mod.rs +4 -0
- package/src/errors/consensus/signature/identity_not_found_error.rs +29 -0
- package/src/errors/consensus/signature/mod.rs +3 -0
- package/src/errors/consensus/state/data_contract/data_contract_already_present_error.rs +31 -0
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_condition_error.rs +74 -0
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_execution_error.rs +82 -0
- package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs +66 -0
- package/src/errors/consensus/state/data_contract/data_trigger/mod.rs +7 -0
- package/src/errors/consensus/state/data_contract/mod.rs +4 -0
- package/src/errors/consensus/state/document/document_already_present_error.rs +28 -0
- package/src/errors/consensus/state/document/document_not_found_error.rs +28 -0
- package/src/errors/consensus/state/document/document_owner_id_mismatch_error.rs +50 -0
- package/src/errors/consensus/state/document/document_timestamp_window_violation_error.rs +72 -0
- package/src/errors/consensus/state/document/document_timestamps_mismatch_error.rs +28 -0
- package/src/errors/consensus/state/document/duplicate_unique_index_error.rs +42 -0
- package/src/errors/consensus/state/document/invalid_document_revision_error.rs +38 -0
- package/src/errors/consensus/state/document/mod.rs +15 -0
- package/src/errors/consensus/state/identity/identity_already_exists_error.rs +28 -0
- package/src/errors/consensus/state/identity/identity_public_key_disabled_at_window_violation_error.rs +49 -0
- package/src/errors/consensus/state/identity/identity_public_key_is_disabled_error.rs +31 -0
- package/src/errors/consensus/state/identity/identity_public_key_is_read_only_error.rs +28 -0
- package/src/errors/consensus/state/identity/invalid_identity_public_key_id_error.rs +28 -0
- package/src/errors/consensus/state/identity/invalid_identity_revision_error.rs +38 -0
- package/src/errors/consensus/state/identity/max_identity_public_key_limit_reached_error.rs +26 -0
- package/src/errors/consensus/state/identity/mod.rs +15 -0
- package/src/errors/consensus/state/mod.rs +3 -0
- package/src/errors/consensus_error.rs +612 -0
- package/src/errors/from.rs +24 -0
- package/src/errors/js_conversion.rs +63 -0
- package/src/errors/mod.rs +10 -0
- package/src/errors/public_key_validation_error.rs +23 -0
- package/src/identifier.rs +103 -0
- package/src/identity.rs +253 -0
- package/src/identity_facade.rs +55 -0
- package/src/identity_public_key/key_type.rs +22 -0
- package/src/identity_public_key/mod.rs +192 -0
- package/src/identity_public_key/public_keys_validator.rs +44 -0
- package/src/identity_public_key/purpose.rs +24 -0
- package/src/identity_public_key/security_level.rs +21 -0
- package/src/lib.rs +29 -0
- package/src/metadata.rs +54 -0
- package/src/state_repository.rs +229 -0
- package/src/state_transition/mod.rs +41 -0
- package/src/utils.rs +59 -0
- package/src/validation_result.rs +41 -0
- package/test/integration/DashPlatformProtocol.spec.js +4 -4
- package/test/integration/ajv/keywords/byteArray/addByteArrayKeyword.spec.js +2 -2
- package/test/integration/dataContract/DataContractFacade.spec.js +6 -6
- package/test/integration/dataContract/stateTransition/DataContractCreateTransition/validation/basic/validateDataContractCreateTransitionBasicFactory.spec.js +10 -10
- package/test/integration/dataContract/stateTransition/DataContractUpdateTransition/validation/basic/validateDataContractUpdateTransitionBasicFactory.spec.js +14 -14
- package/test/integration/dataContract/validation/validateDataContractFactory.spec.js +22 -22
- package/test/integration/document/Document.spec.js +10 -5
- package/test/integration/document/DocumentFacade.spec.js +11 -11
- package/test/integration/document/stateTransition/DocumentsBatchTransition/DocumentBatchTransition.spec.js +5 -5
- package/test/integration/document/stateTransition/DocumentsBatchTransition/validation/basic/validateDocumentsBatchTransitionBasicFactory.spec.js +25 -25
- package/test/integration/document/stateTransition/DocumentsBatchTransition/validation/state/executeDataTriggersFactory.spec.js +15 -15
- package/test/integration/document/validation/validateDocumentFactory.spec.js +12 -12
- package/test/integration/error/consensus/createConsensusError.spec.js +3 -3
- package/test/integration/identity/IdentityFacade.spec.js +13 -13
- package/test/integration/identity/stateTransition/IdentityCreateTransition/validation/basic/validateIdentityCreateTransitionBasicFactory.spec.js +12 -12
- package/test/integration/identity/stateTransition/IdentityTopUpTransition/validation/basic/validateIdentityTopUpTransitionBasicFactory.spec.js +11 -11
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/basic/validateIdentityUpdateTransitionBasicFactory.spec.js +8 -8
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validateIdentityUpdateTransitionStateFactory.spec.js +24 -39
- package/test/integration/identity/stateTransition/IdentityUpdateTransition/validation/state/validatePublicKeysState.spec.js +7 -7
- package/test/integration/identity/stateTransition/assetLockProof/chain/validateChainAssetLockProofStructureFactory.spec.js +29 -35
- package/test/integration/identity/stateTransition/assetLockProof/fetchAssetLockTransactionOutputFactory.spec.js +8 -8
- package/test/integration/identity/stateTransition/assetLockProof/instant/validateInstantAssetLockProofStructureFactory.spec.js +11 -11
- package/test/integration/identity/stateTransition/assetLockProof/validateAssetLockTransactionFactory.spec.js +10 -10
- package/test/integration/identity/stateTransition/validatePublicKeySignaturesFactory.spec.js +7 -7
- package/test/integration/identity/validation/validateIdentityFactory.spec.js +8 -8
- package/test/integration/identity/validation/validatePublicKeysFactory.spec.js +50 -24
- package/test/integration/stateTransition/AbstractStateTransitionIdentitySigned.spec.js +14 -14
- package/test/integration/stateTransition/StateTransitionFacade.spec.js +15 -19
- package/test/integration/stateTransition/calculateStateTransitionFee.spec.js +8 -11
- package/test/integration/util/generateEntropy.spec.js +1 -1
- package/test/integration/util/serializer.spec.js +2 -2
- package/test/unit/DashPlatformProtocol.spec.js +4 -4
- package/test/unit/Identifier.spec.js +2 -2
- package/test/unit/Metadata.spec.js +1 -1
- package/test/unit/dataContract/DataContract.spec.js +100 -159
- package/test/unit/dataContract/DataContractFactory.spec.js +55 -111
- package/test/unit/dataContract/createDataContract.spec.js +20 -10
- package/test/unit/dataContract/errors/InvalidDataContractError.spec.js +2 -2
- package/test/unit/dataContract/generateDataContractId.spec.js +23 -6
- package/test/unit/dataContract/getBinaryPropertiesFromSchema.spec.js +1 -1
- package/test/unit/dataContract/getPropertyDefinitionByPath.spec.js +1 -1
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/DataContractCreateTransition.spec.js +20 -67
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/applyDataContractCreateTransitionFactory.spec.js +29 -23
- package/test/unit/dataContract/stateTransition/DataContractCreateTransition/validation/state/validateDataContractCreateTransitionStateFactory.spec.js +48 -45
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/DataContractUpdateTransition.spec.js +8 -8
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/applyDataContractUpdateTransitionFactory.spec.js +6 -6
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/basic/validateIndicesAreBackwardCompatible.spec.js +6 -6
- package/test/unit/dataContract/stateTransition/DataContractUpdateTransition/validation/state/validateDataContractUpdateTransitionStateFactory.spec.js +9 -9
- package/test/unit/dataContract/validation/validateDataContractMaxDepthFactory.spec.js +6 -6
- package/test/unit/dataContract/validation/validateDataContractPatternsFactory.spec.js +3 -3
- package/test/unit/dataTrigger/DataTrigger.spec.js +8 -8
- package/test/unit/dataTrigger/DataTriggerExecutionContext.spec.js +4 -4
- package/test/unit/dataTrigger/dashpayDataTriggers/createContactRequestDataTrigger.spec.js +13 -15
- package/test/unit/dataTrigger/dpnsTriggers/createDomainDataTrigger.spec.js +12 -12
- package/test/unit/dataTrigger/featureFlagDataTriggers/createFeatureFlagDataTrigger.spec.js +11 -13
- package/test/unit/dataTrigger/getDataTriggersFactory.spec.js +7 -7
- package/test/unit/dataTrigger/rejectDataTrigger.spec.js +8 -8
- package/test/unit/dataTrigger/rewardShareDataTriggers/createMasternodeRewardSharesDataTrigger.spec.js +9 -9
- package/test/unit/decodeProtocolEntityFactory.spec.js +4 -4
- package/test/unit/document/Document.spec.js +9 -9
- package/test/unit/document/DocumentFactory.spec.js +19 -19
- package/test/unit/document/errors/InvalidDocumentError.spec.js +2 -2
- package/test/unit/document/fetchAndValidateDataContractFactory.spec.js +8 -8
- package/test/unit/document/stateTransition/DocumetsBatchTransition/DocumentsBatchTransition.spec.js +8 -8
- package/test/unit/document/stateTransition/DocumetsBatchTransition/applyDocumentsBatchTransitionFactory.spec.js +16 -17
- package/test/unit/document/stateTransition/DocumetsBatchTransition/documentTransition/DocumentCreateTransition.spec.js +1 -1
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/basic/findDuplicatesById.spec.js +2 -2
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/basic/findDuplicatesByIndices.spec.js +6 -6
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/basic/validatePartialCompoundIndices.spec.js +7 -7
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/fetchDocumentsFactory.spec.js +6 -6
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsBatchTransitionStateFactory.spec.js +27 -34
- package/test/unit/document/stateTransition/DocumetsBatchTransition/validation/state/validateDocumentsUniquenessByIndicesFactory.spec.js +9 -9
- package/test/unit/errors/consensus/codes.spec.js +7 -7
- package/test/unit/identity/Identity.spec.js +98 -69
- package/test/unit/identity/IdentityFactory.spec.js +15 -15
- package/test/unit/identity/IdentityPublicKey.spec.js +53 -66
- package/test/unit/identity/creditsConverter.spec.js +1 -1
- package/test/unit/identity/errors/InvalidIdentityError.spec.js +2 -2
- package/test/unit/identity/stateTransition/IdentityCreateTransition/IdentityCreateTransition.spec.js +7 -7
- package/test/unit/identity/stateTransition/IdentityCreateTransition/applyIdentityCreateTransitionFactory.spec.js +8 -8
- package/test/unit/identity/stateTransition/IdentityCreateTransition/validation/state/validateIdentityCreateTransitionStateFactory.spec.js +6 -6
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/IdentityTopUpTransition.spec.js +4 -4
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/applyIdentityTopUpTransitionFactory.spec.js +7 -7
- package/test/unit/identity/stateTransition/IdentityTopUpTransition/validation/state/validateIdentityTopUpTransitionStateFactory.spec.js +2 -2
- package/test/unit/identity/stateTransition/IdentityUpdateTransition/IdentityUpdateTransition.spec.js +6 -6
- package/test/unit/identity/stateTransition/IdentityUpdateTransition/applyIdentityUpdateTransitionFactory.spec.js +6 -6
- package/test/unit/identity/stateTransition/assetLockProof/createAssetLockProofInstance.spec.js +5 -5
- package/test/unit/identity/stateTransition/assetLockProof/fetchAssetLockPublicKeyHashFactory.spec.js +3 -3
- package/test/unit/identity/validation/validateRequiredPurposeAndSecurityLevelFactory.spec.js +5 -5
- package/test/unit/stateTransition/StateTransitionFactory.spec.js +8 -8
- package/test/unit/stateTransition/createStateTransitionFactory.spec.js +8 -8
- package/test/unit/stateTransition/errors/InvalidStateTransitionError.spec.js +3 -3
- package/test/unit/stateTransition/validation/validateStateTransitionBasicFactory.spec.js +12 -12
- package/test/unit/stateTransition/validation/validateStateTransitionFeeFactory.spec.js +15 -15
- package/test/unit/stateTransition/validation/validateStateTransitionIdentitySignatureFactory.spec.js +22 -22
- package/test/unit/stateTransition/validation/validateStateTransitionKeySignatureFactory.spec.js +6 -6
- package/test/unit/stateTransition/validation/validateStateTransitionStateFactory.spec.js +9 -9
- package/test/unit/version/validateProtocolVersionFactory.spec.js +7 -7
- package/tsconfig.json +18 -0
- package/wasm/wasm_dpp.d.ts +2850 -0
- package/wasm/wasm_dpp.js +7978 -0
- package/wasm/wasm_dpp_bg.js +1 -0
- package/wasm/wasm_dpp_bg.wasm +0 -0
- package/wasm/wasm_dpp_bg.wasm.d.ts +536 -0
- package/webpack.config.js +22 -19
- package/CHANGELOG.md +0 -397
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
use dpp::prelude::Identifier;
|
|
2
|
+
use wasm_bindgen::prelude::*;
|
|
3
|
+
|
|
4
|
+
use crate::buffer::Buffer;
|
|
5
|
+
|
|
6
|
+
#[wasm_bindgen(js_name=IdentityNotFoundError)]
|
|
7
|
+
pub struct IdentityNotFoundErrorWasm {
|
|
8
|
+
identity_id: Identifier,
|
|
9
|
+
code: u32,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
impl IdentityNotFoundErrorWasm {
|
|
13
|
+
pub fn new(identity_id: Identifier, code: u32) -> Self {
|
|
14
|
+
IdentityNotFoundErrorWasm { identity_id, code }
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=IdentityNotFoundError)]
|
|
19
|
+
impl IdentityNotFoundErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getIdentityId)]
|
|
21
|
+
pub fn get_identity_id(&self) -> Buffer {
|
|
22
|
+
Buffer::from_bytes(self.identity_id.as_bytes())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
26
|
+
pub fn get_code(&self) -> u32 {
|
|
27
|
+
self.code
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DataContractAlreadyPresentError)]
|
|
6
|
+
pub struct DataContractAlreadyPresentErrorWasm {
|
|
7
|
+
data_contract_id: Identifier,
|
|
8
|
+
code: u32,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[wasm_bindgen(js_class=DataContractAlreadyPresentError)]
|
|
12
|
+
impl DataContractAlreadyPresentErrorWasm {
|
|
13
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
14
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
15
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
19
|
+
pub fn get_code(&self) -> u32 {
|
|
20
|
+
self.code
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl DataContractAlreadyPresentErrorWasm {
|
|
25
|
+
pub fn new(data_contract_id: Identifier, code: u32) -> Self {
|
|
26
|
+
Self {
|
|
27
|
+
data_contract_id,
|
|
28
|
+
code,
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use crate::document::state_transition::document_batch_transition::document_transition::from_document_transition_to_js_value;
|
|
3
|
+
|
|
4
|
+
use dpp::identifier::Identifier;
|
|
5
|
+
use dpp::prelude::DocumentTransition;
|
|
6
|
+
use wasm_bindgen::prelude::*;
|
|
7
|
+
|
|
8
|
+
#[wasm_bindgen(js_name=DataTriggerConditionError)]
|
|
9
|
+
pub struct DataTriggerConditionErrorWasm {
|
|
10
|
+
data_contract_id: Identifier,
|
|
11
|
+
document_transition_id: Identifier,
|
|
12
|
+
message: String,
|
|
13
|
+
document_transition: Option<DocumentTransition>,
|
|
14
|
+
owner_id: Option<Identifier>,
|
|
15
|
+
code: u32,
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_class=DataTriggerConditionError)]
|
|
19
|
+
impl DataTriggerConditionErrorWasm {
|
|
20
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
21
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
22
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(js_name=getDocumentTransitionId)]
|
|
26
|
+
pub fn document_transition_id(&self) -> Buffer {
|
|
27
|
+
Buffer::from_bytes(self.document_transition_id.as_bytes())
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=getMessage)]
|
|
31
|
+
pub fn message(&self) -> String {
|
|
32
|
+
self.message.clone()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#[wasm_bindgen(js_name=getTimestamp)]
|
|
36
|
+
pub fn document_transition(&self) -> JsValue {
|
|
37
|
+
if let Some(document_transition) = &self.document_transition {
|
|
38
|
+
from_document_transition_to_js_value(document_transition.clone())
|
|
39
|
+
} else {
|
|
40
|
+
JsValue::undefined()
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[wasm_bindgen(js_name=getOwnerId)]
|
|
45
|
+
pub fn owner_id(&self) -> Option<Buffer> {
|
|
46
|
+
let owner_id = self.owner_id.as_ref()?;
|
|
47
|
+
Some(Buffer::from_bytes(owner_id.as_bytes()))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
51
|
+
pub fn get_code(&self) -> u32 {
|
|
52
|
+
self.code
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
impl DataTriggerConditionErrorWasm {
|
|
57
|
+
pub fn new(
|
|
58
|
+
data_contract_id: Identifier,
|
|
59
|
+
document_transition_id: Identifier,
|
|
60
|
+
message: String,
|
|
61
|
+
document_transition: Option<DocumentTransition>,
|
|
62
|
+
owner_id: Option<Identifier>,
|
|
63
|
+
code: u32,
|
|
64
|
+
) -> Self {
|
|
65
|
+
Self {
|
|
66
|
+
data_contract_id,
|
|
67
|
+
document_transition_id,
|
|
68
|
+
message,
|
|
69
|
+
document_transition,
|
|
70
|
+
owner_id,
|
|
71
|
+
code,
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use crate::document::state_transition::document_batch_transition::document_transition::from_document_transition_to_js_value;
|
|
3
|
+
|
|
4
|
+
use dpp::identifier::Identifier;
|
|
5
|
+
use dpp::prelude::DocumentTransition;
|
|
6
|
+
use wasm_bindgen::prelude::*;
|
|
7
|
+
|
|
8
|
+
#[wasm_bindgen(js_name=DataTriggerExecutionError)]
|
|
9
|
+
pub struct DataTriggerExecutionErrorWasm {
|
|
10
|
+
data_contract_id: Identifier,
|
|
11
|
+
document_transition_id: Identifier,
|
|
12
|
+
message: String,
|
|
13
|
+
execution_error: JsError,
|
|
14
|
+
document_transition: Option<DocumentTransition>,
|
|
15
|
+
owner_id: Option<Identifier>,
|
|
16
|
+
code: u32,
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[wasm_bindgen(js_class=DataTriggerExecutionError)]
|
|
20
|
+
impl DataTriggerExecutionErrorWasm {
|
|
21
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
22
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
23
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
#[wasm_bindgen(js_name=getExecutionError)]
|
|
27
|
+
pub fn data_execution_error(&self) -> JsError {
|
|
28
|
+
self.execution_error.clone()
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
#[wasm_bindgen(js_name=getDocumentTransitionId)]
|
|
32
|
+
pub fn document_transition_id(&self) -> Buffer {
|
|
33
|
+
Buffer::from_bytes(self.document_transition_id.as_bytes())
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
#[wasm_bindgen(js_name=getMessage)]
|
|
37
|
+
pub fn message(&self) -> String {
|
|
38
|
+
self.message.clone()
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#[wasm_bindgen(js_name=getTimestamp)]
|
|
42
|
+
pub fn document_transition(&self) -> JsValue {
|
|
43
|
+
if let Some(document_transition) = &self.document_transition {
|
|
44
|
+
from_document_transition_to_js_value(document_transition.clone())
|
|
45
|
+
} else {
|
|
46
|
+
JsValue::undefined()
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
#[wasm_bindgen(js_name=getOwnerId)]
|
|
51
|
+
pub fn owner_id(&self) -> Option<Buffer> {
|
|
52
|
+
let owner_id = self.owner_id.as_ref()?;
|
|
53
|
+
Some(Buffer::from_bytes(owner_id.as_bytes()))
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
57
|
+
pub fn get_code(&self) -> u32 {
|
|
58
|
+
self.code
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
impl DataTriggerExecutionErrorWasm {
|
|
63
|
+
pub fn new(
|
|
64
|
+
data_contract_id: Identifier,
|
|
65
|
+
document_transition_id: Identifier,
|
|
66
|
+
message: String,
|
|
67
|
+
execution_error: wasm_bindgen::JsError,
|
|
68
|
+
document_transition: Option<DocumentTransition>,
|
|
69
|
+
owner_id: Option<Identifier>,
|
|
70
|
+
code: u32,
|
|
71
|
+
) -> Self {
|
|
72
|
+
Self {
|
|
73
|
+
data_contract_id,
|
|
74
|
+
document_transition_id,
|
|
75
|
+
message,
|
|
76
|
+
execution_error,
|
|
77
|
+
document_transition,
|
|
78
|
+
owner_id,
|
|
79
|
+
code,
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
package/src/errors/consensus/state/data_contract/data_trigger/data_trigger_invalid_result_error.rs
ADDED
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use crate::document::state_transition::document_batch_transition::document_transition::from_document_transition_to_js_value;
|
|
3
|
+
|
|
4
|
+
use dpp::identifier::Identifier;
|
|
5
|
+
use dpp::prelude::DocumentTransition;
|
|
6
|
+
use wasm_bindgen::prelude::*;
|
|
7
|
+
|
|
8
|
+
#[wasm_bindgen(js_name=DataTriggerInvalidResultError)]
|
|
9
|
+
pub struct DataTriggerInvalidResultErrorWasm {
|
|
10
|
+
data_contract_id: Identifier,
|
|
11
|
+
document_transition_id: Identifier,
|
|
12
|
+
document_transition: Option<DocumentTransition>,
|
|
13
|
+
owner_id: Option<Identifier>,
|
|
14
|
+
code: u32,
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[wasm_bindgen(js_class=DataTriggerInvalidResultError)]
|
|
18
|
+
impl DataTriggerInvalidResultErrorWasm {
|
|
19
|
+
#[wasm_bindgen(js_name=getDataContractId)]
|
|
20
|
+
pub fn data_contract_id(&self) -> Buffer {
|
|
21
|
+
Buffer::from_bytes(self.data_contract_id.as_bytes())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#[wasm_bindgen(js_name=getDocumentTransitionId)]
|
|
25
|
+
pub fn document_transition_id(&self) -> Buffer {
|
|
26
|
+
Buffer::from_bytes(self.document_transition_id.as_bytes())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
#[wasm_bindgen(js_name=getTimestamp)]
|
|
30
|
+
pub fn document_transition(&self) -> JsValue {
|
|
31
|
+
if let Some(document_transition) = &self.document_transition {
|
|
32
|
+
from_document_transition_to_js_value(document_transition.clone())
|
|
33
|
+
} else {
|
|
34
|
+
JsValue::undefined()
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
#[wasm_bindgen(js_name=getOwnerId)]
|
|
39
|
+
pub fn owner_id(&self) -> Option<Buffer> {
|
|
40
|
+
let owner_id = self.owner_id.as_ref()?;
|
|
41
|
+
Some(Buffer::from_bytes(owner_id.as_bytes()))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
45
|
+
pub fn get_code(&self) -> u32 {
|
|
46
|
+
self.code
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
impl DataTriggerInvalidResultErrorWasm {
|
|
51
|
+
pub fn new(
|
|
52
|
+
data_contract_id: Identifier,
|
|
53
|
+
document_transition_id: Identifier,
|
|
54
|
+
document_transition: Option<DocumentTransition>,
|
|
55
|
+
owner_id: Option<Identifier>,
|
|
56
|
+
code: u32,
|
|
57
|
+
) -> Self {
|
|
58
|
+
Self {
|
|
59
|
+
data_contract_id,
|
|
60
|
+
document_transition_id,
|
|
61
|
+
document_transition,
|
|
62
|
+
owner_id,
|
|
63
|
+
code,
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DocumentAlreadyPresentError)]
|
|
6
|
+
pub struct DocumentAlreadyPresentErrorWasm {
|
|
7
|
+
document_id: Identifier,
|
|
8
|
+
code: u32,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[wasm_bindgen(js_class=DocumentAlreadyPresentError)]
|
|
12
|
+
impl DocumentAlreadyPresentErrorWasm {
|
|
13
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
14
|
+
pub fn document_id(&self) -> Buffer {
|
|
15
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
19
|
+
pub fn get_code(&self) -> u32 {
|
|
20
|
+
self.code
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl DocumentAlreadyPresentErrorWasm {
|
|
25
|
+
pub fn new(document_id: Identifier, code: u32) -> Self {
|
|
26
|
+
Self { document_id, code }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DocumentNotFoundError)]
|
|
6
|
+
pub struct DocumentNotFoundErrorWasm {
|
|
7
|
+
document_id: Identifier,
|
|
8
|
+
code: u32,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[wasm_bindgen(js_class=DocumentNotFoundError)]
|
|
12
|
+
impl DocumentNotFoundErrorWasm {
|
|
13
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
14
|
+
pub fn document_id(&self) -> Buffer {
|
|
15
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
19
|
+
pub fn get_code(&self) -> u32 {
|
|
20
|
+
self.code
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl DocumentNotFoundErrorWasm {
|
|
25
|
+
pub fn new(document_id: Identifier, code: u32) -> Self {
|
|
26
|
+
Self { document_id, code }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DocumentOwnerIdMismatchError)]
|
|
6
|
+
pub struct DocumentOwnerIdMismatchErrorWasm {
|
|
7
|
+
document_id: Identifier,
|
|
8
|
+
document_owner_id: Identifier,
|
|
9
|
+
existing_document_owner_id: Identifier,
|
|
10
|
+
code: u32,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[wasm_bindgen(js_class=DocumentOwnerIdMismatchError)]
|
|
14
|
+
impl DocumentOwnerIdMismatchErrorWasm {
|
|
15
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
16
|
+
pub fn document_id(&self) -> Buffer {
|
|
17
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[wasm_bindgen(js_name=getDocumentOwnerId)]
|
|
21
|
+
pub fn document_owner_id(&self) -> Buffer {
|
|
22
|
+
Buffer::from_bytes(self.document_owner_id.as_bytes())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
#[wasm_bindgen(js_name=getExistingDocumentOwnerId)]
|
|
26
|
+
pub fn existing_document_owner_id(&self) -> Buffer {
|
|
27
|
+
Buffer::from_bytes(self.existing_document_owner_id.as_bytes())
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
31
|
+
pub fn get_code(&self) -> u32 {
|
|
32
|
+
self.code
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
impl DocumentOwnerIdMismatchErrorWasm {
|
|
37
|
+
pub fn new(
|
|
38
|
+
document_id: Identifier,
|
|
39
|
+
document_owner_id: Identifier,
|
|
40
|
+
existing_document_owner_id: Identifier,
|
|
41
|
+
code: u32,
|
|
42
|
+
) -> Self {
|
|
43
|
+
Self {
|
|
44
|
+
document_id,
|
|
45
|
+
document_owner_id,
|
|
46
|
+
existing_document_owner_id,
|
|
47
|
+
code,
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DocumentTimestampWindowViolationError)]
|
|
6
|
+
pub struct DocumentTimestampWindowViolationErrorWasm {
|
|
7
|
+
timestamp_name: String,
|
|
8
|
+
document_id: Identifier,
|
|
9
|
+
timestamp: i64,
|
|
10
|
+
time_window_start: i64,
|
|
11
|
+
time_window_end: i64,
|
|
12
|
+
code: u32,
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
#[wasm_bindgen(js_class=DocumentTimestampWindowViolationError)]
|
|
16
|
+
impl DocumentTimestampWindowViolationErrorWasm {
|
|
17
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
18
|
+
pub fn document_id(&self) -> Buffer {
|
|
19
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#[wasm_bindgen(js_name=getTimestampName)]
|
|
23
|
+
pub fn timestamp_name(&self) -> String {
|
|
24
|
+
self.timestamp_name.clone()
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
#[wasm_bindgen(js_name=getTimestamp)]
|
|
28
|
+
pub fn timestamp(&self) -> js_sys::Date {
|
|
29
|
+
// TODO: Figure out how to match rust timestamps with JS timestamps
|
|
30
|
+
let timestamp = JsValue::from(self.timestamp as u32);
|
|
31
|
+
js_sys::Date::new(×tamp)
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
#[wasm_bindgen(js_name=getTimeWindowStart)]
|
|
35
|
+
pub fn time_window_start(&self) -> js_sys::Date {
|
|
36
|
+
// TODO: Figure out how to match rust timestamps with JS timestamps
|
|
37
|
+
let timestamp = JsValue::from(self.time_window_start as u32);
|
|
38
|
+
js_sys::Date::new(×tamp)
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
#[wasm_bindgen(js_name=getTimeWindowEnd)]
|
|
42
|
+
pub fn time_window_end(&self) -> js_sys::Date {
|
|
43
|
+
// TODO: Figure out how to match rust timestamps with JS timestamps
|
|
44
|
+
let timestamp = JsValue::from(self.time_window_end as u32);
|
|
45
|
+
js_sys::Date::new(×tamp)
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
49
|
+
pub fn get_code(&self) -> u32 {
|
|
50
|
+
self.code
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
impl DocumentTimestampWindowViolationErrorWasm {
|
|
55
|
+
pub fn new(
|
|
56
|
+
timestamp_name: String,
|
|
57
|
+
document_id: Identifier,
|
|
58
|
+
timestamp: i64,
|
|
59
|
+
time_window_start: i64,
|
|
60
|
+
time_window_end: i64,
|
|
61
|
+
code: u32,
|
|
62
|
+
) -> Self {
|
|
63
|
+
Self {
|
|
64
|
+
timestamp_name,
|
|
65
|
+
document_id,
|
|
66
|
+
timestamp,
|
|
67
|
+
time_window_start,
|
|
68
|
+
time_window_end,
|
|
69
|
+
code,
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=DocumentTimestampsMismatchError)]
|
|
6
|
+
pub struct DocumentTimestampsMismatchErrorWasm {
|
|
7
|
+
document_id: Identifier,
|
|
8
|
+
code: u32,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
#[wasm_bindgen(js_class=DocumentTimestampsMismatchError)]
|
|
12
|
+
impl DocumentTimestampsMismatchErrorWasm {
|
|
13
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
14
|
+
pub fn document_id(&self) -> Buffer {
|
|
15
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
19
|
+
pub fn get_code(&self) -> u32 {
|
|
20
|
+
self.code
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
impl DocumentTimestampsMismatchErrorWasm {
|
|
25
|
+
pub fn new(document_id: Identifier, code: u32) -> Self {
|
|
26
|
+
Self { document_id, code }
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use js_sys::JsString;
|
|
4
|
+
use wasm_bindgen::prelude::*;
|
|
5
|
+
|
|
6
|
+
#[wasm_bindgen(js_name=DuplicateUniqueIndexError)]
|
|
7
|
+
pub struct DuplicateUniqueIndexErrorWasm {
|
|
8
|
+
document_id: Identifier,
|
|
9
|
+
duplicating_properties: Vec<String>,
|
|
10
|
+
code: u32,
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
#[wasm_bindgen(js_class=DuplicateUniqueIndexError)]
|
|
14
|
+
impl DuplicateUniqueIndexErrorWasm {
|
|
15
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
16
|
+
pub fn document_id(&self) -> Buffer {
|
|
17
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
#[wasm_bindgen(js_name=getDuplicatingProperties)]
|
|
21
|
+
pub fn duplicating_properties(&self) -> js_sys::Array {
|
|
22
|
+
self.duplicating_properties
|
|
23
|
+
.iter()
|
|
24
|
+
.map(|string| JsString::from(string.as_ref()))
|
|
25
|
+
.collect()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
29
|
+
pub fn get_code(&self) -> u32 {
|
|
30
|
+
self.code
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
impl DuplicateUniqueIndexErrorWasm {
|
|
35
|
+
pub fn new(document_id: Identifier, duplicating_properties: Vec<String>, code: u32) -> Self {
|
|
36
|
+
Self {
|
|
37
|
+
document_id,
|
|
38
|
+
duplicating_properties,
|
|
39
|
+
code,
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::identifier::Identifier;
|
|
3
|
+
use wasm_bindgen::prelude::*;
|
|
4
|
+
|
|
5
|
+
#[wasm_bindgen(js_name=InvalidDocumentRevisionError)]
|
|
6
|
+
pub struct InvalidDocumentRevisionErrorWasm {
|
|
7
|
+
document_id: Identifier,
|
|
8
|
+
current_revision: u32,
|
|
9
|
+
code: u32,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
#[wasm_bindgen(js_class=InvalidDocumentRevisionError)]
|
|
13
|
+
impl InvalidDocumentRevisionErrorWasm {
|
|
14
|
+
#[wasm_bindgen(js_name=getDocumentId)]
|
|
15
|
+
pub fn document_id(&self) -> Buffer {
|
|
16
|
+
Buffer::from_bytes(self.document_id.as_bytes())
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
#[wasm_bindgen(js_name=getCurrentRevision)]
|
|
20
|
+
pub fn current_revision(&self) -> u32 {
|
|
21
|
+
self.current_revision
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
25
|
+
pub fn get_code(&self) -> u32 {
|
|
26
|
+
self.code
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
impl InvalidDocumentRevisionErrorWasm {
|
|
31
|
+
pub fn new(document_id: Identifier, current_revision: u32, code: u32) -> Self {
|
|
32
|
+
Self {
|
|
33
|
+
document_id,
|
|
34
|
+
current_revision,
|
|
35
|
+
code,
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
mod document_already_present_error;
|
|
2
|
+
mod document_not_found_error;
|
|
3
|
+
mod document_owner_id_mismatch_error;
|
|
4
|
+
mod document_timestamp_window_violation_error;
|
|
5
|
+
mod document_timestamps_mismatch_error;
|
|
6
|
+
mod duplicate_unique_index_error;
|
|
7
|
+
mod invalid_document_revision_error;
|
|
8
|
+
|
|
9
|
+
pub use document_already_present_error::*;
|
|
10
|
+
pub use document_not_found_error::*;
|
|
11
|
+
pub use document_owner_id_mismatch_error::*;
|
|
12
|
+
pub use document_timestamp_window_violation_error::*;
|
|
13
|
+
pub use document_timestamps_mismatch_error::*;
|
|
14
|
+
pub use duplicate_unique_index_error::*;
|
|
15
|
+
pub use invalid_document_revision_error::*;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
use crate::buffer::Buffer;
|
|
2
|
+
use dpp::consensus::state::identity::IdentityAlreadyExistsError;
|
|
3
|
+
use dpp::consensus::ConsensusError;
|
|
4
|
+
use wasm_bindgen::prelude::*;
|
|
5
|
+
|
|
6
|
+
#[wasm_bindgen(js_name=IdentityAlreadyExistsError)]
|
|
7
|
+
pub struct IdentityAlreadyExistsErrorWasm {
|
|
8
|
+
inner: IdentityAlreadyExistsError,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
impl From<&IdentityAlreadyExistsError> for IdentityAlreadyExistsErrorWasm {
|
|
12
|
+
fn from(e: &IdentityAlreadyExistsError) -> Self {
|
|
13
|
+
Self { inner: e.clone() }
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
#[wasm_bindgen(js_class=IdentityAlreadyExistsError)]
|
|
18
|
+
impl IdentityAlreadyExistsErrorWasm {
|
|
19
|
+
#[wasm_bindgen(js_name=getIdentityId)]
|
|
20
|
+
pub fn identity_id(&self) -> Buffer {
|
|
21
|
+
Buffer::from_bytes(self.inner.identity_id())
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#[wasm_bindgen(js_name=getCode)]
|
|
25
|
+
pub fn get_code(&self) -> u32 {
|
|
26
|
+
ConsensusError::from(self.inner.clone()).code()
|
|
27
|
+
}
|
|
28
|
+
}
|