@anywalletkit/protocol-swap2-lifi 0.4.0 → 0.6.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 +26 -7
- package/dist/{chunk-TQYG23FS.js → chunk-IZ7TP4KT.js} +341 -92
- package/dist/chunk-IZ7TP4KT.js.map +1 -0
- package/dist/{chunk-7SUAXOPF.js → chunk-YABKNR7N.js} +2 -2
- package/dist/index.cjs +345 -96
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +2 -2
- package/dist/protocol.cjs +345 -96
- package/dist/protocol.cjs.map +1 -1
- package/dist/protocol.js +2 -2
- package/dist/provider.cjs +345 -96
- package/dist/provider.cjs.map +1 -1
- package/dist/provider.d.cts +11 -1
- package/dist/provider.d.ts +11 -1
- package/dist/provider.js +1 -1
- package/package.json +5 -5
- package/dist/chunk-TQYG23FS.js.map +0 -1
- /package/dist/{chunk-7SUAXOPF.js.map → chunk-YABKNR7N.js.map} +0 -0
package/README.md
CHANGED
|
@@ -24,9 +24,14 @@ do the same: a same-chain swap (GenericSwapFacet / V3) pays the reviewed recipie
|
|
|
24
24
|
reviewed minimum, spending the input token and delivering the requested one; a bridge call must be
|
|
25
25
|
one of LI.FI's listed `startBridgeTokensVia*` / `swapAndStartBridgeTokensVia*` entry points (packed
|
|
26
26
|
calls are refused) and its `BridgeData` must name the reviewed recipient and chain and bridge the
|
|
27
|
-
input token (or what its source swaps make of it).
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
input token (or what its source swaps make of it). Every refund, depositor or fallback address a
|
|
28
|
+
bridge carries in its own data (Stargate's LayerZero fee refund, an expired Across deposit or LI.FI
|
|
29
|
+
intent, a Mayan Swift order's trader, Chainflip's refund address, …) must be the sender or the
|
|
30
|
+
recipient. Refused, because the recipient cannot be read from the calldata: routes with a destination call, EVM-source routes to a non-EVM chain, and the
|
|
31
|
+
bridges whose facet does not bind the delivery to `BridgeData` (Relay, Garden, deBridge DLN,
|
|
32
|
+
ThorSwap, Squid, Symbiosis) — cross-chain requests ask LI.FI to route around Relay, Garden, Squid
|
|
33
|
+
and Symbiosis, and not to offer destination calls (`allowDestinationCall=false`), so their pairs get
|
|
34
|
+
another bridge. Unknown calldata is refused.
|
|
30
35
|
|
|
31
36
|
Every swap step is read, not only the ends: each must spend what the step before delivered, only
|
|
32
37
|
steps that spend the input token may pull from the wallet (`requiresDeposit`), and together at most
|
|
@@ -36,9 +41,23 @@ bound to the asset kinds they move (`*ToNative` only for a native output, `*ToER
|
|
|
36
41
|
bridge without source swaps must bridge the input, less at most a 1 % bridge fee. `apiUrl` must be
|
|
37
42
|
`https:` (`allowInsecureApiUrl` for local development).
|
|
38
43
|
|
|
39
|
-
|
|
40
|
-
what finally reaches the recipient — sits in bridge-specific data, so on cross-chain routes the
|
|
41
|
-
reviewed minimum relies on LI.FI's API (or your `apiUrl` proxy) answering honestly.
|
|
44
|
+
Mostly not checked: a bridge's output. The destination minimum — and for some bridges (Relay, Across)
|
|
45
|
+
what finally reaches the recipient — sits in bridge-specific data, so on most cross-chain routes the
|
|
46
|
+
reviewed minimum relies on LI.FI's API (or your `apiUrl` proxy) answering honestly. Two bridges name
|
|
47
|
+
it outright and are held to the quote: an Eco intent must run on the destination chain and its route
|
|
48
|
+
must end in the destination token's `transfer` of at least the reviewed minimum to the recipient
|
|
49
|
+
(a route of more than 16 calls is refused); an M0 order must ask for the destination token at a
|
|
50
|
+
rate of at least the reviewed minimum. An M0 order can be filled in part: the recipient then gets
|
|
51
|
+
that share at the order's rate and the rest of the input returns to the sender after the order's
|
|
52
|
+
fill deadline. Neither can deliver the native token through this module: an Eco or M0 route whose
|
|
53
|
+
destination token is native (ETH, POL, …) is always refused. The module does not ask LI.FI again
|
|
54
|
+
without that bridge, so when LI.FI picks one of them for such a pair, the pair shows no LI.FI route.
|
|
55
|
+
|
|
56
|
+
`routeWideSlippage: true` (default off) asks LI.FI for one slippage budget for the whole route
|
|
57
|
+
(`slippageScope=route`) on EVM → EVM requests instead of one per step; when LI.FI can protect no
|
|
58
|
+
route for a request (`ROUTE_SLIPPAGE_UNSUPPORTED`) or has route-wide slippage switched off
|
|
59
|
+
(`ROUTE_SLIPPAGE_UNAVAILABLE`), it is asked again in its default scope, held to the same floor. That
|
|
60
|
+
happens while quoting, so the quote the user reviews is the per-step one, with its own minimum.
|
|
42
61
|
|
|
43
62
|
## Behind `remoteProvider`
|
|
44
63
|
|
|
@@ -46,7 +65,7 @@ When the provider runs on your server, spread its pins into the app's stub:
|
|
|
46
65
|
`remoteProvider({name: "lifi", baseUrl, ...lifiPins})`. The engine then lets the EVM route call and
|
|
47
66
|
approve only the LI.FI Diamond of that chain, never an address the backend names, and `lifiVerifyQuote` decodes the
|
|
48
67
|
server's Diamond call on the device with the same check the provider runs on LI.FI's answer (receiver, minimum, input
|
|
49
|
-
token and amount, output token, destination chain; value and approval for the input kind). Without the pins the stub
|
|
68
|
+
token and amount, output token, destination chain, refund addresses; value and approval for the input kind). Without the pins the stub
|
|
50
69
|
gets no EVM calldata route (fail closed).
|
|
51
70
|
|
|
52
71
|
## Activity
|