@dignetwork/dig-sdk 0.0.1-alpha.35 → 0.0.1-alpha.37

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.
@@ -1 +1 @@
1
- {"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;gBAEpC,OAAO,EAAE,MAAM;YAOb,eAAe;IA8ChB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDhD,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;WA6BrC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQhD,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;WA6CX,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ5C,aAAa,CACxB,aAAa,GAAE,OAAe,EAC9B,iBAAiB,GAAE,OAAc,EACjC,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,IAAI,CAAC;YAiEF,mBAAmB;YAWnB,kBAAkB;YASlB,oBAAoB;YASpB,qBAAqB;YAuErB,cAAc;CAoB7B"}
1
+ {"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAOpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;gBAEpC,OAAO,EAAE,MAAM;YAOb,eAAe;IA8ChB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;IAsDhD,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC;WA6BrC,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQhD,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,eAAe,GAAE,MAAM,EAAO,GAC7B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;WAuCX,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;IAQ5C,aAAa,CACxB,aAAa,GAAE,OAAe,EAC9B,iBAAiB,GAAE,OAAc,EACjC,QAAQ,GAAE,OAAe,GACxB,OAAO,CAAC,IAAI,CAAC;YAsEF,mBAAmB;YAWnB,kBAAkB;YASlB,oBAAoB;YASpB,qBAAqB;YAuErB,cAAc;CAoB7B"}
@@ -136,22 +136,19 @@ class DigNetwork {
136
136
  hasRootHash: rootHash,
137
137
  });
138
138
  console.log(peerIp, storeResponse.headers);
139
- if (storeResponse.success &&
140
- storeResponse.headers?.["x-has-rootHash"] === "true") {
141
- if (!key)
139
+ if (storeResponse.headers?.["x-has-roothash"] === "true") {
140
+ console.log(`Found Peer at ${peerIp} for storeId: ${storeId}, root hash ${rootHash}`);
141
+ if (!key) {
142
142
  return peerIp;
143
+ }
143
144
  const keyResponse = await digPeer.contentServer.headKey(key);
144
- if (keyResponse.success &&
145
- keyResponse.headers?.["x-key-exists"] === "true") {
145
+ if (keyResponse.headers?.["x-key-exists"] === "true") {
146
146
  return peerIp;
147
147
  }
148
148
  }
149
149
  peerBlackList.push(peerIp);
150
150
  }
151
- catch (error) {
152
- console.error("Error while sampling the epoch or contacting peer:", error);
153
- break;
154
- }
151
+ catch { }
155
152
  }
156
153
  return null;
157
154
  }
@@ -180,7 +177,9 @@ class DigNetwork {
180
177
  }
181
178
  const digPeer = new DigPeer_1.DigPeer(peerIp, this.dataStore.StoreId);
182
179
  const rootResponse = await digPeer.propagationServer.getStoreData(`${rootInfo.root_hash}.dat`);
180
+ console.log(rootResponse);
183
181
  const root = JSON.parse(rootResponse);
182
+ console.log(root);
184
183
  if (!skipData) {
185
184
  await Promise.all(root.files.map(async (file) => {
186
185
  const filePath = (0, hashUtils_1.getFilePathFromSha256)(file.sha256, this.storeDir);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dignetwork/dig-sdk",
3
- "version": "0.0.1-alpha.35",
3
+ "version": "0.0.1-alpha.37",
4
4
  "description": "",
5
5
  "type": "commonjs",
6
6
  "main": "./dist/index.js",