@sanketsaagar/polygon-kit 0.1.1 → 0.1.3
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 +15 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -16,28 +16,28 @@ PolygonKit is a comprehensive React library inspired by OnchainKit, specifically
|
|
|
16
16
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
|
-
### Install from
|
|
19
|
+
### Install from NPM (Recommended)
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
npm install
|
|
22
|
+
npm install @sanketsaagar/polygon-kit wagmi viem @tanstack/react-query
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
or
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
|
-
yarn add
|
|
28
|
+
yarn add @sanketsaagar/polygon-kit wagmi viem @tanstack/react-query
|
|
29
29
|
```
|
|
30
30
|
|
|
31
31
|
or
|
|
32
32
|
|
|
33
33
|
```bash
|
|
34
|
-
pnpm add
|
|
34
|
+
pnpm add @sanketsaagar/polygon-kit wagmi viem @tanstack/react-query
|
|
35
35
|
```
|
|
36
36
|
|
|
37
|
-
### Install from
|
|
37
|
+
### Install from GitHub
|
|
38
38
|
|
|
39
39
|
```bash
|
|
40
|
-
npm install
|
|
40
|
+
npm install github:sanketsaagar/polygonKit wagmi viem @tanstack/react-query
|
|
41
41
|
```
|
|
42
42
|
|
|
43
43
|
## Quick Start
|
|
@@ -45,7 +45,7 @@ npm install @polygon/polygon-kit wagmi viem @tanstack/react-query
|
|
|
45
45
|
### 1. Wrap your app with PolygonKitProvider
|
|
46
46
|
|
|
47
47
|
```tsx
|
|
48
|
-
import { PolygonKitProvider } from '@
|
|
48
|
+
import { PolygonKitProvider } from '@sanketsaagar/polygon-kit';
|
|
49
49
|
|
|
50
50
|
function App() {
|
|
51
51
|
return (
|
|
@@ -59,7 +59,7 @@ function App() {
|
|
|
59
59
|
### 2. Use Wallet Components
|
|
60
60
|
|
|
61
61
|
```tsx
|
|
62
|
-
import { Wallet, ConnectWallet, WalletDropdown } from '@
|
|
62
|
+
import { Wallet, ConnectWallet, WalletDropdown } from '@sanketsaagar/polygon-kit';
|
|
63
63
|
|
|
64
64
|
function Header() {
|
|
65
65
|
return (
|
|
@@ -74,7 +74,7 @@ function Header() {
|
|
|
74
74
|
### 3. Display User Identity
|
|
75
75
|
|
|
76
76
|
```tsx
|
|
77
|
-
import { Identity } from '@
|
|
77
|
+
import { Identity } from '@sanketsaagar/polygon-kit';
|
|
78
78
|
|
|
79
79
|
function UserProfile({ address }) {
|
|
80
80
|
return (
|
|
@@ -294,7 +294,7 @@ Token swap interface (integrate with your DEX aggregator).
|
|
|
294
294
|
Main hook for wallet interactions.
|
|
295
295
|
|
|
296
296
|
```tsx
|
|
297
|
-
import { usePolygonKit } from '@
|
|
297
|
+
import { usePolygonKit } from '@sanketsaagar/polygon-kit';
|
|
298
298
|
|
|
299
299
|
function Component() {
|
|
300
300
|
const { address, isConnected, chain, balance, connect, disconnect } = usePolygonKit();
|
|
@@ -325,7 +325,7 @@ function Component() {
|
|
|
325
325
|
Get token balance with formatting.
|
|
326
326
|
|
|
327
327
|
```tsx
|
|
328
|
-
import { usePolygonBalance } from '@
|
|
328
|
+
import { usePolygonBalance } from '@sanketsaagar/polygon-kit';
|
|
329
329
|
|
|
330
330
|
function Component({ address }) {
|
|
331
331
|
const { balance, formatted, symbol, isLoading } = usePolygonBalance(address);
|
|
@@ -354,7 +354,7 @@ function Component({ address }) {
|
|
|
354
354
|
Send transactions with status tracking.
|
|
355
355
|
|
|
356
356
|
```tsx
|
|
357
|
-
import { usePolygonTransaction } from '@
|
|
357
|
+
import { usePolygonTransaction } from '@sanketsaagar/polygon-kit';
|
|
358
358
|
|
|
359
359
|
function Component() {
|
|
360
360
|
const { send, hash, isPending, isConfirming, isSuccess } = usePolygonTransaction();
|
|
@@ -393,7 +393,7 @@ import {
|
|
|
393
393
|
shortenAddress,
|
|
394
394
|
formatBalance,
|
|
395
395
|
parseTokenAmount
|
|
396
|
-
} from '@
|
|
396
|
+
} from '@sanketsaagar/polygon-kit';
|
|
397
397
|
|
|
398
398
|
// Shorten address: 0x1234...5678
|
|
399
399
|
const short = shortenAddress('0x1234567890123456789012345678901234567890');
|
|
@@ -408,7 +408,7 @@ const parsed = parseTokenAmount('1.5', 18);
|
|
|
408
408
|
## Chain Constants
|
|
409
409
|
|
|
410
410
|
```tsx
|
|
411
|
-
import { polygon, polygonAmoy, polygonZkEVM } from '@
|
|
411
|
+
import { polygon, polygonAmoy, polygonZkEVM } from '@sanketsaagar/polygon-kit';
|
|
412
412
|
|
|
413
413
|
console.log(polygon.id); // 137
|
|
414
414
|
console.log(polygonAmoy.id); // 80002
|
|
@@ -435,7 +435,7 @@ import {
|
|
|
435
435
|
TransactionButton,
|
|
436
436
|
Swap,
|
|
437
437
|
usePolygonKit,
|
|
438
|
-
} from '@
|
|
438
|
+
} from '@sanketsaagar/polygon-kit';
|
|
439
439
|
|
|
440
440
|
function Dashboard() {
|
|
441
441
|
const { address, isConnected } = usePolygonKit();
|
package/package.json
CHANGED