@agentlayer.tech/wallet 0.1.32 → 0.1.34
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 -59
- package/.openclaw/extensions/agent-wallet/index.ts +2 -59
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +1 -4
- package/.openclaw/extensions/agent-wallet/package.json +1 -1
- package/CHANGELOG.md +66 -0
- package/README.md +2 -5
- package/RELEASING.md +56 -29
- package/VERSION +1 -0
- package/agent-wallet/.env.example +0 -1
- package/agent-wallet/README.md +0 -8
- package/agent-wallet/agent_wallet/__init__.py +5 -0
- package/agent-wallet/agent_wallet/config.py +0 -1
- package/agent-wallet/agent_wallet/openclaw_adapter.py +25 -324
- package/agent-wallet/agent_wallet/openclaw_cli.py +0 -5
- package/agent-wallet/agent_wallet/providers/bags.py +1 -58
- package/agent-wallet/agent_wallet/providers/jupiter.py +1 -64
- package/agent-wallet/agent_wallet/update_check.py +191 -0
- package/agent-wallet/agent_wallet/wallet_layer/base.py +0 -44
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +0 -236
- package/agent-wallet/openclaw.plugin.json +1 -5
- package/agent-wallet/pyproject.toml +1 -1
- package/agent-wallet/skills/wallet-operator/SKILL.md +2 -5
- package/bin/openclaw-agent-wallet.mjs +419 -33
- package/claude-code/plugins/agent-wallet/.claude-plugin/plugin.json +1 -1
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +14 -1
- package/codex/plugins/agent-wallet/.codex-plugin/plugin.json +1 -1
- package/codex/plugins/agent-wallet/scripts/run_mcp.sh +18 -0
- package/codex/plugins/agent-wallet/server.py +39 -5
- package/hermes/plugins/agent_wallet/plugin.yaml +1 -1
- package/package.json +5 -1
- package/scripts/check_release_version.mjs +50 -20
- package/scripts/version_targets.mjs +60 -0
- package/wdk-btc-wallet/package.json +1 -1
- package/wdk-evm-wallet/README.md +3 -3
- package/wdk-evm-wallet/package.json +1 -1
- package/wdk-evm-wallet/src/wdk_evm_wallet.js +17 -2
|
@@ -42,13 +42,8 @@ network argument to EVM tools. Do not edit code, plugin config, or environment v
|
|
|
42
42
|
just to switch the active EVM network.
|
|
43
43
|
""".strip()
|
|
44
44
|
|
|
45
|
-
# Keep the backend implementation in place, but hide these agent-facing tools for now.
|
|
46
|
-
TEMPORARILY_DISABLED_TOOLS = {
|
|
47
|
-
"get_jupiter_portfolio_platforms",
|
|
48
|
-
"get_jupiter_portfolio",
|
|
49
|
-
"get_jupiter_staked_jup",
|
|
50
|
-
}
|
|
51
45
|
EVM_NATIVE_TOKEN_ADDRESS = "0x0000000000000000000000000000000000000000"
|
|
46
|
+
VELORA_NATIVE_TOKEN_ADDRESS = "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee"
|
|
52
47
|
SOLANA_NATIVE_TOKEN_ADDRESS = "11111111111111111111111111111111"
|
|
53
48
|
LIFI_CHAIN_ALIASES = {
|
|
54
49
|
"eth": "1",
|
|
@@ -167,6 +162,19 @@ class OpenClawWalletAdapter:
|
|
|
167
162
|
return SOLANA_NATIVE_TOKEN_ADDRESS
|
|
168
163
|
return text
|
|
169
164
|
|
|
165
|
+
def _canonicalize_velora_token_identifier(self, value: Any) -> str:
|
|
166
|
+
text = str(value or "").strip()
|
|
167
|
+
alias = text.lower()
|
|
168
|
+
if alias in {"native", "eth", "ethereum"}:
|
|
169
|
+
return VELORA_NATIVE_TOKEN_ADDRESS
|
|
170
|
+
if alias == EVM_NATIVE_TOKEN_ADDRESS:
|
|
171
|
+
return VELORA_NATIVE_TOKEN_ADDRESS
|
|
172
|
+
if alias == VELORA_NATIVE_TOKEN_ADDRESS:
|
|
173
|
+
return VELORA_NATIVE_TOKEN_ADDRESS
|
|
174
|
+
if alias.startswith("0x") and len(alias) == 42:
|
|
175
|
+
return alias
|
|
176
|
+
return text
|
|
177
|
+
|
|
170
178
|
def _require_prepare_intent(self, user_intent: Any) -> None:
|
|
171
179
|
if user_intent is not True:
|
|
172
180
|
raise WalletBackendError(
|
|
@@ -563,29 +571,6 @@ class OpenClawWalletAdapter:
|
|
|
563
571
|
"launch_fingerprint": launch_fingerprint,
|
|
564
572
|
}
|
|
565
573
|
|
|
566
|
-
if asset_type == "bags-fee-claim":
|
|
567
|
-
claim_binding = {
|
|
568
|
-
"token_mint": payload.get("token_mint"),
|
|
569
|
-
"claimable_positions": payload.get("claimable_positions"),
|
|
570
|
-
"claimable_position_count": payload.get("claimable_position_count"),
|
|
571
|
-
}
|
|
572
|
-
claim_fingerprint = hashlib.sha256(
|
|
573
|
-
json.dumps(
|
|
574
|
-
claim_binding,
|
|
575
|
-
sort_keys=True,
|
|
576
|
-
separators=(",", ":"),
|
|
577
|
-
).encode("utf-8")
|
|
578
|
-
).hexdigest()
|
|
579
|
-
return {
|
|
580
|
-
"operation": action_label,
|
|
581
|
-
"network": str(payload.get("network") or getattr(self.backend, "network", "unknown")),
|
|
582
|
-
"owner": payload.get("owner"),
|
|
583
|
-
"fee_claimer": payload.get("fee_claimer"),
|
|
584
|
-
"token_mint": payload.get("token_mint"),
|
|
585
|
-
"claimable_position_count": payload.get("claimable_position_count"),
|
|
586
|
-
"claim_fingerprint": claim_fingerprint,
|
|
587
|
-
}
|
|
588
|
-
|
|
589
574
|
if asset_type in {"flash-trade-open-position", "flash-trade-close-position"}:
|
|
590
575
|
flash_binding = {
|
|
591
576
|
"pool_name": payload.get("pool_name"),
|
|
@@ -1458,7 +1443,7 @@ class OpenClawWalletAdapter:
|
|
|
1458
1443
|
AgentToolSpec(
|
|
1459
1444
|
name="get_evm_swap_quote",
|
|
1460
1445
|
description=(
|
|
1461
|
-
"Get a read-only Velora quote for an ERC-20
|
|
1446
|
+
"Get a read-only Velora quote for an ERC-20 or native ETH swap on supported EVM mainnet networks. "
|
|
1462
1447
|
"This does not approve or execute a swap."
|
|
1463
1448
|
),
|
|
1464
1449
|
input_schema={
|
|
@@ -1466,11 +1451,11 @@ class OpenClawWalletAdapter:
|
|
|
1466
1451
|
"properties": {
|
|
1467
1452
|
"token_in": {
|
|
1468
1453
|
"type": "string",
|
|
1469
|
-
"description": "ERC-20 contract address for the input token.",
|
|
1454
|
+
"description": "ERC-20 contract address for the input token, or native/eth for native ETH.",
|
|
1470
1455
|
},
|
|
1471
1456
|
"token_out": {
|
|
1472
1457
|
"type": "string",
|
|
1473
|
-
"description": "ERC-20 contract address for the output token.",
|
|
1458
|
+
"description": "ERC-20 contract address for the output token, or native/eth for native ETH.",
|
|
1474
1459
|
},
|
|
1475
1460
|
"amount_in_raw": {
|
|
1476
1461
|
"type": "string",
|
|
@@ -1494,7 +1479,7 @@ class OpenClawWalletAdapter:
|
|
|
1494
1479
|
AgentToolSpec(
|
|
1495
1480
|
name="swap_evm_tokens",
|
|
1496
1481
|
description=(
|
|
1497
|
-
"Preview, prepare, or execute an ERC-20
|
|
1482
|
+
"Preview, prepare, or execute an ERC-20 or native ETH swap through Velora on supported EVM mainnet networks. "
|
|
1498
1483
|
"Prepare returns an execution plan only, and execute requires a host-issued approval token bound to the previewed operation."
|
|
1499
1484
|
),
|
|
1500
1485
|
input_schema={
|
|
@@ -1879,64 +1864,6 @@ class OpenClawWalletAdapter:
|
|
|
1879
1864
|
read_only=True,
|
|
1880
1865
|
risk_level="low",
|
|
1881
1866
|
),
|
|
1882
|
-
AgentToolSpec(
|
|
1883
|
-
name="get_bags_claimable_positions",
|
|
1884
|
-
description="Get claimable Bags fee-share positions for a Solana wallet on mainnet.",
|
|
1885
|
-
input_schema={
|
|
1886
|
-
"type": "object",
|
|
1887
|
-
"properties": {
|
|
1888
|
-
"wallet": {
|
|
1889
|
-
"type": "string",
|
|
1890
|
-
"description": "Optional wallet address override. If omitted, use the configured wallet address.",
|
|
1891
|
-
}
|
|
1892
|
-
},
|
|
1893
|
-
"additionalProperties": False,
|
|
1894
|
-
},
|
|
1895
|
-
read_only=True,
|
|
1896
|
-
risk_level="low",
|
|
1897
|
-
),
|
|
1898
|
-
AgentToolSpec(
|
|
1899
|
-
name="get_bags_fee_analytics",
|
|
1900
|
-
description="Get Bags fee analytics for a launched token, with optional claim event history.",
|
|
1901
|
-
input_schema={
|
|
1902
|
-
"type": "object",
|
|
1903
|
-
"properties": {
|
|
1904
|
-
"token_mint": {
|
|
1905
|
-
"type": "string",
|
|
1906
|
-
"description": "Launched token mint address.",
|
|
1907
|
-
},
|
|
1908
|
-
"include_claim_events": {
|
|
1909
|
-
"type": "boolean",
|
|
1910
|
-
"description": "If true, also fetch claim event history.",
|
|
1911
|
-
},
|
|
1912
|
-
"mode": {
|
|
1913
|
-
"type": "string",
|
|
1914
|
-
"enum": ["offset", "time"],
|
|
1915
|
-
"description": "Claim event pagination mode when include_claim_events is true.",
|
|
1916
|
-
},
|
|
1917
|
-
"limit": {
|
|
1918
|
-
"type": "integer",
|
|
1919
|
-
"description": "Optional event page size.",
|
|
1920
|
-
},
|
|
1921
|
-
"offset": {
|
|
1922
|
-
"type": "integer",
|
|
1923
|
-
"description": "Optional event offset when mode=offset.",
|
|
1924
|
-
},
|
|
1925
|
-
"from_ts": {
|
|
1926
|
-
"type": "integer",
|
|
1927
|
-
"description": "Optional unix timestamp start when mode=time.",
|
|
1928
|
-
},
|
|
1929
|
-
"to_ts": {
|
|
1930
|
-
"type": "integer",
|
|
1931
|
-
"description": "Optional unix timestamp end when mode=time.",
|
|
1932
|
-
},
|
|
1933
|
-
},
|
|
1934
|
-
"required": ["token_mint"],
|
|
1935
|
-
"additionalProperties": False,
|
|
1936
|
-
},
|
|
1937
|
-
read_only=True,
|
|
1938
|
-
risk_level="low",
|
|
1939
|
-
),
|
|
1940
1867
|
AgentToolSpec(
|
|
1941
1868
|
name="get_solana_staking_validators",
|
|
1942
1869
|
description="List native Solana staking validators by vote account, commission, and activated stake.",
|
|
@@ -1974,56 +1901,6 @@ class OpenClawWalletAdapter:
|
|
|
1974
1901
|
read_only=True,
|
|
1975
1902
|
risk_level="low",
|
|
1976
1903
|
),
|
|
1977
|
-
AgentToolSpec(
|
|
1978
|
-
name="get_jupiter_portfolio_platforms",
|
|
1979
|
-
description="List the Jupiter Portfolio platforms available for filtering position queries.",
|
|
1980
|
-
input_schema={
|
|
1981
|
-
"type": "object",
|
|
1982
|
-
"properties": {},
|
|
1983
|
-
"additionalProperties": False,
|
|
1984
|
-
},
|
|
1985
|
-
read_only=True,
|
|
1986
|
-
risk_level="low",
|
|
1987
|
-
),
|
|
1988
|
-
AgentToolSpec(
|
|
1989
|
-
name="get_jupiter_portfolio",
|
|
1990
|
-
description=(
|
|
1991
|
-
"Get Jupiter Portfolio positions for a Solana wallet address on mainnet."
|
|
1992
|
-
),
|
|
1993
|
-
input_schema={
|
|
1994
|
-
"type": "object",
|
|
1995
|
-
"properties": {
|
|
1996
|
-
"address": {
|
|
1997
|
-
"type": "string",
|
|
1998
|
-
"description": "Optional Solana wallet address override. If omitted, use the configured wallet.",
|
|
1999
|
-
},
|
|
2000
|
-
"platforms": {
|
|
2001
|
-
"type": "array",
|
|
2002
|
-
"items": {"type": "string"},
|
|
2003
|
-
"description": "Optional list of Jupiter platform ids to filter positions.",
|
|
2004
|
-
},
|
|
2005
|
-
},
|
|
2006
|
-
"additionalProperties": False,
|
|
2007
|
-
},
|
|
2008
|
-
read_only=True,
|
|
2009
|
-
risk_level="low",
|
|
2010
|
-
),
|
|
2011
|
-
AgentToolSpec(
|
|
2012
|
-
name="get_jupiter_staked_jup",
|
|
2013
|
-
description="Get Jupiter staked JUP information for a Solana wallet address on mainnet.",
|
|
2014
|
-
input_schema={
|
|
2015
|
-
"type": "object",
|
|
2016
|
-
"properties": {
|
|
2017
|
-
"address": {
|
|
2018
|
-
"type": "string",
|
|
2019
|
-
"description": "Optional Solana wallet address override. If omitted, use the configured wallet.",
|
|
2020
|
-
}
|
|
2021
|
-
},
|
|
2022
|
-
"additionalProperties": False,
|
|
2023
|
-
},
|
|
2024
|
-
read_only=True,
|
|
2025
|
-
risk_level="low",
|
|
2026
|
-
),
|
|
2027
1904
|
AgentToolSpec(
|
|
2028
1905
|
name="get_flash_trade_markets",
|
|
2029
1906
|
description="List Flash Trade perpetual markets currently available on Solana mainnet.",
|
|
@@ -2513,48 +2390,6 @@ class OpenClawWalletAdapter:
|
|
|
2513
2390
|
)
|
|
2514
2391
|
)
|
|
2515
2392
|
|
|
2516
|
-
tools.append(
|
|
2517
|
-
AgentToolSpec(
|
|
2518
|
-
name="claim_bags_fees",
|
|
2519
|
-
description=(
|
|
2520
|
-
"Preview, prepare, or execute a Bags fee-share claim for the connected wallet on mainnet. "
|
|
2521
|
-
"Use preview first, then execute only after explicit user approval."
|
|
2522
|
-
),
|
|
2523
|
-
input_schema={
|
|
2524
|
-
"type": "object",
|
|
2525
|
-
"properties": {
|
|
2526
|
-
"token_mint": {
|
|
2527
|
-
"type": "string",
|
|
2528
|
-
"description": "Launched token mint address whose fees should be claimed.",
|
|
2529
|
-
},
|
|
2530
|
-
"mode": {
|
|
2531
|
-
"type": "string",
|
|
2532
|
-
"enum": ["preview", "prepare", "execute"],
|
|
2533
|
-
"description": "preview returns claimable positions, prepare returns an execution plan without signed transaction bytes, execute attempts to claim fees.",
|
|
2534
|
-
},
|
|
2535
|
-
"purpose": {
|
|
2536
|
-
"type": "string",
|
|
2537
|
-
"description": "Short explanation of why the fee claim is being made.",
|
|
2538
|
-
},
|
|
2539
|
-
"user_intent": {
|
|
2540
|
-
"type": "boolean",
|
|
2541
|
-
"description": "Must be true for prepare mode.",
|
|
2542
|
-
},
|
|
2543
|
-
"approval_token": {
|
|
2544
|
-
"type": "string",
|
|
2545
|
-
"description": "Host-issued approval token required for execute mode.",
|
|
2546
|
-
},
|
|
2547
|
-
},
|
|
2548
|
-
"required": ["token_mint", "mode", "purpose"],
|
|
2549
|
-
"additionalProperties": False,
|
|
2550
|
-
},
|
|
2551
|
-
read_only=False,
|
|
2552
|
-
requires_explicit_user_intent=True,
|
|
2553
|
-
risk_level="high",
|
|
2554
|
-
)
|
|
2555
|
-
)
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
2393
|
tools.append(
|
|
2559
2394
|
AgentToolSpec(
|
|
2560
2395
|
name="swap_solana_lifi_cross_chain_tokens",
|
|
@@ -2976,7 +2811,7 @@ class OpenClawWalletAdapter:
|
|
|
2976
2811
|
)
|
|
2977
2812
|
|
|
2978
2813
|
tools.extend(self._x402_tool_specs())
|
|
2979
|
-
return
|
|
2814
|
+
return tools
|
|
2980
2815
|
|
|
2981
2816
|
def get_runtime_instructions(self) -> str:
|
|
2982
2817
|
"""Return the instruction block to inject into the agent runtime."""
|
|
@@ -2987,10 +2822,6 @@ class OpenClawWalletAdapter:
|
|
|
2987
2822
|
args = arguments or {}
|
|
2988
2823
|
try:
|
|
2989
2824
|
active_backend = self._resolve_backend_for_args(args)
|
|
2990
|
-
if tool_name in TEMPORARILY_DISABLED_TOOLS:
|
|
2991
|
-
raise WalletBackendError(
|
|
2992
|
-
f"{tool_name} is temporarily disabled. The implementation remains in the repo but this tool is currently turned off."
|
|
2993
|
-
)
|
|
2994
2825
|
|
|
2995
2826
|
if tool_name == "x402_search_services":
|
|
2996
2827
|
query = args.get("query")
|
|
@@ -3637,8 +3468,8 @@ class OpenClawWalletAdapter:
|
|
|
3637
3468
|
if int(amount_in_raw.strip()) <= 0:
|
|
3638
3469
|
raise WalletBackendError("amount_in_raw must be greater than zero.")
|
|
3639
3470
|
data = await active_backend.get_evm_swap_quote(
|
|
3640
|
-
token_in=
|
|
3641
|
-
token_out=
|
|
3471
|
+
token_in=self._canonicalize_velora_token_identifier(token_in),
|
|
3472
|
+
token_out=self._canonicalize_velora_token_identifier(token_out),
|
|
3642
3473
|
amount_in_raw=amount_in_raw.strip(),
|
|
3643
3474
|
)
|
|
3644
3475
|
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
@@ -3666,8 +3497,8 @@ class OpenClawWalletAdapter:
|
|
|
3666
3497
|
raise WalletBackendError("purpose is required.")
|
|
3667
3498
|
|
|
3668
3499
|
preview_kwargs = {
|
|
3669
|
-
"token_in":
|
|
3670
|
-
"token_out":
|
|
3500
|
+
"token_in": self._canonicalize_velora_token_identifier(token_in),
|
|
3501
|
+
"token_out": self._canonicalize_velora_token_identifier(token_out),
|
|
3671
3502
|
"amount_in_raw": amount_in_raw.strip(),
|
|
3672
3503
|
}
|
|
3673
3504
|
|
|
@@ -3713,8 +3544,8 @@ class OpenClawWalletAdapter:
|
|
|
3713
3544
|
expected_summary = {
|
|
3714
3545
|
"operation": "EVM swap",
|
|
3715
3546
|
"network": str(getattr(active_backend, "network", "unknown")),
|
|
3716
|
-
"token_in": token_in
|
|
3717
|
-
"token_out": token_out
|
|
3547
|
+
"token_in": preview_kwargs["token_in"],
|
|
3548
|
+
"token_out": preview_kwargs["token_out"],
|
|
3718
3549
|
"input_amount_raw": amount_in_raw.strip(),
|
|
3719
3550
|
}
|
|
3720
3551
|
for key, expected_value in expected_summary.items():
|
|
@@ -3938,46 +3769,6 @@ class OpenClawWalletAdapter:
|
|
|
3938
3769
|
data = await self.backend.get_token_prices(mints=mints)
|
|
3939
3770
|
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
3940
3771
|
|
|
3941
|
-
if tool_name == "get_bags_claimable_positions":
|
|
3942
|
-
wallet = args.get("wallet")
|
|
3943
|
-
if wallet is not None and not isinstance(wallet, str):
|
|
3944
|
-
raise WalletBackendError("wallet must be a string when provided.")
|
|
3945
|
-
data = await self.backend.get_bags_claimable_positions(wallet=wallet)
|
|
3946
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
3947
|
-
|
|
3948
|
-
if tool_name == "get_bags_fee_analytics":
|
|
3949
|
-
token_mint = args.get("token_mint")
|
|
3950
|
-
include_claim_events = args.get("include_claim_events", False)
|
|
3951
|
-
mode = args.get("mode", "offset")
|
|
3952
|
-
limit = args.get("limit")
|
|
3953
|
-
offset = args.get("offset")
|
|
3954
|
-
from_ts = args.get("from_ts")
|
|
3955
|
-
to_ts = args.get("to_ts")
|
|
3956
|
-
if not isinstance(token_mint, str) or not token_mint.strip():
|
|
3957
|
-
raise WalletBackendError("token_mint is required.")
|
|
3958
|
-
if not isinstance(include_claim_events, bool):
|
|
3959
|
-
raise WalletBackendError("include_claim_events must be a boolean.")
|
|
3960
|
-
if not isinstance(mode, str) or mode not in {"offset", "time"}:
|
|
3961
|
-
raise WalletBackendError("mode must be 'offset' or 'time'.")
|
|
3962
|
-
for field_name, value in (
|
|
3963
|
-
("limit", limit),
|
|
3964
|
-
("offset", offset),
|
|
3965
|
-
("from_ts", from_ts),
|
|
3966
|
-
("to_ts", to_ts),
|
|
3967
|
-
):
|
|
3968
|
-
if value is not None and not isinstance(value, int):
|
|
3969
|
-
raise WalletBackendError(f"{field_name} must be an integer when provided.")
|
|
3970
|
-
data = await self.backend.get_bags_fee_analytics(
|
|
3971
|
-
token_mint=token_mint.strip(),
|
|
3972
|
-
include_claim_events=include_claim_events,
|
|
3973
|
-
mode=mode,
|
|
3974
|
-
limit=limit,
|
|
3975
|
-
offset=offset,
|
|
3976
|
-
from_ts=from_ts,
|
|
3977
|
-
to_ts=to_ts,
|
|
3978
|
-
)
|
|
3979
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
3980
|
-
|
|
3981
3772
|
if tool_name == "get_solana_staking_validators":
|
|
3982
3773
|
limit = args.get("limit", 20)
|
|
3983
3774
|
include_delinquent = args.get("include_delinquent", False)
|
|
@@ -3998,33 +3789,6 @@ class OpenClawWalletAdapter:
|
|
|
3998
3789
|
data = await self.backend.get_stake_account(stake_account.strip())
|
|
3999
3790
|
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4000
3791
|
|
|
4001
|
-
if tool_name == "get_jupiter_portfolio_platforms":
|
|
4002
|
-
data = await self.backend.get_jupiter_portfolio_platforms()
|
|
4003
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4004
|
-
|
|
4005
|
-
if tool_name == "get_jupiter_portfolio":
|
|
4006
|
-
address = args.get("address")
|
|
4007
|
-
platforms = args.get("platforms")
|
|
4008
|
-
if address is not None and not isinstance(address, str):
|
|
4009
|
-
raise WalletBackendError("address must be a string when provided.")
|
|
4010
|
-
if platforms is not None:
|
|
4011
|
-
if not isinstance(platforms, list) or not all(
|
|
4012
|
-
isinstance(item, str) for item in platforms
|
|
4013
|
-
):
|
|
4014
|
-
raise WalletBackendError("platforms must be an array of strings.")
|
|
4015
|
-
data = await self.backend.get_jupiter_portfolio(
|
|
4016
|
-
address=address,
|
|
4017
|
-
platforms=platforms,
|
|
4018
|
-
)
|
|
4019
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4020
|
-
|
|
4021
|
-
if tool_name == "get_jupiter_staked_jup":
|
|
4022
|
-
address = args.get("address")
|
|
4023
|
-
if address is not None and not isinstance(address, str):
|
|
4024
|
-
raise WalletBackendError("address must be a string when provided.")
|
|
4025
|
-
data = await self.backend.get_jupiter_staked_jup(address=address)
|
|
4026
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4027
|
-
|
|
4028
3792
|
if tool_name == "get_flash_trade_markets":
|
|
4029
3793
|
pool_name = args.get("pool_name")
|
|
4030
3794
|
if pool_name is not None and not isinstance(pool_name, str):
|
|
@@ -5432,69 +5196,6 @@ class OpenClawWalletAdapter:
|
|
|
5432
5196
|
),
|
|
5433
5197
|
)
|
|
5434
5198
|
|
|
5435
|
-
if tool_name == "claim_bags_fees":
|
|
5436
|
-
token_mint = args.get("token_mint")
|
|
5437
|
-
mode = args.get("mode")
|
|
5438
|
-
purpose = args.get("purpose")
|
|
5439
|
-
user_intent = args.get("user_intent", False)
|
|
5440
|
-
approval_token = args.get("approval_token")
|
|
5441
|
-
|
|
5442
|
-
if not isinstance(token_mint, str) or not token_mint.strip():
|
|
5443
|
-
raise WalletBackendError("token_mint is required.")
|
|
5444
|
-
if mode not in {"preview", "prepare", "execute"}:
|
|
5445
|
-
raise WalletBackendError("mode must be 'preview', 'prepare' or 'execute'.")
|
|
5446
|
-
if not isinstance(purpose, str) or not purpose.strip():
|
|
5447
|
-
raise WalletBackendError("purpose is required.")
|
|
5448
|
-
|
|
5449
|
-
if mode == "preview":
|
|
5450
|
-
preview = await self.backend.preview_bags_fee_claim(token_mint.strip())
|
|
5451
|
-
return AgentToolResult(
|
|
5452
|
-
tool=tool_name,
|
|
5453
|
-
ok=True,
|
|
5454
|
-
data=self._annotate_sensitive_payload(
|
|
5455
|
-
preview,
|
|
5456
|
-
action_label="Bags fee claim",
|
|
5457
|
-
mode="preview",
|
|
5458
|
-
),
|
|
5459
|
-
)
|
|
5460
|
-
|
|
5461
|
-
if mode == "prepare":
|
|
5462
|
-
self._require_prepare_intent(user_intent)
|
|
5463
|
-
preview = await self.backend.preview_bags_fee_claim(token_mint.strip())
|
|
5464
|
-
return AgentToolResult(
|
|
5465
|
-
tool=tool_name,
|
|
5466
|
-
ok=True,
|
|
5467
|
-
data=self._annotate_sensitive_payload(
|
|
5468
|
-
self._build_prepare_plan(
|
|
5469
|
-
preview_payload=preview,
|
|
5470
|
-
action_label="Bags fee claim",
|
|
5471
|
-
),
|
|
5472
|
-
action_label="Bags fee claim",
|
|
5473
|
-
mode="prepare",
|
|
5474
|
-
),
|
|
5475
|
-
)
|
|
5476
|
-
|
|
5477
|
-
execute_preview = await self.backend.preview_bags_fee_claim(token_mint.strip())
|
|
5478
|
-
self._require_execute_approval(
|
|
5479
|
-
approval_token=approval_token,
|
|
5480
|
-
tool_name=tool_name,
|
|
5481
|
-
summary=self._build_confirmation_summary(
|
|
5482
|
-
action_label="Bags fee claim",
|
|
5483
|
-
payload=execute_preview,
|
|
5484
|
-
),
|
|
5485
|
-
action_label="Bags fee claim",
|
|
5486
|
-
)
|
|
5487
|
-
result = await self.backend.execute_bags_fee_claim_from_preview(execute_preview)
|
|
5488
|
-
return AgentToolResult(
|
|
5489
|
-
tool=tool_name,
|
|
5490
|
-
ok=True,
|
|
5491
|
-
data=self._annotate_sensitive_payload(
|
|
5492
|
-
result,
|
|
5493
|
-
action_label="Bags fee claim",
|
|
5494
|
-
mode="execute",
|
|
5495
|
-
),
|
|
5496
|
-
)
|
|
5497
|
-
|
|
5498
5199
|
if tool_name == "launch_bags_token":
|
|
5499
5200
|
name = args.get("name")
|
|
5500
5201
|
symbol = args.get("symbol")
|
|
@@ -96,11 +96,6 @@ def _apply_config_overrides(config: dict[str, Any]) -> None:
|
|
|
96
96
|
"jupiterSwapV2BaseUrl": ("JUPITER_SWAP_V2_API_BASE_URL", config.get("jupiterSwapV2BaseUrl"), True),
|
|
97
97
|
"jupiterUltraBaseUrl": ("JUPITER_ULTRA_API_BASE_URL", config.get("jupiterUltraBaseUrl"), True),
|
|
98
98
|
"jupiterPriceBaseUrl": ("JUPITER_PRICE_API_BASE_URL", config.get("jupiterPriceBaseUrl"), True),
|
|
99
|
-
"jupiterPortfolioBaseUrl": (
|
|
100
|
-
"JUPITER_PORTFOLIO_API_BASE_URL",
|
|
101
|
-
config.get("jupiterPortfolioBaseUrl"),
|
|
102
|
-
True,
|
|
103
|
-
),
|
|
104
99
|
"jupiterApiKey": ("JUPITER_API_KEY", config.get("jupiterApiKey"), True),
|
|
105
100
|
"kaminoBaseUrl": ("KAMINO_API_BASE_URL", config.get("kaminoBaseUrl"), True),
|
|
106
101
|
"kaminoProgramId": ("KAMINO_PROGRAM_ID", config.get("kaminoProgramId"), True),
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Bags
|
|
1
|
+
"""Bags launch helpers routed through the shared provider gateway."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -200,60 +200,3 @@ async def create_launch_transaction(payload: dict[str, Any]) -> str:
|
|
|
200
200
|
if isinstance(response, str):
|
|
201
201
|
return response
|
|
202
202
|
raise ProviderError("bags", "Unexpected launch transaction response from Bags.")
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
async def fetch_claimable_positions(wallet: str) -> Any:
|
|
206
|
-
return await _gateway_get_json(
|
|
207
|
-
"/v1/bags/claim/positions",
|
|
208
|
-
params={"wallet": wallet},
|
|
209
|
-
operation="Bags claimable positions",
|
|
210
|
-
)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
async def build_claim_transactions(payload: dict[str, Any]) -> Any:
|
|
214
|
-
return await _gateway_post_json(
|
|
215
|
-
"/v1/bags/claim/transactions",
|
|
216
|
-
body=payload,
|
|
217
|
-
operation="Bags claim transactions",
|
|
218
|
-
)
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
async def fetch_lifetime_fees(token_mint: str) -> Any:
|
|
222
|
-
return await _gateway_get_json(
|
|
223
|
-
"/v1/bags/fees/lifetime",
|
|
224
|
-
params={"tokenMint": token_mint},
|
|
225
|
-
operation="Bags lifetime fees",
|
|
226
|
-
)
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
async def fetch_claim_stats(token_mint: str) -> Any:
|
|
230
|
-
return await _gateway_get_json(
|
|
231
|
-
"/v1/bags/fees/claim-stats",
|
|
232
|
-
params={"tokenMint": token_mint},
|
|
233
|
-
operation="Bags claim stats",
|
|
234
|
-
)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
async def fetch_claim_events(
|
|
238
|
-
*,
|
|
239
|
-
token_mint: str,
|
|
240
|
-
mode: str = "offset",
|
|
241
|
-
limit: int | None = None,
|
|
242
|
-
offset: int | None = None,
|
|
243
|
-
from_ts: int | None = None,
|
|
244
|
-
to_ts: int | None = None,
|
|
245
|
-
) -> Any:
|
|
246
|
-
params: dict[str, Any] = {"tokenMint": token_mint, "mode": mode}
|
|
247
|
-
if limit is not None:
|
|
248
|
-
params["limit"] = str(limit)
|
|
249
|
-
if offset is not None:
|
|
250
|
-
params["offset"] = str(offset)
|
|
251
|
-
if from_ts is not None:
|
|
252
|
-
params["from"] = str(from_ts)
|
|
253
|
-
if to_ts is not None:
|
|
254
|
-
params["to"] = str(to_ts)
|
|
255
|
-
return await _gateway_get_json(
|
|
256
|
-
"/v1/bags/fees/claim-events",
|
|
257
|
-
params=params,
|
|
258
|
-
operation="Bags claim events",
|
|
259
|
-
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"""Jupiter providers for swap routing
|
|
1
|
+
"""Jupiter providers for swap routing and price flows."""
|
|
2
2
|
|
|
3
3
|
from __future__ import annotations
|
|
4
4
|
|
|
@@ -478,66 +478,3 @@ async def fetch_prices(
|
|
|
478
478
|
if not isinstance(data, dict):
|
|
479
479
|
raise ProviderError("jupiter", "Unexpected price response from Jupiter.")
|
|
480
480
|
return data
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
async def fetch_portfolio_platforms() -> dict[str, Any]:
|
|
484
|
-
"""Fetch the list of supported Jupiter Portfolio platforms."""
|
|
485
|
-
client = get_client()
|
|
486
|
-
response = await client.get(
|
|
487
|
-
f"{settings.jupiter_portfolio_api_base_url.rstrip('/')}/platforms",
|
|
488
|
-
headers=_headers(),
|
|
489
|
-
)
|
|
490
|
-
if response.status_code != 200:
|
|
491
|
-
raise ProviderError(
|
|
492
|
-
"jupiter-portfolio",
|
|
493
|
-
f"HTTP {response.status_code}: {response.text[:300]}",
|
|
494
|
-
)
|
|
495
|
-
data = response.json()
|
|
496
|
-
if not isinstance(data, dict):
|
|
497
|
-
raise ProviderError("jupiter-portfolio", "Unexpected portfolio platforms response.")
|
|
498
|
-
return data
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
async def fetch_portfolio_positions(
|
|
502
|
-
*,
|
|
503
|
-
address: str,
|
|
504
|
-
platforms: list[str] | None = None,
|
|
505
|
-
) -> dict[str, Any]:
|
|
506
|
-
"""Fetch Jupiter Portfolio positions for a wallet address."""
|
|
507
|
-
client = get_client()
|
|
508
|
-
params: dict[str, str] = {"address": address}
|
|
509
|
-
if platforms:
|
|
510
|
-
params["platforms"] = ",".join(platforms)
|
|
511
|
-
response = await client.get(
|
|
512
|
-
f"{settings.jupiter_portfolio_api_base_url.rstrip('/')}/positions",
|
|
513
|
-
params=params,
|
|
514
|
-
headers=_headers(),
|
|
515
|
-
)
|
|
516
|
-
if response.status_code != 200:
|
|
517
|
-
raise ProviderError(
|
|
518
|
-
"jupiter-portfolio",
|
|
519
|
-
f"HTTP {response.status_code}: {response.text[:300]}",
|
|
520
|
-
)
|
|
521
|
-
data = response.json()
|
|
522
|
-
if not isinstance(data, dict):
|
|
523
|
-
raise ProviderError("jupiter-portfolio", "Unexpected portfolio positions response.")
|
|
524
|
-
return data
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
async def fetch_staked_jup(*, address: str) -> dict[str, Any]:
|
|
528
|
-
"""Fetch staked JUP information for a wallet address."""
|
|
529
|
-
client = get_client()
|
|
530
|
-
response = await client.get(
|
|
531
|
-
f"{settings.jupiter_portfolio_api_base_url.rstrip('/')}/staked-jup",
|
|
532
|
-
params={"address": address},
|
|
533
|
-
headers=_headers(),
|
|
534
|
-
)
|
|
535
|
-
if response.status_code != 200:
|
|
536
|
-
raise ProviderError(
|
|
537
|
-
"jupiter-portfolio",
|
|
538
|
-
f"HTTP {response.status_code}: {response.text[:300]}",
|
|
539
|
-
)
|
|
540
|
-
data = response.json()
|
|
541
|
-
if not isinstance(data, dict):
|
|
542
|
-
raise ProviderError("jupiter-portfolio", "Unexpected staked JUP response.")
|
|
543
|
-
return data
|