@dashevo/wasm-dpp 1.4.0-dev.3 → 1.4.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": "1.4.0-dev.3",
3
+ "version": "1.4.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.23.3",
45
45
  "@babel/preset-env": "^7.23.3",
46
46
  "@dashevo/dashcore-lib": "~0.21.3",
47
- "@dashevo/dpns-contract": "1.4.0-dev.3",
47
+ "@dashevo/dpns-contract": "1.4.0-dev.5",
48
48
  "@types/bs58": "^4.0.1",
49
49
  "@types/node": "^14.6.0",
50
50
  "@yarnpkg/pnpify": "^4.0.0-rc.42",
@@ -63,7 +63,7 @@ use dpp::consensus::state::data_trigger::DataTriggerError::{
63
63
  use wasm_bindgen::{JsError, JsValue};
64
64
  use dpp::consensus::basic::data_contract::{ContestedUniqueIndexOnMutableDocumentTypeError, ContestedUniqueIndexWithUniqueIndexError, InvalidDocumentTypeRequiredSecurityLevelError, UnknownDocumentCreationRestrictionModeError, UnknownSecurityLevelError, UnknownStorageKeyRequirementsError, UnknownTradeModeError, UnknownTransferableTypeError};
65
65
  use dpp::consensus::basic::document::{ContestedDocumentsTemporarilyNotAllowedError, DocumentCreationNotAllowedError, DocumentFieldMaxSizeExceededError, MaxDocumentsTransitionsExceededError, MissingPositionsInDocumentTypePropertiesError};
66
- use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, TooManyMasterPublicKeyError};
66
+ use dpp::consensus::basic::identity::{DataContractBoundsNotPresentError, DisablingKeyIdAlsoBeingAddedInSameTransitionError, InvalidIdentityCreditWithdrawalTransitionAmountError, InvalidIdentityUpdateTransitionDisableKeysError, InvalidIdentityUpdateTransitionEmptyError, TooManyMasterPublicKeyError, WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError};
67
67
  use dpp::consensus::basic::overflow_error::OverflowError;
68
68
  use dpp::consensus::state::data_contract::document_type_update_error::DocumentTypeUpdateError;
69
69
  use dpp::consensus::state::document::document_contest_currently_locked_error::DocumentContestCurrentlyLockedError;
@@ -560,6 +560,13 @@ fn from_basic_error(basic_error: &BasicError) -> JsValue {
560
560
  BasicError::ContestedDocumentsTemporarilyNotAllowedError(e) => {
561
561
  generic_consensus_error!(ContestedDocumentsTemporarilyNotAllowedError, e).into()
562
562
  }
563
+ BasicError::WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError(e) => {
564
+ generic_consensus_error!(
565
+ WithdrawalOutputScriptNotAllowedWhenSigningWithOwnerKeyError,
566
+ e
567
+ )
568
+ .into()
569
+ }
563
570
  }
564
571
  }
565
572
 
@@ -206,7 +206,7 @@ impl IdentityFacadeWasm {
206
206
  amount: u64,
207
207
  core_fee_per_byte: u32,
208
208
  pooling: u8,
209
- output_script: Vec<u8>,
209
+ output_script: Option<Vec<u8>>,
210
210
  identity_nonce: u64,
211
211
  ) -> Result<IdentityCreditWithdrawalTransitionWasm, JsValue> {
212
212
  let pooling = match pooling {
@@ -222,7 +222,7 @@ impl IdentityFacadeWasm {
222
222
  amount,
223
223
  core_fee_per_byte,
224
224
  pooling,
225
- CoreScript::from_bytes(output_script),
225
+ output_script.map(CoreScript::from_bytes),
226
226
  identity_nonce as IdentityNonce,
227
227
  )
228
228
  .map(Into::into)
@@ -210,7 +210,7 @@ impl IdentityFactoryWasm {
210
210
  amount: u64,
211
211
  core_fee_per_byte: u32,
212
212
  pooling: u8,
213
- output_script: Vec<u8>,
213
+ output_script: Option<Vec<u8>>,
214
214
  identity_nonce: u64,
215
215
  ) -> Result<IdentityCreditWithdrawalTransitionWasm, JsValue> {
216
216
  let pooling = match pooling {
@@ -226,7 +226,7 @@ impl IdentityFactoryWasm {
226
226
  amount,
227
227
  core_fee_per_byte,
228
228
  pooling,
229
- CoreScript::from_bytes(output_script),
229
+ output_script.map(CoreScript::from_bytes),
230
230
  identity_nonce as IdentityNonce,
231
231
  )
232
232
  .map(Into::into)
@@ -15,6 +15,8 @@ pub enum PurposeWasm {
15
15
  SYSTEM = 4,
16
16
  /// this key cannot be used for signing documents
17
17
  VOTING = 5,
18
+ /// this key is only for masternode owners
19
+ OWNER = 6,
18
20
  }
19
21
 
20
22
  impl From<Purpose> for PurposeWasm {
@@ -26,6 +28,7 @@ impl From<Purpose> for PurposeWasm {
26
28
  Purpose::TRANSFER => PurposeWasm::TRANSFER,
27
29
  Purpose::SYSTEM => PurposeWasm::SYSTEM,
28
30
  Purpose::VOTING => PurposeWasm::VOTING,
31
+ Purpose::OWNER => PurposeWasm::OWNER,
29
32
  }
30
33
  }
31
34
  }
@@ -24,7 +24,7 @@ describe('IdentityFacade', () => {
24
24
  beforeEach(async () => {
25
25
  dpp = new DashPlatformProtocol(
26
26
  { generate: () => crypto.randomBytes(32) },
27
- 1,
27
+ 3,
28
28
  );
29
29
 
30
30
  const chainAssetLockProofJS = getChainAssetLockProofFixture();
@@ -26,7 +26,7 @@ describe('IdentityFactory', () => {
26
26
 
27
27
  // const identityValidator = new IdentityValidator(blsAdapter);
28
28
 
29
- factory = new IdentityFactory(1);
29
+ factory = new IdentityFactory(3);
30
30
 
31
31
  identity = await getIdentityFixture(instantAssetLockProof.createIdentifier());
32
32
  identity.setBalance(0);
@@ -75,7 +75,7 @@ describe('IdentityCreditWithdrawalTransition', () => {
75
75
  rawStateTransition = stateTransition.toObject();
76
76
 
77
77
  expect(rawStateTransition).to.deep.equal({
78
- $version: '0',
78
+ $version: '1',
79
79
  type: StateTransitionTypes.IdentityCreditWithdrawal,
80
80
  identityId: stateTransition.getIdentityId().toBuffer(),
81
81
  amount: stateTransition.getAmount(),
@@ -92,7 +92,7 @@ describe('IdentityCreditWithdrawalTransition', () => {
92
92
  rawStateTransition = stateTransition.toObject({ skipSignature: true });
93
93
 
94
94
  expect(rawStateTransition).to.deep.equal({
95
- $version: '0',
95
+ $version: '1',
96
96
  type: StateTransitionTypes.IdentityCreditWithdrawal,
97
97
  identityId: stateTransition.getIdentityId().toBuffer(),
98
98
  amount: stateTransition.getAmount(),
@@ -109,7 +109,7 @@ describe('IdentityCreditWithdrawalTransition', () => {
109
109
  const jsonStateTransition = stateTransition.toJSON();
110
110
 
111
111
  expect(jsonStateTransition).to.deep.equal({
112
- $version: '0',
112
+ $version: '1',
113
113
  type: StateTransitionTypes.IdentityCreditWithdrawal,
114
114
  identityId: stateTransition.getIdentityId().toString(),
115
115
  amount: stateTransition.getAmount().toString(),