mirror of
https://github.com/oceanprotocol/react.git
synced 2025-01-23 00:18:12 +01:00
more docs updates
This commit is contained in:
parent
977c4e2a83
commit
01ec93658f
14
README.md
14
README.md
@ -22,8 +22,8 @@
|
||||
|
||||
- [🏗 Installation](#-installation)
|
||||
- [🏄 Usage](#-usage)
|
||||
- [Providers](#providers)
|
||||
- [Hooks](#hooks)
|
||||
- [1. Providers](#1-providers)
|
||||
- [2. Hooks](#2-hooks)
|
||||
- [🦑 Development](#-development)
|
||||
- [✨ Code Style](#-code-style)
|
||||
- [👩🔬 Testing](#-testing)
|
||||
@ -44,9 +44,9 @@ npm install @oceanprotocol/react
|
||||
|
||||
## 🏄 Usage
|
||||
|
||||
First, wrap your whole app with the `Web3Provider` and the `OceanProvider`.
|
||||
First, wrap your whole app with the [`Web3Provider`](src/providers/Web3Provider) and the [`OceanProvider`](src/providers/OceanProvider).
|
||||
|
||||
### Providers
|
||||
### 1. Providers
|
||||
|
||||
```tsx
|
||||
import React, { ReactNode } from 'react'
|
||||
@ -78,9 +78,9 @@ export default function MyApp({
|
||||
|
||||
The `OceanProvider` requires a Web3 instance to be passed as prop so you can replace the basic [`Web3Provider`](src/providers/Web3Provider) with whatever component/library/provider returning a Web3 instance.
|
||||
|
||||
### Hooks
|
||||
### 2. Hooks
|
||||
|
||||
Then within your component use the provided hooks to interact with Ocean's functionality. Each hook can be used independently:
|
||||
Then within your component use the included hooks to interact with Ocean's functionality. Each hook can be used independently:
|
||||
|
||||
```tsx
|
||||
import React from 'react'
|
||||
@ -156,7 +156,7 @@ npm run format
|
||||
The build script will compile `src/` with `tsc` into:
|
||||
|
||||
1. CommonJS module with ES5 syntax
|
||||
2. ES module with ES5 syntax
|
||||
2. ES module with ES6 syntax
|
||||
|
||||
```bash
|
||||
npm run build
|
||||
|
@ -1 +0,0 @@
|
||||
// noop
|
@ -2,4 +2,4 @@ import './@types/globals'
|
||||
|
||||
export * from './providers'
|
||||
export * from './hooks'
|
||||
export * from './components'
|
||||
// export * from './components'
|
||||
|
@ -3,11 +3,11 @@ import Web3 from 'web3'
|
||||
async function getWeb3(): Promise<Web3> {
|
||||
let web3: Web3
|
||||
|
||||
// modern dapp browsers
|
||||
// modern dapp browser
|
||||
if (window.ethereum) {
|
||||
web3 = new Web3(window.ethereum as any)
|
||||
web3 = new Web3(window.ethereum)
|
||||
}
|
||||
// legacy dapp browsers
|
||||
// legacy dapp browser
|
||||
else if (window.web3) {
|
||||
web3 = new Web3(window.web3.currentProvider)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user