wagmi-extended 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +35 -33
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,12 +10,12 @@ It simplifies common tasks such as fetching token metadata, approving ERC20 toke
|
|
|
10
10
|
- [Installation](#installation)
|
|
11
11
|
- [Requirements](#requirements)
|
|
12
12
|
- [API](#api)
|
|
13
|
-
- [Setup](#setup)
|
|
14
13
|
- [Usage](#usage)
|
|
15
14
|
- [useERC20ApproveX Hook](#useerc20approvex-hook)
|
|
16
15
|
- [useContractWriteX Hook](#usecontractwritex-hook)
|
|
17
16
|
- [useSendTransactionX Hook](#usesendtransactionx-hook)
|
|
18
17
|
- [useTokenX Hook](#usetokenx-hook)
|
|
18
|
+
- [Non-hook functions setup](#Non-hook-functions-setup)
|
|
19
19
|
- [License](#license)
|
|
20
20
|
|
|
21
21
|
### Installation
|
|
@@ -60,38 +60,6 @@ import {
|
|
|
60
60
|
|
|
61
61
|
Each hook is documented with detailed JSDoc comments (including usage examples) in the source code. Refer to that documentation for additional details.
|
|
62
62
|
|
|
63
|
-
## Setup
|
|
64
|
-
|
|
65
|
-
For easier use of fetch (non hook) functions setup the default configuration.
|
|
66
|
-
<br />
|
|
67
|
-
This is done by calling `setDefaults` in your application initialization (e.g., in index.tsx or App.tsx).
|
|
68
|
-
|
|
69
|
-
Example:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
// index.tsx (or App.tsx)
|
|
73
|
-
import React from "react";
|
|
74
|
-
import ReactDOM from "react-dom/client";
|
|
75
|
-
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
76
|
-
import { useConfig } from "wagmi";
|
|
77
|
-
import { setDefaults } from "wagmi-extended";
|
|
78
|
-
|
|
79
|
-
const queryClient = new QueryClient();
|
|
80
|
-
// Obtain your Wagmi configuration from your initialization or provider
|
|
81
|
-
const wagmiConfig = /* your wagmi config here */;
|
|
82
|
-
|
|
83
|
-
// Set defaults for the extended library functions.
|
|
84
|
-
setDefaults(queryClient, wagmiConfig);
|
|
85
|
-
|
|
86
|
-
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
87
|
-
<React.StrictMode>
|
|
88
|
-
<QueryClientProvider client={queryClient}>
|
|
89
|
-
<App />
|
|
90
|
-
</QueryClientProvider>
|
|
91
|
-
</React.StrictMode>
|
|
92
|
-
);
|
|
93
|
-
```
|
|
94
|
-
|
|
95
63
|
## Hooks explanations and examples
|
|
96
64
|
|
|
97
65
|
### useERC20ApproveX Hook
|
|
@@ -219,6 +187,40 @@ function TokenDisplay({ tokenAddress }: { tokenAddress: Address }) {
|
|
|
219
187
|
}
|
|
220
188
|
```
|
|
221
189
|
|
|
190
|
+
## Non-hook functions setup
|
|
191
|
+
|
|
192
|
+
**Feel free to skip Setup-section if using only hooks - no fetch methods directly**
|
|
193
|
+
<br />
|
|
194
|
+
For easier use of fetch (non hook) functions setup the default configuration.
|
|
195
|
+
<br />
|
|
196
|
+
This is done by calling `setDefaults` in your application initialization (e.g., in index.tsx or App.tsx).
|
|
197
|
+
|
|
198
|
+
Example:
|
|
199
|
+
|
|
200
|
+
```bash
|
|
201
|
+
// index.tsx (or App.tsx)
|
|
202
|
+
import React from "react";
|
|
203
|
+
import ReactDOM from "react-dom/client";
|
|
204
|
+
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
205
|
+
import { useConfig } from "wagmi";
|
|
206
|
+
import { setDefaults } from "wagmi-extended";
|
|
207
|
+
import { wagmiConfig } from "/your/path/to/wagmi-config";
|
|
208
|
+
|
|
209
|
+
const queryClient = new QueryClient();
|
|
210
|
+
// Obtain your Wagmi configuration from your initialization or provider
|
|
211
|
+
|
|
212
|
+
// Set defaults for the extended library functions.
|
|
213
|
+
setDefaults(queryClient, wagmiConfig);
|
|
214
|
+
|
|
215
|
+
ReactDOM.createRoot(document.getElementById("root")!).render(
|
|
216
|
+
<React.StrictMode>
|
|
217
|
+
<QueryClientProvider client={queryClient}>
|
|
218
|
+
<App />
|
|
219
|
+
</QueryClientProvider>
|
|
220
|
+
</React.StrictMode>
|
|
221
|
+
);
|
|
222
|
+
```
|
|
223
|
+
|
|
222
224
|
### License
|
|
223
225
|
|
|
224
226
|
This is free and unencumbered software released into the public domain.
|