@ethersphere/bee-js 13.0.0-upcoming.gcfb9756 → 13.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/README.md +104 -103
- package/dist/cjs/api/bytes.js +3 -4
- package/dist/cjs/api/bzz.js +5 -6
- package/dist/cjs/api/chunk.js +3 -3
- package/dist/cjs/api/envelope.js +3 -2
- package/dist/cjs/api/feed.js +4 -5
- package/dist/cjs/api/pin.js +2 -2
- package/dist/cjs/api/soc.js +2 -2
- package/dist/cjs/bee.js +18 -19
- package/dist/cjs/chunk/soc.js +21 -63
- package/dist/cjs/feed/identifier.js +3 -4
- package/dist/cjs/feed/index.js +17 -19
- package/dist/cjs/feed/retrievable.js +2 -2
- package/dist/cjs/index.js +18 -8
- package/dist/cjs/manifest/manifest.js +97 -333
- package/dist/cjs/modules/balance.js +3 -3
- package/dist/cjs/modules/cheque.js +4 -4
- package/dist/cjs/modules/chunk.js +8 -8
- package/dist/cjs/modules/collection.js +6 -6
- package/dist/cjs/modules/connectivity.js +3 -3
- package/dist/cjs/modules/data.js +6 -6
- package/dist/cjs/modules/feed.js +10 -10
- package/dist/cjs/modules/file.js +3 -3
- package/dist/cjs/modules/grantee.js +9 -9
- package/dist/cjs/modules/messaging.js +15 -17
- package/dist/cjs/modules/pin.js +6 -6
- package/dist/cjs/modules/settlement.js +2 -2
- package/dist/cjs/modules/soc.js +3 -3
- package/dist/cjs/modules/stamp.js +7 -7
- package/dist/cjs/modules/tag.js +2 -2
- package/dist/cjs/modules/transaction.js +4 -4
- package/dist/cjs/modules/wallet.js +3 -3
- package/dist/cjs/types/schema/chequebook.js +5 -5
- package/dist/cjs/types/schema/connectivity.js +5 -5
- package/dist/cjs/types/schema/envelope.js +5 -5
- package/dist/cjs/types/schema/grantee.js +4 -4
- package/dist/cjs/types/schema/stake.js +2 -2
- package/dist/cjs/types/schema/stamps.js +4 -4
- package/dist/cjs/types/schema/states.js +2 -2
- package/dist/cjs/types/schema/transactions.js +3 -3
- package/dist/cjs/types/schema/upload.js +2 -2
- package/dist/cjs/utils/chunk-stream.browser.js +24 -16
- package/dist/cjs/utils/chunk-stream.js +17 -9
- package/dist/cjs/utils/constants.js +3 -3
- package/dist/cjs/utils/expose.js +4 -4
- package/dist/cjs/utils/headers.js +4 -4
- package/dist/cjs/utils/http.js +3 -1
- package/dist/cjs/utils/pss.js +2 -2
- package/dist/cjs/utils/resource-locator.js +2 -2
- package/dist/cjs/utils/schema.js +4 -4
- package/dist/cjs/utils/stamps.js +15 -130
- package/dist/cjs/utils/type.js +2 -2
- package/dist/codemod/index.js +141 -0
- package/dist/codemod/transforms/v13.js +524 -0
- package/dist/index.browser.min.js +2 -1
- package/dist/index.browser.min.js.LICENSE.txt +3 -0
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/api/bytes.js +1 -2
- package/dist/mjs/api/bzz.js +1 -2
- package/dist/mjs/api/chunk.js +1 -1
- package/dist/mjs/api/envelope.js +3 -2
- package/dist/mjs/api/feed.js +1 -2
- package/dist/mjs/api/pin.js +1 -1
- package/dist/mjs/api/soc.js +1 -1
- package/dist/mjs/bee.js +13 -14
- package/dist/mjs/chunk/soc.js +11 -49
- package/dist/mjs/feed/identifier.js +2 -3
- package/dist/mjs/feed/index.js +6 -8
- package/dist/mjs/feed/retrievable.js +1 -1
- package/dist/mjs/index.js +2 -5
- package/dist/mjs/manifest/manifest.js +95 -339
- package/dist/mjs/modules/balance.js +1 -1
- package/dist/mjs/modules/cheque.js +1 -1
- package/dist/mjs/modules/chunk.js +1 -1
- package/dist/mjs/modules/collection.js +1 -1
- package/dist/mjs/modules/connectivity.js +1 -1
- package/dist/mjs/modules/data.js +3 -3
- package/dist/mjs/modules/feed.js +1 -1
- package/dist/mjs/modules/file.js +1 -1
- package/dist/mjs/modules/grantee.js +1 -1
- package/dist/mjs/modules/messaging.js +3 -5
- package/dist/mjs/modules/pin.js +1 -1
- package/dist/mjs/modules/settlement.js +1 -1
- package/dist/mjs/modules/soc.js +1 -1
- package/dist/mjs/modules/stamp.js +1 -1
- package/dist/mjs/modules/tag.js +1 -1
- package/dist/mjs/modules/transaction.js +1 -1
- package/dist/mjs/modules/wallet.js +1 -1
- package/dist/mjs/types/schema/chequebook.js +1 -1
- package/dist/mjs/types/schema/connectivity.js +1 -1
- package/dist/mjs/types/schema/envelope.js +5 -5
- package/dist/mjs/types/schema/grantee.js +1 -1
- package/dist/mjs/types/schema/stake.js +1 -1
- package/dist/mjs/types/schema/stamps.js +1 -1
- package/dist/mjs/types/schema/states.js +1 -1
- package/dist/mjs/types/schema/transactions.js +1 -1
- package/dist/mjs/types/schema/upload.js +1 -1
- package/dist/mjs/utils/chunk-stream.browser.js +28 -18
- package/dist/mjs/utils/chunk-stream.js +21 -11
- package/dist/mjs/utils/constants.js +1 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/mjs/utils/headers.js +1 -1
- package/dist/mjs/utils/http.js +6 -1
- package/dist/mjs/utils/pss.js +1 -1
- package/dist/mjs/utils/resource-locator.js +1 -1
- package/dist/mjs/utils/schema.js +1 -1
- package/dist/mjs/utils/stamps.js +5 -99
- package/dist/mjs/utils/type.js +2 -2
- package/dist/types/api/balance.d.ts +1 -1
- package/dist/types/api/batches.d.ts +1 -1
- package/dist/types/api/bytes.d.ts +3 -3
- package/dist/types/api/bzz.d.ts +1 -2
- package/dist/types/api/chequebook.d.ts +1 -1
- package/dist/types/api/chunk.d.ts +1 -1
- package/dist/types/api/connectivity.d.ts +1 -1
- package/dist/types/api/consumed.d.ts +1 -1
- package/dist/types/api/envelope.d.ts +1 -1
- package/dist/types/api/feed.d.ts +1 -2
- package/dist/types/api/grantee.d.ts +1 -1
- package/dist/types/api/pin.d.ts +1 -1
- package/dist/types/api/pss.d.ts +1 -1
- package/dist/types/api/settlement.d.ts +1 -1
- package/dist/types/api/soc.d.ts +1 -1
- package/dist/types/api/stake.d.ts +1 -1
- package/dist/types/api/stamp.d.ts +1 -1
- package/dist/types/api/stewardship.d.ts +1 -1
- package/dist/types/api/tag.d.ts +1 -1
- package/dist/types/api/transaction.d.ts +1 -1
- package/dist/types/api/wallet.d.ts +1 -1
- package/dist/types/bee.d.ts +11 -13
- package/dist/types/chunk/soc.d.ts +3 -48
- package/dist/types/feed/identifier.d.ts +1 -1
- package/dist/types/feed/index.d.ts +1 -3
- package/dist/types/feed/retrievable.d.ts +1 -1
- package/dist/types/index.d.ts +17 -20
- package/dist/types/manifest/manifest.d.ts +24 -33
- package/dist/types/modules/balance.d.ts +1 -1
- package/dist/types/modules/cheque.d.ts +1 -1
- package/dist/types/modules/chequebook.d.ts +1 -1
- package/dist/types/modules/chunk.d.ts +1 -2
- package/dist/types/modules/collection.d.ts +2 -2
- package/dist/types/modules/connectivity.d.ts +1 -1
- package/dist/types/modules/context.d.ts +1 -1
- package/dist/types/modules/data.d.ts +3 -3
- package/dist/types/modules/feed.d.ts +1 -1
- package/dist/types/modules/file.d.ts +1 -2
- package/dist/types/modules/grantee.d.ts +1 -1
- package/dist/types/modules/messaging.d.ts +1 -2
- package/dist/types/modules/pin.d.ts +1 -1
- package/dist/types/modules/settlement.d.ts +1 -1
- package/dist/types/modules/soc.d.ts +1 -1
- package/dist/types/modules/stake.d.ts +1 -1
- package/dist/types/modules/stamp.d.ts +1 -1
- package/dist/types/modules/storage.d.ts +1 -1
- package/dist/types/modules/tag.d.ts +1 -1
- package/dist/types/modules/transaction.d.ts +1 -1
- package/dist/types/modules/wallet.d.ts +1 -1
- package/dist/types/types/debug.d.ts +1 -1
- package/dist/types/types/index.d.ts +2 -11
- package/dist/types/types/schema/chequebook.d.ts +1 -1
- package/dist/types/types/schema/connectivity.d.ts +1 -1
- package/dist/types/types/schema/grantee.d.ts +1 -1
- package/dist/types/types/schema/stake.d.ts +1 -1
- package/dist/types/types/schema/stamps.d.ts +1 -1
- package/dist/types/types/schema/states.d.ts +1 -1
- package/dist/types/types/schema/transactions.d.ts +1 -1
- package/dist/types/types/schema/upload.d.ts +1 -1
- package/dist/types/utils/chunk-stream.browser.d.ts +1 -1
- package/dist/types/utils/chunk-stream.d.ts +2 -2
- package/dist/types/utils/constants.d.ts +1 -1
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/headers.d.ts +1 -1
- package/dist/types/utils/pss.d.ts +1 -1
- package/dist/types/utils/resource-locator.d.ts +1 -1
- package/dist/types/utils/schema.d.ts +1 -1
- package/dist/types/utils/stamps.d.ts +2 -27
- 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 -1
- package/package.json +7 -2
- package/dist/cjs/chunk/bmt.js +0 -37
- package/dist/cjs/chunk/cac.js +0 -43
- package/dist/cjs/stamper/stamper.js +0 -44
- package/dist/cjs/utils/bytes.js +0 -116
- package/dist/cjs/utils/cid.js +0 -37
- package/dist/cjs/utils/redundancy.js +0 -133
- package/dist/cjs/utils/typed-bytes.js +0 -186
- package/dist/mjs/chunk/bmt.js +0 -34
- package/dist/mjs/chunk/cac.js +0 -34
- package/dist/mjs/stamper/stamper.js +0 -40
- package/dist/mjs/utils/bytes.js +0 -102
- package/dist/mjs/utils/cid.js +0 -32
- package/dist/mjs/utils/redundancy.js +0 -98
- package/dist/mjs/utils/typed-bytes.js +0 -167
- package/dist/types/chunk/bmt.d.ts +0 -16
- package/dist/types/chunk/cac.d.ts +0 -40
- package/dist/types/stamper/stamper.d.ts +0 -15
- package/dist/types/utils/bytes.d.ts +0 -19
- package/dist/types/utils/cid.d.ts +0 -10
- package/dist/types/utils/redundancy.d.ts +0 -21
- package/dist/types/utils/typed-bytes.d.ts +0 -69
|
@@ -34,11 +34,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Collection = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const chunk_stream_1 = require("../utils/chunk-stream");
|
|
38
39
|
const collection_1 = require("../utils/collection");
|
|
39
40
|
const collection_node_1 = require("../utils/collection.node");
|
|
40
41
|
const schema_1 = require("../utils/schema");
|
|
41
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
42
42
|
const api = __importStar(require("../api/bzz"));
|
|
43
43
|
/**
|
|
44
44
|
* Collection (multi-file) operations backed by the `/bzz` endpoint.
|
|
@@ -58,7 +58,7 @@ class Collection {
|
|
|
58
58
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
59
59
|
*/
|
|
60
60
|
async upload(postageBatchId, collection, options, requestOptions) {
|
|
61
|
-
const batchId = new
|
|
61
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
62
62
|
(0, collection_1.assertCollection)(collection);
|
|
63
63
|
if (options) {
|
|
64
64
|
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
@@ -74,7 +74,7 @@ class Collection {
|
|
|
74
74
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
75
75
|
*/
|
|
76
76
|
async uploadFromFileList(postageBatchId, fileList, options, requestOptions) {
|
|
77
|
-
const batchId = new
|
|
77
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
78
78
|
if (options) {
|
|
79
79
|
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
80
80
|
}
|
|
@@ -92,7 +92,7 @@ class Collection {
|
|
|
92
92
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
93
93
|
*/
|
|
94
94
|
async uploadFromDirectory(postageBatchId, dir, options, requestOptions) {
|
|
95
|
-
const batchId = new
|
|
95
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
96
96
|
if (options) {
|
|
97
97
|
options = schema_1.CollectionUploadOptionsSchema.parse(options);
|
|
98
98
|
}
|
|
@@ -112,7 +112,7 @@ class Collection {
|
|
|
112
112
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
113
113
|
*/
|
|
114
114
|
async stream(postageBatchId, files, onUploadProgress, options, requestOptions) {
|
|
115
|
-
const batchId = new
|
|
115
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
116
116
|
return (0, chunk_stream_1.streamFiles)(this.context.bee, files, batchId, onUploadProgress, options, this.context.getRequestOptionsForCall(requestOptions));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
@@ -128,7 +128,7 @@ class Collection {
|
|
|
128
128
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
129
129
|
*/
|
|
130
130
|
async streamFromDirectory(postageBatchId, dir, onUploadProgress, options, requestOptions) {
|
|
131
|
-
const batchId = new
|
|
131
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
132
132
|
return (0, chunk_stream_1.streamDirectory)(this.context.bee, dir, batchId, onUploadProgress, options, this.context.getRequestOptionsForCall(requestOptions));
|
|
133
133
|
}
|
|
134
134
|
/**
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Connectivity = void 0;
|
|
37
|
-
const
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
38
38
|
const api = __importStar(require("../api/connectivity"));
|
|
39
39
|
/**
|
|
40
40
|
* Peer, topology and network connectivity operations.
|
|
@@ -116,7 +116,7 @@ class Connectivity {
|
|
|
116
116
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
117
117
|
*/
|
|
118
118
|
async removePeer(peer, requestOptions) {
|
|
119
|
-
const address = new
|
|
119
|
+
const address = new core_sdk_1.PeerAddress(peer);
|
|
120
120
|
return api.removePeer(this.context.getRequestOptionsForCall(requestOptions), address);
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
@@ -134,7 +134,7 @@ class Connectivity {
|
|
|
134
134
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
135
135
|
*/
|
|
136
136
|
async ping(peer, requestOptions) {
|
|
137
|
-
const address = new
|
|
137
|
+
const address = new core_sdk_1.PeerAddress(peer);
|
|
138
138
|
return api.ping(this.context.getRequestOptionsForCall(requestOptions), address);
|
|
139
139
|
}
|
|
140
140
|
}
|
package/dist/cjs/modules/data.js
CHANGED
|
@@ -34,12 +34,12 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Data = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
38
|
+
const bytes = __importStar(require("../api/bytes"));
|
|
39
|
+
const stewardship = __importStar(require("../api/stewardship"));
|
|
37
40
|
const resource_locator_1 = require("../utils/resource-locator");
|
|
38
41
|
const schema_1 = require("../utils/schema");
|
|
39
42
|
const type_1 = require("../utils/type");
|
|
40
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
41
|
-
const bytes = __importStar(require("../api/bytes"));
|
|
42
|
-
const stewardship = __importStar(require("../api/stewardship"));
|
|
43
43
|
/**
|
|
44
44
|
* Raw data operations backed by the `/bytes` endpoint.
|
|
45
45
|
*
|
|
@@ -60,7 +60,7 @@ class Data {
|
|
|
60
60
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
61
61
|
*/
|
|
62
62
|
async upload(postageBatchId, data, options, requestOptions) {
|
|
63
|
-
const batchId = new
|
|
63
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
64
64
|
(0, type_1.assertData)(data);
|
|
65
65
|
if (options) {
|
|
66
66
|
options = schema_1.RedundantUploadOptionsSchema.parse(options);
|
|
@@ -102,7 +102,7 @@ class Data {
|
|
|
102
102
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
103
103
|
*/
|
|
104
104
|
async probe(reference, requestOptions) {
|
|
105
|
-
const ref = new
|
|
105
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
106
106
|
return bytes.head(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
107
107
|
}
|
|
108
108
|
/**
|
|
@@ -112,7 +112,7 @@ class Data {
|
|
|
112
112
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
113
113
|
*/
|
|
114
114
|
async isRetrievable(reference, requestOptions) {
|
|
115
|
-
const ref = new
|
|
115
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
116
116
|
return stewardship.isRetrievable(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
117
117
|
}
|
|
118
118
|
}
|
package/dist/cjs/modules/feed.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Feed = void 0;
|
|
4
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
4
5
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
6
|
const feed_1 = require("../api/feed");
|
|
6
7
|
const feed_2 = require("../feed");
|
|
7
8
|
const retrievable_1 = require("../feed/retrievable");
|
|
8
9
|
const schema_1 = require("../utils/schema");
|
|
9
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
10
10
|
/**
|
|
11
11
|
* Feed operations.
|
|
12
12
|
*
|
|
@@ -24,7 +24,7 @@ class Feed {
|
|
|
24
24
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
25
25
|
*/
|
|
26
26
|
makeReader(topic, owner, requestOptions) {
|
|
27
|
-
return (0, feed_2.makeFeedReader)(this.context.getRequestOptionsForCall(requestOptions), new
|
|
27
|
+
return (0, feed_2.makeFeedReader)(this.context.getRequestOptionsForCall(requestOptions), new core_sdk_1.Topic(topic), new core_sdk_1.EthAddress(owner));
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Makes a new feed writer for updating feeds.
|
|
@@ -34,11 +34,11 @@ class Feed {
|
|
|
34
34
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
35
35
|
*/
|
|
36
36
|
makeWriter(topic, signer, requestOptions) {
|
|
37
|
-
const key = signer ? new
|
|
37
|
+
const key = signer ? new core_sdk_1.PrivateKey(signer) : this.context.signer;
|
|
38
38
|
if (!key) {
|
|
39
39
|
throw Error('No signer provided');
|
|
40
40
|
}
|
|
41
|
-
return (0, feed_2.makeFeedWriter)(this.context.getRequestOptionsForCall(requestOptions), new
|
|
41
|
+
return (0, feed_2.makeFeedWriter)(this.context.getRequestOptionsForCall(requestOptions), new core_sdk_1.Topic(topic), key);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Creates a feed manifest chunk and returns the reference to it.
|
|
@@ -50,9 +50,9 @@ class Feed {
|
|
|
50
50
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
51
51
|
*/
|
|
52
52
|
async createManifest(postageBatchId, topic, owner, options, requestOptions) {
|
|
53
|
-
const batchId = new
|
|
54
|
-
const feedTopic = new
|
|
55
|
-
const feedOwner = new
|
|
53
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
54
|
+
const feedTopic = new core_sdk_1.Topic(topic);
|
|
55
|
+
const feedOwner = new core_sdk_1.EthAddress(owner);
|
|
56
56
|
if (options) {
|
|
57
57
|
options = schema_1.UploadOptionsSchema.parse(options);
|
|
58
58
|
}
|
|
@@ -66,7 +66,7 @@ class Feed {
|
|
|
66
66
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
67
67
|
*/
|
|
68
68
|
async fetchLatestUpdate(topic, owner, requestOptions) {
|
|
69
|
-
return (0, feed_1.fetchLatestFeedUpdate)(this.context.getRequestOptionsForCall(requestOptions), new
|
|
69
|
+
return (0, feed_1.fetchLatestFeedUpdate)(this.context.getRequestOptionsForCall(requestOptions), new core_sdk_1.EthAddress(owner), new core_sdk_1.Topic(topic));
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Validates whether a feed is retrievable in the network.
|
|
@@ -78,8 +78,8 @@ class Feed {
|
|
|
78
78
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
79
79
|
*/
|
|
80
80
|
async isRetrievable(owner, topic, index, options, requestOptions) {
|
|
81
|
-
const feedOwner = new
|
|
82
|
-
const feedTopic = new
|
|
81
|
+
const feedOwner = new core_sdk_1.EthAddress(owner);
|
|
82
|
+
const feedTopic = new core_sdk_1.Topic(topic);
|
|
83
83
|
if (options) {
|
|
84
84
|
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
85
85
|
}
|
package/dist/cjs/modules/file.js
CHANGED
|
@@ -34,11 +34,11 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.File = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const file_1 = require("../utils/file");
|
|
38
39
|
const resource_locator_1 = require("../utils/resource-locator");
|
|
39
40
|
const schema_1 = require("../utils/schema");
|
|
40
41
|
const type_1 = require("../utils/type");
|
|
41
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
42
42
|
const api = __importStar(require("../api/bzz"));
|
|
43
43
|
/**
|
|
44
44
|
* Single-file operations backed by the `/bzz` endpoint.
|
|
@@ -61,7 +61,7 @@ class File {
|
|
|
61
61
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
62
62
|
*/
|
|
63
63
|
async upload(postageBatchId, data, name, options, requestOptions) {
|
|
64
|
-
const batchId = new
|
|
64
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
65
65
|
(0, type_1.assertFileData)(data);
|
|
66
66
|
if (options) {
|
|
67
67
|
options = schema_1.FileUploadOptionsSchema.parse(options);
|
|
@@ -103,7 +103,7 @@ class File {
|
|
|
103
103
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
104
104
|
*/
|
|
105
105
|
async downloadReadable(reference, path = '', options, requestOptions) {
|
|
106
|
-
const ref = new
|
|
106
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
107
107
|
if (options) {
|
|
108
108
|
options = schema_1.DownloadOptionsSchema.parse(options);
|
|
109
109
|
}
|
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Grantee = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const api = __importStar(require("../api/grantee"));
|
|
38
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
39
39
|
/**
|
|
40
40
|
* Grantee (access control) operations.
|
|
41
41
|
*
|
|
@@ -53,8 +53,8 @@ class Grantee {
|
|
|
53
53
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
54
54
|
*/
|
|
55
55
|
async create(postageBatchId, grantees, requestOptions) {
|
|
56
|
-
const batchId = new
|
|
57
|
-
const publicKeys = grantees.map(x => new
|
|
56
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
57
|
+
const publicKeys = grantees.map(x => new core_sdk_1.PublicKey(x));
|
|
58
58
|
return api.createGrantees(this.context.getRequestOptionsForCall(requestOptions), batchId, publicKeys);
|
|
59
59
|
}
|
|
60
60
|
/**
|
|
@@ -64,7 +64,7 @@ class Grantee {
|
|
|
64
64
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
65
65
|
*/
|
|
66
66
|
async get(reference, requestOptions) {
|
|
67
|
-
const ref = new
|
|
67
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
68
68
|
return api.getGrantees(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
@@ -77,12 +77,12 @@ class Grantee {
|
|
|
77
77
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
78
78
|
*/
|
|
79
79
|
async patch(postageBatchId, reference, history, grantees, requestOptions) {
|
|
80
|
-
const batchId = new
|
|
81
|
-
const ref = new
|
|
82
|
-
const historyRef = new
|
|
80
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
81
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
82
|
+
const historyRef = new core_sdk_1.Reference(history);
|
|
83
83
|
const publicKeys = {
|
|
84
|
-
add: grantees.add?.map(x => new
|
|
85
|
-
revoke: grantees.revoke?.map(x => new
|
|
84
|
+
add: grantees.add?.map(x => new core_sdk_1.PublicKey(x)) ?? [],
|
|
85
|
+
revoke: grantees.revoke?.map(x => new core_sdk_1.PublicKey(x)) ?? [],
|
|
86
86
|
};
|
|
87
87
|
return api.patchGrantees(this.context.getRequestOptionsForCall(requestOptions), batchId, ref, historyRef, publicKeys);
|
|
88
88
|
}
|
|
@@ -39,15 +39,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
39
39
|
exports.Messaging = void 0;
|
|
40
40
|
const cafe_utility_1 = require("cafe-utility");
|
|
41
41
|
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
|
|
42
|
-
const
|
|
43
|
-
const soc_1 = require("../chunk/soc");
|
|
42
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
44
43
|
const pssApi = __importStar(require("../api/pss"));
|
|
45
|
-
const
|
|
44
|
+
const soc_1 = require("../chunk/soc");
|
|
46
45
|
const data_1 = require("../utils/data");
|
|
47
46
|
const error_1 = require("../utils/error");
|
|
48
47
|
const schema_1 = require("../utils/schema");
|
|
49
48
|
const type_1 = require("../utils/type");
|
|
50
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
51
49
|
const PSS_ENDPOINT = 'pss';
|
|
52
50
|
const GSOC_ENDPOINT = 'gsoc';
|
|
53
51
|
/**
|
|
@@ -74,9 +72,9 @@ class Messaging {
|
|
|
74
72
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
75
73
|
*/
|
|
76
74
|
async pssSend(postageBatchId, topic, target, data, recipient, requestOptions) {
|
|
77
|
-
const batchId = new
|
|
75
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
78
76
|
(0, type_1.assertData)(data);
|
|
79
|
-
const recipientKey = recipient ? new
|
|
77
|
+
const recipientKey = recipient ? new core_sdk_1.PublicKey(recipient) : undefined;
|
|
80
78
|
await pssApi.send(this.context.getRequestOptionsForCall(requestOptions), batchId, topic, target, data, recipientKey);
|
|
81
79
|
}
|
|
82
80
|
/**
|
|
@@ -95,7 +93,7 @@ class Messaging {
|
|
|
95
93
|
ws.onmessage = async (event) => {
|
|
96
94
|
const data = await (0, data_1.prepareWebsocketData)(event.data);
|
|
97
95
|
if (data.length) {
|
|
98
|
-
handler.onMessage(new
|
|
96
|
+
handler.onMessage(new core_sdk_1.Bytes(data), subscription);
|
|
99
97
|
}
|
|
100
98
|
};
|
|
101
99
|
ws.onerror = event => {
|
|
@@ -154,11 +152,11 @@ class Messaging {
|
|
|
154
152
|
* @param proximity
|
|
155
153
|
*/
|
|
156
154
|
gsocMine(targetOverlay, identifier, proximity = 12) {
|
|
157
|
-
const overlay = new
|
|
158
|
-
const id = new
|
|
155
|
+
const overlay = new core_sdk_1.PeerAddress(targetOverlay);
|
|
156
|
+
const id = new core_sdk_1.Identifier(identifier);
|
|
159
157
|
const start = 0xb33n;
|
|
160
158
|
for (let i = 0n; i < 0xffffn; i++) {
|
|
161
|
-
const signer = new
|
|
159
|
+
const signer = new core_sdk_1.PrivateKey((0, core_sdk_1.numberToUint256)(start + i, 'BE'));
|
|
162
160
|
const socAddress = (0, soc_1.makeSOCAddress)(id, signer.publicKey().address());
|
|
163
161
|
// TODO: test the significance of the hardcoded 256
|
|
164
162
|
const actualProximity = 256 - cafe_utility_1.Binary.proximity(socAddress.toUint8Array(), overlay.toUint8Array());
|
|
@@ -181,10 +179,10 @@ class Messaging {
|
|
|
181
179
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
182
180
|
*/
|
|
183
181
|
async gsocSend(postageBatchId, signer, identifier, data, options, requestOptions) {
|
|
184
|
-
const batchId = new
|
|
185
|
-
const key = new
|
|
186
|
-
const id = new
|
|
187
|
-
const cac = (0,
|
|
182
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
183
|
+
const key = new core_sdk_1.PrivateKey(signer);
|
|
184
|
+
const id = new core_sdk_1.Identifier(identifier);
|
|
185
|
+
const cac = (0, core_sdk_1.makeContentAddressedChunk)(data);
|
|
188
186
|
const soc = cac.toSingleOwnerChunk(id, key);
|
|
189
187
|
return (0, soc_1.uploadSingleOwnerChunk)(this.context.getRequestOptionsForCall(requestOptions), soc, batchId, options);
|
|
190
188
|
}
|
|
@@ -198,8 +196,8 @@ class Messaging {
|
|
|
198
196
|
* @param handler
|
|
199
197
|
*/
|
|
200
198
|
gsocSubscribe(address, identifier, handler) {
|
|
201
|
-
const ethAddress = new
|
|
202
|
-
const id = new
|
|
199
|
+
const ethAddress = new core_sdk_1.EthAddress(address);
|
|
200
|
+
const id = new core_sdk_1.Identifier(identifier);
|
|
203
201
|
handler = schema_1.GsocMessageHandlerSchema.parse(handler);
|
|
204
202
|
const socAddress = (0, soc_1.makeSOCAddress)(id, ethAddress);
|
|
205
203
|
const ws = this.openWebSocket(`${GSOC_ENDPOINT}/subscribe/${socAddress.toHex()}`);
|
|
@@ -208,7 +206,7 @@ class Messaging {
|
|
|
208
206
|
ws.onmessage = async (event) => {
|
|
209
207
|
const data = await (0, data_1.prepareWebsocketData)(event.data);
|
|
210
208
|
if (data.length) {
|
|
211
|
-
handler.onMessage(new
|
|
209
|
+
handler.onMessage(new core_sdk_1.Bytes(data), subscription);
|
|
212
210
|
}
|
|
213
211
|
};
|
|
214
212
|
ws.onerror = event => {
|
package/dist/cjs/modules/pin.js
CHANGED
|
@@ -34,9 +34,9 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Pin = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const pinApi = __importStar(require("../api/pin"));
|
|
38
39
|
const stewardshipApi = __importStar(require("../api/stewardship"));
|
|
39
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
40
40
|
/**
|
|
41
41
|
* Local pinning operations.
|
|
42
42
|
*
|
|
@@ -53,7 +53,7 @@ class Pin {
|
|
|
53
53
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
54
54
|
*/
|
|
55
55
|
async add(reference, requestOptions) {
|
|
56
|
-
const ref = new
|
|
56
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
57
57
|
await pinApi.pin(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
@@ -63,7 +63,7 @@ class Pin {
|
|
|
63
63
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
64
64
|
*/
|
|
65
65
|
async remove(reference, requestOptions) {
|
|
66
|
-
const ref = new
|
|
66
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
67
67
|
await pinApi.unpin(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -81,7 +81,7 @@ class Pin {
|
|
|
81
81
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
82
82
|
*/
|
|
83
83
|
async get(reference, requestOptions) {
|
|
84
|
-
const ref = new
|
|
84
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
85
85
|
return pinApi.getPin(this.context.getRequestOptionsForCall(requestOptions), ref);
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
@@ -92,8 +92,8 @@ class Pin {
|
|
|
92
92
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
93
93
|
*/
|
|
94
94
|
async reuploadData(postageBatchId, reference, requestOptions) {
|
|
95
|
-
const batchId = new
|
|
96
|
-
const ref = new
|
|
95
|
+
const batchId = new core_sdk_1.BatchId(postageBatchId);
|
|
96
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
97
97
|
await stewardshipApi.reupload(this.context.getRequestOptionsForCall(requestOptions), batchId, ref);
|
|
98
98
|
}
|
|
99
99
|
}
|
|
@@ -34,7 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Settlement = void 0;
|
|
37
|
-
const
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
38
38
|
const api = __importStar(require("../api/settlement"));
|
|
39
39
|
/**
|
|
40
40
|
* Settlement operations. Related to the bandwidth incentives and the chequebook.
|
|
@@ -52,7 +52,7 @@ class Settlement {
|
|
|
52
52
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
53
53
|
*/
|
|
54
54
|
async get(address, requestOptions) {
|
|
55
|
-
const peer = new
|
|
55
|
+
const peer = new core_sdk_1.PeerAddress(address);
|
|
56
56
|
return api.getSettlements(this.context.getRequestOptionsForCall(requestOptions), peer);
|
|
57
57
|
}
|
|
58
58
|
/**
|
package/dist/cjs/modules/soc.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Soc = void 0;
|
|
4
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
4
5
|
const soc_1 = require("../chunk/soc");
|
|
5
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
6
6
|
/**
|
|
7
7
|
* Single owner chunk (SOC) reader/writer operations.
|
|
8
8
|
*
|
|
@@ -19,7 +19,7 @@ class Soc {
|
|
|
19
19
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
20
20
|
*/
|
|
21
21
|
makeReader(ownerAddress, requestOptions) {
|
|
22
|
-
const owner = new
|
|
22
|
+
const owner = new core_sdk_1.EthAddress(ownerAddress);
|
|
23
23
|
return {
|
|
24
24
|
owner,
|
|
25
25
|
download: soc_1.downloadSingleOwnerChunk.bind(null, this.context.getRequestOptionsForCall(requestOptions), owner),
|
|
@@ -32,7 +32,7 @@ class Soc {
|
|
|
32
32
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
33
33
|
*/
|
|
34
34
|
makeWriter(signer, requestOptions) {
|
|
35
|
-
const key = signer ? new
|
|
35
|
+
const key = signer ? new core_sdk_1.PrivateKey(signer) : this.context.signer;
|
|
36
36
|
if (!key) {
|
|
37
37
|
throw Error('No signer provided');
|
|
38
38
|
}
|
|
@@ -34,6 +34,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Stamp = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const cafe_utility_1 = require("cafe-utility");
|
|
38
39
|
const zod_1 = require("zod");
|
|
39
40
|
const types_1 = require("../types");
|
|
@@ -41,7 +42,6 @@ const error_1 = require("../utils/error");
|
|
|
41
42
|
const schema_1 = require("../utils/schema");
|
|
42
43
|
const stamps_1 = require("../utils/stamps");
|
|
43
44
|
const type_1 = require("../utils/type");
|
|
44
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
45
45
|
const stampApi = __importStar(require("../api/stamp"));
|
|
46
46
|
const batchesApi = __importStar(require("../api/batches"));
|
|
47
47
|
/**
|
|
@@ -90,7 +90,7 @@ class Stamp {
|
|
|
90
90
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
91
91
|
*/
|
|
92
92
|
async updateLabel(postageBatchId, label, requestOptions) {
|
|
93
|
-
const id = new
|
|
93
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
94
94
|
await stampApi.updateLabel(this.context.getRequestOptionsForCall(requestOptions), id, label);
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
@@ -115,7 +115,7 @@ class Stamp {
|
|
|
115
115
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
116
116
|
*/
|
|
117
117
|
async topUp(postageBatchId, amount, requestOptions) {
|
|
118
|
-
const id = new
|
|
118
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
119
119
|
const amountString = (0, type_1.asNumberString)(amount, { min: 1n, name: 'amount' });
|
|
120
120
|
return stampApi.topUpBatch(this.context.getRequestOptionsForCall(requestOptions), id, amountString);
|
|
121
121
|
}
|
|
@@ -127,7 +127,7 @@ class Stamp {
|
|
|
127
127
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
128
128
|
*/
|
|
129
129
|
async dilute(postageBatchId, depth, requestOptions) {
|
|
130
|
-
const id = new
|
|
130
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
131
131
|
const depthNumber = zod_1.z.number().int().min(18).max(255).parse(depth);
|
|
132
132
|
return stampApi.diluteBatch(this.context.getRequestOptionsForCall(requestOptions), id, depthNumber);
|
|
133
133
|
}
|
|
@@ -140,7 +140,7 @@ class Stamp {
|
|
|
140
140
|
* @param erasureCodeLevel Assume that uploads with this postage batch are erasure coded, which skews the capacity.
|
|
141
141
|
*/
|
|
142
142
|
async get(postageBatchId, requestOptions, encryption, erasureCodeLevel) {
|
|
143
|
-
const id = new
|
|
143
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
144
144
|
return stampApi.getPostageBatch(this.context.getRequestOptionsForCall(requestOptions), id, encryption, erasureCodeLevel);
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
@@ -150,7 +150,7 @@ class Stamp {
|
|
|
150
150
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
151
151
|
*/
|
|
152
152
|
async getGlobal(postageBatchId, requestOptions) {
|
|
153
|
-
const id = new
|
|
153
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
154
154
|
return batchesApi.getGlobalPostageBatch(this.context.getRequestOptionsForCall(requestOptions), id);
|
|
155
155
|
}
|
|
156
156
|
/**
|
|
@@ -160,7 +160,7 @@ class Stamp {
|
|
|
160
160
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
161
161
|
*/
|
|
162
162
|
async getBuckets(postageBatchId, requestOptions) {
|
|
163
|
-
const id = new
|
|
163
|
+
const id = new core_sdk_1.BatchId(postageBatchId);
|
|
164
164
|
return stampApi.getPostageBatchBuckets(this.context.getRequestOptionsForCall(requestOptions), id);
|
|
165
165
|
}
|
|
166
166
|
/**
|
package/dist/cjs/modules/tag.js
CHANGED
|
@@ -34,10 +34,10 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Tag = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const api = __importStar(require("../api/tag"));
|
|
38
39
|
const schema_1 = require("../utils/schema");
|
|
39
40
|
const type_1 = require("../utils/type");
|
|
40
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
41
41
|
/**
|
|
42
42
|
* Tag operations for tracking upload and synchronization progress.
|
|
43
43
|
*
|
|
@@ -95,7 +95,7 @@ class Tag {
|
|
|
95
95
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
96
96
|
*/
|
|
97
97
|
async update(tagUid, reference, requestOptions) {
|
|
98
|
-
const ref = new
|
|
98
|
+
const ref = new core_sdk_1.Reference(reference);
|
|
99
99
|
const uid = (0, type_1.makeTagUid)(tagUid);
|
|
100
100
|
await api.updateTag(this.context.getRequestOptionsForCall(requestOptions), uid, ref);
|
|
101
101
|
}
|
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Transaction = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const type_1 = require("../utils/type");
|
|
38
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
39
39
|
const api = __importStar(require("../api/transaction"));
|
|
40
40
|
/**
|
|
41
41
|
* Pending transaction operations for the Bee node's `/transactions` queue.
|
|
@@ -61,7 +61,7 @@ class Transaction {
|
|
|
61
61
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
62
62
|
*/
|
|
63
63
|
async get(transactionHash, requestOptions) {
|
|
64
|
-
const hash = new
|
|
64
|
+
const hash = new core_sdk_1.TransactionId(transactionHash);
|
|
65
65
|
return api.getTransaction(this.context.getRequestOptionsForCall(requestOptions), hash);
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -73,7 +73,7 @@ class Transaction {
|
|
|
73
73
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
74
74
|
*/
|
|
75
75
|
async rebroadcast(transactionHash, requestOptions) {
|
|
76
|
-
const hash = new
|
|
76
|
+
const hash = new core_sdk_1.TransactionId(transactionHash);
|
|
77
77
|
return api.rebroadcastTransaction(this.context.getRequestOptionsForCall(requestOptions), hash);
|
|
78
78
|
}
|
|
79
79
|
/**
|
|
@@ -84,7 +84,7 @@ class Transaction {
|
|
|
84
84
|
* @param requestOptions Options for making requests, such as timeouts, custom HTTP agents, headers, etc.
|
|
85
85
|
*/
|
|
86
86
|
async cancel(transactionHash, gasPrice, requestOptions) {
|
|
87
|
-
const hash = new
|
|
87
|
+
const hash = new core_sdk_1.TransactionId(transactionHash);
|
|
88
88
|
const gasPriceString = gasPrice ? (0, type_1.asNumberString)(gasPrice, { min: 0n, name: 'gasPrice' }) : undefined;
|
|
89
89
|
return api.cancelTransaction(this.context.getRequestOptionsForCall(requestOptions), hash, gasPriceString);
|
|
90
90
|
}
|
|
@@ -34,8 +34,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.Wallet = void 0;
|
|
37
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
37
38
|
const tokens_1 = require("../utils/tokens");
|
|
38
|
-
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
39
39
|
const api = __importStar(require("../api/wallet"));
|
|
40
40
|
/**
|
|
41
41
|
* Node wallet operations (balances and external withdrawals).
|
|
@@ -63,7 +63,7 @@ class Wallet {
|
|
|
63
63
|
*/
|
|
64
64
|
async withdrawBZZ(amount, address, requestOptions) {
|
|
65
65
|
const bzz = amount instanceof tokens_1.BZZ ? amount : tokens_1.BZZ.fromPLUR(amount);
|
|
66
|
-
const ethAddress = new
|
|
66
|
+
const ethAddress = new core_sdk_1.EthAddress(address);
|
|
67
67
|
return api.withdrawBZZ(this.context.getRequestOptionsForCall(requestOptions), bzz, ethAddress);
|
|
68
68
|
}
|
|
69
69
|
/**
|
|
@@ -75,7 +75,7 @@ class Wallet {
|
|
|
75
75
|
*/
|
|
76
76
|
async withdrawDAI(amount, address, requestOptions) {
|
|
77
77
|
const dai = amount instanceof tokens_1.DAI ? amount : tokens_1.DAI.fromWei(amount);
|
|
78
|
-
const ethAddress = new
|
|
78
|
+
const ethAddress = new core_sdk_1.EthAddress(address);
|
|
79
79
|
return api.withdrawDAI(this.context.getRequestOptionsForCall(requestOptions), dai, ethAddress);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TransactionHashResponse = exports.GetLastChequesResponse = exports.GetLastChequesForPeerResponse = exports.GetLastCashoutActionResponse = exports.GetChequebookBalanceResponse = exports.GetChequebookAddressResponse = void 0;
|
|
4
|
+
const core_sdk_1 = require("@ethersphere/core-sdk");
|
|
4
5
|
const zod_1 = require("zod");
|
|
5
6
|
const tokens_1 = require("../../utils/tokens");
|
|
6
7
|
const type_1 = require("../../utils/type");
|
|
7
|
-
const typed_bytes_1 = require("../../utils/typed-bytes");
|
|
8
8
|
const ChequeSchema = zod_1.z.object({
|
|
9
|
-
beneficiary: zod_1.z.string().transform(s => new
|
|
10
|
-
chequebook: zod_1.z.string().transform(s => new
|
|
9
|
+
beneficiary: zod_1.z.string().transform(s => new core_sdk_1.EthAddress(s)),
|
|
10
|
+
chequebook: zod_1.z.string().transform(s => new core_sdk_1.EthAddress(s)),
|
|
11
11
|
payout: zod_1.z.string().transform(s => tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(s, { name: 'payout' }))),
|
|
12
12
|
});
|
|
13
13
|
const CashoutResultSchema = zod_1.z.object({
|
|
@@ -16,7 +16,7 @@ const CashoutResultSchema = zod_1.z.object({
|
|
|
16
16
|
bounced: zod_1.z.boolean(),
|
|
17
17
|
});
|
|
18
18
|
exports.GetChequebookAddressResponse = zod_1.z.object({
|
|
19
|
-
chequebookAddress: zod_1.z.string().transform(s => new
|
|
19
|
+
chequebookAddress: zod_1.z.string().transform(s => new core_sdk_1.EthAddress(s)),
|
|
20
20
|
});
|
|
21
21
|
exports.GetChequebookBalanceResponse = zod_1.z.object({
|
|
22
22
|
availableBalance: zod_1.z.string().transform(s => tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(s, { name: 'availableBalance' }))),
|
|
@@ -45,5 +45,5 @@ exports.GetLastChequesResponse = zod_1.z.object({
|
|
|
45
45
|
})),
|
|
46
46
|
});
|
|
47
47
|
exports.TransactionHashResponse = zod_1.z.object({
|
|
48
|
-
transactionHash: zod_1.z.string().transform(s => new
|
|
48
|
+
transactionHash: zod_1.z.string().transform(s => new core_sdk_1.TransactionId(s)),
|
|
49
49
|
});
|