@agentlayer.tech/wallet 0.1.77 → 0.1.88
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/.openclaw/extensions/agent-wallet/dist/index.js +2 -2
- package/.openclaw/extensions/agent-wallet/index.ts +2 -2
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +1 -1
- package/.openclaw/extensions/agent-wallet/package.json +1 -1
- package/CHANGELOG.md +15 -0
- package/VERSION +1 -1
- package/agent-wallet/agent_wallet/__init__.py +1 -1
- package/agent-wallet/agent_wallet/openclaw_adapter.py +6 -4
- package/agent-wallet/agent_wallet/wallet_layer/wdk_evm.py +31 -16
- package/agent-wallet/openclaw.plugin.json +1 -1
- package/agent-wallet/pyproject.toml +1 -1
- package/agent-wallet/skills/wallet-operator/SKILL.md +1 -1
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +1 -1
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +1 -1
- package/hermes/plugins/agent_wallet/plugin.yaml +1 -1
- package/package.json +1 -1
- package/wdk-btc-wallet/package.json +1 -1
- package/wdk-evm-wallet/.env.example +5 -0
- package/wdk-evm-wallet/README.md +1 -0
- package/wdk-evm-wallet/package.json +1 -1
- package/wdk-evm-wallet/src/config.js +38 -0
- package/wdk-evm-wallet/src/server.js +18 -0
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +870 -87
|
@@ -1963,7 +1963,7 @@ const evmToolDefinitions = [
|
|
|
1963
1963
|
},
|
|
1964
1964
|
{
|
|
1965
1965
|
name: "get_uniswap_swap_quote",
|
|
1966
|
-
description: "Get a read-only Uniswap
|
|
1966
|
+
description: "Get a read-only Uniswap execution preview for an ERC-20 or native ETH swap on ethereum, base, or robinhood. Supported paths are CLASSIC, UniswapX orders, and canonical ETH↔WETH wrap/unwrap. This does not approve, sign, or execute a swap.",
|
|
1967
1967
|
parameters: {
|
|
1968
1968
|
type: "object",
|
|
1969
1969
|
properties: {
|
|
@@ -1979,7 +1979,7 @@ const evmToolDefinitions = [
|
|
|
1979
1979
|
},
|
|
1980
1980
|
{
|
|
1981
1981
|
name: "swap_evm_uniswap_tokens",
|
|
1982
|
-
description: "Preview, prepare, or execute
|
|
1982
|
+
description: "Preview, prepare, or execute a supported Uniswap path on ethereum, base, or robinhood: CLASSIC, UniswapX orders, or canonical ETH↔WETH wrap/unwrap. ERC-20 paths may use Permit2 EIP-712 or an UniswapX order signature. Preview or prepare first. After the user explicitly confirms the shown summary in chat, call execute; the OpenClaw plugin handles the internal execution authorization automatically.",
|
|
1983
1983
|
optional: true,
|
|
1984
1984
|
parameters: {
|
|
1985
1985
|
type: "object",
|
|
@@ -1963,7 +1963,7 @@ const evmToolDefinitions = [
|
|
|
1963
1963
|
},
|
|
1964
1964
|
{
|
|
1965
1965
|
name: "get_uniswap_swap_quote",
|
|
1966
|
-
description: "Get a read-only Uniswap
|
|
1966
|
+
description: "Get a read-only Uniswap execution preview for an ERC-20 or native ETH swap on ethereum, base, or robinhood. Supported paths are CLASSIC, UniswapX orders, and canonical ETH↔WETH wrap/unwrap. This does not approve, sign, or execute a swap.",
|
|
1967
1967
|
parameters: {
|
|
1968
1968
|
type: "object",
|
|
1969
1969
|
properties: {
|
|
@@ -1979,7 +1979,7 @@ const evmToolDefinitions = [
|
|
|
1979
1979
|
},
|
|
1980
1980
|
{
|
|
1981
1981
|
name: "swap_evm_uniswap_tokens",
|
|
1982
|
-
description: "Preview, prepare, or execute
|
|
1982
|
+
description: "Preview, prepare, or execute a supported Uniswap path on ethereum, base, or robinhood: CLASSIC, UniswapX orders, or canonical ETH↔WETH wrap/unwrap. ERC-20 paths may use Permit2 EIP-712 or an UniswapX order signature. Preview or prepare first. After the user explicitly confirms the shown summary in chat, call execute; the OpenClaw plugin handles the internal execution authorization automatically.",
|
|
1983
1983
|
optional: true,
|
|
1984
1984
|
parameters: {
|
|
1985
1985
|
type: "object",
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "agent-wallet",
|
|
3
3
|
"name": "Agent Wallet",
|
|
4
4
|
"description": "Official OpenClaw plugin bridge for the agent-wallet backends, including Solana, local BTC, and local EVM.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.88",
|
|
6
6
|
"contracts": {
|
|
7
7
|
"tools": [
|
|
8
8
|
"agentlayer_autonomous_approve",
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,21 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
+
- Hardened Morpho EVM operations with a 30% gas-limit buffer calculated from
|
|
6
|
+
the exact final calldata immediately before sending. Morpho vault and market
|
|
7
|
+
writes now wait for their final on-chain receipt and report reverts instead
|
|
8
|
+
of returning an unconfirmed broadcast as a successful operation.
|
|
9
|
+
|
|
10
|
+
- Extended the same exact-calldata 30% gas-limit buffer and receipt validation
|
|
11
|
+
to Aave, Lido, Velora, LI.FI, and locally broadcast Uniswap swaps. This
|
|
12
|
+
includes Robinhood Chain's Universal Router, direct V3 fallback, and native
|
|
13
|
+
wrap/unwrap paths; UniswapX orders remain order submissions, not local
|
|
14
|
+
on-chain confirmations.
|
|
15
|
+
|
|
16
|
+
- Fixed the Robinhood Chain Uniswap default to Universal Router `2.1.1`.
|
|
17
|
+
`UNISWAP_ROUTER_VERSION_BY_NETWORK` can still explicitly override it per
|
|
18
|
+
network; the legacy global `2.0` default continues to serve Ethereum and Base.
|
|
19
|
+
|
|
5
20
|
## v0.1.77 - 2026-07-13
|
|
6
21
|
|
|
7
22
|
- Added Robinhood Chain mainnet (`chainId` 4663) to the local EVM wallet,
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.88
|
|
@@ -2174,8 +2174,9 @@ class OpenClawWalletAdapter:
|
|
|
2174
2174
|
AgentToolSpec(
|
|
2175
2175
|
name="get_uniswap_swap_quote",
|
|
2176
2176
|
description=(
|
|
2177
|
-
"Get a read-only Uniswap
|
|
2178
|
-
"on ethereum, base, or robinhood.
|
|
2177
|
+
"Get a read-only Uniswap execution preview for an ERC-20 or native ETH swap "
|
|
2178
|
+
"on ethereum, base, or robinhood. Supported paths are CLASSIC, UniswapX orders, "
|
|
2179
|
+
"and canonical ETH↔WETH wrap/unwrap. Supports Permit2 where required. "
|
|
2179
2180
|
"This does not approve, sign, or execute a swap."
|
|
2180
2181
|
),
|
|
2181
2182
|
input_schema={
|
|
@@ -2215,8 +2216,9 @@ class OpenClawWalletAdapter:
|
|
|
2215
2216
|
AgentToolSpec(
|
|
2216
2217
|
name="swap_evm_uniswap_tokens",
|
|
2217
2218
|
description=(
|
|
2218
|
-
"Preview, prepare, or execute
|
|
2219
|
-
"
|
|
2219
|
+
"Preview, prepare, or execute a supported Uniswap path on ethereum, base, or robinhood: "
|
|
2220
|
+
"CLASSIC, UniswapX orders, or canonical ETH↔WETH wrap/unwrap. ERC-20 paths may use Permit2 "
|
|
2221
|
+
"EIP-712 or an UniswapX order signature. "
|
|
2220
2222
|
"Prepare returns an execution plan only. Execute requires a host-issued approval token bound to the previewed operation "
|
|
2221
2223
|
"unless the high-trust autonomous permission group is enabled."
|
|
2222
2224
|
),
|
|
@@ -1240,7 +1240,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1240
1240
|
sign_only=self.sign_only,
|
|
1241
1241
|
),
|
|
1242
1242
|
"broadcasted": True,
|
|
1243
|
-
"confirmed":
|
|
1243
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1244
1244
|
}
|
|
1245
1245
|
|
|
1246
1246
|
async def preview_evm_lido_operation(
|
|
@@ -1308,7 +1308,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1308
1308
|
sign_only=self.sign_only,
|
|
1309
1309
|
),
|
|
1310
1310
|
"broadcasted": True,
|
|
1311
|
-
"confirmed":
|
|
1311
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1312
1312
|
}
|
|
1313
1313
|
|
|
1314
1314
|
async def preview_evm_lido_withdrawal(
|
|
@@ -1385,7 +1385,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1385
1385
|
sign_only=self.sign_only,
|
|
1386
1386
|
),
|
|
1387
1387
|
"broadcasted": True,
|
|
1388
|
-
"confirmed":
|
|
1388
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1389
1389
|
}
|
|
1390
1390
|
|
|
1391
1391
|
async def preview_evm_morpho_vault_operation(
|
|
@@ -1480,7 +1480,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1480
1480
|
sign_only=self.sign_only,
|
|
1481
1481
|
),
|
|
1482
1482
|
"broadcasted": True,
|
|
1483
|
-
"confirmed":
|
|
1483
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1484
1484
|
}
|
|
1485
1485
|
|
|
1486
1486
|
async def preview_evm_morpho_market_operation(
|
|
@@ -1575,7 +1575,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1575
1575
|
sign_only=self.sign_only,
|
|
1576
1576
|
),
|
|
1577
1577
|
"broadcasted": True,
|
|
1578
|
-
"confirmed":
|
|
1578
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1579
1579
|
}
|
|
1580
1580
|
|
|
1581
1581
|
async def get_evm_swap_quote(
|
|
@@ -1816,7 +1816,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1816
1816
|
"result": result,
|
|
1817
1817
|
"chain_id": int(data.get("chainId") or 0),
|
|
1818
1818
|
"broadcasted": True,
|
|
1819
|
-
"confirmed":
|
|
1819
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1820
1820
|
"source": "wdk-evm-wallet",
|
|
1821
1821
|
}
|
|
1822
1822
|
|
|
@@ -1835,6 +1835,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1835
1835
|
"slippage_bps": int(data.get("slippageBps")) if data.get("slippageBps") is not None else None,
|
|
1836
1836
|
"protocol": str(data.get("protocol") or "uniswap"),
|
|
1837
1837
|
"routing": str(data.get("routing") or "CLASSIC"),
|
|
1838
|
+
"execution_kind": str(data.get("executionKind") or "classic"),
|
|
1838
1839
|
"permit_required": bool(data.get("permitRequired")),
|
|
1839
1840
|
"allowance": _normalize_swap_allowance(data.get("allowance")),
|
|
1840
1841
|
"router": str(data.get("router") or "").strip() or None,
|
|
@@ -1845,7 +1846,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1845
1846
|
"token_in_metadata": _normalize_token_metadata(data.get("tokenInMetadata"), token_in),
|
|
1846
1847
|
"token_out_metadata": _normalize_token_metadata(data.get("tokenOutMetadata"), token_out),
|
|
1847
1848
|
"chain_id": int(data.get("chainId") or 0),
|
|
1848
|
-
"source": "wdk-evm-wallet",
|
|
1849
|
+
"source": str(data.get("source") or "wdk-evm-wallet"),
|
|
1849
1850
|
}
|
|
1850
1851
|
|
|
1851
1852
|
async def get_uniswap_swap_quote(
|
|
@@ -1893,6 +1894,19 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1893
1894
|
body["slippageBps"] = slippage_bps
|
|
1894
1895
|
data = await self.client.post("/v1/evm/uniswap/swap/quote", body)
|
|
1895
1896
|
payload = self._normalize_uniswap_quote_payload(data, token_in, token_out, amount_in_raw)
|
|
1897
|
+
prepared_transaction = data.get("swapTransaction")
|
|
1898
|
+
if isinstance(prepared_transaction, dict):
|
|
1899
|
+
swap_transaction = {
|
|
1900
|
+
"to": str(prepared_transaction.get("to") or "").strip() or payload["router"],
|
|
1901
|
+
"value": str(prepared_transaction.get("value") or "0"),
|
|
1902
|
+
"data_hash": str(prepared_transaction.get("dataHash") or "").strip() or None,
|
|
1903
|
+
}
|
|
1904
|
+
else:
|
|
1905
|
+
swap_transaction = {
|
|
1906
|
+
"to": payload["router"],
|
|
1907
|
+
"value": "0",
|
|
1908
|
+
"data_hash": None,
|
|
1909
|
+
}
|
|
1896
1910
|
return {
|
|
1897
1911
|
**payload,
|
|
1898
1912
|
"asset_type": "evm-uniswap-swap",
|
|
@@ -1903,11 +1917,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1903
1917
|
"input_amount_ui": payload["amount_in_ui"],
|
|
1904
1918
|
"swap_provider": payload["protocol"],
|
|
1905
1919
|
"route_plan": None,
|
|
1906
|
-
"swap_transaction":
|
|
1907
|
-
"to": payload["router"],
|
|
1908
|
-
"value": "0",
|
|
1909
|
-
"data_hash": None,
|
|
1910
|
-
},
|
|
1920
|
+
"swap_transaction": swap_transaction,
|
|
1911
1921
|
}
|
|
1912
1922
|
|
|
1913
1923
|
async def send_uniswap_swap(
|
|
@@ -1938,6 +1948,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1938
1948
|
body["minimumTokenOutAmount"] = minimum_output_amount_raw.strip()
|
|
1939
1949
|
data = await self.client.post("/v1/evm/uniswap/swap/send", body)
|
|
1940
1950
|
result = dict(data.get("result") or {})
|
|
1951
|
+
order_id = str(result.get("orderId") or "").strip() or None
|
|
1941
1952
|
return {
|
|
1942
1953
|
"chain": self.chain,
|
|
1943
1954
|
"network": self.network,
|
|
@@ -1955,6 +1966,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1955
1966
|
"minimum_output_amount_raw": str(data.get("minimumOutputAmountRaw")) if data.get("minimumOutputAmountRaw") is not None else None,
|
|
1956
1967
|
"swap_provider": str(data.get("protocol") or "uniswap"),
|
|
1957
1968
|
"routing": str(data.get("routing") or "CLASSIC"),
|
|
1969
|
+
"execution_kind": str(data.get("executionKind") or "classic"),
|
|
1958
1970
|
"quote_fingerprint": str(data.get("quoteFingerprint") or "").strip() or None,
|
|
1959
1971
|
"router": str(data.get("router") or "").strip() or None,
|
|
1960
1972
|
"allowance": _normalize_swap_allowance(data.get("allowance")),
|
|
@@ -1967,13 +1979,16 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
1967
1979
|
"token_in_metadata": _normalize_token_metadata(data.get("tokenInMetadata"), token_in),
|
|
1968
1980
|
"token_out_metadata": _normalize_token_metadata(data.get("tokenOutMetadata"), token_out),
|
|
1969
1981
|
"hash": result.get("hash"),
|
|
1982
|
+
"order_id": order_id,
|
|
1983
|
+
"order_status": str(result.get("orderStatus") or "").strip() or None,
|
|
1970
1984
|
"approve_hash": result.get("approveHash"),
|
|
1971
1985
|
"reset_allowance_hash": result.get("resetAllowanceHash"),
|
|
1972
1986
|
"result": result,
|
|
1973
1987
|
"chain_id": int(data.get("chainId") or 0),
|
|
1974
|
-
"broadcasted":
|
|
1975
|
-
"
|
|
1976
|
-
"
|
|
1988
|
+
"broadcasted": bool(result.get("hash")),
|
|
1989
|
+
"order_submitted": order_id is not None,
|
|
1990
|
+
"confirmed": bool(data.get("confirmed")),
|
|
1991
|
+
"source": str(data.get("source") or "wdk-evm-wallet"),
|
|
1977
1992
|
}
|
|
1978
1993
|
|
|
1979
1994
|
async def preview_evm_lifi_cross_chain_swap(
|
|
@@ -2087,7 +2102,7 @@ class WdkEvmLocalWalletBackend(AgentWalletBackend):
|
|
|
2087
2102
|
"reset_allowance_hash": result.get("resetAllowanceHash"),
|
|
2088
2103
|
"result": result,
|
|
2089
2104
|
"broadcasted": True,
|
|
2090
|
-
"confirmed":
|
|
2105
|
+
"confirmed": bool(data.get("confirmed")),
|
|
2091
2106
|
}
|
|
2092
2107
|
|
|
2093
2108
|
async def preview_evm_native_transfer(
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"id": "agent-wallet",
|
|
3
3
|
"name": "Agent Wallet",
|
|
4
4
|
"description": "Plugin-friendly wallet backend for OpenClaw agents with safe wallet tools and runtime instructions across Solana, local BTC, and local EVM.",
|
|
5
|
-
"version": "0.1.
|
|
5
|
+
"version": "0.1.88",
|
|
6
6
|
"skills": ["skills/wallet-operator"],
|
|
7
7
|
"configSchema": {
|
|
8
8
|
"type": "object",
|
|
@@ -99,7 +99,7 @@ Use this skill before calling OpenClaw wallet tools. It is the routing guide for
|
|
|
99
99
|
- Current intended path is ERC-20 to ERC-20 on `ethereum` or `base`.
|
|
100
100
|
- EVM same-chain Uniswap swap: `swap_evm_uniswap_tokens`
|
|
101
101
|
- Params: `token_in`, `token_out`, `amount_in_raw` base-unit string, `mode`, `purpose`, optional `network`.
|
|
102
|
-
-
|
|
102
|
+
- Supported paths on `ethereum`, `base`, and `robinhood` are CLASSIC, UniswapX orders, and canonical ETH↔WETH wrap/unwrap; other routes fail closed before signing.
|
|
103
103
|
- EVM swap quote only: `get_evm_swap_quote`
|
|
104
104
|
- Params: `token_in`, `token_out`, `amount_in_raw`, optional `network`.
|
|
105
105
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-wallet",
|
|
3
3
|
"displayName": "Agent Wallet",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.88",
|
|
5
5
|
"description": "Claude Code bridge for the existing AgentLayer wallet runtime. Connects to Solana, Bitcoin, and EVM wallets without creating a new one.",
|
|
6
6
|
"author": {
|
|
7
7
|
"name": "AgentLayer"
|
package/package.json
CHANGED
|
@@ -27,4 +27,9 @@ MORPHO_API_BASE_URL=https://api.morpho.org/graphql
|
|
|
27
27
|
UNISWAP_API_KEY=
|
|
28
28
|
# UNISWAP_TRADING_API_BASE_URL= # defaults to PROVIDER_GATEWAY_URL/v1/evm/uniswap
|
|
29
29
|
UNISWAP_ROUTER_VERSION=2.0
|
|
30
|
+
# Optional per-network override; each value must exist in the wallet's reviewed
|
|
31
|
+
# execution profile and match the provider-gateway's per-chain configuration.
|
|
32
|
+
# Robinhood Chain has no Universal Router 2.0 deployment (Uniswap defaults it
|
|
33
|
+
# to 2.1.1); requesting 2.0 makes the Trading API 404 every pair on that chain.
|
|
34
|
+
UNISWAP_ROUTER_VERSION_BY_NETWORK={"ethereum":"2.0","base":"2.0","robinhood":"2.1.1"}
|
|
30
35
|
UNISWAP_DEFAULT_SLIPPAGE_BPS=300
|
package/wdk-evm-wallet/README.md
CHANGED
|
@@ -57,6 +57,12 @@ const DEFAULT_NETWORK_PROFILES = {
|
|
|
57
57
|
},
|
|
58
58
|
};
|
|
59
59
|
|
|
60
|
+
// Robinhood Chain uses the Universal Router 2.1.1 deployment. Keep this
|
|
61
|
+
// network-specific default separate from the legacy global 2.0 setting so
|
|
62
|
+
// Ethereum and Base retain their existing routers while Robinhood can quote
|
|
63
|
+
// and execute without a local environment override.
|
|
64
|
+
const DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK = { robinhood: "2.1.1" };
|
|
65
|
+
|
|
60
66
|
const SUPPORTED_GATEWAY_PROVIDERS = new Set(["auto", "shared", "alchemy"]);
|
|
61
67
|
|
|
62
68
|
function parseProviderMode(value, fallback = "public") {
|
|
@@ -189,6 +195,35 @@ function normalizeNetworkKey(value) {
|
|
|
189
195
|
return aliases[normalized] || normalized;
|
|
190
196
|
}
|
|
191
197
|
|
|
198
|
+
function parseUniswapRouterVersionsByNetwork(value) {
|
|
199
|
+
const raw = String(value ?? "").trim();
|
|
200
|
+
if (!raw) {
|
|
201
|
+
return { ...DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK };
|
|
202
|
+
}
|
|
203
|
+
let parsed;
|
|
204
|
+
try {
|
|
205
|
+
parsed = JSON.parse(raw);
|
|
206
|
+
} catch {
|
|
207
|
+
throw new Error("UNISWAP_ROUTER_VERSION_BY_NETWORK must be a JSON object.");
|
|
208
|
+
}
|
|
209
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
210
|
+
throw new Error("UNISWAP_ROUTER_VERSION_BY_NETWORK must be a JSON object.");
|
|
211
|
+
}
|
|
212
|
+
const normalized = {};
|
|
213
|
+
for (const [network, version] of Object.entries(parsed)) {
|
|
214
|
+
const networkKey = normalizeNetworkKey(network);
|
|
215
|
+
if (!Object.hasOwn(DEFAULT_NETWORK_PROFILES, networkKey)) {
|
|
216
|
+
throw new Error(`UNISWAP_ROUTER_VERSION_BY_NETWORK contains unsupported network '${network}'.`);
|
|
217
|
+
}
|
|
218
|
+
const normalizedVersion = String(version ?? "").trim();
|
|
219
|
+
if (!normalizedVersion) {
|
|
220
|
+
throw new Error(`UNISWAP_ROUTER_VERSION_BY_NETWORK.${network} must be a non-empty string.`);
|
|
221
|
+
}
|
|
222
|
+
normalized[networkKey] = normalizedVersion;
|
|
223
|
+
}
|
|
224
|
+
return { ...DEFAULT_UNISWAP_ROUTER_VERSIONS_BY_NETWORK, ...normalized };
|
|
225
|
+
}
|
|
226
|
+
|
|
192
227
|
function joinUrl(base, pathname) {
|
|
193
228
|
const normalizedBase = String(base || "").trim();
|
|
194
229
|
if (!normalizedBase) {
|
|
@@ -360,6 +395,9 @@ export function loadConfig(env = process.env) {
|
|
|
360
395
|
providerGatewayToken,
|
|
361
396
|
uniswapApiKey: String(env.UNISWAP_API_KEY ?? "").trim(),
|
|
362
397
|
uniswapRouterVersion: String(env.UNISWAP_ROUTER_VERSION ?? "").trim() || "2.0",
|
|
398
|
+
uniswapRouterVersionsByNetwork: parseUniswapRouterVersionsByNetwork(
|
|
399
|
+
env.UNISWAP_ROUTER_VERSION_BY_NETWORK
|
|
400
|
+
),
|
|
363
401
|
// 300 bps (3%) default mirrors the Solana swap-intent floor. Active markets
|
|
364
402
|
// (Base re-prices every block) drift during the multi-step preview -> approval
|
|
365
403
|
// -> execute window; a 0.5% floor rejected ordinary drift. The quote
|
|
@@ -37,12 +37,21 @@ function normalizeErrorCode(errorCode, pathname, message) {
|
|
|
37
37
|
code === "aave_quote_changed" ||
|
|
38
38
|
code === "aave_approval_required" ||
|
|
39
39
|
code === "aave_fee_unavailable" ||
|
|
40
|
+
code === "aave_operation_reverted" ||
|
|
41
|
+
code === "aave_operation_confirmation_timeout" ||
|
|
40
42
|
code === "aave_cleanup_failed" ||
|
|
41
43
|
code === "morpho_api_failed" ||
|
|
42
44
|
code === "morpho_quote_changed" ||
|
|
43
45
|
code === "morpho_requirements_unresolved" ||
|
|
44
46
|
code === "morpho_fee_unavailable" ||
|
|
45
47
|
code === "morpho_cleanup_failed" ||
|
|
48
|
+
code === "defi_gas_estimate_unavailable" ||
|
|
49
|
+
code === "lido_operation_reverted" ||
|
|
50
|
+
code === "lido_operation_confirmation_timeout" ||
|
|
51
|
+
code === "lido_withdrawal_reverted" ||
|
|
52
|
+
code === "lido_withdrawal_confirmation_timeout" ||
|
|
53
|
+
code === "swap_reverted" ||
|
|
54
|
+
code === "swap_confirmation_timeout" ||
|
|
46
55
|
code === "token_transfer_failed" ||
|
|
47
56
|
code === "fee_limit_exceeded" ||
|
|
48
57
|
code === "token_read_failed" ||
|
|
@@ -138,11 +147,20 @@ function errorStatusCode(errorCode, fallback = 400) {
|
|
|
138
147
|
errorCode === "swap_cleanup_failed" ||
|
|
139
148
|
errorCode === "aave_approval_required" ||
|
|
140
149
|
errorCode === "aave_fee_unavailable" ||
|
|
150
|
+
errorCode === "aave_operation_reverted" ||
|
|
151
|
+
errorCode === "aave_operation_confirmation_timeout" ||
|
|
141
152
|
errorCode === "aave_cleanup_failed" ||
|
|
142
153
|
errorCode === "morpho_api_failed" ||
|
|
143
154
|
errorCode === "morpho_requirements_unresolved" ||
|
|
144
155
|
errorCode === "morpho_fee_unavailable" ||
|
|
145
156
|
errorCode === "morpho_cleanup_failed" ||
|
|
157
|
+
errorCode === "defi_gas_estimate_unavailable" ||
|
|
158
|
+
errorCode === "lido_operation_reverted" ||
|
|
159
|
+
errorCode === "lido_operation_confirmation_timeout" ||
|
|
160
|
+
errorCode === "lido_withdrawal_reverted" ||
|
|
161
|
+
errorCode === "lido_withdrawal_confirmation_timeout" ||
|
|
162
|
+
errorCode === "swap_reverted" ||
|
|
163
|
+
errorCode === "swap_confirmation_timeout" ||
|
|
146
164
|
errorCode === "token_transfer_failed" ||
|
|
147
165
|
errorCode === "fee_limit_exceeded" ||
|
|
148
166
|
errorCode === "uniswap_api_key_missing"
|