@dashevo/dashpay-contract 0.2.0 → 0.21.4

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/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # [0.4.0](https://github.com/dashevo/dashpay-contract/compare/v0.3.0...v0.4.0) (2021-08-17)
2
+
3
+
4
+ ### Features
5
+
6
+ * update contract to work with DPP 0.20 ([#12](https://github.com/dashevo/dashpay-contract/issues/12))
7
+
8
+
9
+
1
10
  # [0.2.0](https://github.com/dashevo/dashpay-contract/compare/v0.1.0...v0.2.0) (2021-02-02)
2
11
 
3
12
 
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # DashPay Contract
2
2
 
3
3
  [![NPM Version](https://img.shields.io/npm/v/@dashevo/dashpay-contract)](https://www.npmjs.com/package/@dashevo/dashpay-contract)
4
- [![Build Status](https://travis-ci.com/dashevo/dashpay-contract.svg?branch=master)](https://travis-ci.com/dashevo/dashpay-contract)
4
+ [![Build Status](https://github.com/dashevo/dashpay-contract/actions/workflows/test_and_release.yml/badge.svg)](https://github.com/dashevo/dashpay-contract/actions/workflows/test_and_release.yml)
5
5
  [![Release Date](https://img.shields.io/github/release-date/dashevo/dashpay-contract)](https://github.com/dashevo/dashpay-contract/releases/latest)
6
6
  [![license](https://img.shields.io/github/license/dashevo/dashpay-contract.svg)](LICENSE)
7
7
  [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen)](https://github.com/RichardLitt/standard-readme)
8
8
 
9
- > Reference contract of the DashPay Application Contract
9
+ Reference contract of the DashPay Application Contract
10
10
 
11
11
  DashPay allows Dash user to create a DashPay profile on the Platform chain.
12
12
  This profile can be used to interact with other DashPay profiles, may it be for the purpose of sending/receiving transactions without having to go around the process of querying the public address of the recipient.
package/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@dashevo/dashpay-contract",
3
- "version": "0.2.0",
3
+ "version": "0.21.4",
4
4
  "description": "Reference contract of the DashPay DPA on Dash Evolution",
5
5
  "scripts": {
6
- "check-package": "npm run check-package:name && npm run check-package:version",
7
- "check-package:name": "test $(jq -r .name package.json) = $(jq -r .name package-lock.json)",
8
- "check-package:version": "test $(jq -r .version package.json) = $(jq -r .version package-lock.json)",
9
6
  "lint": "eslint .",
10
7
  "test": "npm run test:unit",
11
8
  "test:unit": "mocha 'test/unit/*.spec.js'"
@@ -28,14 +25,14 @@
28
25
  },
29
26
  "homepage": "https://github.com/dashevo/dashpay-contract#readme",
30
27
  "devDependencies": {
31
- "@dashevo/dpp": "^0.17.0",
32
- "chai": "^4.2.0",
28
+ "@dashevo/dpp": "~0.21.4",
29
+ "chai": "^4.3.4",
33
30
  "dirty-chai": "^2.0.1",
34
- "eslint": "^7.7.0",
35
- "eslint-config-airbnb-base": "^14.2.0",
36
- "eslint-plugin-import": "^2.22.0",
37
- "mocha": "^8.1.1",
38
- "sinon": "^9.0.3",
39
- "sinon-chai": "^3.5.0"
31
+ "eslint": "^7.32.0",
32
+ "eslint-config-airbnb-base": "^14.2.1",
33
+ "eslint-plugin-import": "^2.24.2",
34
+ "mocha": "^9.1.2",
35
+ "sinon": "^11.1.2",
36
+ "sinon-chai": "^3.7.0"
40
37
  }
41
38
  }
@@ -1,5 +1,6 @@
1
1
  {
2
2
  "profile": {
3
+ "type": "object",
3
4
  "indices": [
4
5
  {
5
6
  "properties": [
@@ -56,6 +57,7 @@
56
57
  "additionalProperties": false
57
58
  },
58
59
  "contactInfo": {
60
+ "type": "object",
59
61
  "indices": [
60
62
  {
61
63
  "properties": [
@@ -116,6 +118,7 @@
116
118
  "additionalProperties": false
117
119
  },
118
120
  "contactRequest": {
121
+ "type": "object",
119
122
  "indices": [
120
123
  {
121
124
  "properties": [
@@ -211,8 +214,7 @@
211
214
  "encryptedPublicKey",
212
215
  "senderKeyIndex",
213
216
  "recipientKeyIndex",
214
- "accountReference",
215
- "coreHeightCreatedAt"
217
+ "accountReference"
216
218
  ],
217
219
  "additionalProperties": false
218
220
  }
@@ -12,7 +12,7 @@ describe('Dashpay Contract', () => {
12
12
  let contract;
13
13
  let identityId;
14
14
 
15
- beforeEach(function beforeEach() {
15
+ beforeEach(async function beforeEach() {
16
16
  const fetchContractStub = this.sinon.stub();
17
17
 
18
18
  dpp = new DashPlatformProtocol({
@@ -21,6 +21,8 @@ describe('Dashpay Contract', () => {
21
21
  },
22
22
  });
23
23
 
24
+ await dpp.initialize();
25
+
24
26
  identityId = generateRandomIdentifier();
25
27
 
26
28
  contract = dpp.dataContract.create(identityId, schema);
@@ -28,7 +30,9 @@ describe('Dashpay Contract', () => {
28
30
  fetchContractStub.resolves(contract);
29
31
  });
30
32
 
31
- it('should have a valid contract definition', async () => {
33
+ it('should have a valid contract definition', async function shouldHaveValidContract() {
34
+ this.timeout(5000);
35
+
32
36
  const validationResult = await dpp.dataContract.validate(contract);
33
37
 
34
38
  expect(validationResult.isValid()).to.be.true();
@@ -61,7 +65,7 @@ describe('Dashpay Contract', () => {
61
65
 
62
66
  expect(error.name).to.equal('JsonSchemaError');
63
67
  expect(error.keyword).to.equal('maxLength');
64
- expect(error.dataPath).to.equal('.displayName');
68
+ expect(error.instancePath).to.equal('/displayName');
65
69
  }
66
70
  });
67
71
  });
@@ -82,7 +86,7 @@ describe('Dashpay Contract', () => {
82
86
 
83
87
  expect(error.name).to.equal('JsonSchemaError');
84
88
  expect(error.keyword).to.equal('maxLength');
85
- expect(error.dataPath).to.equal('.publicMessage');
89
+ expect(error.instancePath).to.equal('/publicMessage');
86
90
  }
87
91
  });
88
92
  });
@@ -103,7 +107,7 @@ describe('Dashpay Contract', () => {
103
107
 
104
108
  expect(error.name).to.equal('JsonSchemaError');
105
109
  expect(error.keyword).to.equal('format');
106
- expect(error.dataPath).to.equal('.avatarUrl');
110
+ expect(error.instancePath).to.equal('/avatarUrl');
107
111
  }
108
112
  });
109
113
 
@@ -122,7 +126,7 @@ describe('Dashpay Contract', () => {
122
126
 
123
127
  expect(error.name).to.equal('JsonSchemaError');
124
128
  expect(error.keyword).to.equal('maxLength');
125
- expect(error.dataPath).to.equal('.avatarUrl');
129
+ expect(error.instancePath).to.equal('/avatarUrl');
126
130
  }
127
131
  });
128
132
 
@@ -141,7 +145,7 @@ describe('Dashpay Contract', () => {
141
145
 
142
146
  expect(error.name).to.equal('JsonSchemaError');
143
147
  expect(error.keyword).to.equal('format');
144
- expect(error.dataPath).to.equal('.avatarUrl');
148
+ expect(error.instancePath).to.equal('/avatarUrl');
145
149
  }
146
150
  });
147
151
  });
@@ -160,7 +164,7 @@ describe('Dashpay Contract', () => {
160
164
  const [error] = e.errors;
161
165
  expect(error.name).to.equal('JsonSchemaError');
162
166
  expect(error.keyword).to.equal('minItems');
163
- expect(error.dataPath).to.equal('.avatarHash');
167
+ expect(error.instancePath).to.equal('/avatarHash');
164
168
  }
165
169
  });
166
170
 
@@ -177,7 +181,7 @@ describe('Dashpay Contract', () => {
177
181
  const [error] = e.errors;
178
182
  expect(error.name).to.equal('JsonSchemaError');
179
183
  expect(error.keyword).to.equal('maxItems');
180
- expect(error.dataPath).to.equal('.avatarHash');
184
+ expect(error.instancePath).to.equal('/avatarHash');
181
185
  }
182
186
  });
183
187
 
@@ -194,7 +198,7 @@ describe('Dashpay Contract', () => {
194
198
  const [error] = e.errors;
195
199
  expect(error.name).to.equal('JsonSchemaError');
196
200
  expect(error.keyword).to.equal('type');
197
- expect(error.dataPath).to.equal('.avatarHash');
201
+ expect(error.instancePath).to.equal('/avatarHash');
198
202
  }
199
203
  });
200
204
  });
@@ -213,7 +217,7 @@ describe('Dashpay Contract', () => {
213
217
  const [error] = e.errors;
214
218
  expect(error.name).to.equal('JsonSchemaError');
215
219
  expect(error.keyword).to.equal('minItems');
216
- expect(error.dataPath).to.equal('.avatarFingerprint');
220
+ expect(error.instancePath).to.equal('/avatarFingerprint');
217
221
  }
218
222
  });
219
223
 
@@ -230,7 +234,7 @@ describe('Dashpay Contract', () => {
230
234
  const [error] = e.errors;
231
235
  expect(error.name).to.equal('JsonSchemaError');
232
236
  expect(error.keyword).to.equal('maxItems');
233
- expect(error.dataPath).to.equal('.avatarFingerprint');
237
+ expect(error.instancePath).to.equal('/avatarFingerprint');
234
238
  }
235
239
  });
236
240
 
@@ -247,7 +251,7 @@ describe('Dashpay Contract', () => {
247
251
  const [error] = e.errors;
248
252
  expect(error.name).to.equal('JsonSchemaError');
249
253
  expect(error.keyword).to.equal('type');
250
- expect(error.dataPath).to.equal('.avatarFingerprint');
254
+ expect(error.instancePath).to.equal('/avatarFingerprint');
251
255
  }
252
256
  });
253
257
  });
@@ -327,7 +331,7 @@ describe('Dashpay Contract', () => {
327
331
 
328
332
  expect(error.name).to.equal('JsonSchemaError');
329
333
  expect(error.keyword).to.equal('maxItems');
330
- expect(error.dataPath).to.equal('.encToUserId');
334
+ expect(error.instancePath).to.equal('/encToUserId');
331
335
  }
332
336
  });
333
337
 
@@ -346,7 +350,7 @@ describe('Dashpay Contract', () => {
346
350
 
347
351
  expect(error.name).to.equal('JsonSchemaError');
348
352
  expect(error.keyword).to.equal('minItems');
349
- expect(error.dataPath).to.equal('.encToUserId');
353
+ expect(error.instancePath).to.equal('/encToUserId');
350
354
  }
351
355
  });
352
356
  });
@@ -386,7 +390,7 @@ describe('Dashpay Contract', () => {
386
390
 
387
391
  expect(error.name).to.equal('JsonSchemaError');
388
392
  expect(error.keyword).to.equal('minimum');
389
- expect(error.dataPath).to.equal('.rootEncryptionKeyIndex');
393
+ expect(error.instancePath).to.equal('/rootEncryptionKeyIndex');
390
394
  }
391
395
  });
392
396
  });
@@ -522,7 +526,7 @@ describe('Dashpay Contract', () => {
522
526
 
523
527
  expect(error.name).to.equal('JsonSchemaError');
524
528
  expect(error.keyword).to.equal('minimum');
525
- expect(error.dataPath).to.equal('.senderKeyIndex');
529
+ expect(error.instancePath).to.equal('/senderKeyIndex');
526
530
  }
527
531
  });
528
532
  });
@@ -562,7 +566,7 @@ describe('Dashpay Contract', () => {
562
566
 
563
567
  expect(error.name).to.equal('JsonSchemaError');
564
568
  expect(error.keyword).to.equal('minimum');
565
- expect(error.dataPath).to.equal('.recipientKeyIndex');
569
+ expect(error.instancePath).to.equal('/recipientKeyIndex');
566
570
  }
567
571
  });
568
572
  });
@@ -581,7 +585,7 @@ describe('Dashpay Contract', () => {
581
585
  const [error] = e.errors;
582
586
  expect(error.name).to.equal('JsonSchemaError');
583
587
  expect(error.keyword).to.equal('minItems');
584
- expect(error.dataPath).to.equal('.encryptedAccountLabel');
588
+ expect(error.instancePath).to.equal('/encryptedAccountLabel');
585
589
  }
586
590
  });
587
591
 
@@ -598,7 +602,7 @@ describe('Dashpay Contract', () => {
598
602
  const [error] = e.errors;
599
603
  expect(error.name).to.equal('JsonSchemaError');
600
604
  expect(error.keyword).to.equal('maxItems');
601
- expect(error.dataPath).to.equal('.encryptedAccountLabel');
605
+ expect(error.instancePath).to.equal('/encryptedAccountLabel');
602
606
  }
603
607
  });
604
608
 
@@ -614,7 +618,7 @@ describe('Dashpay Contract', () => {
614
618
  const [error] = e.errors;
615
619
  expect(error.name).to.equal('JsonSchemaError');
616
620
  expect(error.keyword).to.equal('type');
617
- expect(error.dataPath).to.equal('.encryptedAccountLabel');
621
+ expect(error.instancePath).to.equal('/encryptedAccountLabel');
618
622
  }
619
623
  });
620
624
  });
@@ -633,7 +637,7 @@ describe('Dashpay Contract', () => {
633
637
  const [error] = e.errors;
634
638
  expect(error.name).to.equal('JsonSchemaError');
635
639
  expect(error.keyword).to.equal('minItems');
636
- expect(error.dataPath).to.equal('.autoAcceptProof');
640
+ expect(error.instancePath).to.equal('/autoAcceptProof');
637
641
  }
638
642
  });
639
643
 
@@ -650,7 +654,7 @@ describe('Dashpay Contract', () => {
650
654
  const [error] = e.errors;
651
655
  expect(error.name).to.equal('JsonSchemaError');
652
656
  expect(error.keyword).to.equal('maxItems');
653
- expect(error.dataPath).to.equal('.autoAcceptProof');
657
+ expect(error.instancePath).to.equal('/autoAcceptProof');
654
658
  }
655
659
  });
656
660
 
@@ -667,7 +671,7 @@ describe('Dashpay Contract', () => {
667
671
  const [error] = e.errors;
668
672
  expect(error.name).to.equal('JsonSchemaError');
669
673
  expect(error.keyword).to.equal('type');
670
- expect(error.dataPath).to.equal('.autoAcceptProof');
674
+ expect(error.instancePath).to.equal('/autoAcceptProof');
671
675
  }
672
676
  });
673
677
  });
@@ -703,29 +707,12 @@ describe('Dashpay Contract', () => {
703
707
  const [error] = e.errors;
704
708
  expect(error.name).to.equal('JsonSchemaError');
705
709
  expect(error.keyword).to.equal('minimum');
706
- expect(error.dataPath).to.equal('.accountReference');
710
+ expect(error.instancePath).to.equal('/accountReference');
707
711
  }
708
712
  });
709
713
  });
710
714
 
711
715
  describe('coreHeightCreatedAt', () => {
712
- it('should be defined', async () => {
713
- delete contactRequestData.coreHeightCreatedAt;
714
-
715
- try {
716
- dpp.document.create(contract, identityId, 'contactRequest', contactRequestData);
717
-
718
- expect.fail('should throw error');
719
- } catch (e) {
720
- expect(e.name).to.equal('InvalidDocumentError');
721
- expect(e.errors).to.have.a.lengthOf(1);
722
- const [error] = e.errors;
723
- expect(error.name).to.equal('JsonSchemaError');
724
- expect(error.keyword).to.equal('required');
725
- expect(error.params.missingProperty).to.equal('coreHeightCreatedAt');
726
- }
727
- });
728
-
729
716
  it('should not be less than 1', async () => {
730
717
  contactRequestData.coreHeightCreatedAt = -1;
731
718
 
@@ -739,7 +726,7 @@ describe('Dashpay Contract', () => {
739
726
  const [error] = e.errors;
740
727
  expect(error.name).to.equal('JsonSchemaError');
741
728
  expect(error.keyword).to.equal('minimum');
742
- expect(error.dataPath).to.equal('.coreHeightCreatedAt');
729
+ expect(error.instancePath).to.equal('/coreHeightCreatedAt');
743
730
  }
744
731
  });
745
732
  });
@@ -1,38 +0,0 @@
1
- ---
2
- name: Bug report
3
- about: Create a report to help us improve
4
- title: ''
5
- labels: 'bug'
6
- assignees: ''
7
-
8
- ---
9
-
10
- <!--- Provide a general summary of the issue in the Title above -->
11
-
12
- ## Expected Behavior
13
- <!--- Tell us what should happen -->
14
-
15
- ## Current Behavior
16
- <!--- Tell us what happens instead of the expected behavior -->
17
-
18
- ## Possible Solution
19
- <!--- Not obligatory, but suggest a fix/reason for the bug -->
20
-
21
- ## Steps to Reproduce (for bugs)
22
- <!--- Provide a link to a live example, or an unambiguous set of steps to -->
23
- <!--- reproduce this bug. Include code to reproduce, if relevant -->
24
- 1.
25
- 2.
26
- 3.
27
- 4.
28
-
29
- ## Context
30
- <!--- How has this issue affected you? What are you trying to accomplish? -->
31
- <!--- Providing context helps us come up with a solution that is most useful in the real world -->
32
-
33
- ## Your Environment
34
- <!--- Include as many relevant details about the environment you experienced the bug in -->
35
- * Version used:
36
- * Environment name and version (e.g. Chrome 39, node.js 5.4):
37
- * Operating System and version (desktop, server, or mobile):
38
- * Link to your project:
@@ -1,26 +0,0 @@
1
- ---
2
- name: Feature request
3
- about: Suggest an idea for this project
4
- title: ''
5
- labels: 'enhancement'
6
- assignees: ''
7
-
8
- ---
9
-
10
- <!--- Provide a general summary of the feature request in the Title above -->
11
-
12
- ## Expected Behavior
13
- <!--- A clear and concise description of what you want to happen -->
14
-
15
- ## Current Behavior
16
- <!--- Explain the difference from current behavior -->
17
-
18
- ## Possible Solution
19
- <!--- Suggest ideas of how to implement the addition or change -->
20
-
21
- ## Alternatives Considered
22
- <!--- A clear and concise description of any alternative solutions or features you've considered -->
23
-
24
- ## Additional Context
25
- <!--- Add any other context or screenshots about the feature request here. -->
26
-
@@ -1,32 +0,0 @@
1
- <!--- Provide a general summary of your changes in the Title above -->
2
- <!--- Pull request titles must use the [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/#summary) format -->
3
-
4
- ## Issue being fixed or feature implemented
5
- <!--- Why is this change required? What problem does it solve? -->
6
- <!--- If it fixes an open issue, please link to the issue here. -->
7
-
8
-
9
- ## What was done?
10
- <!--- Describe your changes in detail -->
11
-
12
-
13
- ## How Has This Been Tested?
14
- <!--- Please describe in detail how you tested your changes. -->
15
- <!--- Include details of your testing environment, and the tests you ran to -->
16
- <!--- see how your change affects other areas of the code, etc. -->
17
-
18
-
19
- ## Breaking Changes
20
- <!--- Please describe any breaking changes your code introduces and verify that -->
21
- <!--- the title includes "!" following the conventional commit type (e.g. "feat!: ..."-->
22
-
23
-
24
- ## Checklist:
25
- <!--- Go over all the following points, and put an `x` in all the boxes that apply. -->
26
- - [ ] I have performed a self-review of my own code
27
- - [ ] I have commented my code, particularly in hard-to-understand areas
28
- - [ ] I have added or updated relevant unit/integration/functional/e2e tests
29
- - [ ] I have made corresponding changes to the documentation
30
-
31
- **For repository code-owners and collaborators only**
32
- - [ ] I have assigned this pull request to a milestone
package/.travis.yml DELETED
@@ -1,40 +0,0 @@
1
- sudo: false
2
- dist: trusty
3
- language: node_js
4
-
5
- node_js:
6
- - '14'
7
-
8
- branches:
9
- only:
10
- - master
11
- - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)-dev$/
12
- - /^v(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/
13
-
14
- services:
15
- - docker
16
-
17
- addons:
18
- apt:
19
- packages:
20
- - docker-ce
21
-
22
- install:
23
- - npm ci
24
-
25
- script:
26
- - npm run check-package
27
- - npm run lint
28
- - npm run test
29
-
30
- before_deploy:
31
- # Login to NPM registry
32
- - echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc
33
-
34
- deploy:
35
- provider: script
36
- skip_cleanup: true
37
- script: bash bin/travis-deploy.sh
38
- on:
39
- tags: true
40
- repo: dashevo/dashpay-contract
@@ -1,31 +0,0 @@
1
- #! /bin/sh
2
-
3
- set -xe
4
-
5
- # Update this whenever the latest Node.js LTS version changes (~ every year).
6
- # Do not forget to add this version to .travis.yml config also.
7
- LATEST_LTS_VERSION="14"
8
-
9
- # We want this command to succeed whether or not the Node.js version is the
10
- # latest (so that the build does not show as failed), but _only_ the latest
11
- # should be used to publish the module.
12
- if [ "$TRAVIS_NODE_VERSION" != "$LATEST_LTS_VERSION" ]; then
13
- echo "Node.js v$TRAVIS_NODE_VERSION is not latest LTS version -- will not deploy with this version."
14
- exit 0
15
- fi
16
-
17
- # Ensure the tag matches the one in package.json, otherwise abort.
18
- PACKAGE_TAG=v"$(jq -r .version package.json)"
19
- if [ "$PACKAGE_TAG" != "$TRAVIS_TAG" ]; then
20
- echo "Travis tag (\"$TRAVIS_TAG\") is not equal to package.json tag (\"$PACKAGE_TAG\"). Please push a correct tag and try again."
21
- exit 1
22
- fi
23
-
24
- # Use regex pattern matching to check if "dev" exists in tag
25
- NPM_TAG="latest"
26
- if [[ $PACKAGE_TAG =~ dev ]]; then
27
- NPM_TAG="dev"
28
- fi
29
-
30
- # Now that checks have been passed, publish the module
31
- npm publish --access public --tag $NPM_TAG