@ayanworks/polygon-did-registry-contract 2.0.1-alpha.2 → 2.0.1-alpha.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.
@@ -1,393 +0,0 @@
1
- const ethers = require('ethers')
2
- const ganache = require('ganache-cli')
3
- const assert = require('assert')
4
- const { deployProxy } = require('@openzeppelin/truffle-upgrades')
5
- const PolygonDidRegistry = artifacts.require('PolygonDidRegistry')
6
-
7
- // Library initialization that will talk with Blockchain
8
- const provider = new ethers.providers.Web3Provider(
9
- ganache.provider({ gasLimit: 8000000 }),
10
- )
11
- // Initializing the build files
12
- const PolygonDIDRegistryJSON = require('../build/contracts/PolygonDidRegistry.json')
13
-
14
- let accounts,
15
- PolygonDIDRegistryInstance,
16
- PolygonDIDRegistryInstance_test,
17
- PolygonUpgradableInstance,
18
- PolygonUpgradableInstance_test
19
-
20
- // Describing the 1st Test
21
- // This will setup Ganache with some test address
22
- describe('Ganache Setup', async () => {
23
- it('Ganache setup with Test Accounts', async () => {
24
- // List of accounts are fetched here
25
- accounts = await provider.listAccounts()
26
-
27
- // We will check that atleast 2 accounts are loaded
28
- assert.ok(accounts.length >= 1, '2 Accounts are present minimum')
29
- })
30
- })
31
-
32
- // Upgradable with Proxy
33
- // Deployment Testing 1.0
34
- describe('Setting up the Upgradable Smart Contract', async () => {
35
- describe('Setting up the contract', async () => {
36
- it('Should deploy contract with Proxy, with no parameters/Constructor', async () => {
37
- PolygonUpgradableInstance = await deployProxy(PolygonDidRegistry)
38
- PolygonUpgradableInstance_test = new ethers.Contract(
39
- PolygonUpgradableInstance.address,
40
- PolygonDIDRegistryJSON.abi,
41
- provider.getSigner(accounts[3]),
42
- )
43
- assert.ok(
44
- PolygonUpgradableInstance.address,
45
- 'Upgradeable contract is deployed',
46
- )
47
- })
48
- })
49
-
50
- //Check Create Function test 1.1
51
- describe('Checking the Create function using Upgradeable Contract', async () => {
52
- it('This should store the DID doc on Upgradable Contract and will read and check if the value stored is correct', async () => {
53
- // This will send the value to local ganache blockchain
54
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
55
- const doc =
56
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
57
- const tx = await PolygonUpgradableInstance.createDID(did, doc)
58
-
59
- // Getting the set value in ganache blockchain
60
- const currentValue = await PolygonUpgradableInstance.getDID(did)
61
-
62
- // Comparing the set value to confirm
63
- assert.equal(currentValue, doc, 'value set must be able to get')
64
-
65
- assert.notEqual(currentValue, null, 'value should not be empty')
66
- })
67
- })
68
-
69
- //Describing the 1.2 Test Case
70
- describe('Checking the getTotalNumberOfDIDs Function', async () => {
71
- it('This should get correct number of DIDs registered', async () => {
72
- const currentValue =
73
- await PolygonUpgradableInstance.getTotalNumberOfDIDs()
74
- assert.equal(currentValue, 1, 'value should be matching')
75
- })
76
- })
77
-
78
- // Describing the 1.3 Test case
79
- describe('Checking the Update function in Upgradable Contract', async () => {
80
- it('This should update the DID doc on Upgradable Contract and will read and check if the value stored is correct', async () => {
81
- // This will send the value to local ganache blockchain
82
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
83
- //changed the controller
84
- const doc =
85
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
86
- const tx = await PolygonUpgradableInstance.updateDID(did, doc)
87
-
88
- // Getting the set value in ganache blockchain
89
- const currentValue = await PolygonUpgradableInstance.getDID(did)
90
-
91
- // Comparing the set value to confirm
92
- assert.equal(currentValue, doc, 'value set must be able to get')
93
- })
94
- })
95
-
96
- //Describing test 1.4 to check if test fails if we update with different controller
97
- describe('Checking update with wrong controller', async () => {
98
- it('This should not update DID doc ', async () => {
99
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
100
- const doc =
101
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
102
- try {
103
- assert.ifError(
104
- //sending transaction using different controller
105
- await PolygonUpgradableInstance_test.functions.updateDID(did, doc),
106
- )
107
- } catch (error) {}
108
- })
109
- })
110
-
111
- // Describing the 1.5 Test case
112
- describe('Checking the Delete function in Upgradable Contract', async () => {
113
- it('This should delete the DID doc on Upgradable Contract and will read and check if the value is now an empty string', async () => {
114
- // This will send the value to local ganache blockchain
115
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
116
- const tx = await PolygonUpgradableInstance.deleteDID(did)
117
-
118
- // Getting the set value in ganache blockchain
119
- const currentValue = await PolygonUpgradableInstance.getDID(did)
120
-
121
- // Comparing the set value to confirm
122
- assert.equal(currentValue, '', 'value should be matching')
123
- })
124
- })
125
-
126
- // Describing the 1.6 Test case
127
- describe('Checking the Create function in Upgradable Contract', async () => {
128
- it('This should store the DID doc on Upgradable Contract and will read and check if the value stored is not null', async () => {
129
- // This will send the value to local ganache blockchain
130
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
131
- const doc =
132
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}'
133
- const doctest =
134
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
135
- const tx = await PolygonUpgradableInstance.createDID(did, doc)
136
-
137
- // Getting the set value in ganache blockchain
138
- const currentValue = await PolygonUpgradableInstance.getDID(did)
139
-
140
- // Checking value is not null
141
-
142
- assert.notEqual(currentValue, '', 'value should not match')
143
- })
144
- })
145
-
146
- // Describing the 1.7 Test case
147
- describe('Checking the Update function in Upgradable Contract', async () => {
148
- it('This should update the DID doc on Upgradable Contract and will read and check if the value stored has changed', async () => {
149
- // This will send the value to local ganache blockchain
150
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
151
- //changed the controller
152
- const doc =
153
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
154
- const docoriginal =
155
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}'
156
- const tx = await PolygonUpgradableInstance.updateDID(did, doc)
157
-
158
- // Getting the set value in ganache blockchain
159
- const currentValue = await PolygonUpgradableInstance.getDID(did)
160
-
161
- // Comparing the set value to confirm
162
- assert.notEqual(currentValue, docoriginal, 'value should not match')
163
- })
164
- })
165
-
166
- // Describing the 1.8 Test Case
167
- describe('Checking the Delete function in Upgradable Contract', async () => {
168
- it('This should delete the DID doc on Upgradable Contract and will read and check if the value is now not equal to the updated doc', async () => {
169
- // This will send the value to local ganache blockchain
170
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
171
- const doc =
172
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
173
- const tx = await PolygonUpgradableInstance.deleteDID(did)
174
-
175
- // Getting the set value in ganache blockchain
176
- const currentValue = await PolygonUpgradableInstance.getDID(did)
177
-
178
- // Comparing the set value to confirm
179
- assert.notEqual(currentValue, doc, 'value should not be matching')
180
- })
181
- })
182
-
183
- //Describing the 1.9 Test Case
184
- describe('Checking the getTotalNumberOfDIDs Function', async () => {
185
- it('This should get correct number of DIDs registered', async () => {
186
- const totalValue = await PolygonUpgradableInstance.getTotalNumberOfDIDs()
187
- const deltedValue =
188
- await PolygonUpgradableInstance.getTotalNumberOfDeletedDIDs()
189
- const currentValue = totalValue - deltedValue
190
- assert.equal(currentValue, 0, 'value should be matching')
191
- })
192
- })
193
-
194
- //Describing the 1.10 Test Case
195
- describe('Checking the Transafer Ownership Function', async () => {
196
- it('This should transfer ownership of contract to another user', async () => {
197
- const newOwner = accounts[5]
198
- const owner = await PolygonUpgradableInstance.getOwner()
199
- const tx = await PolygonUpgradableInstance.transferOwnership(newOwner)
200
- const currentOwner = await PolygonUpgradableInstance.getOwner()
201
-
202
- assert.notEqual(owner, currentOwner, 'value should not be equal')
203
- })
204
- })
205
-
206
- //Describing the 1.11 Test Case
207
- describe('Checking the Transafer Ownership Function', async () => {
208
- it('This should not transfer ownership of contract to another user since the transaction is being initiated by different owner', async () => {
209
- const newOwner = accounts[6]
210
- try {
211
- assert.ifError(
212
- //sending transaction using different controller
213
- await PolygonUpgradableInstance_test.functions.transferOwnership(
214
- newOwner,
215
- ),
216
- )
217
- } catch (error) {}
218
- })
219
- })
220
- })
221
-
222
- // basic Contract Testing
223
- // Deployment Testing 2.0
224
- describe('Basic Contract Testing', async () => {
225
- // Describing a SubTest case
226
- describe('Setting up the contract', async () => {
227
- it('This Deploys Polygon Smart contract from 1st account with no Parameters/Constructor', async () => {
228
- // Creating a contract factory for deploying contract.
229
- const PolygonDIDRegistry = new ethers.ContractFactory(
230
- PolygonDIDRegistryJSON.abi,
231
- PolygonDIDRegistryJSON.bytecode,
232
- provider.getSigner(accounts[2]),
233
- )
234
- PolygonDIDRegistryInstance = await PolygonDIDRegistry.deploy()
235
- PolygonDIDRegistryInstance_test = new ethers.Contract(
236
- PolygonDIDRegistryInstance.address,
237
- PolygonDIDRegistryJSON.abi,
238
- provider.getSigner(accounts[3]),
239
- )
240
- assert.ok(
241
- PolygonDIDRegistryInstance.address,
242
- 'conract address should be present',
243
- )
244
- })
245
- })
246
-
247
- // Describing the 2.1 Test case
248
- describe('Checking the Create function in Contract', async () => {
249
- it('This should store the DID doc on Contract and will read and check if the value stored is correct', async () => {
250
- // This will send the value to local ganache blockchain
251
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
252
- const doc =
253
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
254
- const tx = await PolygonDIDRegistryInstance.functions.createDID(did, doc)
255
-
256
- // Transfer confirmation
257
- await tx.wait()
258
-
259
- // Getting the set value in ganache blockchain
260
- const currentValue =
261
- await PolygonDIDRegistryInstance.functions.getDID(did)
262
-
263
- // Comparing the set value to confirm
264
- assert.equal(currentValue, doc, 'value set must be able to get')
265
-
266
- assert.notEqual(currentValue, null, 'value should not be empty')
267
- })
268
- })
269
-
270
- // Describing the 2.2 Test case
271
- describe('Checking the Update function in Contract', async () => {
272
- it('This should update the DID doc on Contract and will read and check if the value stored is correct', async () => {
273
- // This will send the value to local ganache blockchain
274
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
275
- //changed the controller
276
- const doc =
277
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
278
- const tx = await PolygonDIDRegistryInstance.functions.updateDID(did, doc)
279
-
280
- // Transfer confirmation
281
- await tx.wait()
282
-
283
- // Getting the set value in ganache blockchain
284
- const currentValue =
285
- await PolygonDIDRegistryInstance.functions.getDID(did)
286
-
287
- // Comparing the set value to confirm
288
- assert.equal(currentValue, doc, 'value set must be able to get')
289
- })
290
- })
291
- //Describing test 2.3 to check if test fails if we update with different controller
292
- describe('Checking update with wrong controller', async () => {
293
- it('This should not update DID doc ', async () => {
294
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
295
- const doc =
296
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
297
- try {
298
- assert.ifError(
299
- //sending transaction using different controller
300
- await PolygonDIDRegistryInstance_test.functions.updateDID(did, doc),
301
- )
302
- } catch (error) {}
303
- })
304
- })
305
-
306
- // Describing the 2.4 Test case
307
- describe('Checking the Delete function in Contract', async () => {
308
- it('This should delete the DID doc on Contract and will read and check if the value is now an empty string', async () => {
309
- // This will send the value to local ganache blockchain
310
- const did = '0x2f65b747440deaf596892dfc7965040be8b99100'
311
- const tx = await PolygonDIDRegistryInstance.functions.deleteDID(did)
312
-
313
- // Transfer confirmation
314
- await tx.wait()
315
-
316
- // Getting the set value in ganache blockchain
317
- const currentValue =
318
- await PolygonDIDRegistryInstance.functions.getDID(did)
319
-
320
- // Comparing the set value to confirm
321
- assert.equal(currentValue, '', 'value should be matching')
322
- })
323
- })
324
-
325
- // Describing the 2.5 Test case
326
- describe('Checking the Create function in Contract', async () => {
327
- it('This should store the DID doc on Contract and will read and check if the value stored is not null', async () => {
328
- // This will send the value to local ganache blockchain
329
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
330
- const doc =
331
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}'
332
- const doctest =
333
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
334
- const tx = await PolygonDIDRegistryInstance.functions.createDID(did, doc)
335
-
336
- // Transfer confirmation
337
- await tx.wait()
338
-
339
- // Getting the set value in ganache blockchain
340
- const currentValue =
341
- await PolygonDIDRegistryInstance.functions.getDID(did)
342
-
343
- // Checking value is not null
344
-
345
- assert.notEqual(currentValue, doctest, 'value should not match')
346
- })
347
- })
348
-
349
- // Describing the 2.6 Test case
350
- describe('Checking the Update function in Contract', async () => {
351
- it('This should update the DID doc on Contract and will read and check if the value stored has changed', async () => {
352
- // This will send the value to local ganache blockchain
353
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
354
- //changed the controller
355
- const doc =
356
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
357
- const docoriginal =
358
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","verificationMethod":[{"id":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x54ec7be8b24f7139f870f277cf99c527ff43892b","publicKeyBase58":"RwHysxjkzFdJDqi2irHRVRFHX9uUj5aVAXVoufnk5PDA4qcn1ejJMgGhqCsFdQqXRCTdi4TbEQFJjDUAdi2JvYmH"}]}'
359
- const tx = await PolygonDIDRegistryInstance.functions.updateDID(did, doc)
360
-
361
- // Transfer confirmation
362
- await tx.wait()
363
-
364
- // Getting the set value in ganache blockchain
365
- const currentValue =
366
- await PolygonDIDRegistryInstance.functions.getDID(did)
367
-
368
- // Comparing the set value to confirm
369
- assert.notEqual(currentValue, docoriginal, 'value should not match')
370
- })
371
- })
372
-
373
- // Describing the 2.7 Test case
374
- describe('Checking the Delete function in Contract', async () => {
375
- it('This should delete the DID doc on Contract and will read and check if the value is now not equal to the updated doc', async () => {
376
- // This will send the value to local ganache blockchain
377
- const did = '0x54ec7be8b24f7139f870f277cf99c527ff43892b'
378
- const doc =
379
- '{"@context":"https://w3id.org/did/v1","id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","verificationMethod":[{"id":"did:polygon:0x2f65b747440deaf596892dfc7965040be8b99100","type":"EcdsaSecp256k1VerificationKey2019","controller":"did:polygon:0x2f65b747440deaf596892dfc7965040be8c66666","publicKeyBase58":"NDaEdTguJV39Ns8BZkxQ3XR6GUinZAJfVoyEMkK9fP7XQmpSkT3UsLHB52cFpDqoM6m4Hevtba8pkmjvEG3Ur7ji"}]}'
380
- const tx = await PolygonDIDRegistryInstance.functions.deleteDID(did)
381
-
382
- // Transfer confirmation
383
- await tx.wait()
384
-
385
- // Getting the set value in ganache blockchain
386
- const currentValue =
387
- await PolygonDIDRegistryInstance.functions.getDID(did)
388
-
389
- // Comparing the set value to confirm
390
- assert.notEqual(currentValue, doc, 'value should not be matching')
391
- })
392
- })
393
- })
package/truffle-config.js DELETED
@@ -1,68 +0,0 @@
1
- /**
2
- * Use this file to configure your truffle project. It's seeded with some
3
- * common settings for different networks and features like migrations,
4
- * compilation and testing. Uncomment the ones you need or modify
5
- * them to suit your project as necessary.
6
- *
7
- * More information about configuration can be found at:
8
- *
9
- * trufflesuite.com/docs/advanced/configuration
10
- *
11
- * To deploy via Infura you'll need a wallet provider (like @truffle/hdwallet-provider)
12
- * to sign your transactions before they're sent to a remote public node. Infura accounts
13
- * are available for free at: infura.io/register.
14
- *
15
- * You'll also need a mnemonic - the twelve word phrase the wallet uses to generate
16
- * public/private key pairs. If you're publishing your code to GitHub make sure you load this
17
- * phrase from a file you've .gitignored so it doesn't accidentally become public.
18
- *
19
- */
20
- const HDWalletProvider = require('@truffle/hdwallet-provider')
21
- require('dotenv').config()
22
-
23
- module.exports = {
24
- /**
25
- * Networks define how you connect to your ethereum client and let you set the
26
- * defaults web3 uses to send transactions. If you don't specify one truffle
27
- * will spin up a development blockchain for you on port 9545 when you
28
- * run `develop` or `test`. You can ask a truffle command to use a specific
29
- * network from the command line, e.g
30
- *
31
- * $ truffle test --network <network-name>
32
- */
33
- networks: {
34
- development: {
35
- host: '127.0.0.1', // Localhost (default: none)
36
- port: 8545, // Standard Ethereum port (default: none)
37
- network_id: '*', // Any network (default: none)
38
- },
39
- matic: {
40
- provider: function () {
41
- return new HDWalletProvider(process.env.SIGNER, process.env.RPCURL)
42
- },
43
- network_id: '80001',
44
- },
45
- matic_mainnet: {
46
- provider: function () {
47
- return new HDWalletProvider(process.env.SIGNER, process.env.RPCURL)
48
- },
49
- network_id: '137',
50
- },
51
- },
52
-
53
- // Set default mocha options here, use special reporters etc.
54
- mocha: {
55
- // timeout: 100000
56
- },
57
-
58
- // Configure your compilers
59
- compilers: {
60
- solc: {
61
- version: '0.8.16', // Fetch exact version from solc-bin (default: truffle's version)
62
- },
63
- },
64
-
65
- db: {
66
- enabled: false,
67
- },
68
- }