Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit 31c98c6

Browse files
authored
doc: update readme and doc site (#31)
1 parent f992c8c commit 31c98c6

File tree

5 files changed

+55
-35
lines changed

5 files changed

+55
-35
lines changed

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,10 @@ You can find some package documentation below:
1313

1414
The following examples are provided in the [examples](./examples/) folder of this repo.
1515

16-
- [uploadkit-with-nextjs-wallkit](./examples/uploadkit-with-nextjs-wallkit/)
16+
- [uploadkit-with-nextjs-walletkit](./examples/uploadkit-with-nextjs-walletkit/)
1717
- [uploadkit-with-nextjs-rainbowkit](./examples/uploadkit-with-nextjs-rainbowkit/)
18-
- [uploadkit-with-view-walletkit](./examples/uploadkit-with-view-walletkit/)
18+
- [uploadkit-with-vite-walletkit](./examples/uploadkit-with-vite-walletkit/)
19+
- [uploadkit-with-remix-rainbowkit](./examples/uploadkit-with-remix-rainbowkit/)
1920

2021
## Contributing
2122

docs/src/pages/index.mdx

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
# Greenfield UploadKit
22

3+
Greenfield UploadKit is a React component library for easily uploading objects to BNB Greenfield.
4+
35
## Installation
46

57
```bash
6-
npm i wagmi viem @bnb-chain/greenfield-js-sdk @bnb-chain/greenfield-cosmos-types @bnb-chain/reed-solomon
8+
npm i wagmi viem @node-real/greenfield-uploadkit @bnb-chain/greenfield-js-sdk @bnb-chain/greenfield-cosmos-types @bnb-chain/reed-solomon
79
```
810

911
- wagmi > 1.0.0
@@ -14,21 +16,27 @@ npm i wagmi viem @bnb-chain/greenfield-js-sdk @bnb-chain/greenfield-cosmos-types
1416

1517
## Examples
1618

17-
- [uploadkit-with-vite-walletkit](https://github.com/node-real/greenfield-toolkit/examples/uploadkit-with-vite-walletkit)
18-
- [uploadkit-with-nextjs-walletkit](https://github.com/node-real/greenfield-toolkit/examples/uploadkit-with-nextjs-walletkit)
19-
- [uploadkit-with-nextjs-rainbowkit](https://github.com/node-real/greenfield-toolkit/examples/uploadkit-with-nextjs-rainbowkit)
20-
- [uploadkit-with-remix-walletkit](https://github.com/node-real/greenfield-toolkit/examples/uploadkit-with-vite-walletkit)
19+
Explore these examples to get started:
20+
21+
- [uploadkit-with-nextjs-walletkit](https://github.com/node-real/greenfield-toolkit/tree/main/examples/uploadkit-with-nextjs-walletkit)
22+
- [uploadkit-with-nextjs-rainbowkit](https://github.com/node-real/greenfield-toolkit/tree/main/examples/uploadkit-with-nextjs-rainbowkit)
23+
- [uploadkit-with-vite-walletkit](https://github.com/node-real/greenfield-toolkit/tree/main/examples/uploadkit-with-vite-walletkit)
24+
- [uploadkit-with-remix-rainbowkit](https://github.com/node-real/greenfield-toolkit/tree/main/examples/uploadkit-with-remix-rainbowkit)
2125

2226
## Playground
2327

24-
In this example, we use [@totejs/walletkit](https://github.com/node-real/walletkit) as the component
25-
for connecting the wallet.
28+
Connect your wallet and switch to the BNB Greenfield Chain Testnet to securely upload files using
29+
the `@node-real/greenfield-uploadkit` component.
2630

2731
<UploadKitExample />
2832

29-
## How to use
33+
## How to Configure Greenfield UploadKit?
34+
35+
The configuration process is identical to that of the
36+
[uploadkit-with-nextjs-walletkit](https://github.com/node-real/greenfield-toolkit/tree/main/examples/uploadkit-with-nextjs-walletkit)
37+
example. Follow the steps below:
3038

31-
### 1. Import @node-real/greenfield-uploadkit styles
39+
### 1. Import Styles
3240

3341
```tsx live=false
3442
// 👇 Import @node-real/greenfield-uploadkit styles here.
@@ -120,13 +128,13 @@ export const client = Client.create(GRPC_URL, String(GREEN_CHAIN_ID), {
120128
});
121129
```
122130

123-
### 3. Add @totejs/walletkit as the wallet connection library, or connect with rainbowkit or wamgi.
131+
### 4. Integrate [@totejs/walletkit](https://github.com/node-real/walletkit) as the wallet connection library, or connect with [rainbowkit](https://github.com/rainbow-me/rainbowkit)
124132

125133
```bash
126134
npm install @totejs/walletkit
127135
```
128136

129-
### 4. Add WagmiConfig, WalletKitProvider and UploadKitProvider to your project.
137+
### 5. Add WagmiConfig, WalletKitProvider and UploadKitProvider configuration to your project
130138

131139
```tsx live=false
132140
import { WagmiConfig, createConfig } from 'wagmi';
@@ -187,30 +195,34 @@ export default function App({ Component, pageProps }: AppProps) {
187195
}
188196
```
189197

190-
## useUploadModal
198+
## Managing Modals and Upload Data Retrieval
191199

192-
Use the useUploadModal hook to show/dismiss the specific modal. It must be used within a
200+
### Managing Object Upload Modals
201+
202+
Use the `useUploadModal` hook to show/dismiss the specific modal. It must be used within a
193203
`<UploadKitProvider>`.
194204

195205
- `onOpenDragModal`: Open the drag files modal.
196206
- `onOpenUploadModal`: Open the upload tasks modal.
197207
- `onCloseModal`: Close the upload Modal.
198208

199-
## useUploadQueue
209+
### Retrieving Upload Data
200210

201-
Use the useUploadQueue hook to get details about the upload task queue.
211+
Use the `useUploadQueue` hook to get details about the upload task queue.
202212

203213
- `uploadQueue`: Details of the upload task queue.
204214

205-
## useTaskManagementButton
215+
### Manage Task ManagementButton
206216

207-
Use the useTaskManagementButton hook to show/dismiss the bottom -right button.
217+
Use the `useTaskManagementButton` hook to show/dismiss the bottom -right button.
208218

209219
- `isShow`: Indicates whether the button is displayed.
210220
- `onShow`: Function to display the button.
211221
- `onHide`: Function to hide the button.
212222

213-
## Handle upload errors by yourself
223+
## How to Handle Errors
224+
225+
Handle errors by passing them to the onError callback for custom error management.
214226

215227
```tsx live=false
216228
<UploadKitProvider
@@ -226,6 +238,8 @@ Use the useTaskManagementButton hook to show/dismiss the bottom -right button.
226238

227239
## Customizing theme
228240

241+
Customize the theme according to your application's design:
242+
229243
```tsx live=false
230244
type ThemeMode = 'auto' | 'dark' | 'light';
231245
type ThemeVariant = 'base';
@@ -236,7 +250,8 @@ type ThemeVariant = 'base';
236250
```
237251

238252
An example for custom theme as follows, or you can configure themes in both light and dark modes,
239-
for more details, please click [here]().
253+
for more details, please click
254+
[here](https://github.com/node-real/greenfield-toolkit/blob/main/packages/uploadkit/src/themes/base.ts).
240255

241256
```tsx live=false
242257
export const customTheme = {
@@ -324,25 +339,30 @@ export const customTheme = {
324339

325340
## Type definitions
326341

327-
### 1. UploadKitProviderProps
342+
### 1. Props for Configuring the UploadKitProvider Component.
328343

329344
```tsx live=false
345+
/**
346+
* Props for Configuring the UploadKitProvider Component.
347+
*
348+
* @property {UploadKitOptions} options - Configuration options for the UploadKitProvider.
349+
* @property {React.ReactNode} children - The children components rendered within the UploadKitProvider.
350+
* @property {ThemeVariant} [theme] - The theme variant for the UploadKitProvider.
351+
* @property {ThemeMode} [mode] - The mode for the UploadKitProvider.
352+
* @property {CustomTheme} [customTheme] - Custom theme settings for the UploadKitProvider.
353+
*/
330354
export interface UploadKitProviderProps {
331355
options: UploadKitOptions;
332356
children: React.ReactNode;
333357
theme?: ThemeVariant;
334358
mode?: ThemeMode;
335359
customTheme?: CustomTheme;
336360
}
337-
```
338-
339-
### 2. UploadKitOptions
340361

341-
```tsx live=false
342362
/**
343-
* UploadKitOptions is the options of the Greenfield UploadKit.
363+
* Configuration options for upload.
344364
*
345-
* @property {Client} client - THe Greenfield js sdk client, Reference: https://docs.bnbchain.org/greenfield-js-sdk/client/greenfield-client
365+
* @property {Client} client - The Greenfield js sdk client, Reference: https://docs.bnbchain.org/greenfield-js-sdk/client/greenfield-client
346366
*
347367
* @property {string} seedString -seedString is used to authenticate yourself to the provider. If not specified, the provider will generate one.
348368
* @property {(data: Uint8Array) => Promise<string[]>} [checksumFn] - The function to calculate the checksum of the object. If not specified, the provider will use the default checksum function.

examples/uploadkit-with-vite-walletkit/src/App.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import '@totejs/walletkit/styles.css';
21
import { WagmiConfig, createConfig } from 'wagmi';
32
import { chainList } from './chains';
43
import {

packages/uploadkit/README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,16 +16,16 @@ For full documentation, visit [here](https://node-real.github.io/greenfield-tool
1616

1717
The following examples are provided in the [examples](./examples/) folder of this repo.
1818

19-
- [uploadkit-with-vite-walletkit](./examples/uploadkit-with-vite-walletkit/)
20-
- [uploadkit-with-nextjs-walletkit](./examples/uploadkit-with-nextjs-walletkit/)
21-
- [uploadkit-with-nextjs-rainbowkit](./examples/uploadkit-with-nextjs-rainbowkit/)
22-
- [uploadkit-with-remix-rainbowkit]('./examples/uploadkit-with-remix-rainbowkit/)
19+
- [uploadkit-with-nextjs-walletkit](../../examples/uploadkit-with-nextjs-walletkit/)
20+
- [uploadkit-with-nextjs-rainbowkit](../../examples/uploadkit-with-nextjs-rainbowkit/)
21+
- [uploadkit-with-vite-walletkit](../../examples/uploadkit-with-vite-walletkit/)
22+
- [uploadkit-with-remix-rainbowkit](../../examples/uploadkit-with-remix-rainbowkit/)
2323

2424

2525
## Installation
2626

2727
```bash
28-
npm i wagmi viem @bnb-chain/greenfield-js-sdk @bnb-chain/greenfield-cosmos-types @bnb-chain/reed-solomon
28+
npm i wagmi viem @node-real/greenfield-uploadkit @bnb-chain/greenfield-js-sdk @bnb-chain/greenfield-cosmos-types @bnb-chain/reed-solomon
2929
```
3030

3131
## Usage

packages/uploadkit/src/components/UploadKitProvider/context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { VisibilityType } from '@bnb-chain/greenfield-cosmos-types/greenfield/st
66
/**
77
* UploadKitOptions is the options of the Greenfield UploadKit.
88
*
9-
* @property {Client} client - THe Greenfield js sdk client, Reference: https://docs.bnbchain.org/greenfield-js-sdk/client/greenfield-client
9+
* @property {Client} client - The Greenfield js sdk client, Reference: https://docs.bnbchain.org/greenfield-js-sdk/client/greenfield-client
1010
*
1111
* @property {string} seedString -seedString is used to authenticate yourself to the provider. If not specified, the provider will generate one.
1212
* @property {(data: Uint8Array) => Promise<string[]>} [checksumFn] - The function to calculate the checksum of the object. If not specified, the provider will use the default checksum function.

0 commit comments

Comments
 (0)