@dignetwork/dig-sdk 0.0.1-alpha.15 → 0.0.1-alpha.150
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/dist/DataIntegrityTree/DataIntegrityTree.d.ts +11 -2
- package/dist/DataIntegrityTree/DataIntegrityTree.d.ts.map +1 -1
- package/dist/DataIntegrityTree/DataIntegrityTree.js +117 -58
- package/dist/DigNetwork/ContentServer.d.ts +12 -5
- package/dist/DigNetwork/ContentServer.d.ts.map +1 -1
- package/dist/DigNetwork/ContentServer.js +172 -24
- package/dist/DigNetwork/DigNetwork.d.ts +15 -9
- package/dist/DigNetwork/DigNetwork.d.ts.map +1 -1
- package/dist/DigNetwork/DigNetwork.js +146 -189
- package/dist/DigNetwork/DigPeer.d.ts +8 -3
- package/dist/DigNetwork/DigPeer.d.ts.map +1 -1
- package/dist/DigNetwork/DigPeer.js +68 -115
- package/dist/DigNetwork/IncentiveServer.d.ts.map +1 -1
- package/dist/DigNetwork/IncentiveServer.js +6 -5
- package/dist/DigNetwork/PropagationServer.d.ts +83 -33
- package/dist/DigNetwork/PropagationServer.d.ts.map +1 -1
- package/dist/DigNetwork/PropagationServer.js +605 -356
- package/dist/blockchain/DataStore.d.ts +25 -7
- package/dist/blockchain/DataStore.d.ts.map +1 -1
- package/dist/blockchain/DataStore.js +114 -159
- package/dist/blockchain/DataStoreSerializer.d.ts +1 -1
- package/dist/blockchain/DataStoreSerializer.d.ts.map +1 -1
- package/dist/blockchain/FullNodePeer.d.ts +94 -10
- package/dist/blockchain/FullNodePeer.d.ts.map +1 -1
- package/dist/blockchain/FullNodePeer.js +325 -100
- package/dist/blockchain/ServerCoin.d.ts +13 -5
- package/dist/blockchain/ServerCoin.d.ts.map +1 -1
- package/dist/blockchain/ServerCoin.js +90 -28
- package/dist/blockchain/StoreMonitorRegistry.d.ts +85 -0
- package/dist/blockchain/StoreMonitorRegistry.d.ts.map +1 -0
- package/dist/blockchain/StoreMonitorRegistry.js +241 -0
- package/dist/blockchain/Wallet.d.ts +2 -2
- package/dist/blockchain/Wallet.d.ts.map +1 -1
- package/dist/blockchain/Wallet.js +50 -18
- package/dist/blockchain/coins.d.ts +1 -2
- package/dist/blockchain/coins.d.ts.map +1 -1
- package/dist/blockchain/coins.js +1 -55
- package/dist/blockchain/index.d.ts +1 -0
- package/dist/blockchain/index.d.ts.map +1 -1
- package/dist/blockchain/index.js +1 -0
- package/dist/types.d.ts +2 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/ContentScanner.d.ts +63 -0
- package/dist/utils/ContentScanner.d.ts.map +1 -0
- package/dist/utils/ContentScanner.js +175 -0
- package/dist/utils/Environment.d.ts +21 -0
- package/dist/utils/Environment.d.ts.map +1 -0
- package/dist/utils/Environment.js +92 -0
- package/dist/utils/FileCache.d.ts +1 -1
- package/dist/utils/FileCache.d.ts.map +1 -1
- package/dist/utils/FileCache.js +2 -2
- package/dist/utils/FileTransfer.d.ts +47 -0
- package/dist/utils/FileTransfer.d.ts.map +1 -0
- package/dist/utils/FileTransfer.js +209 -0
- package/dist/utils/NconfManager.js +2 -1
- package/dist/utils/PeerRanker.d.ts +53 -0
- package/dist/utils/PeerRanker.d.ts.map +1 -0
- package/dist/utils/PeerRanker.js +171 -0
- package/dist/utils/StoreArchiveManager.d.ts +45 -0
- package/dist/utils/StoreArchiveManager.d.ts.map +1 -0
- package/dist/utils/StoreArchiveManager.js +153 -0
- package/dist/utils/config.d.ts +4 -3
- package/dist/utils/config.d.ts.map +1 -1
- package/dist/utils/config.js +12 -7
- package/dist/utils/directoryUtils.d.ts.map +1 -1
- package/dist/utils/directoryUtils.js +9 -12
- package/dist/utils/index.d.ts +3 -1
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +3 -1
- package/dist/utils/merkle.d.ts +2 -0
- package/dist/utils/merkle.d.ts.map +1 -0
- package/dist/utils/merkle.js +28 -0
- package/dist/utils/network.d.ts +1 -0
- package/dist/utils/network.d.ts.map +1 -1
- package/dist/utils/network.js +38 -11
- package/dist/utils/promiseUtils.d.ts +19 -0
- package/dist/utils/promiseUtils.d.ts.map +1 -0
- package/dist/utils/promiseUtils.js +43 -0
- package/dist/utils/ssl.js +2 -2
- package/package.json +17 -5
- package/dist/utils/deltaUtils.d.ts +0 -2
- package/dist/utils/deltaUtils.d.ts.map +0 -1
- package/dist/utils/deltaUtils.js +0 -83
|
@@ -4,23 +4,37 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.ContentServer = void 0;
|
|
7
|
+
const fs_1 = __importDefault(require("fs"));
|
|
7
8
|
const http_1 = __importDefault(require("http"));
|
|
8
9
|
const url_1 = require("url");
|
|
10
|
+
const ssl_1 = require("../utils/ssl");
|
|
11
|
+
const network_1 = require("../utils/network");
|
|
9
12
|
class ContentServer {
|
|
10
13
|
constructor(ipAddress, storeId) {
|
|
11
14
|
this.ipAddress = ipAddress;
|
|
12
15
|
this.storeId = storeId;
|
|
16
|
+
if (!ContentServer.certPath || !ContentServer.keyPath) {
|
|
17
|
+
const { certPath, keyPath } = (0, ssl_1.getOrCreateSSLCerts)();
|
|
18
|
+
ContentServer.certPath = certPath;
|
|
19
|
+
ContentServer.keyPath = keyPath;
|
|
20
|
+
}
|
|
13
21
|
}
|
|
14
22
|
// Method to get the content of a specified key from the peer, with optional challenge query
|
|
15
23
|
async getKey(key, rootHash, challengeHex) {
|
|
16
24
|
// Construct the base URL
|
|
17
|
-
let url = `
|
|
25
|
+
let url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/chia.${this.storeId}.${rootHash}/${key}`;
|
|
18
26
|
// If a challenge is provided, append it as a query parameter
|
|
19
27
|
if (challengeHex) {
|
|
20
28
|
url += `?challenge=${challengeHex}`;
|
|
21
29
|
}
|
|
22
30
|
return this.fetchWithRetries(url);
|
|
23
31
|
}
|
|
32
|
+
// New method to get only the first chunk of the content
|
|
33
|
+
async getKeyChunk(key, rootHash) {
|
|
34
|
+
// Construct the base URL
|
|
35
|
+
let url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/chia.${this.storeId}.${rootHash}/${key}`;
|
|
36
|
+
return this.fetchFirstChunk(url);
|
|
37
|
+
}
|
|
24
38
|
// Method to get the payment address from the peer
|
|
25
39
|
async getPaymentAddress() {
|
|
26
40
|
console.log(`Fetching payment address from peer ${this.ipAddress}...`);
|
|
@@ -30,43 +44,66 @@ class ContentServer {
|
|
|
30
44
|
}
|
|
31
45
|
catch (error) {
|
|
32
46
|
console.error(`Failed to fetch payment address from ${this.ipAddress}: ${error.message}`);
|
|
33
|
-
|
|
47
|
+
return null;
|
|
34
48
|
}
|
|
35
49
|
}
|
|
36
50
|
// Method to get the .well-known information
|
|
37
51
|
async getWellKnown() {
|
|
38
|
-
const url = `
|
|
52
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/.well-known`;
|
|
39
53
|
return this.fetchJson(url);
|
|
40
54
|
}
|
|
41
55
|
// Method to get the list of known stores
|
|
42
56
|
async getKnownStores() {
|
|
43
|
-
const url = `
|
|
57
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/.well-known/stores`;
|
|
44
58
|
return this.fetchJson(url);
|
|
45
59
|
}
|
|
46
60
|
// Method to get the index of all stores
|
|
47
61
|
async getStoresIndex() {
|
|
48
|
-
const url = `
|
|
62
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/`;
|
|
49
63
|
return this.fetchJson(url);
|
|
50
64
|
}
|
|
51
65
|
// Method to get the index of keys in a store
|
|
52
|
-
async getKeysIndex() {
|
|
53
|
-
|
|
66
|
+
async getKeysIndex(rootHash) {
|
|
67
|
+
let udi = `chia.${this.storeId}`;
|
|
68
|
+
if (rootHash) {
|
|
69
|
+
udi += `.${rootHash}`;
|
|
70
|
+
}
|
|
71
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}`;
|
|
54
72
|
return this.fetchJson(url);
|
|
55
73
|
}
|
|
56
74
|
// Method to check if a specific key exists (HEAD request)
|
|
57
|
-
async headKey(key) {
|
|
58
|
-
|
|
59
|
-
|
|
75
|
+
async headKey(key, rootHash) {
|
|
76
|
+
let udi = `chia.${this.storeId}`;
|
|
77
|
+
if (rootHash) {
|
|
78
|
+
udi += `.${rootHash}`;
|
|
79
|
+
}
|
|
80
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}/${key}`;
|
|
81
|
+
return this.head(url);
|
|
60
82
|
}
|
|
61
83
|
// Method to check if a specific store exists (HEAD request)
|
|
62
|
-
async headStore() {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
84
|
+
async headStore(options) {
|
|
85
|
+
let url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/chia.${this.storeId}`;
|
|
86
|
+
if (options?.hasRootHash) {
|
|
87
|
+
url += `?hasRootHash=${options.hasRootHash}`;
|
|
88
|
+
}
|
|
89
|
+
return this.head(url);
|
|
66
90
|
}
|
|
67
|
-
|
|
91
|
+
async hasRootHash(rootHash) {
|
|
92
|
+
const { success, headers } = await this.headStore({
|
|
93
|
+
hasRootHash: rootHash,
|
|
94
|
+
});
|
|
95
|
+
if (success) {
|
|
96
|
+
return headers?.["x-has-root-hash"] === "true";
|
|
97
|
+
}
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
streamKey(key, rootHash) {
|
|
101
|
+
let udi = `chia.${this.storeId}`;
|
|
102
|
+
if (rootHash) {
|
|
103
|
+
udi += `.${rootHash}`;
|
|
104
|
+
}
|
|
68
105
|
return new Promise((resolve, reject) => {
|
|
69
|
-
const url = `
|
|
106
|
+
const url = `https://${(0, network_1.formatHost)(this.ipAddress)}:${ContentServer.port}/${udi}/${key}`;
|
|
70
107
|
const urlObj = new url_1.URL(url);
|
|
71
108
|
const requestOptions = {
|
|
72
109
|
hostname: urlObj.hostname,
|
|
@@ -93,7 +130,7 @@ class ContentServer {
|
|
|
93
130
|
}
|
|
94
131
|
});
|
|
95
132
|
request.on("error", (error) => {
|
|
96
|
-
console.error(`Request error for ${url}:`, error);
|
|
133
|
+
console.error(`GET Request error for ${url}:`, error);
|
|
97
134
|
reject(error);
|
|
98
135
|
});
|
|
99
136
|
request.end();
|
|
@@ -111,6 +148,9 @@ class ContentServer {
|
|
|
111
148
|
(urlObj.protocol === "http:" ? 80 : ContentServer.port),
|
|
112
149
|
path: urlObj.pathname + urlObj.search,
|
|
113
150
|
method: "HEAD",
|
|
151
|
+
key: fs_1.default.readFileSync(ContentServer.keyPath),
|
|
152
|
+
cert: fs_1.default.readFileSync(ContentServer.certPath),
|
|
153
|
+
rejectUnauthorized: false,
|
|
114
154
|
};
|
|
115
155
|
const request = http_1.default.request(requestOptions, (response) => {
|
|
116
156
|
const { statusCode, headers } = response;
|
|
@@ -149,7 +189,7 @@ class ContentServer {
|
|
|
149
189
|
}
|
|
150
190
|
});
|
|
151
191
|
request.on("error", (error) => {
|
|
152
|
-
console.error(`
|
|
192
|
+
console.error(`HEAD ${url}:`, error.message);
|
|
153
193
|
reject({ success: false });
|
|
154
194
|
});
|
|
155
195
|
request.end();
|
|
@@ -168,7 +208,7 @@ class ContentServer {
|
|
|
168
208
|
// Helper method to fetch content with retries and redirection handling
|
|
169
209
|
async fetchWithRetries(url) {
|
|
170
210
|
let attempt = 0;
|
|
171
|
-
const maxRetries =
|
|
211
|
+
const maxRetries = 1;
|
|
172
212
|
const initialDelay = 2000; // 2 seconds
|
|
173
213
|
const maxDelay = 10000; // 10 seconds
|
|
174
214
|
const delayMultiplier = 1.5;
|
|
@@ -192,23 +232,48 @@ class ContentServer {
|
|
|
192
232
|
}
|
|
193
233
|
throw new Error(`Failed to retrieve data from ${url} after ${maxRetries} attempts.`);
|
|
194
234
|
}
|
|
195
|
-
// Core method to fetch content from a URL
|
|
235
|
+
// Core method to fetch content from a URL with a 5-second inactivity timeout
|
|
196
236
|
async fetch(url, maxRedirects = 5) {
|
|
197
237
|
return new Promise((resolve, reject) => {
|
|
198
238
|
const urlObj = new url_1.URL(url);
|
|
239
|
+
const timeoutDuration = 5000; // 5 seconds
|
|
240
|
+
let timeout = null; // Initialize timeout
|
|
199
241
|
const requestOptions = {
|
|
200
242
|
hostname: urlObj.hostname,
|
|
201
243
|
port: urlObj.port || ContentServer.port,
|
|
202
244
|
path: urlObj.pathname + urlObj.search, // Include query params
|
|
203
245
|
method: "GET",
|
|
246
|
+
key: fs_1.default.readFileSync(ContentServer.keyPath),
|
|
247
|
+
cert: fs_1.default.readFileSync(ContentServer.certPath),
|
|
248
|
+
rejectUnauthorized: false,
|
|
204
249
|
};
|
|
205
250
|
const request = http_1.default.request(requestOptions, (response) => {
|
|
206
251
|
let data = "";
|
|
252
|
+
// Set timeout for inactivity
|
|
253
|
+
timeout = setTimeout(() => {
|
|
254
|
+
console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
|
|
255
|
+
request.destroy(); // Use destroy instead of abort
|
|
256
|
+
reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
|
|
257
|
+
}, timeoutDuration);
|
|
258
|
+
const resetTimeout = () => {
|
|
259
|
+
if (timeout) {
|
|
260
|
+
clearTimeout(timeout);
|
|
261
|
+
}
|
|
262
|
+
timeout = setTimeout(() => {
|
|
263
|
+
console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
|
|
264
|
+
request.destroy(); // Use destroy instead of abort
|
|
265
|
+
reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
|
|
266
|
+
}, timeoutDuration);
|
|
267
|
+
};
|
|
207
268
|
if (response.statusCode === 200) {
|
|
208
269
|
response.on("data", (chunk) => {
|
|
209
270
|
data += chunk;
|
|
271
|
+
resetTimeout(); // Reset the timeout every time data is received
|
|
210
272
|
});
|
|
211
273
|
response.on("end", () => {
|
|
274
|
+
if (timeout) {
|
|
275
|
+
clearTimeout(timeout);
|
|
276
|
+
}
|
|
212
277
|
resolve(data);
|
|
213
278
|
});
|
|
214
279
|
}
|
|
@@ -217,8 +282,9 @@ class ContentServer {
|
|
|
217
282
|
// Handle redirects
|
|
218
283
|
if (maxRedirects > 0) {
|
|
219
284
|
const redirectUrl = new url_1.URL(response.headers.location, url); // Resolve relative URLs based on the original URL
|
|
220
|
-
|
|
221
|
-
|
|
285
|
+
if (timeout) {
|
|
286
|
+
clearTimeout(timeout);
|
|
287
|
+
}
|
|
222
288
|
this.fetch(redirectUrl.toString(), maxRedirects - 1)
|
|
223
289
|
.then(resolve)
|
|
224
290
|
.catch(reject);
|
|
@@ -228,11 +294,93 @@ class ContentServer {
|
|
|
228
294
|
}
|
|
229
295
|
}
|
|
230
296
|
else {
|
|
297
|
+
if (timeout) {
|
|
298
|
+
clearTimeout(timeout);
|
|
299
|
+
}
|
|
231
300
|
reject(new Error(`Failed to retrieve data from ${url}. Status code: ${response.statusCode}`));
|
|
232
301
|
}
|
|
233
302
|
});
|
|
234
303
|
request.on("error", (error) => {
|
|
235
|
-
|
|
304
|
+
if (timeout) {
|
|
305
|
+
clearTimeout(timeout);
|
|
306
|
+
}
|
|
307
|
+
console.error(`GET ${url}:`, error.message);
|
|
308
|
+
reject(error);
|
|
309
|
+
});
|
|
310
|
+
request.end();
|
|
311
|
+
});
|
|
312
|
+
}
|
|
313
|
+
// New core method to fetch only the first chunk without retries
|
|
314
|
+
async fetchFirstChunk(url) {
|
|
315
|
+
return new Promise((resolve, reject) => {
|
|
316
|
+
const urlObj = new url_1.URL(url);
|
|
317
|
+
const timeoutDuration = 5000; // 5 seconds
|
|
318
|
+
let timeout = null;
|
|
319
|
+
const requestOptions = {
|
|
320
|
+
hostname: urlObj.hostname,
|
|
321
|
+
port: urlObj.port || ContentServer.port,
|
|
322
|
+
path: urlObj.pathname + urlObj.search, // Include query params
|
|
323
|
+
method: "GET",
|
|
324
|
+
key: fs_1.default.readFileSync(ContentServer.keyPath),
|
|
325
|
+
cert: fs_1.default.readFileSync(ContentServer.certPath),
|
|
326
|
+
rejectUnauthorized: false,
|
|
327
|
+
};
|
|
328
|
+
const request = http_1.default.request(requestOptions, (response) => {
|
|
329
|
+
// Set timeout for inactivity
|
|
330
|
+
timeout = setTimeout(() => {
|
|
331
|
+
console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
|
|
332
|
+
request.destroy(); // Use destroy instead of abort
|
|
333
|
+
reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
|
|
334
|
+
}, timeoutDuration);
|
|
335
|
+
const resetTimeout = () => {
|
|
336
|
+
if (timeout) {
|
|
337
|
+
clearTimeout(timeout);
|
|
338
|
+
}
|
|
339
|
+
timeout = setTimeout(() => {
|
|
340
|
+
console.error(`Request timeout: No data received for ${timeoutDuration / 1000} seconds.`);
|
|
341
|
+
request.destroy(); // Use destroy instead of abort
|
|
342
|
+
reject(new Error(`Request timed out after ${timeoutDuration / 1000} seconds of inactivity`));
|
|
343
|
+
}, timeoutDuration);
|
|
344
|
+
};
|
|
345
|
+
if (response.statusCode === 200) {
|
|
346
|
+
response.once("data", (chunk) => {
|
|
347
|
+
if (timeout) {
|
|
348
|
+
clearTimeout(timeout);
|
|
349
|
+
}
|
|
350
|
+
response.destroy(); // Close the connection after receiving the first chunk
|
|
351
|
+
resolve(chunk);
|
|
352
|
+
});
|
|
353
|
+
response.on("end", () => {
|
|
354
|
+
if (timeout) {
|
|
355
|
+
clearTimeout(timeout);
|
|
356
|
+
}
|
|
357
|
+
// In case the response ends before any data is received
|
|
358
|
+
reject(new Error("No data received"));
|
|
359
|
+
});
|
|
360
|
+
}
|
|
361
|
+
else if ((response.statusCode === 301 || response.statusCode === 302) &&
|
|
362
|
+
response.headers.location) {
|
|
363
|
+
// Handle redirects
|
|
364
|
+
const redirectUrl = new url_1.URL(response.headers.location, url).toString(); // Resolve relative URLs
|
|
365
|
+
if (timeout) {
|
|
366
|
+
clearTimeout(timeout);
|
|
367
|
+
}
|
|
368
|
+
this.fetchFirstChunk(redirectUrl)
|
|
369
|
+
.then(resolve)
|
|
370
|
+
.catch(reject);
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
if (timeout) {
|
|
374
|
+
clearTimeout(timeout);
|
|
375
|
+
}
|
|
376
|
+
reject(new Error(`Failed to retrieve data from ${url}. Status code: ${response.statusCode}`));
|
|
377
|
+
}
|
|
378
|
+
});
|
|
379
|
+
request.on("error", (error) => {
|
|
380
|
+
if (timeout) {
|
|
381
|
+
clearTimeout(timeout);
|
|
382
|
+
}
|
|
383
|
+
console.error(`GET ${url}:`, error.message);
|
|
236
384
|
reject(error);
|
|
237
385
|
});
|
|
238
386
|
request.end();
|
|
@@ -240,4 +388,4 @@ class ContentServer {
|
|
|
240
388
|
}
|
|
241
389
|
}
|
|
242
390
|
exports.ContentServer = ContentServer;
|
|
243
|
-
ContentServer.port =
|
|
391
|
+
ContentServer.port = 4161;
|
|
@@ -4,17 +4,23 @@ export declare class DigNetwork {
|
|
|
4
4
|
private serverCoin;
|
|
5
5
|
private storeDir;
|
|
6
6
|
private peerBlacklist;
|
|
7
|
+
private static networkSyncMap;
|
|
7
8
|
constructor(storeId: string);
|
|
8
|
-
private uploadPreflight;
|
|
9
|
-
uploadStoreHead(digPeer: DigPeer): Promise<void>;
|
|
10
|
-
uploadStore(digPeer: DigPeer): Promise<void>;
|
|
11
9
|
static subscribeToStore(storeId: string): Promise<void>;
|
|
10
|
+
static getUdiContent(udi: string): Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Find a peer that has the store key and root hash.
|
|
13
|
+
*
|
|
14
|
+
* @param {string} storeId - The ID of the store.
|
|
15
|
+
* @param {string} rootHash - The root hash of the store.
|
|
16
|
+
* @param {string} [key] - Optional key to check for in the store.
|
|
17
|
+
* @param {string[]} [initialBlackList] - Initial list of blacklisted peer IPs.
|
|
18
|
+
* @returns {Promise<DigPeer | null>} - A valid peer or null if none found.
|
|
19
|
+
*/
|
|
20
|
+
static findPeerWithStoreKey(storeId: string, rootHash: string, key?: string, initialBlackList?: string[]): Promise<DigPeer | null>;
|
|
12
21
|
static unsubscribeFromStore(storeId: string): void;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
private downloadManifestFile;
|
|
17
|
-
private downloadFileFromPeers;
|
|
18
|
-
private runProgressBar;
|
|
22
|
+
static pingNetworkOfUpdate(storeId: string, rootHash: string): Promise<void>;
|
|
23
|
+
syncStoreFromPeers(prioritizedPeer?: DigPeer, maxRootsToProcess?: number): Promise<void>;
|
|
24
|
+
fetchAvailablePeers(): Promise<DigPeer[]>;
|
|
19
25
|
}
|
|
20
26
|
//# sourceMappingURL=DigNetwork.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"DigNetwork.d.ts","sourceRoot":"","sources":["../../src/DigNetwork/DigNetwork.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,qBAAa,UAAU;IACrB,OAAO,CAAC,SAAS,CAAY;IAC7B,OAAO,CAAC,UAAU,CAAa;IAC/B,OAAO,CAAC,QAAQ,CAAS;IACzB,OAAO,CAAC,aAAa,CAA2B;IAChD,OAAO,CAAC,MAAM,CAAC,cAAc,CAAmC;gBAEpD,OAAO,EAAE,MAAM;WAOP,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;WAQhD,aAAa,CAAC,GAAG,EAAE,MAAM;IAI7C;;;;;;;;OAQG;WACiB,oBAAoB,CACtC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,GAAG,CAAC,EAAE,MAAM,EACZ,gBAAgB,GAAE,MAAM,EAAO,GAC9B,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC;WA6EZ,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI;WAOrC,mBAAmB,CACrC,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC;IAcH,kBAAkB,CAC7B,eAAe,CAAC,EAAE,OAAO,EACzB,iBAAiB,CAAC,EAAE,MAAM,GACzB,OAAO,CAAC,IAAI,CAAC;IAgHH,mBAAmB,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;CAUvD"}
|