Skip to content

Commit 34b7f39

Browse files
authored
feat: update to bee-js v13 (#266)
* feat: update to bee-js v13 * fix: fix core-sdk definitions * fix: remove backslash escaping from page titles * fix: add namespace modules (#270)
1 parent 55f8ddf commit 34b7f39

187 files changed

Lines changed: 10153 additions & 7946 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,38 @@ This command generates static content into the `build` directory and can be serv
3434
Don't forget to find and replace the version number for the whole of the docs folder.
3535

3636

37+
## API Reference (`docs/api`)
38+
39+
Everything under `docs/api` is [typedoc](https://typedoc.org) output generated from the bee-js sources and committed to this repository, so the site builds without a bee-js checkout.
40+
41+
### Regenerating
42+
43+
The generator reads two clones that are not part of this repository:
44+
45+
```
46+
$ git clone https://github.com/ethersphere/bee-js sources/bee-js
47+
$ git clone https://github.com/ethersphere/core-sdk sources/core-sdk
48+
$ npm --prefix sources/bee-js install
49+
```
50+
51+
Check both out at the release you are documenting, then run:
52+
53+
```
54+
$ npm run generate-api
55+
```
56+
57+
This drives typedoc via `typedoc.config.mjs` and reshapes the output into the layout the site expects: it lifts the main entry point's pages out of the `bee-js/src` directory typedoc nests them in, flattens the `Utils` namespace into `docs/api/namespaces/Utils`, folds the namespace class pages into `docs/api/classes` alongside the rest, turns the generated index into `Overview.md`, reduces references to TypeScript's own `lib.*.d.ts` to a machine-independent form, and links the `@ethersphere/core-sdk` re-exports against the core-sdk clone (`scripts/fix-core-sdk-links.mjs`, also runnable on its own as `npm run fix-api-links`).
58+
59+
Review the result as a diff against what is already committed. Anything unrelated to the bee-js release you are documenting means the toolchain moved, not the docs.
60+
61+
### Things worth knowing before changing it
62+
63+
- **`typedoc` and `typedoc-plugin-markdown` are pinned exactly.** A plugin upgrade rewrites unrelated pages and drowns the diff, so upgrade them deliberately, on their own.
64+
- **The `typescript` devDependency exists only for this step.** Nothing in this repository is TypeScript; typedoc compiles the bee-js sources with it, so it has to track what `sources/bee-js` requires or generation fails with type errors.
65+
- **`scripts/typedoc-frontmatter-titles.mjs` is not optional.** typedoc escapes markdown characters in page headings (`# Variable: NULL\_OWNER`), and Docusaurus takes the browser tab title, sidebar label, breadcrumbs and prev/next links from that raw heading without undoing the escapes. The plugin adds an unescaped frontmatter `title` instead. The escaping itself is not configurable upstream, and the heading has to stay escaped or MDX parses `\<V\>` as JSX.
66+
- **The namespace classes reach the reference through extra entry points.** The classes behind `bee.data`, `bee.stamp` and the rest live in `src/modules/*.ts` and are not exported from bee-js's `src/index.ts`, so typedoc would otherwise render them as the unlinkable type of a `Bee` property. `typedoc.config.mjs` adds `src/modules/*.ts` as entry points of their own to give them pages. Their names collide with exported types (`Data`, `Tag`, `Pin`, `Collection`, `Chunk`), which is harmless because each entry point is its own typedoc module — but it is also why nothing may fold those pages together with the exported types of the same name.
67+
- **Multiple entry points are what puts every page under `bee-js/src`.** typedoc names a module directory after each entry point's path, so the whole reference arrives one subtree down. `generate-api.mjs` moves that subtree up as one piece, which is what keeps the relative links inside it correct without rewriting any of them. Should bee-js move `src/modules` or rename the entry file, that lift is the first thing to break.
68+
3769
## Maintainers
3870

3971
See what "Maintainer" means [here](https://github.com/ethersphere/repo-maintainer).

TASK.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Current task
2+
3+
There are several open issues with titles only. Maybe they are already fixed. Please assess them:
4+
5+
- New functions: getWithdrawableStake, withdrawSurplusStake and migrateStake
6+
- New functions: withdrawBZZToExternalWallet and withdrawDAIToExternalWallet
7+
- Deprecation: withdrawTokens and depositTokens
8+
- new Bytes is unnecessary, simply use toHex() on the returned classes
9+
10+
Please note that the methods in these issues are from before the namespace restructuring, so you'll have to cross-check with the wandered method names.

docs/api/Overview.md

Lines changed: 27 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,30 +17,52 @@ sidebar_position: 0
1717

1818
## Classes
1919

20+
- [Balance](classes/Balance.md)
2021
- [BatchId](classes/BatchId.md)
2122
- [Bee](classes/Bee.md)
2223
- [BeeArgumentError](classes/BeeArgumentError.md)
23-
- [BeeDev](classes/BeeDev.md)
2424
- [BeeError](classes/BeeError.md)
2525
- [BeeResponseError](classes/BeeResponseError.md)
2626
- [Bytes](classes/Bytes.md)
2727
- [BZZ](classes/BZZ.md)
28+
- [Cheque](classes/Cheque.md)
29+
- [Chequebook](classes/Chequebook.md)
30+
- [Chunk](classes/Chunk.md)
31+
- [ChunkBuilder](classes/ChunkBuilder.md)
32+
- [ChunkSplitter](classes/ChunkSplitter.md)
33+
- [Collection](classes/Collection.md)
34+
- [Connectivity](classes/Connectivity.md)
2835
- [DAI](classes/DAI.md)
36+
- [Data](classes/Data.md)
2937
- [Duration](classes/Duration.md)
3038
- [EthAddress](classes/EthAddress.md)
39+
- [Feed](classes/Feed.md)
3140
- [FeedIndex](classes/FeedIndex.md)
41+
- [File](classes/File.md)
42+
- [Grantee](classes/Grantee.md)
3243
- [Identifier](classes/Identifier.md)
3344
- [MantarayNode](classes/MantarayNode.md)
45+
- [Messaging](classes/Messaging.md)
3446
- [PeerAddress](classes/PeerAddress.md)
47+
- [Pin](classes/Pin.md)
3548
- [PrivateKey](classes/PrivateKey.md)
3649
- [PublicKey](classes/PublicKey.md)
3750
- [Reference](classes/Reference.md)
51+
- [Settlement](classes/Settlement.md)
3852
- [Signature](classes/Signature.md)
3953
- [Size](classes/Size.md)
54+
- [Soc](classes/Soc.md)
4055
- [Span](classes/Span.md)
56+
- [Stake](classes/Stake.md)
57+
- [Stamp](classes/Stamp.md)
4158
- [Stamper](classes/Stamper.md)
59+
- [Status](classes/Status.md)
60+
- [Storage](classes/Storage.md)
61+
- [Tag](classes/Tag.md)
4262
- [Topic](classes/Topic.md)
63+
- [Transaction](classes/Transaction.md)
4364
- [TransactionId](classes/TransactionId.md)
65+
- [Wallet](classes/Wallet.md)
4466

4567
## Interfaces
4668

@@ -58,6 +80,7 @@ sidebar_position: 0
5880
- [Cheque](interfaces/Cheque.md)
5981
- [ChequebookAddressResponse](interfaces/ChequebookAddressResponse.md)
6082
- [ChequebookBalanceResponse](interfaces/ChequebookBalanceResponse.md)
83+
- [Chunk](interfaces/Chunk.md)
6184
- [CollectionEntry](interfaces/CollectionEntry.md)
6285
- [CollectionUploadOptions](interfaces/CollectionUploadOptions.md)
6386
- [Data](interfaces/Data.md)
@@ -98,6 +121,7 @@ sidebar_position: 0
98121
- [RemovePeerResponse](interfaces/RemovePeerResponse.md)
99122
- [ReserveState](interfaces/ReserveState.md)
100123
- [Settlements](interfaces/Settlements.md)
124+
- [SingleOwnerChunk](interfaces/SingleOwnerChunk.md)
101125
- [SOCReader](interfaces/SOCReader.md)
102126
- [SOCWriter](interfaces/SOCWriter.md)
103127
- [Tag](interfaces/Tag.md)
@@ -107,6 +131,7 @@ sidebar_position: 0
107131
- [TransactionResponse](interfaces/TransactionResponse.md)
108132
- [UploadHeaders](interfaces/UploadHeaders.md)
109133
- [UploadOptions](interfaces/UploadOptions.md)
134+
- [UploadProgress](interfaces/UploadProgress.md)
110135
- [UploadResult](interfaces/UploadResult.md)
111136
- [WalletBalance](interfaces/WalletBalance.md)
112137

@@ -121,8 +146,8 @@ sidebar_position: 0
121146
## Variables
122147

123148
- [BRANCHES](variables/BRANCHES.md)
149+
- [capacityBreakpoints](variables/capacityBreakpoints.md)
124150
- [CHUNK\_SIZE](variables/CHUNK_SIZE.md)
125-
- [FEED\_INDEX\_HEX\_LENGTH](variables/FEED_INDEX_HEX_LENGTH.md)
126151
- [NULL\_ADDRESS](variables/NULL_ADDRESS.md)
127152
- [NULL\_IDENTIFIER](variables/NULL_IDENTIFIER.md)
128153
- [NULL\_OWNER](variables/NULL_OWNER.md)

docs/api/classes/BZZ.md

Lines changed: 47 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
# Class: BZZ
22

3-
Defined in: [bee-js/src/utils/tokens.ts:4](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L4)
3+
Defined in: [bee-js/src/utils/tokens.ts:4](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L4)
44

55
## Properties
66

77
### DIGITS
88

99
> `readonly` `static` **DIGITS**: `16` = `16`
1010
11-
Defined in: [bee-js/src/utils/tokens.ts:5](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L5)
11+
Defined in: [bee-js/src/utils/tokens.ts:5](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L5)
1212

1313
## Methods
1414

1515
### divide()
1616

1717
> **divide**(`other`): `BZZ`
1818
19-
Defined in: [bee-js/src/utils/tokens.ts:63](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L63)
19+
Defined in: [bee-js/src/utils/tokens.ts:71](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L71)
2020

2121
Does not mutate the current BZZ instance.
2222

@@ -40,7 +40,7 @@ New BZZ instance
4040

4141
> **eq**(`other`): `boolean`
4242
43-
Defined in: [bee-js/src/utils/tokens.ts:83](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L83)
43+
Defined in: [bee-js/src/utils/tokens.ts:91](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L91)
4444

4545
#### Parameters
4646

@@ -58,7 +58,7 @@ Defined in: [bee-js/src/utils/tokens.ts:83](https://github.com/ethersphere/bee-j
5858

5959
> **exchangeToDAI**(`daiPerBzz`): [`DAI`](DAI.md)
6060
61-
Defined in: [bee-js/src/utils/tokens.ts:87](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L87)
61+
Defined in: [bee-js/src/utils/tokens.ts:95](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L95)
6262

6363
#### Parameters
6464

@@ -76,7 +76,7 @@ Defined in: [bee-js/src/utils/tokens.ts:87](https://github.com/ethersphere/bee-j
7676

7777
> **gt**(`other`): `boolean`
7878
79-
Defined in: [bee-js/src/utils/tokens.ts:67](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L67)
79+
Defined in: [bee-js/src/utils/tokens.ts:75](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L75)
8080

8181
#### Parameters
8282

@@ -94,7 +94,7 @@ Defined in: [bee-js/src/utils/tokens.ts:67](https://github.com/ethersphere/bee-j
9494

9595
> **gte**(`other`): `boolean`
9696
97-
Defined in: [bee-js/src/utils/tokens.ts:71](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L71)
97+
Defined in: [bee-js/src/utils/tokens.ts:79](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L79)
9898

9999
#### Parameters
100100

@@ -112,7 +112,7 @@ Defined in: [bee-js/src/utils/tokens.ts:71](https://github.com/ethersphere/bee-j
112112

113113
> **lt**(`other`): `boolean`
114114
115-
Defined in: [bee-js/src/utils/tokens.ts:75](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L75)
115+
Defined in: [bee-js/src/utils/tokens.ts:83](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L83)
116116

117117
#### Parameters
118118

@@ -130,7 +130,7 @@ Defined in: [bee-js/src/utils/tokens.ts:75](https://github.com/ethersphere/bee-j
130130

131131
> **lte**(`other`): `boolean`
132132
133-
Defined in: [bee-js/src/utils/tokens.ts:79](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L79)
133+
Defined in: [bee-js/src/utils/tokens.ts:87](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L87)
134134

135135
#### Parameters
136136

@@ -148,7 +148,7 @@ Defined in: [bee-js/src/utils/tokens.ts:79](https://github.com/ethersphere/bee-j
148148

149149
> **minus**(`other`): `BZZ`
150150
151-
Defined in: [bee-js/src/utils/tokens.ts:53](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L53)
151+
Defined in: [bee-js/src/utils/tokens.ts:61](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L61)
152152

153153
Does not mutate the current BZZ instance.
154154

@@ -172,7 +172,7 @@ New BZZ instance
172172

173173
> **plus**(`other`): `BZZ`
174174
175-
Defined in: [bee-js/src/utils/tokens.ts:43](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L43)
175+
Defined in: [bee-js/src/utils/tokens.ts:51](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L51)
176176

177177
Does not mutate the current BZZ instance.
178178

@@ -196,19 +196,31 @@ New BZZ instance
196196

197197
> **toDecimalString**(): `string`
198198
199-
Defined in: [bee-js/src/utils/tokens.ts:29](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L29)
199+
Defined in: [bee-js/src/utils/tokens.ts:33](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L33)
200200

201201
#### Returns
202202

203203
`string`
204204

205205
***
206206

207+
### toFloat()
208+
209+
> **toFloat**(): `number`
210+
211+
Defined in: [bee-js/src/utils/tokens.ts:37](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L37)
212+
213+
#### Returns
214+
215+
`number`
216+
217+
***
218+
207219
### toPLURBigInt()
208220

209221
> **toPLURBigInt**(): `bigint`
210222
211-
Defined in: [bee-js/src/utils/tokens.ts:25](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L25)
223+
Defined in: [bee-js/src/utils/tokens.ts:29](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L29)
212224

213225
#### Returns
214226

@@ -220,7 +232,7 @@ Defined in: [bee-js/src/utils/tokens.ts:25](https://github.com/ethersphere/bee-j
220232

221233
> **toPLURString**(): `string`
222234
223-
Defined in: [bee-js/src/utils/tokens.ts:21](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L21)
235+
Defined in: [bee-js/src/utils/tokens.ts:25](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L25)
224236

225237
#### Returns
226238

@@ -232,7 +244,7 @@ Defined in: [bee-js/src/utils/tokens.ts:21](https://github.com/ethersphere/bee-j
232244

233245
> **toSignificantDigits**(`digits`): `string`
234246
235-
Defined in: [bee-js/src/utils/tokens.ts:33](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L33)
247+
Defined in: [bee-js/src/utils/tokens.ts:41](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L41)
236248

237249
#### Parameters
238250

@@ -250,7 +262,7 @@ Defined in: [bee-js/src/utils/tokens.ts:33](https://github.com/ethersphere/bee-j
250262

251263
> `static` **fromDecimalString**(`string`): `BZZ`
252264
253-
Defined in: [bee-js/src/utils/tokens.ts:13](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L13)
265+
Defined in: [bee-js/src/utils/tokens.ts:13](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L13)
254266

255267
#### Parameters
256268

@@ -264,11 +276,29 @@ Defined in: [bee-js/src/utils/tokens.ts:13](https://github.com/ethersphere/bee-j
264276

265277
***
266278

279+
### fromFloat()
280+
281+
> `static` **fromFloat**(`float`): `BZZ`
282+
283+
Defined in: [bee-js/src/utils/tokens.ts:21](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L21)
284+
285+
#### Parameters
286+
287+
##### float
288+
289+
`number`
290+
291+
#### Returns
292+
293+
`BZZ`
294+
295+
***
296+
267297
### fromPLUR()
268298

269299
> `static` **fromPLUR**(`plur`): `BZZ`
270300
271-
Defined in: [bee-js/src/utils/tokens.ts:17](https://github.com/ethersphere/bee-js/blob/3abbe2b1b264d6b586511a56e93badb2236bd09d/src/utils/tokens.ts#L17)
301+
Defined in: [bee-js/src/utils/tokens.ts:17](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/utils/tokens.ts#L17)
272302

273303
#### Parameters
274304

0 commit comments

Comments
 (0)