@ethersphere/bee-js 5.1.1 → 5.1.2
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 +14 -6
- package/dist/223.index.browser.min.js +3 -0
- package/dist/223.index.browser.min.js.LICENSE.txt +1 -0
- package/dist/223.index.browser.min.js.map +1 -0
- package/dist/cjs/bee-debug.js +208 -312
- package/dist/cjs/bee.js +258 -353
- package/dist/cjs/chunk/signer.js +11 -22
- package/dist/cjs/chunk/soc.js +33 -50
- package/dist/cjs/chunk/span.js +1 -1
- package/dist/cjs/feed/index.js +50 -65
- package/dist/cjs/feed/json.js +8 -21
- package/dist/cjs/feed/retrievable.js +14 -27
- package/dist/cjs/modules/bytes.js +25 -37
- package/dist/cjs/modules/bzz.js +63 -68
- package/dist/cjs/modules/chunk.js +17 -27
- package/dist/cjs/modules/debug/balance.js +24 -41
- package/dist/cjs/modules/debug/chequebook.js +71 -96
- package/dist/cjs/modules/debug/chunk.js +13 -26
- package/dist/cjs/modules/debug/connectivity.js +32 -53
- package/dist/cjs/modules/debug/settlements.js +12 -25
- package/dist/cjs/modules/debug/stake.js +20 -33
- package/dist/cjs/modules/debug/stamps.js +45 -66
- package/dist/cjs/modules/debug/states.js +27 -40
- package/dist/cjs/modules/debug/status.js +53 -80
- package/dist/cjs/modules/debug/tag.js +6 -17
- package/dist/cjs/modules/debug/transactions.js +23 -40
- package/dist/cjs/modules/feed.js +17 -27
- package/dist/cjs/modules/pinning.js +24 -41
- package/dist/cjs/modules/pss.js +9 -20
- package/dist/cjs/modules/soc.js +12 -20
- package/dist/cjs/modules/status.js +4 -15
- package/dist/cjs/modules/stewardship.js +10 -23
- package/dist/cjs/modules/tag.js +28 -47
- package/dist/cjs/utils/collection.browser.js +4 -17
- package/dist/cjs/utils/collection.js +11 -22
- package/dist/cjs/utils/collection.node.js +42 -86
- package/dist/cjs/utils/data.browser.js +46 -59
- package/dist/cjs/utils/data.js +22 -35
- package/dist/cjs/utils/eth.js +31 -43
- package/dist/cjs/utils/file.js +9 -20
- package/dist/cjs/utils/headers.js +4 -4
- package/dist/cjs/utils/http.js +78 -93
- package/dist/cjs/utils/merge.js +1 -1
- package/dist/cjs/utils/sleep.js +2 -13
- package/dist/cjs/utils/type.js +14 -12
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.LICENSE.txt +1 -3
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee-debug.js +209 -450
- package/dist/mjs/bee.js +256 -491
- package/dist/mjs/chunk/bmt.js +4 -10
- package/dist/mjs/chunk/cac.js +0 -3
- package/dist/mjs/chunk/signer.js +12 -63
- package/dist/mjs/chunk/soc.js +33 -85
- package/dist/mjs/chunk/span.js +3 -6
- package/dist/mjs/feed/identifier.js +0 -6
- package/dist/mjs/feed/index.js +53 -97
- package/dist/mjs/feed/json.js +10 -49
- package/dist/mjs/feed/retrievable.js +13 -64
- package/dist/mjs/feed/topic.js +0 -2
- package/dist/mjs/index.js +1 -2
- package/dist/mjs/modules/bytes.js +25 -65
- package/dist/mjs/modules/bzz.js +64 -108
- package/dist/mjs/modules/chunk.js +17 -54
- package/dist/mjs/modules/debug/balance.js +24 -68
- package/dist/mjs/modules/debug/chequebook.js +75 -138
- package/dist/mjs/modules/debug/chunk.js +13 -51
- package/dist/mjs/modules/debug/connectivity.js +32 -76
- package/dist/mjs/modules/debug/settlements.js +12 -50
- package/dist/mjs/modules/debug/stake.js +20 -61
- package/dist/mjs/modules/debug/stamps.js +47 -94
- package/dist/mjs/modules/debug/states.js +25 -66
- package/dist/mjs/modules/debug/status.js +66 -125
- package/dist/mjs/modules/debug/tag.js +6 -41
- package/dist/mjs/modules/debug/transactions.js +25 -69
- package/dist/mjs/modules/feed.js +17 -57
- package/dist/mjs/modules/pinning.js +24 -68
- package/dist/mjs/modules/pss.js +11 -47
- package/dist/mjs/modules/soc.js +14 -48
- package/dist/mjs/modules/status.js +4 -39
- package/dist/mjs/modules/stewardship.js +10 -47
- package/dist/mjs/modules/tag.js +31 -78
- package/dist/mjs/types/debug.js +0 -1
- package/dist/mjs/types/index.js +0 -4
- package/dist/mjs/utils/bytes.js +6 -14
- package/dist/mjs/utils/collection.browser.js +4 -42
- package/dist/mjs/utils/collection.js +11 -57
- package/dist/mjs/utils/collection.node.js +42 -150
- package/dist/mjs/utils/data.browser.js +49 -94
- package/dist/mjs/utils/data.js +19 -62
- package/dist/mjs/utils/error.js +0 -5
- package/dist/mjs/utils/eth.js +37 -95
- package/dist/mjs/utils/file.js +11 -50
- package/dist/mjs/utils/hash.js +0 -1
- package/dist/mjs/utils/headers.js +6 -14
- package/dist/mjs/utils/hex.js +6 -25
- package/dist/mjs/utils/http.js +80 -138
- package/dist/mjs/utils/merge.js +3 -7
- package/dist/mjs/utils/pss.js +0 -2
- package/dist/mjs/utils/reference.js +2 -5
- package/dist/mjs/utils/sleep.js +2 -37
- package/dist/mjs/utils/stream.js +0 -23
- package/dist/mjs/utils/tar.js +2 -5
- package/dist/mjs/utils/type.js +18 -82
- package/dist/mjs/utils/uint64.js +0 -1
- package/dist/mjs/utils/url.js +2 -10
- package/dist/types/bee-debug.d.ts +2 -2
- package/dist/types/bee.d.ts +2 -26
- package/dist/types/chunk/cac.d.ts +1 -1
- package/dist/types/chunk/soc.d.ts +8 -7
- package/dist/types/feed/index.d.ts +9 -8
- package/dist/types/feed/type.d.ts +1 -1
- package/dist/types/modules/bytes.d.ts +6 -5
- package/dist/types/modules/bzz.d.ts +9 -8
- package/dist/types/modules/chunk.d.ts +5 -4
- package/dist/types/modules/debug/balance.d.ts +10 -9
- package/dist/types/modules/debug/chequebook.d.ts +18 -17
- package/dist/types/modules/debug/chunk.d.ts +6 -5
- package/dist/types/modules/debug/connectivity.d.ts +8 -7
- package/dist/types/modules/debug/settlements.d.ts +6 -5
- package/dist/types/modules/debug/stake.d.ts +5 -4
- package/dist/types/modules/debug/stamps.d.ts +8 -7
- package/dist/types/modules/debug/states.d.ts +8 -7
- package/dist/types/modules/debug/status.d.ts +15 -15
- package/dist/types/modules/debug/tag.d.ts +4 -3
- package/dist/types/modules/debug/transactions.d.ts +6 -5
- package/dist/types/modules/feed.d.ts +4 -3
- package/dist/types/modules/pinning.d.ts +8 -7
- package/dist/types/modules/pss.d.ts +4 -3
- package/dist/types/modules/soc.d.ts +3 -2
- package/dist/types/modules/status.d.ts +3 -3
- package/dist/types/modules/stewardship.d.ts +4 -3
- package/dist/types/modules/tag.d.ts +7 -6
- package/dist/types/types/debug.d.ts +1 -1
- package/dist/types/types/index.d.ts +30 -34
- package/dist/types/utils/eth.d.ts +3 -3
- package/dist/types/utils/hex.d.ts +2 -2
- package/dist/types/utils/http.d.ts +6 -6
- package/package.json +34 -39
- package/dist/cjs/types/ky-options.js +0 -8
- package/dist/cjs/types/ky-universal/common.js +0 -8
- package/dist/cjs/types/ky-universal/hooks.js +0 -8
- package/dist/cjs/types/ky-universal/retry.js +0 -8
- package/dist/mjs/types/ky-options.js +0 -7
- package/dist/mjs/types/ky-universal/common.js +0 -7
- package/dist/mjs/types/ky-universal/hooks.js +0 -7
- package/dist/mjs/types/ky-universal/retry.js +0 -7
- package/dist/types/types/ky-options.d.ts +0 -221
- package/dist/types/types/ky-universal/common.d.ts +0 -13
- package/dist/types/types/ky-universal/hooks.d.ts +0 -92
- package/dist/types/types/ky-universal/retry.d.ts +0 -38
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -17,7 +8,7 @@ const http_1 = require("../../utils/http");
|
|
|
17
8
|
const major_js_1 = __importDefault(require("semver/functions/major.js"));
|
|
18
9
|
// Following lines bellow are automatically updated with GitHub Action when Bee version is updated
|
|
19
10
|
// so if you are changing anything about them change the `update_bee` action accordingly!
|
|
20
|
-
exports.SUPPORTED_BEE_VERSION_EXACT = '1.
|
|
11
|
+
exports.SUPPORTED_BEE_VERSION_EXACT = '1.11.1-1992b846';
|
|
21
12
|
exports.SUPPORTED_API_VERSION = '4.0.0';
|
|
22
13
|
exports.SUPPORTED_DEBUG_API_VERSION = '4.0.0';
|
|
23
14
|
exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT.substring(0, exports.SUPPORTED_BEE_VERSION_EXACT.indexOf('-'));
|
|
@@ -27,68 +18,60 @@ const READINESS_URL = 'readiness';
|
|
|
27
18
|
/**
|
|
28
19
|
* Get health of node
|
|
29
20
|
*
|
|
30
|
-
* @param
|
|
21
|
+
* @param kyOptions Ky Options for making requests
|
|
31
22
|
*/
|
|
32
|
-
function getHealth(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
responseType: 'json',
|
|
38
|
-
});
|
|
39
|
-
return response.data;
|
|
23
|
+
async function getHealth(kyOptions) {
|
|
24
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
25
|
+
method: 'get',
|
|
26
|
+
path: HEALTH_URL,
|
|
27
|
+
responseType: 'json',
|
|
40
28
|
});
|
|
29
|
+
return response.parsedData;
|
|
41
30
|
}
|
|
42
31
|
exports.getHealth = getHealth;
|
|
43
32
|
/**
|
|
44
33
|
* Get readiness of node
|
|
45
34
|
*
|
|
46
|
-
* @param
|
|
35
|
+
* @param kyOptions Ky Options for making requests
|
|
47
36
|
*/
|
|
48
|
-
function getReadiness(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
});
|
|
37
|
+
async function getReadiness(kyOptions) {
|
|
38
|
+
try {
|
|
39
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
40
|
+
method: 'get',
|
|
41
|
+
path: READINESS_URL,
|
|
42
|
+
});
|
|
43
|
+
return response.status === 200;
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return false;
|
|
47
|
+
}
|
|
61
48
|
}
|
|
62
49
|
exports.getReadiness = getReadiness;
|
|
63
50
|
/**
|
|
64
51
|
* Get information about Bee node
|
|
65
52
|
*
|
|
66
|
-
* @param
|
|
53
|
+
* @param kyOptions Ky Options for making requests
|
|
67
54
|
*/
|
|
68
|
-
function getNodeInfo(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
responseType: 'json',
|
|
74
|
-
});
|
|
75
|
-
return response.data;
|
|
55
|
+
async function getNodeInfo(kyOptions) {
|
|
56
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
57
|
+
method: 'get',
|
|
58
|
+
path: NODE_INFO_URL,
|
|
59
|
+
responseType: 'json',
|
|
76
60
|
});
|
|
61
|
+
return response.parsedData;
|
|
77
62
|
}
|
|
78
63
|
exports.getNodeInfo = getNodeInfo;
|
|
79
64
|
/**
|
|
80
65
|
* Connects to a node and checks if it is a supported Bee version by the bee-js
|
|
81
66
|
*
|
|
82
|
-
* @param
|
|
67
|
+
* @param kyOptions Ky Options for making requests
|
|
83
68
|
*
|
|
84
69
|
* @returns true if the Bee node version is supported
|
|
85
70
|
* @deprecated Use `isSupportedExactVersion` instead
|
|
86
71
|
*/
|
|
87
72
|
// TODO: Remove on break
|
|
88
|
-
function isSupportedVersion(
|
|
89
|
-
return
|
|
90
|
-
return isSupportedExactVersion(ky);
|
|
91
|
-
});
|
|
73
|
+
async function isSupportedVersion(kyOptions) {
|
|
74
|
+
return isSupportedExactVersion(kyOptions);
|
|
92
75
|
}
|
|
93
76
|
exports.isSupportedVersion = isSupportedVersion;
|
|
94
77
|
/**
|
|
@@ -101,11 +84,9 @@ exports.isSupportedVersion = isSupportedVersion;
|
|
|
101
84
|
*
|
|
102
85
|
* @param ky
|
|
103
86
|
*/
|
|
104
|
-
function isSupportedExactVersion(
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
return version === exports.SUPPORTED_BEE_VERSION_EXACT;
|
|
108
|
-
});
|
|
87
|
+
async function isSupportedExactVersion(kyOptions) {
|
|
88
|
+
const { version } = await getHealth(kyOptions);
|
|
89
|
+
return version === exports.SUPPORTED_BEE_VERSION_EXACT;
|
|
109
90
|
}
|
|
110
91
|
exports.isSupportedExactVersion = isSupportedExactVersion;
|
|
111
92
|
/**
|
|
@@ -116,11 +97,9 @@ exports.isSupportedExactVersion = isSupportedExactVersion;
|
|
|
116
97
|
*
|
|
117
98
|
* @param ky
|
|
118
99
|
*/
|
|
119
|
-
function isSupportedMainApiVersion(
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
return (0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION);
|
|
123
|
-
});
|
|
100
|
+
async function isSupportedMainApiVersion(kyOptions) {
|
|
101
|
+
const { apiVersion } = await getHealth(kyOptions);
|
|
102
|
+
return (0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION);
|
|
124
103
|
}
|
|
125
104
|
exports.isSupportedMainApiVersion = isSupportedMainApiVersion;
|
|
126
105
|
/**
|
|
@@ -131,11 +110,9 @@ exports.isSupportedMainApiVersion = isSupportedMainApiVersion;
|
|
|
131
110
|
*
|
|
132
111
|
* @param ky
|
|
133
112
|
*/
|
|
134
|
-
function isSupportedDebugApiVersion(
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
return (0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION);
|
|
138
|
-
});
|
|
113
|
+
async function isSupportedDebugApiVersion(kyOptions) {
|
|
114
|
+
const { debugApiVersion } = await getHealth(kyOptions);
|
|
115
|
+
return (0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION);
|
|
139
116
|
}
|
|
140
117
|
exports.isSupportedDebugApiVersion = isSupportedDebugApiVersion;
|
|
141
118
|
/**
|
|
@@ -145,12 +122,10 @@ exports.isSupportedDebugApiVersion = isSupportedDebugApiVersion;
|
|
|
145
122
|
*
|
|
146
123
|
* @param ky
|
|
147
124
|
*/
|
|
148
|
-
function isSupportedApiVersion(
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
(0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION));
|
|
153
|
-
});
|
|
125
|
+
async function isSupportedApiVersion(kyOptions) {
|
|
126
|
+
const { apiVersion, debugApiVersion } = await getHealth(kyOptions);
|
|
127
|
+
return ((0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION) &&
|
|
128
|
+
(0, major_js_1.default)(debugApiVersion) === (0, major_js_1.default)(exports.SUPPORTED_DEBUG_API_VERSION));
|
|
154
129
|
}
|
|
155
130
|
exports.isSupportedApiVersion = isSupportedApiVersion;
|
|
156
131
|
/**
|
|
@@ -159,17 +134,15 @@ exports.isSupportedApiVersion = isSupportedApiVersion;
|
|
|
159
134
|
*
|
|
160
135
|
* @param ky
|
|
161
136
|
*/
|
|
162
|
-
function getVersions(
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
};
|
|
173
|
-
});
|
|
137
|
+
async function getVersions(kyOptions) {
|
|
138
|
+
const { version, apiVersion, debugApiVersion } = await getHealth(kyOptions);
|
|
139
|
+
return {
|
|
140
|
+
supportedBeeVersion: exports.SUPPORTED_BEE_VERSION_EXACT,
|
|
141
|
+
supportedBeeApiVersion: exports.SUPPORTED_API_VERSION,
|
|
142
|
+
supportedBeeDebugApiVersion: exports.SUPPORTED_DEBUG_API_VERSION,
|
|
143
|
+
beeVersion: version,
|
|
144
|
+
beeApiVersion: apiVersion,
|
|
145
|
+
beeDebugApiVersion: debugApiVersion,
|
|
146
|
+
};
|
|
174
147
|
}
|
|
175
148
|
exports.getVersions = getVersions;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.retrieveExtendedTag = void 0;
|
|
13
4
|
const http_1 = require("../../utils/http");
|
|
@@ -15,16 +6,14 @@ const endpoint = 'tags';
|
|
|
15
6
|
/**
|
|
16
7
|
* Retrieve tag with extended information from Bee node
|
|
17
8
|
*
|
|
18
|
-
* @param
|
|
9
|
+
* @param kyOptions Ky Options for making requests
|
|
19
10
|
* @param uid UID of tag to be retrieved
|
|
20
11
|
*/
|
|
21
|
-
function retrieveExtendedTag(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
responseType: 'json',
|
|
26
|
-
});
|
|
27
|
-
return response.data;
|
|
12
|
+
async function retrieveExtendedTag(kyOptions, uid) {
|
|
13
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
14
|
+
path: `${endpoint}/${uid}`,
|
|
15
|
+
responseType: 'json',
|
|
28
16
|
});
|
|
17
|
+
return response.parsedData;
|
|
29
18
|
}
|
|
30
19
|
exports.retrieveExtendedTag = retrieveExtendedTag;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.cancelTransaction = exports.rebroadcastTransaction = exports.getTransaction = exports.getAllTransactions = void 0;
|
|
13
4
|
const http_1 = require("../../utils/http");
|
|
@@ -17,14 +8,12 @@ const transactionsEndpoint = 'transactions';
|
|
|
17
8
|
*
|
|
18
9
|
* @param ky Debug Ky instance
|
|
19
10
|
*/
|
|
20
|
-
function getAllTransactions(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
responseType: 'json',
|
|
25
|
-
});
|
|
26
|
-
return response.data.pendingTransactions;
|
|
11
|
+
async function getAllTransactions(kyOptions) {
|
|
12
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
13
|
+
path: transactionsEndpoint,
|
|
14
|
+
responseType: 'json',
|
|
27
15
|
});
|
|
16
|
+
return response.parsedData.pendingTransactions;
|
|
28
17
|
}
|
|
29
18
|
exports.getAllTransactions = getAllTransactions;
|
|
30
19
|
/**
|
|
@@ -33,14 +22,12 @@ exports.getAllTransactions = getAllTransactions;
|
|
|
33
22
|
* @param ky Debug Ky instance
|
|
34
23
|
* @param transactionHash Hash of the transaction
|
|
35
24
|
*/
|
|
36
|
-
function getTransaction(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
responseType: 'json',
|
|
41
|
-
});
|
|
42
|
-
return response.data;
|
|
25
|
+
async function getTransaction(kyOptions, transactionHash) {
|
|
26
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
27
|
+
path: `${transactionsEndpoint}/${transactionHash}`,
|
|
28
|
+
responseType: 'json',
|
|
43
29
|
});
|
|
30
|
+
return response.parsedData;
|
|
44
31
|
}
|
|
45
32
|
exports.getTransaction = getTransaction;
|
|
46
33
|
/**
|
|
@@ -49,15 +36,13 @@ exports.getTransaction = getTransaction;
|
|
|
49
36
|
* @param ky Debug Ky instance
|
|
50
37
|
* @param transactionHash Hash of the transaction
|
|
51
38
|
*/
|
|
52
|
-
function rebroadcastTransaction(
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
responseType: 'json',
|
|
58
|
-
});
|
|
59
|
-
return response.data.transactionHash;
|
|
39
|
+
async function rebroadcastTransaction(kyOptions, transactionHash) {
|
|
40
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
41
|
+
method: 'post',
|
|
42
|
+
path: `${transactionsEndpoint}/${transactionHash}`,
|
|
43
|
+
responseType: 'json',
|
|
60
44
|
});
|
|
45
|
+
return response.parsedData.transactionHash;
|
|
61
46
|
}
|
|
62
47
|
exports.rebroadcastTransaction = rebroadcastTransaction;
|
|
63
48
|
/**
|
|
@@ -67,15 +52,13 @@ exports.rebroadcastTransaction = rebroadcastTransaction;
|
|
|
67
52
|
* @param transactionHash Hash of the transaction
|
|
68
53
|
* @param gasPrice Optional gas price
|
|
69
54
|
*/
|
|
70
|
-
function cancelTransaction(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
responseType: 'json',
|
|
77
|
-
});
|
|
78
|
-
return response.data.transactionHash;
|
|
55
|
+
async function cancelTransaction(kyOptions, transactionHash, gasPrice) {
|
|
56
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
57
|
+
method: 'delete',
|
|
58
|
+
headers: { 'gas-price': gasPrice },
|
|
59
|
+
path: `${transactionsEndpoint}/${transactionHash}`,
|
|
60
|
+
responseType: 'json',
|
|
79
61
|
});
|
|
62
|
+
return response.parsedData.transactionHash;
|
|
80
63
|
}
|
|
81
64
|
exports.cancelTransaction = cancelTransaction;
|
package/dist/cjs/modules/feed.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.fetchLatestFeedUpdate = exports.createFeedManifest = void 0;
|
|
13
4
|
const http_1 = require("../utils/http");
|
|
@@ -23,17 +14,15 @@ const feedEndpoint = 'feeds';
|
|
|
23
14
|
* @param postageBatchId Postage BatchId to be used to create the Feed Manifest
|
|
24
15
|
* @param options Additional options, like type (default: 'sequence')
|
|
25
16
|
*/
|
|
26
|
-
function createFeedManifest(
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
|
|
34
|
-
});
|
|
35
|
-
return response.data.reference;
|
|
17
|
+
async function createFeedManifest(kyOptions, owner, topic, postageBatchId, options) {
|
|
18
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
19
|
+
method: 'post',
|
|
20
|
+
responseType: 'json',
|
|
21
|
+
path: `${feedEndpoint}/${owner}/${topic}`,
|
|
22
|
+
searchParams: (0, http_1.filterHeaders)(options),
|
|
23
|
+
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
|
|
36
24
|
});
|
|
25
|
+
return response.parsedData.reference;
|
|
37
26
|
}
|
|
38
27
|
exports.createFeedManifest = createFeedManifest;
|
|
39
28
|
function readFeedUpdateHeaders(headers) {
|
|
@@ -63,14 +52,15 @@ function readFeedUpdateHeaders(headers) {
|
|
|
63
52
|
* @param topic Topic in hex
|
|
64
53
|
* @param options Additional options, like index, at, type
|
|
65
54
|
*/
|
|
66
|
-
function fetchLatestFeedUpdate(
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
searchParams: (0, http_1.filterHeaders)(options),
|
|
72
|
-
});
|
|
73
|
-
return Object.assign(Object.assign({}, response.data), readFeedUpdateHeaders(response.headers));
|
|
55
|
+
async function fetchLatestFeedUpdate(kyOptions, owner, topic, options) {
|
|
56
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
57
|
+
responseType: 'json',
|
|
58
|
+
path: `${feedEndpoint}/${owner}/${topic}`,
|
|
59
|
+
searchParams: (0, http_1.filterHeaders)(options),
|
|
74
60
|
});
|
|
61
|
+
return {
|
|
62
|
+
...response.parsedData,
|
|
63
|
+
...readFeedUpdateHeaders(response.headers),
|
|
64
|
+
};
|
|
75
65
|
}
|
|
76
66
|
exports.fetchLatestFeedUpdate = fetchLatestFeedUpdate;
|
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.getAllPins = exports.getPin = exports.unpin = exports.pin = void 0;
|
|
13
4
|
const http_1 = require("../utils/http");
|
|
@@ -15,32 +6,28 @@ const PINNING_ENDPOINT = 'pins';
|
|
|
15
6
|
/**
|
|
16
7
|
* Pin data with given reference
|
|
17
8
|
*
|
|
18
|
-
* @param
|
|
9
|
+
* @param kyOptions Ky Options for making requests
|
|
19
10
|
* @param reference Bee data reference
|
|
20
11
|
*/
|
|
21
|
-
function pin(
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
27
|
-
});
|
|
12
|
+
async function pin(kyOptions, reference) {
|
|
13
|
+
await (0, http_1.http)(kyOptions, {
|
|
14
|
+
method: 'post',
|
|
15
|
+
responseType: 'json',
|
|
16
|
+
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
28
17
|
});
|
|
29
18
|
}
|
|
30
19
|
exports.pin = pin;
|
|
31
20
|
/**
|
|
32
21
|
* Unpin data with given reference
|
|
33
22
|
*
|
|
34
|
-
* @param
|
|
23
|
+
* @param kyOptions Ky Options for making requests
|
|
35
24
|
* @param reference Bee data reference
|
|
36
25
|
*/
|
|
37
|
-
function unpin(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
43
|
-
});
|
|
26
|
+
async function unpin(kyOptions, reference) {
|
|
27
|
+
await (0, http_1.http)(kyOptions, {
|
|
28
|
+
method: 'delete',
|
|
29
|
+
responseType: 'json',
|
|
30
|
+
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
44
31
|
});
|
|
45
32
|
}
|
|
46
33
|
exports.unpin = unpin;
|
|
@@ -51,15 +38,13 @@ exports.unpin = unpin;
|
|
|
51
38
|
* @param reference
|
|
52
39
|
* @throws Error if given address is not pinned
|
|
53
40
|
*/
|
|
54
|
-
function getPin(
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
60
|
-
});
|
|
61
|
-
return response.data;
|
|
41
|
+
async function getPin(kyOptions, reference) {
|
|
42
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
43
|
+
method: 'get',
|
|
44
|
+
responseType: 'json',
|
|
45
|
+
path: `${PINNING_ENDPOINT}/${reference}`,
|
|
62
46
|
});
|
|
47
|
+
return response.parsedData;
|
|
63
48
|
}
|
|
64
49
|
exports.getPin = getPin;
|
|
65
50
|
/**
|
|
@@ -67,14 +52,12 @@ exports.getPin = getPin;
|
|
|
67
52
|
*
|
|
68
53
|
* @param ky Ky instance
|
|
69
54
|
*/
|
|
70
|
-
function getAllPins(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
path: `${PINNING_ENDPOINT}`,
|
|
76
|
-
});
|
|
77
|
-
return response.data.references;
|
|
55
|
+
async function getAllPins(kyOptions) {
|
|
56
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
57
|
+
method: 'get',
|
|
58
|
+
responseType: 'json',
|
|
59
|
+
path: `${PINNING_ENDPOINT}`,
|
|
78
60
|
});
|
|
61
|
+
return response.parsedData.references;
|
|
79
62
|
}
|
|
80
63
|
exports.getAllPins = getAllPins;
|
package/dist/cjs/modules/pss.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
4
|
};
|
|
@@ -21,7 +12,7 @@ const endpoint = 'pss';
|
|
|
21
12
|
/**
|
|
22
13
|
* Send to recipient or target with Postal Service for Swarm
|
|
23
14
|
*
|
|
24
|
-
* @param
|
|
15
|
+
* @param kyOptions Ky Options for making requests
|
|
25
16
|
* @param topic Topic name
|
|
26
17
|
* @param target Target message address prefix
|
|
27
18
|
* @param data
|
|
@@ -29,16 +20,14 @@ const endpoint = 'pss';
|
|
|
29
20
|
* @param recipient Recipient public key
|
|
30
21
|
*
|
|
31
22
|
*/
|
|
32
|
-
function send(
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
|
|
41
|
-
});
|
|
23
|
+
async function send(kyOptions, topic, target, data, postageBatchId, recipient) {
|
|
24
|
+
await (0, http_1.http)(kyOptions, {
|
|
25
|
+
method: 'post',
|
|
26
|
+
path: `${endpoint}/send/${topic}/${target}`,
|
|
27
|
+
body: await (0, data_1.prepareData)(data),
|
|
28
|
+
responseType: 'json',
|
|
29
|
+
searchParams: { recipient },
|
|
30
|
+
headers: (0, headers_1.extractUploadHeaders)(postageBatchId),
|
|
42
31
|
});
|
|
43
32
|
}
|
|
44
33
|
exports.send = send;
|
package/dist/cjs/modules/soc.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.upload = void 0;
|
|
13
4
|
const headers_1 = require("../utils/headers");
|
|
@@ -24,17 +15,18 @@ const socEndpoint = 'soc';
|
|
|
24
15
|
* @param postageBatchId Postage BatchId that will be assigned to uploaded data
|
|
25
16
|
* @param options Additional options like tag, encryption, pinning
|
|
26
17
|
*/
|
|
27
|
-
function upload(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
18
|
+
async function upload(kyOptions, owner, identifier, signature, data, postageBatchId, options) {
|
|
19
|
+
const response = await (0, http_1.http)(kyOptions, {
|
|
20
|
+
method: 'post',
|
|
21
|
+
path: `${socEndpoint}/${owner}/${identifier}`,
|
|
22
|
+
body: data,
|
|
23
|
+
headers: {
|
|
24
|
+
'content-type': 'application/octet-stream',
|
|
25
|
+
...(0, headers_1.extractUploadHeaders)(postageBatchId, options),
|
|
26
|
+
},
|
|
27
|
+
responseType: 'json',
|
|
28
|
+
searchParams: { sig: signature },
|
|
38
29
|
});
|
|
30
|
+
return response.parsedData.reference;
|
|
39
31
|
}
|
|
40
32
|
exports.upload = upload;
|
|
@@ -1,26 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
-
});
|
|
10
|
-
};
|
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
3
|
exports.checkConnection = void 0;
|
|
13
4
|
const http_1 = require("../utils/http");
|
|
14
5
|
/**
|
|
15
6
|
* Ping the base bee URL. If connection was not successful throw error
|
|
16
7
|
*
|
|
17
|
-
* @param
|
|
8
|
+
* @param kyOptions Ky instance for given Bee class instance
|
|
18
9
|
*/
|
|
19
|
-
function checkConnection(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
path: '',
|
|
23
|
-
});
|
|
10
|
+
async function checkConnection(kyOptions) {
|
|
11
|
+
await (0, http_1.http)(kyOptions, {
|
|
12
|
+
path: '',
|
|
24
13
|
});
|
|
25
14
|
}
|
|
26
15
|
exports.checkConnection = checkConnection;
|