@ethersphere/bee-js 10.4.0 → 11.0.0
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/cjs/bee.js +17 -10
- package/dist/cjs/chunk/bmt.js +1 -2
- package/dist/cjs/chunk/cac.js +3 -3
- package/dist/cjs/chunk/soc.js +24 -15
- package/dist/cjs/feed/identifier.js +1 -2
- package/dist/cjs/feed/index.js +25 -16
- package/dist/cjs/feed/retrievable.js +1 -2
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/modules/bytes.js +4 -5
- package/dist/cjs/modules/bzz.js +4 -5
- package/dist/cjs/modules/chunk.js +2 -3
- package/dist/cjs/modules/debug/balance.js +4 -5
- package/dist/cjs/modules/debug/chequebook.js +8 -9
- package/dist/cjs/modules/debug/connectivity.js +7 -8
- package/dist/cjs/modules/debug/settlements.js +2 -3
- package/dist/cjs/modules/debug/stake.js +6 -7
- package/dist/cjs/modules/debug/stamps.js +7 -8
- package/dist/cjs/modules/debug/states.js +6 -6
- package/dist/cjs/modules/debug/status.js +9 -9
- package/dist/cjs/modules/debug/transactions.js +4 -5
- package/dist/cjs/modules/envelope.js +1 -2
- package/dist/cjs/modules/feed.js +3 -4
- package/dist/cjs/modules/grantee.js +3 -4
- package/dist/cjs/modules/gsoc.js +2 -3
- package/dist/cjs/modules/pinning.js +4 -5
- package/dist/cjs/modules/pss.js +2 -3
- package/dist/cjs/modules/rchash.js +1 -2
- package/dist/cjs/modules/soc.js +1 -2
- package/dist/cjs/modules/status.js +2 -3
- package/dist/cjs/modules/stewardship.js +2 -3
- package/dist/cjs/modules/tag.js +5 -6
- package/dist/cjs/types/debug.js +3 -3
- package/dist/cjs/types/index.js +2 -2
- package/dist/cjs/utils/bytes.js +2 -2
- package/dist/cjs/utils/chunk-size.js +1 -2
- package/dist/cjs/utils/chunk-stream.browser.js +3 -4
- package/dist/cjs/utils/chunk-stream.js +3 -4
- package/dist/cjs/utils/cid.js +3 -3
- package/dist/cjs/utils/collection.browser.js +2 -3
- package/dist/cjs/utils/collection.js +5 -6
- package/dist/cjs/utils/collection.node.js +2 -3
- package/dist/cjs/utils/data.browser.js +1 -2
- package/dist/cjs/utils/data.js +1 -2
- package/dist/cjs/utils/expose.js +2 -1
- package/dist/cjs/utils/file.js +2 -3
- package/dist/cjs/utils/headers.js +2 -3
- package/dist/cjs/utils/http.js +2 -2
- package/dist/cjs/utils/pss.js +1 -2
- package/dist/cjs/utils/redundancy.js +3 -4
- package/dist/cjs/utils/stamps.js +12 -13
- package/dist/cjs/utils/tar-uploader.browser.js +1 -2
- package/dist/cjs/utils/tar-uploader.js +1 -2
- package/dist/cjs/utils/tar-writer.browser.js +1 -2
- package/dist/cjs/utils/tar-writer.js +1 -2
- package/dist/cjs/utils/type.js +34 -25
- package/dist/cjs/utils/url.js +3 -4
- package/dist/cjs/utils/workaround.js +2 -3
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +0 -3
- package/dist/mjs/modules/debug/states.js +3 -0
- package/dist/mjs/modules/debug/status.js +1 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/types/bee.d.ts +0 -4
- package/dist/types/index.d.ts +1 -0
- package/dist/types/modules/bzz.d.ts +0 -1
- package/dist/types/modules/debug/status.d.ts +1 -1
- package/dist/types/modules/gsoc.d.ts +0 -1
- package/dist/types/modules/pss.d.ts +0 -1
- package/dist/types/types/debug.d.ts +1 -0
- package/dist/types/utils/constants.d.ts +3 -3
- package/dist/types/utils/error.d.ts +2 -2
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/tar.browser.d.ts +1 -1
- package/dist/types/utils/tar.d.ts +0 -1
- package/dist/types/utils/type.d.ts +0 -1
- package/package.json +9 -12
package/dist/cjs/bee.js
CHANGED
|
@@ -15,13 +15,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
36
|
exports.Bee = void 0;
|
|
27
37
|
const cafe_utility_1 = require("cafe-utility");
|
|
@@ -981,9 +991,6 @@ class Bee {
|
|
|
981
991
|
*
|
|
982
992
|
* @param rawPayload Data to be stored in the chunk. If the data is a string, it will be converted to UTF-8 bytes.
|
|
983
993
|
* @param span Optional span for the chunk. If not provided, it will be set to the length of the payload.
|
|
984
|
-
*
|
|
985
|
-
* @example
|
|
986
|
-
*
|
|
987
994
|
*/
|
|
988
995
|
makeContentAddressedChunk(rawPayload, span) {
|
|
989
996
|
return (0, cac_1.makeContentAddressedChunk)(rawPayload, span);
|
package/dist/cjs/chunk/bmt.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.calculateChunkAddress =
|
|
3
|
+
exports.calculateChunkAddress = calculateChunkAddress;
|
|
4
4
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
5
|
const error_1 = require("../utils/error");
|
|
6
6
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
@@ -27,7 +27,6 @@ function calculateChunkAddress(chunkContent) {
|
|
|
27
27
|
const chunkHash = cafe_utility_1.Binary.keccak256(cafe_utility_1.Binary.concatBytes(span, rootHash));
|
|
28
28
|
return new typed_bytes_1.Reference(chunkHash);
|
|
29
29
|
}
|
|
30
|
-
exports.calculateChunkAddress = calculateChunkAddress;
|
|
31
30
|
function calculateBmtRootHash(payload) {
|
|
32
31
|
if (payload.length > MAX_CHUNK_PAYLOAD_SIZE) {
|
|
33
32
|
throw new error_1.BeeArgumentError(`payload size ${payload.length} exceeds maximum chunk payload size ${MAX_CHUNK_PAYLOAD_SIZE}`, payload);
|
package/dist/cjs/chunk/cac.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.MAX_PAYLOAD_SIZE = exports.MIN_PAYLOAD_SIZE = void 0;
|
|
4
|
+
exports.unmarshalContentAddressedChunk = unmarshalContentAddressedChunk;
|
|
5
|
+
exports.makeContentAddressedChunk = makeContentAddressedChunk;
|
|
4
6
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
7
|
const bytes_1 = require("../utils/bytes");
|
|
6
8
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
@@ -12,7 +14,6 @@ function unmarshalContentAddressedChunk(data) {
|
|
|
12
14
|
data = new bytes_1.Bytes(data);
|
|
13
15
|
return makeContentAddressedChunk(data.toUint8Array().slice(typed_bytes_1.Span.LENGTH), typed_bytes_1.Span.fromSlice(data.toUint8Array(), 0));
|
|
14
16
|
}
|
|
15
|
-
exports.unmarshalContentAddressedChunk = unmarshalContentAddressedChunk;
|
|
16
17
|
function makeContentAddressedChunk(rawPayload, span) {
|
|
17
18
|
if (cafe_utility_1.Types.isString(rawPayload)) {
|
|
18
19
|
rawPayload = bytes_1.Bytes.fromUtf8(rawPayload);
|
|
@@ -38,4 +39,3 @@ function makeContentAddressedChunk(rawPayload, span) {
|
|
|
38
39
|
},
|
|
39
40
|
};
|
|
40
41
|
}
|
|
41
|
-
exports.makeContentAddressedChunk = makeContentAddressedChunk;
|
package/dist/cjs/chunk/soc.js
CHANGED
|
@@ -15,15 +15,31 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.unmarshalSingleOwnerChunk = unmarshalSingleOwnerChunk;
|
|
37
|
+
exports.makeSOCAddress = makeSOCAddress;
|
|
38
|
+
exports.makeSingleOwnerChunk = makeSingleOwnerChunk;
|
|
39
|
+
exports.uploadSingleOwnerChunk = uploadSingleOwnerChunk;
|
|
40
|
+
exports.uploadSingleOwnerChunkData = uploadSingleOwnerChunkData;
|
|
41
|
+
exports.uploadSingleOwnerChunkWithWrappedChunk = uploadSingleOwnerChunkWithWrappedChunk;
|
|
42
|
+
exports.downloadSingleOwnerChunk = downloadSingleOwnerChunk;
|
|
27
43
|
const cafe_utility_1 = require("cafe-utility");
|
|
28
44
|
const chunkAPI = __importStar(require("../modules/chunk"));
|
|
29
45
|
const socAPI = __importStar(require("../modules/soc"));
|
|
@@ -75,11 +91,9 @@ function unmarshalSingleOwnerChunk(data, address) {
|
|
|
75
91
|
owner: ownerAddress,
|
|
76
92
|
};
|
|
77
93
|
}
|
|
78
|
-
exports.unmarshalSingleOwnerChunk = unmarshalSingleOwnerChunk;
|
|
79
94
|
function makeSOCAddress(identifier, address) {
|
|
80
95
|
return new typed_bytes_1.Reference(cafe_utility_1.Binary.keccak256(cafe_utility_1.Binary.concatBytes(identifier.toUint8Array(), address.toUint8Array())));
|
|
81
96
|
}
|
|
82
|
-
exports.makeSOCAddress = makeSOCAddress;
|
|
83
97
|
/**
|
|
84
98
|
* Creates a single owner chunk object
|
|
85
99
|
*
|
|
@@ -103,7 +117,6 @@ function makeSingleOwnerChunk(address, span, payload, identifier, signer) {
|
|
|
103
117
|
owner: signer.publicKey().address(),
|
|
104
118
|
};
|
|
105
119
|
}
|
|
106
|
-
exports.makeSingleOwnerChunk = makeSingleOwnerChunk;
|
|
107
120
|
/**
|
|
108
121
|
* Helper function to upload a chunk.
|
|
109
122
|
*
|
|
@@ -118,7 +131,6 @@ async function uploadSingleOwnerChunk(requestOptions, chunk, stamp, options) {
|
|
|
118
131
|
const data = cafe_utility_1.Binary.concatBytes(chunk.span.toUint8Array(), chunk.payload.toUint8Array());
|
|
119
132
|
return socAPI.upload(requestOptions, chunk.owner, chunk.identifier, chunk.signature, data, stamp, options);
|
|
120
133
|
}
|
|
121
|
-
exports.uploadSingleOwnerChunk = uploadSingleOwnerChunk;
|
|
122
134
|
/**
|
|
123
135
|
* Helper function to create and upload SOC.
|
|
124
136
|
*
|
|
@@ -136,14 +148,12 @@ async function uploadSingleOwnerChunkData(requestOptions, signer, stamp, identif
|
|
|
136
148
|
const soc = cac.toSingleOwnerChunk(identifier, signer);
|
|
137
149
|
return uploadSingleOwnerChunk(requestOptions, soc, stamp, options);
|
|
138
150
|
}
|
|
139
|
-
exports.uploadSingleOwnerChunkData = uploadSingleOwnerChunkData;
|
|
140
151
|
async function uploadSingleOwnerChunkWithWrappedChunk(requestOptions, signer, stamp, identifier, wrappedChunk, options) {
|
|
141
152
|
signer = new typed_bytes_1.PrivateKey(signer);
|
|
142
153
|
identifier = new typed_bytes_1.Identifier(identifier);
|
|
143
154
|
const soc = wrappedChunk.toSingleOwnerChunk(identifier, signer);
|
|
144
155
|
return uploadSingleOwnerChunk(requestOptions, soc, stamp, options);
|
|
145
156
|
}
|
|
146
|
-
exports.uploadSingleOwnerChunkWithWrappedChunk = uploadSingleOwnerChunkWithWrappedChunk;
|
|
147
157
|
/**
|
|
148
158
|
* Helper function to download SOC.
|
|
149
159
|
*
|
|
@@ -158,4 +168,3 @@ async function downloadSingleOwnerChunk(requestOptions, ownerAddress, identifier
|
|
|
158
168
|
const cac = await chunkAPI.download(requestOptions, address.toHex());
|
|
159
169
|
return unmarshalSingleOwnerChunk(cac, address);
|
|
160
170
|
}
|
|
161
|
-
exports.downloadSingleOwnerChunk = downloadSingleOwnerChunk;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.makeFeedIdentifier =
|
|
3
|
+
exports.makeFeedIdentifier = makeFeedIdentifier;
|
|
4
4
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
5
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
6
6
|
function makeFeedIdentifier(topic, index) {
|
|
7
7
|
index = typeof index === 'number' ? typed_bytes_1.FeedIndex.fromBigInt(BigInt(index)) : index;
|
|
8
8
|
return new typed_bytes_1.Identifier(cafe_utility_1.Binary.keccak256(cafe_utility_1.Binary.concatBytes(topic.toUint8Array(), index.toUint8Array())));
|
|
9
9
|
}
|
|
10
|
-
exports.makeFeedIdentifier = makeFeedIdentifier;
|
package/dist/cjs/feed/index.js
CHANGED
|
@@ -15,15 +15,32 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
15
15
|
}) : function(o, v) {
|
|
16
16
|
o["default"] = v;
|
|
17
17
|
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
};
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
25
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
36
|
+
exports.findNextIndex = findNextIndex;
|
|
37
|
+
exports.updateFeedWithReference = updateFeedWithReference;
|
|
38
|
+
exports.updateFeedWithPayload = updateFeedWithPayload;
|
|
39
|
+
exports.getFeedUpdateChunkReference = getFeedUpdateChunkReference;
|
|
40
|
+
exports.downloadFeedUpdate = downloadFeedUpdate;
|
|
41
|
+
exports.downloadFeedUpdateAsCAC = downloadFeedUpdateAsCAC;
|
|
42
|
+
exports.makeFeedReader = makeFeedReader;
|
|
43
|
+
exports.makeFeedWriter = makeFeedWriter;
|
|
27
44
|
const cafe_utility_1 = require("cafe-utility");
|
|
28
45
|
const cac_1 = require("../chunk/cac");
|
|
29
46
|
const soc_1 = require("../chunk/soc");
|
|
@@ -53,7 +70,6 @@ async function findNextIndex(requestOptions, owner, topic) {
|
|
|
53
70
|
throw e;
|
|
54
71
|
}
|
|
55
72
|
}
|
|
56
|
-
exports.findNextIndex = findNextIndex;
|
|
57
73
|
async function updateFeedWithReference(requestOptions, signer, topic, reference, postageBatchId, options) {
|
|
58
74
|
reference = new typed_bytes_1.Reference(reference);
|
|
59
75
|
const nextIndex = options?.index ?? (await findNextIndex(requestOptions, signer.publicKey().address(), topic));
|
|
@@ -63,7 +79,6 @@ async function updateFeedWithReference(requestOptions, signer, topic, reference,
|
|
|
63
79
|
const payloadBytes = cafe_utility_1.Binary.concatBytes(timestamp, reference.toUint8Array());
|
|
64
80
|
return (0, soc_1.uploadSingleOwnerChunkData)(requestOptions, signer, postageBatchId, identifier, payloadBytes, options);
|
|
65
81
|
}
|
|
66
|
-
exports.updateFeedWithReference = updateFeedWithReference;
|
|
67
82
|
async function updateFeedWithPayload(requestOptions, signer, topic, data, postageBatchId, options) {
|
|
68
83
|
const nextIndex = options?.index ?? (await findNextIndex(requestOptions, signer.publicKey().address(), topic));
|
|
69
84
|
const identifier = (0, identifier_1.makeFeedIdentifier)(topic, nextIndex);
|
|
@@ -74,12 +89,10 @@ async function updateFeedWithPayload(requestOptions, signer, topic, data, postag
|
|
|
74
89
|
}
|
|
75
90
|
return (0, soc_1.uploadSingleOwnerChunkData)(requestOptions, signer, postageBatchId, identifier, cafe_utility_1.Types.isString(data) ? bytes_1.Bytes.fromUtf8(data).toUint8Array() : data, options);
|
|
76
91
|
}
|
|
77
|
-
exports.updateFeedWithPayload = updateFeedWithPayload;
|
|
78
92
|
function getFeedUpdateChunkReference(owner, topic, index) {
|
|
79
93
|
const identifier = (0, identifier_1.makeFeedIdentifier)(topic, index);
|
|
80
94
|
return new typed_bytes_1.Reference(cafe_utility_1.Binary.keccak256(cafe_utility_1.Binary.concatBytes(identifier.toUint8Array(), owner.toUint8Array())));
|
|
81
95
|
}
|
|
82
|
-
exports.getFeedUpdateChunkReference = getFeedUpdateChunkReference;
|
|
83
96
|
async function downloadFeedUpdate(requestOptions, owner, topic, index, hasTimestamp = false) {
|
|
84
97
|
index = typeof index === 'number' ? typed_bytes_1.FeedIndex.fromBigInt(BigInt(index)) : index;
|
|
85
98
|
const address = getFeedUpdateChunkReference(owner, topic, index);
|
|
@@ -95,7 +108,6 @@ async function downloadFeedUpdate(requestOptions, owner, topic, index, hasTimest
|
|
|
95
108
|
payload: new bytes_1.Bytes(soc.payload.offset(hasTimestamp ? REFERENCE_PAYLOAD_OFFSET : 0)),
|
|
96
109
|
};
|
|
97
110
|
}
|
|
98
|
-
exports.downloadFeedUpdate = downloadFeedUpdate;
|
|
99
111
|
async function downloadFeedUpdateAsCAC(requestOptions, owner, topic, index) {
|
|
100
112
|
index = typeof index === 'number' ? typed_bytes_1.FeedIndex.fromBigInt(BigInt(index)) : index;
|
|
101
113
|
const address = getFeedUpdateChunkReference(owner, topic, index);
|
|
@@ -103,7 +115,6 @@ async function downloadFeedUpdateAsCAC(requestOptions, owner, topic, index) {
|
|
|
103
115
|
const soc = (0, soc_1.unmarshalSingleOwnerChunk)(data, address);
|
|
104
116
|
return (0, cac_1.makeContentAddressedChunk)(soc.payload, soc.span);
|
|
105
117
|
}
|
|
106
|
-
exports.downloadFeedUpdateAsCAC = downloadFeedUpdateAsCAC;
|
|
107
118
|
function makeFeedReader(requestOptions, topic, owner) {
|
|
108
119
|
// TODO: remove after enough time has passed in deprecated version
|
|
109
120
|
const download = async (options) => {
|
|
@@ -153,7 +164,6 @@ function makeFeedReader(requestOptions, topic, owner) {
|
|
|
153
164
|
topic,
|
|
154
165
|
};
|
|
155
166
|
}
|
|
156
|
-
exports.makeFeedReader = makeFeedReader;
|
|
157
167
|
function makeFeedWriter(requestOptions, topic, signer) {
|
|
158
168
|
const upload = async (postageBatchId, reference, options) => {
|
|
159
169
|
return updateFeedWithReference(requestOptions, signer, topic, reference, postageBatchId, options);
|
|
@@ -168,4 +178,3 @@ function makeFeedWriter(requestOptions, topic, signer) {
|
|
|
168
178
|
uploadPayload,
|
|
169
179
|
};
|
|
170
180
|
}
|
|
171
|
-
exports.makeFeedWriter = makeFeedWriter;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.areAllSequentialFeedsUpdateRetrievable =
|
|
3
|
+
exports.areAllSequentialFeedsUpdateRetrievable = areAllSequentialFeedsUpdateRetrievable;
|
|
4
4
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
5
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
6
6
|
const index_1 = require("./index");
|
|
@@ -44,4 +44,3 @@ async function areAllSequentialFeedsUpdateRetrievable(bee, owner, topic, index,
|
|
|
44
44
|
const chunkRetrievablePromises = getAllSequenceUpdateReferences(owner, topic, index).map(async (reference) => isChunkRetrievable(bee, reference, options, requestOptions));
|
|
45
45
|
return (await Promise.all(chunkRetrievablePromises)).every(result => result);
|
|
46
46
|
}
|
|
47
|
-
exports.areAllSequentialFeedsUpdateRetrievable = areAllSequentialFeedsUpdateRetrievable;
|
package/dist/cjs/index.js
CHANGED
|
@@ -18,13 +18,23 @@ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (
|
|
|
18
18
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
|
-
var __importStar = (this && this.__importStar) || function (
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
};
|
|
21
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
22
|
+
var ownKeys = function(o) {
|
|
23
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
24
|
+
var ar = [];
|
|
25
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
26
|
+
return ar;
|
|
27
|
+
};
|
|
28
|
+
return ownKeys(o);
|
|
29
|
+
};
|
|
30
|
+
return function (mod) {
|
|
31
|
+
if (mod && mod.__esModule) return mod;
|
|
32
|
+
var result = {};
|
|
33
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
34
|
+
__setModuleDefault(result, mod);
|
|
35
|
+
return result;
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
28
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
39
|
exports.Stamper = exports.BeeDev = exports.Bee = exports.Size = exports.Utils = exports.Duration = exports.Bytes = exports.SUPPORTED_BEE_VERSION_EXACT = exports.SUPPORTED_BEE_VERSION = exports.MantarayNode = exports.MerkleTree = void 0;
|
|
30
40
|
const bee_1 = require("./bee");
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.upload = upload;
|
|
4
|
+
exports.head = head;
|
|
5
|
+
exports.download = download;
|
|
6
|
+
exports.downloadReadable = downloadReadable;
|
|
4
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
8
|
const bytes_1 = require("../utils/bytes");
|
|
6
9
|
const headers_1 = require("../utils/headers");
|
|
@@ -36,7 +39,6 @@ async function upload(requestOptions, data, postageBatchId, options) {
|
|
|
36
39
|
: cafe_utility_1.Optional.empty(),
|
|
37
40
|
};
|
|
38
41
|
}
|
|
39
|
-
exports.upload = upload;
|
|
40
42
|
/**
|
|
41
43
|
* Requests content length for a reference
|
|
42
44
|
*
|
|
@@ -54,7 +56,6 @@ async function head(requestOptions, reference) {
|
|
|
54
56
|
contentLength: parseInt(response.headers['content-length']),
|
|
55
57
|
};
|
|
56
58
|
}
|
|
57
|
-
exports.head = head;
|
|
58
59
|
/**
|
|
59
60
|
* Download data as a byte array
|
|
60
61
|
*
|
|
@@ -72,7 +73,6 @@ async function download(requestOptions, resource, options) {
|
|
|
72
73
|
});
|
|
73
74
|
return new bytes_1.Bytes(response.data);
|
|
74
75
|
}
|
|
75
|
-
exports.download = download;
|
|
76
76
|
/**
|
|
77
77
|
* Download data as a readable stream
|
|
78
78
|
*
|
|
@@ -90,4 +90,3 @@ async function downloadReadable(requestOptions, resource, options) {
|
|
|
90
90
|
});
|
|
91
91
|
return response.data;
|
|
92
92
|
}
|
|
93
|
-
exports.downloadReadable = downloadReadable;
|
package/dist/cjs/modules/bzz.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.uploadFile = uploadFile;
|
|
4
|
+
exports.downloadFile = downloadFile;
|
|
5
|
+
exports.downloadFileReadable = downloadFileReadable;
|
|
6
|
+
exports.uploadCollection = uploadCollection;
|
|
4
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
8
|
const bytes_1 = require("../utils/bytes");
|
|
6
9
|
const collection_1 = require("../utils/collection");
|
|
@@ -43,7 +46,6 @@ async function uploadFile(requestOptions, data, postageBatchId, name, options) {
|
|
|
43
46
|
: cafe_utility_1.Optional.empty(),
|
|
44
47
|
};
|
|
45
48
|
}
|
|
46
|
-
exports.uploadFile = uploadFile;
|
|
47
49
|
/**
|
|
48
50
|
* Download single file as a buffer
|
|
49
51
|
*
|
|
@@ -64,7 +66,6 @@ async function downloadFile(requestOptions, resource, path = '', options) {
|
|
|
64
66
|
};
|
|
65
67
|
return file;
|
|
66
68
|
}
|
|
67
|
-
exports.downloadFile = downloadFile;
|
|
68
69
|
/**
|
|
69
70
|
* Download single file as a readable stream
|
|
70
71
|
*
|
|
@@ -86,7 +87,6 @@ async function downloadFileReadable(requestOptions, reference, path = '', option
|
|
|
86
87
|
};
|
|
87
88
|
return file;
|
|
88
89
|
}
|
|
89
|
-
exports.downloadFileReadable = downloadFileReadable;
|
|
90
90
|
/*******************************************************************************************************************/
|
|
91
91
|
// Collections
|
|
92
92
|
/**
|
|
@@ -108,4 +108,3 @@ async function uploadCollection(requestOptions, collection, postageBatchId, opti
|
|
|
108
108
|
: cafe_utility_1.Optional.empty(),
|
|
109
109
|
};
|
|
110
110
|
}
|
|
111
|
-
exports.uploadCollection = uploadCollection;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.upload = upload;
|
|
4
|
+
exports.download = download;
|
|
4
5
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
6
|
const headers_1 = require("../utils/headers");
|
|
6
7
|
const http_1 = require("../utils/http");
|
|
@@ -39,7 +40,6 @@ async function upload(requestOptions, data, stamp, options) {
|
|
|
39
40
|
: cafe_utility_1.Optional.empty(),
|
|
40
41
|
};
|
|
41
42
|
}
|
|
42
|
-
exports.upload = upload;
|
|
43
43
|
/**
|
|
44
44
|
* Download chunk data as a byte array
|
|
45
45
|
*
|
|
@@ -56,4 +56,3 @@ async function download(requestOptions, reference, options) {
|
|
|
56
56
|
});
|
|
57
57
|
return new Uint8Array(response.data);
|
|
58
58
|
}
|
|
59
|
-
exports.download = download;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAllBalances = getAllBalances;
|
|
4
|
+
exports.getPeerBalance = getPeerBalance;
|
|
5
|
+
exports.getPastDueConsumptionBalances = getPastDueConsumptionBalances;
|
|
6
|
+
exports.getPastDueConsumptionPeerBalance = getPastDueConsumptionPeerBalance;
|
|
4
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
8
|
const http_1 = require("../../utils/http");
|
|
6
9
|
const tokens_1 = require("../../utils/tokens");
|
|
@@ -26,7 +29,6 @@ async function getAllBalances(requestOptions) {
|
|
|
26
29
|
})),
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
|
-
exports.getAllBalances = getAllBalances;
|
|
30
32
|
/**
|
|
31
33
|
* Get the balances with a specific peer including prepaid services
|
|
32
34
|
*
|
|
@@ -44,7 +46,6 @@ async function getPeerBalance(requestOptions, address) {
|
|
|
44
46
|
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.balance, { name: 'balance' })),
|
|
45
47
|
};
|
|
46
48
|
}
|
|
47
|
-
exports.getPeerBalance = getPeerBalance;
|
|
48
49
|
/**
|
|
49
50
|
* Get the past due consumption balances with all known peers
|
|
50
51
|
*
|
|
@@ -64,7 +65,6 @@ async function getPastDueConsumptionBalances(requestOptions) {
|
|
|
64
65
|
})),
|
|
65
66
|
};
|
|
66
67
|
}
|
|
67
|
-
exports.getPastDueConsumptionBalances = getPastDueConsumptionBalances;
|
|
68
68
|
/**
|
|
69
69
|
* Get the past due consumption balance with a specific peer
|
|
70
70
|
*
|
|
@@ -82,4 +82,3 @@ async function getPastDueConsumptionPeerBalance(requestOptions, address) {
|
|
|
82
82
|
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.balance, { name: 'balance' })),
|
|
83
83
|
};
|
|
84
84
|
}
|
|
85
|
-
exports.getPastDueConsumptionPeerBalance = getPastDueConsumptionPeerBalance;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getChequebookAddress = getChequebookAddress;
|
|
4
|
+
exports.getChequebookBalance = getChequebookBalance;
|
|
5
|
+
exports.getLastCashoutAction = getLastCashoutAction;
|
|
6
|
+
exports.cashoutLastCheque = cashoutLastCheque;
|
|
7
|
+
exports.getLastChequesForPeer = getLastChequesForPeer;
|
|
8
|
+
exports.getLastCheques = getLastCheques;
|
|
9
|
+
exports.depositTokens = depositTokens;
|
|
10
|
+
exports.withdrawTokens = withdrawTokens;
|
|
4
11
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
12
|
const headers_1 = require("../../utils/headers");
|
|
6
13
|
const http_1 = require("../../utils/http");
|
|
@@ -23,7 +30,6 @@ async function getChequebookAddress(requestOptions) {
|
|
|
23
30
|
chequebookAddress: new typed_bytes_1.EthAddress(cafe_utility_1.Types.asString(body.chequebookAddress, { name: 'chequebookAddress' })),
|
|
24
31
|
};
|
|
25
32
|
}
|
|
26
|
-
exports.getChequebookAddress = getChequebookAddress;
|
|
27
33
|
/**
|
|
28
34
|
* Get the balance of the chequebook
|
|
29
35
|
*
|
|
@@ -40,7 +46,6 @@ async function getChequebookBalance(requestOptions) {
|
|
|
40
46
|
totalBalance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.totalBalance, { name: 'totalBalance' })),
|
|
41
47
|
};
|
|
42
48
|
}
|
|
43
|
-
exports.getChequebookBalance = getChequebookBalance;
|
|
44
49
|
/**
|
|
45
50
|
* Get last cashout action for the peer
|
|
46
51
|
*
|
|
@@ -61,7 +66,6 @@ async function getLastCashoutAction(requestOptions, peer) {
|
|
|
61
66
|
result: cafe_utility_1.Types.asNullable(x => asCashoutResult(x), body.result),
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
|
-
exports.getLastCashoutAction = getLastCashoutAction;
|
|
65
69
|
/**
|
|
66
70
|
* Cashout the last cheque for the peer
|
|
67
71
|
*
|
|
@@ -79,7 +83,6 @@ async function cashoutLastCheque(requestOptions, peer, options) {
|
|
|
79
83
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
80
84
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
81
85
|
}
|
|
82
|
-
exports.cashoutLastCheque = cashoutLastCheque;
|
|
83
86
|
/**
|
|
84
87
|
* Get last cheques for the peer
|
|
85
88
|
*
|
|
@@ -98,7 +101,6 @@ async function getLastChequesForPeer(requestOptions, peer) {
|
|
|
98
101
|
lastsent: cafe_utility_1.Types.asNullable(x => asCheque(x), body.lastsent),
|
|
99
102
|
};
|
|
100
103
|
}
|
|
101
|
-
exports.getLastChequesForPeer = getLastChequesForPeer;
|
|
102
104
|
/**
|
|
103
105
|
* Get last cheques for all peers
|
|
104
106
|
*
|
|
@@ -119,7 +121,6 @@ async function getLastCheques(requestOptions) {
|
|
|
119
121
|
})),
|
|
120
122
|
};
|
|
121
123
|
}
|
|
122
|
-
exports.getLastCheques = getLastCheques;
|
|
123
124
|
function asCheque(x) {
|
|
124
125
|
const object = cafe_utility_1.Types.asObject(x, { name: 'cheque' });
|
|
125
126
|
return {
|
|
@@ -159,7 +160,6 @@ async function depositTokens(requestOptions, amount, gasPrice) {
|
|
|
159
160
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
160
161
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
161
162
|
}
|
|
162
|
-
exports.depositTokens = depositTokens;
|
|
163
163
|
/**
|
|
164
164
|
* Withdraw tokens from the chequebook to the overlay address
|
|
165
165
|
*
|
|
@@ -183,4 +183,3 @@ async function withdrawTokens(requestOptions, amount, gasPrice) {
|
|
|
183
183
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
184
184
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
185
185
|
}
|
|
186
|
-
exports.withdrawTokens = withdrawTokens;
|
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getNodeAddresses = getNodeAddresses;
|
|
4
|
+
exports.getPeers = getPeers;
|
|
5
|
+
exports.getBlocklist = getBlocklist;
|
|
6
|
+
exports.removePeer = removePeer;
|
|
7
|
+
exports.getTopology = getTopology;
|
|
8
|
+
exports.pingPeer = pingPeer;
|
|
9
|
+
exports.asBin = asBin;
|
|
4
10
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
11
|
const http_1 = require("../../utils/http");
|
|
6
12
|
const typed_bytes_1 = require("../../utils/typed-bytes");
|
|
@@ -18,7 +24,6 @@ async function getNodeAddresses(requestOptions) {
|
|
|
18
24
|
pssPublicKey: new typed_bytes_1.PublicKey(cafe_utility_1.Types.asString(body.pssPublicKey, { name: 'pssPublicKey' })),
|
|
19
25
|
};
|
|
20
26
|
}
|
|
21
|
-
exports.getNodeAddresses = getNodeAddresses;
|
|
22
27
|
async function getPeers(requestOptions) {
|
|
23
28
|
const response = await (0, http_1.http)(requestOptions, {
|
|
24
29
|
url: 'peers',
|
|
@@ -30,7 +35,6 @@ async function getPeers(requestOptions) {
|
|
|
30
35
|
fullNode: cafe_utility_1.Types.asBoolean(cafe_utility_1.Types.asObject(x, { name: 'peer' }).fullNode, { name: 'fullNode' }),
|
|
31
36
|
}));
|
|
32
37
|
}
|
|
33
|
-
exports.getPeers = getPeers;
|
|
34
38
|
async function getBlocklist(requestOptions) {
|
|
35
39
|
const response = await (0, http_1.http)(requestOptions, {
|
|
36
40
|
url: 'blocklist',
|
|
@@ -38,7 +42,6 @@ async function getBlocklist(requestOptions) {
|
|
|
38
42
|
});
|
|
39
43
|
return response.data.peers;
|
|
40
44
|
}
|
|
41
|
-
exports.getBlocklist = getBlocklist;
|
|
42
45
|
async function removePeer(requestOptions, peer) {
|
|
43
46
|
const response = await (0, http_1.http)(requestOptions, {
|
|
44
47
|
url: `peers/${peer}`,
|
|
@@ -47,7 +50,6 @@ async function removePeer(requestOptions, peer) {
|
|
|
47
50
|
});
|
|
48
51
|
return response.data;
|
|
49
52
|
}
|
|
50
|
-
exports.removePeer = removePeer;
|
|
51
53
|
async function getTopology(requestOptions) {
|
|
52
54
|
const response = await (0, http_1.http)(requestOptions, {
|
|
53
55
|
url: `topology`,
|
|
@@ -100,7 +102,6 @@ async function getTopology(requestOptions) {
|
|
|
100
102
|
},
|
|
101
103
|
};
|
|
102
104
|
}
|
|
103
|
-
exports.getTopology = getTopology;
|
|
104
105
|
async function pingPeer(requestOptions, peer) {
|
|
105
106
|
const response = await (0, http_1.http)(requestOptions, {
|
|
106
107
|
url: `pingpong/${peer}`,
|
|
@@ -109,7 +110,6 @@ async function pingPeer(requestOptions, peer) {
|
|
|
109
110
|
});
|
|
110
111
|
return response.data;
|
|
111
112
|
}
|
|
112
|
-
exports.pingPeer = pingPeer;
|
|
113
113
|
function asBin(value, name) {
|
|
114
114
|
const bin = cafe_utility_1.Types.asObject(value, { name });
|
|
115
115
|
if (!bin.disconnectedPeers) {
|
|
@@ -129,4 +129,3 @@ function asBin(value, name) {
|
|
|
129
129
|
})),
|
|
130
130
|
};
|
|
131
131
|
}
|
|
132
|
-
exports.asBin = asBin;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSettlements = getSettlements;
|
|
4
|
+
exports.getAllSettlements = getAllSettlements;
|
|
4
5
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
6
|
const http_1 = require("../../utils/http");
|
|
6
7
|
const tokens_1 = require("../../utils/tokens");
|
|
@@ -24,7 +25,6 @@ async function getSettlements(requestOptions, peer) {
|
|
|
24
25
|
received: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.received, { name: 'received' })),
|
|
25
26
|
};
|
|
26
27
|
}
|
|
27
|
-
exports.getSettlements = getSettlements;
|
|
28
28
|
/**
|
|
29
29
|
* Get settlements with all known peers and total amount sent or received
|
|
30
30
|
*
|
|
@@ -49,4 +49,3 @@ async function getAllSettlements(requestOptions) {
|
|
|
49
49
|
})),
|
|
50
50
|
};
|
|
51
51
|
}
|
|
52
|
-
exports.getAllSettlements = getAllSettlements;
|