@pioneer-platform/swapkit-client 0.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/CHANGELOG.md ADDED
@@ -0,0 +1,10 @@
1
+ # @pioneer-platform/swapkit-client
2
+
3
+ ## 0.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - chore: chore: chore: chore: fix: move @types/pdfkit to dependencies for Docker --production build
8
+ - Updated dependencies
9
+ - @pioneer-platform/pioneer-caip@9.10.9
10
+ - @pioneer-platform/pioneer-coins@9.11.9
package/README.md ADDED
@@ -0,0 +1,159 @@
1
+ # SwapKit Integration
2
+
3
+ API-only integration with SwapKit for cross-chain swaps and DEX aggregation, explicitly excluding THORChain and MayaChain providers.
4
+
5
+ ## Overview
6
+
7
+ This module integrates with the SwapKit API (https://api.swapkit.dev) to provide:
8
+ - Cross-chain swaps via Chainflip and NEAR protocols
9
+ - DEX aggregation via 1inch, Jupiter, and other providers
10
+ - Multi-chain support for 14+ EVM and non-EVM chains
11
+
12
+ **Note**: THORChain and MayaChain providers are explicitly excluded from this integration.
13
+
14
+ ## Supported Networks
15
+
16
+ - **Ethereum Mainnet** (eip155:1)
17
+ - **Arbitrum** (eip155:42161)
18
+ - **Base** (eip155:8453)
19
+ - **Optimism** (eip155:10)
20
+ - **Polygon** (eip155:137)
21
+ - **Avalanche C-Chain** (eip155:43114)
22
+ - **BSC** (eip155:56)
23
+ - **Gnosis** (eip155:100)
24
+ - **Berachain** (eip155:80094)
25
+ - **Monad** (eip155:143)
26
+ - **Hyperliquid** (eip155:2868)
27
+ - **Sonic** (eip155:146)
28
+ - **Unichain** (eip155:130)
29
+ - **Aurora** (eip155:1313161554)
30
+
31
+ ## SwapKit Capabilities
32
+
33
+ ### ✅ What SwapKit Supports:
34
+
35
+ 1. **Cross-Chain Swaps** (via Chainflip, NEAR):
36
+ - ETH → BTC, SOL, etc.
37
+ - Cross-chain token swaps between major chains
38
+
39
+ 2. **Single-Chain DEX Aggregation**:
40
+ - Best rates across multiple DEXs on same chain
41
+ - Supports 1inch (ETH, AVAX, ARB, BSC), Jupiter (SOL)
42
+
43
+ 3. **Cross-Chain DEX Aggregation** (Swap Ins):
44
+ - Any token on source chain → major tokens on destination chain
45
+ - Currently: 1inch + Chainflip on ETH, AVAX, BSC
46
+
47
+ ### ❌ What SwapKit Does NOT Support:
48
+
49
+ 1. **Native L2 Bridges**:
50
+ - ETH mainnet → BASE/ARB/OP (use native bridges)
51
+ - L2 → L2 direct bridging (use dedicated bridge protocols)
52
+
53
+ 2. **THORChain/MayaChain Routes** (excluded by design in this integration)
54
+
55
+ 3. **Stablecoin Bridges**:
56
+ - Cross-chain USDC/USDT transfers may have limited or no routes
57
+ - Native token bridges (Circle CCTP, etc.) are not aggregated
58
+
59
+ ## Usage
60
+
61
+ ```typescript
62
+ import swapkit from '@pioneer-platform/pioneer-swapkit'
63
+
64
+ // Initialize
65
+ await swapkit.init({})
66
+
67
+ // Get quote for cross-chain swap (ETH → BTC via Chainflip)
68
+ const quote = await swapkit.getQuote({
69
+ sellAsset: 'eip155:1/slip44:60', // ETH mainnet native
70
+ buyAsset: 'bip122:000000000019d6689c085ae165831e93/slip44:0', // BTC
71
+ sellAmount: '1000000000000000', // 0.001 ETH in wei
72
+ senderAddress: '0x...',
73
+ recipientAddress: 'bc1...',
74
+ slippage: 3 // 3% slippage
75
+ })
76
+
77
+ // Get quote for same-chain swap (ETH USDC → ETH via 1inch)
78
+ const sameChainQuote = await swapkit.getQuote({
79
+ sellAsset: 'eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48', // USDC
80
+ buyAsset: 'eip155:1/slip44:60', // ETH
81
+ sellAmount: '1000000', // 1 USDC (6 decimals)
82
+ senderAddress: '0x...',
83
+ recipientAddress: '0x...',
84
+ slippage: 3
85
+ })
86
+ ```
87
+
88
+ ## CAIP to SwapKit Asset Conversion
89
+
90
+ The integration converts CAIP identifiers to SwapKit format:
91
+
92
+ ### Native Assets:
93
+ - `eip155:1/slip44:60` → `ETH.ETH` (Ethereum mainnet)
94
+ - `eip155:8453/slip44:60` → `BASE.ETH` (Base - native ETH)
95
+ - `eip155:42161/slip44:60` → `ARB.ETH` (Arbitrum - native ETH)
96
+ - `eip155:10/slip44:60` → `OP.ETH` (Optimism - native ETH)
97
+ - `eip155:43114/slip44:9000` → `AVAX.AVAX` (Avalanche)
98
+ - `eip155:137/slip44:966` → `MATIC.MATIC` (Polygon)
99
+
100
+ ### ERC20 Tokens:
101
+ - `eip155:1/erc20:0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48` → `ETH.USDC-0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48`
102
+
103
+ ## API Configuration
104
+
105
+ Set your SwapKit API key in environment variables:
106
+
107
+ ```bash
108
+ SWAPKIT_API_KEY=your_api_key_here
109
+ ```
110
+
111
+ Get your API key from: https://partners.swapkit.dev/
112
+
113
+ ## Testing
114
+
115
+ ```bash
116
+ bun run test
117
+ ```
118
+
119
+ Test suite includes:
120
+ - Native ETH cross-chain swaps
121
+ - ERC20 token bridges
122
+ - L2 ↔ L2 operations
123
+ - Error handling and validation
124
+
125
+ ## Response Format
126
+
127
+ Successful quote response:
128
+ ```typescript
129
+ [{
130
+ provider: 'CHAINFLIP',
131
+ sellAsset: 'ETH.ETH',
132
+ buyAsset: 'BTC.BTC',
133
+ amountOut: '0.00123',
134
+ fees: [...],
135
+ estimatedTime: 600,
136
+ // ... additional fields
137
+ }]
138
+ ```
139
+
140
+ ## Known Limitations
141
+
142
+ 1. **No Native L2 Bridges**: For ETH → BASE/ARB/OP, use dedicated bridge services
143
+ 2. **Limited Stablecoin Routes**: Cross-chain USDC may not have routes via SwapKit
144
+ 3. **THORChain Excluded**: By design - use THORChain SDK directly if needed
145
+ 4. **Provider Availability**: Some routes may not be available depending on liquidity and provider status
146
+
147
+ ## Documentation
148
+
149
+ - SwapKit API Docs: https://docs.swapkit.dev/
150
+ - API Swagger: https://api.swapkit.dev/docs/
151
+ - Track Swaps: https://track.swapkit.dev/
152
+
153
+ ## Integration Notes
154
+
155
+ This integration is designed to work with the Pioneer Router. It:
156
+ - Focuses on cross-chain swaps via Chainflip/NEAR
157
+ - Aggregates best DEX rates for single-chain swaps
158
+ - Excludes THORChain/MayaChain to avoid duplication with other integrations
159
+ - Returns standardized quote format compatible with Pioneer SDK