@switch-win/sdk 1.2.0 → 1.2.1

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/ROBINHOOD.md CHANGED
@@ -11,7 +11,7 @@ Production integration reference for Switch swaps on Robinhood Chain mainnet.
11
11
  | Explorer | `https://robinhoodchain.blockscout.com` |
12
12
  | Quote API | `https://quote.switch.win/swap/quote` |
13
13
  | Tax API | `https://quote.switch.win/swap/checkTax` |
14
- | Supported liquidity | Uniswap V2 and Uniswap V3 |
14
+ | Supported liquidity | Uniswap V2, V3, and hookless static-fee V4 |
15
15
  | Limit orders | Not currently available |
16
16
 
17
17
  ## Contents
@@ -20,6 +20,7 @@ Production integration reference for Switch swaps on Robinhood Chain mainnet.
20
20
  - [Authentication](#authentication)
21
21
  - [Network configuration](#network-configuration)
22
22
  - [Contracts and native currency](#contracts-and-native-currency)
23
+ - [Uniswap V4 routing](#uniswap-v4-routing)
23
24
  - [Swap integration flow](#swap-integration-flow)
24
25
  - [Quickstart](#quickstart)
25
26
  - [Tax-token checks](#tax-token-checks)
@@ -43,6 +44,7 @@ import {
43
44
  ROBINHOOD_CHAIN,
44
45
  ROBINHOOD_NATIVE_ETH,
45
46
  ROBINHOOD_SWITCH_CONTRACTS,
47
+ ROBINHOOD_UNISWAP_CONTRACTS,
46
48
  ROBINHOOD_TOKENS,
47
49
  ROBINHOOD_FEE_TOKEN_PRIORITY,
48
50
  ROBINHOOD_FRONTEND_DEFAULT_TOKENS,
@@ -103,9 +105,14 @@ await window.ethereum.request({
103
105
  | Contract | Address |
104
106
  |---|---|
105
107
  | SwitchRouter | `0x8730C3e2cF2c8CDa8E6166837A1Ed26f46aa9E59` |
106
- | SwitchRouterView | `0xFF6b56d3F444eB5b7FA1db047F57140C84810376` |
107
108
  | Uniswap V2 adapter | `0x7a14d7A8509a66209D4332843b983b29bF5604A4` |
108
109
  | Uniswap V3 adapter | `0xbcA08f296d9Ba0dc19Aa0E05D355365cE29A3205` |
110
+ | Uniswap V4 adapter | `0x754dDCD05aFbAd1cc7Bc42B9268EB586F579E7F6` |
111
+
112
+ The V4 adapter was created in
113
+ [deployment transaction `0x60d5...34a7`](https://robinhoodchain.blockscout.com/tx/0x60d56466a8162a643a15ecde98322ec05ea23d44d03fbd817df4ddbaef4834a7)
114
+ and added to the router in
115
+ [activation transaction `0x405b...1098`](https://robinhoodchain.blockscout.com/tx/0x405b49619ebfe4d1a73eb2d4601d8d1e63ae3d6fff0cd811a96c17e146971098).
109
116
 
110
117
  The router constant is the ERC-20 approval target. Always submit the swap to
111
118
  `quote.tx.to`; do not replace the API-provided transaction target with a
@@ -128,6 +135,64 @@ Use `ROBINHOOD_TOKENS.WETH.address` for the wrapped ERC-20:
128
135
  Native ETH does not require approval. WETH and every other ERC-20 input token
129
136
  must be approved for `ROBINHOOD_SWITCH_CONTRACTS.router`.
130
137
 
138
+ ## Uniswap V4 routing
139
+
140
+ Switch's Robinhood V4 integration is designed for canonical Uniswap V4, whose
141
+ pools share one `PoolManager`. A V4 pool is identified by its complete
142
+ `PoolKey`:
143
+
144
+ ```ts
145
+ type PoolKey = {
146
+ currency0: string;
147
+ currency1: string;
148
+ fee: number;
149
+ tickSpacing: number;
150
+ hooks: string;
151
+ };
152
+ ```
153
+
154
+ Do not treat V4 pools as V3 pools with another fee-tier list. The `fee`,
155
+ `tickSpacing`, and `hooks` values are all part of pool identity, and Robinhood
156
+ V4 discovery must preserve the full key. The backend selects the key and
157
+ embeds adapter-specific route data in the quote; clients should submit the
158
+ returned transaction unchanged rather than reconstructing V4 calldata.
159
+
160
+ Phase one supports **hookless static-fee pools only** (`hooks` is the zero
161
+ address, hook data is empty, and the dynamic-fee flag is not set). Pools with
162
+ custom hooks or dynamic fees are not considered until their behavior and
163
+ required hook data have been explicitly reviewed and allowed. This restriction
164
+ does not reduce V2 or V3 routing coverage.
165
+
166
+ V4 can represent native ETH as the zero-address currency. Switch routes use
167
+ the canonical Robinhood WETH address, so the V4 adapter unwraps WETH when a
168
+ selected pool consumes native ETH and wraps native ETH when that pool produces
169
+ it. API callers should continue using `ROBINHOOD_NATIVE_ETH` for a native user
170
+ input/output and `ROBINHOOD_TOKENS.WETH.address` for the ERC-20.
171
+
172
+ The Robinhood Uniswap V4 adapter is deployed at
173
+ `0x754dDCD05aFbAd1cc7Bc42B9268EB586F579E7F6`, whitelisted in the production
174
+ SwitchRouter at adapter index `2`, and exported as
175
+ `ROBINHOOD_SWITCH_CONTRACTS.uniswapV4Adapter`. Continue treating
176
+ `GET /swap/adapters?network=robinhood` as the source of truth for the adapters
177
+ currently available from the quote backend.
178
+
179
+ The canonical Robinhood V4 infrastructure is available through
180
+ `ROBINHOOD_UNISWAP_CONTRACTS`:
181
+
182
+ | Contract | Address |
183
+ |---|---|
184
+ | PoolManager | `0x8366a39cc670b4001a1121b8f6a443a643e40951` |
185
+ | PositionDescriptor | `0x9639443158e8c5efa35bd45287bf2effd3d8dc06` |
186
+ | PositionManager | `0x58daec3116aae6d93017baaea7749052e8a04fa7` |
187
+ | Quoter | `0x8dc178efb8111bb0973dd9d722ebeff267c98f94` |
188
+ | StateView | `0xf3334192d15450cdd385c8b70e03f9a6bd9e673b` |
189
+ | Universal Router | `0x8876789976decbfcbbbe364623c63652db8c0904` |
190
+ | Permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` |
191
+
192
+ Tax-token safety is unchanged: if either side is detected as a transfer-tax
193
+ token, the complete route is restricted to Uniswap V2 adapter index `0`.
194
+ Uniswap V3 and V4 are both excluded from that quote.
195
+
131
196
  ## Swap integration flow
132
197
 
133
198
  Use the same sequence as a PulseChain integration:
@@ -250,7 +315,7 @@ The no-tax priority list is:
250
315
  | 1 | WETH / native ETH | `0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73` / native sentinel |
251
316
  | 2 | USDG | `0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168` |
252
317
  | 3 | WALLET | `0x0339f5459FC690aC85F1782e15782A151b4A9E1b` |
253
- | 4 | SEEDCOIN | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` |
318
+ | 4 | SEEDCOIN | `0xD8d1C08A8bA4fc64BAC744f74290B89ADcb6Bf25` |
254
319
  | 5 | CASHCAT | `0x020bfC650A365f8BB26819deAAbF3E21291018b4` |
255
320
 
256
321
  The ordered ERC-20 addresses are exported as
@@ -346,6 +411,10 @@ Robinhood currently returns:
346
411
  |---:|---|
347
412
  | `0` | Uniswap V2 |
348
413
  | `1` | Uniswap V3 |
414
+ | `2` | Uniswap V4 |
415
+
416
+ Treat the endpoint response, not this document, as the source of truth for
417
+ which adapters are currently selectable.
349
418
 
350
419
  Do not permanently hard-code the available adapter list in an integration.
351
420
  Fetch it when presenting routing-source controls. If a quote involves a tax
@@ -390,7 +459,7 @@ GET https://quote.switch.win/swap/quote
390
459
  | `fee` | No | Partner/protocol fee in basis points. |
391
460
  | `partnerAddress` | No | Fee-sharing recipient. |
392
461
  | `feeOnOutput` | No | `true` takes the fee from output; `false` takes it from input. |
393
- | `adapters` | No | Comma-separated adapter indices, such as `0,1`. |
462
+ | `adapters` | No | Comma-separated indices returned by `/swap/adapters`, such as `0,1,2`. |
394
463
  | `gasPrice` | No | Quote gas price in wei. |
395
464
 
396
465
  Omitting `sender` produces a display-only quote. Request a fresh executable
@@ -408,7 +477,7 @@ Important response fields:
408
477
  | `expectedOutputAmount` | Expected user receipt after tax and fee, before slippage. |
409
478
  | `minAmountOut` | Minimum output encoded into calldata. |
410
479
  | `paths` | Human-readable route descriptions. |
411
- | `routeAllocation` | Structured split, hop, adapter, and fee-tier allocation. |
480
+ | `routeAllocation` | Structured split, hop, adapter, and pool-specific route allocation. V4 PoolKey data is encoded in the executable transaction and must not be reconstructed client-side. |
412
481
  | `fromTokenTax`, `toTokenTax` | Detected tax metadata. |
413
482
  | `effectiveSlippageBps` | Slippage plus applicable tax buffers. |
414
483
  | `tx` | Fee-on-input transaction; present when `sender` is supplied. |
@@ -429,7 +498,7 @@ Common Robinhood errors include:
429
498
  - Invalid token, sender, receiver, or partner address.
430
499
  - Invalid raw amount, slippage, fee, gas price, or adapter filter.
431
500
  - A tax-token quote explicitly excluded the Uniswap V2 adapter.
432
- - No viable Uniswap V2/V3 route or insufficient liquidity.
501
+ - No viable route across the currently active adapters, or insufficient liquidity.
433
502
  - RPC timeout or public-RPC rate limiting.
434
503
  - Missing executable transaction because `sender` was omitted.
435
504
 
@@ -465,7 +534,7 @@ into the UI separately from this list.
465
534
  | VIRTUAL | Virtuals Protocol | `0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31` | 18 |
466
535
  | CASHCAT | Cash Cat | `0x020bfC650A365f8BB26819deAAbF3E21291018b4` | 18 |
467
536
  | WALLET | Robinhood Wallet | `0x0339f5459FC690aC85F1782e15782A151b4A9E1b` | 18 |
468
- | seedcoin | watch it grow | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` | 9 |
537
+ | seedcoin | watch it grow | `0xD8d1C08A8bA4fc64BAC744f74290B89ADcb6Bf25` | 18 |
469
538
  | JUGGERNAUT | The Juggernaut | `0xD7321801CAae694090694Ff55A9323139F043B88` | 18 |
470
539
  | HOODRAT | Hoodrat | `0x8e62F281f282686fCa6dCB39288069a93fC23F1c` | 18 |
471
540
  | DIH | Dog In Hood | `0x17bb0C898254406b1Ea2e8E99B0C263e26c9E4a4` | 18 |
@@ -492,9 +561,15 @@ Switch currently evaluates:
492
561
  - V3 fee tiers `100`, `500`, `3000`, and `10000`.
493
562
  - Trusted routing hubs WETH, USDG, VIRTUAL, and CASHCAT.
494
563
 
564
+ The prepared V4 integration reserves adapter index `2`. Once activated, it
565
+ discovers hookless static-fee V4 pools by complete `PoolKey` rather than
566
+ applying the V3 fee-tier list. Native-ETH V4 currencies are normalized through the WETH/native
567
+ alias described above. Until `/swap/adapters` returns index `2`, V4 is not part
568
+ of live production quotes.
569
+
495
570
  If either side is detected as a transfer-tax token, the backend restricts the
496
571
  entire route (including every split and intermediate hop) to Uniswap V2. V3 is
497
- not considered for that quote.
572
+ not considered for that quote, and V4 will remain excluded after activation.
498
573
 
499
574
  The API may split a quote across routes and adapters. Integrators should render
500
575
  the returned `paths` or `routeAllocation` instead of assuming a single path.
@@ -513,7 +588,12 @@ untrusted clients.
513
588
 
514
589
  - Robinhood limit orders are not deployed.
515
590
  - Rialto DEX is not integrated.
516
- - Quotes currently use Uniswap V2 and V3 liquidity.
591
+ - The production router supports Uniswap V2, V3, and supported hookless
592
+ static-fee V4 liquidity. V4 participates in quotes whenever adapter index
593
+ `2` is advertised by `/swap/adapters`.
594
+ - The first V4 phase intentionally excludes hooked and dynamic-fee pools.
595
+ - A V4 allocation currently selects its best single PoolKey; intra-V4
596
+ multi-pool splitting is not yet enabled. V4 can still split against V2/V3.
517
597
  - Contract and token addresses must be treated as chain-specific.
518
598
 
519
599
  See the main [SDK reference](README.md) for authentication, partner fees,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@switch-win/sdk",
3
- "version": "1.2.0",
3
+ "version": "1.2.1",
4
4
  "description": "Official integration kit for the Switch DEX Aggregator on PulseChain and Robinhood Chain",
5
5
  "author": "BuildTheTech",
6
6
  "license": "MIT",
@@ -27,6 +27,7 @@ export const ROBINHOOD_SWITCH_CONTRACTS = {
27
27
  routerView: "0xFF6b56d3F444eB5b7FA1db047F57140C84810376",
28
28
  uniswapV2Adapter: "0x7a14d7A8509a66209D4332843b983b29bF5604A4",
29
29
  uniswapV3Adapter: "0xbcA08f296d9Ba0dc19Aa0E05D355365cE29A3205",
30
+ uniswapV4Adapter: "0x754dDCD05aFbAd1cc7Bc42B9268EB586F579E7F6",
30
31
  } as const;
31
32
 
32
33
  /** Uniswap contracts used by the Robinhood Switch deployment. */
@@ -35,6 +36,14 @@ export const ROBINHOOD_UNISWAP_CONTRACTS = {
35
36
  v3Factory: "0x1f7d7550B1b028f7571E69A784071F0205FD2EfA",
36
37
  v3QuoterV2: "0x33e885eD0Ec9bF04EcfB19341582aADCb4c8A9E7",
37
38
  v3SwapRouter02: "0xCaf681a66D020601342297493863E78C959E5cb2",
39
+ /** Canonical Uniswap V4 singleton and periphery deployments. */
40
+ v4PoolManager: "0x8366a39cc670b4001a1121b8f6a443a643e40951",
41
+ v4PositionDescriptor: "0x9639443158e8c5efa35bd45287bf2effd3d8dc06",
42
+ v4PositionManager: "0x58daec3116aae6d93017baaea7749052e8a04fa7",
43
+ v4Quoter: "0x8dc178efb8111bb0973dd9d722ebeff267c98f94",
44
+ v4StateView: "0xf3334192d15450cdd385c8b70e03f9a6bd9e673b",
45
+ v4UniversalRouter: "0x8876789976decbfcbbbe364623c63652db8c0904",
46
+ permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
38
47
  } as const;
39
48
 
40
49
  export interface RobinhoodToken {
@@ -83,10 +92,10 @@ export const ROBINHOOD_TOKENS = {
83
92
  decimals: 18,
84
93
  },
85
94
  SEEDCOIN: {
86
- address: "0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45",
95
+ address: "0xD8d1C08A8bA4fc64BAC744f74290B89ADcb6Bf25",
87
96
  symbol: "seedcoin",
88
97
  name: "watch it grow",
89
- decimals: 9,
98
+ decimals: 18,
90
99
  },
91
100
  JUGGERNAUT: {
92
101
  address: "0xD7321801CAae694090694Ff55A9323139F043B88",