Skip to content

Commit 56a8c40

Browse files
feat: feeds and general improvements (#51)
Co-authored-by: Vojtech Simetka <[email protected]>
1 parent 7bcfc6a commit 56a8c40

File tree

4 files changed

+45
-8
lines changed

4 files changed

+45
-8
lines changed

docs/user-documentation/getting-started.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ yarn add @ethersphere/bee-js --save
3434
<TabItem value="script">
3535

3636
```html
37-
<script src="https://unpkg.com/@ethersphere/bee-js/dist/index.js"></script>
37+
<script src="https://unpkg.com/@ethersphere/bee-js/dist/index.browser.min.js"></script>
3838
```
3939

4040
</TabItem>
@@ -76,3 +76,16 @@ That’s it! now you can use the `bee` object.
7676
:::info Run your own Bee node
7777
You can find out more about running Bee node in the [Bee docs](https://docs.ethswarm.org/docs/installation/quick-start)
7878
:::
79+
80+
:::tip Using `<script>` import
81+
82+
If you include `bee-js` using the `unpkg.com` script link then all the exported components will be available to you
83+
under global namespace `BeeJs`:
84+
85+
```html
86+
<script src="https://unpkg.com/@ethersphere/bee-js/dist/index.browser.min.js"></script>
87+
<script>
88+
const bee = new BeeJs.Bee('...')
89+
</script>
90+
```
91+
:::

docs/user-documentation/soc-and-feeds.md

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,34 @@ const data = soc.payload()
3636

3737
### Writing SOCs
3838

39-
When writing a SOC, first, we need to make a writer object. Because we need to sign the chunk, we need to pass in a `signer` object. The `signer` object can be either an Ethereum private key (as a hex string or `Uint8Array`) or an instance of the `Signer` interface. The `Signer` interface can be used for integration with 3rd party Ethereum wallet applications because Swarm uses the same format for signing chunks that Ethereum uses for signing transactions.
39+
When writing a SOC, first, we need to make a writer object. Because we need to sign the chunk, we need to pass in a `signer` object. The `signer` object can be either an Ethereum private key (as a hex string or `Uint8Array`) or an instance of the [`Signer`](../api/types/signer.md) interface. The `Signer` interface can be used for integration with 3rd party Ethereum wallet applications because Swarm uses the same format for signing chunks that Ethereum uses for signing transactions.
40+
41+
:::info Default `signer`
42+
43+
When you are instantiating `Bee` class you can pass it a default signer that will be used if you won't specify it
44+
directly for the `makeSOCWriter`. See [`Bee` constructor](../api/classes/bee.md#constructor) for more info.
45+
46+
:::
47+
48+
:::tip Ethereum Wallet signers
49+
50+
If you want to use your browser Ethereum Wallet like Metamask you can use utility called [`makeEthereumWalletSigner`](../api/functions/utils.eth.makeethereumwalletsigner.md) that we ship with bee-js
51+
which creates a [`Signer`](../api/types/signer.md) object out of given EIP-1193 compatible provider.
52+
53+
See it used in our example [here](https://github.com/ethersphere/examples-js/tree/master/eth-wallet-signing).
54+
55+
```js
56+
import { utils } from '@ethersphere/bee-js'
57+
58+
const signer = utils.Eth.makeEthereumWalletSigner(window.ethereum)
59+
...
60+
```
61+
:::
62+
4063

4164
```ts
42-
type SyncSigner = (digest: Uint8Array) => Signature
43-
type AsyncSigner = (digest: Uint8Array) => Promise<Signature>
65+
type SyncSigner = (digest: Data) => Signature | string
66+
type AsyncSigner = (digest: Data) => Promise<Signature | string>
4467

4568
/**
4669
* Interface for implementing Ethereum compatible signing.

docs/user-documentation/upload-download.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ Uploading your data to Swarm is easy with `bee-js`. Based on your needs you can
1515

1616
### Data
1717

18-
You can upload and retrieve any `string` or `Uint8Array` data with [`uploadData`](./api/classes/bee#uploaddata) and [`downloadData`](./api/classes/bee#downloaddata) functions.
18+
You can upload and retrieve any `string` or `Uint8Array` data with [`uploadData`](../api/classes/bee.md#uploaddata) and [`downloadData`](../api/classes/bee.md#downloaddata) functions.
1919

20-
When you download data the return type is [`Data`](./api/types/data) interface which extends `Uint8Array` with convenience functions like:
20+
When you download data the return type is [`Data`](../api/interfaces/data.md) interface which extends `Uint8Array` with convenience functions like:
2121

2222
- `text()` that converts the bytes into UTF-8 encoded string
2323
- `hex()` that converts the bytes into **non-prefixed** hex string
@@ -103,7 +103,7 @@ console.log(retrievedFile.data.text()) // prints 'Bee is awesome!'
103103
</TabItem>
104104
</Tabs>
105105

106-
In browsers, you can upload directly `File` type. The filename is taken from the file object itself, but can be overwritten through the second argument of the `uploadFile` function (see the [API docs](./api/classes/bee#uploadfile))
106+
In browsers, you can upload directly `File` type. The filename is taken from the file object itself, but can be overwritten through the second argument of the `uploadFile` function (see the [API docs](../api/classes/bee.md#uploadfile))
107107

108108
<Tabs
109109
groupId="lang_preferrence"

src/css/custom.css

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)