@dashevo/dashpay-contract 0.3.0 → 0.21.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/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/package.json CHANGED
@@ -1,11 +1,8 @@
1
1
  {
2
2
  "name": "@dashevo/dashpay-contract",
3
- "version": "0.3.0",
3
+ "version": "0.21.5",
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.19.0-dev.4",
32
- "chai": "^4.2.0",
28
+ "@dashevo/dpp": "~0.21.5",
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": [
@@ -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,7 +707,7 @@ 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
  });
@@ -722,7 +726,7 @@ describe('Dashpay Contract', () => {
722
726
  const [error] = e.errors;
723
727
  expect(error.name).to.equal('JsonSchemaError');
724
728
  expect(error.keyword).to.equal('minimum');
725
- expect(error.dataPath).to.equal('.coreHeightCreatedAt');
729
+ expect(error.instancePath).to.equal('/coreHeightCreatedAt');
726
730
  }
727
731
  });
728
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
@@ -1,83 +0,0 @@
1
- name: Test and Release
2
-
3
- on:
4
- workflow_dispatch:
5
- release:
6
- types:
7
- - published
8
- pull_request:
9
- branches:
10
- - master
11
- - v[0-9]+.[0-9]+-dev
12
-
13
- jobs:
14
- test:
15
- name: Run Dashpay Contract tests
16
- runs-on: ubuntu-20.04
17
- timeout-minutes: 10
18
- steps:
19
- - uses: actions/checkout@v2
20
-
21
- - uses: actions/setup-node@v2
22
- with:
23
- node-version: '12'
24
-
25
- - name: Enable NPM cache
26
- uses: actions/cache@v2
27
- with:
28
- path: '~/.npm'
29
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
30
- restore-keys: |
31
- ${{ runner.os }}-node-
32
-
33
- - name: Install NPM dependencies
34
- run: npm ci
35
-
36
- - name: Check NPM package lock version is updated
37
- run: npm run check-package # TODO: does this exist as an action already?
38
-
39
- - name: Run ESLinter
40
- run: npm run lint
41
-
42
- - name: Run tests
43
- run: npm run test
44
-
45
- release:
46
- name: Release NPM package
47
- runs-on: ubuntu-20.04
48
- needs: test
49
- if: ${{ github.event_name == 'release' }}
50
- steps:
51
- - uses: actions/checkout@v2
52
-
53
- - name: Check package version matches tag
54
- uses: geritol/match-tag-to-package-version@0.1.0
55
- env:
56
- TAG_PREFIX: refs/tags/v
57
-
58
- - name: Enable NPM cache
59
- uses: actions/cache@v2
60
- with:
61
- path: '~/.npm'
62
- key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
63
- restore-keys: |
64
- ${{ runner.os }}-node-
65
-
66
- - name: Install NPM dependencies
67
- run: npm ci
68
-
69
- - name: Set release tag
70
- uses: actions/github-script@v3
71
- id: tag
72
- with:
73
- result-encoding: string
74
- script: |
75
- const tag = context.payload.release.tag_name;
76
- const [, major, minor] = tag.match(/^v([0-9]+)\.([0-9]+)/);
77
- return (tag.includes('dev') ? `${major}.${minor}-dev` : 'latest');
78
-
79
- - name: Publish NPM package
80
- uses: JS-DevTools/npm-publish@v1
81
- with:
82
- token: ${{ secrets.NPM_TOKEN }}
83
- tag: ${{ steps.tag.outputs.result }}