Skip to content

Commit bf3fdb0

Browse files
committed
chore: initial release setup
1 parent 91a8f27 commit bf3fdb0

File tree

10 files changed

+140
-31
lines changed

10 files changed

+140
-31
lines changed

.github/workflows/docs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
run: pnpm install
2929

3030
- name: Build docs
31-
run: pnpm docs
31+
run: pnpm run docs
3232

3333
- name: Deploy to GitHub Pages
3434
uses: peaceiris/actions-gh-pages@v3

.github/workflows/release.yml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,27 @@ jobs:
99
release:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v4
13-
- uses: actions/setup-node@v4
12+
- name: Checkout Code
13+
uses: actions/checkout@v4
14+
15+
- name: Setup Node.js
16+
uses: actions/setup-node@v4
1417
with:
1518
node-version: 20
1619
registry-url: 'https://registry.npmjs.org/'
20+
1721
- name: Install pnpm
1822
run: npm install -g pnpm
19-
- run: pnpm install
20-
- run: pnpm run build
21-
- run: npx semantic-release --no-ci
23+
24+
- name: Install Dependencies
25+
run: pnpm install
26+
27+
- name: Build Package
28+
run: pnpm run build
29+
30+
- name: Run Semantic Release
31+
run: npx semantic-release
2232
env:
2333
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
34+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
35+
CI: true

.npmrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
2-
access=public
2+
access=public

.releaserc.json

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
11
{
22
"branches": ["main"],
3+
"tagFormat": "v${version}",
4+
"release": {
5+
"initialVersion": "0.0.1"
6+
},
37
"plugins": [
4-
"@semantic-release/commit-analyzer",
8+
[
9+
"@semantic-release/commit-analyzer",
10+
{
11+
"releaseRules": [
12+
{ "type": "*", "release": "patch" }
13+
],
14+
"parserOpts": {
15+
"noteKeywords": ["BREAKING CHANGE", "BREAKING CHANGES"]
16+
}
17+
}
18+
],
519
"@semantic-release/release-notes-generator",
620
"@semantic-release/changelog",
7-
"@semantic-release/npm",
21+
[
22+
"@semantic-release/npm",
23+
{
24+
"npmPublish": true
25+
}
26+
],
827
"@semantic-release/github"
9-
],
10-
"release": {
11-
"initialVersion": "0.0.1"
12-
}
28+
]
1329
}

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contributing to uni-dev-kit
1+
# Contributing to uniswap-dev-kit
22

33
Thanks for your interest in contributing! Here's how to get started:
44

README.md

Lines changed: 75 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,92 @@
1-
# uni-dev-kit
1+
# uniswap-dev-kit
22

33
[![CI](https://github.com/BootNodeDev/uni-dev-kit/actions/workflows/ci.yml/badge.svg)](https://github.com/BootNodeDev/uni-dev-kit/actions/workflows/ci.yml)
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)
5-
[![Docs](https://img.shields.io/badge/docs-typedoc-blue)](https://github.com/BootNodeDev/uni-dev-kit/tree/main/docs)
5+
[![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 into your dapp.
7+
A modern TypeScript library for integrating Uniswap V4 into your dapp.
88

99
## Installation
1010

1111
```bash
12-
pnpm install uni-dev-kit
12+
pnpm install uniswap-dev-kit
1313
```
1414

15-
## Usage
15+
## Quick Start
16+
17+
### 1. Configure and create an SDK instance
18+
19+
```ts
20+
import { createInstance } from 'uniswap-dev-kit';
21+
22+
const config = {
23+
chainId: 1,
24+
rpcUrl: 'https://eth.llamarpc.com',
25+
contracts: {
26+
poolManager: '0x...',
27+
positionDescriptor: '0x...',
28+
positionManager: '0x...',
29+
quoter: '0x...',
30+
stateView: '0x...',
31+
universalRouter: '0x...',
32+
permit2: '0x...'
33+
}
34+
};
35+
36+
createInstance(config);
37+
```
38+
39+
### 2. Use the getQuote function (vanilla JS/TS)
1640

1741
```ts
18-
import { useUniswap, someFunction } from 'uni-dev-kit';
42+
import { getQuote } from 'uniswap-dev-kit';
43+
import { parseEther } from 'viem';
44+
45+
const quote = await getQuote({
46+
tokens: [
47+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48", // USDC
48+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2" // WETH
49+
],
50+
feeTier: 3000,
51+
tickSpacing: 60,
52+
amountIn: parseEther("1"), // 1 ETH in wei
53+
zeroForOne: true
54+
});
55+
console.log(quote.amountOut);
56+
```
57+
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
65+
66+
### 3. Use the useGetQuote hook (React)
67+
68+
```tsx
69+
import { useGetQuote } from 'uniswap-dev-kit';
70+
import { parseEther } from 'viem';
1971

20-
// Example React hook usage
21-
const result = useUniswap(/* params */);
72+
function QuoteComponent() {
73+
const { data, isLoading, error } = useGetQuote({
74+
params: {
75+
tokens: [
76+
"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
77+
"0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"
78+
],
79+
feeTier: 3000,
80+
tickSpacing: 60,
81+
amountIn: parseEther("1"),
82+
zeroForOne: true
83+
}
84+
});
2285

23-
// Example function usage
24-
const data = someFunction(/* params */);
86+
if (isLoading) return <span>Loading...</span>;
87+
if (error) return <span>Error: {error.message}</span>;
88+
return <span>Quote: {data?.amountOut?.toString()}</span>;
89+
}
2590
```
2691

2792
## Documentation

biome.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
}
99
},
1010
"files": {
11-
"include": ["src/**/*", "test/**/*"]
11+
"include": ["src/**/*", "test/**/*"],
12+
"ignore": ["dist/**/*"]
1213
}
1314
}

package.json

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "uni-dev-kit",
2+
"name": "uniswap-dev-kit",
33
"version": "0.0.1",
44
"description": "A modern TypeScript library for integrating Uniswap into your dapp.",
55
"main": "dist/index.js",
@@ -10,7 +10,9 @@
1010
"require": "./dist/index.js"
1111
}
1212
},
13-
"files": ["dist/**/*"],
13+
"files": [
14+
"dist/**/*"
15+
],
1416
"scripts": {
1517
"dev": "tsc --watch",
1618
"build": "npm run clean && tsc && tsc-alias",
@@ -43,6 +45,10 @@
4345
],
4446
"author": "BootNodeDev",
4547
"license": "MIT",
48+
"publishConfig": {
49+
"access": "public",
50+
"registry": "https://registry.npmjs.org/"
51+
},
4652
"peerDependencies": {
4753
"@tanstack/react-query": "^5.0.0",
4854
"react": "^18.0.0",

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@
2424
},
2525
},
2626
"include": ["src/**/*"],
27-
"exclude": ["node_modules", "dist"]
27+
"exclude": ["node_modules", "dist", "docs"]
2828
}

vitest.config.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1+
import path from "path";
12
import { defineConfig } from "vitest/config";
23

34
export default defineConfig({
45
test: {
56
environment: "jsdom",
67
globals: true,
78
alias: {
8-
"@": "/src",
9+
"@": path.resolve(__dirname, "src"),
910
},
11+
exclude: ["node_modules", "dist", ".git", ".cache"],
12+
coverage: {
13+
provider: "v8",
14+
reporter: ["text", "json", "html"],
15+
include: ["src/**/*.ts"],
16+
exclude: ["src/**/*.test.ts"],
17+
all: true,
18+
},
19+
clearMocks: true,
1020
},
11-
});
21+
});

0 commit comments

Comments
 (0)