@dignetwork/dig-sdk 0.0.1-alpha.42 → 0.0.1-alpha.43
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.
|
@@ -21,7 +21,7 @@ class ContentServer {
|
|
|
21
21
|
// Method to get the content of a specified key from the peer, with optional challenge query
|
|
22
22
|
async getKey(key, rootHash, challengeHex) {
|
|
23
23
|
// Construct the base URL
|
|
24
|
-
let url = `
|
|
24
|
+
let url = `http://${this.ipAddress}/chia.${this.storeId}.${rootHash}/${key}`;
|
|
25
25
|
// If a challenge is provided, append it as a query parameter
|
|
26
26
|
if (challengeHex) {
|
|
27
27
|
url += `?challenge=${challengeHex}`;
|
|
@@ -42,32 +42,32 @@ class ContentServer {
|
|
|
42
42
|
}
|
|
43
43
|
// Method to get the .well-known information
|
|
44
44
|
async getWellKnown() {
|
|
45
|
-
const url = `
|
|
45
|
+
const url = `http://${this.ipAddress}/.well-known`;
|
|
46
46
|
return this.fetchJson(url);
|
|
47
47
|
}
|
|
48
48
|
// Method to get the list of known stores
|
|
49
49
|
async getKnownStores() {
|
|
50
|
-
const url = `
|
|
50
|
+
const url = `http://${this.ipAddress}/.well-known/stores`;
|
|
51
51
|
return this.fetchJson(url);
|
|
52
52
|
}
|
|
53
53
|
// Method to get the index of all stores
|
|
54
54
|
async getStoresIndex() {
|
|
55
|
-
const url = `
|
|
55
|
+
const url = `http://${this.ipAddress}/`;
|
|
56
56
|
return this.fetchJson(url);
|
|
57
57
|
}
|
|
58
58
|
// Method to get the index of keys in a store
|
|
59
59
|
async getKeysIndex() {
|
|
60
|
-
const url = `
|
|
60
|
+
const url = `http://${this.ipAddress}/${this.storeId}`;
|
|
61
61
|
return this.fetchJson(url);
|
|
62
62
|
}
|
|
63
63
|
// Method to check if a specific key exists (HEAD request)
|
|
64
64
|
async headKey(key) {
|
|
65
|
-
const url = `
|
|
65
|
+
const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
|
|
66
66
|
return this.head(url);
|
|
67
67
|
}
|
|
68
68
|
// Method to check if a specific store exists (HEAD request)
|
|
69
69
|
async headStore(options) {
|
|
70
|
-
let url = `
|
|
70
|
+
let url = `http://${this.ipAddress}/${this.storeId}`;
|
|
71
71
|
if (options?.hasRootHash) {
|
|
72
72
|
url += `?hasRootHash=${options.hasRootHash}`;
|
|
73
73
|
}
|
|
@@ -75,7 +75,7 @@ class ContentServer {
|
|
|
75
75
|
}
|
|
76
76
|
streamKey(key) {
|
|
77
77
|
return new Promise((resolve, reject) => {
|
|
78
|
-
const url = `
|
|
78
|
+
const url = `http://${this.ipAddress}/${this.storeId}/${key}`;
|
|
79
79
|
const urlObj = new url_1.URL(url);
|
|
80
80
|
const requestOptions = {
|
|
81
81
|
hostname: urlObj.hostname,
|