Skip to content

Commit

Permalink
Merge pull request #207 from decentralized-identity/alpha
Browse files Browse the repository at this point in the history
merge changes in alpha
  • Loading branch information
mirceanis authored Sep 30, 2024
2 parents 61862ba + 3e8fe2b commit be89ed3
Show file tree
Hide file tree
Showing 17 changed files with 2,768 additions and 6,143 deletions.
18 changes: 0 additions & 18 deletions .eslintrc.json

This file was deleted.

30 changes: 30 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,33 @@
# [11.0.0-alpha.3](https://github.com/decentralized-identity/ethr-did-resolver/compare/11.0.0-alpha.2...11.0.0-alpha.3) (2024-09-30)


### Features

* **deployment:** add gnosischain and holesky deployments ([#206](https://github.com/decentralized-identity/ethr-did-resolver/issues/206)) ([4992094](https://github.com/decentralized-identity/ethr-did-resolver/commit/4992094b565387ab0b50b62246b67d27ed697c71))

# [11.0.0-alpha.2](https://github.com/decentralized-identity/ethr-did-resolver/compare/11.0.0-alpha.1...11.0.0-alpha.2) (2024-09-30)


### Bug Fixes

* **build:** include default export to work around some bundler issues ([#205](https://github.com/decentralized-identity/ethr-did-resolver/issues/205)) ([1e9e4ef](https://github.com/decentralized-identity/ethr-did-resolver/commit/1e9e4ef93098009eac8fc39567348356139e8673)), closes [#186](https://github.com/decentralized-identity/ethr-did-resolver/issues/186)

# [11.0.0-alpha.1](https://github.com/decentralized-identity/ethr-did-resolver/compare/10.1.10...11.0.0-alpha.1) (2024-09-30)


### Bug Fixes

* add esm wrapper instead of double transpile ([d2bbeaf](https://github.com/decentralized-identity/ethr-did-resolver/commit/d2bbeafbd2d77308f12d73f952b0b9940431dd83))
* **build:** build commonjs and also expose esm wrapper ([522c199](https://github.com/decentralized-identity/ethr-did-resolver/commit/522c1999877c26dd3b1959111cd9d155987ada19))
* **build:** use commonjs module in tsconfig ([e66d054](https://github.com/decentralized-identity/ethr-did-resolver/commit/e66d054e8c6af9f90bcd55389786488f16ed1ce4))
* **ci:** run tests on a matrix of node versions ([3825ac0](https://github.com/decentralized-identity/ethr-did-resolver/commit/3825ac04889ec0fc2564cc82c8b94b51a521ef85))
* create alpha release ([1d5d5f2](https://github.com/decentralized-identity/ethr-did-resolver/commit/1d5d5f21e3d9f13500faf1acfdef89819589606c))


### BREAKING CHANGES

* ESM is only supported through a wrapper

## [10.1.10](https://github.com/decentralized-identity/ethr-did-resolver/compare/10.1.9...10.1.10) (2024-07-26)


Expand Down
15 changes: 9 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,20 +88,23 @@ constructor:
import { Resolver } from 'did-resolver'
import { getResolver } from 'ethr-did-resolver'

const providerConfig = {
// While experimenting, you can set a rpc endpoint to be used by the web3 provider
// You can also set the address for your own ethr-did-registry contract
const providerConfig = { rpcUrl: 'http://localhost:7545', registry: registry.address }
rpcUrl: 'http://localhost:7545',
// You can also set the address for your own ethr-did-registry (ERC1056) contract
registry: registry.address,
name: 'development' // this becomes did:ethr:development:0x...
}
// It's recommended to use the multi-network configuration when using this in production
// since that allows you to resolve on multiple public and private networks at the same time.

// getResolver will return an object with a key/value pair of { "ethr": resolver } where resolver is a function used by the generic did resolver.
const ethrDidResolver = getResolver(providerConfig)
const didResolver = new Resolver(ethrDidResolver)

didResolver.resolve('did:ethr:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74').then((doc) => console.log)

// You can also use ES7 async/await syntax
const doc = await didResolver.resolve('did:ethr:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74')
didResolver
.resolve('did:ethr:development:0xf3beac30c498d9e26865f34fcaa57dbb935b0d74')
.then((result) => console.dir(result, { depth: 3 }))
```

## Multi-network configuration
Expand Down
40 changes: 40 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import typescriptEslint from "@typescript-eslint/eslint-plugin";
import jest from "eslint-plugin-jest";
import globals from "globals";
import tsParser from "@typescript-eslint/parser";
import path from "node:path";
import { fileURLToPath } from "node:url";
import js from "@eslint/js";
import { FlatCompat } from "@eslint/eslintrc";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const compat = new FlatCompat({
baseDirectory: __dirname,
recommendedConfig: js.configs.recommended,
allConfig: js.configs.all
});

export default [...compat.extends(
"eslint:recommended",
"plugin:@typescript-eslint/recommended",
"plugin:prettier/recommended",
), {
plugins: {
"@typescript-eslint": typescriptEslint,
jest,
},

languageOptions: {
globals: {
...globals.node,
...jest.environments.globals.globals,
},

parser: tsParser,
ecmaVersion: 2020,
sourceType: "module",
},

rules: {},
}];
40 changes: 40 additions & 0 deletions jest.config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defaults } from 'jest-config'

// @type {import('jest-config').InitialOptions}
const config = {
rootDir: './',
moduleFileExtensions: [...defaults.moduleFileExtensions, 'mts'],
collectCoverage: false,
collectCoverageFrom: [
'packages/**/src/**/*.ts',
'!**/examples/**',
'!packages/cli/**',
'!**/types/**',
'!**/build/**',
'!**/node_modules/**',
'!packages/test-react-app/**',
'!packages/test-utils/**',
],
coverageReporters: ['json'],
coverageDirectory: './coverage',
coverageProvider: 'v8',
testMatch: ['**/__tests__/**/*.test.ts'],
automock: false,
// // typescript 5 removes the need to specify relative imports as .js, so we should no longer need this workaround
// // but webpack still requires .js specifiers, so we are keeping it for now
moduleNameMapper: {
'^(\\.{1,2}/.*)\\.js$': '$1',
},
transform: {
'^.+\\.m?tsx?$': [
'ts-jest',
{
useESM: true,
},
],
},
extensionsToTreatAsEsm: ['.ts'],
testEnvironment: 'node',
}

export default config
40 changes: 10 additions & 30 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ethr-did-resolver",
"version": "10.1.10",
"version": "11.0.0-alpha.3",
"description": "Resolve DID documents for ethereum addresses and public keys",
"type": "commonjs",
"source": "./src/index.ts",
Expand All @@ -14,16 +14,6 @@
"require": "./lib/index.js"
}
},
"typesVersions": {
"*": {
"lib/index.d.ts": [
"lib/index.d.ts"
],
"*": [
"./lib/index.d.js"
]
}
},
"repository": {
"type": "git",
"url": "git@github.com:decentralized-identity/ethr-did-resolver.git"
Expand All @@ -36,7 +26,7 @@
],
"author": "Pelle Braendgaard",
"contributors": [
"Mircea Nistor <mircea.nistor@mesh.xyz>"
"Mircea Nistor"
],
"license": "Apache-2.0",
"keywords": [
Expand Down Expand Up @@ -66,42 +56,32 @@
"prepublishOnly": "yarn test:ci && yarn format && yarn lint",
"release": "semantic-release --debug"
},
"jest": {
"clearMocks": true,
"collectCoverageFrom": [
"src/**/*.{ts,tsx}",
"!src/**/*.d.ts",
"!**/node_modules/**",
"!**/__tests__/**"
],
"testEnvironment": "node",
"testMatch": [
"**/__tests__/**/*.test.[jt]s"
]
},
"devDependencies": {
"@babel/core": "7.25.2",
"@babel/preset-env": "7.25.4",
"@babel/preset-typescript": "7.24.7",
"@eslint/eslintrc": "^3.1.0",
"@eslint/js": "^9.11.1",
"@ethers-ext/provider-ganache": "6.0.0-beta.2",
"@semantic-release/changelog": "6.0.3",
"@semantic-release/git": "10.0.1",
"@types/jest": "29.5.12",
"@typescript-eslint/eslint-plugin": "6.21.0",
"@typescript-eslint/parser": "6.21.0",
"@typescript-eslint/eslint-plugin": "8.7.0",
"@typescript-eslint/parser": "8.7.0",
"babel-jest": "29.7.0",
"eslint": "8.57.0",
"eslint-config-prettier": "9.1.0",
"eslint-plugin-jest": "27.9.0",
"eslint-plugin-jest": "28.8.3",
"eslint-plugin-prettier": "5.2.1",
"jest": "29.7.0",
"microbundle": "0.15.1",
"prettier": "3.3.3",
"semantic-release": "22.0.12",
"ts-jest": "^29.2.5",
"typescript": "5.5.4"
},
"dependencies": {
"did-resolver": "^4.1.0",
"ethers": "^6.8.1"
}
},
"packageManager": "yarn@1.22.22"
}
27 changes: 0 additions & 27 deletions src/__tests__/networks.integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,6 @@ describe('ethrResolver (alt-chains)', () => {
})
})

it('resolves on linea:goerli when configured', async () => {
const did = 'did:ethr:linea:goerli:' + addr
const ethr = getResolver({
infuraProjectId: '6b734e0b04454df8a6ce234023c04f26',
})
const resolver = new Resolver(ethr)
const result = await resolver.resolve(did)
expect(result).toEqual({
didDocumentMetadata: {},
didResolutionMetadata: { contentType: 'application/did+ld+json' },
didDocument: {
'@context': expect.anything(),
id: did,
verificationMethod: [
{
id: `${did}#controller`,
type: 'EcdsaSecp256k1RecoveryMethod2020',
controller: did,
blockchainAccountId: `eip155:59140:${checksumAddr}`,
},
],
authentication: [`${did}#controller`],
assertionMethod: [`${did}#controller`],
},
})
})

it('resolves on sepolia when configured', async () => {
const did = 'did:ethr:sepolia:' + addr
const ethr = getResolver({
Expand Down
2 changes: 1 addition & 1 deletion src/__tests__/testUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Contract, ContractFactory, ethers, SigningKey, Wallet } from 'ethers'
import { GanacheProvider } from '@ethers-ext/provider-ganache'
import { Resolver } from 'did-resolver'
import { getResolver } from '../resolver'
import { default as EthereumDIDRegistry } from '../config/EthereumDIDRegistry.json'
import { EthereumDIDRegistry } from '../config/EthereumDIDRegistry'

export async function deployRegistry(): Promise<{
registryContract: Contract
Expand Down
Loading

0 comments on commit be89ed3

Please sign in to comment.