You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Remove "-plugin" from package name
* Generate types in dist
* Allow constuction with pre-existing ApiPromise
* Don't put DID document @context in an array, ed25519-multikey doesn't like it
Copy file name to clipboardExpand all lines: README.md
+32-11Lines changed: 32 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,49 @@
1
1
# Overview
2
2
3
-
This package contains a plugin for the [@dsnp/did-resolver](https://github.com/LibertyDSNP/dsnp-did-resolver) library which enables resolution of `did:dsnp:*` DIDs on the [Frequency](https://github.com/LibertyDSNP/frequency) blockchain.
3
+
This package contains a resolver for the [@dsnp/did-resolver](https://github.com/LibertyDSNP/dsnp-did-resolver) library which enables resolution of `did:dsnp:*` DIDs on the [Frequency](https://github.com/LibertyDSNP/frequency) blockchain.
4
+
5
+
# Installation
6
+
7
+
`npm install @dsnp/did-resolver-frequency`
4
8
5
9
# Usage
6
10
7
-
The plugin must be initialized with Frequency connection information.
11
+
The resolver object can be constructed with Frequency connection information in one of two ways.
12
+
13
+
1. Construct with provider URI:
8
14
9
15
```
10
-
import { FrequencyResolver } from "@dsnp/did-resolver-plugin-frequency";
16
+
import { FrequencyResolver } from "@dsnp/did-resolver-frequency";
11
17
12
18
const frequencyResolver = new FrequencyResolver({
13
19
providerUri: "ws://127.0.0.1:9944",
14
20
frequencyNetwork: "local",
15
21
});
16
22
```
17
23
18
-
The plugin will automatically register itself with the DSNP DID resolver when initialized.
24
+
If constructed this way, you must call `disconnect()` to explicitly release the connection; the process will not exit if this is not done.
25
+
26
+
or,
27
+
28
+
2. Construct with preconfigured `ApiPromise` object from `@polkadot/api`:
29
+
30
+
```
31
+
import { FrequencyResolver } from "@dsnp/did-resolver-frequency";
32
+
33
+
const frequencyResolver = new FrequencyResolver({
34
+
apiPromise: myApiPromise, // from ApiPromise.create(...)
35
+
frequencyNetwork: "local",
36
+
});
37
+
```
38
+
39
+
The `frequencyNetwork` key is required in both cases (this is expected to be unnecessary with Frequency schema naming in the future).
19
40
20
-
The following options must be provided:
41
+
Summary of options:
21
42
22
43
| Configuration option | Description |
23
44
| --- | --- |
24
-
|`providerUri`| Provider URI for Frequency RPC node |
45
+
|`providerUri`| Provider URI for Frequency RPC node (optional; alternative to `apiPromise`|
46
+
|`apiPromise`| An `ApiPromise` object (optional; alternative to `providerUri`|
25
47
|`frequencyNetwork`| One of `local`, `testnet`, `mainnet`|
0 commit comments