Skip to content

Commit

Permalink
docs: simplify samplecode in readme
Browse files Browse the repository at this point in the history
  • Loading branch information
mirceanis committed Sep 30, 2024
1 parent ce08cb5 commit af05bf9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
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
1 change: 0 additions & 1 deletion src/configuration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ const infuraNames: Record<string, string> = {
polygon: 'matic',
'polygon:test': 'maticmum',
aurora: 'aurora-mainnet',
'linea:goerli': 'linea-goerli',
}

const knownInfuraNames = ['mainnet', 'aurora', 'linea:goerli', 'sepolia']
Expand Down

0 comments on commit af05bf9

Please sign in to comment.