@ayanworks/polygon-did-registry-contract 3.0.0 → 4.0.0

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,134 +0,0 @@
1
- {
2
- "manifestVersion": "3.2",
3
- "proxies": [
4
- {
5
- "address": "0x0C16958c4246271622201101C83B9F0Fc7180d15",
6
- "txHash": "0xa14cd6a823161901ef272283a60b796d976cc56ac4e90073e7c39d071e4aa261",
7
- "kind": "transparent"
8
- }
9
- ],
10
- "impls": {
11
- "4ea697d213312244614a688367167de1e84d9fd58fa073c2461c24e28152def1": {
12
- "address": "0xD084c9772Dc6F644Dbe1831d5039BF2e516AEfdc",
13
- "txHash": "0x3e047df9361c0d6d64075007cd71d0137d61b9df07bb90d5a84db66d1d28b969",
14
- "layout": {
15
- "solcVersion": "0.8.16",
16
- "storage": [
17
- {
18
- "label": "owner",
19
- "offset": 0,
20
- "slot": "0",
21
- "type": "t_address",
22
- "contract": "PolygonDidRegistry",
23
- "src": "contracts/PolygonDidRegistry.sol:9"
24
- },
25
- {
26
- "label": "polyDIDs",
27
- "offset": 0,
28
- "slot": "1",
29
- "type": "t_mapping(t_address,t_struct(PolyDID)13_storage)",
30
- "contract": "PolygonDidRegistry",
31
- "src": "contracts/PolygonDidRegistry.sol:17"
32
- },
33
- {
34
- "label": "resourceData",
35
- "offset": 0,
36
- "slot": "2",
37
- "type": "t_mapping(t_address,t_mapping(t_string_memory_ptr,t_string_storage))",
38
- "contract": "PolygonDidRegistry",
39
- "src": "contracts/PolygonDidRegistry.sol:18"
40
- },
41
- {
42
- "label": "keysById",
43
- "offset": 0,
44
- "slot": "3",
45
- "type": "t_mapping(t_address,t_array(t_string_storage)dyn_storage)",
46
- "contract": "PolygonDidRegistry",
47
- "src": "contracts/PolygonDidRegistry.sol:19"
48
- },
49
- {
50
- "label": "initialized",
51
- "offset": 0,
52
- "slot": "4",
53
- "type": "t_bool",
54
- "contract": "PolygonDidRegistry",
55
- "src": "contracts/PolygonDidRegistry.sol:29"
56
- }
57
- ],
58
- "types": {
59
- "t_address": {
60
- "label": "address",
61
- "numberOfBytes": "20"
62
- },
63
- "t_array(t_string_storage)dyn_storage": {
64
- "label": "string[]",
65
- "numberOfBytes": "32"
66
- },
67
- "t_bool": {
68
- "label": "bool",
69
- "numberOfBytes": "1"
70
- },
71
- "t_mapping(t_address,t_array(t_string_storage)dyn_storage)": {
72
- "label": "mapping(address => string[])",
73
- "numberOfBytes": "32"
74
- },
75
- "t_mapping(t_address,t_mapping(t_string_memory_ptr,t_string_storage))": {
76
- "label": "mapping(address => mapping(string => string))",
77
- "numberOfBytes": "32"
78
- },
79
- "t_mapping(t_address,t_struct(PolyDID)13_storage)": {
80
- "label": "mapping(address => struct PolygonDidRegistry.PolyDID)",
81
- "numberOfBytes": "32"
82
- },
83
- "t_mapping(t_string_memory_ptr,t_string_storage)": {
84
- "label": "mapping(string => string)",
85
- "numberOfBytes": "32"
86
- },
87
- "t_string_memory_ptr": {
88
- "label": "string",
89
- "numberOfBytes": "32"
90
- },
91
- "t_string_storage": {
92
- "label": "string",
93
- "numberOfBytes": "32"
94
- },
95
- "t_struct(PolyDID)13_storage": {
96
- "label": "struct PolygonDidRegistry.PolyDID",
97
- "members": [
98
- {
99
- "label": "controller",
100
- "type": "t_address",
101
- "offset": 0,
102
- "slot": "0"
103
- },
104
- {
105
- "label": "created",
106
- "type": "t_uint256",
107
- "offset": 0,
108
- "slot": "1"
109
- },
110
- {
111
- "label": "updated",
112
- "type": "t_uint256",
113
- "offset": 0,
114
- "slot": "2"
115
- },
116
- {
117
- "label": "didDoc",
118
- "type": "t_string_storage",
119
- "offset": 0,
120
- "slot": "3"
121
- }
122
- ],
123
- "numberOfBytes": "128"
124
- },
125
- "t_uint256": {
126
- "label": "uint256",
127
- "numberOfBytes": "32"
128
- }
129
- },
130
- "namespaces": {}
131
- }
132
- }
133
- }
134
- }
@@ -1,134 +0,0 @@
1
- {
2
- "manifestVersion": "3.2",
3
- "proxies": [
4
- {
5
- "address": "0xcB80F37eDD2bE3570c6C9D5B0888614E04E1e49E",
6
- "txHash": "0x4816779d34173119141afed8604b591eff112911a3b952273686436d9be03470",
7
- "kind": "transparent"
8
- }
9
- ],
10
- "impls": {
11
- "4ea697d213312244614a688367167de1e84d9fd58fa073c2461c24e28152def1": {
12
- "address": "0x6203b92447BF0A3260e5Ee643b472B2D5BeD7Bb6",
13
- "txHash": "0xd8abad4e72a8509796ca15095d591d2cb8e5751d7071bb2ca141537cfa9e0e4f",
14
- "layout": {
15
- "solcVersion": "0.8.16",
16
- "storage": [
17
- {
18
- "label": "owner",
19
- "offset": 0,
20
- "slot": "0",
21
- "type": "t_address",
22
- "contract": "PolygonDidRegistry",
23
- "src": "contracts/PolygonDidRegistry.sol:9"
24
- },
25
- {
26
- "label": "polyDIDs",
27
- "offset": 0,
28
- "slot": "1",
29
- "type": "t_mapping(t_address,t_struct(PolyDID)13_storage)",
30
- "contract": "PolygonDidRegistry",
31
- "src": "contracts/PolygonDidRegistry.sol:17"
32
- },
33
- {
34
- "label": "resourceData",
35
- "offset": 0,
36
- "slot": "2",
37
- "type": "t_mapping(t_address,t_mapping(t_string_memory_ptr,t_string_storage))",
38
- "contract": "PolygonDidRegistry",
39
- "src": "contracts/PolygonDidRegistry.sol:18"
40
- },
41
- {
42
- "label": "keysById",
43
- "offset": 0,
44
- "slot": "3",
45
- "type": "t_mapping(t_address,t_array(t_string_storage)dyn_storage)",
46
- "contract": "PolygonDidRegistry",
47
- "src": "contracts/PolygonDidRegistry.sol:19"
48
- },
49
- {
50
- "label": "initialized",
51
- "offset": 0,
52
- "slot": "4",
53
- "type": "t_bool",
54
- "contract": "PolygonDidRegistry",
55
- "src": "contracts/PolygonDidRegistry.sol:29"
56
- }
57
- ],
58
- "types": {
59
- "t_address": {
60
- "label": "address",
61
- "numberOfBytes": "20"
62
- },
63
- "t_array(t_string_storage)dyn_storage": {
64
- "label": "string[]",
65
- "numberOfBytes": "32"
66
- },
67
- "t_bool": {
68
- "label": "bool",
69
- "numberOfBytes": "1"
70
- },
71
- "t_mapping(t_address,t_array(t_string_storage)dyn_storage)": {
72
- "label": "mapping(address => string[])",
73
- "numberOfBytes": "32"
74
- },
75
- "t_mapping(t_address,t_mapping(t_string_memory_ptr,t_string_storage))": {
76
- "label": "mapping(address => mapping(string => string))",
77
- "numberOfBytes": "32"
78
- },
79
- "t_mapping(t_address,t_struct(PolyDID)13_storage)": {
80
- "label": "mapping(address => struct PolygonDidRegistry.PolyDID)",
81
- "numberOfBytes": "32"
82
- },
83
- "t_mapping(t_string_memory_ptr,t_string_storage)": {
84
- "label": "mapping(string => string)",
85
- "numberOfBytes": "32"
86
- },
87
- "t_string_memory_ptr": {
88
- "label": "string",
89
- "numberOfBytes": "32"
90
- },
91
- "t_string_storage": {
92
- "label": "string",
93
- "numberOfBytes": "32"
94
- },
95
- "t_struct(PolyDID)13_storage": {
96
- "label": "struct PolygonDidRegistry.PolyDID",
97
- "members": [
98
- {
99
- "label": "controller",
100
- "type": "t_address",
101
- "offset": 0,
102
- "slot": "0"
103
- },
104
- {
105
- "label": "created",
106
- "type": "t_uint256",
107
- "offset": 0,
108
- "slot": "1"
109
- },
110
- {
111
- "label": "updated",
112
- "type": "t_uint256",
113
- "offset": 0,
114
- "slot": "2"
115
- },
116
- {
117
- "label": "didDoc",
118
- "type": "t_string_storage",
119
- "offset": 0,
120
- "slot": "3"
121
- }
122
- ],
123
- "numberOfBytes": "128"
124
- },
125
- "t_uint256": {
126
- "label": "uint256",
127
- "numberOfBytes": "32"
128
- }
129
- },
130
- "namespaces": {}
131
- }
132
- }
133
- }
134
- }
package/.prettierignore DELETED
@@ -1,6 +0,0 @@
1
- pnpm-lock.yaml
2
- node_modules
3
- .DS_Store
4
- build
5
- artifacts
6
- sst-config.json
package/.prettierrc DELETED
@@ -1,5 +0,0 @@
1
- {
2
- "printWidth": 80,
3
- "semi": false,
4
- "singleQuote": true
5
- }
package/.release-it.json DELETED
@@ -1,11 +0,0 @@
1
- {
2
- "git": {
3
- "commitMessage": "chore: release v${version} [skip ci]",
4
- "commitArgs": ["--signoff"]
5
- },
6
- "github": {
7
- "release": true,
8
- "autoGenerate": true
9
- },
10
- "requireCleanWorkingDir": false
11
- }
package/README.md DELETED
@@ -1,93 +0,0 @@
1
- # Polygon DID Registry Contract
2
-
3
- This library is an implementation of a registry contract that supports the Polygon DID Method.
4
-
5
- ## Overview
6
-
7
- The Polygon registry contract acts as a public ledger, where the Polygon-Identity specified Decentralised Identifiers will be logged. The specifications related to polygon DID method are mentioned in the document. A DID generated using the Polygon DID generator, can be stored and managed on the ledger using this contract library.
8
-
9
- ## Contract Deployment
10
-
11
- | Network | ChainId | Registry Address |
12
- | :--------------------: | :-----: | :----------------------------------------: |
13
- | Polygon Mainnet | 137 | 0x0C16958c4246271622201101C83B9F0Fc7180d15 |
14
- | Polygon Testnet (amoy) | 80002 | 0xcB80F37eDD2bE3570c6C9D5B0888614E04E1e49E |
15
-
16
- ## Methods
17
-
18
- - `createDID(address, string)` : The method createDID is used to create and log a new DID on the polygon chain. The parameter of address type, will act as the reference key, to refer the did document stored on the chain. The string type variable will contain the did document, that will be stored on the matic chain.
19
-
20
- - `updateDIDDoc(address, string)` : The method updateDID is included in contract, which will facilitate the controller, and only the controller of the did, to update the document if need arises. Though the Polygon DID method, defines how the DID doc is defined as per standards, and that can be resolved.
21
-
22
- - `getDIDDoc(address)` : The method getDID helps to resolve the DID document.
23
-
24
- - `transferOwnership(address)` : The method transferOwnership, helps in transferring the ownership of contract to a new owner. Only the current owner can access this function.
25
-
26
- - `getOwner()` : the method getOwner helps one to fetch the current owner of the contract.
27
-
28
- - `addResource(address, string, string)` : The addResource method allows the controller of a DID to add a linked resource to the DID document. This method ensures that only authorized controllers can add resources by requiring the caller to be the controller of the DID.
29
-
30
- - `getResource(address, string)` : The getResource method fetches a specific linked resource from the blockchain that is associated with a given DID document.
31
-
32
- - `getAllResources(address)` : The getAllResources method retrieves all resources linked to a specific DID document. This provides a comprehensive list of all resources associated with a given DID.
33
-
34
- ## Example ethers code
35
-
36
- Using ethers, the following illustrates how one can interact with PolygonRegistry contract, from client side application.
37
-
38
- ## Loading the Contract
39
-
40
- ```
41
- const ethers = require('ethers');
42
- const url = https://rpc-amoy.polygon.technology; // For amoy testnet
43
- const DID_ADDRESS = `<Contract Address>`;
44
- const provider = new ethers.providers.JsonRpcProvider(url);
45
-
46
- let wallet = new ethers.Wallet(`<Signer Key/Private Key>`, provider);
47
- let registry = new ethers.Contract(DID_ADDRESS, <Contract ABI>, wallet);
48
- ```
49
-
50
- # Deploying the Contract on Matic network
51
-
52
- Pre-requisites
53
-
54
- - NodeJS - https://nodejs.org/en/download/
55
- - Hardhat - https://hardhat.org
56
- - A wallet connected to polygon network, with Matic token in it. One can receive the Matic Test Tokens from their faucet.
57
-
58
- ## Deployment
59
-
60
- Clone the repository
61
-
62
- ```
63
- git clone https://github.com/ayanworks/polygon-did-registry-contract.git
64
- ```
65
-
66
- Install Dependencies
67
-
68
- ```
69
- pnpm i
70
- ```
71
-
72
- Update your and RPC URL in .env file.
73
-
74
- ```
75
- MAINNET_RPCURL="<Place your Mainnet RPC URL here>"
76
- AMOY_RPCURL="<Place your Amoy RPC URL here>"
77
- SIGNER_TESTNET="<Place your Testnet Signer Key here>"
78
- SIGNER_MAINNET="<Place your Mainnet Signer Key here>"
79
- ```
80
-
81
- On a new console window run
82
-
83
- ```
84
- npx hardhat run deploy --network <network name>
85
- ```
86
-
87
- ## Testing
88
-
89
- For Testing use the command
90
-
91
- ```
92
- pnpm test
93
- ```