@agentlayer.tech/wallet 0.1.30 → 0.1.32
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/README.md +1 -2
- package/.openclaw/extensions/agent-wallet/dist/index.js +6 -340
- package/.openclaw/extensions/agent-wallet/index.ts +6 -340
- package/.openclaw/extensions/agent-wallet/openclaw.plugin.json +0 -43
- package/.openclaw/extensions/agent-wallet/package.json +1 -1
- package/.openclaw/extensions/agent-wallet/skills/wallet-operator/SKILL.md +1 -3
- package/CHANGELOG.md +35 -0
- package/README.md +0 -5
- package/agent-wallet/.env.example +0 -12
- package/agent-wallet/README.md +0 -35
- package/agent-wallet/agent_wallet/btc_user_wallets.py +32 -1
- package/agent-wallet/agent_wallet/config.py +11 -7
- package/agent-wallet/agent_wallet/evm_user_wallets.py +2 -0
- package/agent-wallet/agent_wallet/openclaw_adapter.py +1 -655
- package/agent-wallet/agent_wallet/openclaw_cli.py +0 -7
- package/agent-wallet/agent_wallet/providers/evm_portfolio.py +18 -42
- package/agent-wallet/agent_wallet/providers/jupiter.py +1 -307
- package/agent-wallet/agent_wallet/providers/wdk_btc_local.py +31 -3
- package/agent-wallet/agent_wallet/providers/wdk_evm_local.py +37 -3
- package/agent-wallet/agent_wallet/transaction_policy.py +0 -262
- package/agent-wallet/agent_wallet/wallet_layer/base.py +0 -100
- package/agent-wallet/agent_wallet/wallet_layer/solana.py +1 -1118
- package/agent-wallet/openclaw.plugin.json +0 -4
- package/agent-wallet/pyproject.toml +1 -1
- package/agent-wallet/scripts/install_agent_wallet.py +113 -6
- package/agent-wallet/scripts/install_openclaw_local_config.py +7 -5
- package/agent-wallet/skills/wallet-operator/SKILL.md +1 -5
- package/bin/openclaw-agent-wallet.mjs +103 -36
- package/claude-code/plugins/agent-wallet/scripts/run_mcp.sh +7 -2
- package/codex/plugins/agent-wallet/server.py +2 -118
- package/hermes/plugins/agent_wallet/tools.py +1 -1
- package/package.json +1 -1
- package/wdk-btc-wallet/src/local_vault.js +45 -68
- package/wdk-btc-wallet/src/server.js +1 -0
- package/wdk-evm-wallet/README.md +4 -3
- package/wdk-evm-wallet/src/config.js +15 -0
- package/wdk-evm-wallet/src/local_vault.js +45 -68
- package/wdk-evm-wallet/src/server.js +1 -0
- package/agent-wallet/agent_wallet/providers/houdini.py +0 -539
|
@@ -389,27 +389,6 @@ class OpenClawWalletAdapter:
|
|
|
389
389
|
"transaction_data_hash": payload.get("transaction_data_hash"),
|
|
390
390
|
}
|
|
391
391
|
|
|
392
|
-
if asset_type == "solana-private-swap":
|
|
393
|
-
return {
|
|
394
|
-
"operation": action_label,
|
|
395
|
-
"network": str(payload.get("network") or getattr(self.backend, "network", "unknown")),
|
|
396
|
-
"swap_provider": payload.get("source") or "houdini",
|
|
397
|
-
"owner": payload.get("owner"),
|
|
398
|
-
"destination_address": payload.get("destination_address"),
|
|
399
|
-
"input_token_id": payload.get("input_token_id"),
|
|
400
|
-
"output_token_id": payload.get("output_token_id"),
|
|
401
|
-
"input_token_symbol": payload.get("input_token_symbol"),
|
|
402
|
-
"output_token_symbol": payload.get("output_token_symbol"),
|
|
403
|
-
"input_token_address": payload.get("input_token_address"),
|
|
404
|
-
"output_token_address": payload.get("output_token_address"),
|
|
405
|
-
"input_amount_ui": payload.get("input_amount_ui"),
|
|
406
|
-
"estimated_output_amount_ui": payload.get("estimated_output_amount_ui"),
|
|
407
|
-
"private_duration_minutes": payload.get("private_duration_minutes"),
|
|
408
|
-
"quote_id": payload.get("quote_id"),
|
|
409
|
-
"anonymous": payload.get("anonymous"),
|
|
410
|
-
"use_xmr": payload.get("use_xmr"),
|
|
411
|
-
}
|
|
412
|
-
|
|
413
392
|
if asset_type == "evm-lifi-cross-chain-swap":
|
|
414
393
|
return {
|
|
415
394
|
"operation": action_label,
|
|
@@ -2045,56 +2024,6 @@ class OpenClawWalletAdapter:
|
|
|
2045
2024
|
read_only=True,
|
|
2046
2025
|
risk_level="low",
|
|
2047
2026
|
),
|
|
2048
|
-
AgentToolSpec(
|
|
2049
|
-
name="get_jupiter_earn_tokens",
|
|
2050
|
-
description="List Jupiter Earn vault tokens currently supported on Solana mainnet.",
|
|
2051
|
-
input_schema={
|
|
2052
|
-
"type": "object",
|
|
2053
|
-
"properties": {},
|
|
2054
|
-
"additionalProperties": False,
|
|
2055
|
-
},
|
|
2056
|
-
read_only=True,
|
|
2057
|
-
risk_level="low",
|
|
2058
|
-
),
|
|
2059
|
-
AgentToolSpec(
|
|
2060
|
-
name="get_jupiter_earn_positions",
|
|
2061
|
-
description="Get Jupiter Earn positions for one or more Solana wallet addresses on mainnet.",
|
|
2062
|
-
input_schema={
|
|
2063
|
-
"type": "object",
|
|
2064
|
-
"properties": {
|
|
2065
|
-
"users": {
|
|
2066
|
-
"type": "array",
|
|
2067
|
-
"items": {"type": "string"},
|
|
2068
|
-
"description": "Optional list of Solana wallet addresses. If omitted, use the configured wallet address.",
|
|
2069
|
-
}
|
|
2070
|
-
},
|
|
2071
|
-
"additionalProperties": False,
|
|
2072
|
-
},
|
|
2073
|
-
read_only=True,
|
|
2074
|
-
risk_level="low",
|
|
2075
|
-
),
|
|
2076
|
-
AgentToolSpec(
|
|
2077
|
-
name="get_jupiter_earn_earnings",
|
|
2078
|
-
description="Get Jupiter Earn earnings for a wallet and one or more position addresses on mainnet.",
|
|
2079
|
-
input_schema={
|
|
2080
|
-
"type": "object",
|
|
2081
|
-
"properties": {
|
|
2082
|
-
"user": {
|
|
2083
|
-
"type": "string",
|
|
2084
|
-
"description": "Optional Solana wallet address override. If omitted, use the configured wallet.",
|
|
2085
|
-
},
|
|
2086
|
-
"positions": {
|
|
2087
|
-
"type": "array",
|
|
2088
|
-
"items": {"type": "string"},
|
|
2089
|
-
"description": "List of Jupiter Earn position addresses.",
|
|
2090
|
-
},
|
|
2091
|
-
},
|
|
2092
|
-
"required": ["positions"],
|
|
2093
|
-
"additionalProperties": False,
|
|
2094
|
-
},
|
|
2095
|
-
read_only=True,
|
|
2096
|
-
risk_level="low",
|
|
2097
|
-
),
|
|
2098
2027
|
AgentToolSpec(
|
|
2099
2028
|
name="get_flash_trade_markets",
|
|
2100
2029
|
description="List Flash Trade perpetual markets currently available on Solana mainnet.",
|
|
@@ -2584,112 +2513,6 @@ class OpenClawWalletAdapter:
|
|
|
2584
2513
|
)
|
|
2585
2514
|
)
|
|
2586
2515
|
|
|
2587
|
-
tools.append(
|
|
2588
|
-
AgentToolSpec(
|
|
2589
|
-
name="swap_solana_privately",
|
|
2590
|
-
description=(
|
|
2591
|
-
"Preview or create a Solana private payout through Houdini's anonymous routing. "
|
|
2592
|
-
"The initial implementation supports same-token private payouts only, such as SOL->SOL or USDC->USDC. "
|
|
2593
|
-
"Use preview first, then execute after explicit approval. "
|
|
2594
|
-
"The first execute creates the Houdini order and returns the deposit address; use continue_solana_private_swap to submit the funding transfer."
|
|
2595
|
-
),
|
|
2596
|
-
input_schema={
|
|
2597
|
-
"type": "object",
|
|
2598
|
-
"properties": {
|
|
2599
|
-
"input_token": {
|
|
2600
|
-
"type": "string",
|
|
2601
|
-
"description": "Source Solana token identifier. Symbol, name, mint address, or Houdini token id.",
|
|
2602
|
-
},
|
|
2603
|
-
"output_token": {
|
|
2604
|
-
"type": "string",
|
|
2605
|
-
"description": "Destination Solana token identifier. For the initial implementation, this must resolve to the same token as input_token.",
|
|
2606
|
-
},
|
|
2607
|
-
"destination_address": {
|
|
2608
|
-
"type": "string",
|
|
2609
|
-
"description": "Destination Solana wallet address that should receive the privately routed payout.",
|
|
2610
|
-
},
|
|
2611
|
-
"amount": {
|
|
2612
|
-
"type": "number",
|
|
2613
|
-
"description": "Input token amount in UI units.",
|
|
2614
|
-
},
|
|
2615
|
-
"use_xmr": {
|
|
2616
|
-
"type": "boolean",
|
|
2617
|
-
"description": "Optional. Force Houdini's XMR privacy hop when available.",
|
|
2618
|
-
},
|
|
2619
|
-
"mode": {
|
|
2620
|
-
"type": "string",
|
|
2621
|
-
"enum": ["preview", "execute"],
|
|
2622
|
-
},
|
|
2623
|
-
"purpose": {"type": "string"},
|
|
2624
|
-
"user_intent": {"type": "boolean"},
|
|
2625
|
-
"approval_token": {"type": "string"},
|
|
2626
|
-
},
|
|
2627
|
-
"required": [
|
|
2628
|
-
"input_token",
|
|
2629
|
-
"output_token",
|
|
2630
|
-
"destination_address",
|
|
2631
|
-
"amount",
|
|
2632
|
-
"mode",
|
|
2633
|
-
"purpose",
|
|
2634
|
-
],
|
|
2635
|
-
"additionalProperties": False,
|
|
2636
|
-
},
|
|
2637
|
-
read_only=False,
|
|
2638
|
-
requires_explicit_user_intent=True,
|
|
2639
|
-
risk_level="high",
|
|
2640
|
-
)
|
|
2641
|
-
)
|
|
2642
|
-
|
|
2643
|
-
tools.append(
|
|
2644
|
-
AgentToolSpec(
|
|
2645
|
-
name="continue_solana_private_swap",
|
|
2646
|
-
description=(
|
|
2647
|
-
"Continue a previously created Houdini Solana private payout and submit the funding transfer "
|
|
2648
|
-
"to the saved deposit address. Use this only after swap_solana_privately execute has returned "
|
|
2649
|
-
"a pending order with deposit address details."
|
|
2650
|
-
),
|
|
2651
|
-
input_schema={
|
|
2652
|
-
"type": "object",
|
|
2653
|
-
"properties": {
|
|
2654
|
-
"houdini_id": {
|
|
2655
|
-
"type": "string",
|
|
2656
|
-
"description": "Optional Houdini order id for the pending private payout. If omitted, the host may use the latest cached pending order.",
|
|
2657
|
-
},
|
|
2658
|
-
"approval_token": {
|
|
2659
|
-
"type": "string",
|
|
2660
|
-
"description": "Approval token issued from the original private swap preview.",
|
|
2661
|
-
},
|
|
2662
|
-
},
|
|
2663
|
-
"required": ["approval_token"],
|
|
2664
|
-
"additionalProperties": False,
|
|
2665
|
-
},
|
|
2666
|
-
read_only=False,
|
|
2667
|
-
requires_explicit_user_intent=True,
|
|
2668
|
-
risk_level="high",
|
|
2669
|
-
)
|
|
2670
|
-
)
|
|
2671
|
-
|
|
2672
|
-
tools.append(
|
|
2673
|
-
AgentToolSpec(
|
|
2674
|
-
name="get_solana_private_swap_status",
|
|
2675
|
-
description=(
|
|
2676
|
-
"Check Houdini status for a Solana private payout created by swap_solana_privately. "
|
|
2677
|
-
"Use houdini_id from the execute result. multi_id is still accepted for legacy multi-order flows."
|
|
2678
|
-
),
|
|
2679
|
-
input_schema={
|
|
2680
|
-
"type": "object",
|
|
2681
|
-
"properties": {
|
|
2682
|
-
"multi_id": {"type": "string"},
|
|
2683
|
-
"houdini_id": {"type": "string"},
|
|
2684
|
-
},
|
|
2685
|
-
"anyOf": [{"required": ["multi_id"]}, {"required": ["houdini_id"]}],
|
|
2686
|
-
"additionalProperties": False,
|
|
2687
|
-
},
|
|
2688
|
-
read_only=True,
|
|
2689
|
-
risk_level="low",
|
|
2690
|
-
)
|
|
2691
|
-
)
|
|
2692
|
-
|
|
2693
2516
|
tools.append(
|
|
2694
2517
|
AgentToolSpec(
|
|
2695
2518
|
name="claim_bags_fees",
|
|
@@ -2731,6 +2554,7 @@ class OpenClawWalletAdapter:
|
|
|
2731
2554
|
)
|
|
2732
2555
|
)
|
|
2733
2556
|
|
|
2557
|
+
|
|
2734
2558
|
tools.append(
|
|
2735
2559
|
AgentToolSpec(
|
|
2736
2560
|
name="swap_solana_lifi_cross_chain_tokens",
|
|
@@ -2874,96 +2698,6 @@ class OpenClawWalletAdapter:
|
|
|
2874
2698
|
)
|
|
2875
2699
|
)
|
|
2876
2700
|
|
|
2877
|
-
tools.append(
|
|
2878
|
-
AgentToolSpec(
|
|
2879
|
-
name="jupiter_earn_deposit",
|
|
2880
|
-
description=(
|
|
2881
|
-
"Preview, prepare, or execute a Jupiter Earn deposit using a raw base-unit amount. "
|
|
2882
|
-
"Use preview first, then execute only after explicit user approval."
|
|
2883
|
-
),
|
|
2884
|
-
input_schema={
|
|
2885
|
-
"type": "object",
|
|
2886
|
-
"properties": {
|
|
2887
|
-
"asset": {
|
|
2888
|
-
"type": "string",
|
|
2889
|
-
"description": "Solana mint address for the Earn asset.",
|
|
2890
|
-
},
|
|
2891
|
-
"amount_raw": {
|
|
2892
|
-
"type": "string",
|
|
2893
|
-
"description": "Deposit amount in raw base units as an integer string.",
|
|
2894
|
-
},
|
|
2895
|
-
"mode": {
|
|
2896
|
-
"type": "string",
|
|
2897
|
-
"enum": ["preview", "prepare", "execute"],
|
|
2898
|
-
"description": "preview returns a summary, prepare returns an execution plan without signed transaction bytes, execute attempts to submit the Earn deposit transaction.",
|
|
2899
|
-
},
|
|
2900
|
-
"purpose": {
|
|
2901
|
-
"type": "string",
|
|
2902
|
-
"description": "Short explanation of why the Earn deposit is being made.",
|
|
2903
|
-
},
|
|
2904
|
-
"user_intent": {
|
|
2905
|
-
"type": "boolean",
|
|
2906
|
-
"description": "Must be true for prepare mode.",
|
|
2907
|
-
},
|
|
2908
|
-
"approval_token": {
|
|
2909
|
-
"type": "string",
|
|
2910
|
-
"description": "Host-issued approval token required for execute mode.",
|
|
2911
|
-
},
|
|
2912
|
-
},
|
|
2913
|
-
"required": ["asset", "amount_raw", "mode", "purpose"],
|
|
2914
|
-
"additionalProperties": False,
|
|
2915
|
-
},
|
|
2916
|
-
read_only=False,
|
|
2917
|
-
requires_explicit_user_intent=True,
|
|
2918
|
-
risk_level="high",
|
|
2919
|
-
)
|
|
2920
|
-
)
|
|
2921
|
-
|
|
2922
|
-
tools.append(
|
|
2923
|
-
AgentToolSpec(
|
|
2924
|
-
name="jupiter_earn_withdraw",
|
|
2925
|
-
description=(
|
|
2926
|
-
"Preview, prepare, or execute a Jupiter Earn withdraw using a raw base-unit amount. "
|
|
2927
|
-
"Use preview first, then execute only after explicit user approval."
|
|
2928
|
-
),
|
|
2929
|
-
input_schema={
|
|
2930
|
-
"type": "object",
|
|
2931
|
-
"properties": {
|
|
2932
|
-
"asset": {
|
|
2933
|
-
"type": "string",
|
|
2934
|
-
"description": "Solana mint address for the Earn asset.",
|
|
2935
|
-
},
|
|
2936
|
-
"amount_raw": {
|
|
2937
|
-
"type": "string",
|
|
2938
|
-
"description": "Withdraw amount in raw base units as an integer string.",
|
|
2939
|
-
},
|
|
2940
|
-
"mode": {
|
|
2941
|
-
"type": "string",
|
|
2942
|
-
"enum": ["preview", "prepare", "execute"],
|
|
2943
|
-
"description": "preview returns a summary, prepare returns an execution plan without signed transaction bytes, execute attempts to submit the Earn withdraw transaction.",
|
|
2944
|
-
},
|
|
2945
|
-
"purpose": {
|
|
2946
|
-
"type": "string",
|
|
2947
|
-
"description": "Short explanation of why the Earn withdraw is being made.",
|
|
2948
|
-
},
|
|
2949
|
-
"user_intent": {
|
|
2950
|
-
"type": "boolean",
|
|
2951
|
-
"description": "Must be true for prepare mode.",
|
|
2952
|
-
},
|
|
2953
|
-
"approval_token": {
|
|
2954
|
-
"type": "string",
|
|
2955
|
-
"description": "Host-issued approval token required for execute mode.",
|
|
2956
|
-
},
|
|
2957
|
-
},
|
|
2958
|
-
"required": ["asset", "amount_raw", "mode", "purpose"],
|
|
2959
|
-
"additionalProperties": False,
|
|
2960
|
-
},
|
|
2961
|
-
read_only=False,
|
|
2962
|
-
requires_explicit_user_intent=True,
|
|
2963
|
-
risk_level="high",
|
|
2964
|
-
)
|
|
2965
|
-
)
|
|
2966
|
-
|
|
2967
2701
|
tools.append(
|
|
2968
2702
|
AgentToolSpec(
|
|
2969
2703
|
name="kamino_lend_deposit",
|
|
@@ -4291,33 +4025,6 @@ class OpenClawWalletAdapter:
|
|
|
4291
4025
|
data = await self.backend.get_jupiter_staked_jup(address=address)
|
|
4292
4026
|
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4293
4027
|
|
|
4294
|
-
if tool_name == "get_jupiter_earn_tokens":
|
|
4295
|
-
data = await self.backend.get_jupiter_earn_tokens()
|
|
4296
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4297
|
-
|
|
4298
|
-
if tool_name == "get_jupiter_earn_positions":
|
|
4299
|
-
users = args.get("users")
|
|
4300
|
-
if users is not None:
|
|
4301
|
-
if not isinstance(users, list) or not all(isinstance(item, str) for item in users):
|
|
4302
|
-
raise WalletBackendError("users must be an array of strings.")
|
|
4303
|
-
data = await self.backend.get_jupiter_earn_positions(users=users)
|
|
4304
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4305
|
-
|
|
4306
|
-
if tool_name == "get_jupiter_earn_earnings":
|
|
4307
|
-
user = args.get("user")
|
|
4308
|
-
positions = args.get("positions")
|
|
4309
|
-
if user is not None and not isinstance(user, str):
|
|
4310
|
-
raise WalletBackendError("user must be a string when provided.")
|
|
4311
|
-
if not isinstance(positions, list) or not positions:
|
|
4312
|
-
raise WalletBackendError("positions must be a non-empty array of strings.")
|
|
4313
|
-
if not all(isinstance(item, str) for item in positions):
|
|
4314
|
-
raise WalletBackendError("Each position must be a string.")
|
|
4315
|
-
data = await self.backend.get_jupiter_earn_earnings(
|
|
4316
|
-
user=user,
|
|
4317
|
-
positions=positions,
|
|
4318
|
-
)
|
|
4319
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
4320
|
-
|
|
4321
4028
|
if tool_name == "get_flash_trade_markets":
|
|
4322
4029
|
pool_name = args.get("pool_name")
|
|
4323
4030
|
if pool_name is not None and not isinstance(pool_name, str):
|
|
@@ -5567,211 +5274,6 @@ class OpenClawWalletAdapter:
|
|
|
5567
5274
|
),
|
|
5568
5275
|
)
|
|
5569
5276
|
|
|
5570
|
-
if tool_name == "swap_solana_privately":
|
|
5571
|
-
input_token = args.get("input_token")
|
|
5572
|
-
output_token = args.get("output_token")
|
|
5573
|
-
destination_address = args.get("destination_address")
|
|
5574
|
-
amount = args.get("amount")
|
|
5575
|
-
use_xmr = args.get("use_xmr", False)
|
|
5576
|
-
mode = args.get("mode")
|
|
5577
|
-
purpose = args.get("purpose")
|
|
5578
|
-
user_intent = args.get("user_intent", False)
|
|
5579
|
-
approval_token = args.get("approval_token")
|
|
5580
|
-
|
|
5581
|
-
if not isinstance(input_token, str) or not input_token.strip():
|
|
5582
|
-
raise WalletBackendError("input_token is required.")
|
|
5583
|
-
if not isinstance(output_token, str) or not output_token.strip():
|
|
5584
|
-
raise WalletBackendError("output_token is required.")
|
|
5585
|
-
if not isinstance(destination_address, str) or not destination_address.strip():
|
|
5586
|
-
raise WalletBackendError("destination_address is required.")
|
|
5587
|
-
if not isinstance(amount, (int, float)) or amount <= 0:
|
|
5588
|
-
raise WalletBackendError("amount must be a positive number.")
|
|
5589
|
-
if not isinstance(use_xmr, bool):
|
|
5590
|
-
raise WalletBackendError("use_xmr must be a boolean when provided.")
|
|
5591
|
-
if mode not in {"preview", "prepare", "execute"}:
|
|
5592
|
-
raise WalletBackendError("mode must be 'preview', 'prepare' or 'execute'.")
|
|
5593
|
-
if not isinstance(purpose, str) or not purpose.strip():
|
|
5594
|
-
raise WalletBackendError("purpose is required.")
|
|
5595
|
-
|
|
5596
|
-
preview_kwargs = {
|
|
5597
|
-
"input_token": input_token.strip(),
|
|
5598
|
-
"output_token": output_token.strip(),
|
|
5599
|
-
"destination_address": destination_address.strip(),
|
|
5600
|
-
"amount_ui": float(amount),
|
|
5601
|
-
"use_xmr": use_xmr,
|
|
5602
|
-
}
|
|
5603
|
-
|
|
5604
|
-
if mode == "preview":
|
|
5605
|
-
preview = await self.backend.preview_solana_private_swap(**preview_kwargs)
|
|
5606
|
-
return AgentToolResult(
|
|
5607
|
-
tool=tool_name,
|
|
5608
|
-
ok=True,
|
|
5609
|
-
data=self._annotate_sensitive_payload(
|
|
5610
|
-
preview,
|
|
5611
|
-
action_label="Solana private swap",
|
|
5612
|
-
mode="preview",
|
|
5613
|
-
),
|
|
5614
|
-
)
|
|
5615
|
-
|
|
5616
|
-
if mode == "prepare":
|
|
5617
|
-
self._require_prepare_intent(user_intent)
|
|
5618
|
-
preview = await self.backend.preview_solana_private_swap(**preview_kwargs)
|
|
5619
|
-
return AgentToolResult(
|
|
5620
|
-
tool=tool_name,
|
|
5621
|
-
ok=True,
|
|
5622
|
-
data=self._annotate_sensitive_payload(
|
|
5623
|
-
self._build_prepare_plan(
|
|
5624
|
-
preview_payload=preview,
|
|
5625
|
-
action_label="Solana private swap",
|
|
5626
|
-
),
|
|
5627
|
-
action_label="Solana private swap",
|
|
5628
|
-
mode="prepare",
|
|
5629
|
-
),
|
|
5630
|
-
)
|
|
5631
|
-
|
|
5632
|
-
approval_payload = inspect_approval_token(
|
|
5633
|
-
approval_token,
|
|
5634
|
-
tool_name=tool_name,
|
|
5635
|
-
network=str(getattr(self.backend, "network", "unknown")),
|
|
5636
|
-
require_mainnet_confirmation=self._is_mainnet_for_backend(self.backend),
|
|
5637
|
-
)
|
|
5638
|
-
approval_summary = approval_payload.get("binding", {}).get("summary")
|
|
5639
|
-
if not isinstance(approval_summary, dict):
|
|
5640
|
-
raise WalletBackendError(
|
|
5641
|
-
"approval_token does not match the requested operation. Generate a new approval after previewing the exact action."
|
|
5642
|
-
)
|
|
5643
|
-
expected_summary = {
|
|
5644
|
-
"operation": "Solana private swap",
|
|
5645
|
-
"network": str(getattr(self.backend, "network", "unknown")),
|
|
5646
|
-
"destination_address": destination_address.strip(),
|
|
5647
|
-
"use_xmr": use_xmr,
|
|
5648
|
-
}
|
|
5649
|
-
for key, expected_value in expected_summary.items():
|
|
5650
|
-
if approval_summary.get(key) != expected_value:
|
|
5651
|
-
raise WalletBackendError(
|
|
5652
|
-
"approval_token does not match the requested operation. Generate a new approval after previewing the exact action."
|
|
5653
|
-
)
|
|
5654
|
-
try:
|
|
5655
|
-
approved_amount = float(approval_summary.get("input_amount_ui"))
|
|
5656
|
-
except (TypeError, ValueError):
|
|
5657
|
-
raise WalletBackendError(
|
|
5658
|
-
"approval_token does not match the requested operation. Generate a new approval after previewing the exact action."
|
|
5659
|
-
)
|
|
5660
|
-
if approved_amount != float(amount):
|
|
5661
|
-
raise WalletBackendError(
|
|
5662
|
-
"approval_token does not match the requested operation. Generate a new approval after previewing the exact action."
|
|
5663
|
-
)
|
|
5664
|
-
|
|
5665
|
-
approval_summary_copy = dict(approval_summary)
|
|
5666
|
-
approved_preview = args.get("_approved_preview")
|
|
5667
|
-
resume_private_swap_order = args.get("_resume_private_swap_order")
|
|
5668
|
-
if resume_private_swap_order is not None and not isinstance(resume_private_swap_order, dict):
|
|
5669
|
-
raise WalletBackendError("_resume_private_swap_order must be an object when provided.")
|
|
5670
|
-
execute_preview = None
|
|
5671
|
-
if isinstance(approval_summary_copy.get("_preview_digest"), str):
|
|
5672
|
-
if not isinstance(approved_preview, dict):
|
|
5673
|
-
raise WalletBackendError(
|
|
5674
|
-
"Approved private swap preview payload is required for execute mode. Generate a new preview and approval before execute."
|
|
5675
|
-
)
|
|
5676
|
-
if preview_payload_digest(approved_preview) != approval_summary_copy["_preview_digest"]:
|
|
5677
|
-
raise WalletBackendError(
|
|
5678
|
-
"approved preview payload does not match the approval token. Generate a new preview and approval before execute."
|
|
5679
|
-
)
|
|
5680
|
-
execute_preview = dict(approved_preview)
|
|
5681
|
-
|
|
5682
|
-
self._require_execute_approval(
|
|
5683
|
-
approval_token=approval_token,
|
|
5684
|
-
tool_name=tool_name,
|
|
5685
|
-
summary=approval_summary_copy,
|
|
5686
|
-
action_label="Solana private swap",
|
|
5687
|
-
)
|
|
5688
|
-
|
|
5689
|
-
result = await self.backend.execute_solana_private_swap(
|
|
5690
|
-
**preview_kwargs,
|
|
5691
|
-
approved_preview=execute_preview,
|
|
5692
|
-
existing_order=resume_private_swap_order,
|
|
5693
|
-
)
|
|
5694
|
-
return AgentToolResult(
|
|
5695
|
-
tool=tool_name,
|
|
5696
|
-
ok=True,
|
|
5697
|
-
data=self._annotate_sensitive_payload(
|
|
5698
|
-
result,
|
|
5699
|
-
action_label="Solana private swap",
|
|
5700
|
-
mode="execute",
|
|
5701
|
-
),
|
|
5702
|
-
)
|
|
5703
|
-
|
|
5704
|
-
if tool_name == "continue_solana_private_swap":
|
|
5705
|
-
approval_token = args.get("approval_token")
|
|
5706
|
-
approved_preview = args.get("_approved_preview")
|
|
5707
|
-
resume_private_swap_order = args.get("_resume_private_swap_order")
|
|
5708
|
-
if not isinstance(approved_preview, dict):
|
|
5709
|
-
raise WalletBackendError(
|
|
5710
|
-
"Approved private swap preview payload is required. Create the private swap order first."
|
|
5711
|
-
)
|
|
5712
|
-
if not isinstance(resume_private_swap_order, dict) or not resume_private_swap_order:
|
|
5713
|
-
raise WalletBackendError(
|
|
5714
|
-
"A pending Houdini private swap order is required. Create the private swap order first."
|
|
5715
|
-
)
|
|
5716
|
-
|
|
5717
|
-
approval_payload = inspect_approval_token(
|
|
5718
|
-
approval_token,
|
|
5719
|
-
tool_name="swap_solana_privately",
|
|
5720
|
-
network=str(getattr(self.backend, "network", "unknown")),
|
|
5721
|
-
require_mainnet_confirmation=self._is_mainnet_for_backend(self.backend),
|
|
5722
|
-
)
|
|
5723
|
-
approval_summary = approval_payload.get("binding", {}).get("summary")
|
|
5724
|
-
if not isinstance(approval_summary, dict):
|
|
5725
|
-
raise WalletBackendError(
|
|
5726
|
-
"approval_token does not match the requested private swap. Generate a new approval from the preview first."
|
|
5727
|
-
)
|
|
5728
|
-
|
|
5729
|
-
approval_summary_copy = dict(approval_summary)
|
|
5730
|
-
if isinstance(approval_summary_copy.get("_preview_digest"), str):
|
|
5731
|
-
if preview_payload_digest(approved_preview) != approval_summary_copy["_preview_digest"]:
|
|
5732
|
-
raise WalletBackendError(
|
|
5733
|
-
"approved preview payload does not match the approval token. Generate a new preview and approval before continue."
|
|
5734
|
-
)
|
|
5735
|
-
self._require_execute_approval(
|
|
5736
|
-
approval_token=approval_token,
|
|
5737
|
-
tool_name="swap_solana_privately",
|
|
5738
|
-
summary=approval_summary_copy,
|
|
5739
|
-
action_label="Solana private swap",
|
|
5740
|
-
)
|
|
5741
|
-
|
|
5742
|
-
result = await self.backend.continue_solana_private_swap(
|
|
5743
|
-
approved_preview=approved_preview,
|
|
5744
|
-
existing_order=resume_private_swap_order,
|
|
5745
|
-
)
|
|
5746
|
-
return AgentToolResult(
|
|
5747
|
-
tool=tool_name,
|
|
5748
|
-
ok=True,
|
|
5749
|
-
data=self._annotate_sensitive_payload(
|
|
5750
|
-
result,
|
|
5751
|
-
action_label="Solana private swap funding",
|
|
5752
|
-
mode="execute",
|
|
5753
|
-
),
|
|
5754
|
-
)
|
|
5755
|
-
|
|
5756
|
-
if tool_name == "get_solana_private_swap_status":
|
|
5757
|
-
multi_id = args.get("multi_id")
|
|
5758
|
-
houdini_id = args.get("houdini_id")
|
|
5759
|
-
if multi_id is not None and not isinstance(multi_id, str):
|
|
5760
|
-
raise WalletBackendError("multi_id must be a string when provided.")
|
|
5761
|
-
if houdini_id is not None and not isinstance(houdini_id, str):
|
|
5762
|
-
raise WalletBackendError("houdini_id must be a string when provided.")
|
|
5763
|
-
normalized_multi_id = multi_id.strip() if isinstance(multi_id, str) and multi_id.strip() else None
|
|
5764
|
-
normalized_houdini_id = (
|
|
5765
|
-
houdini_id.strip() if isinstance(houdini_id, str) and houdini_id.strip() else None
|
|
5766
|
-
)
|
|
5767
|
-
if normalized_multi_id is None and normalized_houdini_id is None:
|
|
5768
|
-
raise WalletBackendError("multi_id or houdini_id is required.")
|
|
5769
|
-
data = await self.backend.get_solana_private_swap_status(
|
|
5770
|
-
multi_id=normalized_multi_id,
|
|
5771
|
-
houdini_id=normalized_houdini_id,
|
|
5772
|
-
)
|
|
5773
|
-
return AgentToolResult(tool=tool_name, ok=True, data=data)
|
|
5774
|
-
|
|
5775
5277
|
if tool_name == "swap_solana_lifi_cross_chain_tokens":
|
|
5776
5278
|
input_token = args.get("input_token")
|
|
5777
5279
|
destination_chain = args.get("destination_chain")
|
|
@@ -6111,162 +5613,6 @@ class OpenClawWalletAdapter:
|
|
|
6111
5613
|
),
|
|
6112
5614
|
)
|
|
6113
5615
|
|
|
6114
|
-
if tool_name == "jupiter_earn_deposit":
|
|
6115
|
-
asset = args.get("asset")
|
|
6116
|
-
amount_raw = args.get("amount_raw")
|
|
6117
|
-
mode = args.get("mode")
|
|
6118
|
-
purpose = args.get("purpose")
|
|
6119
|
-
user_intent = args.get("user_intent", False)
|
|
6120
|
-
approval_token = args.get("approval_token")
|
|
6121
|
-
|
|
6122
|
-
if not isinstance(asset, str) or not asset.strip():
|
|
6123
|
-
raise WalletBackendError("asset is required.")
|
|
6124
|
-
if not isinstance(amount_raw, str) or not amount_raw.strip():
|
|
6125
|
-
raise WalletBackendError("amount_raw is required.")
|
|
6126
|
-
if mode not in {"preview", "prepare", "execute"}:
|
|
6127
|
-
raise WalletBackendError("mode must be 'preview', 'prepare' or 'execute'.")
|
|
6128
|
-
if not isinstance(purpose, str) or not purpose.strip():
|
|
6129
|
-
raise WalletBackendError("purpose is required.")
|
|
6130
|
-
|
|
6131
|
-
if mode == "preview":
|
|
6132
|
-
preview = await self.backend.preview_jupiter_earn_deposit(
|
|
6133
|
-
asset=asset.strip(),
|
|
6134
|
-
amount_raw=amount_raw.strip(),
|
|
6135
|
-
)
|
|
6136
|
-
return AgentToolResult(
|
|
6137
|
-
tool=tool_name,
|
|
6138
|
-
ok=True,
|
|
6139
|
-
data=self._annotate_sensitive_payload(
|
|
6140
|
-
preview,
|
|
6141
|
-
action_label="Jupiter Earn deposit",
|
|
6142
|
-
mode="preview",
|
|
6143
|
-
),
|
|
6144
|
-
)
|
|
6145
|
-
|
|
6146
|
-
if mode == "prepare":
|
|
6147
|
-
self._require_prepare_intent(user_intent)
|
|
6148
|
-
preview = await self.backend.preview_jupiter_earn_deposit(
|
|
6149
|
-
asset=asset.strip(),
|
|
6150
|
-
amount_raw=amount_raw.strip(),
|
|
6151
|
-
)
|
|
6152
|
-
return AgentToolResult(
|
|
6153
|
-
tool=tool_name,
|
|
6154
|
-
ok=True,
|
|
6155
|
-
data=self._annotate_sensitive_payload(
|
|
6156
|
-
self._build_prepare_plan(
|
|
6157
|
-
preview_payload=preview,
|
|
6158
|
-
action_label="Jupiter Earn deposit",
|
|
6159
|
-
),
|
|
6160
|
-
action_label="Jupiter Earn deposit",
|
|
6161
|
-
mode="prepare",
|
|
6162
|
-
),
|
|
6163
|
-
)
|
|
6164
|
-
|
|
6165
|
-
execute_preview = await self.backend.preview_jupiter_earn_deposit(
|
|
6166
|
-
asset=asset.strip(),
|
|
6167
|
-
amount_raw=amount_raw.strip(),
|
|
6168
|
-
)
|
|
6169
|
-
self._require_execute_approval(
|
|
6170
|
-
approval_token=approval_token,
|
|
6171
|
-
tool_name=tool_name,
|
|
6172
|
-
summary=self._build_confirmation_summary(
|
|
6173
|
-
action_label="Jupiter Earn deposit",
|
|
6174
|
-
payload=execute_preview,
|
|
6175
|
-
),
|
|
6176
|
-
action_label="Jupiter Earn deposit",
|
|
6177
|
-
)
|
|
6178
|
-
result = await self.backend.execute_jupiter_earn_deposit(
|
|
6179
|
-
asset=asset.strip(),
|
|
6180
|
-
amount_raw=amount_raw.strip(),
|
|
6181
|
-
)
|
|
6182
|
-
return AgentToolResult(
|
|
6183
|
-
tool=tool_name,
|
|
6184
|
-
ok=True,
|
|
6185
|
-
data=self._annotate_sensitive_payload(
|
|
6186
|
-
result,
|
|
6187
|
-
action_label="Jupiter Earn deposit",
|
|
6188
|
-
mode="execute",
|
|
6189
|
-
),
|
|
6190
|
-
)
|
|
6191
|
-
|
|
6192
|
-
if tool_name == "jupiter_earn_withdraw":
|
|
6193
|
-
asset = args.get("asset")
|
|
6194
|
-
amount_raw = args.get("amount_raw")
|
|
6195
|
-
mode = args.get("mode")
|
|
6196
|
-
purpose = args.get("purpose")
|
|
6197
|
-
user_intent = args.get("user_intent", False)
|
|
6198
|
-
approval_token = args.get("approval_token")
|
|
6199
|
-
|
|
6200
|
-
if not isinstance(asset, str) or not asset.strip():
|
|
6201
|
-
raise WalletBackendError("asset is required.")
|
|
6202
|
-
if not isinstance(amount_raw, str) or not amount_raw.strip():
|
|
6203
|
-
raise WalletBackendError("amount_raw is required.")
|
|
6204
|
-
if mode not in {"preview", "prepare", "execute"}:
|
|
6205
|
-
raise WalletBackendError("mode must be 'preview', 'prepare' or 'execute'.")
|
|
6206
|
-
if not isinstance(purpose, str) or not purpose.strip():
|
|
6207
|
-
raise WalletBackendError("purpose is required.")
|
|
6208
|
-
|
|
6209
|
-
if mode == "preview":
|
|
6210
|
-
preview = await self.backend.preview_jupiter_earn_withdraw(
|
|
6211
|
-
asset=asset.strip(),
|
|
6212
|
-
amount_raw=amount_raw.strip(),
|
|
6213
|
-
)
|
|
6214
|
-
return AgentToolResult(
|
|
6215
|
-
tool=tool_name,
|
|
6216
|
-
ok=True,
|
|
6217
|
-
data=self._annotate_sensitive_payload(
|
|
6218
|
-
preview,
|
|
6219
|
-
action_label="Jupiter Earn withdraw",
|
|
6220
|
-
mode="preview",
|
|
6221
|
-
),
|
|
6222
|
-
)
|
|
6223
|
-
|
|
6224
|
-
if mode == "prepare":
|
|
6225
|
-
self._require_prepare_intent(user_intent)
|
|
6226
|
-
preview = await self.backend.preview_jupiter_earn_withdraw(
|
|
6227
|
-
asset=asset.strip(),
|
|
6228
|
-
amount_raw=amount_raw.strip(),
|
|
6229
|
-
)
|
|
6230
|
-
return AgentToolResult(
|
|
6231
|
-
tool=tool_name,
|
|
6232
|
-
ok=True,
|
|
6233
|
-
data=self._annotate_sensitive_payload(
|
|
6234
|
-
self._build_prepare_plan(
|
|
6235
|
-
preview_payload=preview,
|
|
6236
|
-
action_label="Jupiter Earn withdraw",
|
|
6237
|
-
),
|
|
6238
|
-
action_label="Jupiter Earn withdraw",
|
|
6239
|
-
mode="prepare",
|
|
6240
|
-
),
|
|
6241
|
-
)
|
|
6242
|
-
|
|
6243
|
-
execute_preview = await self.backend.preview_jupiter_earn_withdraw(
|
|
6244
|
-
asset=asset.strip(),
|
|
6245
|
-
amount_raw=amount_raw.strip(),
|
|
6246
|
-
)
|
|
6247
|
-
self._require_execute_approval(
|
|
6248
|
-
approval_token=approval_token,
|
|
6249
|
-
tool_name=tool_name,
|
|
6250
|
-
summary=self._build_confirmation_summary(
|
|
6251
|
-
action_label="Jupiter Earn withdraw",
|
|
6252
|
-
payload=execute_preview,
|
|
6253
|
-
),
|
|
6254
|
-
action_label="Jupiter Earn withdraw",
|
|
6255
|
-
)
|
|
6256
|
-
result = await self.backend.execute_jupiter_earn_withdraw(
|
|
6257
|
-
asset=asset.strip(),
|
|
6258
|
-
amount_raw=amount_raw.strip(),
|
|
6259
|
-
)
|
|
6260
|
-
return AgentToolResult(
|
|
6261
|
-
tool=tool_name,
|
|
6262
|
-
ok=True,
|
|
6263
|
-
data=self._annotate_sensitive_payload(
|
|
6264
|
-
result,
|
|
6265
|
-
action_label="Jupiter Earn withdraw",
|
|
6266
|
-
mode="execute",
|
|
6267
|
-
),
|
|
6268
|
-
)
|
|
6269
|
-
|
|
6270
5616
|
if tool_name == "close_empty_token_accounts":
|
|
6271
5617
|
limit = args.get("limit", 8)
|
|
6272
5618
|
mode = args.get("mode")
|