@bitzy-app/bitzy-sdk 0.0.4 → 0.0.6
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/CHANGELOG.md +100 -0
- package/README.md +13 -13
- package/package.json +12 -15
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
## [0.0.6](https://github.com/bitzy-app/bitzy-sdk/compare/v0.0.5...v0.0.6) (2025-09-08)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## [0.0.5](https://github.com/bitzy-app/bitzy-sdk/compare/v0.0.4...v0.0.5) (2025-09-08)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* bundle all dependencies for zero conflicts ([1d45278](https://github.com/bitzy-app/bitzy-sdk/commit/1d452785f61c071cc0779e88aa61e0e7de4d73d4))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# Changelog
|
|
15
|
+
|
|
16
|
+
All notable changes to this project will be documented in this file.
|
|
17
|
+
|
|
18
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
19
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
20
|
+
|
|
21
|
+
## [Unreleased]
|
|
22
|
+
|
|
23
|
+
## [0.0.4] - 2024-09-08
|
|
24
|
+
|
|
25
|
+
### Added
|
|
26
|
+
- **Core Functions:**
|
|
27
|
+
- `fetchSwapRoute()` - Main route finding function with intelligent routing
|
|
28
|
+
- `fetchBatchSwapRoutes()` - Multiple routes fetching simultaneously
|
|
29
|
+
- `getSwapQuote()` - Simple price quote without full routing details
|
|
30
|
+
- `fetchSwapRouteSimple()` - Minimal configuration route fetching
|
|
31
|
+
- **React Hooks:**
|
|
32
|
+
- `useSwapV3Routes()` - Main React hook with hot reloading and auto-updates
|
|
33
|
+
- **Utility Functions:**
|
|
34
|
+
- `isHighValueToken()` - Check if token is high-value for optimal routing
|
|
35
|
+
- `getPartCountOffline()` - Offline part count calculation
|
|
36
|
+
- `getPartCountOnline()` - Online part count with real-time data
|
|
37
|
+
- `getPartCountWithFallback()` - Part count with fallback logic
|
|
38
|
+
- `clearMinimumAmountsCache()` - Cache management
|
|
39
|
+
- `APIClient.resetInstance()` - Reset singleton APIClient
|
|
40
|
+
- **Network Support:**
|
|
41
|
+
- Botanix Mainnet (Chain ID: 3637)
|
|
42
|
+
- Botanix Testnet (Chain ID: 3636)
|
|
43
|
+
- **Features:**
|
|
44
|
+
- Intelligent routing optimization based on token characteristics
|
|
45
|
+
- Automatic wrap/unwrap detection
|
|
46
|
+
- Multiple liquidity sources (V2 and V3)
|
|
47
|
+
- TypeScript support with full type definitions
|
|
48
|
+
- Source maps for debugging
|
|
49
|
+
- Comprehensive error handling
|
|
50
|
+
|
|
51
|
+
### Fixed
|
|
52
|
+
- Dependency conflicts with Privy.io packages
|
|
53
|
+
- Peer dependency resolution issues
|
|
54
|
+
- Bundle all dependencies (viem, bignumber.js, lodash) for zero conflicts
|
|
55
|
+
- Eliminated need for `--legacy-peer-deps` or `--force` flags
|
|
56
|
+
|
|
57
|
+
### Changed
|
|
58
|
+
- Moved all dependencies to devDependencies for complete isolation
|
|
59
|
+
- Bundle size increased to ~65KB (includes all dependencies)
|
|
60
|
+
- Only React remains as optional peer dependency
|
|
61
|
+
|
|
62
|
+
## [0.0.3] - 2024-09-08
|
|
63
|
+
|
|
64
|
+
### Fixed
|
|
65
|
+
- Moved viem from peerDependencies to regular dependencies
|
|
66
|
+
- Removed conflicting overrides
|
|
67
|
+
- Improved dependency resolution
|
|
68
|
+
|
|
69
|
+
### Changed
|
|
70
|
+
- Bundle size increased to ~65KB (includes viem)
|
|
71
|
+
- More reliable installation process
|
|
72
|
+
|
|
73
|
+
## [0.0.2] - 2024-09-08
|
|
74
|
+
|
|
75
|
+
### Fixed
|
|
76
|
+
- Added overrides to resolve Privy.io dependency conflicts
|
|
77
|
+
- Made peer dependencies optional
|
|
78
|
+
- Improved compatibility with existing projects
|
|
79
|
+
|
|
80
|
+
### Added
|
|
81
|
+
- `peerDependenciesMeta` configuration
|
|
82
|
+
- Override support for dependency conflicts
|
|
83
|
+
|
|
84
|
+
## [0.0.1] - 2024-09-08
|
|
85
|
+
|
|
86
|
+
### Added
|
|
87
|
+
- Initial package setup with proper npm configuration
|
|
88
|
+
- Basic build configuration with Rollup
|
|
89
|
+
- TypeScript support with declaration files
|
|
90
|
+
- MIT license
|
|
91
|
+
- Comprehensive README with usage examples
|
|
92
|
+
- `.npmignore` for proper package distribution
|
|
93
|
+
- Git repository initialization
|
|
94
|
+
- Basic project structure:
|
|
95
|
+
- `src/common/` - Common functions
|
|
96
|
+
- `src/hooks/` - React hooks
|
|
97
|
+
- `src/services/` - Core logic
|
|
98
|
+
- `src/types/` - TypeScript interfaces
|
|
99
|
+
- `src/utils/` - Utility functions
|
|
100
|
+
- `src/constants/` - Constants and ABIs
|
package/README.md
CHANGED
|
@@ -15,11 +15,11 @@ A comprehensive SDK for fetching swap routes and executing swaps on Bitzy's dece
|
|
|
15
15
|
### **Installation**
|
|
16
16
|
|
|
17
17
|
```bash
|
|
18
|
-
npm install @bitzy/
|
|
18
|
+
npm install @bitzy-app/bitzy-sdk
|
|
19
19
|
# or
|
|
20
|
-
yarn add @bitzy/
|
|
20
|
+
yarn add @bitzy-app/bitzy-sdk
|
|
21
21
|
# or
|
|
22
|
-
pnpm add @bitzy/
|
|
22
|
+
pnpm add @bitzy-app/bitzy-sdk
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
## **1. Using Functions**
|
|
@@ -27,7 +27,7 @@ pnpm add @bitzy/swap-sdk
|
|
|
27
27
|
### **1.1 `fetchSwapRoute()` - Main Route Finding Function**
|
|
28
28
|
|
|
29
29
|
```typescript
|
|
30
|
-
import { fetchSwapRoute } from '@bitzy/
|
|
30
|
+
import { fetchSwapRoute } from '@bitzy-app/bitzy-sdk';
|
|
31
31
|
|
|
32
32
|
// Basic usage with defaults
|
|
33
33
|
const result = await fetchSwapRoute({
|
|
@@ -57,7 +57,7 @@ console.log('Distributions:', result.distributions);
|
|
|
57
57
|
### **1.2 `fetchBatchSwapRoutes()` - Multiple Routes at Once**
|
|
58
58
|
|
|
59
59
|
```typescript
|
|
60
|
-
import { fetchBatchSwapRoutes } from '@bitzy/
|
|
60
|
+
import { fetchBatchSwapRoutes } from '@bitzy-app/bitzy-sdk';
|
|
61
61
|
|
|
62
62
|
// Fetch multiple routes simultaneously
|
|
63
63
|
const results = await fetchBatchSwapRoutes([
|
|
@@ -94,7 +94,7 @@ results.forEach((result, index) => {
|
|
|
94
94
|
### **1.3 `getSwapQuote()` - Simple Price Quote**
|
|
95
95
|
|
|
96
96
|
```typescript
|
|
97
|
-
import { getSwapQuote } from '@bitzy/
|
|
97
|
+
import { getSwapQuote } from '@bitzy-app/bitzy-sdk';
|
|
98
98
|
|
|
99
99
|
// Get a simple quote without full routing details
|
|
100
100
|
const quote = await getSwapQuote(
|
|
@@ -112,7 +112,7 @@ console.log('Route count:', quote.routes);
|
|
|
112
112
|
### **1.4 `fetchSwapRouteSimple()` - Minimal Configuration**
|
|
113
113
|
|
|
114
114
|
```typescript
|
|
115
|
-
import { fetchSwapRouteSimple } from '@bitzy/
|
|
115
|
+
import { fetchSwapRouteSimple } from '@bitzy-app/bitzy-sdk';
|
|
116
116
|
|
|
117
117
|
// Simplified function with minimal parameters
|
|
118
118
|
const result = await fetchSwapRouteSimple(
|
|
@@ -131,7 +131,7 @@ console.log('Best route:', result.routes[0]);
|
|
|
131
131
|
### **2.1 `useSwapV3Routes()` - Main React Hook**
|
|
132
132
|
|
|
133
133
|
```tsx
|
|
134
|
-
import { useSwapV3Routes } from '@bitzy/
|
|
134
|
+
import { useSwapV3Routes } from '@bitzy-app/bitzy-sdk';
|
|
135
135
|
|
|
136
136
|
function SwapComponent() {
|
|
137
137
|
const [srcToken, setSrcToken] = useState(btcToken);
|
|
@@ -221,7 +221,7 @@ Here are generic examples showing how to execute swaps using direct contract cal
|
|
|
221
221
|
#### **Example 1: Using Viem with BitzyAggregator Contract**
|
|
222
222
|
|
|
223
223
|
```tsx
|
|
224
|
-
import { useSwapV3Routes } from '@bitzy/
|
|
224
|
+
import { useSwapV3Routes } from '@bitzy-app/bitzy-sdk';
|
|
225
225
|
import { useWriteContract, useAccount } from 'wagmi';
|
|
226
226
|
import { parseUnits, formatUnits } from 'viem';
|
|
227
227
|
|
|
@@ -401,7 +401,7 @@ function SwapComponent() {
|
|
|
401
401
|
#### **Example 2: Using Ethers.js**
|
|
402
402
|
|
|
403
403
|
```typescript
|
|
404
|
-
import { useSwapV3Routes } from '@bitzy/
|
|
404
|
+
import { useSwapV3Routes } from '@bitzy-app/bitzy-sdk';
|
|
405
405
|
import { ethers } from 'ethers';
|
|
406
406
|
|
|
407
407
|
function SwapWithEthers() {
|
|
@@ -484,7 +484,7 @@ function SwapWithEthers() {
|
|
|
484
484
|
#### **Example 3: Using Web3.js**
|
|
485
485
|
|
|
486
486
|
```typescript
|
|
487
|
-
import { useSwapV3Routes } from '@bitzy/
|
|
487
|
+
import { useSwapV3Routes } from '@bitzy-app/bitzy-sdk';
|
|
488
488
|
import Web3 from 'web3';
|
|
489
489
|
|
|
490
490
|
function SwapWithWeb3() {
|
|
@@ -776,7 +776,7 @@ interface Token {
|
|
|
776
776
|
### **Backend Usage (Node.js)**
|
|
777
777
|
|
|
778
778
|
```typescript
|
|
779
|
-
import { fetchSwapRoute, fetchBatchSwapRoutes } from '@bitzy/
|
|
779
|
+
import { fetchSwapRoute, fetchBatchSwapRoutes } from '@bitzy-app/bitzy-sdk';
|
|
780
780
|
|
|
781
781
|
// Express.js endpoint
|
|
782
782
|
app.post('/api/swap/routes', async (req, res) => {
|
|
@@ -822,7 +822,7 @@ import {
|
|
|
822
822
|
getPartCountWithFallback,
|
|
823
823
|
clearMinimumAmountsCache,
|
|
824
824
|
APIClient
|
|
825
|
-
} from '@bitzy/
|
|
825
|
+
} from '@bitzy-app/bitzy-sdk';
|
|
826
826
|
|
|
827
827
|
// Check if token is high-value (requires chainId)
|
|
828
828
|
const isHighValue = isHighValueToken(token, 3637);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bitzy-app/bitzy-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.6",
|
|
4
4
|
"description": "Bitzy Swap V3 Routes SDK for frontend and backend applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
11
|
"README.md",
|
|
12
|
-
"LICENSE"
|
|
12
|
+
"LICENSE",
|
|
13
|
+
"CHANGELOG.md"
|
|
13
14
|
],
|
|
14
15
|
"scripts": {
|
|
15
16
|
"build": "rollup -c",
|
|
@@ -18,7 +19,9 @@
|
|
|
18
19
|
"prepublishOnly": "npm run clean && npm run build",
|
|
19
20
|
"test": "jest",
|
|
20
21
|
"lint": "eslint src --ext .ts,.tsx",
|
|
21
|
-
"type-check": "tsc --noEmit"
|
|
22
|
+
"type-check": "tsc --noEmit",
|
|
23
|
+
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
|
|
24
|
+
"version": "npm run changelog && git add CHANGELOG.md"
|
|
22
25
|
},
|
|
23
26
|
"keywords": [
|
|
24
27
|
"bitzy",
|
|
@@ -36,28 +39,27 @@
|
|
|
36
39
|
"type": "git",
|
|
37
40
|
"url": "https://github.com/bitzy-app/bitzy-sdk"
|
|
38
41
|
},
|
|
39
|
-
"dependencies": {
|
|
40
|
-
"bignumber.js": "^9.1.2",
|
|
41
|
-
"lodash": "^4.17.21",
|
|
42
|
-
"viem": "^2.0.0"
|
|
43
|
-
},
|
|
44
42
|
"devDependencies": {
|
|
45
43
|
"@rollup/plugin-commonjs": "^25.0.0",
|
|
46
44
|
"@rollup/plugin-node-resolve": "^15.0.0",
|
|
47
|
-
"@rollup/plugin-typescript": "^11.0.0",
|
|
48
45
|
"@rollup/plugin-terser": "^0.4.4",
|
|
46
|
+
"@rollup/plugin-typescript": "^11.0.0",
|
|
49
47
|
"@types/jest": "^30.0.0",
|
|
50
48
|
"@types/lodash": "^4.14.202",
|
|
51
49
|
"@types/node": "^20.0.0",
|
|
52
50
|
"@types/react": "^18.0.0",
|
|
51
|
+
"bignumber.js": "^9.1.2",
|
|
52
|
+
"conventional-changelog-cli": "^5.0.0",
|
|
53
53
|
"eslint": "^8.0.0",
|
|
54
54
|
"jest": "^29.7.0",
|
|
55
|
+
"lodash": "^4.17.21",
|
|
55
56
|
"rimraf": "^6.0.1",
|
|
56
57
|
"rollup": "^4.0.0",
|
|
57
58
|
"rollup-plugin-dts": "^6.0.0",
|
|
58
59
|
"ts-jest": "^29.4.1",
|
|
59
60
|
"tslib": "^2.6.0",
|
|
60
|
-
"typescript": "^5.0.0"
|
|
61
|
+
"typescript": "^5.0.0",
|
|
62
|
+
"viem": "^2.0.0"
|
|
61
63
|
},
|
|
62
64
|
"peerDependencies": {
|
|
63
65
|
"react": ">=16.8.0"
|
|
@@ -67,11 +69,6 @@
|
|
|
67
69
|
"optional": true
|
|
68
70
|
}
|
|
69
71
|
},
|
|
70
|
-
"overrides": {
|
|
71
|
-
"@privy-io/wagmi": {
|
|
72
|
-
"@privy-io/react-auth": "^2.0.0"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
72
|
"publishConfig": {
|
|
76
73
|
"access": "public",
|
|
77
74
|
"registry": "https://registry.npmjs.org/"
|