@spicenet-io/spiceflow-ui 4.7.11 → 4.8.0-venues.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/README.md +61 -0
- package/dist/auth-privy.cjs.js +1 -1
- package/dist/auth-privy.js +1 -1
- package/dist/hooks/useSupplyQuote.d.ts +2 -0
- package/dist/index.cjs.js +7 -7
- package/dist/index.d.ts +7 -2
- package/dist/index.js +7 -7
- package/dist/{privy-DinsCCJf.js → privy-CKRpUHB_.js} +1 -1
- package/dist/privy-ROtJpoJf.js +2 -0
- package/dist/providers/SpiceFlowProvider.d.ts +3 -0
- package/dist/utils/crossChainRouter/liquidityVenues.d.ts +11 -8
- package/dist/utils/crossChainRouter/uniV4.d.ts +3 -2
- package/dist/utils/crossChainRouter/venueConfig.d.ts +23 -0
- package/package.json +1 -1
- package/dist/privy-BXdQgePJ.js +0 -2
package/README.md
CHANGED
|
@@ -35,6 +35,67 @@ function App() {
|
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
+
## Liquidity venues
|
|
39
|
+
|
|
40
|
+
When a flow has to swap on the destination chain, the SDK quotes every liquidity
|
|
41
|
+
venue that covers that chain and takes the best fill: the most output on a
|
|
42
|
+
supply, the least input on a pay. Routing is decided here, on your RPC. The
|
|
43
|
+
solver only executes the calls the winning quote produced.
|
|
44
|
+
|
|
45
|
+
Leave `liquidityVenues` off and you get the built-in venues. Declare it once on
|
|
46
|
+
the provider to add your own, and every component picks them up.
|
|
47
|
+
|
|
48
|
+
```tsx
|
|
49
|
+
<SpiceFlowProvider
|
|
50
|
+
network="mainnet"
|
|
51
|
+
nativeChainId={4663}
|
|
52
|
+
rpcOverrides={{ 4663: ROBINHOOD_RPC }}
|
|
53
|
+
liquidityVenues={{
|
|
54
|
+
venues: [
|
|
55
|
+
{
|
|
56
|
+
protocol: "uniswap-v3",
|
|
57
|
+
chainId: 4663,
|
|
58
|
+
swapRouter: "0x1e406484F1F204b23cE84B9901C0171a738fd406",
|
|
59
|
+
quoterV2: "0x3E290e5E01818002A0b672148BdC7514D861C7B3",
|
|
60
|
+
hubCurrencies: ["0x0bd7d308f8e1639fab988df18a8011f41eacad73"],
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
}}
|
|
64
|
+
>
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Your venues race the built-ins on price; they do not override them. Set
|
|
68
|
+
`includeDefaults: false` to drop the built-ins and route only through what you
|
|
69
|
+
declared. On a chain with no venue at all, quoting fails with that chain named
|
|
70
|
+
rather than falling back to something you did not configure.
|
|
71
|
+
|
|
72
|
+
Every entry names one chain and one protocol family, and serves both swap
|
|
73
|
+
directions. Supply the **deployment's** addresses, not a pool address: a
|
|
74
|
+
v3-style pool calls back into `msg.sender`, so swaps go through the router and
|
|
75
|
+
quotes through the quoter. The SDK finds the pools from the fee tiers (or tick
|
|
76
|
+
spacings) and hub currencies.
|
|
77
|
+
|
|
78
|
+
| `protocol` | Required | Optional |
|
|
79
|
+
| ---------------------- | ------------------------------------------------- | -------------------------------------------------------- |
|
|
80
|
+
| `uniswap-v3` | `chainId`, `swapRouter`, `quoterV2` | `name`, `feeTiers`, `hubCurrencies`, `routerHasDeadline` |
|
|
81
|
+
| `uniswap-v4` | `chainId`, `quoter`, `universalRouter`, `permit2` | `name`, `hubCurrencies` |
|
|
82
|
+
| `aerodrome-slipstream` | `chainId`, `swapRouter`, `quoterV2` | `name`, `tickSpacings`, `hubCurrencies` |
|
|
83
|
+
|
|
84
|
+
`name` is the label shown to the user as "via <name>" once a swap is quoted, so
|
|
85
|
+
give it the name people know the venue by. It defaults to the protocol, which
|
|
86
|
+
means a swap always names something real rather than a family it does not belong
|
|
87
|
+
to.
|
|
88
|
+
|
|
89
|
+
`hubCurrencies` are the intermediate tokens tried for two-hop routes, usually
|
|
90
|
+
wrapped native and the chain's main stablecoin. Set `routerHasDeadline` when the
|
|
91
|
+
deployment forked the original Uniswap `SwapRouter`, whose exact-output structs
|
|
92
|
+
carry a deadline; SwapRouter02 forks do not.
|
|
93
|
+
|
|
94
|
+
Most DEXs are forks of one of these families, so adding one is addresses only.
|
|
95
|
+
A venue from a different family (a Uniswap v2 pair, Curve, Balancer) needs an
|
|
96
|
+
adapter in the SDK — send us the chain, router, quoter and one funded pool and
|
|
97
|
+
it becomes a `protocol` everyone can name.
|
|
98
|
+
|
|
38
99
|
## Components
|
|
39
100
|
|
|
40
101
|
- **SwapWidget** - Main swap interface component
|
package/dist/auth-privy.cjs.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";const r=require("./privy-
|
|
2
|
+
"use strict";const r=require("./privy-ROtJpoJf.js");require("react/jsx-runtime"),require("react"),require("@spicenet-io/spiceflow-core"),require("viem"),require("viem/actions"),require("@privy-io/react-auth"),require("wagmi"),require("@tanstack/react-query"),exports.PrivyLogin=r.PrivyLogin;
|
package/dist/auth-privy.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import{P as g}from"./privy-
|
|
2
|
+
import{P as g}from"./privy-CKRpUHB_.js";import"react/jsx-runtime";import"react";import"@spicenet-io/spiceflow-core";import"viem";import"viem/actions";import"@privy-io/react-auth";import"wagmi";import"@tanstack/react-query";export{g as PrivyLogin};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type Address } from "viem";
|
|
2
|
+
import { type LiquidityVenuesConfig } from "../utils/crossChainRouter/venueConfig";
|
|
2
3
|
import type { ResolvedSwap } from "../utils/crossChainRouter/liquidityVenues";
|
|
3
4
|
import { type ExactOutputSwapIntent, type ResolvedExactOutputSwap } from "../utils/swapQuotes";
|
|
4
5
|
import type { SelectedAsset } from "../types/assets";
|
|
@@ -35,5 +36,6 @@ export declare function resolveInputSupplySwapQuote(params: {
|
|
|
35
36
|
tokenIn: Address;
|
|
36
37
|
tokenOut: Address;
|
|
37
38
|
amountIn: bigint;
|
|
39
|
+
liquidityVenues?: LiquidityVenuesConfig;
|
|
38
40
|
}): Promise<ResolvedSwap>;
|
|
39
41
|
export declare function useSupplyQuote(opts: UseSupplyQuoteOpts): SupplyQuoteResult;
|