diff --git a/package.json b/package.json index 4ca28ff7..dde1cacd 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,17 @@ "exports": { ".": { "require": "./lib/index.cjs", - "import": "./lib/index.module.js" + "import": "./lib/index.modern.js" + } + }, + "typesVersions": { + "*": { + "lib/index.d.ts": [ + "lib/index.d.ts" + ], + "*": [ + "./lib/index.d.js" + ] } }, "repository": { @@ -98,7 +108,6 @@ "@ethersproject/contracts": "^5.6.2", "@ethersproject/providers": "^5.6.8", "@ethersproject/transactions": "^5.6.2", - "did-resolver": "^4.0.0", - "ethr-did-registry": "^1.0.0" + "did-resolver": "^4.0.0" } } diff --git a/src/__tests__/resolver.test.ts b/src/__tests__/resolver.test.ts index 1d8c0218..f936bfb4 100644 --- a/src/__tests__/resolver.test.ts +++ b/src/__tests__/resolver.test.ts @@ -2,7 +2,7 @@ import { Contract, ContractFactory } from '@ethersproject/contracts' import { Resolvable, Resolver } from 'did-resolver' import { getResolver } from '../resolver' import { EthrDidController } from '../controller' -import { EthereumDIDRegistry } from 'ethr-did-registry' +import { default as EthereumDIDRegistry } from '../config/EthereumDIDRegistry.json' import { interpretIdentifier, stringToBytes32 } from '../helpers' import { createProvider, sleep, startMining, stopMining } from './testUtils' import { nullAddress } from '../helpers' diff --git a/src/config/EthereumDIDRegistry.json b/src/config/EthereumDIDRegistry.json new file mode 100644 index 00000000..af5ede45 --- /dev/null +++ b/src/config/EthereumDIDRegistry.json @@ -0,0 +1,559 @@ +{ + "_format": "hh-sol-artifact-1", + "contractName": "EthereumDIDRegistry", + "sourceName": "contracts/EthereumDIDRegistry.sol", + "abi": [ + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validTo", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousChange", + "type": "uint256" + } + ], + "name": "DIDAttributeChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "validTo", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousChange", + "type": "uint256" + } + ], + "name": "DIDDelegateChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "owner", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "previousChange", + "type": "uint256" + } + ], + "name": "DIDOwnerChanged", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validity", + "type": "uint256" + } + ], + "name": "addDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + }, + { + "internalType": "uint256", + "name": "validity", + "type": "uint256" + } + ], + "name": "addDelegateSigned", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "changeOwner", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "changeOwnerSigned", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "changed", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "delegates", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + } + ], + "name": "identityOwner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "nonce", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "owners", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "revokeAttribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + } + ], + "name": "revokeAttributeSigned", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "revokeDelegate", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "revokeDelegateSigned", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "validity", + "type": "uint256" + } + ], + "name": "setAttribute", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "uint8", + "name": "sigV", + "type": "uint8" + }, + { + "internalType": "bytes32", + "name": "sigR", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "sigS", + "type": "bytes32" + }, + { + "internalType": "bytes32", + "name": "name", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "value", + "type": "bytes" + }, + { + "internalType": "uint256", + "name": "validity", + "type": "uint256" + } + ], + "name": "setAttributeSigned", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "identity", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "delegateType", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "delegate", + "type": "address" + } + ], + "name": "validDelegate", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + } + ], + "bytecode": "0x608060405234801561001057600080fd5b506113c8806100206000396000f3fe608060405234801561001057600080fd5b50600436106100ff5760003560e01c806380b29f7c11610097578063a7068d6611610066578063a7068d66146102b5578063e476af5c146102c8578063f00d4b5d146102db578063f96d0f9f146102ee57600080fd5b806380b29f7c146102695780638733d4e81461027c578063930726841461028f5780639c2c1b2b146102a257600080fd5b8063240cf1fa116100d3578063240cf1fa146101b1578063622b2a3c146101c457806370ae92d2146102365780637ad4b0a41461025657600080fd5b8062c023da14610104578063022914a7146101195780630d44625b1461015f578063123b5e981461019e575b600080fd5b610117610112366004610ea7565b61030e565b005b610142610127366004610dd2565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61019061016d366004610e27565b600160209081526000938452604080852082529284528284209052825290205481565b604051908152602001610156565b6101176101ac3660046110f7565b61031f565b6101176101bf366004610f5d565b6103ab565b6102266101d2366004610e27565b6001600160a01b039283166000908152600160209081526040808320815180840196909652815180870384018152958201825285519583019590952083529381528382209290941681529252902054421090565b6040519015158152602001610156565b610190610244366004610dd2565b60036020526000908152604090205481565b610117610264366004610efe565b61048d565b610117610277366004610e27565b6104a0565b61014261028a366004610dd2565b6104ac565b61011761029d366004610fb4565b6104dc565b6101176102b0366004611013565b6105c7565b6101176102c3366004610e63565b6106b5565b6101176102d636600461107d565b6106c2565b6101176102e9366004610df4565b610741565b6101906102fc366004610dd2565b60026020526000908152604090205481565b61031a83338484610750565b505050565b6000601960f81b81306003826103348d6104ac565b6001600160a01b03166001600160a01b03168152602001908152602001600020548b88888860405160200161037098979695949392919061123e565b6040516020818303038152906040528051906020012090506103a1886103998a8a8a8a87610824565b868686610923565b5050505050505050565b6000601960f81b81306003826103c08b6104ac565b6001600160a01b0316815260208082019290925260409081016000205481516001600160f81b0319968716818501529490951660218501526bffffffffffffffffffffffff19606093841b8116602286015260368501959095528a831b851660568501527f6368616e67654f776e6572000000000000000000000000000000000000000000606a8501529186901b90931660758301528051606981840301815260899092019052805191012090506104858661047f8188888887610824565b84610a07565b505050505050565b61049a8433858585610923565b50505050565b61031a83338484610b03565b6001600160a01b0380821660009081526020819052604081205490911680156104d55792915050565b5090919050565b6000601960f81b81306003826104f18c6104ac565b6001600160a01b0316815260208082019290925260409081016000205481516001600160f81b0319968716818501529490951660218501526bffffffffffffffffffffffff19606093841b8116602286015260368501959095528b831b851660568501527f7265766f6b6544656c6567617465000000000000000000000000000000000000606a850152607884018890529186901b90931660988301528051608c81840301815260ac9092019052805191012090506105be876105b78189898987610824565b8585610b03565b50505050505050565b6000601960f81b81306003826105dc8d6104ac565b6001600160a01b0316815260208082019290925260409081016000205490516001600160f81b031995861692810192909252929093166021840152606090811b6bffffffffffffffffffffffff19908116602285015260368401929092528a811b821660568401527f61646444656c6567617465000000000000000000000000000000000000000000606a8401526075830187905285901b16609582015260a9810183905260c9016040516020818303038152906040528051906020012090506103a1886106ad8a8a8a8a87610824565b868686610bfd565b61049a8433858585610bfd565b6000601960f81b81306003826106d78c6104ac565b6001600160a01b03166001600160a01b03168152602001908152602001600020548a878760405160200161071197969594939291906111a8565b6040516020818303038152906040528051906020012090506105be8761073a8989898987610824565b8585610750565b61074c823383610a07565b5050565b838361075b826104ac565b6001600160a01b0316816001600160a01b0316146107ac5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064015b60405180910390fd5b6001600160a01b0386166000818152600260205260408082205490517f18ab6b2ae3d64306c00ce663125f2bd680e441a098de1635bd7ad8b0d44965e4926107f9928992899291906112db565b60405180910390a25050506001600160a01b0390921660009081526002602052604090204390555050565b6040805160008082526020820180845284905260ff8716928201929092526060810185905260808101849052819060019060a0016020604051602081039080840390855afa15801561087a573d6000803e3d6000fd5b50505060206040510351905061088f876104ac565b6001600160a01b0316816001600160a01b0316146108ef5760405162461bcd60e51b815260206004820152600d60248201527f6261645f7369676e61747572650000000000000000000000000000000000000060448201526064016107a3565b6001600160a01b03811660009081526003602052604081208054916109138361134b565b9091555090979650505050505050565b848461092e826104ac565b6001600160a01b0316816001600160a01b03161461097a5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b0387167f18ab6b2ae3d64306c00ce663125f2bd680e441a098de1635bd7ad8b0d44965e486866109b18742611307565b6001600160a01b038c16600090815260026020526040908190205490516109db94939291906112db565b60405180910390a25050506001600160a01b039093166000908152600260205260409020439055505050565b8282610a12826104ac565b6001600160a01b0316816001600160a01b031614610a5e5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b0385811660008181526020818152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016958916958617905560028252918290205482519485529084015290917f38a5a6e68f30ed1ab45860a4afb34bcb2fc00f22ca462d249b8a8d40cda6f7a3910160405180910390a2505050506001600160a01b03166000908152600260205260409020439055565b8383610b0e826104ac565b6001600160a01b0316816001600160a01b031614610b5a5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b03868116600081815260016020908152604080832081518084018b90528251808203850181528184018085528151918601919091208652918452828520968a16808652968452828520429081905586865260029094529190932054928990526060810194909452608084015260a0830152907f5a5084339536bcab65f20799fcc58724588145ca054bd2be626174b27ba156f79060c0016107f9565b8484610c08826104ac565b6001600160a01b0316816001600160a01b031614610c545760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b610c5e8342611307565b6001600160a01b03888116600081815260016020908152604080832081518084018d9052825180820385018152908301835280519084012084528252808320948a16835293905291909120919091557f5a5084339536bcab65f20799fcc58724588145ca054bd2be626174b27ba156f78686610cda8742611307565b6001600160a01b038c8116600090815260026020908152604091829020548251968752949092169185019190915283015260608201526080016109db565b80356001600160a01b0381168114610d2f57600080fd5b919050565b600082601f830112610d4557600080fd5b813567ffffffffffffffff80821115610d6057610d6061137c565b604051601f8301601f19908116603f01168101908282118183101715610d8857610d8861137c565b81604052838152866020858801011115610da157600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff81168114610d2f57600080fd5b600060208284031215610de457600080fd5b610ded82610d18565b9392505050565b60008060408385031215610e0757600080fd5b610e1083610d18565b9150610e1e60208401610d18565b90509250929050565b600080600060608486031215610e3c57600080fd5b610e4584610d18565b925060208401359150610e5a60408501610d18565b90509250925092565b60008060008060808587031215610e7957600080fd5b610e8285610d18565b935060208501359250610e9760408601610d18565b9396929550929360600135925050565b600080600060608486031215610ebc57600080fd5b610ec584610d18565b925060208401359150604084013567ffffffffffffffff811115610ee857600080fd5b610ef486828701610d34565b9150509250925092565b60008060008060808587031215610f1457600080fd5b610f1d85610d18565b935060208501359250604085013567ffffffffffffffff811115610f4057600080fd5b610f4c87828801610d34565b949793965093946060013593505050565b600080600080600060a08688031215610f7557600080fd5b610f7e86610d18565b9450610f8c60208701610dc1565b93506040860135925060608601359150610fa860808701610d18565b90509295509295909350565b60008060008060008060c08789031215610fcd57600080fd5b610fd687610d18565b9550610fe460208801610dc1565b945060408701359350606087013592506080870135915061100760a08801610d18565b90509295509295509295565b600080600080600080600060e0888a03121561102e57600080fd5b61103788610d18565b965061104560208901610dc1565b955060408801359450606088013593506080880135925061106860a08901610d18565b915060c0880135905092959891949750929550565b60008060008060008060c0878903121561109657600080fd5b61109f87610d18565b95506110ad60208801610dc1565b945060408701359350606087013592506080870135915060a087013567ffffffffffffffff8111156110de57600080fd5b6110ea89828a01610d34565b9150509295509295509295565b600080600080600080600060e0888a03121561111257600080fd5b61111b88610d18565b965061112960208901610dc1565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff81111561115a57600080fd5b6111668a828b01610d34565b92505060c0880135905092959891949750929550565b6000815180845261119481602086016020860161131f565b601f01601f19169290920160200192915050565b60006001600160f81b0319808a1683528089166001840152506bffffffffffffffffffffffff19808860601b166002840152866016840152808660601b166036840152507f7265766f6b654174747269627574650000000000000000000000000000000000604a830152836059830152825161122b81607985016020870161131f565b9190910160790198975050505050505050565b60006001600160f81b0319808b168352808a166001840152506bffffffffffffffffffffffff19808960601b166002840152876016840152808760601b166036840152507f7365744174747269627574650000000000000000000000000000000000000000604a83015284605683015283516112c181607685016020880161131f565b607692019182019290925260960198975050505050505050565b8481526080602082015260006112f4608083018661117c565b6040830194909452506060015292915050565b6000821982111561131a5761131a611366565b500190565b60005b8381101561133a578181015183820152602001611322565b8381111561049a5750506000910152565b600060001982141561135f5761135f611366565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220216ddc889c83668a16b40556d3dc23f6e1a9fa3333587b228a11c3a0d1fad80b64736f6c63430008060033", + "deployedBytecode": "0x608060405234801561001057600080fd5b50600436106100ff5760003560e01c806380b29f7c11610097578063a7068d6611610066578063a7068d66146102b5578063e476af5c146102c8578063f00d4b5d146102db578063f96d0f9f146102ee57600080fd5b806380b29f7c146102695780638733d4e81461027c578063930726841461028f5780639c2c1b2b146102a257600080fd5b8063240cf1fa116100d3578063240cf1fa146101b1578063622b2a3c146101c457806370ae92d2146102365780637ad4b0a41461025657600080fd5b8062c023da14610104578063022914a7146101195780630d44625b1461015f578063123b5e981461019e575b600080fd5b610117610112366004610ea7565b61030e565b005b610142610127366004610dd2565b6000602081905290815260409020546001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b61019061016d366004610e27565b600160209081526000938452604080852082529284528284209052825290205481565b604051908152602001610156565b6101176101ac3660046110f7565b61031f565b6101176101bf366004610f5d565b6103ab565b6102266101d2366004610e27565b6001600160a01b039283166000908152600160209081526040808320815180840196909652815180870384018152958201825285519583019590952083529381528382209290941681529252902054421090565b6040519015158152602001610156565b610190610244366004610dd2565b60036020526000908152604090205481565b610117610264366004610efe565b61048d565b610117610277366004610e27565b6104a0565b61014261028a366004610dd2565b6104ac565b61011761029d366004610fb4565b6104dc565b6101176102b0366004611013565b6105c7565b6101176102c3366004610e63565b6106b5565b6101176102d636600461107d565b6106c2565b6101176102e9366004610df4565b610741565b6101906102fc366004610dd2565b60026020526000908152604090205481565b61031a83338484610750565b505050565b6000601960f81b81306003826103348d6104ac565b6001600160a01b03166001600160a01b03168152602001908152602001600020548b88888860405160200161037098979695949392919061123e565b6040516020818303038152906040528051906020012090506103a1886103998a8a8a8a87610824565b868686610923565b5050505050505050565b6000601960f81b81306003826103c08b6104ac565b6001600160a01b0316815260208082019290925260409081016000205481516001600160f81b0319968716818501529490951660218501526bffffffffffffffffffffffff19606093841b8116602286015260368501959095528a831b851660568501527f6368616e67654f776e6572000000000000000000000000000000000000000000606a8501529186901b90931660758301528051606981840301815260899092019052805191012090506104858661047f8188888887610824565b84610a07565b505050505050565b61049a8433858585610923565b50505050565b61031a83338484610b03565b6001600160a01b0380821660009081526020819052604081205490911680156104d55792915050565b5090919050565b6000601960f81b81306003826104f18c6104ac565b6001600160a01b0316815260208082019290925260409081016000205481516001600160f81b0319968716818501529490951660218501526bffffffffffffffffffffffff19606093841b8116602286015260368501959095528b831b851660568501527f7265766f6b6544656c6567617465000000000000000000000000000000000000606a850152607884018890529186901b90931660988301528051608c81840301815260ac9092019052805191012090506105be876105b78189898987610824565b8585610b03565b50505050505050565b6000601960f81b81306003826105dc8d6104ac565b6001600160a01b0316815260208082019290925260409081016000205490516001600160f81b031995861692810192909252929093166021840152606090811b6bffffffffffffffffffffffff19908116602285015260368401929092528a811b821660568401527f61646444656c6567617465000000000000000000000000000000000000000000606a8401526075830187905285901b16609582015260a9810183905260c9016040516020818303038152906040528051906020012090506103a1886106ad8a8a8a8a87610824565b868686610bfd565b61049a8433858585610bfd565b6000601960f81b81306003826106d78c6104ac565b6001600160a01b03166001600160a01b03168152602001908152602001600020548a878760405160200161071197969594939291906111a8565b6040516020818303038152906040528051906020012090506105be8761073a8989898987610824565b8585610750565b61074c823383610a07565b5050565b838361075b826104ac565b6001600160a01b0316816001600160a01b0316146107ac5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064015b60405180910390fd5b6001600160a01b0386166000818152600260205260408082205490517f18ab6b2ae3d64306c00ce663125f2bd680e441a098de1635bd7ad8b0d44965e4926107f9928992899291906112db565b60405180910390a25050506001600160a01b0390921660009081526002602052604090204390555050565b6040805160008082526020820180845284905260ff8716928201929092526060810185905260808101849052819060019060a0016020604051602081039080840390855afa15801561087a573d6000803e3d6000fd5b50505060206040510351905061088f876104ac565b6001600160a01b0316816001600160a01b0316146108ef5760405162461bcd60e51b815260206004820152600d60248201527f6261645f7369676e61747572650000000000000000000000000000000000000060448201526064016107a3565b6001600160a01b03811660009081526003602052604081208054916109138361134b565b9091555090979650505050505050565b848461092e826104ac565b6001600160a01b0316816001600160a01b03161461097a5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b0387167f18ab6b2ae3d64306c00ce663125f2bd680e441a098de1635bd7ad8b0d44965e486866109b18742611307565b6001600160a01b038c16600090815260026020526040908190205490516109db94939291906112db565b60405180910390a25050506001600160a01b039093166000908152600260205260409020439055505050565b8282610a12826104ac565b6001600160a01b0316816001600160a01b031614610a5e5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b0385811660008181526020818152604080832080547fffffffffffffffffffffffff000000000000000000000000000000000000000016958916958617905560028252918290205482519485529084015290917f38a5a6e68f30ed1ab45860a4afb34bcb2fc00f22ca462d249b8a8d40cda6f7a3910160405180910390a2505050506001600160a01b03166000908152600260205260409020439055565b8383610b0e826104ac565b6001600160a01b0316816001600160a01b031614610b5a5760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b6001600160a01b03868116600081815260016020908152604080832081518084018b90528251808203850181528184018085528151918601919091208652918452828520968a16808652968452828520429081905586865260029094529190932054928990526060810194909452608084015260a0830152907f5a5084339536bcab65f20799fcc58724588145ca054bd2be626174b27ba156f79060c0016107f9565b8484610c08826104ac565b6001600160a01b0316816001600160a01b031614610c545760405162461bcd60e51b81526020600482015260096024820152683130b22fb0b1ba37b960b91b60448201526064016107a3565b610c5e8342611307565b6001600160a01b03888116600081815260016020908152604080832081518084018d9052825180820385018152908301835280519084012084528252808320948a16835293905291909120919091557f5a5084339536bcab65f20799fcc58724588145ca054bd2be626174b27ba156f78686610cda8742611307565b6001600160a01b038c8116600090815260026020908152604091829020548251968752949092169185019190915283015260608201526080016109db565b80356001600160a01b0381168114610d2f57600080fd5b919050565b600082601f830112610d4557600080fd5b813567ffffffffffffffff80821115610d6057610d6061137c565b604051601f8301601f19908116603f01168101908282118183101715610d8857610d8861137c565b81604052838152866020858801011115610da157600080fd5b836020870160208301376000602085830101528094505050505092915050565b803560ff81168114610d2f57600080fd5b600060208284031215610de457600080fd5b610ded82610d18565b9392505050565b60008060408385031215610e0757600080fd5b610e1083610d18565b9150610e1e60208401610d18565b90509250929050565b600080600060608486031215610e3c57600080fd5b610e4584610d18565b925060208401359150610e5a60408501610d18565b90509250925092565b60008060008060808587031215610e7957600080fd5b610e8285610d18565b935060208501359250610e9760408601610d18565b9396929550929360600135925050565b600080600060608486031215610ebc57600080fd5b610ec584610d18565b925060208401359150604084013567ffffffffffffffff811115610ee857600080fd5b610ef486828701610d34565b9150509250925092565b60008060008060808587031215610f1457600080fd5b610f1d85610d18565b935060208501359250604085013567ffffffffffffffff811115610f4057600080fd5b610f4c87828801610d34565b949793965093946060013593505050565b600080600080600060a08688031215610f7557600080fd5b610f7e86610d18565b9450610f8c60208701610dc1565b93506040860135925060608601359150610fa860808701610d18565b90509295509295909350565b60008060008060008060c08789031215610fcd57600080fd5b610fd687610d18565b9550610fe460208801610dc1565b945060408701359350606087013592506080870135915061100760a08801610d18565b90509295509295509295565b600080600080600080600060e0888a03121561102e57600080fd5b61103788610d18565b965061104560208901610dc1565b955060408801359450606088013593506080880135925061106860a08901610d18565b915060c0880135905092959891949750929550565b60008060008060008060c0878903121561109657600080fd5b61109f87610d18565b95506110ad60208801610dc1565b945060408701359350606087013592506080870135915060a087013567ffffffffffffffff8111156110de57600080fd5b6110ea89828a01610d34565b9150509295509295509295565b600080600080600080600060e0888a03121561111257600080fd5b61111b88610d18565b965061112960208901610dc1565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff81111561115a57600080fd5b6111668a828b01610d34565b92505060c0880135905092959891949750929550565b6000815180845261119481602086016020860161131f565b601f01601f19169290920160200192915050565b60006001600160f81b0319808a1683528089166001840152506bffffffffffffffffffffffff19808860601b166002840152866016840152808660601b166036840152507f7265766f6b654174747269627574650000000000000000000000000000000000604a830152836059830152825161122b81607985016020870161131f565b9190910160790198975050505050505050565b60006001600160f81b0319808b168352808a166001840152506bffffffffffffffffffffffff19808960601b166002840152876016840152808760601b166036840152507f7365744174747269627574650000000000000000000000000000000000000000604a83015284605683015283516112c181607685016020880161131f565b607692019182019290925260960198975050505050505050565b8481526080602082015260006112f4608083018661117c565b6040830194909452506060015292915050565b6000821982111561131a5761131a611366565b500190565b60005b8381101561133a578181015183820152602001611322565b8381111561049a5750506000910152565b600060001982141561135f5761135f611366565b5060010190565b634e487b7160e01b600052601160045260246000fd5b634e487b7160e01b600052604160045260246000fdfea2646970667358221220216ddc889c83668a16b40556d3dc23f6e1a9fa3333587b228a11c3a0d1fad80b64736f6c63430008060033", + "linkReferences": {}, + "deployedLinkReferences": {} +} diff --git a/src/config/deployments.ts b/src/config/deployments.ts new file mode 100644 index 00000000..345090e0 --- /dev/null +++ b/src/config/deployments.ts @@ -0,0 +1,36 @@ +export type EthrDidRegistryDeployment = { + chainId: number + registry: string + name?: string + description?: string + rpcUrl?: string + // eslint-disable-next-line @typescript-eslint/no-explicit-any + [x: string]: any +} + +export const deployments: EthrDidRegistryDeployment[] = [ + { chainId: 1, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'mainnet' }, + { chainId: 3, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'ropsten' }, + { chainId: 4, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'rinkeby' }, + { chainId: 5, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'goerli' }, + { chainId: 42, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'kovan' }, + { chainId: 30, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'rsk' }, + { chainId: 31, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', description: 'rsk:testnet' }, + { + chainId: 246, + registry: '0xE29672f34e92b56C9169f9D485fFc8b9A136BCE4', + name: 'ewc', + description: 'energy web chain', + }, + { + chainId: 73799, + registry: '0xC15D5A57A8Eb0e1dCBE5D88B8f9a82017e5Cc4AF', + name: 'volta', + description: 'energy web testnet', + }, + { chainId: 246785, registry: '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B', description: 'artis:tau1' }, + { chainId: 246529, registry: '0xdCa7EF03e98e0DC2B855bE647C39ABe984fcF21B', description: 'artis:sigma1' }, + { chainId: 137, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', name: 'polygon' }, + { chainId: 80001, registry: '0xdca7ef03e98e0dc2b855be647c39abe984fcf21b', description: 'polygon:test' }, + { chainId: 1313161554, registry: '0x63eD58B671EeD12Bc1652845ba5b2CDfBff198e0', name: 'aurora' }, +] diff --git a/src/configuration.ts b/src/configuration.ts index 7b64c464..fa3ee108 100644 --- a/src/configuration.ts +++ b/src/configuration.ts @@ -1,8 +1,9 @@ import { BigNumber } from '@ethersproject/bignumber' import { Contract, ContractFactory } from '@ethersproject/contracts' import { JsonRpcProvider, Provider } from '@ethersproject/providers' -import { EthereumDIDRegistry, deployments, EthrDidRegistryDeployment } from 'ethr-did-registry' import { DEFAULT_REGISTRY_ADDRESS } from './helpers' +import { deployments, EthrDidRegistryDeployment } from './config/deployments' +import { default as EthereumDIDRegistry } from './config/EthereumDIDRegistry.json' const infuraNames: Record = { polygon: 'matic', diff --git a/yarn.lock b/yarn.lock index 5be75554..8e1a5c22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4815,11 +4815,6 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -ethr-did-registry@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/ethr-did-registry/-/ethr-did-registry-1.0.0.tgz#9fc076c5dd06288d79d4682ad7dd9b05832e8661" - integrity sha512-9Gl3WcogECcdIjCjFbTKtmkz18VlQf50qE9iELnLIYVsEZo+hB38ApwOd83sYMGAjSs2c1dlzUI96H9kyvfl7w== - eventemitter3@^4.0.4: version "4.0.7" resolved "https://registry.yarnpkg.com/eventemitter3/-/eventemitter3-4.0.7.tgz#2de9b68f6528d5644ef5c59526a1b4a07306169f"