@upcoming/bee-js 9.9.1 → 11.1.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 +2 -2
- package/dist/cjs/bee.js +881 -370
- package/dist/cjs/chunk/bmt.js +1 -2
- package/dist/cjs/chunk/cac.js +27 -32
- package/dist/cjs/chunk/soc.js +39 -31
- package/dist/cjs/feed/identifier.js +1 -2
- package/dist/cjs/feed/index.js +29 -19
- package/dist/cjs/feed/retrievable.js +1 -2
- package/dist/cjs/index.js +17 -7
- package/dist/cjs/manifest/manifest.js +19 -2
- 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 +9 -10
- 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 +24 -60
- 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 +11 -6
- package/dist/cjs/utils/bytes.js +23 -3
- package/dist/cjs/utils/chunk-size.js +1 -2
- package/dist/cjs/utils/chunk-stream.browser.js +30 -6
- 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/duration.js +27 -1
- package/dist/cjs/utils/expose.js +4 -1
- package/dist/cjs/utils/file.js +2 -3
- package/dist/cjs/utils/headers.js +2 -3
- package/dist/cjs/utils/http.js +25 -5
- package/dist/cjs/utils/pss.js +1 -2
- package/dist/cjs/utils/redundancy.js +3 -4
- package/dist/cjs/utils/size.js +25 -0
- package/dist/cjs/utils/stamps.js +60 -11
- 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 +37 -25
- package/dist/cjs/utils/url.js +3 -4
- package/dist/cjs/utils/workaround.js +7 -5
- package/dist/index.browser.min.js +1 -1
- package/dist/index.browser.min.js.map +1 -1
- package/dist/mjs/bee.js +864 -366
- package/dist/mjs/chunk/cac.js +21 -30
- package/dist/mjs/chunk/soc.js +16 -17
- package/dist/mjs/feed/index.js +7 -6
- package/dist/mjs/manifest/manifest.js +19 -2
- package/dist/mjs/modules/debug/chequebook.js +2 -2
- package/dist/mjs/modules/debug/stamps.js +38 -93
- package/dist/mjs/modules/debug/states.js +3 -0
- package/dist/mjs/modules/debug/status.js +1 -1
- package/dist/mjs/types/index.js +8 -3
- package/dist/mjs/utils/bytes.js +19 -2
- package/dist/mjs/utils/chunk-stream.browser.js +29 -5
- package/dist/mjs/utils/duration.js +27 -1
- package/dist/mjs/utils/expose.js +1 -1
- package/dist/mjs/utils/http.js +25 -3
- package/dist/mjs/utils/size.js +25 -0
- package/dist/mjs/utils/stamps.js +48 -0
- package/dist/mjs/utils/type.js +8 -1
- package/dist/mjs/utils/workaround.js +5 -2
- package/dist/types/bee.d.ts +756 -252
- package/dist/types/chunk/cac.d.ts +27 -13
- package/dist/types/chunk/soc.d.ts +43 -11
- package/dist/types/index.d.ts +3 -0
- package/dist/types/modules/bzz.d.ts +0 -1
- package/dist/types/modules/debug/stamps.d.ts +2 -2
- 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 +2 -1
- package/dist/types/types/index.d.ts +53 -6
- package/dist/types/utils/constants.d.ts +3 -3
- package/dist/types/utils/duration.d.ts +24 -0
- package/dist/types/utils/error.d.ts +2 -2
- package/dist/types/utils/expose.d.ts +1 -1
- package/dist/types/utils/size.d.ts +23 -0
- package/dist/types/utils/stamps.d.ts +15 -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 +10 -13
|
@@ -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");
|
|
@@ -20,10 +27,9 @@ async function getChequebookAddress(requestOptions) {
|
|
|
20
27
|
});
|
|
21
28
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
22
29
|
return {
|
|
23
|
-
chequebookAddress: cafe_utility_1.Types.asString(body.chequebookAddress, { name: 'chequebookAddress' }),
|
|
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;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getStake = getStake;
|
|
4
|
+
exports.getWithdrawableStake = getWithdrawableStake;
|
|
5
|
+
exports.withdrawSurplusStake = withdrawSurplusStake;
|
|
6
|
+
exports.migrateStake = migrateStake;
|
|
7
|
+
exports.stake = stake;
|
|
8
|
+
exports.getRedistributionState = getRedistributionState;
|
|
4
9
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
10
|
const headers_1 = require("../../utils/headers");
|
|
6
11
|
const http_1 = require("../../utils/http");
|
|
@@ -23,7 +28,6 @@ async function getStake(requestOptions) {
|
|
|
23
28
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
24
29
|
return tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.stakedAmount, { name: 'stakedAmount' }));
|
|
25
30
|
}
|
|
26
|
-
exports.getStake = getStake;
|
|
27
31
|
/**
|
|
28
32
|
* Gets the amount of withdrawable staked BZZ
|
|
29
33
|
*
|
|
@@ -38,7 +42,6 @@ async function getWithdrawableStake(requestOptions) {
|
|
|
38
42
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
39
43
|
return tokens_1.BZZ.fromPLUR((0, type_1.asNumberString)(body.withdrawableAmount, { name: 'withdrawableAmount' }));
|
|
40
44
|
}
|
|
41
|
-
exports.getWithdrawableStake = getWithdrawableStake;
|
|
42
45
|
async function withdrawSurplusStake(requestOptions) {
|
|
43
46
|
const response = await (0, http_1.http)(requestOptions, {
|
|
44
47
|
method: 'delete',
|
|
@@ -48,7 +51,6 @@ async function withdrawSurplusStake(requestOptions) {
|
|
|
48
51
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
49
52
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asHexString(body.txHash, { name: 'txHash' }));
|
|
50
53
|
}
|
|
51
|
-
exports.withdrawSurplusStake = withdrawSurplusStake;
|
|
52
54
|
async function migrateStake(requestOptions) {
|
|
53
55
|
const response = await (0, http_1.http)(requestOptions, {
|
|
54
56
|
method: 'delete',
|
|
@@ -58,7 +60,6 @@ async function migrateStake(requestOptions) {
|
|
|
58
60
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
59
61
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asHexString(body.txHash, { name: 'txHash' }));
|
|
60
62
|
}
|
|
61
|
-
exports.migrateStake = migrateStake;
|
|
62
63
|
/**
|
|
63
64
|
* Stake given amount of tokens.
|
|
64
65
|
*
|
|
@@ -75,7 +76,6 @@ async function stake(requestOptions, amount, options) {
|
|
|
75
76
|
const body = cafe_utility_1.Types.asObject(repsonse.data, { name: 'response.data' });
|
|
76
77
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asHexString(body.txHash, { name: 'txHash' }));
|
|
77
78
|
}
|
|
78
|
-
exports.stake = stake;
|
|
79
79
|
/**
|
|
80
80
|
* Get current status of node in redistribution game
|
|
81
81
|
*
|
|
@@ -106,4 +106,3 @@ async function getRedistributionState(requestOptions) {
|
|
|
106
106
|
isHealthy: cafe_utility_1.Types.asBoolean(body.isHealthy, { name: 'isHealthy' }),
|
|
107
107
|
};
|
|
108
108
|
}
|
|
109
|
-
exports.getRedistributionState = getRedistributionState;
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getGlobalPostageBatches = getGlobalPostageBatches;
|
|
4
|
+
exports.getAllPostageBatches = getAllPostageBatches;
|
|
5
|
+
exports.getPostageBatch = getPostageBatch;
|
|
6
|
+
exports.getPostageBatchBuckets = getPostageBatchBuckets;
|
|
7
|
+
exports.createPostageBatch = createPostageBatch;
|
|
8
|
+
exports.topUpBatch = topUpBatch;
|
|
9
|
+
exports.diluteBatch = diluteBatch;
|
|
4
10
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
|
-
const duration_1 = require("../../utils/duration");
|
|
6
11
|
const http_1 = require("../../utils/http");
|
|
7
|
-
const size_1 = require("../../utils/size");
|
|
8
12
|
const stamps_1 = require("../../utils/stamps");
|
|
9
13
|
const type_1 = require("../../utils/type");
|
|
10
14
|
const typed_bytes_1 = require("../../utils/typed-bytes");
|
|
11
|
-
const workaround_1 = require("../../utils/workaround");
|
|
12
15
|
const STAMPS_ENDPOINT = 'stamps';
|
|
13
16
|
const BATCHES_ENDPOINT = 'batches';
|
|
14
17
|
async function getGlobalPostageBatches(requestOptions) {
|
|
@@ -30,7 +33,6 @@ async function getGlobalPostageBatches(requestOptions) {
|
|
|
30
33
|
value: (0, type_1.asNumberString)(x.value, { name: 'value' }),
|
|
31
34
|
}));
|
|
32
35
|
}
|
|
33
|
-
exports.getGlobalPostageBatches = getGlobalPostageBatches;
|
|
34
36
|
async function getAllPostageBatches(requestOptions) {
|
|
35
37
|
const response = await (0, http_1.http)(requestOptions, {
|
|
36
38
|
method: 'get',
|
|
@@ -39,65 +41,17 @@ async function getAllPostageBatches(requestOptions) {
|
|
|
39
41
|
});
|
|
40
42
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
41
43
|
const stamps = cafe_utility_1.Types.asArray(body.stamps, { name: 'stamps' }).map(x => cafe_utility_1.Types.asObject(x, { name: 'stamp' }));
|
|
42
|
-
return stamps.map(x =>
|
|
43
|
-
const utilization = cafe_utility_1.Types.asNumber(x.utilization, { name: 'utilization' });
|
|
44
|
-
const depth = cafe_utility_1.Types.asNumber(x.depth, { name: 'depth' });
|
|
45
|
-
const bucketDepth = cafe_utility_1.Types.asNumber(x.bucketDepth, { name: 'bucketDepth' });
|
|
46
|
-
const usage = (0, stamps_1.getStampUsage)(utilization, depth, bucketDepth);
|
|
47
|
-
const batchTTL = (0, workaround_1.normalizeBatchTTL)(cafe_utility_1.Types.asNumber(x.batchTTL, { name: 'batchTTL' }));
|
|
48
|
-
const duration = duration_1.Duration.fromSeconds(batchTTL);
|
|
49
|
-
return {
|
|
50
|
-
batchID: new typed_bytes_1.BatchId(cafe_utility_1.Types.asString(x.batchID, { name: 'batchID' })),
|
|
51
|
-
utilization,
|
|
52
|
-
usable: cafe_utility_1.Types.asBoolean(x.usable, { name: 'usable' }),
|
|
53
|
-
label: cafe_utility_1.Types.asEmptiableString(x.label, { name: 'label' }),
|
|
54
|
-
depth,
|
|
55
|
-
amount: (0, type_1.asNumberString)(x.amount, { name: 'amount' }),
|
|
56
|
-
bucketDepth,
|
|
57
|
-
blockNumber: cafe_utility_1.Types.asNumber(x.blockNumber, { name: 'blockNumber' }),
|
|
58
|
-
immutableFlag: cafe_utility_1.Types.asBoolean(x.immutableFlag, { name: 'immutableFlag' }),
|
|
59
|
-
usage,
|
|
60
|
-
usageText: `${Math.round(usage * 100)}%`,
|
|
61
|
-
size: size_1.Size.fromBytes((0, stamps_1.getStampEffectiveBytes)(depth)),
|
|
62
|
-
remainingSize: size_1.Size.fromBytes(Math.ceil((0, stamps_1.getStampEffectiveBytes)(depth) * (1 - usage))),
|
|
63
|
-
theoreticalSize: size_1.Size.fromBytes((0, stamps_1.getStampTheoreticalBytes)(depth)),
|
|
64
|
-
duration,
|
|
65
|
-
};
|
|
66
|
-
});
|
|
44
|
+
return stamps.map(x => (0, stamps_1.mapPostageBatch)(validateRawPostageBatch(x)));
|
|
67
45
|
}
|
|
68
|
-
|
|
69
|
-
async function getPostageBatch(requestOptions, postageBatchId) {
|
|
46
|
+
async function getPostageBatch(requestOptions, postageBatchId, encryption, erasureCodeLevel) {
|
|
70
47
|
const response = await (0, http_1.http)(requestOptions, {
|
|
71
48
|
method: 'get',
|
|
72
49
|
url: `${STAMPS_ENDPOINT}/${postageBatchId}`,
|
|
73
50
|
responseType: 'json',
|
|
74
51
|
});
|
|
75
52
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
76
|
-
|
|
77
|
-
const depth = cafe_utility_1.Types.asNumber(body.depth, { name: 'depth' });
|
|
78
|
-
const bucketDepth = cafe_utility_1.Types.asNumber(body.bucketDepth, { name: 'bucketDepth' });
|
|
79
|
-
const usage = (0, stamps_1.getStampUsage)(utilization, depth, bucketDepth);
|
|
80
|
-
const batchTTL = (0, workaround_1.normalizeBatchTTL)(cafe_utility_1.Types.asNumber(body.batchTTL, { name: 'batchTTL' }));
|
|
81
|
-
const duration = duration_1.Duration.fromSeconds(batchTTL);
|
|
82
|
-
return {
|
|
83
|
-
batchID: new typed_bytes_1.BatchId(cafe_utility_1.Types.asString(body.batchID, { name: 'batchID' })),
|
|
84
|
-
utilization,
|
|
85
|
-
usable: cafe_utility_1.Types.asBoolean(body.usable, { name: 'usable' }),
|
|
86
|
-
label: cafe_utility_1.Types.asEmptiableString(body.label, { name: 'label' }),
|
|
87
|
-
depth,
|
|
88
|
-
amount: (0, type_1.asNumberString)(body.amount, { name: 'amount' }),
|
|
89
|
-
bucketDepth,
|
|
90
|
-
blockNumber: cafe_utility_1.Types.asNumber(body.blockNumber, { name: 'blockNumber' }),
|
|
91
|
-
immutableFlag: cafe_utility_1.Types.asBoolean(body.immutableFlag, { name: 'immutableFlag' }),
|
|
92
|
-
usage,
|
|
93
|
-
usageText: `${Math.round(usage * 100)}%`,
|
|
94
|
-
size: size_1.Size.fromBytes((0, stamps_1.getStampEffectiveBytes)(depth)),
|
|
95
|
-
remainingSize: size_1.Size.fromBytes(Math.ceil((0, stamps_1.getStampEffectiveBytes)(depth) * (1 - usage))),
|
|
96
|
-
theoreticalSize: size_1.Size.fromBytes((0, stamps_1.getStampTheoreticalBytes)(depth)),
|
|
97
|
-
duration,
|
|
98
|
-
};
|
|
53
|
+
return (0, stamps_1.mapPostageBatch)(validateRawPostageBatch(body), encryption, erasureCodeLevel);
|
|
99
54
|
}
|
|
100
|
-
exports.getPostageBatch = getPostageBatch;
|
|
101
55
|
async function getPostageBatchBuckets(requestOptions, postageBatchId) {
|
|
102
56
|
const response = await (0, http_1.http)(requestOptions, {
|
|
103
57
|
method: 'get',
|
|
@@ -117,7 +71,6 @@ async function getPostageBatchBuckets(requestOptions, postageBatchId) {
|
|
|
117
71
|
})),
|
|
118
72
|
};
|
|
119
73
|
}
|
|
120
|
-
exports.getPostageBatchBuckets = getPostageBatchBuckets;
|
|
121
74
|
async function createPostageBatch(requestOptions, amount, depth, options) {
|
|
122
75
|
const headers = {};
|
|
123
76
|
if (options?.gasPrice) {
|
|
@@ -136,7 +89,6 @@ async function createPostageBatch(requestOptions, amount, depth, options) {
|
|
|
136
89
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
137
90
|
return new typed_bytes_1.BatchId(cafe_utility_1.Types.asString(body.batchID, { name: 'batchID' }));
|
|
138
91
|
}
|
|
139
|
-
exports.createPostageBatch = createPostageBatch;
|
|
140
92
|
async function topUpBatch(requestOptions, id, amount) {
|
|
141
93
|
const response = await (0, http_1.http)(requestOptions, {
|
|
142
94
|
method: 'patch',
|
|
@@ -146,7 +98,6 @@ async function topUpBatch(requestOptions, id, amount) {
|
|
|
146
98
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
147
99
|
return new typed_bytes_1.BatchId(cafe_utility_1.Types.asString(body.batchID, { name: 'batchID' }));
|
|
148
100
|
}
|
|
149
|
-
exports.topUpBatch = topUpBatch;
|
|
150
101
|
async function diluteBatch(requestOptions, id, depth) {
|
|
151
102
|
const response = await (0, http_1.http)(requestOptions, {
|
|
152
103
|
method: 'patch',
|
|
@@ -156,4 +107,17 @@ async function diluteBatch(requestOptions, id, depth) {
|
|
|
156
107
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
157
108
|
return new typed_bytes_1.BatchId(cafe_utility_1.Types.asString(body.batchID, { name: 'batchID' }));
|
|
158
109
|
}
|
|
159
|
-
|
|
110
|
+
function validateRawPostageBatch(raw) {
|
|
111
|
+
return {
|
|
112
|
+
amount: (0, type_1.asNumberString)(raw.amount, { name: 'amount' }),
|
|
113
|
+
batchID: cafe_utility_1.Types.asString(raw.batchID, { name: 'batchID' }),
|
|
114
|
+
batchTTL: cafe_utility_1.Types.asNumber(raw.batchTTL, { name: 'batchTTL' }),
|
|
115
|
+
bucketDepth: cafe_utility_1.Types.asNumber(raw.bucketDepth, { name: 'bucketDepth' }),
|
|
116
|
+
blockNumber: cafe_utility_1.Types.asNumber(raw.blockNumber, { name: 'blockNumber' }),
|
|
117
|
+
depth: cafe_utility_1.Types.asNumber(raw.depth, { name: 'depth' }),
|
|
118
|
+
immutableFlag: cafe_utility_1.Types.asBoolean(raw.immutableFlag, { name: 'immutableFlag' }),
|
|
119
|
+
label: cafe_utility_1.Types.asEmptiableString(raw.label, { name: 'label' }),
|
|
120
|
+
usable: cafe_utility_1.Types.asBoolean(raw.usable, { name: 'usable' }),
|
|
121
|
+
utilization: cafe_utility_1.Types.asNumber(raw.utilization, { name: 'utilization' }),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getReserveState = getReserveState;
|
|
4
|
+
exports.getChainState = getChainState;
|
|
5
|
+
exports.getWalletBalance = getWalletBalance;
|
|
6
|
+
exports.withdrawBZZ = withdrawBZZ;
|
|
7
|
+
exports.withdrawDAI = withdrawDAI;
|
|
4
8
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
9
|
const http_1 = require("../../utils/http");
|
|
6
10
|
const tokens_1 = require("../../utils/tokens");
|
|
@@ -26,9 +30,9 @@ async function getReserveState(requestOptions) {
|
|
|
26
30
|
commitment: cafe_utility_1.Types.asNumber(body.commitment, { name: 'commitment' }),
|
|
27
31
|
radius: cafe_utility_1.Types.asNumber(body.radius, { name: 'radius' }),
|
|
28
32
|
storageRadius: cafe_utility_1.Types.asNumber(body.storageRadius, { name: 'storageRadius' }),
|
|
33
|
+
reserveCapacityDoubling: cafe_utility_1.Types.asNumber(body.reserveCapacityDoubling, { name: 'reserveCapacityDoubling' }),
|
|
29
34
|
};
|
|
30
35
|
}
|
|
31
|
-
exports.getReserveState = getReserveState;
|
|
32
36
|
/**
|
|
33
37
|
* Get state of reserve
|
|
34
38
|
*
|
|
@@ -48,7 +52,6 @@ async function getChainState(requestOptions) {
|
|
|
48
52
|
currentPrice: (0, workaround_1.normalizeCurrentPrice)(cafe_utility_1.Types.asNumber(body.currentPrice, { name: 'currentPrice' })),
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
|
-
exports.getChainState = getChainState;
|
|
52
55
|
/**
|
|
53
56
|
* Get wallet balances for xDai and BZZ of the node
|
|
54
57
|
*
|
|
@@ -69,7 +72,6 @@ async function getWalletBalance(requestOptions) {
|
|
|
69
72
|
walletAddress: cafe_utility_1.Types.asString(body.walletAddress, { name: 'walletAddress' }),
|
|
70
73
|
};
|
|
71
74
|
}
|
|
72
|
-
exports.getWalletBalance = getWalletBalance;
|
|
73
75
|
async function withdrawBZZ(requestOptions, amount, address) {
|
|
74
76
|
const response = await (0, http_1.http)(requestOptions, {
|
|
75
77
|
method: 'post',
|
|
@@ -80,7 +82,6 @@ async function withdrawBZZ(requestOptions, amount, address) {
|
|
|
80
82
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
81
83
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
82
84
|
}
|
|
83
|
-
exports.withdrawBZZ = withdrawBZZ;
|
|
84
85
|
async function withdrawDAI(requestOptions, amount, address) {
|
|
85
86
|
const response = await (0, http_1.http)(requestOptions, {
|
|
86
87
|
method: 'post',
|
|
@@ -91,4 +92,3 @@ async function withdrawDAI(requestOptions, amount, address) {
|
|
|
91
92
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
92
93
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
93
94
|
}
|
|
94
|
-
exports.withdrawDAI = withdrawDAI;
|
|
@@ -3,12 +3,19 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.SUPPORTED_API_VERSION = exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT = void 0;
|
|
7
|
+
exports.getDebugStatus = getDebugStatus;
|
|
8
|
+
exports.getHealth = getHealth;
|
|
9
|
+
exports.getReadiness = getReadiness;
|
|
10
|
+
exports.getNodeInfo = getNodeInfo;
|
|
11
|
+
exports.isSupportedExactVersion = isSupportedExactVersion;
|
|
12
|
+
exports.isSupportedApiVersion = isSupportedApiVersion;
|
|
13
|
+
exports.getVersions = getVersions;
|
|
7
14
|
const cafe_utility_1 = require("cafe-utility");
|
|
8
15
|
const major_js_1 = __importDefault(require("semver/functions/major.js"));
|
|
9
16
|
const debug_1 = require("../../types/debug");
|
|
10
17
|
const http_1 = require("../../utils/http");
|
|
11
|
-
exports.SUPPORTED_BEE_VERSION_EXACT = '2.
|
|
18
|
+
exports.SUPPORTED_BEE_VERSION_EXACT = '2.7.0-6ddf9b45';
|
|
12
19
|
exports.SUPPORTED_BEE_VERSION = exports.SUPPORTED_BEE_VERSION_EXACT.split('-')[0];
|
|
13
20
|
exports.SUPPORTED_API_VERSION = '7.3.0';
|
|
14
21
|
const NODE_INFO_URL = 'node';
|
|
@@ -39,7 +46,6 @@ async function getDebugStatus(requestOptions) {
|
|
|
39
46
|
isWarmingUp: cafe_utility_1.Types.asBoolean(body.isWarmingUp, { name: 'isWarmingUp' }),
|
|
40
47
|
};
|
|
41
48
|
}
|
|
42
|
-
exports.getDebugStatus = getDebugStatus;
|
|
43
49
|
/**
|
|
44
50
|
* Get health of node
|
|
45
51
|
*
|
|
@@ -58,7 +64,6 @@ async function getHealth(requestOptions) {
|
|
|
58
64
|
status: cafe_utility_1.Types.asString(body.status, { name: 'status' }),
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
|
-
exports.getHealth = getHealth;
|
|
62
67
|
/**
|
|
63
68
|
* Get readiness of node
|
|
64
69
|
*
|
|
@@ -76,7 +81,6 @@ async function getReadiness(requestOptions) {
|
|
|
76
81
|
status: cafe_utility_1.Types.asString(body.status, { name: 'status' }),
|
|
77
82
|
};
|
|
78
83
|
}
|
|
79
|
-
exports.getReadiness = getReadiness;
|
|
80
84
|
/**
|
|
81
85
|
* Get information about Bee node
|
|
82
86
|
*
|
|
@@ -95,7 +99,6 @@ async function getNodeInfo(requestOptions) {
|
|
|
95
99
|
swapEnabled: cafe_utility_1.Types.asBoolean(body.swapEnabled, { name: 'swapEnabled' }),
|
|
96
100
|
};
|
|
97
101
|
}
|
|
98
|
-
exports.getNodeInfo = getNodeInfo;
|
|
99
102
|
/**
|
|
100
103
|
* Connects to a node and checks if its version matches with the one that bee-js supports.
|
|
101
104
|
*
|
|
@@ -108,7 +111,6 @@ async function isSupportedExactVersion(requestOptions) {
|
|
|
108
111
|
const { version } = await getHealth(requestOptions);
|
|
109
112
|
return version === exports.SUPPORTED_BEE_VERSION_EXACT;
|
|
110
113
|
}
|
|
111
|
-
exports.isSupportedExactVersion = isSupportedExactVersion;
|
|
112
114
|
/**
|
|
113
115
|
* Connects to a node and checks if its Main API versions matches with the one that bee-js supports.
|
|
114
116
|
*
|
|
@@ -120,7 +122,6 @@ async function isSupportedApiVersion(requestOptions) {
|
|
|
120
122
|
const { apiVersion } = await getHealth(requestOptions);
|
|
121
123
|
return (0, major_js_1.default)(apiVersion) === (0, major_js_1.default)(exports.SUPPORTED_API_VERSION);
|
|
122
124
|
}
|
|
123
|
-
exports.isSupportedApiVersion = isSupportedApiVersion;
|
|
124
125
|
/**
|
|
125
126
|
* Returns object with all versions specified by the connected Bee node (properties prefixed with `bee*`)
|
|
126
127
|
* and versions that bee-js supports (properties prefixed with `supported*`).
|
|
@@ -136,4 +137,3 @@ async function getVersions(requestOptions) {
|
|
|
136
137
|
beeApiVersion: apiVersion,
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
|
-
exports.getVersions = getVersions;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getAllTransactions = getAllTransactions;
|
|
4
|
+
exports.getTransaction = getTransaction;
|
|
5
|
+
exports.rebroadcastTransaction = rebroadcastTransaction;
|
|
6
|
+
exports.cancelTransaction = cancelTransaction;
|
|
4
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
8
|
const http_1 = require("../../utils/http");
|
|
6
9
|
const type_1 = require("../../utils/type");
|
|
@@ -20,7 +23,6 @@ async function getAllTransactions(requestOptions) {
|
|
|
20
23
|
const pendingTransactions = cafe_utility_1.Types.asArray(body.pendingTransactions, { name: 'pendingTransactions' });
|
|
21
24
|
return pendingTransactions.map(toTransaction);
|
|
22
25
|
}
|
|
23
|
-
exports.getAllTransactions = getAllTransactions;
|
|
24
26
|
/**
|
|
25
27
|
* Get information for specific pending transactions
|
|
26
28
|
*
|
|
@@ -35,7 +37,6 @@ async function getTransaction(requestOptions, transactionHash) {
|
|
|
35
37
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
36
38
|
return toTransaction(body);
|
|
37
39
|
}
|
|
38
|
-
exports.getTransaction = getTransaction;
|
|
39
40
|
function toTransaction(value) {
|
|
40
41
|
const object = cafe_utility_1.Types.asObject(value, { name: 'transaction' });
|
|
41
42
|
return {
|
|
@@ -65,7 +66,6 @@ async function rebroadcastTransaction(requestOptions, transactionHash) {
|
|
|
65
66
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
66
67
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
67
68
|
}
|
|
68
|
-
exports.rebroadcastTransaction = rebroadcastTransaction;
|
|
69
69
|
/**
|
|
70
70
|
* Cancel existing transaction
|
|
71
71
|
*
|
|
@@ -87,4 +87,3 @@ async function cancelTransaction(requestOptions, transactionHash, gasPrice) {
|
|
|
87
87
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
88
88
|
return new typed_bytes_1.TransactionId(cafe_utility_1.Types.asString(body.transactionHash, { name: 'transactionHash' }));
|
|
89
89
|
}
|
|
90
|
-
exports.cancelTransaction = cancelTransaction;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.postEnvelope =
|
|
3
|
+
exports.postEnvelope = postEnvelope;
|
|
4
4
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
5
|
const http_1 = require("../utils/http");
|
|
6
6
|
const ENVELOPE_ENDPOINT = 'envelope';
|
|
@@ -22,4 +22,3 @@ async function postEnvelope(requestOptions, postageBatchId, reference) {
|
|
|
22
22
|
batchId: postageBatchId,
|
|
23
23
|
};
|
|
24
24
|
}
|
|
25
|
-
exports.postEnvelope = postEnvelope;
|
package/dist/cjs/modules/feed.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.createFeedManifest = createFeedManifest;
|
|
4
|
+
exports.fetchLatestFeedUpdate = fetchLatestFeedUpdate;
|
|
5
|
+
exports.probeFeed = probeFeed;
|
|
4
6
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
7
|
const bytes_1 = require("../utils/bytes");
|
|
6
8
|
const error_1 = require("../utils/error");
|
|
@@ -27,7 +29,6 @@ async function createFeedManifest(requestOptions, owner, topic, stamp, options)
|
|
|
27
29
|
const body = cafe_utility_1.Types.asObject(response.data, { name: 'response.data' });
|
|
28
30
|
return new typed_bytes_1.Reference(cafe_utility_1.Types.asHexString(body.reference));
|
|
29
31
|
}
|
|
30
|
-
exports.createFeedManifest = createFeedManifest;
|
|
31
32
|
function readFeedUpdateHeaders(headers) {
|
|
32
33
|
const feedIndex = headers['swarm-feed-index'];
|
|
33
34
|
const feedIndexNext = headers['swarm-feed-index-next'];
|
|
@@ -66,7 +67,6 @@ async function fetchLatestFeedUpdate(requestOptions, owner, topic, options) {
|
|
|
66
67
|
...readFeedUpdateHeaders(response.headers),
|
|
67
68
|
};
|
|
68
69
|
}
|
|
69
|
-
exports.fetchLatestFeedUpdate = fetchLatestFeedUpdate;
|
|
70
70
|
async function probeFeed(requestOptions, owner, topic) {
|
|
71
71
|
const response = await (0, http_1.http)(requestOptions, {
|
|
72
72
|
responseType: 'arraybuffer',
|
|
@@ -77,4 +77,3 @@ async function probeFeed(requestOptions, owner, topic) {
|
|
|
77
77
|
});
|
|
78
78
|
return readFeedUpdateHeaders(response.headers);
|
|
79
79
|
}
|
|
80
|
-
exports.probeFeed = probeFeed;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getGrantees = getGrantees;
|
|
4
|
+
exports.createGrantees = createGrantees;
|
|
5
|
+
exports.patchGrantees = patchGrantees;
|
|
4
6
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
7
|
const headers_1 = require("../utils/headers");
|
|
6
8
|
const http_1 = require("../utils/http");
|
|
@@ -19,7 +21,6 @@ async function getGrantees(reference, requestOptions) {
|
|
|
19
21
|
grantees: body,
|
|
20
22
|
};
|
|
21
23
|
}
|
|
22
|
-
exports.getGrantees = getGrantees;
|
|
23
24
|
async function createGrantees(requestOptions, postageBatchId, grantees) {
|
|
24
25
|
const response = await (0, http_1.http)(requestOptions, {
|
|
25
26
|
method: 'post',
|
|
@@ -36,7 +37,6 @@ async function createGrantees(requestOptions, postageBatchId, grantees) {
|
|
|
36
37
|
historyref: new typed_bytes_1.Reference(cafe_utility_1.Types.asString(body.historyref, { name: 'historyref' })),
|
|
37
38
|
};
|
|
38
39
|
}
|
|
39
|
-
exports.createGrantees = createGrantees;
|
|
40
40
|
async function patchGrantees(postageBatchId, reference, historyRef, grantees, requestOptions) {
|
|
41
41
|
const response = await (0, http_1.http)(requestOptions, {
|
|
42
42
|
method: 'patch',
|
|
@@ -59,4 +59,3 @@ async function patchGrantees(postageBatchId, reference, historyRef, grantees, re
|
|
|
59
59
|
historyref: new typed_bytes_1.Reference(cafe_utility_1.Types.asString(body.historyref, { name: 'historyref' })),
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
|
-
exports.patchGrantees = patchGrantees;
|
package/dist/cjs/modules/gsoc.js
CHANGED
|
@@ -3,7 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.send = send;
|
|
7
|
+
exports.subscribe = subscribe;
|
|
7
8
|
const cafe_utility_1 = require("cafe-utility");
|
|
8
9
|
const isomorphic_ws_1 = __importDefault(require("isomorphic-ws"));
|
|
9
10
|
const soc_1 = require("../chunk/soc");
|
|
@@ -11,7 +12,6 @@ const endpoint = 'gsoc';
|
|
|
11
12
|
async function send(requestOptions, soc, stamp, options) {
|
|
12
13
|
return (0, soc_1.uploadSingleOwnerChunk)(requestOptions, soc, stamp, options);
|
|
13
14
|
}
|
|
14
|
-
exports.send = send;
|
|
15
15
|
function subscribe(url, reference, headers) {
|
|
16
16
|
const wsUrl = url.replace(/^http/i, 'ws');
|
|
17
17
|
if (cafe_utility_1.System.whereAmI() === 'browser') {
|
|
@@ -21,4 +21,3 @@ function subscribe(url, reference, headers) {
|
|
|
21
21
|
headers,
|
|
22
22
|
});
|
|
23
23
|
}
|
|
24
|
-
exports.subscribe = subscribe;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.pin = pin;
|
|
4
|
+
exports.unpin = unpin;
|
|
5
|
+
exports.getPin = getPin;
|
|
6
|
+
exports.getAllPins = getAllPins;
|
|
4
7
|
const cafe_utility_1 = require("cafe-utility");
|
|
5
8
|
const http_1 = require("../utils/http");
|
|
6
9
|
const typed_bytes_1 = require("../utils/typed-bytes");
|
|
@@ -18,7 +21,6 @@ async function pin(requestOptions, reference) {
|
|
|
18
21
|
url: `${PINNING_ENDPOINT}/${reference}`,
|
|
19
22
|
});
|
|
20
23
|
}
|
|
21
|
-
exports.pin = pin;
|
|
22
24
|
/**
|
|
23
25
|
* Unpin data with given reference
|
|
24
26
|
*
|
|
@@ -32,7 +34,6 @@ async function unpin(requestOptions, reference) {
|
|
|
32
34
|
url: `${PINNING_ENDPOINT}/${reference}`,
|
|
33
35
|
});
|
|
34
36
|
}
|
|
35
|
-
exports.unpin = unpin;
|
|
36
37
|
/**
|
|
37
38
|
* Get pin status for specific address.
|
|
38
39
|
*
|
|
@@ -51,7 +52,6 @@ async function getPin(requestOptions, reference) {
|
|
|
51
52
|
reference: new typed_bytes_1.Reference(cafe_utility_1.Types.asString(body.reference, { name: 'reference' })),
|
|
52
53
|
};
|
|
53
54
|
}
|
|
54
|
-
exports.getPin = getPin;
|
|
55
55
|
/**
|
|
56
56
|
* Get list of all pins
|
|
57
57
|
*
|
|
@@ -71,4 +71,3 @@ async function getAllPins(requestOptions) {
|
|
|
71
71
|
const references = cafe_utility_1.Types.asArray(body.references, { name: 'references' }).map(x => cafe_utility_1.Types.asString(x, { name: 'reference' }));
|
|
72
72
|
return references.map(x => new typed_bytes_1.Reference(x));
|
|
73
73
|
}
|
|
74
|
-
exports.getAllPins = getAllPins;
|