@ethersphere/bee-js 12.2.2 → 12.3.1
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 +56 -23
- package/dist/cjs/chunk/cac.js +4 -2
- package/dist/cjs/feed/index.js +3 -1
- package/dist/cjs/modules/bytes.js +6 -4
- package/dist/cjs/modules/bzz.js +5 -4
- package/dist/cjs/modules/chunk.js +3 -2
- package/dist/cjs/modules/debug/balance.js +5 -29
- package/dist/cjs/modules/debug/chequebook.js +9 -58
- package/dist/cjs/modules/debug/connectivity.js +5 -82
- package/dist/cjs/modules/debug/settlements.js +3 -22
- package/dist/cjs/modules/debug/stake.js +8 -33
- package/dist/cjs/modules/debug/stamps.js +27 -53
- package/dist/cjs/modules/debug/states.js +6 -31
- package/dist/cjs/modules/debug/status.js +7 -39
- package/dist/cjs/modules/debug/transactions.js +5 -26
- package/dist/cjs/modules/envelope.js +6 -6
- package/dist/cjs/modules/feed.js +3 -4
- package/dist/cjs/modules/grantee.js +8 -10
- package/dist/cjs/modules/pinning.js +5 -11
- package/dist/cjs/modules/rchash.js +2 -3
- package/dist/cjs/modules/soc.js +3 -2
- package/dist/cjs/modules/status.js +3 -3
- package/dist/cjs/modules/stewardship.js +2 -3
- package/dist/cjs/modules/tag.js +4 -35
- package/dist/cjs/stamper/stamper.js +2 -1
- package/dist/cjs/types/schema/balance.js +14 -0
- package/dist/cjs/types/schema/chequebook.js +49 -0
- package/dist/cjs/types/schema/connectivity.js +46 -0
- package/dist/cjs/types/schema/envelope.js +11 -0
- package/dist/cjs/types/schema/grantee.js +10 -0
- package/dist/cjs/types/schema/pinning.js +7 -0
- package/dist/cjs/types/schema/rchash.js +7 -0
- package/dist/cjs/types/schema/settlements.js +17 -0
- package/dist/cjs/types/schema/stake.js +33 -0
- package/dist/cjs/types/schema/stamps.js +48 -0
- package/dist/cjs/types/schema/states.js +34 -0
- package/dist/cjs/types/schema/status.js +39 -0
- package/dist/cjs/types/schema/stewardship.js +7 -0
- package/dist/cjs/types/schema/tag.js +20 -0
- package/dist/cjs/types/schema/transactions.js +24 -0
- package/dist/cjs/types/schema/upload.js +8 -0
- package/dist/cjs/utils/bad-ports.js +92 -0
- package/dist/cjs/utils/bytes.js +5 -3
- package/dist/cjs/utils/error.js +1 -0
- package/dist/cjs/utils/headers.js +19 -13
- package/dist/cjs/utils/hex-schema.js +8 -0
- package/dist/cjs/utils/http.js +92 -52
- package/dist/cjs/utils/resource-locator.js +4 -3
- package/dist/cjs/utils/schema.js +88 -0
- package/dist/cjs/utils/stamps.js +2 -1
- package/dist/cjs/utils/type.js +12 -130
- package/dist/cjs/utils/url.js +24 -0
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +59 -30
- package/dist/mjs/chunk/cac.js +5 -3
- package/dist/mjs/feed/index.js +4 -2
- package/dist/mjs/modules/bytes.js +8 -8
- package/dist/mjs/modules/bzz.js +6 -9
- package/dist/mjs/modules/chunk.js +4 -7
- package/dist/mjs/modules/debug/balance.js +5 -61
- package/dist/mjs/modules/debug/chequebook.js +9 -114
- package/dist/mjs/modules/debug/connectivity.js +5 -145
- package/dist/mjs/modules/debug/settlements.js +3 -46
- package/dist/mjs/modules/debug/stake.js +8 -85
- package/dist/mjs/modules/debug/stamps.js +24 -126
- package/dist/mjs/modules/debug/states.js +6 -71
- package/dist/mjs/modules/debug/status.js +7 -93
- package/dist/mjs/modules/debug/transactions.js +5 -60
- package/dist/mjs/modules/envelope.js +6 -20
- package/dist/mjs/modules/feed.js +6 -7
- package/dist/mjs/modules/grantee.js +8 -26
- package/dist/mjs/modules/pinning.js +7 -21
- package/dist/mjs/modules/rchash.js +2 -7
- package/dist/mjs/modules/soc.js +4 -5
- package/dist/mjs/modules/status.js +4 -4
- package/dist/mjs/modules/stewardship.js +2 -7
- package/dist/mjs/modules/tag.js +4 -93
- package/dist/mjs/stamper/stamper.js +2 -1
- package/dist/mjs/types/schema/balance.js +13 -0
- package/dist/mjs/types/schema/chequebook.js +53 -0
- package/dist/mjs/types/schema/connectivity.js +41 -0
- package/dist/mjs/types/schema/envelope.js +8 -0
- package/dist/mjs/types/schema/grantee.js +7 -0
- package/dist/mjs/types/schema/pinning.js +4 -0
- package/dist/mjs/types/schema/rchash.js +4 -0
- package/dist/mjs/types/schema/settlements.js +22 -0
- package/dist/mjs/types/schema/stake.js +40 -0
- package/dist/mjs/types/schema/stamps.js +47 -0
- package/dist/mjs/types/schema/states.js +34 -0
- package/dist/mjs/types/schema/status.js +36 -0
- package/dist/mjs/types/schema/stewardship.js +4 -0
- package/dist/mjs/types/schema/tag.js +14 -0
- package/dist/mjs/types/schema/transactions.js +25 -0
- package/dist/mjs/types/schema/upload.js +5 -0
- package/dist/mjs/utils/bad-ports.js +6 -0
- package/dist/mjs/utils/bytes.js +6 -8
- package/dist/mjs/utils/error.js +5 -0
- package/dist/mjs/utils/headers.js +19 -13
- package/dist/mjs/utils/hex-schema.js +2 -0
- package/dist/mjs/utils/http.js +97 -59
- package/dist/mjs/utils/resource-locator.js +4 -3
- package/dist/mjs/utils/schema.js +81 -0
- package/dist/mjs/utils/stamps.js +2 -1
- package/dist/mjs/utils/type.js +13 -233
- package/dist/mjs/utils/url.js +23 -0
- package/dist/types/bee.d.ts +23 -0
- package/dist/types/modules/debug/connectivity.d.ts +2 -2
- package/dist/types/modules/debug/stamps.d.ts +2 -0
- package/dist/types/modules/debug/status.d.ts +2 -2
- package/dist/types/types/debug.d.ts +1 -0
- package/dist/types/types/schema/balance.d.ts +12 -0
- package/dist/types/types/schema/chequebook.d.ts +104 -0
- package/dist/types/types/schema/connectivity.d.ts +49 -0
- package/dist/types/types/schema/envelope.d.ts +7 -0
- package/dist/types/types/schema/grantee.d.ts +7 -0
- package/dist/types/types/schema/pinning.d.ts +4 -0
- package/dist/types/types/schema/rchash.d.ts +4 -0
- package/dist/types/types/schema/settlements.d.ts +16 -0
- package/dist/types/types/schema/stake.d.ts +29 -0
- package/dist/types/types/schema/stamps.d.ts +77 -0
- package/dist/types/types/schema/states.d.ts +26 -0
- package/dist/types/types/schema/status.d.ts +38 -0
- package/dist/types/types/schema/stewardship.d.ts +4 -0
- package/dist/types/types/schema/tag.d.ts +23 -0
- package/dist/types/types/schema/transactions.d.ts +29 -0
- package/dist/types/types/schema/upload.d.ts +5 -0
- package/dist/types/utils/bad-ports.d.ts +6 -0
- package/dist/types/utils/error.d.ts +5 -0
- package/dist/types/utils/hex-schema.d.ts +2 -0
- package/dist/types/utils/http.d.ts +18 -3
- package/dist/types/utils/schema.d.ts +90 -0
- package/dist/types/utils/stamps.d.ts +1 -0
- package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
- package/dist/types/utils/tar-uploader.d.ts +1 -1
- package/dist/types/utils/type.d.ts +1 -16
- package/dist/types/utils/url.d.ts +9 -0
- package/package.json +11 -11
package/dist/cjs/bee.js
CHANGED
|
@@ -35,6 +35,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Bee = void 0;
|
|
37
37
|
const cafe_utility_1 = require("cafe-utility");
|
|
38
|
+
const zod_1 = require("zod");
|
|
38
39
|
const cac_1 = require("./chunk/cac");
|
|
39
40
|
const soc_1 = require("./chunk/soc");
|
|
40
41
|
const feed_1 = require("./feed");
|
|
@@ -70,6 +71,7 @@ const data_1 = require("./utils/data");
|
|
|
70
71
|
const error_1 = require("./utils/error");
|
|
71
72
|
const file_1 = require("./utils/file");
|
|
72
73
|
const resource_locator_1 = require("./utils/resource-locator");
|
|
74
|
+
const schema_1 = require("./utils/schema");
|
|
73
75
|
const stamps_1 = require("./utils/stamps");
|
|
74
76
|
const tokens_1 = require("./utils/tokens");
|
|
75
77
|
const type_1 = require("./utils/type");
|
|
@@ -126,7 +128,7 @@ class Bee {
|
|
|
126
128
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
127
129
|
(0, type_1.assertData)(data);
|
|
128
130
|
if (options) {
|
|
129
|
-
options =
|
|
131
|
+
options = schema_1.RedundantUploadOptionsSchema.parse(options);
|
|
130
132
|
}
|
|
131
133
|
return bytes.upload(this.getRequestOptionsForCall(requestOptions), data, postageBatchId, options);
|
|
132
134
|
}
|
|
@@ -162,7 +164,7 @@ class Bee {
|
|
|
162
164
|
*/
|
|
163
165
|
async downloadData(resource, options, requestOptions) {
|
|
164
166
|
if (options) {
|
|
165
|
-
options =
|
|
167
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
166
168
|
}
|
|
167
169
|
return bytes.download(this.getRequestOptionsForCall(requestOptions), new resource_locator_1.ResourceLocator(resource), options);
|
|
168
170
|
}
|
|
@@ -184,7 +186,7 @@ class Bee {
|
|
|
184
186
|
*/
|
|
185
187
|
async downloadReadableData(resource, options, requestOptions) {
|
|
186
188
|
if (options) {
|
|
187
|
-
options =
|
|
189
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
188
190
|
}
|
|
189
191
|
return bytes.downloadReadable(this.getRequestOptionsForCall(requestOptions), new resource_locator_1.ResourceLocator(resource), options);
|
|
190
192
|
}
|
|
@@ -206,7 +208,7 @@ class Bee {
|
|
|
206
208
|
const isSOC = 'identifier' in data && 'signature' in data && 'owner' in data;
|
|
207
209
|
data = data instanceof Uint8Array ? data : data.data;
|
|
208
210
|
if (options) {
|
|
209
|
-
options =
|
|
211
|
+
options = schema_1.UploadOptionsSchema.parse(options);
|
|
210
212
|
}
|
|
211
213
|
if (data.length < typed_bytes_1.Span.LENGTH) {
|
|
212
214
|
throw new error_1.BeeArgumentError(`Chunk has to have size of at least ${typed_bytes_1.Span.LENGTH}.`, data);
|
|
@@ -237,7 +239,7 @@ class Bee {
|
|
|
237
239
|
async downloadChunk(reference, options, requestOptions) {
|
|
238
240
|
reference = new typed_bytes_1.Reference(reference);
|
|
239
241
|
if (options) {
|
|
240
|
-
options =
|
|
242
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
241
243
|
}
|
|
242
244
|
return chunk.download(this.getRequestOptionsForCall(requestOptions), reference, options);
|
|
243
245
|
}
|
|
@@ -310,7 +312,7 @@ class Bee {
|
|
|
310
312
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
311
313
|
(0, type_1.assertFileData)(data);
|
|
312
314
|
if (options) {
|
|
313
|
-
options =
|
|
315
|
+
options = schema_1.FileUploadOptionsSchema.parse(options);
|
|
314
316
|
}
|
|
315
317
|
if (name && typeof name !== 'string') {
|
|
316
318
|
throw new TypeError('name has to be string or undefined!');
|
|
@@ -319,7 +321,7 @@ class Bee {
|
|
|
319
321
|
const fileData = await (0, file_1.fileArrayBuffer)(data);
|
|
320
322
|
const fileName = name ?? data.name;
|
|
321
323
|
const contentType = data.type;
|
|
322
|
-
const fileOptions = {
|
|
324
|
+
const fileOptions = { ...options, contentType };
|
|
323
325
|
return bzz.uploadFile(this.getRequestOptionsForCall(requestOptions), fileData, postageBatchId, fileName, fileOptions);
|
|
324
326
|
}
|
|
325
327
|
else {
|
|
@@ -339,7 +341,7 @@ class Bee {
|
|
|
339
341
|
*/
|
|
340
342
|
async downloadFile(resource, path = '', options, requestOptions) {
|
|
341
343
|
if (options) {
|
|
342
|
-
options =
|
|
344
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
343
345
|
}
|
|
344
346
|
return bzz.downloadFile(this.getRequestOptionsForCall(requestOptions), new resource_locator_1.ResourceLocator(resource), path, options);
|
|
345
347
|
}
|
|
@@ -357,7 +359,7 @@ class Bee {
|
|
|
357
359
|
async downloadReadableFile(reference, path = '', options, requestOptions) {
|
|
358
360
|
reference = new typed_bytes_1.Reference(reference);
|
|
359
361
|
if (options) {
|
|
360
|
-
options =
|
|
362
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
361
363
|
}
|
|
362
364
|
return bzz.downloadFileReadable(this.getRequestOptionsForCall(requestOptions), reference, path, options);
|
|
363
365
|
}
|
|
@@ -381,7 +383,7 @@ class Bee {
|
|
|
381
383
|
async uploadFiles(postageBatchId, fileList, options, requestOptions) {
|
|
382
384
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
383
385
|
if (options) {
|
|
384
|
-
options =
|
|
386
|
+
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
385
387
|
}
|
|
386
388
|
const data = (0, collection_1.makeCollectionFromFileList)(fileList);
|
|
387
389
|
return bzz.uploadCollection(this.getRequestOptionsForCall(requestOptions), data, postageBatchId, options);
|
|
@@ -455,7 +457,7 @@ class Bee {
|
|
|
455
457
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
456
458
|
(0, collection_1.assertCollection)(collection);
|
|
457
459
|
if (options) {
|
|
458
|
-
options =
|
|
460
|
+
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
459
461
|
}
|
|
460
462
|
return bzz.uploadCollection(this.getRequestOptionsForCall(requestOptions), collection, postageBatchId, options);
|
|
461
463
|
}
|
|
@@ -478,7 +480,7 @@ class Bee {
|
|
|
478
480
|
async uploadFilesFromDirectory(postageBatchId, dir, options, requestOptions) {
|
|
479
481
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
480
482
|
if (options) {
|
|
481
|
-
options =
|
|
483
|
+
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
482
484
|
}
|
|
483
485
|
const data = await (0, collection_node_1.makeCollectionFromFS)(dir);
|
|
484
486
|
return bzz.uploadCollection(this.getRequestOptionsForCall(requestOptions), data, postageBatchId, options);
|
|
@@ -507,7 +509,7 @@ class Bee {
|
|
|
507
509
|
*/
|
|
508
510
|
async getAllTags(options, requestOptions) {
|
|
509
511
|
if (options) {
|
|
510
|
-
options =
|
|
512
|
+
options = schema_1.AllTagsOptionsSchema.parse(options);
|
|
511
513
|
}
|
|
512
514
|
return tag.getAllTags(this.getRequestOptionsForCall(requestOptions), options?.offset, options?.limit);
|
|
513
515
|
}
|
|
@@ -648,7 +650,7 @@ class Bee {
|
|
|
648
650
|
owner = new typed_bytes_1.EthAddress(owner);
|
|
649
651
|
topic = new typed_bytes_1.Topic(topic);
|
|
650
652
|
if (options) {
|
|
651
|
-
options =
|
|
653
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
652
654
|
}
|
|
653
655
|
if (!index) {
|
|
654
656
|
try {
|
|
@@ -710,7 +712,7 @@ class Bee {
|
|
|
710
712
|
* @see [Bee API reference - `GET /pss`](https://docs.ethswarm.org/api/#tag/Postal-Service-for-Swarm/paths/~1pss~1subscribe~1{topic}/get)
|
|
711
713
|
*/
|
|
712
714
|
pssSubscribe(topic, handler) {
|
|
713
|
-
handler =
|
|
715
|
+
handler = schema_1.PssMessageHandlerSchema.parse(handler);
|
|
714
716
|
const ws = pss.subscribe(this.url, topic, this.requestOptions.headers);
|
|
715
717
|
let cancelled = false;
|
|
716
718
|
const cancel = () => {
|
|
@@ -888,7 +890,7 @@ class Bee {
|
|
|
888
890
|
gsocSubscribe(address, identifier, handler) {
|
|
889
891
|
address = new typed_bytes_1.EthAddress(address);
|
|
890
892
|
identifier = new typed_bytes_1.Identifier(identifier);
|
|
891
|
-
handler =
|
|
893
|
+
handler = schema_1.GsocMessageHandlerSchema.parse(handler);
|
|
892
894
|
const socAddress = (0, soc_1.makeSOCAddress)(identifier, address);
|
|
893
895
|
const ws = gsoc.subscribe(this.url, socAddress, this.requestOptions.headers);
|
|
894
896
|
let cancelled = false;
|
|
@@ -942,7 +944,7 @@ class Bee {
|
|
|
942
944
|
topic = new typed_bytes_1.Topic(topic);
|
|
943
945
|
owner = new typed_bytes_1.EthAddress(owner);
|
|
944
946
|
if (options) {
|
|
945
|
-
options =
|
|
947
|
+
options = schema_1.UploadOptionsSchema.parse(options);
|
|
946
948
|
}
|
|
947
949
|
return (0, feed_2.createFeedManifest)(this.getRequestOptionsForCall(requestOptions), owner, topic, postageBatchId, options);
|
|
948
950
|
}
|
|
@@ -1312,7 +1314,7 @@ class Bee {
|
|
|
1312
1314
|
async cashoutLastCheque(address, options, requestOptions) {
|
|
1313
1315
|
address = new typed_bytes_1.PeerAddress(address);
|
|
1314
1316
|
if (options) {
|
|
1315
|
-
|
|
1317
|
+
options = schema_1.TransactionOptionsSchema.parse(options);
|
|
1316
1318
|
}
|
|
1317
1319
|
return chequebook.cashoutLastCheque(this.getRequestOptionsForCall(requestOptions), address, options);
|
|
1318
1320
|
}
|
|
@@ -1526,7 +1528,7 @@ class Bee {
|
|
|
1526
1528
|
async createPostageBatch(amount, depth, options, requestOptions) {
|
|
1527
1529
|
const amountString = (0, type_1.asNumberString)(amount, { min: 0n, name: 'amount' });
|
|
1528
1530
|
if (options) {
|
|
1529
|
-
options =
|
|
1531
|
+
options = schema_1.PostageBatchOptionsSchema.parse(options);
|
|
1530
1532
|
}
|
|
1531
1533
|
if (depth < types_1.STAMPS_DEPTH_MIN || depth > types_1.STAMPS_DEPTH_MAX) {
|
|
1532
1534
|
throw new error_1.BeeArgumentError(`Depth has to be between ${types_1.STAMPS_DEPTH_MIN}..${types_1.STAMPS_DEPTH_MAX}`, depth);
|
|
@@ -1565,7 +1567,7 @@ class Bee {
|
|
|
1565
1567
|
const amount = (0, stamps_1.getAmountForDuration)(duration, chainState.currentPrice, this.network === 'gnosis' ? 5 : 15);
|
|
1566
1568
|
const depth = (0, stamps_1.getDepthForSize)(size, encryption, erasureCodeLevel);
|
|
1567
1569
|
if (options) {
|
|
1568
|
-
options =
|
|
1570
|
+
options = schema_1.PostageBatchOptionsSchema.parse(options);
|
|
1569
1571
|
}
|
|
1570
1572
|
return this.createPostageBatch(amount, depth, options, requestOptions);
|
|
1571
1573
|
}
|
|
@@ -1763,6 +1765,27 @@ class Bee {
|
|
|
1763
1765
|
const amount = (0, stamps_1.getAmountForDuration)(duration, chainState.currentPrice, this.network === 'gnosis' ? 5 : 15);
|
|
1764
1766
|
return (0, stamps_1.getStampCost)(batch.depth, amount);
|
|
1765
1767
|
}
|
|
1768
|
+
/**
|
|
1769
|
+
* Updates the label of a certain postage batch.
|
|
1770
|
+
*
|
|
1771
|
+
* @param postageBatchId Batch ID of the postage batch to update.
|
|
1772
|
+
* @param label New label for the postage batch.
|
|
1773
|
+
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
1774
|
+
*/
|
|
1775
|
+
async updatePostageBatchLabel(postageBatchId, label, requestOptions) {
|
|
1776
|
+
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
1777
|
+
return stamps.updatePostageBatchLabel(this.getRequestOptionsForCall(requestOptions), postageBatchId, label);
|
|
1778
|
+
}
|
|
1779
|
+
/**
|
|
1780
|
+
* Renames a storage. This is a convenience method that calls {@link updatePostageBatchLabel}.
|
|
1781
|
+
*
|
|
1782
|
+
* @param postageBatchId Batch ID of the postage batch to update.
|
|
1783
|
+
* @param newName New name for the storage.
|
|
1784
|
+
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
1785
|
+
*/
|
|
1786
|
+
async renameStorage(postageBatchId, newLabel, requestOptions) {
|
|
1787
|
+
return this.updatePostageBatchLabel(postageBatchId, newLabel, requestOptions);
|
|
1788
|
+
}
|
|
1766
1789
|
/**
|
|
1767
1790
|
* Calculates the `amount` and expected duration extension for topping up a postage batch with a given BZZ value.
|
|
1768
1791
|
*
|
|
@@ -1833,7 +1856,7 @@ class Bee {
|
|
|
1833
1856
|
*/
|
|
1834
1857
|
async diluteBatch(postageBatchId, depth, requestOptions) {
|
|
1835
1858
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
1836
|
-
depth =
|
|
1859
|
+
depth = zod_1.z.number().int().min(18).max(255).parse(depth);
|
|
1837
1860
|
return stamps.diluteBatch(this.getRequestOptionsForCall(requestOptions), postageBatchId, depth);
|
|
1838
1861
|
}
|
|
1839
1862
|
/**
|
|
@@ -1851,6 +1874,16 @@ class Bee {
|
|
|
1851
1874
|
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
1852
1875
|
return stamps.getPostageBatch(this.getRequestOptionsForCall(requestOptions), postageBatchId, encryption, erasureCodeLevel);
|
|
1853
1876
|
}
|
|
1877
|
+
/**
|
|
1878
|
+
* Returns details for specific globally available postage batch.
|
|
1879
|
+
*
|
|
1880
|
+
* @param postageBatchId Batch ID
|
|
1881
|
+
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
1882
|
+
*/
|
|
1883
|
+
async getGlobalPostageBatch(postageBatchId, requestOptions) {
|
|
1884
|
+
postageBatchId = new typed_bytes_1.BatchId(postageBatchId);
|
|
1885
|
+
return stamps.getGlobalPostageBatch(this.getRequestOptionsForCall(requestOptions), postageBatchId);
|
|
1886
|
+
}
|
|
1854
1887
|
/**
|
|
1855
1888
|
* Return detailed information related to buckets for specific postage batch.
|
|
1856
1889
|
*
|
|
@@ -1998,7 +2031,7 @@ class Bee {
|
|
|
1998
2031
|
async depositStake(amount, options, requestOptions) {
|
|
1999
2032
|
const amountString = amount instanceof tokens_1.BZZ ? amount.toPLURString() : (0, type_1.asNumberString)(amount, { min: 1n, name: 'amount' });
|
|
2000
2033
|
if (options) {
|
|
2001
|
-
options =
|
|
2034
|
+
options = schema_1.TransactionOptionsSchema.parse(options);
|
|
2002
2035
|
}
|
|
2003
2036
|
return stake.stake(this.getRequestOptionsForCall(requestOptions), amountString, options);
|
|
2004
2037
|
}
|
|
@@ -2030,7 +2063,7 @@ class Bee {
|
|
|
2030
2063
|
}
|
|
2031
2064
|
getRequestOptionsForCall(requestOptions) {
|
|
2032
2065
|
if (requestOptions) {
|
|
2033
|
-
requestOptions =
|
|
2066
|
+
requestOptions = schema_1.BeeRequestOptionsSchema.parse(requestOptions);
|
|
2034
2067
|
}
|
|
2035
2068
|
return requestOptions ? cafe_utility_1.Objects.deepMerge2(this.requestOptions, requestOptions) : this.requestOptions;
|
|
2036
2069
|
}
|
package/dist/cjs/chunk/cac.js
CHANGED
|
@@ -4,6 +4,7 @@ exports.MAX_PAYLOAD_SIZE = exports.MIN_PAYLOAD_SIZE = void 0;
|
|
|
4
4
|
exports.unmarshalContentAddressedChunk = unmarshalContentAddressedChunk;
|
|
5
5
|
exports.makeContentAddressedChunk = makeContentAddressedChunk;
|
|
6
6
|
const cafe_utility_1 = require("cafe-utility");
|
|
7
|
+
const zod_1 = require("zod");
|
|
7
8
|
const bytes_1 = require("../utils/bytes");
|
|
8
9
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
9
10
|
const bmt_1 = require("./bmt");
|
|
@@ -15,8 +16,9 @@ function unmarshalContentAddressedChunk(data) {
|
|
|
15
16
|
return makeContentAddressedChunk(data.toUint8Array().slice(typed_bytes_1.Span.LENGTH), typed_bytes_1.Span.fromSlice(data.toUint8Array(), 0));
|
|
16
17
|
}
|
|
17
18
|
function makeContentAddressedChunk(rawPayload, span) {
|
|
18
|
-
|
|
19
|
-
|
|
19
|
+
const asString = zod_1.z.string().safeParse(rawPayload);
|
|
20
|
+
if (asString.success) {
|
|
21
|
+
rawPayload = bytes_1.Bytes.fromUtf8(asString.data);
|
|
20
22
|
}
|
|
21
23
|
if (rawPayload.length < exports.MIN_PAYLOAD_SIZE || rawPayload.length > exports.MAX_PAYLOAD_SIZE) {
|
|
22
24
|
throw new RangeError(`payload size ${rawPayload.length} exceeds limits [${exports.MIN_PAYLOAD_SIZE}, ${exports.MAX_PAYLOAD_SIZE}]`);
|
package/dist/cjs/feed/index.js
CHANGED
|
@@ -42,6 +42,7 @@ exports.downloadFeedUpdateAsCAC = downloadFeedUpdateAsCAC;
|
|
|
42
42
|
exports.makeFeedReader = makeFeedReader;
|
|
43
43
|
exports.makeFeedWriter = makeFeedWriter;
|
|
44
44
|
const cafe_utility_1 = require("cafe-utility");
|
|
45
|
+
const zod_1 = require("zod");
|
|
45
46
|
const cac_1 = require("../chunk/cac");
|
|
46
47
|
const soc_1 = require("../chunk/soc");
|
|
47
48
|
const bytes = __importStar(require("../modules/bytes"));
|
|
@@ -87,7 +88,8 @@ async function updateFeedWithPayload(requestOptions, signer, topic, data, postag
|
|
|
87
88
|
const rootChunk = (0, cac_1.unmarshalContentAddressedChunk)(await chunkAPI.download(requestOptions, uploadResult.reference));
|
|
88
89
|
return (0, soc_1.uploadSingleOwnerChunkWithWrappedChunk)(requestOptions, signer, postageBatchId, identifier, rootChunk, options);
|
|
89
90
|
}
|
|
90
|
-
|
|
91
|
+
const dataString = zod_1.z.string().safeParse(data);
|
|
92
|
+
return (0, soc_1.uploadSingleOwnerChunkData)(requestOptions, signer, postageBatchId, identifier, dataString.success ? bytes_1.Bytes.fromUtf8(dataString.data).toUint8Array() : data, options);
|
|
91
93
|
}
|
|
92
94
|
function getFeedUpdateChunkReference(owner, topic, index) {
|
|
93
95
|
const identifier = (0, identifier_1.makeFeedIdentifier)(topic, index);
|
|
@@ -5,9 +5,11 @@ exports.head = head;
|
|
|
5
5
|
exports.download = download;
|
|
6
6
|
exports.downloadReadable = downloadReadable;
|
|
7
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
8
|
+
const upload_1 = require("../types/schema/upload");
|
|
8
9
|
const bytes_1 = require("../utils/bytes");
|
|
9
10
|
const headers_1 = require("../utils/headers");
|
|
10
11
|
const http_1 = require("../utils/http");
|
|
12
|
+
const schema_1 = require("../utils/schema");
|
|
11
13
|
const type_1 = require("../utils/type");
|
|
12
14
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
13
15
|
const endpoint = 'bytes';
|
|
@@ -30,9 +32,9 @@ async function upload(requestOptions, data, postageBatchId, options) {
|
|
|
30
32
|
...(0, headers_1.prepareRequestHeaders)(postageBatchId, options),
|
|
31
33
|
},
|
|
32
34
|
});
|
|
33
|
-
const body =
|
|
35
|
+
const body = upload_1.UploadResultBody.parse(response.data);
|
|
34
36
|
return {
|
|
35
|
-
reference:
|
|
37
|
+
reference: body.reference,
|
|
36
38
|
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
|
|
37
39
|
historyAddress: response.headers['swarm-act-history-address']
|
|
38
40
|
? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
|
|
@@ -64,7 +66,7 @@ async function head(requestOptions, reference) {
|
|
|
64
66
|
*/
|
|
65
67
|
async function download(requestOptions, resource, options) {
|
|
66
68
|
if (options) {
|
|
67
|
-
options =
|
|
69
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
68
70
|
}
|
|
69
71
|
const response = await (0, http_1.http)(requestOptions, {
|
|
70
72
|
responseType: 'arraybuffer',
|
|
@@ -81,7 +83,7 @@ async function download(requestOptions, resource, options) {
|
|
|
81
83
|
*/
|
|
82
84
|
async function downloadReadable(requestOptions, resource, options) {
|
|
83
85
|
if (options) {
|
|
84
|
-
options =
|
|
86
|
+
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
85
87
|
}
|
|
86
88
|
const response = await (0, http_1.http)(requestOptions, {
|
|
87
89
|
responseType: 'stream',
|
package/dist/cjs/modules/bzz.js
CHANGED
|
@@ -5,6 +5,7 @@ exports.downloadFile = downloadFile;
|
|
|
5
5
|
exports.downloadFileReadable = downloadFileReadable;
|
|
6
6
|
exports.uploadCollection = uploadCollection;
|
|
7
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
8
|
+
const upload_1 = require("../types/schema/upload");
|
|
8
9
|
const bytes_1 = require("../utils/bytes");
|
|
9
10
|
const collection_1 = require("../utils/collection");
|
|
10
11
|
const headers_1 = require("../utils/headers");
|
|
@@ -37,9 +38,9 @@ async function uploadFile(requestOptions, data, postageBatchId, name, options) {
|
|
|
37
38
|
params: { name },
|
|
38
39
|
responseType: 'json',
|
|
39
40
|
});
|
|
40
|
-
const body =
|
|
41
|
+
const body = upload_1.UploadResultBody.parse(response.data);
|
|
41
42
|
return {
|
|
42
|
-
reference:
|
|
43
|
+
reference: body.reference,
|
|
43
44
|
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
|
|
44
45
|
historyAddress: response.headers['swarm-act-history-address']
|
|
45
46
|
? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
|
|
@@ -99,9 +100,9 @@ async function downloadFileReadable(requestOptions, reference, path = '', option
|
|
|
99
100
|
async function uploadCollection(requestOptions, collection, postageBatchId, options) {
|
|
100
101
|
(0, collection_1.assertCollection)(collection);
|
|
101
102
|
const response = await (0, tar_uploader_1.uploadTar)(requestOptions, collection, postageBatchId, options);
|
|
102
|
-
const body =
|
|
103
|
+
const body = upload_1.UploadResultBody.parse(response.data);
|
|
103
104
|
return {
|
|
104
|
-
reference:
|
|
105
|
+
reference: body.reference,
|
|
105
106
|
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
|
|
106
107
|
historyAddress: response.headers['swarm-act-history-address']
|
|
107
108
|
? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.upload = upload;
|
|
4
4
|
exports.download = download;
|
|
5
5
|
const cafe_utility_1 = require("cafe-utility");
|
|
6
|
+
const upload_1 = require("../types/schema/upload");
|
|
6
7
|
const headers_1 = require("../utils/headers");
|
|
7
8
|
const http_1 = require("../utils/http");
|
|
8
9
|
const type_1 = require("../utils/type");
|
|
@@ -31,9 +32,9 @@ async function upload(requestOptions, data, stamp, options) {
|
|
|
31
32
|
},
|
|
32
33
|
responseType: 'json',
|
|
33
34
|
});
|
|
34
|
-
const body =
|
|
35
|
+
const body = upload_1.UploadResultBody.parse(response.data);
|
|
35
36
|
return {
|
|
36
|
-
reference:
|
|
37
|
+
reference: body.reference,
|
|
37
38
|
tagUid: response.headers['swarm-tag'] ? (0, type_1.makeTagUid)(response.headers['swarm-tag']) : undefined,
|
|
38
39
|
historyAddress: response.headers['swarm-act-history-address']
|
|
39
40
|
? cafe_utility_1.Optional.of(new typed_bytes_1.Reference(response.headers['swarm-act-history-address']))
|
|
@@ -4,10 +4,8 @@ exports.getAllBalances = getAllBalances;
|
|
|
4
4
|
exports.getPeerBalance = getPeerBalance;
|
|
5
5
|
exports.getPastDueConsumptionBalances = getPastDueConsumptionBalances;
|
|
6
6
|
exports.getPastDueConsumptionPeerBalance = getPastDueConsumptionPeerBalance;
|
|
7
|
-
const
|
|
7
|
+
const balance_1 = require("../../types/schema/balance");
|
|
8
8
|
const http_1 = require("../../utils/http");
|
|
9
|
-
const tokens_1 = require("../../utils/tokens");
|
|
10
|
-
const type_1 = require("../../utils/type");
|
|
11
9
|
const balancesEndpoint = 'balances';
|
|
12
10
|
const consumedEndpoint = 'consumed';
|
|
13
11
|
/**
|
|
@@ -20,14 +18,7 @@ async function getAllBalances(requestOptions) {
|
|
|
20
18
|
url: balancesEndpoint,
|
|
21
19
|
responseType: 'json',
|
|
22
20
|
});
|
|
23
|
-
|
|
24
|
-
const balances = cafe_utility_1.Types.asArray(body.balances, { name: 'balances' }).map(x => cafe_utility_1.Types.asObject(x, { name: 'balance' }));
|
|
25
|
-
return {
|
|
26
|
-
balances: balances.map(x => ({
|
|
27
|
-
peer: cafe_utility_1.Types.asString(x.peer, { name: 'peer' }),
|
|
28
|
-
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(x.balance, { name: 'balance' })),
|
|
29
|
-
})),
|
|
30
|
-
};
|
|
21
|
+
return balance_1.GetAllBalancesResponse.parse(response.data);
|
|
31
22
|
}
|
|
32
23
|
/**
|
|
33
24
|
* Get the balances with a specific peer including prepaid services
|
|
@@ -40,11 +31,7 @@ async function getPeerBalance(requestOptions, address) {
|
|
|
40
31
|
url: `${balancesEndpoint}/${address}`,
|
|
41
32
|
responseType: 'json',
|
|
42
33
|
});
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
peer: cafe_utility_1.Types.asString(body.peer, { name: 'peer' }),
|
|
46
|
-
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.balance, { name: 'balance' })),
|
|
47
|
-
};
|
|
34
|
+
return balance_1.GetPeerBalanceResponse.parse(response.data);
|
|
48
35
|
}
|
|
49
36
|
/**
|
|
50
37
|
* Get the past due consumption balances with all known peers
|
|
@@ -56,14 +43,7 @@ async function getPastDueConsumptionBalances(requestOptions) {
|
|
|
56
43
|
url: consumedEndpoint,
|
|
57
44
|
responseType: 'json',
|
|
58
45
|
});
|
|
59
|
-
|
|
60
|
-
const balances = cafe_utility_1.Types.asArray(body.balances, { name: 'balances' }).map(x => cafe_utility_1.Types.asObject(x, { name: 'balance' }));
|
|
61
|
-
return {
|
|
62
|
-
balances: balances.map(x => ({
|
|
63
|
-
peer: cafe_utility_1.Types.asString(x.peer, { name: 'peer' }),
|
|
64
|
-
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(x.balance, { name: 'balance' })),
|
|
65
|
-
})),
|
|
66
|
-
};
|
|
46
|
+
return balance_1.GetAllBalancesResponse.parse(response.data);
|
|
67
47
|
}
|
|
68
48
|
/**
|
|
69
49
|
* Get the past due consumption balance with a specific peer
|
|
@@ -76,9 +56,5 @@ async function getPastDueConsumptionPeerBalance(requestOptions, address) {
|
|
|
76
56
|
url: `${consumedEndpoint}/${address}`,
|
|
77
57
|
responseType: 'json',
|
|
78
58
|
});
|
|
79
|
-
|
|
80
|
-
return {
|
|
81
|
-
peer: cafe_utility_1.Types.asString(body.peer, { name: 'peer' }),
|
|
82
|
-
balance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.balance, { name: 'balance' })),
|
|
83
|
-
};
|
|
59
|
+
return balance_1.GetPeerBalanceResponse.parse(response.data);
|
|
84
60
|
}
|
|
@@ -8,12 +8,9 @@ exports.getLastChequesForPeer = getLastChequesForPeer;
|
|
|
8
8
|
exports.getLastCheques = getLastCheques;
|
|
9
9
|
exports.depositTokens = depositTokens;
|
|
10
10
|
exports.withdrawTokens = withdrawTokens;
|
|
11
|
-
const
|
|
11
|
+
const chequebook_1 = require("../../types/schema/chequebook");
|
|
12
12
|
const headers_1 = require("../../utils/headers");
|
|
13
13
|
const http_1 = require("../../utils/http");
|
|
14
|
-
const tokens_1 = require("../../utils/tokens");
|
|
15
|
-
const type_1 = require("../../utils/type");
|
|
16
|
-
const typed_bytes_1 = require("../../utils/typed-bytes");
|
|
17
14
|
const chequebookEndpoint = 'chequebook';
|
|
18
15
|
/**
|
|
19
16
|
* Get the address of the chequebook contract used
|
|
@@ -25,10 +22,7 @@ async function getChequebookAddress(requestOptions) {
|
|
|
25
22
|
url: chequebookEndpoint + '/address',
|
|
26
23
|
responseType: 'json',
|
|
27
24
|
});
|
|
28
|
-
|
|
29
|
-
return {
|
|
30
|
-
chequebookAddress: new typed_bytes_1.EthAddress(cafe_utility_1.Types.asString(body.chequebookAddress, { name: 'chequebookAddress' })),
|
|
31
|
-
};
|
|
25
|
+
return chequebook_1.GetChequebookAddressResponse.parse(response.data);
|
|
32
26
|
}
|
|
33
27
|
/**
|
|
34
28
|
* Get the balance of the chequebook
|
|
@@ -40,11 +34,7 @@ async function getChequebookBalance(requestOptions) {
|
|
|
40
34
|
url: chequebookEndpoint + '/balance',
|
|
41
35
|
responseType: 'json',
|
|
42
36
|
});
|
|
43
|
-
|
|
44
|
-
return {
|
|
45
|
-
availableBalance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.availableBalance, { name: 'availableBalance' })),
|
|
46
|
-
totalBalance: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.totalBalance, { name: 'totalBalance' })),
|
|
47
|
-
};
|
|
37
|
+
return chequebook_1.GetChequebookBalanceResponse.parse(response.data);
|
|
48
38
|
}
|
|
49
39
|
/**
|
|
50
40
|
* Get last cashout action for the peer
|
|
@@ -57,14 +47,7 @@ async function getLastCashoutAction(requestOptions, peer) {
|
|
|
57
47
|
url: chequebookEndpoint + `/cashout/${peer}`,
|
|
58
48
|
responseType: 'json',
|
|
59
49
|
});
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
peer: cafe_utility_1.Types.asString(body.peer, { name: 'peer' }),
|
|
63
|
-
uncashedAmount: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.uncashedAmount, { name: 'uncashedAmount' })),
|
|
64
|
-
transactionHash: cafe_utility_1.Types.asNullableString(body.transactionHash),
|
|
65
|
-
lastCashedCheque: cafe_utility_1.Types.asNullable(x => asCheque(x), body.lastCashedCheque),
|
|
66
|
-
result: cafe_utility_1.Types.asNullable(x => asCashoutResult(x), body.result),
|
|
67
|
-
};
|
|
50
|
+
return chequebook_1.GetLastCashoutActionResponse.parse(response.data);
|
|
68
51
|
}
|
|
69
52
|
/**
|
|
70
53
|
* Cashout the last cheque for the peer
|
|
@@ -80,8 +63,7 @@ async function cashoutLastCheque(requestOptions, peer, options) {
|
|
|
80
63
|
responseType: 'json',
|
|
81
64
|
headers: (0, headers_1.prepareRequestHeaders)(null, options),
|
|
82
65
|
});
|
|
83
|
-
|
|
84
|
-
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
66
|
+
return chequebook_1.TransactionHashResponse.parse(response.data).transactionHash;
|
|
85
67
|
}
|
|
86
68
|
/**
|
|
87
69
|
* Get last cheques for the peer
|
|
@@ -94,12 +76,7 @@ async function getLastChequesForPeer(requestOptions, peer) {
|
|
|
94
76
|
url: chequebookEndpoint + `/cheque/${peer}`,
|
|
95
77
|
responseType: 'json',
|
|
96
78
|
});
|
|
97
|
-
|
|
98
|
-
return {
|
|
99
|
-
peer: cafe_utility_1.Types.asString(body.peer, { name: 'peer' }),
|
|
100
|
-
lastreceived: cafe_utility_1.Types.asNullable(x => asCheque(x), body.lastreceived),
|
|
101
|
-
lastsent: cafe_utility_1.Types.asNullable(x => asCheque(x), body.lastsent),
|
|
102
|
-
};
|
|
79
|
+
return chequebook_1.GetLastChequesForPeerResponse.parse(response.data);
|
|
103
80
|
}
|
|
104
81
|
/**
|
|
105
82
|
* Get last cheques for all peers
|
|
@@ -111,31 +88,7 @@ async function getLastCheques(requestOptions) {
|
|
|
111
88
|
url: chequebookEndpoint + '/cheque',
|
|
112
89
|
responseType: 'json',
|
|
113
90
|
});
|
|
114
|
-
|
|
115
|
-
const lastcheques = cafe_utility_1.Types.asArray(body.lastcheques, { name: 'lastcheques' }).map(x => cafe_utility_1.Types.asObject(x, { name: 'lastcheque' }));
|
|
116
|
-
return {
|
|
117
|
-
lastcheques: lastcheques.map(x => ({
|
|
118
|
-
peer: cafe_utility_1.Types.asString(x.peer, { name: 'peer' }),
|
|
119
|
-
lastreceived: cafe_utility_1.Types.asNullable(y => asCheque(y), x.lastreceived),
|
|
120
|
-
lastsent: cafe_utility_1.Types.asNullable(y => asCheque(y), x.lastsent),
|
|
121
|
-
})),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
function asCheque(x) {
|
|
125
|
-
const object = cafe_utility_1.Types.asObject(x, { name: 'cheque' });
|
|
126
|
-
return {
|
|
127
|
-
beneficiary: new typed_bytes_1.EthAddress(cafe_utility_1.Types.asString(object.beneficiary, { name: 'beneficiary' })),
|
|
128
|
-
chequebook: new typed_bytes_1.EthAddress(cafe_utility_1.Types.asString(object.chequebook, { name: 'chequebook' })),
|
|
129
|
-
payout: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(object.payout, { name: 'payout' })),
|
|
130
|
-
};
|
|
131
|
-
}
|
|
132
|
-
function asCashoutResult(x) {
|
|
133
|
-
const object = cafe_utility_1.Types.asObject(x, { name: 'cashout result' });
|
|
134
|
-
return {
|
|
135
|
-
recipient: cafe_utility_1.Types.asString(object.recipient, { name: 'recipient' }),
|
|
136
|
-
lastPayout: tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(object.lastPayout, { name: 'lastPayout' })),
|
|
137
|
-
bounced: cafe_utility_1.Types.asBoolean(object.bounced, { name: 'bounced' }),
|
|
138
|
-
};
|
|
91
|
+
return chequebook_1.GetLastChequesResponse.parse(response.data);
|
|
139
92
|
}
|
|
140
93
|
/**
|
|
141
94
|
* Deposit tokens from overlay address into chequebook
|
|
@@ -157,8 +110,7 @@ async function depositTokens(requestOptions, amount, gasPrice) {
|
|
|
157
110
|
params: { amount: amount.toString(10) },
|
|
158
111
|
headers,
|
|
159
112
|
});
|
|
160
|
-
|
|
161
|
-
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
113
|
+
return chequebook_1.TransactionHashResponse.parse(response.data).transactionHash;
|
|
162
114
|
}
|
|
163
115
|
/**
|
|
164
116
|
* Withdraw tokens from the chequebook to the overlay address
|
|
@@ -180,6 +132,5 @@ async function withdrawTokens(requestOptions, amount, gasPrice) {
|
|
|
180
132
|
params: { amount: amount.toString(10) },
|
|
181
133
|
headers,
|
|
182
134
|
});
|
|
183
|
-
|
|
184
|
-
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
135
|
+
return chequebook_1.TransactionHashResponse.parse(response.data).transactionHash;
|
|
185
136
|
}
|