@blockcore/dns 0.0.8 → 0.0.9

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.
package/README.md CHANGED
@@ -30,11 +30,26 @@ npm install @blockcore/dns
30
30
  ```ts
31
31
  import { BlockcoreDns } from '@blockcore/dns';
32
32
 
33
- let dns = new BlockcoreDns('https://ns.blockcore.net');
33
+ let dns = new BlockcoreDns();
34
+
35
+ // This relies on a central nameserver registry:
36
+ await dns.load();
37
+ let indexers = await dns.getServicesByType('Indexer');
38
+ ```
39
+
40
+ Get servers from known nameservers:
41
+
42
+ ```ts
43
+ import { BlockcoreDns } from '@blockcore/dns';
44
+
45
+ let dns = new BlockcoreDns();
46
+
47
+ // This relies on fixed set of nameservers:
48
+ await dns.load({ url: 'https://ns.blockcore.net', contact: 'post@blockcore.net' });
34
49
  let indexers = await dns.getServicesByType('Indexer');
35
50
  ```
36
51
 
37
- You can retrieve the public known nameservers and use those instead of manually specifying server:
52
+ You can create an load the nameservers using this static function:
38
53
 
39
54
  ```ts
40
55
  let dnsServers = await BlockcoreDns.getDnsServers();
@@ -12,5 +12,5 @@ export declare class BlockcoreDns {
12
12
  /** Attempts to load the latest status of all services from all known nameservers. This method can be called
13
13
  * at intervals to ensure latest status is available.
14
14
  */
15
- load(): Promise<void>;
15
+ load(nameservers?: DnsListEntry[]): Promise<void>;
16
16
  }
@@ -40,8 +40,8 @@ export class BlockcoreDns {
40
40
  /** Attempts to load the latest status of all services from all known nameservers. This method can be called
41
41
  * at intervals to ensure latest status is available.
42
42
  */
43
- async load() {
44
- this.nameservers = await this.getDnsServers();
43
+ async load(nameservers) {
44
+ this.nameservers = nameservers || (await this.getDnsServers());
45
45
  const servicesMap = new Map();
46
46
  for (let i = 0; i < this.nameservers.length; i++) {
47
47
  const nameserver = this.nameservers[i];
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "@blockcore/dns",
3
- "version": "0.0.8",
3
+ "version": "0.0.9",
4
+ "description": "DNS Provider package to query and resolve dynamic and decentralized DNS entries",
4
5
  "type": "module",
5
6
  "exports": "./lib/index.js",
6
7
  "types": "./lib/index.d.ts",