Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Check both out at the release you are documenting, then run:
$ npm run generate-api
```

This drives typedoc via `typedoc.config.mjs` and reshapes the output into the layout the site expects: it flattens the `Utils` namespace into `docs/api/namespaces/Utils`, 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`).
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`).

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.

Expand All @@ -63,7 +63,8 @@ Review the result as a diff against what is already committed. Anything unrelate
- **`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.
- **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.
- **`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.
- **The namespace classes are missing on purpose.** 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 emits no pages for them. They cannot simply be added as entry points — their names collide with exported types (`Data`, `Tag`, `Pin`, `Collection`, `Cheque`, `Chunk`). They are documented by hand in `docs/documentation/overview.md`.
- **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.
- **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.

## Maintainers

Expand Down
10 changes: 10 additions & 0 deletions TASK.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Current task

There are several open issues with titles only. Maybe they are already fixed. Please assess them:

- New functions: getWithdrawableStake, withdrawSurplusStake and migrateStake
- New functions: withdrawBZZToExternalWallet and withdrawDAIToExternalWallet
- Deprecation: withdrawTokens and depositTokens
- new Bytes is unnecessary, simply use toHex() on the returned classes

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.
25 changes: 21 additions & 4 deletions docs/api/Overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@ slug: /api/
sidebar_position: 0
---

:::info Namespace methods
This reference covers everything `@ethersphere/bee-js` exports. The classes behind `bee.data`, `bee.file`, `bee.stamp` and the other [namespaces](../documentation/overview.md#namespaces) are internal to the library and have no page of their own here. The [SDK Overview](../documentation/overview.md#bee-api) lists every namespaced method together with the Bee endpoint it calls.
:::

## Namespaces

- [Utils](./namespaces/Utils/approximateOverheadForRedundancyLevel.md)
Expand All @@ -21,31 +17,52 @@ This reference covers everything `@ethersphere/bee-js` exports. The classes behi

## Classes

- [Balance](classes/Balance.md)
- [BatchId](classes/BatchId.md)
- [Bee](classes/Bee.md)
- [BeeArgumentError](classes/BeeArgumentError.md)
- [BeeError](classes/BeeError.md)
- [BeeResponseError](classes/BeeResponseError.md)
- [Bytes](classes/Bytes.md)
- [BZZ](classes/BZZ.md)
- [Cheque](classes/Cheque.md)
- [Chequebook](classes/Chequebook.md)
- [Chunk](classes/Chunk.md)
- [ChunkBuilder](classes/ChunkBuilder.md)
- [ChunkSplitter](classes/ChunkSplitter.md)
- [Collection](classes/Collection.md)
- [Connectivity](classes/Connectivity.md)
- [DAI](classes/DAI.md)
- [Data](classes/Data.md)
- [Duration](classes/Duration.md)
- [EthAddress](classes/EthAddress.md)
- [Feed](classes/Feed.md)
- [FeedIndex](classes/FeedIndex.md)
- [File](classes/File.md)
- [Grantee](classes/Grantee.md)
- [Identifier](classes/Identifier.md)
- [MantarayNode](classes/MantarayNode.md)
- [Messaging](classes/Messaging.md)
- [PeerAddress](classes/PeerAddress.md)
- [Pin](classes/Pin.md)
- [PrivateKey](classes/PrivateKey.md)
- [PublicKey](classes/PublicKey.md)
- [Reference](classes/Reference.md)
- [Settlement](classes/Settlement.md)
- [Signature](classes/Signature.md)
- [Size](classes/Size.md)
- [Soc](classes/Soc.md)
- [Span](classes/Span.md)
- [Stake](classes/Stake.md)
- [Stamp](classes/Stamp.md)
- [Stamper](classes/Stamper.md)
- [Status](classes/Status.md)
- [Storage](classes/Storage.md)
- [Tag](classes/Tag.md)
- [Topic](classes/Topic.md)
- [Transaction](classes/Transaction.md)
- [TransactionId](classes/TransactionId.md)
- [Wallet](classes/Wallet.md)

## Interfaces

Expand Down
125 changes: 125 additions & 0 deletions docs/api/classes/Balance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# Class: Balance

Defined in: [bee-js/src/modules/balance.ts:12](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L12)

SWAP balance operations. Related to the bandwidth incentives and the chequebook.

Accessed as `bee.balance`.

## Constructors

### Constructor

> **new Balance**(`context`): `Balance`

Defined in: [bee-js/src/modules/balance.ts:13](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L13)

#### Parameters

##### context

`BeeContext`

#### Returns

`Balance`

## Methods

### getAll()

> **getAll**(`requestOptions?`): `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\>

Defined in: [bee-js/src/modules/balance.ts:20](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L20)

Gets the SWAP balances with all known peers including prepaid services.

#### Parameters

##### requestOptions?

[`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md)

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

#### Returns

`Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\>

***

### getAllPastDueConsumption()

> **getAllPastDueConsumption**(`requestOptions?`): `Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\>

Defined in: [bee-js/src/modules/balance.ts:41](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L41)

Gets the past due consumption balances for all known peers.

#### Parameters

##### requestOptions?

[`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md)

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

#### Returns

`Promise`\<[`BalanceResponse`](../interfaces/BalanceResponse.md)\>

***

### getAllPastDueConsumptionForPeer()

> **getAllPastDueConsumptionForPeer**(`address`, `requestOptions?`): `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\>

Defined in: [bee-js/src/modules/balance.ts:51](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L51)

Gets the past due consumption balance for a specific peer.

#### Parameters

##### address

Swarm address of peer

`string` | [`PeerAddress`](../classes/PeerAddress.md)

##### requestOptions?

[`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md)

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

#### Returns

`Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\>

***

### getPeer()

> **getPeer**(`address`, `requestOptions?`): `Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\>

Defined in: [bee-js/src/modules/balance.ts:30](https://github.com/ethersphere/bee-js/blob/bab2b2e5a3874187d29a1c1e6c70f2f645ed53c2/src/modules/balance.ts#L30)

Gets the SWAP balances for a specific peer including prepaid services.

#### Parameters

##### address

Swarm address of peer

`string` | [`PeerAddress`](../classes/PeerAddress.md)

##### requestOptions?

[`BeeRequestOptions`](../type-aliases/BeeRequestOptions.md)

Options for making requests, such as timeouts, custom HTTP agents, headers, etc.

#### Returns

`Promise`\<[`PeerBalance`](../interfaces/PeerBalance.md)\>
Loading
Loading