@ethersphere/bee-js 12.3.2-upcoming.116 → 13.0.0-upcoming.gc013bdf

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.
Files changed (268) hide show
  1. package/dist/cjs/api/balance.js +24 -0
  2. package/dist/cjs/api/batches.js +26 -0
  3. package/dist/cjs/{modules → api}/bytes.js +4 -29
  4. package/dist/cjs/{modules → api}/bzz.js +6 -34
  5. package/dist/cjs/{modules/debug → api}/chequebook.js +48 -87
  6. package/dist/cjs/api/chunk.js +43 -0
  7. package/dist/cjs/api/connectivity.js +86 -0
  8. package/dist/cjs/api/consumed.js +24 -0
  9. package/dist/cjs/{modules → api}/envelope.js +3 -2
  10. package/dist/cjs/api/feed.js +55 -0
  11. package/dist/cjs/api/grantee.js +62 -0
  12. package/dist/cjs/{modules/pinning.js → api/pin.js} +13 -34
  13. package/dist/cjs/api/pss.js +19 -0
  14. package/dist/cjs/api/redistributionstate.js +17 -0
  15. package/dist/cjs/{modules/debug/settlements.js → api/settlement.js} +3 -11
  16. package/dist/cjs/api/soc.js +34 -0
  17. package/dist/cjs/{modules/debug → api}/stake.js +15 -43
  18. package/dist/cjs/{modules/debug/stamps.js → api/stamp.js} +41 -57
  19. package/dist/cjs/api/status.js +67 -0
  20. package/dist/cjs/{modules → api}/stewardship.js +1 -6
  21. package/dist/cjs/api/tag.js +51 -0
  22. package/dist/cjs/{modules/debug/transactions.js → api/transaction.js} +10 -31
  23. package/dist/cjs/{modules/debug/states.js → api/wallet.js} +4 -36
  24. package/dist/cjs/bee.js +115 -1978
  25. package/dist/cjs/chunk/soc.js +23 -65
  26. package/dist/cjs/feed/identifier.js +3 -4
  27. package/dist/cjs/feed/index.js +20 -22
  28. package/dist/cjs/feed/retrievable.js +3 -3
  29. package/dist/cjs/index.js +18 -8
  30. package/dist/cjs/manifest/manifest.js +99 -335
  31. package/dist/cjs/modules/balance.js +86 -0
  32. package/dist/cjs/modules/cheque.js +92 -0
  33. package/dist/cjs/modules/chequebook.js +90 -0
  34. package/dist/cjs/modules/chunk.js +87 -53
  35. package/dist/cjs/modules/collection.js +145 -0
  36. package/dist/cjs/modules/connectivity.js +141 -0
  37. package/dist/cjs/modules/context.js +2 -0
  38. package/dist/cjs/modules/data.js +119 -0
  39. package/dist/cjs/modules/feed.js +94 -70
  40. package/dist/cjs/modules/file.js +113 -0
  41. package/dist/cjs/modules/grantee.js +86 -55
  42. package/dist/cjs/modules/messaging.js +248 -0
  43. package/dist/cjs/modules/pin.js +100 -0
  44. package/dist/cjs/modules/settlement.js +67 -0
  45. package/dist/cjs/modules/soc.js +39 -36
  46. package/dist/cjs/modules/stake.js +110 -0
  47. package/dist/cjs/modules/stamp.js +199 -0
  48. package/dist/cjs/modules/status.js +128 -20
  49. package/dist/cjs/modules/storage.js +191 -0
  50. package/dist/cjs/modules/tag.js +97 -71
  51. package/dist/cjs/modules/transaction.js +92 -0
  52. package/dist/cjs/modules/wallet.js +82 -0
  53. package/dist/cjs/types/schema/chequebook.js +5 -5
  54. package/dist/cjs/types/schema/connectivity.js +5 -5
  55. package/dist/cjs/types/schema/envelope.js +5 -5
  56. package/dist/cjs/types/schema/grantee.js +4 -4
  57. package/dist/cjs/types/schema/stake.js +2 -2
  58. package/dist/cjs/types/schema/stamps.js +4 -4
  59. package/dist/cjs/types/schema/states.js +2 -2
  60. package/dist/cjs/types/schema/transactions.js +3 -3
  61. package/dist/cjs/types/schema/upload.js +2 -2
  62. package/dist/cjs/utils/chunk-stream.browser.js +24 -16
  63. package/dist/cjs/utils/chunk-stream.js +17 -9
  64. package/dist/cjs/utils/constants.js +3 -3
  65. package/dist/cjs/utils/expose.js +4 -4
  66. package/dist/cjs/utils/headers.js +4 -4
  67. package/dist/cjs/utils/pss.js +2 -2
  68. package/dist/cjs/utils/resource-locator.js +2 -2
  69. package/dist/cjs/utils/schema.js +4 -4
  70. package/dist/cjs/utils/stamps.js +15 -130
  71. package/dist/index.browser.min.js +2 -1
  72. package/dist/index.browser.min.js.LICENSE.txt +3 -0
  73. package/dist/index.browser.min.js.map +1 -1
  74. package/dist/mjs/api/balance.js +20 -0
  75. package/dist/mjs/api/batches.js +22 -0
  76. package/dist/mjs/{modules → api}/bytes.js +2 -27
  77. package/dist/mjs/{modules → api}/bzz.js +2 -30
  78. package/dist/mjs/{modules/debug → api}/chequebook.js +50 -89
  79. package/dist/mjs/api/chunk.js +37 -0
  80. package/dist/mjs/api/connectivity.js +76 -0
  81. package/dist/mjs/api/consumed.js +20 -0
  82. package/dist/mjs/{modules → api}/envelope.js +3 -2
  83. package/dist/mjs/api/feed.js +52 -0
  84. package/dist/mjs/api/grantee.js +59 -0
  85. package/dist/mjs/{modules/pinning.js → api/pin.js} +14 -35
  86. package/dist/mjs/api/pss.js +18 -0
  87. package/dist/mjs/api/redistributionstate.js +14 -0
  88. package/dist/mjs/{modules/debug/settlements.js → api/settlement.js} +3 -11
  89. package/dist/mjs/api/soc.js +31 -0
  90. package/dist/mjs/{modules/debug → api}/stake.js +14 -41
  91. package/dist/mjs/{modules/debug/stamps.js → api/stamp.js} +37 -51
  92. package/dist/mjs/api/status.js +59 -0
  93. package/dist/mjs/{modules → api}/stewardship.js +1 -6
  94. package/dist/mjs/api/tag.js +49 -0
  95. package/dist/mjs/api/transaction.js +41 -0
  96. package/dist/mjs/api/wallet.js +38 -0
  97. package/dist/mjs/bee.js +115 -1965
  98. package/dist/mjs/chunk/soc.js +13 -51
  99. package/dist/mjs/feed/identifier.js +2 -3
  100. package/dist/mjs/feed/index.js +9 -11
  101. package/dist/mjs/feed/retrievable.js +2 -2
  102. package/dist/mjs/index.js +2 -5
  103. package/dist/mjs/manifest/manifest.js +97 -341
  104. package/dist/mjs/modules/balance.js +49 -0
  105. package/dist/mjs/modules/cheque.js +55 -0
  106. package/dist/mjs/modules/chequebook.js +65 -0
  107. package/dist/mjs/modules/chunk.js +52 -49
  108. package/dist/mjs/modules/collection.js +108 -0
  109. package/dist/mjs/modules/connectivity.js +102 -0
  110. package/dist/mjs/modules/context.js +1 -0
  111. package/dist/mjs/modules/data.js +82 -0
  112. package/dist/mjs/modules/feed.js +89 -67
  113. package/dist/mjs/modules/file.js +78 -0
  114. package/dist/mjs/modules/grantee.js +52 -55
  115. package/dist/mjs/modules/messaging.js +213 -0
  116. package/dist/mjs/modules/pin.js +63 -0
  117. package/dist/mjs/modules/settlement.js +30 -0
  118. package/dist/mjs/modules/soc.js +36 -34
  119. package/dist/mjs/modules/stake.js +76 -0
  120. package/dist/mjs/modules/stamp.js +170 -0
  121. package/dist/mjs/modules/status.js +98 -18
  122. package/dist/mjs/modules/storage.js +185 -0
  123. package/dist/mjs/modules/tag.js +61 -68
  124. package/dist/mjs/modules/transaction.js +58 -0
  125. package/dist/mjs/modules/wallet.js +45 -0
  126. package/dist/mjs/types/schema/chequebook.js +1 -1
  127. package/dist/mjs/types/schema/connectivity.js +1 -1
  128. package/dist/mjs/types/schema/envelope.js +5 -5
  129. package/dist/mjs/types/schema/grantee.js +1 -1
  130. package/dist/mjs/types/schema/stake.js +1 -1
  131. package/dist/mjs/types/schema/stamps.js +1 -1
  132. package/dist/mjs/types/schema/states.js +1 -1
  133. package/dist/mjs/types/schema/transactions.js +1 -1
  134. package/dist/mjs/types/schema/upload.js +1 -1
  135. package/dist/mjs/utils/chunk-stream.browser.js +28 -18
  136. package/dist/mjs/utils/chunk-stream.js +21 -11
  137. package/dist/mjs/utils/constants.js +1 -1
  138. package/dist/mjs/utils/expose.js +1 -1
  139. package/dist/mjs/utils/headers.js +1 -1
  140. package/dist/mjs/utils/pss.js +1 -1
  141. package/dist/mjs/utils/resource-locator.js +1 -1
  142. package/dist/mjs/utils/schema.js +1 -1
  143. package/dist/mjs/utils/stamps.js +5 -99
  144. package/dist/types/api/balance.d.ts +7 -0
  145. package/dist/types/api/batches.d.ts +7 -0
  146. package/dist/types/api/bytes.d.ts +11 -0
  147. package/dist/types/api/bzz.d.ts +12 -0
  148. package/dist/types/api/chequebook.d.ts +21 -0
  149. package/dist/types/api/chunk.d.ts +7 -0
  150. package/dist/types/api/connectivity.d.ts +22 -0
  151. package/dist/types/api/consumed.d.ts +7 -0
  152. package/dist/types/{modules → api}/envelope.d.ts +1 -1
  153. package/dist/types/api/feed.d.ts +40 -0
  154. package/dist/types/api/grantee.d.ts +11 -0
  155. package/dist/types/api/pin.d.ts +10 -0
  156. package/dist/types/api/pss.d.ts +6 -0
  157. package/dist/types/api/redistributionstate.d.ts +5 -0
  158. package/dist/types/api/settlement.d.ts +7 -0
  159. package/dist/types/api/soc.d.ts +6 -0
  160. package/dist/types/api/stake.d.ts +11 -0
  161. package/dist/types/api/stamp.d.ts +12 -0
  162. package/dist/types/api/status.d.ts +11 -0
  163. package/dist/types/api/stewardship.d.ts +7 -0
  164. package/dist/types/api/tag.d.ts +12 -0
  165. package/dist/types/api/transaction.d.ts +9 -0
  166. package/dist/types/api/wallet.d.ts +9 -0
  167. package/dist/types/bee.d.ts +71 -1199
  168. package/dist/types/chunk/soc.d.ts +3 -48
  169. package/dist/types/feed/identifier.d.ts +1 -1
  170. package/dist/types/feed/index.d.ts +2 -4
  171. package/dist/types/feed/retrievable.d.ts +1 -1
  172. package/dist/types/index.d.ts +17 -20
  173. package/dist/types/manifest/manifest.d.ts +25 -34
  174. package/dist/types/modules/balance.d.ts +38 -0
  175. package/dist/types/modules/cheque.d.ts +40 -0
  176. package/dist/types/modules/chequebook.d.ts +41 -0
  177. package/dist/types/modules/chunk.d.ts +30 -20
  178. package/dist/types/modules/collection.d.ts +77 -0
  179. package/dist/types/modules/connectivity.d.ts +74 -0
  180. package/dist/types/modules/context.d.ts +24 -0
  181. package/dist/types/modules/data.d.ts +55 -0
  182. package/dist/types/modules/feed.d.ts +47 -49
  183. package/dist/types/modules/file.d.ts +43 -0
  184. package/dist/types/modules/grantee.d.ts +40 -8
  185. package/dist/types/modules/messaging.d.ts +79 -0
  186. package/dist/types/modules/pin.d.ts +47 -0
  187. package/dist/types/modules/settlement.d.ts +25 -0
  188. package/dist/types/modules/soc.d.ts +23 -11
  189. package/dist/types/modules/stake.d.ts +55 -0
  190. package/dist/types/modules/stamp.d.ts +96 -0
  191. package/dist/types/modules/status.d.ts +66 -5
  192. package/dist/types/modules/storage.d.ts +107 -0
  193. package/dist/types/modules/tag.d.ts +44 -33
  194. package/dist/types/modules/transaction.d.ts +42 -0
  195. package/dist/types/modules/wallet.d.ts +35 -0
  196. package/dist/types/types/debug.d.ts +1 -1
  197. package/dist/types/types/index.d.ts +3 -12
  198. package/dist/types/types/schema/chequebook.d.ts +1 -1
  199. package/dist/types/types/schema/connectivity.d.ts +1 -1
  200. package/dist/types/types/schema/grantee.d.ts +1 -1
  201. package/dist/types/types/schema/stake.d.ts +1 -1
  202. package/dist/types/types/schema/stamps.d.ts +1 -1
  203. package/dist/types/types/schema/states.d.ts +1 -1
  204. package/dist/types/types/schema/transactions.d.ts +1 -1
  205. package/dist/types/types/schema/upload.d.ts +1 -1
  206. package/dist/types/utils/chunk-stream.browser.d.ts +1 -1
  207. package/dist/types/utils/chunk-stream.d.ts +2 -2
  208. package/dist/types/utils/constants.d.ts +1 -1
  209. package/dist/types/utils/expose.d.ts +1 -1
  210. package/dist/types/utils/headers.d.ts +1 -1
  211. package/dist/types/utils/pss.d.ts +1 -1
  212. package/dist/types/utils/resource-locator.d.ts +1 -1
  213. package/dist/types/utils/schema.d.ts +1 -1
  214. package/dist/types/utils/stamps.d.ts +2 -27
  215. package/dist/types/utils/tar-uploader.browser.d.ts +1 -1
  216. package/dist/types/utils/tar-uploader.d.ts +1 -1
  217. package/package.json +4 -2
  218. package/dist/cjs/chunk/bmt.js +0 -37
  219. package/dist/cjs/chunk/cac.js +0 -43
  220. package/dist/cjs/modules/debug/balance.js +0 -60
  221. package/dist/cjs/modules/debug/connectivity.js +0 -54
  222. package/dist/cjs/modules/debug/status.js +0 -104
  223. package/dist/cjs/modules/gsoc.js +0 -23
  224. package/dist/cjs/modules/pss.js +0 -48
  225. package/dist/cjs/stamper/stamper.js +0 -44
  226. package/dist/cjs/utils/bytes.js +0 -116
  227. package/dist/cjs/utils/cid.js +0 -37
  228. package/dist/cjs/utils/redundancy.js +0 -133
  229. package/dist/cjs/utils/typed-bytes.js +0 -186
  230. package/dist/mjs/chunk/bmt.js +0 -34
  231. package/dist/mjs/chunk/cac.js +0 -34
  232. package/dist/mjs/modules/debug/balance.js +0 -54
  233. package/dist/mjs/modules/debug/connectivity.js +0 -46
  234. package/dist/mjs/modules/debug/states.js +0 -68
  235. package/dist/mjs/modules/debug/status.js +0 -99
  236. package/dist/mjs/modules/debug/transactions.js +0 -62
  237. package/dist/mjs/modules/gsoc.js +0 -16
  238. package/dist/mjs/modules/pss.js +0 -43
  239. package/dist/mjs/stamper/stamper.js +0 -40
  240. package/dist/mjs/utils/bytes.js +0 -102
  241. package/dist/mjs/utils/cid.js +0 -32
  242. package/dist/mjs/utils/redundancy.js +0 -98
  243. package/dist/mjs/utils/typed-bytes.js +0 -167
  244. package/dist/types/chunk/bmt.d.ts +0 -16
  245. package/dist/types/chunk/cac.d.ts +0 -40
  246. package/dist/types/modules/bytes.d.ts +0 -35
  247. package/dist/types/modules/bzz.d.ts +0 -40
  248. package/dist/types/modules/debug/balance.d.ts +0 -28
  249. package/dist/types/modules/debug/chequebook.d.ts +0 -60
  250. package/dist/types/modules/debug/connectivity.d.ts +0 -9
  251. package/dist/types/modules/debug/settlements.d.ts +0 -15
  252. package/dist/types/modules/debug/stake.d.ts +0 -30
  253. package/dist/types/modules/debug/stamps.d.ts +0 -11
  254. package/dist/types/modules/debug/states.d.ts +0 -23
  255. package/dist/types/modules/debug/status.d.ts +0 -46
  256. package/dist/types/modules/debug/transactions.d.ts +0 -30
  257. package/dist/types/modules/gsoc.d.ts +0 -6
  258. package/dist/types/modules/pinning.d.ts +0 -30
  259. package/dist/types/modules/pss.d.ts +0 -22
  260. package/dist/types/modules/stewardship.d.ts +0 -10
  261. package/dist/types/stamper/stamper.d.ts +0 -15
  262. package/dist/types/utils/bytes.d.ts +0 -19
  263. package/dist/types/utils/cid.d.ts +0 -10
  264. package/dist/types/utils/redundancy.d.ts +0 -21
  265. package/dist/types/utils/typed-bytes.d.ts +0 -69
  266. /package/dist/cjs/{modules → api}/rchash.js +0 -0
  267. /package/dist/mjs/{modules → api}/rchash.js +0 -0
  268. /package/dist/types/{modules → api}/rchash.d.ts +0 -0
@@ -1,102 +0,0 @@
1
- import { Binary, Objects } from 'cafe-utility';
2
- import _debug from 'debug';
3
- import { z } from 'zod';
4
- import { HexStringSchema } from "./hex-schema.js";
5
- const debug = _debug('bee-js:bytes');
6
- const DECODER = new TextDecoder();
7
- const ENCODER = new TextEncoder();
8
- export class Bytes {
9
- constructor(bytes, byteLength) {
10
- if (!bytes) {
11
- throw Error(`Bytes#constructor: constructor parameter is falsy: ${bytes}`);
12
- }
13
- if (bytes instanceof Bytes) {
14
- this.bytes = bytes.bytes;
15
- } else if (typeof bytes === 'string') {
16
- this.bytes = Binary.hexToUint8Array(HexStringSchema.parse(bytes));
17
- } else if (bytes instanceof ArrayBuffer) {
18
- this.bytes = new Uint8Array(bytes);
19
- } else if (bytes instanceof Uint8Array) {
20
- this.bytes = bytes;
21
- } else {
22
- const unknownInput = bytes;
23
- const toHex = Objects.getDeep(unknownInput, 'toHex');
24
- if (z.function().safeParse(toHex).success) {
25
- const hex = toHex.call(unknownInput);
26
- this.bytes = Binary.hexToUint8Array(HexStringSchema.parse(hex));
27
- } else {
28
- debug('bytes', bytes);
29
- throw new Error(`Bytes#constructor: unsupported type: ${typeof bytes}`);
30
- }
31
- }
32
- this.length = this.bytes.length;
33
- if (byteLength) {
34
- if (Array.isArray(byteLength)) {
35
- if (!byteLength.includes(this.length)) {
36
- throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${byteLength.join(' or ')}`);
37
- }
38
- } else if (this.length !== byteLength) {
39
- throw new Error(`Bytes#checkByteLength: bytes length is ${this.length} but expected ${byteLength}`);
40
- }
41
- }
42
- }
43
- static keccak256(bytes) {
44
- return new Bytes(Binary.keccak256(new Bytes(bytes).toUint8Array()));
45
- }
46
- static fromUtf8(utf8) {
47
- return new Bytes(ENCODER.encode(utf8));
48
- }
49
- static fromSlice(bytes, start, length) {
50
- if (length === undefined) {
51
- return new Bytes(bytes.slice(start));
52
- }
53
- return new Bytes(bytes.slice(start, start + length));
54
- }
55
- offset(index) {
56
- return new Uint8Array(this.bytes.slice(index));
57
- }
58
- toUint8Array() {
59
- return new Uint8Array(this.bytes);
60
- }
61
- toHex() {
62
- return Binary.uint8ArrayToHex(this.bytes);
63
- }
64
- toBase64() {
65
- return Binary.uint8ArrayToBase64(this.bytes);
66
- }
67
- toBase32() {
68
- return Binary.uint8ArrayToBase32(this.bytes);
69
- }
70
- toString() {
71
- return this.toHex();
72
- }
73
- toUtf8() {
74
- return DECODER.decode(this.bytes);
75
- }
76
- toJSON() {
77
- return JSON.parse(this.toUtf8());
78
- }
79
- equals(other) {
80
- return this.toHex() === new Bytes(other).toHex();
81
- }
82
- represent() {
83
- return this.toHex();
84
- }
85
- }
86
- export function parseSizeToBytes(sizeStr) {
87
- const units = {
88
- B: 1,
89
- kB: 1000,
90
- MB: 1000 ** 2,
91
- GB: 1000 ** 3,
92
- TB: 1000 ** 4,
93
- PB: 1000 ** 5
94
- };
95
- const match = sizeStr.match(/^([\d.]+)\s*(B|kB|MB|GB|TB|PB)$/);
96
- if (!match) {
97
- throw new Error(`Invalid size format: ${sizeStr}`);
98
- }
99
- const value = parseFloat(match[1]);
100
- const unit = match[2];
101
- return Math.ceil(value * units[unit]);
102
- }
@@ -1,32 +0,0 @@
1
- import { Binary } from 'cafe-utility';
2
- import { Reference } from "./typed-bytes.js";
3
- export const SWARM_MANIFEST_CODEC = 0xfa;
4
- export const SWARM_FEED_CODEC = 0xfb;
5
- const CODEC_TABLE = {
6
- [SWARM_MANIFEST_CODEC]: 'manifest',
7
- [SWARM_FEED_CODEC]: 'feed'
8
- };
9
- export function convertReferenceToCid(reference, type) {
10
- reference = new Reference(reference);
11
- const base32 = 'b';
12
- const version = new Uint8Array([1]);
13
- const codec = new Uint8Array([type === 'feed' ? SWARM_FEED_CODEC : SWARM_MANIFEST_CODEC]);
14
- const unknown = new Uint8Array([1]);
15
- const sha256 = new Uint8Array([27]);
16
- const size = new Uint8Array([32]);
17
- const header = Binary.uint8ArrayToBase32(Binary.concatBytes(version, codec, unknown, sha256, size)).replace(/\=+$/, '');
18
- const hash = reference.toBase32().replace(/\=+$/, '');
19
- return `${base32}${header}${hash}`.toLowerCase();
20
- }
21
- export function convertCidToReference(cid) {
22
- const bytes = Binary.base32ToUint8Array(cid.toUpperCase().slice(1));
23
- const codec = bytes[1];
24
- if (!CODEC_TABLE[codec]) {
25
- throw new Error('Unknown codec');
26
- }
27
- const reference = new Reference(bytes.slice(-32));
28
- return {
29
- type: CODEC_TABLE[codec],
30
- reference
31
- };
32
- }
@@ -1,98 +0,0 @@
1
- import { RedundancyLevel } from "../index.js";
2
- const mediumTable = [[94, 68, 46, 28, 14, 5, 1], [9, 8, 7, 6, 5, 4, 3]];
3
- const encMediumTable = [[47, 34, 23, 14, 7, 2], [9, 8, 7, 6, 5, 4]];
4
- const strongTable = [[104, 95, 86, 77, 69, 61, 53, 46, 39, 32, 26, 20, 15, 10, 6, 3, 1], [21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5]];
5
- const encStrongTable = [[52, 47, 43, 38, 34, 30, 26, 23, 19, 16, 13, 10, 7, 5, 3, 1], [21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6]];
6
- const insaneTable = [[92, 87, 82, 77, 73, 68, 63, 59, 54, 50, 45, 41, 37, 33, 29, 26, 22, 19, 16, 13, 10, 8, 5, 3, 2, 1], [31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6]];
7
- const encInsaneTable = [[46, 43, 41, 38, 36, 34, 31, 29, 27, 25, 22, 20, 18, 16, 14, 13, 11, 9, 8, 6, 5, 4, 2, 1], [31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 7]];
8
- const paranoidTable = [[37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [90, 88, 87, 85, 84, 82, 81, 79, 77, 76, 74, 72, 71, 69, 67, 66, 64, 62, 60, 59, 57, 55, 53, 51, 49, 48, 46, 44, 41, 39, 37, 35, 32, 30, 27, 24, 20]];
9
- const encParanoidTable = [[18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1], [88, 85, 82, 79, 76, 72, 69, 66, 62, 59, 55, 51, 48, 44, 39, 35, 30, 24]];
10
- /**
11
- * Returns an approximate multiplier for the overhead of a given redundancy level.
12
- * Redundancy level is a tradeoff between storage overhead and fault tolerance.
13
- * Use this number to estimate the amount of chunks that will be stored for a given
14
- * redundancy level.
15
- */
16
- export function approximateOverheadForRedundancyLevel(chunks, level, encrypted) {
17
- if (level === RedundancyLevel.OFF) {
18
- return 0;
19
- }
20
- const table = selectTable(level, encrypted);
21
- const [supportedChunks, parities] = table;
22
- for (let i = 0; i < supportedChunks.length; i++) {
23
- if (chunks >= supportedChunks[i]) {
24
- return parities[i] / supportedChunks[i];
25
- }
26
- }
27
- return parities[parities.length - 1] / supportedChunks[supportedChunks.length - 1];
28
- }
29
- function selectTable(level, encrypted) {
30
- switch (level) {
31
- case RedundancyLevel.MEDIUM:
32
- return encrypted ? encMediumTable : mediumTable;
33
- case RedundancyLevel.STRONG:
34
- return encrypted ? encStrongTable : strongTable;
35
- case RedundancyLevel.INSANE:
36
- return encrypted ? encInsaneTable : insaneTable;
37
- case RedundancyLevel.PARANOID:
38
- return encrypted ? encParanoidTable : paranoidTable;
39
- default:
40
- throw new Error(`Unknown redundancy level ${level}`);
41
- }
42
- }
43
- const medium = {
44
- label: 'medium',
45
- value: RedundancyLevel.MEDIUM,
46
- errorTolerance: 0.01
47
- };
48
- const strong = {
49
- label: 'strong',
50
- value: RedundancyLevel.STRONG,
51
- errorTolerance: 0.05
52
- };
53
- const insane = {
54
- label: 'insane',
55
- value: RedundancyLevel.INSANE,
56
- errorTolerance: 0.1
57
- };
58
- const paranoid = {
59
- label: 'paranoid',
60
- value: RedundancyLevel.PARANOID,
61
- errorTolerance: 0.5
62
- };
63
- export function getRedundancyStats() {
64
- return {
65
- medium,
66
- strong,
67
- insane,
68
- paranoid
69
- };
70
- }
71
- export function getRedundancyStat(level) {
72
- if (typeof level === 'string') {
73
- switch (level.toLowerCase()) {
74
- case 'medium':
75
- return medium;
76
- case 'strong':
77
- return strong;
78
- case 'insane':
79
- return insane;
80
- case 'paranoid':
81
- return paranoid;
82
- default:
83
- throw new Error(`Unknown redundancy level '${level}'`);
84
- }
85
- }
86
- switch (level) {
87
- case RedundancyLevel.MEDIUM:
88
- return medium;
89
- case RedundancyLevel.STRONG:
90
- return strong;
91
- case RedundancyLevel.INSANE:
92
- return insane;
93
- case RedundancyLevel.PARANOID:
94
- return paranoid;
95
- default:
96
- throw new Error(`Unknown redundancy level '${level}'`);
97
- }
98
- }
@@ -1,167 +0,0 @@
1
- import { Binary, Elliptic } from 'cafe-utility';
2
- import { Bytes } from "./bytes.js";
3
- import { convertCidToReference, convertReferenceToCid } from "./cid.js"; // TODO: add JSdocs for each class
4
- const ENCODER = new TextEncoder();
5
- export class PrivateKey extends Bytes {
6
- constructor(bytes) {
7
- super(bytes, 32);
8
- }
9
- publicKey() {
10
- const [x, y] = Elliptic.privateKeyToPublicKey(Binary.uint256ToNumber(this.bytes, 'BE'));
11
- return new PublicKey(Binary.concatBytes(Binary.numberToUint256(x, 'BE'), Binary.numberToUint256(y, 'BE')));
12
- }
13
- sign(data) {
14
- const digest = Binary.concatBytes(ENCODER.encode(`\x19Ethereum Signed Message:\n32`), Binary.keccak256(data instanceof Uint8Array ? data : ENCODER.encode(data)));
15
- const [r, s, v] = Elliptic.signMessage(digest, Binary.uint256ToNumber(this.bytes, 'BE'));
16
- return new Signature(Binary.concatBytes(Binary.numberToUint256(r, 'BE'), Binary.numberToUint256(s, 'BE'), new Uint8Array([Number(v)])));
17
- }
18
- }
19
- PrivateKey.LENGTH = 32;
20
- export class PublicKey extends Bytes {
21
- constructor(bytes) {
22
- const b = new Bytes(bytes);
23
- if (b.length === 33) {
24
- const [x, y] = Elliptic.publicKeyFromCompressed(b.toUint8Array());
25
- super(Binary.concatBytes(Binary.numberToUint256(x, 'BE'), Binary.numberToUint256(y, 'BE')), 64);
26
- } else {
27
- super(bytes, 64);
28
- }
29
- }
30
- address() {
31
- const x = Binary.uint256ToNumber(this.bytes.slice(0, 32), 'BE');
32
- const y = Binary.uint256ToNumber(this.bytes.slice(32, 64), 'BE');
33
- return new EthAddress(Elliptic.publicKeyToAddress([x, y]));
34
- }
35
- toCompressedUint8Array() {
36
- const x = Binary.uint256ToNumber(this.bytes.slice(0, 32), 'BE');
37
- const y = Binary.uint256ToNumber(this.bytes.slice(32, 64), 'BE');
38
- return Elliptic.compressPublicKey([x, y]);
39
- }
40
- toCompressedHex() {
41
- return Binary.uint8ArrayToHex(this.toCompressedUint8Array());
42
- }
43
- }
44
- PublicKey.LENGTH = 64;
45
- export class EthAddress extends Bytes {
46
- constructor(bytes) {
47
- super(bytes, 20);
48
- }
49
- toChecksum() {
50
- return Elliptic.checksumEncode(this.bytes);
51
- }
52
- }
53
- EthAddress.LENGTH = 20;
54
- export class Identifier extends Bytes {
55
- constructor(bytes) {
56
- super(bytes, 32);
57
- }
58
- static fromString(value) {
59
- return new Identifier(Binary.keccak256(ENCODER.encode(value)));
60
- }
61
- }
62
- Identifier.LENGTH = 32;
63
- export class Reference extends Bytes {
64
- constructor(bytes) {
65
- if (typeof bytes === 'string' && bytes.startsWith('bah5')) {
66
- const decoded = convertCidToReference(bytes);
67
- super(decoded.reference.bytes, 32);
68
- } else {
69
- super(bytes, [32, 64]);
70
- }
71
- }
72
- toCid(type) {
73
- return convertReferenceToCid(this.bytes, type);
74
- }
75
- static isValid(value) {
76
- try {
77
- new Reference(value);
78
- return true;
79
- } catch {
80
- return false;
81
- }
82
- }
83
- }
84
- Reference.LENGTH = 32;
85
- export class TransactionId extends Bytes {
86
- constructor(bytes) {
87
- super(bytes, 32);
88
- }
89
- }
90
- TransactionId.LENGTH = 32;
91
- export class Span extends Bytes {
92
- constructor(bytes) {
93
- super(bytes, 8);
94
- }
95
- static fromBigInt(number) {
96
- return new Span(Binary.numberToUint64(number, 'LE'));
97
- }
98
- toBigInt() {
99
- return Binary.uint64ToNumber(this.bytes, 'LE');
100
- }
101
- static fromSlice(bytes, start) {
102
- return new Span(bytes.slice(start, start + Span.LENGTH));
103
- }
104
- }
105
- Span.LENGTH = 8;
106
- export class PeerAddress extends Bytes {
107
- constructor(bytes) {
108
- super(bytes, 32);
109
- }
110
- }
111
- PeerAddress.LENGTH = 32;
112
- export class BatchId extends Bytes {
113
- constructor(bytes) {
114
- super(bytes, 32);
115
- }
116
- }
117
- BatchId.LENGTH = 32;
118
- export class Signature extends Bytes {
119
- constructor(bytes) {
120
- super(bytes, 65);
121
- }
122
- static fromSlice(bytes, start) {
123
- return new Signature(bytes.slice(start, start + Signature.LENGTH));
124
- }
125
- recoverPublicKey(digest) {
126
- const r = Binary.uint256ToNumber(this.bytes.slice(0, 32), 'BE');
127
- const s = Binary.uint256ToNumber(this.bytes.slice(32, 64), 'BE');
128
- const v = BigInt(this.bytes[64]);
129
- const [x, y] = Elliptic.recoverPublicKey(Binary.concatBytes(ENCODER.encode(`\x19Ethereum Signed Message:\n32`), Binary.keccak256(digest instanceof Uint8Array ? digest : ENCODER.encode(digest))), r, s, v);
130
- return new PublicKey(Binary.concatBytes(Binary.numberToUint256(x, 'BE'), Binary.numberToUint256(y, 'BE')));
131
- }
132
- isValid(digest, expectedAddress) {
133
- const publicKey = this.recoverPublicKey(digest);
134
- const address = publicKey.address();
135
- return address.equals(expectedAddress);
136
- }
137
- }
138
- Signature.LENGTH = 65;
139
- export class Topic extends Bytes {
140
- constructor(bytes) {
141
- super(bytes, 32);
142
- }
143
- static fromString(value) {
144
- return new Topic(Binary.keccak256(ENCODER.encode(value)));
145
- }
146
- }
147
- Topic.LENGTH = 32;
148
- const MAX_UINT64 = new Uint8Array(8).fill(0xff, 0, 8);
149
- export class FeedIndex extends Bytes {
150
- constructor(bytes) {
151
- super(bytes, 8);
152
- }
153
- static fromBigInt(number) {
154
- return new FeedIndex(Binary.numberToUint64(number, 'BE'));
155
- }
156
- toBigInt() {
157
- return Binary.uint64ToNumber(this.bytes, 'BE');
158
- }
159
- next() {
160
- if (Binary.equals(this.bytes, MAX_UINT64)) {
161
- return FeedIndex.fromBigInt(0n);
162
- }
163
- return FeedIndex.fromBigInt(this.toBigInt() + 1n);
164
- }
165
- }
166
- FeedIndex.LENGTH = 8;
167
- FeedIndex.MINUS_ONE = new FeedIndex(MAX_UINT64);
@@ -1,16 +0,0 @@
1
- import { Reference } from '../utils/typed-bytes';
2
- /**
3
- * Calculate a Binary Merkle Tree hash for a chunk
4
- *
5
- * The BMT chunk address is the hash of the 8 byte span and the root
6
- * hash of a binary Merkle tree (BMT) built on the 32-byte segments
7
- * of the underlying data.
8
- *
9
- * If the chunk content is less than 4k, the hash is calculated as
10
- * if the chunk was padded with all zeros up to 4096 bytes.
11
- *
12
- * @param chunkContent Chunk data including span and payload as well
13
- *
14
- * @returns the keccak256 hash in a byte array
15
- */
16
- export declare function calculateChunkAddress(chunkContent: Uint8Array): Reference;
@@ -1,40 +0,0 @@
1
- import { Bytes } from '../utils/bytes';
2
- import { Identifier, PrivateKey, Reference, Span } from '../utils/typed-bytes';
3
- import { SingleOwnerChunk } from './soc';
4
- export declare const MIN_PAYLOAD_SIZE = 1;
5
- export declare const MAX_PAYLOAD_SIZE = 4096;
6
- /**
7
- * Content Addressed Chunk (CAC) is the immutable building block of Swarm,
8
- * holding at most 4096 bytes of payload.
9
- *
10
- * - `span` indicates the size of the `payload` in bytes.
11
- * - `payload` contains the actual data or the body of the chunk.
12
- * - `data` contains the full chunk data - `span` and `payload`.
13
- * - `address` is the Swarm hash (or reference) of the chunk.
14
- *
15
- * The `toSingleOwnerChunk` method allows converting the CAC into a Single Owner Chunk (SOC).
16
- */
17
- export interface Chunk {
18
- /**
19
- * Contains the full chunk data - `span` + `payload`.
20
- */
21
- readonly data: Uint8Array;
22
- /**
23
- * Indicates the size of the `payload` in bytes.
24
- */
25
- span: Span;
26
- /**
27
- * Contains the actual data or the body of the chunk.
28
- */
29
- payload: Bytes;
30
- /**
31
- * The Swarm hash (or reference) of the chunk.
32
- */
33
- address: Reference;
34
- /**
35
- * Converts the CAC into a Single Owner Chunk (SOC).
36
- */
37
- toSingleOwnerChunk: (identifier: Identifier | Uint8Array | string, signer: PrivateKey | Uint8Array | string) => SingleOwnerChunk;
38
- }
39
- export declare function unmarshalContentAddressedChunk(data: Bytes | Uint8Array): Chunk;
40
- export declare function makeContentAddressedChunk(rawPayload: Bytes | Uint8Array | string, span?: Span | bigint): Chunk;
@@ -1,35 +0,0 @@
1
- import type { BeeRequestOptions, DownloadOptions, RedundantUploadOptions, ReferenceInformation } from '../types';
2
- import { UploadResult } from '../types';
3
- import { Bytes } from '../utils/bytes';
4
- import { ResourceLocator } from '../utils/resource-locator';
5
- import { BatchId, Reference } from '../utils/typed-bytes';
6
- /**
7
- * Upload data to a Bee node
8
- *
9
- * @param requestOptions Options for making requests
10
- * @param data Data to be uploaded
11
- * @param postageBatchId Postage BatchId that will be assigned to uploaded data
12
- * @param options Additional options like tag, encryption, pinning
13
- */
14
- export declare function upload(requestOptions: BeeRequestOptions, data: string | Uint8Array, postageBatchId: BatchId, options?: RedundantUploadOptions): Promise<UploadResult>;
15
- /**
16
- * Requests content length for a reference
17
- *
18
- * @param requestOptions Options for making requests
19
- * @param hash Bee content reference
20
- */
21
- export declare function head(requestOptions: BeeRequestOptions, reference: Reference | Uint8Array | string): Promise<ReferenceInformation>;
22
- /**
23
- * Download data as a byte array
24
- *
25
- * @param requestOptions Options for making requests
26
- * @param hash Bee content reference
27
- */
28
- export declare function download(requestOptions: BeeRequestOptions, resource: ResourceLocator, options?: DownloadOptions): Promise<Bytes>;
29
- /**
30
- * Download data as a readable stream
31
- *
32
- * @param requestOptions Options for making requests
33
- * @param hash Bee content reference
34
- */
35
- export declare function downloadReadable(requestOptions: BeeRequestOptions, resource: ResourceLocator, options?: DownloadOptions): Promise<ReadableStream<Uint8Array>>;
@@ -1,40 +0,0 @@
1
- import { Readable } from 'stream';
2
- import { BeeRequestOptions, Collection, CollectionUploadOptions, DownloadOptions, FileData, FileUploadOptions, UploadResult } from '../types';
3
- import { Bytes } from '../utils/bytes';
4
- import { ResourceLocator } from '../utils/resource-locator';
5
- import { BatchId, Reference } from '../utils/typed-bytes';
6
- /**
7
- * Upload single file
8
- *
9
- * @param requestOptions Options for making requests
10
- * @param data Files data
11
- * @param postageBatchId Postage BatchId that will be assigned to uploaded data
12
- * @param name Name that will be attached to the uploaded file. Wraps the data into manifest with set index document.
13
- * @param options
14
- */
15
- export declare function uploadFile(requestOptions: BeeRequestOptions, data: string | Uint8Array | Readable | ArrayBuffer, postageBatchId: BatchId, name?: string, options?: FileUploadOptions): Promise<UploadResult>;
16
- /**
17
- * Download single file as a buffer
18
- *
19
- * @param requestOptions Options for making requests
20
- * @param hash Bee file or collection hash
21
- * @param path If hash is collection then this defines path to a single file in the collection
22
- */
23
- export declare function downloadFile(requestOptions: BeeRequestOptions, resource: ResourceLocator, path?: string, options?: DownloadOptions): Promise<FileData<Bytes>>;
24
- /**
25
- * Download single file as a readable stream
26
- *
27
- * @param requestOptions Options for making requests
28
- * @param hash Bee file or collection hash
29
- * @param path If hash is collection then this defines path to a single file in the collection
30
- */
31
- export declare function downloadFileReadable(requestOptions: BeeRequestOptions, reference: Reference, path?: string, options?: DownloadOptions): Promise<FileData<ReadableStream<Uint8Array>>>;
32
- /*******************************************************************************************************************/
33
- /**
34
- * Upload collection
35
- * @param requestOptions Options for making requests
36
- * @param collection Collection of Uint8Array buffers to upload
37
- * @param postageBatchId Postage BatchId that will be assigned to uploaded data
38
- * @param options
39
- */
40
- export declare function uploadCollection(requestOptions: BeeRequestOptions, collection: Collection, postageBatchId: BatchId, options?: CollectionUploadOptions): Promise<UploadResult>;
@@ -1,28 +0,0 @@
1
- import type { BalanceResponse, BeeRequestOptions, PeerBalance } from '../../types';
2
- import { PeerAddress } from '../../utils/typed-bytes';
3
- /**
4
- * Get the balances with all known peers including prepaid services
5
- *
6
- * @param requestOptions Options for making requests
7
- */
8
- export declare function getAllBalances(requestOptions: BeeRequestOptions): Promise<BalanceResponse>;
9
- /**
10
- * Get the balances with a specific peer including prepaid services
11
- *
12
- * @param requestOptions Options for making requests
13
- * @param address Swarm address of peer
14
- */
15
- export declare function getPeerBalance(requestOptions: BeeRequestOptions, address: PeerAddress): Promise<PeerBalance>;
16
- /**
17
- * Get the past due consumption balances with all known peers
18
- *
19
- * @param requestOptions Options for making requests
20
- */
21
- export declare function getPastDueConsumptionBalances(requestOptions: BeeRequestOptions): Promise<BalanceResponse>;
22
- /**
23
- * Get the past due consumption balance with a specific peer
24
- *
25
- * @param requestOptions Options for making requests
26
- * @param address Swarm address of peer
27
- */
28
- export declare function getPastDueConsumptionPeerBalance(requestOptions: BeeRequestOptions, address: PeerAddress): Promise<PeerBalance>;
@@ -1,60 +0,0 @@
1
- import type { BeeRequestOptions, ChequebookAddressResponse, ChequebookBalanceResponse, LastCashoutActionResponse, LastChequesForPeerResponse, LastChequesResponse, NumberString, TransactionOptions } from '../../types';
2
- import { PeerAddress, TransactionId } from '../../utils/typed-bytes';
3
- /**
4
- * Get the address of the chequebook contract used
5
- *
6
- * @param requestOptions Options for making requests
7
- */
8
- export declare function getChequebookAddress(requestOptions: BeeRequestOptions): Promise<ChequebookAddressResponse>;
9
- /**
10
- * Get the balance of the chequebook
11
- *
12
- * @param requestOptions Options for making requests
13
- */
14
- export declare function getChequebookBalance(requestOptions: BeeRequestOptions): Promise<ChequebookBalanceResponse>;
15
- /**
16
- * Get last cashout action for the peer
17
- *
18
- * @param requestOptions Options for making requests
19
- * @param peer Swarm address of peer
20
- */
21
- export declare function getLastCashoutAction(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<LastCashoutActionResponse>;
22
- /**
23
- * Cashout the last cheque for the peer
24
- *
25
- * @param requestOptions Options for making requests
26
- * @param peer Swarm address of peer
27
- * @param options
28
- */
29
- export declare function cashoutLastCheque(requestOptions: BeeRequestOptions, peer: PeerAddress, options?: TransactionOptions): Promise<TransactionId>;
30
- /**
31
- * Get last cheques for the peer
32
- *
33
- * @param requestOptions Options for making requests
34
- * @param peer Swarm address of peer
35
- */
36
- export declare function getLastChequesForPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<LastChequesForPeerResponse>;
37
- /**
38
- * Get last cheques for all peers
39
- *
40
- * @param requestOptions Options for making requests
41
- */
42
- export declare function getLastCheques(requestOptions: BeeRequestOptions): Promise<LastChequesResponse>;
43
- /**
44
- * Deposit tokens from overlay address into chequebook
45
- *
46
- * @param requestOptions Options for making requests
47
- * @param amount Amount of tokens to deposit
48
- * @param gasPrice Gas Price in WEI for the transaction call
49
- * @return string Hash of the transaction
50
- */
51
- export declare function depositTokens(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, gasPrice?: NumberString | string | bigint): Promise<TransactionId>;
52
- /**
53
- * Withdraw tokens from the chequebook to the overlay address
54
- *
55
- * @param requestOptions Options for making requests
56
- * @param amount Amount of tokens to withdraw
57
- * @param gasPrice Gas Price in WEI for the transaction call
58
- * @return string Hash of the transaction
59
- */
60
- export declare function withdrawTokens(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, gasPrice?: NumberString | string | bigint): Promise<TransactionId>;
@@ -1,9 +0,0 @@
1
- import type { BeeRequestOptions, Peer, PingResponse, RemovePeerResponse, Topology } from '../../types';
2
- import { NodeAddresses } from '../../types/debug';
3
- import { PeerAddress } from '../../utils/typed-bytes';
4
- export declare function getNodeAddresses(requestOptions: BeeRequestOptions): Promise<NodeAddresses>;
5
- export declare function getPeers(requestOptions: BeeRequestOptions): Promise<Peer[]>;
6
- export declare function getBlocklist(requestOptions: BeeRequestOptions): Promise<Peer[]>;
7
- export declare function removePeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<RemovePeerResponse>;
8
- export declare function getTopology(requestOptions: BeeRequestOptions): Promise<Topology>;
9
- export declare function pingPeer(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<PingResponse>;
@@ -1,15 +0,0 @@
1
- import type { AllSettlements, BeeRequestOptions, Settlements } from '../../types';
2
- import { PeerAddress } from '../../utils/typed-bytes';
3
- /**
4
- * Get amount of sent and received from settlements with a peer
5
- *
6
- * @param requestOptions Options for making requests
7
- * @param peer Swarm address of peer
8
- */
9
- export declare function getSettlements(requestOptions: BeeRequestOptions, peer: PeerAddress): Promise<Settlements>;
10
- /**
11
- * Get settlements with all known peers and total amount sent or received
12
- *
13
- * @param requestOptions Options for making requests
14
- */
15
- export declare function getAllSettlements(requestOptions: BeeRequestOptions): Promise<AllSettlements>;
@@ -1,30 +0,0 @@
1
- import { BeeRequestOptions, NumberString, RedistributionState, TransactionOptions } from '../../types';
2
- import { BZZ } from '../../utils/tokens';
3
- import { TransactionId } from '../../utils/typed-bytes';
4
- /**
5
- * Gets the amount of staked BZZ
6
- *
7
- * @param requestOptions Options for making requests
8
- */
9
- export declare function getStake(requestOptions: BeeRequestOptions): Promise<BZZ>;
10
- /**
11
- * Gets the amount of withdrawable staked BZZ
12
- *
13
- * @param requestOptions Options for making requests
14
- */
15
- export declare function getWithdrawableStake(requestOptions: BeeRequestOptions): Promise<BZZ>;
16
- export declare function withdrawSurplusStake(requestOptions: BeeRequestOptions): Promise<TransactionId>;
17
- export declare function migrateStake(requestOptions: BeeRequestOptions): Promise<TransactionId>;
18
- /**
19
- * Stake given amount of tokens.
20
- *
21
- * @param requestOptions Options for making requests
22
- * @param amount
23
- */
24
- export declare function stake(requestOptions: BeeRequestOptions, amount: NumberString | string | bigint, options?: TransactionOptions): Promise<TransactionId>;
25
- /**
26
- * Get current status of node in redistribution game
27
- *
28
- * @param requestOptions Options for making requests
29
- */
30
- export declare function getRedistributionState(requestOptions: BeeRequestOptions): Promise<RedistributionState>;