@switch-win/sdk 1.2.9 → 1.3.0
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 +26 -0
- package/GASLESS.md +407 -0
- package/LIMIT-ORDERS.md +213 -205
- package/README.md +131 -105
- package/ROBINHOOD.md +201 -198
- package/abi/GaslessSwitchV2ABI.json +1095 -0
- package/dist/constants.d.ts +276 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +403 -0
- package/dist/constants.js.map +1 -0
- package/dist/gasless-client.d.ts +81 -0
- package/dist/gasless-client.d.ts.map +1 -0
- package/dist/gasless-client.js +467 -0
- package/dist/gasless-client.js.map +1 -0
- package/dist/gasless-index.d.ts +5 -0
- package/dist/gasless-index.d.ts.map +1 -0
- package/dist/gasless-index.js +5 -0
- package/dist/gasless-index.js.map +1 -0
- package/dist/gasless-operators.d.ts +32 -0
- package/dist/gasless-operators.d.ts.map +1 -0
- package/dist/gasless-operators.js +132 -0
- package/dist/gasless-operators.js.map +1 -0
- package/dist/gasless-store.d.ts +18 -0
- package/dist/gasless-store.d.ts.map +1 -0
- package/dist/gasless-store.js +83 -0
- package/dist/gasless-store.js.map +1 -0
- package/dist/gasless-types.d.ts +218 -0
- package/dist/gasless-types.d.ts.map +1 -0
- package/dist/gasless-types.js +2 -0
- package/dist/gasless-types.js.map +1 -0
- package/dist/gasless.d.ts +135 -0
- package/dist/gasless.d.ts.map +1 -0
- package/dist/gasless.js +513 -0
- package/dist/gasless.js.map +1 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +30 -0
- package/dist/index.js.map +1 -0
- package/dist/limit-orders.d.ts +440 -0
- package/dist/limit-orders.d.ts.map +1 -0
- package/dist/limit-orders.js +387 -0
- package/dist/limit-orders.js.map +1 -0
- package/dist/networks/index.d.ts +3 -0
- package/dist/networks/index.d.ts.map +1 -0
- package/dist/networks/index.js +2 -0
- package/dist/networks/index.js.map +1 -0
- package/dist/networks/robinhood.d.ts +536 -0
- package/dist/networks/robinhood.d.ts.map +1 -0
- package/dist/networks/robinhood.js +489 -0
- package/dist/networks/robinhood.js.map +1 -0
- package/dist/types.d.ts +436 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +19 -0
- package/dist/types.js.map +1 -0
- package/examples/gasless-nextjs-proxy.ts +87 -0
- package/examples/gasless-operator.ts +76 -0
- package/examples/gasless-swap.ts +170 -0
- package/examples/limit-order-ethers.ts +195 -0
- package/examples/nextjs-proxy.ts +82 -0
- package/examples/react-hooks.tsx +396 -0
- package/examples/swap-ethers.ts +209 -0
- package/examples/swap-web3py.py +267 -0
- package/package.json +53 -12
- package/src/constants.ts +184 -182
- package/src/gasless-client.ts +823 -0
- package/src/gasless-index.ts +4 -0
- package/src/gasless-operators.ts +227 -0
- package/src/gasless-store.ts +137 -0
- package/src/gasless-types.ts +258 -0
- package/src/gasless.ts +756 -0
- package/src/index.ts +69 -63
- package/src/limit-orders.ts +206 -195
- package/src/types.ts +80 -55
package/ROBINHOOD.md
CHANGED
|
@@ -11,8 +11,8 @@ 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 | 21 adapters: Uniswap V2/V3/V4, Switch limit orders, SwapHood, Up33, Sheriff, Aeon, Catnip, PancakeSwap V2/V3, RobinSwap V2/V3, SushiSwap, GIGA, Flap, and Ramses |
|
|
15
|
-
| Limit orders | Available: EIP-712 ERC-20 orders plus native ETH flow |
|
|
14
|
+
| Supported liquidity | 21 adapters: Uniswap V2/V3/V4, Switch limit orders, SwapHood, Up33, Sheriff, Aeon, Catnip, PancakeSwap V2/V3, RobinSwap V2/V3, SushiSwap, GIGA, Flap, and Ramses |
|
|
15
|
+
| Limit orders | Available: EIP-712 ERC-20 orders plus native ETH flow |
|
|
16
16
|
|
|
17
17
|
## Contents
|
|
18
18
|
|
|
@@ -104,36 +104,36 @@ await window.ethereum.request({
|
|
|
104
104
|
|
|
105
105
|
| Contract | Address |
|
|
106
106
|
|---|---|
|
|
107
|
-
| SwitchRouter | `0x8b2bBdF41C1486b3482bD0e9603d72f012EE8599` |
|
|
107
|
+
| SwitchRouter | `0x8b2bBdF41C1486b3482bD0e9603d72f012EE8599` |
|
|
108
108
|
| Uniswap V2 adapter | `0x7a14d7A8509a66209D4332843b983b29bF5604A4` |
|
|
109
109
|
| Uniswap V3 adapter | `0xbcA08f296d9Ba0dc19Aa0E05D355365cE29A3205` |
|
|
110
|
-
| Uniswap V4 adapter | `0xB9885d3C55e79499bf887F2fBe445e01A8cFFf1c` |
|
|
111
|
-
| SwitchLimitOrder | `0x1E05115387f314398bbb1A808B25308E71150396` |
|
|
112
|
-
| Native ETH flow | `0x8170a3B0e2FD2e4333E0Ca9c9414B2D3dd6aF689` |
|
|
113
|
-
| Direct-fill quoter | `0x77b246C127c3c501Ec2836A2B53B555208b30B44` |
|
|
114
|
-
| Switch Limit Order adapter (index 3) | `0xb13CC4C37e1C609617C51B5dCDf8e4Ae5721Faa4` |
|
|
115
|
-
| SwapHood V2 adapter (index 4) | `0x6D8746f02e52944c13824fA691c6f4186E463354` |
|
|
116
|
-
| SwapHood V3 adapter (index 5) | `0x9645dE0AcB48F0AAefdBEb423F0558457907DE98` |
|
|
117
|
-
| Up33 CL adapter (index 6) | `0x388179D2FB0ABcE9b03068916aF8a3c4dfD023c8` |
|
|
118
|
-
| Sheriff V2 adapter (index 7) | `0xBDB3EB0355981500f58C9bc77c3E61762844A146` |
|
|
119
|
-
| Sheriff Algebra adapter (index 8) | `0xaC4da986100724983042Ec28c28db243E2f828CB` |
|
|
120
|
-
| Aeon Algebra adapter (index 9) | `0x20615954FB87360139e7DdDB519359498EbD1904` |
|
|
121
|
-
| Catnip V2 adapter (index 10) | `0x5b2Ca358d56490Dc86224D502522314De7707237` |
|
|
122
|
-
| PancakeSwap V2 adapter (index 11) | `0x3B6e71A59553143937Fef74a7B50AFD24528786E` |
|
|
123
|
-
| PancakeSwap V3 adapter (index 12) | `0xD2Adac87bab4f0f99CF2a21c552c88d1C9825cCC` |
|
|
124
|
-
| RobinSwap V2 adapter (index 13) | `0xF694145F104c3C24f723301e160D2Ccf0Db31FE6` |
|
|
125
|
-
| RobinSwap V3 adapter (index 14) | `0x798f77D63b46b0E019de206E111e5ea5CC16BEc8` |
|
|
126
|
-
| SushiSwap V3 adapter (index 15) | `0xca3EA0Fd6E31f94c81B6586836790adE638313ED` |
|
|
127
|
-
| GIGA V2 adapter (index 16) | `0xa379c7D17F7fEe735773879D4069886B117AB54a` |
|
|
128
|
-
| GIGA V3 adapter (index 17) | `0xcAa612CDe3d3FbE97Be97eB5f79BC91597432d55` |
|
|
129
|
-
| Flap Portal adapter (index 18) | `0x6af2A4475C44d5833575150Bf7C3D3FE6Bf4F344` |
|
|
130
|
-
| Ramses V3 adapter (index 19) | `0xdBf182774C60932c6fe1Bf3FFaB8Ca28CCb0dC17` |
|
|
131
|
-
| Ramses V2 adapter (index 20) | `0x5fe3b873c222e76f7630b40052f07ee06196E6d3` |
|
|
132
|
-
|
|
133
|
-
The PancakeSwap V3 adapter was created in
|
|
134
|
-
[deployment transaction `0xa82a...cfa8`](https://robinhoodchain.blockscout.com/tx/0xa82a53e8e32e7a26be720d62e157c820e8c25ccbb3826e604435480606e0cfa8)
|
|
135
|
-
and inserted at index `12` in
|
|
136
|
-
[router transaction `0xae59...94b5`](https://robinhoodchain.blockscout.com/tx/0xae5949bad45dfbdcd930a2fd39e5fb22914b51704f8c7b137f996a154e8d94b5).
|
|
110
|
+
| Uniswap V4 adapter | `0xB9885d3C55e79499bf887F2fBe445e01A8cFFf1c` |
|
|
111
|
+
| SwitchLimitOrder | `0x1E05115387f314398bbb1A808B25308E71150396` |
|
|
112
|
+
| Native ETH flow | `0x8170a3B0e2FD2e4333E0Ca9c9414B2D3dd6aF689` |
|
|
113
|
+
| Direct-fill quoter | `0x77b246C127c3c501Ec2836A2B53B555208b30B44` |
|
|
114
|
+
| Switch Limit Order adapter (index 3) | `0xb13CC4C37e1C609617C51B5dCDf8e4Ae5721Faa4` |
|
|
115
|
+
| SwapHood V2 adapter (index 4) | `0x6D8746f02e52944c13824fA691c6f4186E463354` |
|
|
116
|
+
| SwapHood V3 adapter (index 5) | `0x9645dE0AcB48F0AAefdBEb423F0558457907DE98` |
|
|
117
|
+
| Up33 CL adapter (index 6) | `0x388179D2FB0ABcE9b03068916aF8a3c4dfD023c8` |
|
|
118
|
+
| Sheriff V2 adapter (index 7) | `0xBDB3EB0355981500f58C9bc77c3E61762844A146` |
|
|
119
|
+
| Sheriff Algebra adapter (index 8) | `0xaC4da986100724983042Ec28c28db243E2f828CB` |
|
|
120
|
+
| Aeon Algebra adapter (index 9) | `0x20615954FB87360139e7DdDB519359498EbD1904` |
|
|
121
|
+
| Catnip V2 adapter (index 10) | `0x5b2Ca358d56490Dc86224D502522314De7707237` |
|
|
122
|
+
| PancakeSwap V2 adapter (index 11) | `0x3B6e71A59553143937Fef74a7B50AFD24528786E` |
|
|
123
|
+
| PancakeSwap V3 adapter (index 12) | `0xD2Adac87bab4f0f99CF2a21c552c88d1C9825cCC` |
|
|
124
|
+
| RobinSwap V2 adapter (index 13) | `0xF694145F104c3C24f723301e160D2Ccf0Db31FE6` |
|
|
125
|
+
| RobinSwap V3 adapter (index 14) | `0x798f77D63b46b0E019de206E111e5ea5CC16BEc8` |
|
|
126
|
+
| SushiSwap V3 adapter (index 15) | `0xca3EA0Fd6E31f94c81B6586836790adE638313ED` |
|
|
127
|
+
| GIGA V2 adapter (index 16) | `0xa379c7D17F7fEe735773879D4069886B117AB54a` |
|
|
128
|
+
| GIGA V3 adapter (index 17) | `0xcAa612CDe3d3FbE97Be97eB5f79BC91597432d55` |
|
|
129
|
+
| Flap Portal adapter (index 18) | `0x6af2A4475C44d5833575150Bf7C3D3FE6Bf4F344` |
|
|
130
|
+
| Ramses V3 adapter (index 19) | `0xdBf182774C60932c6fe1Bf3FFaB8Ca28CCb0dC17` |
|
|
131
|
+
| Ramses V2 adapter (index 20) | `0x5fe3b873c222e76f7630b40052f07ee06196E6d3` |
|
|
132
|
+
|
|
133
|
+
The PancakeSwap V3 adapter was created in
|
|
134
|
+
[deployment transaction `0xa82a...cfa8`](https://robinhoodchain.blockscout.com/tx/0xa82a53e8e32e7a26be720d62e157c820e8c25ccbb3826e604435480606e0cfa8)
|
|
135
|
+
and inserted at index `12` in
|
|
136
|
+
[router transaction `0xae59...94b5`](https://robinhoodchain.blockscout.com/tx/0xae5949bad45dfbdcd930a2fd39e5fb22914b51704f8c7b137f996a154e8d94b5).
|
|
137
137
|
|
|
138
138
|
The V4 adapter was created in
|
|
139
139
|
[deployment transaction `0x60d5...34a7`](https://robinhoodchain.blockscout.com/tx/0x60d56466a8162a643a15ecde98322ec05ea23d44d03fbd817df4ddbaef4834a7)
|
|
@@ -158,64 +158,67 @@ Use `ROBINHOOD_TOKENS.WETH.address` for the wrapped ERC-20:
|
|
|
158
158
|
0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73
|
|
159
159
|
```
|
|
160
160
|
|
|
161
|
-
Native ETH does not require approval. WETH and every other ERC-20 input token
|
|
162
|
-
must be approved for `ROBINHOOD_SWITCH_CONTRACTS.router`.
|
|
163
|
-
|
|
164
|
-
The current Router
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
`
|
|
217
|
-
|
|
218
|
-
|
|
161
|
+
Native ETH does not require approval. WETH and every other ERC-20 input token
|
|
162
|
+
must be approved for `ROBINHOOD_SWITCH_CONTRACTS.router`.
|
|
163
|
+
|
|
164
|
+
The current Router's minimum is 10 bps (0.10%). The current Switch frontend
|
|
165
|
+
explicitly requests 15 bps for Regular swaps; use the quote's actual fee for
|
|
166
|
+
display. GaslessSwitch independently charges 10 bps; see [GASLESS.md](GASLESS.md).
|
|
167
|
+
The protected
|
|
168
|
+
LimitOrder charges 30 bps (0.30%) and is Router-fee-exempt, so the fees do not
|
|
169
|
+
stack. It also caps operator excess at 5% and checks direct fills against its
|
|
170
|
+
Router-bound market-price quoter.
|
|
171
|
+
|
|
172
|
+
### Limit orders
|
|
173
|
+
|
|
174
|
+
Robinhood ERC-20 limit orders use the same EIP-712 `LimitOrder` structure as
|
|
175
|
+
PulseChain, with these network-specific domain values:
|
|
176
|
+
|
|
177
|
+
```ts
|
|
178
|
+
import {
|
|
179
|
+
ROBINHOOD_LIMIT_ORDER_EIP712_DOMAIN,
|
|
180
|
+
ROBINHOOD_SWITCH_CONTRACTS,
|
|
181
|
+
} from "@switch-win/sdk";
|
|
182
|
+
|
|
183
|
+
// { name: "SwitchLimitOrder", version: "2", chainId: 4663,
|
|
184
|
+
// verifyingContract: "0x1E05...0396" }
|
|
185
|
+
await signer.signTypedData(
|
|
186
|
+
ROBINHOOD_LIMIT_ORDER_EIP712_DOMAIN,
|
|
187
|
+
LIMIT_ORDER_EIP712_TYPES,
|
|
188
|
+
order,
|
|
189
|
+
);
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
Submit signed orders to `POST /limit-orders?network=robinhood`. For
|
|
193
|
+
`feeOnOutput=false`, approve `ROBINHOOD_SWITCH_CONTRACTS.limitOrder`; for
|
|
194
|
+
`feeOnOutput=true`, approve `ROBINHOOD_SWITCH_CONTRACTS.router`.
|
|
195
|
+
|
|
196
|
+
Applications should fetch `/limit-orders/config?network=robinhood` at startup
|
|
197
|
+
instead of relying only on static addresses. The SDK exposes this as:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
const config = await fetchLimitOrderConfig({ network: "robinhood" });
|
|
201
|
+
const signing = getNetworkEIP712SigningParams(
|
|
202
|
+
"robinhood",
|
|
203
|
+
config.limitOrderContract,
|
|
204
|
+
);
|
|
205
|
+
const approvalTarget = getLimitOrderApprovalTarget(
|
|
206
|
+
"robinhood",
|
|
207
|
+
order.feeOnOutput,
|
|
208
|
+
{ limitOrderContract: config.limitOrderContract },
|
|
209
|
+
);
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Include `limitOrderContract: config.limitOrderContract` with the submitted
|
|
213
|
+
signed order. Every returned order also carries its own deployment address;
|
|
214
|
+
makers must cancel against that per-order address. Public operators should
|
|
215
|
+
accept only the current `config.limitOrderContract` and current
|
|
216
|
+
`config.plsFlowContract`; legacy arrays are for cancellation and indexing.
|
|
217
|
+
|
|
218
|
+
Native ETH input orders are created on-chain through
|
|
219
|
+
`ROBINHOOD_SWITCH_CONTRACTS.nativeEthFlow` and are indexed from its events; do
|
|
220
|
+
not POST them as signed EOA orders. Native ETH output is represented by WETH in
|
|
221
|
+
the order with `unwrapOutput=true`.
|
|
219
222
|
|
|
220
223
|
## Uniswap V4 routing
|
|
221
224
|
|
|
@@ -239,10 +242,10 @@ V4 discovery must preserve the full key. The backend selects the key and
|
|
|
239
242
|
embeds adapter-specific route data in the quote; clients should submit the
|
|
240
243
|
returned transaction unchanged rather than reconstructing V4 calldata.
|
|
241
244
|
|
|
242
|
-
The current adapter supplies empty hook data and supports hooked pools whose
|
|
243
|
-
normal V4 quoter simulation succeeds. Hooks requiring proprietary hook data or
|
|
244
|
-
router allowlisting still require a specific integration. This does not reduce
|
|
245
|
-
V2 or V3 routing coverage.
|
|
245
|
+
The current adapter supplies empty hook data and supports hooked pools whose
|
|
246
|
+
normal V4 quoter simulation succeeds. Hooks requiring proprietary hook data or
|
|
247
|
+
router allowlisting still require a specific integration. This does not reduce
|
|
248
|
+
V2 or V3 routing coverage.
|
|
246
249
|
|
|
247
250
|
V4 can represent native ETH as the zero-address currency. Switch routes use
|
|
248
251
|
the canonical Robinhood WETH address, so the V4 adapter unwraps WETH when a
|
|
@@ -251,7 +254,7 @@ it. API callers should continue using `ROBINHOOD_NATIVE_ETH` for a native user
|
|
|
251
254
|
input/output and `ROBINHOOD_TOKENS.WETH.address` for the ERC-20.
|
|
252
255
|
|
|
253
256
|
The Robinhood Uniswap V4 adapter is deployed at
|
|
254
|
-
`0xB9885d3C55e79499bf887F2fBe445e01A8cFFf1c`, whitelisted in the production
|
|
257
|
+
`0xB9885d3C55e79499bf887F2fBe445e01A8cFFf1c`, whitelisted in the production
|
|
255
258
|
SwitchRouter at adapter index `2`, and exported as
|
|
256
259
|
`ROBINHOOD_SWITCH_CONTRACTS.uniswapV4Adapter`. Continue treating
|
|
257
260
|
`GET /swap/adapters?network=robinhood` as the source of truth for the adapters
|
|
@@ -270,11 +273,11 @@ The canonical Robinhood V4 infrastructure is available through
|
|
|
270
273
|
| Universal Router | `0x8876789976decbfcbbbe364623c63652db8c0904` |
|
|
271
274
|
| Permit2 | `0x000000000022D473030F116dDEE9F6B43aC78BA3` |
|
|
272
275
|
|
|
273
|
-
If either side is detected as a transfer-tax token, the complete route is
|
|
274
|
-
restricted to tax-safe adapters `0`, `4`, `7`, `10`, `11`, `13`, `16`, `18`,
|
|
275
|
-
and `20`. Indices `13`, `16`, and `20` use direct-pair V2 execution. Flap at index `18`
|
|
276
|
-
must execute through its Portal, whose quote already includes Flap token taxes
|
|
277
|
-
in both directions; clients must not apply those taxes a second time.
|
|
276
|
+
If either side is detected as a transfer-tax token, the complete route is
|
|
277
|
+
restricted to tax-safe adapters `0`, `4`, `7`, `10`, `11`, `13`, `16`, `18`,
|
|
278
|
+
and `20`. Indices `13`, `16`, and `20` use direct-pair V2 execution. Flap at index `18`
|
|
279
|
+
must execute through its Portal, whose quote already includes Flap token taxes
|
|
280
|
+
in both directions; clients must not apply those taxes a second time.
|
|
278
281
|
|
|
279
282
|
## Swap integration flow
|
|
280
283
|
|
|
@@ -290,11 +293,11 @@ Use the same sequence as a PulseChain integration:
|
|
|
290
293
|
6. Show `expectedOutputAmount`, `minAmountOut`, route allocation, and detected
|
|
291
294
|
taxes to the user.
|
|
292
295
|
|
|
293
|
-
Any swap involving a tax token is routed entirely through the tax-safe adapter
|
|
294
|
-
set (`0`, `4`, `7`, `10`, `11`, `14`, `16`, and `18`). This also applies when
|
|
295
|
-
both input and output are tax tokens. Direct-pair adapters receive the
|
|
296
|
-
post-transfer amount; Flap is quoted separately with its full adapter input
|
|
297
|
-
because Portal quoting already models the taxable transfer.
|
|
296
|
+
Any swap involving a tax token is routed entirely through the tax-safe adapter
|
|
297
|
+
set (`0`, `4`, `7`, `10`, `11`, `14`, `16`, and `18`). This also applies when
|
|
298
|
+
both input and output are tax tokens. Direct-pair adapters receive the
|
|
299
|
+
post-transfer amount; Flap is quoted separately with its full adapter input
|
|
300
|
+
because Portal quoting already models the taxable transfer.
|
|
298
301
|
|
|
299
302
|
## Quickstart
|
|
300
303
|
|
|
@@ -311,7 +314,7 @@ const url = buildRobinhoodQuoteUrl({
|
|
|
311
314
|
to: ROBINHOOD_TOKENS.USDG.address,
|
|
312
315
|
amount: 1_000_000_000_000_000n,
|
|
313
316
|
sender: walletAddress,
|
|
314
|
-
slippage: 100, // 1.00%, the Robinhood frontend default
|
|
317
|
+
slippage: 100, // 1.00%, the Robinhood frontend default
|
|
315
318
|
feeOnOutput,
|
|
316
319
|
});
|
|
317
320
|
|
|
@@ -335,7 +338,7 @@ Equivalent curl request:
|
|
|
335
338
|
|
|
336
339
|
```bash
|
|
337
340
|
curl -H "x-api-key: YOUR_KEY" \
|
|
338
|
-
"https://quote.switch.win/swap/quote?network=robinhood&from=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&to=0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168&amount=1000000000000000&sender=0xYOUR_WALLET&slippage=100"
|
|
341
|
+
"https://quote.switch.win/swap/quote?network=robinhood&from=0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE&to=0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168&amount=1000000000000000&sender=0xYOUR_WALLET&slippage=100"
|
|
339
342
|
```
|
|
340
343
|
|
|
341
344
|
Omit `sender` for a display-only quote. Fetch again with the sender immediately
|
|
@@ -401,7 +404,7 @@ The no-tax priority list is:
|
|
|
401
404
|
| 1 | WETH / native ETH | `0x0Bd7D308f8E1639FAb988df18A8011f41EAcAD73` / native sentinel |
|
|
402
405
|
| 2 | USDG | `0x5fc5360D0400a0Fd4f2af552ADD042D716F1d168` |
|
|
403
406
|
| 3 | WALLET | `0x0339f5459FC690aC85F1782e15782A151b4A9E1b` |
|
|
404
|
-
| 4 | SEEDCOIN | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` |
|
|
407
|
+
| 4 | SEEDCOIN | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` |
|
|
405
408
|
| 5 | CASHCAT | `0x020bfC650A365f8BB26819deAAbF3E21291018b4` |
|
|
406
409
|
|
|
407
410
|
The ordered ERC-20 addresses are exported as
|
|
@@ -428,7 +431,7 @@ const quoteUrl = buildRobinhoodQuoteUrl({
|
|
|
428
431
|
to: tokenOut,
|
|
429
432
|
amount: amountIn,
|
|
430
433
|
sender: walletAddress,
|
|
431
|
-
slippage: 100,
|
|
434
|
+
slippage: 100,
|
|
432
435
|
feeOnOutput,
|
|
433
436
|
});
|
|
434
437
|
|
|
@@ -495,36 +498,36 @@ Robinhood currently returns:
|
|
|
495
498
|
|
|
496
499
|
| Index | Adapter |
|
|
497
500
|
|---:|---|
|
|
498
|
-
| `0` | Uniswap V2 |
|
|
499
|
-
| `1` | Uniswap V3 |
|
|
500
|
-
| `2` | Uniswap V4 |
|
|
501
|
-
| `3` | Switch Limit Orders |
|
|
502
|
-
| `4` | SwapHood V2 |
|
|
503
|
-
| `5` | SwapHood V3 |
|
|
504
|
-
| `6` | Up33 CL |
|
|
505
|
-
| `7` | Sheriff V2 |
|
|
506
|
-
| `8` | Sheriff Algebra |
|
|
507
|
-
| `9` | Aeon Algebra |
|
|
508
|
-
| `10` | Catnip V2 |
|
|
509
|
-
| `11` | PancakeSwap V2 |
|
|
510
|
-
| `12` | PancakeSwap V3 |
|
|
511
|
-
| `13` | RobinSwap V2 |
|
|
512
|
-
| `14` | RobinSwap V3 |
|
|
513
|
-
| `15` | SushiSwap V3 |
|
|
514
|
-
| `16` | GIGA V2 |
|
|
515
|
-
| `17` | GIGA V3 |
|
|
516
|
-
| `18` | Flap |
|
|
517
|
-
| `19` | Ramses V3 |
|
|
518
|
-
| `20` | Ramses V2 |
|
|
501
|
+
| `0` | Uniswap V2 |
|
|
502
|
+
| `1` | Uniswap V3 |
|
|
503
|
+
| `2` | Uniswap V4 |
|
|
504
|
+
| `3` | Switch Limit Orders |
|
|
505
|
+
| `4` | SwapHood V2 |
|
|
506
|
+
| `5` | SwapHood V3 |
|
|
507
|
+
| `6` | Up33 CL |
|
|
508
|
+
| `7` | Sheriff V2 |
|
|
509
|
+
| `8` | Sheriff Algebra |
|
|
510
|
+
| `9` | Aeon Algebra |
|
|
511
|
+
| `10` | Catnip V2 |
|
|
512
|
+
| `11` | PancakeSwap V2 |
|
|
513
|
+
| `12` | PancakeSwap V3 |
|
|
514
|
+
| `13` | RobinSwap V2 |
|
|
515
|
+
| `14` | RobinSwap V3 |
|
|
516
|
+
| `15` | SushiSwap V3 |
|
|
517
|
+
| `16` | GIGA V2 |
|
|
518
|
+
| `17` | GIGA V3 |
|
|
519
|
+
| `18` | Flap |
|
|
520
|
+
| `19` | Ramses V3 |
|
|
521
|
+
| `20` | Ramses V2 |
|
|
519
522
|
|
|
520
523
|
Treat the endpoint response, not this document, as the source of truth for
|
|
521
524
|
which adapters are currently selectable.
|
|
522
525
|
|
|
523
|
-
Do not permanently hard-code the available adapter list in an integration.
|
|
524
|
-
Fetch it when presenting routing-source controls. If a quote involves a tax
|
|
525
|
-
token, the backend restricts routing to tax-safe adapters `0`, `4`, `7`, `10`,
|
|
526
|
-
`11`, `13`, `16`, `18`, and `20`; an explicit filter that excludes all of them is
|
|
527
|
-
rejected.
|
|
526
|
+
Do not permanently hard-code the available adapter list in an integration.
|
|
527
|
+
Fetch it when presenting routing-source controls. If a quote involves a tax
|
|
528
|
+
token, the backend restricts routing to tax-safe adapters `0`, `4`, `7`, `10`,
|
|
529
|
+
`11`, `13`, `16`, `18`, and `20`; an explicit filter that excludes all of them is
|
|
530
|
+
rejected.
|
|
528
531
|
|
|
529
532
|
### Check token tax
|
|
530
533
|
|
|
@@ -560,7 +563,7 @@ GET https://quote.switch.win/swap/quote
|
|
|
560
563
|
| `amount` | Yes | Raw input amount. |
|
|
561
564
|
| `sender` | No | Required when transaction calldata is needed. |
|
|
562
565
|
| `receiver` | No | Output recipient; defaults to `sender`. |
|
|
563
|
-
| `slippage` | No | Basis points; API fallback `50` (`0.5%`). The Switch Robinhood frontend explicitly requests `100` (`1%`). |
|
|
566
|
+
| `slippage` | No | Basis points; API fallback `50` (`0.5%`). The Switch Robinhood frontend explicitly requests `100` (`1%`). |
|
|
564
567
|
| `fee` | No | Partner/protocol fee in basis points. |
|
|
565
568
|
| `partnerAddress` | No | Fee-sharing recipient. |
|
|
566
569
|
| `feeOnOutput` | No | `true` takes the fee from output; `false` takes it from input. |
|
|
@@ -578,11 +581,11 @@ Important response fields:
|
|
|
578
581
|
|---|---|
|
|
579
582
|
| `fromToken`, `toToken` | Normalized pair addresses. |
|
|
580
583
|
| `totalAmountIn` | Gross input amount. |
|
|
581
|
-
| `totalAmountOut` | Quoted route output before the Switch fee and slippage. Adapter-native quotes such as Flap Portal may already include token tax. |
|
|
584
|
+
| `totalAmountOut` | Quoted route output before the Switch fee and slippage. Adapter-native quotes such as Flap Portal may already include token tax. |
|
|
582
585
|
| `expectedOutputAmount` | Expected user receipt after tax and fee, before slippage. |
|
|
583
|
-
| `minAmountOut` | Minimum output after adapter-specific tax accounting, fee, and slippage; use it directly. |
|
|
586
|
+
| `minAmountOut` | Minimum output after adapter-specific tax accounting, fee, and slippage; use it directly. |
|
|
584
587
|
| `paths` | Human-readable route descriptions. |
|
|
585
|
-
| `routeAllocation` | Human-readable split, hop, and adapter allocation. Adapter payloads such as V4 PoolKey data are encoded in the executable transaction and must not be reconstructed from this display object. |
|
|
588
|
+
| `routeAllocation` | Human-readable split, hop, and adapter allocation. Adapter payloads such as V4 PoolKey data are encoded in the executable transaction and must not be reconstructed from this display object. |
|
|
586
589
|
| `fromTokenTax`, `toTokenTax` | Detected tax metadata. |
|
|
587
590
|
| `effectiveSlippageBps` | Slippage plus applicable tax buffers. |
|
|
588
591
|
| `tx` | Fee-on-input transaction; present when `sender` is supplied. |
|
|
@@ -602,7 +605,7 @@ Common Robinhood errors include:
|
|
|
602
605
|
- Missing or unsupported `network`.
|
|
603
606
|
- Invalid token, sender, receiver, or partner address.
|
|
604
607
|
- Invalid raw amount, slippage, fee, gas price, or adapter filter.
|
|
605
|
-
- A tax-token quote explicitly excluded every tax-safe direct-pair V2 adapter.
|
|
608
|
+
- A tax-token quote explicitly excluded every tax-safe direct-pair V2 adapter.
|
|
606
609
|
- No viable route across the currently active adapters, or insufficient liquidity.
|
|
607
610
|
- RPC timeout or public-RPC rate limiting.
|
|
608
611
|
- Missing executable transaction because `sender` was omitted.
|
|
@@ -639,7 +642,7 @@ into the UI separately from this list.
|
|
|
639
642
|
| VIRTUAL | Virtuals Protocol | `0xc6911796042b15d7Fa4F6CDe69e245DdCd3d9c31` | 18 |
|
|
640
643
|
| CASHCAT | Cash Cat | `0x020bfC650A365f8BB26819deAAbF3E21291018b4` | 18 |
|
|
641
644
|
| WALLET | Robinhood Wallet | `0x0339f5459FC690aC85F1782e15782A151b4A9E1b` | 18 |
|
|
642
|
-
| SEEDCOIN | Seedcoin | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` | 18 |
|
|
645
|
+
| SEEDCOIN | Seedcoin | `0x58f693A30F124E59b125F7c7b837b0F6bbAF5a45` | 18 |
|
|
643
646
|
| JUGGERNAUT | The Juggernaut | `0xD7321801CAae694090694Ff55A9323139F043B88` | 18 |
|
|
644
647
|
| HOODRAT | Hoodrat | `0x8e62F281f282686fCa6dCB39288069a93fC23F1c` | 18 |
|
|
645
648
|
| DIH | Dog In Hood | `0x17bb0C898254406b1Ea2e8E99B0C263e26c9E4a4` | 18 |
|
|
@@ -649,13 +652,13 @@ into the UI separately from this list.
|
|
|
649
652
|
| TENDIES | TENDIES | `0x45242320DBB855EeA8Fd36804C6487E10E97FCF9` | 18 |
|
|
650
653
|
| GME | GameStop | `0x7e86381A763F0Ecca2bDF27C54eAC403ddD48123` | 18 |
|
|
651
654
|
| 4663 | 4663 | `0xd4052415613B34Af236024B895574c467f65b6dD` | 18 |
|
|
652
|
-
| MARIAN | Lady Marian | `0x01637b14B7378B99dE75A64d50656d98488D9a4d` | 18 |
|
|
653
|
-
| Index | The Index | `0x56910D4409F3a0C78C64DD8D0545FF0705389870` | 18 |
|
|
654
|
-
| VEX | ProjectVex | `0x8Ff92566f2e81BDd68EDfAa8cde73942A723796b` | 18 |
|
|
655
|
-
| HOODIE | HOODIE | `0xC72c01AAB5f5678dc1d6f5C6d2B417d91D402Ba3` | 18 |
|
|
656
|
-
| WISHBONE | WISHBONE | `0x77581054581B9c525E7dd7a0155DE43867532d03` | 18 |
|
|
657
|
-
| VLAD | The Green Bull | `0x31BE8f7485e36928C9De86566c62da82d4B6BF81` | 18 |
|
|
658
|
-
| AEON | Aeon | `0xd4c93eD1843606f92CccA078941f3d52A585982f` | 18 |
|
|
655
|
+
| MARIAN | Lady Marian | `0x01637b14B7378B99dE75A64d50656d98488D9a4d` | 18 |
|
|
656
|
+
| Index | The Index | `0x56910D4409F3a0C78C64DD8D0545FF0705389870` | 18 |
|
|
657
|
+
| VEX | ProjectVex | `0x8Ff92566f2e81BDd68EDfAa8cde73942A723796b` | 18 |
|
|
658
|
+
| HOODIE | HOODIE | `0xC72c01AAB5f5678dc1d6f5C6d2B417d91D402Ba3` | 18 |
|
|
659
|
+
| WISHBONE | WISHBONE | `0x77581054581B9c525E7dd7a0155DE43867532d03` | 18 |
|
|
660
|
+
| VLAD | The Green Bull | `0x31BE8f7485e36928C9De86566c62da82d4B6BF81` | 18 |
|
|
661
|
+
| AEON | Aeon | `0xd4c93eD1843606f92CccA078941f3d52A585982f` | 18 |
|
|
659
662
|
|
|
660
663
|
The ordered list is exported as `ROBINHOOD_FRONTEND_TOKEN_LIST`.
|
|
661
664
|
|
|
@@ -665,47 +668,47 @@ Always identify tokens by address and obtain a fresh quote and tax check.
|
|
|
665
668
|
|
|
666
669
|
### Routing configuration
|
|
667
670
|
|
|
668
|
-
The production router currently exposes 21 ordered adapters:
|
|
669
|
-
|
|
670
|
-
| Index | Venue | Routing family |
|
|
671
|
-
|---:|---|---|
|
|
672
|
-
| `0` | Uniswap V2 | Direct-pair V2 |
|
|
673
|
-
| `1` | Uniswap V3 | V3 tiers `100`, `500`, `3000`, `10000` |
|
|
674
|
-
| `2` | Uniswap V4 | Complete `PoolKey`; empty hook data for compatible hooks |
|
|
675
|
-
| `3` | Switch limit orders | Signed/on-chain order liquidity |
|
|
676
|
-
| `4` | SwapHood V2 | Pair-owned variable-fee V2 |
|
|
677
|
-
| `5` | SwapHood V3 | Pancake V3 tiers `100`, `500`, `2500`, `10000` |
|
|
678
|
-
| `6` | Up33 | Slipstream CL tick spacings `1`, `10`, `50`, `60`, `100`, `200`, `2000` |
|
|
679
|
-
| `7` | Sheriff V2 | Pair-owned variable-fee V2 |
|
|
680
|
-
| `8` | Sheriff | Algebra Integral |
|
|
681
|
-
| `9` | Aeon | Algebra Integral with plugin-aware fees |
|
|
682
|
-
| `10` | Catnip | Direct-pair V2, fixed 30 bps |
|
|
683
|
-
| `11` | PancakeSwap V2 | Direct-pair V2, fixed 25 bps |
|
|
684
|
-
| `12` | PancakeSwap V3 | Factory-enabled tiers `100`, `500`, `2500`, `10000` |
|
|
685
|
-
| `13` | RobinSwap V2 | Direct-pair V2, fixed 25 bps |
|
|
686
|
-
| `14` | RobinSwap V3 | V3 tiers `100`, `500`, `2500`, `3000`, `10000` |
|
|
687
|
-
| `15` | SushiSwap | V3 tiers `500`, `3000`, `10000` |
|
|
688
|
-
| `16` | GIGA V2 | Direct-pair V2 using the pair's live quote and pair-owned fee |
|
|
689
|
-
| `17` | GIGA V3 | V3 tiers `100`, `500`, `1000`, `2000`, `3000`, `10000` |
|
|
690
|
-
| `18` | Flap | Portal-executed bonding curve; Portal quote includes token tax |
|
|
691
|
-
| `19` | Ramses V3 | Tick spacings `1`, `5`, `10`, `50`, `100`, `200`, stored in the route `fee` field |
|
|
692
|
-
| `20` | Ramses V2 | Direct-pair, pair-owned variable-fee V2 |
|
|
693
|
-
|
|
694
|
-
V4 pools are discovered by complete `PoolKey`, not by applying a V3 fee-tier
|
|
695
|
-
list. Native-ETH V4 currencies are normalized through the WETH/native alias
|
|
696
|
-
described above. V3-style and Up33 route legs preserve the exact fee tier or
|
|
697
|
-
tick spacing that won the quote for every direct and multi-hop allocation.
|
|
698
|
-
|
|
699
|
-
Trusted routing hubs are WETH, USDG, VIRTUAL, CASHCAT, HOODRAT, TENDIES,
|
|
700
|
-
JUGGERNAUT, MARIAN, and WALLET. The expanded set was selected from the
|
|
701
|
-
2026-07-16 pair-connectivity audit and zero-tax checks. VEX is excluded because
|
|
702
|
-
it is taxed; INDEX remains an endpoint token but is excluded because its
|
|
703
|
-
dominant liquidity depends on V4 hooks that are not yet supported. If either side is
|
|
704
|
-
detected as a transfer-tax token, the backend restricts the entire route to
|
|
705
|
-
tax-safe adapters `0`, `4`, `7`, `10`, `11`, `13`, `16`, `18`, and `20`;
|
|
706
|
-
concentrated-liquidity and limit-order adapters are excluded. Flap is the one
|
|
707
|
-
non-direct-pair member: only its Portal can execute the curve swap, and the
|
|
708
|
-
Portal quote already includes the Flap token tax.
|
|
671
|
+
The production router currently exposes 21 ordered adapters:
|
|
672
|
+
|
|
673
|
+
| Index | Venue | Routing family |
|
|
674
|
+
|---:|---|---|
|
|
675
|
+
| `0` | Uniswap V2 | Direct-pair V2 |
|
|
676
|
+
| `1` | Uniswap V3 | V3 tiers `100`, `500`, `3000`, `10000` |
|
|
677
|
+
| `2` | Uniswap V4 | Complete `PoolKey`; empty hook data for compatible hooks |
|
|
678
|
+
| `3` | Switch limit orders | Signed/on-chain order liquidity |
|
|
679
|
+
| `4` | SwapHood V2 | Pair-owned variable-fee V2 |
|
|
680
|
+
| `5` | SwapHood V3 | Pancake V3 tiers `100`, `500`, `2500`, `10000` |
|
|
681
|
+
| `6` | Up33 | Slipstream CL tick spacings `1`, `10`, `50`, `60`, `100`, `200`, `2000` |
|
|
682
|
+
| `7` | Sheriff V2 | Pair-owned variable-fee V2 |
|
|
683
|
+
| `8` | Sheriff | Algebra Integral |
|
|
684
|
+
| `9` | Aeon | Algebra Integral with plugin-aware fees |
|
|
685
|
+
| `10` | Catnip | Direct-pair V2, fixed 30 bps |
|
|
686
|
+
| `11` | PancakeSwap V2 | Direct-pair V2, fixed 25 bps |
|
|
687
|
+
| `12` | PancakeSwap V3 | Factory-enabled tiers `100`, `500`, `2500`, `10000` |
|
|
688
|
+
| `13` | RobinSwap V2 | Direct-pair V2, fixed 25 bps |
|
|
689
|
+
| `14` | RobinSwap V3 | V3 tiers `100`, `500`, `2500`, `3000`, `10000` |
|
|
690
|
+
| `15` | SushiSwap | V3 tiers `500`, `3000`, `10000` |
|
|
691
|
+
| `16` | GIGA V2 | Direct-pair V2 using the pair's live quote and pair-owned fee |
|
|
692
|
+
| `17` | GIGA V3 | V3 tiers `100`, `500`, `1000`, `2000`, `3000`, `10000` |
|
|
693
|
+
| `18` | Flap | Portal-executed bonding curve; Portal quote includes token tax |
|
|
694
|
+
| `19` | Ramses V3 | Tick spacings `1`, `5`, `10`, `50`, `100`, `200`, stored in the route `fee` field |
|
|
695
|
+
| `20` | Ramses V2 | Direct-pair, pair-owned variable-fee V2 |
|
|
696
|
+
|
|
697
|
+
V4 pools are discovered by complete `PoolKey`, not by applying a V3 fee-tier
|
|
698
|
+
list. Native-ETH V4 currencies are normalized through the WETH/native alias
|
|
699
|
+
described above. V3-style and Up33 route legs preserve the exact fee tier or
|
|
700
|
+
tick spacing that won the quote for every direct and multi-hop allocation.
|
|
701
|
+
|
|
702
|
+
Trusted routing hubs are WETH, USDG, VIRTUAL, CASHCAT, HOODRAT, TENDIES,
|
|
703
|
+
JUGGERNAUT, MARIAN, and WALLET. The expanded set was selected from the
|
|
704
|
+
2026-07-16 pair-connectivity audit and zero-tax checks. VEX is excluded because
|
|
705
|
+
it is taxed; INDEX remains an endpoint token but is excluded because its
|
|
706
|
+
dominant liquidity depends on V4 hooks that are not yet supported. If either side is
|
|
707
|
+
detected as a transfer-tax token, the backend restricts the entire route to
|
|
708
|
+
tax-safe adapters `0`, `4`, `7`, `10`, `11`, `13`, `16`, `18`, and `20`;
|
|
709
|
+
concentrated-liquidity and limit-order adapters are excluded. Flap is the one
|
|
710
|
+
non-direct-pair member: only its Portal can execute the curve swap, and the
|
|
711
|
+
Portal quote already includes the Flap token tax.
|
|
709
712
|
|
|
710
713
|
The API may split a quote across routes and adapters. Integrators should render
|
|
711
714
|
the returned `paths` or `routeAllocation` instead of assuming a single path.
|
|
@@ -720,17 +723,17 @@ For server integrations, contact Switch to coordinate the expected request
|
|
|
720
723
|
rate and IP allowlisting. Do not distribute one production key across
|
|
721
724
|
untrusted clients.
|
|
722
725
|
|
|
723
|
-
## Current limitations
|
|
724
|
-
|
|
725
|
-
- Rialto liquidity is not integrated.
|
|
726
|
-
- Robinhood market routing is limited to the twenty production adapters
|
|
727
|
-
listed above. Always use `/swap/adapters` as the runtime source of truth.
|
|
728
|
-
- V4 hooks that require proprietary hook data or router allowlisting need a
|
|
729
|
-
venue-specific integration.
|
|
730
|
-
- A V4 allocation currently selects its best single PoolKey; intra-V4
|
|
731
|
-
multi-pool splitting is not yet enabled. V4 can still split against other
|
|
732
|
-
eligible adapters.
|
|
733
|
-
- Contract and token addresses must be treated as chain-specific.
|
|
726
|
+
## Current limitations
|
|
727
|
+
|
|
728
|
+
- Rialto liquidity is not integrated.
|
|
729
|
+
- Robinhood market routing is limited to the twenty production adapters
|
|
730
|
+
listed above. Always use `/swap/adapters` as the runtime source of truth.
|
|
731
|
+
- V4 hooks that require proprietary hook data or router allowlisting need a
|
|
732
|
+
venue-specific integration.
|
|
733
|
+
- A V4 allocation currently selects its best single PoolKey; intra-V4
|
|
734
|
+
multi-pool splitting is not yet enabled. V4 can still split against other
|
|
735
|
+
eligible adapters.
|
|
736
|
+
- Contract and token addresses must be treated as chain-specific.
|
|
734
737
|
|
|
735
738
|
See the main [SDK reference](README.md) for authentication, partner fees,
|
|
736
739
|
response types, error handling, and the complete swap API schema.
|