44[ ![ Release] ( https://github.com/BootNodeDev/uni-dev-kit/actions/workflows/release.yml/badge.svg )] ( https://github.com/BootNodeDev/uni-dev-kit/actions/workflows/release.yml )
55[ ![ Docs] ( https://img.shields.io/badge/docs-typedoc-blue )] ( https://bootnodedev.github.io/uni-dev-kit )
66
7- A modern TypeScript library for integrating Uniswap V4 into your dapp.
7+ > Modern TypeScript SDK for integrating Uniswap V4 into your dapp.
8+ > ** Early version:** API may change rapidly.
89
9- ## Installation
10+ ---
11+
12+ ## Install
1013
1114``` bash
1215pnpm install uniswap-dev-kit
16+ # or
17+ npm install uniswap-dev-kit
1318```
1419
1520## Quick Start
1621
1722### 1. Configure and create an SDK instance
1823
1924``` ts
20- import { createInstance } from ' uniswap-dev-kit' ;
25+ import { createInstance } from " uniswap-dev-kit" ;
2126
2227const config = {
2328 chainId: 1 ,
24- rpcUrl: ' https://eth.llamarpc.com' ,
29+ rpcUrl: " https://eth.llamarpc.com" ,
2530 contracts: {
26- poolManager: ' 0x...' ,
27- positionDescriptor: ' 0x...' ,
28- positionManager: ' 0x...' ,
29- quoter: ' 0x...' ,
30- stateView: ' 0x...' ,
31- universalRouter: ' 0x...' ,
32- permit2: ' 0x...'
31+ poolManager: " 0x..." ,
32+ positionDescriptor: " 0x..." ,
33+ positionManager: " 0x..." ,
34+ quoter: " 0x..." ,
35+ stateView: " 0x..." ,
36+ universalRouter: " 0x..." ,
37+ permit2: " 0x..."
3338 }
3439};
3540
3641createInstance (config );
3742```
3843
39- ### 2. Use the getQuote function (vanilla JS/TS)
44+ ### 2. Get a quote (vanilla JS/TS)
4045
4146``` ts
42- import { getQuote } from ' uniswap-dev-kit' ;
43- import { parseEther } from ' viem' ;
47+ import { getQuote } from " uniswap-dev-kit" ;
48+ import { parseEther } from " viem" ;
4449
4550const quote = await getQuote ({
4651 tokens: [
@@ -49,25 +54,19 @@ const quote = await getQuote({
4954 ],
5055 feeTier: 3000 ,
5156 tickSpacing: 60 ,
52- amountIn: parseEther (" 1" ), // 1 ETH in wei
57+ amountIn: parseEther (" 1" ),
5358 zeroForOne: true
5459});
5560console .log (quote .amountOut );
5661```
5762
58- ** Parameters of getQuote:**
59- - ` tokens ` : ` [tokenA, tokenB] ` (addresses)
60- - ` feeTier ` : pool fee (e.g. 3000)
61- - ` tickSpacing ` : pool tick spacing (e.g. 60)
62- - ` amountIn ` : amount to swap (bigint, e.g. ` parseEther("1") ` )
63- - ` zeroForOne ` : swap direction (true: tokenA→tokenB)
64- - ` hooks ` and ` hookData ` : optional
63+ ### 3. Use in React (with hooks)
6564
66- ### 3. Use the useGetQuote hook (React)
65+ #### Get a quote
6766
6867``` tsx
69- import { useGetQuote } from ' uniswap-dev-kit' ;
70- import { parseEther } from ' viem' ;
68+ import { useGetQuote } from " uniswap-dev-kit" ;
69+ import { parseEther } from " viem" ;
7170
7271function QuoteComponent() {
7372 const { data, isLoading, error } = useGetQuote ({
@@ -89,10 +88,74 @@ function QuoteComponent() {
8988}
9089```
9190
92- ## Documentation
91+ #### Get a pool
92+
93+ ``` tsx
94+ import { useGetPool } from " uniswap-dev-kit" ;
95+
96+ function PoolComponent() {
97+ const { data, isLoading, error } = useGetPool ({
98+ params: {
99+ tokens: [
100+ " 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48" ,
101+ " 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
102+ ],
103+ fee: 3000 ,
104+ chainId: 1
105+ }
106+ });
107+
108+ if (isLoading ) return <span >Loading...</span >;
109+ if (error ) return <span >Error: { error .message } </span >;
110+ return <span >Pool: { JSON .stringify (data )} </span >;
111+ }
112+ ```
113+
114+ ---
115+
116+ ## API Reference
117+
118+ See [ full TypeDoc documentation] ( https://bootnodedev.github.io/uni-dev-kit ) for all methods, types, and advanced usage.
119+
120+ ---
121+
122+ ## Development
123+
124+ ### Scripts
125+
126+ - ` pnpm build ` — Build the library
127+ - ` pnpm test ` — Run all tests
128+ - ` pnpm lint ` — Lint code with Biome
129+ - ` pnpm format ` — Format code with Biome
130+ - ` pnpm docs ` — Generate API docs with TypeDoc
131+
132+ ### Contributing
133+
134+ See [ CONTRIBUTING.md] ( ./CONTRIBUTING.md ) for guidelines.
135+
136+ ### Release
137+
138+ - Releases are automated with [ semantic-release] ( https://semantic-release.gitbook.io/semantic-release/ ) .
139+ - Versioning: [ semver] ( https://semver.org/ )
140+
141+ ---
142+
143+ ## FAQ
144+
145+ - ** Which React versions are supported?**
146+ React 18+ (see peerDependencies)
147+ - ** Does it work in Node and browser?**
148+ Yes, but hooks are React-only.
149+ - ** Can I use my own ABIs?**
150+ Yes, but Uniswap V4 ABIs are included.
151+
152+ ---
153+
154+ ## License
93155
94- See [ API Documentation ] ( https://bootnodedev.github.io/uni-dev-kit ) for full API reference.
156+ MIT
95157
96158---
97159
98- > This is an early version. API and features will evolve rapidly.
160+ > Feedback, issues, and PRs welcome.
161+ > [ API Docs] ( https://bootnodedev.github.io/uni-dev-kit ) • [ Open an Issue] ( https://github.com/BootNodeDev/uni-dev-kit/issues )
0 commit comments