@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
|
@@ -406,230 +406,6 @@ def verify_provider_swap_simulation_result(
|
|
|
406
406
|
}
|
|
407
407
|
|
|
408
408
|
|
|
409
|
-
def verify_provider_houdini_transaction(
|
|
410
|
-
message: Any,
|
|
411
|
-
*,
|
|
412
|
-
wallet_address: str,
|
|
413
|
-
deposit_address: str,
|
|
414
|
-
amount_raw: int,
|
|
415
|
-
is_native_input: bool,
|
|
416
|
-
token_mint: str | None = None,
|
|
417
|
-
loaded_addresses: list[str] | None = None,
|
|
418
|
-
) -> dict[str, Any]:
|
|
419
|
-
binding = _assert_basic_wallet_binding(
|
|
420
|
-
message,
|
|
421
|
-
wallet_address=wallet_address,
|
|
422
|
-
loaded_addresses=loaded_addresses,
|
|
423
|
-
)
|
|
424
|
-
keys = binding["account_keys"]
|
|
425
|
-
program_ids = _program_ids(message, loaded_addresses)
|
|
426
|
-
unknown_program_ids = _assert_program_allowlist(
|
|
427
|
-
program_ids,
|
|
428
|
-
allowed_programs=CORE_PROGRAM_IDS,
|
|
429
|
-
label="Houdini private swap funding",
|
|
430
|
-
reject_unknown=False,
|
|
431
|
-
)
|
|
432
|
-
|
|
433
|
-
matched_native_lamports = 0
|
|
434
|
-
matched_token_amount = 0
|
|
435
|
-
parsed_transfers: list[dict[str, Any]] = []
|
|
436
|
-
|
|
437
|
-
for instruction in _compiled_instructions(message):
|
|
438
|
-
instruction_accounts = _instruction_account_keys(
|
|
439
|
-
message,
|
|
440
|
-
instruction,
|
|
441
|
-
loaded_addresses=loaded_addresses,
|
|
442
|
-
)
|
|
443
|
-
data = _instruction_data_bytes(instruction)
|
|
444
|
-
program_id_index = int(getattr(instruction, "program_id_index", -1))
|
|
445
|
-
if program_id_index < 0 or program_id_index >= len(keys):
|
|
446
|
-
raise WalletBackendError("Provider transaction contains an invalid program id index.")
|
|
447
|
-
program_id = _account_keys(message, loaded_addresses)[program_id_index]
|
|
448
|
-
|
|
449
|
-
if (
|
|
450
|
-
is_native_input
|
|
451
|
-
and program_id == SYSTEM_PROGRAM_ID
|
|
452
|
-
and len(data) >= 12
|
|
453
|
-
and len(instruction_accounts) >= 2
|
|
454
|
-
):
|
|
455
|
-
instruction_type = struct.unpack_from("<I", data, 0)[0]
|
|
456
|
-
if instruction_type == 2:
|
|
457
|
-
lamports = struct.unpack_from("<Q", data, 4)[0]
|
|
458
|
-
recipient = instruction_accounts[1]
|
|
459
|
-
parsed_transfers.append(
|
|
460
|
-
{
|
|
461
|
-
"program_id": program_id,
|
|
462
|
-
"recipient": recipient,
|
|
463
|
-
"amount_raw": str(lamports),
|
|
464
|
-
"kind": "system-transfer",
|
|
465
|
-
}
|
|
466
|
-
)
|
|
467
|
-
if recipient == deposit_address:
|
|
468
|
-
matched_native_lamports += lamports
|
|
469
|
-
continue
|
|
470
|
-
|
|
471
|
-
if program_id not in {TOKEN_PROGRAM_ID, TOKEN_2022_PROGRAM_ID} or len(instruction_accounts) < 2:
|
|
472
|
-
continue
|
|
473
|
-
|
|
474
|
-
if not data:
|
|
475
|
-
continue
|
|
476
|
-
instruction_tag = data[0]
|
|
477
|
-
if instruction_tag == 3 and len(data) >= 9 and len(instruction_accounts) >= 2:
|
|
478
|
-
token_amount = struct.unpack_from("<Q", data, 1)[0]
|
|
479
|
-
recipient = instruction_accounts[1]
|
|
480
|
-
parsed_transfers.append(
|
|
481
|
-
{
|
|
482
|
-
"program_id": program_id,
|
|
483
|
-
"recipient": recipient,
|
|
484
|
-
"amount_raw": str(token_amount),
|
|
485
|
-
"kind": "spl-transfer",
|
|
486
|
-
"mint": None,
|
|
487
|
-
}
|
|
488
|
-
)
|
|
489
|
-
if not is_native_input and recipient == deposit_address:
|
|
490
|
-
matched_token_amount += token_amount
|
|
491
|
-
continue
|
|
492
|
-
|
|
493
|
-
if instruction_tag == 12 and len(data) >= 10 and len(instruction_accounts) >= 3:
|
|
494
|
-
token_amount = struct.unpack_from("<Q", data, 1)[0]
|
|
495
|
-
mint = instruction_accounts[1]
|
|
496
|
-
recipient = instruction_accounts[2]
|
|
497
|
-
parsed_transfers.append(
|
|
498
|
-
{
|
|
499
|
-
"program_id": program_id,
|
|
500
|
-
"recipient": recipient,
|
|
501
|
-
"amount_raw": str(token_amount),
|
|
502
|
-
"kind": "spl-transfer-checked",
|
|
503
|
-
"mint": mint,
|
|
504
|
-
}
|
|
505
|
-
)
|
|
506
|
-
if (
|
|
507
|
-
not is_native_input
|
|
508
|
-
and recipient == deposit_address
|
|
509
|
-
and (token_mint is None or mint == token_mint)
|
|
510
|
-
):
|
|
511
|
-
matched_token_amount += token_amount
|
|
512
|
-
|
|
513
|
-
if is_native_input:
|
|
514
|
-
if matched_native_lamports != amount_raw:
|
|
515
|
-
raise WalletBackendError(
|
|
516
|
-
"Houdini funding transaction does not transfer the approved native SOL amount to the expected deposit address."
|
|
517
|
-
)
|
|
518
|
-
else:
|
|
519
|
-
if matched_token_amount != amount_raw:
|
|
520
|
-
raise WalletBackendError(
|
|
521
|
-
"Houdini funding transaction does not transfer the approved SPL token amount to the expected deposit address."
|
|
522
|
-
)
|
|
523
|
-
|
|
524
|
-
return {
|
|
525
|
-
"wallet_address": wallet_address,
|
|
526
|
-
"fee_payer": binding["fee_payer"],
|
|
527
|
-
"required_signer_keys": binding["required_signer_keys"],
|
|
528
|
-
"required_signature_count": binding["required_signature_count"],
|
|
529
|
-
"wallet_signer_index": binding["wallet_signer_index"],
|
|
530
|
-
"sponsored_fee_payer": binding["sponsored_fee_payer"],
|
|
531
|
-
"program_ids": program_ids,
|
|
532
|
-
"unknown_program_ids": unknown_program_ids,
|
|
533
|
-
"non_core_program_ids": [pid for pid in program_ids if pid not in CORE_PROGRAM_IDS],
|
|
534
|
-
"account_key_count": len(keys),
|
|
535
|
-
"instruction_count": len(_compiled_instructions(message)),
|
|
536
|
-
"deposit_address": deposit_address,
|
|
537
|
-
"amount_raw": str(amount_raw),
|
|
538
|
-
"is_native_input": is_native_input,
|
|
539
|
-
"token_mint": token_mint,
|
|
540
|
-
"parsed_transfers": parsed_transfers,
|
|
541
|
-
"verified": True,
|
|
542
|
-
}
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
def verify_provider_houdini_simulation_result(
|
|
546
|
-
simulation_value: dict[str, Any],
|
|
547
|
-
*,
|
|
548
|
-
wallet_address: str,
|
|
549
|
-
wallet_account_index: int | None,
|
|
550
|
-
is_native_input: bool,
|
|
551
|
-
token_mint: str | None,
|
|
552
|
-
amount_raw: int,
|
|
553
|
-
native_sol_extra_spend_allowance_lamports: int = (
|
|
554
|
-
DEFAULT_NATIVE_SOL_EXTRA_SPEND_ALLOWANCE_LAMPORTS
|
|
555
|
-
),
|
|
556
|
-
) -> dict[str, Any]:
|
|
557
|
-
if not isinstance(simulation_value, dict):
|
|
558
|
-
raise WalletBackendError(
|
|
559
|
-
"Houdini funding transaction simulation returned an unexpected payload.",
|
|
560
|
-
code="transaction_simulation_invalid",
|
|
561
|
-
)
|
|
562
|
-
|
|
563
|
-
if simulation_value.get("err") is not None:
|
|
564
|
-
raise WalletBackendError(
|
|
565
|
-
"Houdini funding transaction simulation failed.",
|
|
566
|
-
code="transaction_simulation_failed",
|
|
567
|
-
details={"simulation": simulation_value},
|
|
568
|
-
)
|
|
569
|
-
|
|
570
|
-
token_deltas = _wallet_token_deltas_by_mint(
|
|
571
|
-
simulation_value,
|
|
572
|
-
wallet_address=wallet_address,
|
|
573
|
-
)
|
|
574
|
-
native_delta = _native_lamport_delta(
|
|
575
|
-
simulation_value,
|
|
576
|
-
wallet_account_index=wallet_account_index,
|
|
577
|
-
)
|
|
578
|
-
warnings: list[str] = []
|
|
579
|
-
enforced_checks: list[str] = ["simulation_err_is_none"]
|
|
580
|
-
|
|
581
|
-
if is_native_input:
|
|
582
|
-
if native_delta is None:
|
|
583
|
-
warnings.append("native_input_delta_unavailable")
|
|
584
|
-
else:
|
|
585
|
-
max_spend = max(amount_raw, 0) + max(native_sol_extra_spend_allowance_lamports, 0)
|
|
586
|
-
if -native_delta > max_spend:
|
|
587
|
-
raise WalletBackendError(
|
|
588
|
-
"Houdini funding transaction simulation spends more native SOL than approved.",
|
|
589
|
-
code="houdini_simulation_overspend",
|
|
590
|
-
details={
|
|
591
|
-
"approved_input_amount_raw": str(amount_raw),
|
|
592
|
-
"native_delta_lamports": str(native_delta),
|
|
593
|
-
"allowed_extra_lamports": str(
|
|
594
|
-
native_sol_extra_spend_allowance_lamports
|
|
595
|
-
),
|
|
596
|
-
},
|
|
597
|
-
)
|
|
598
|
-
enforced_checks.append("native_input_spend_within_approved_amount")
|
|
599
|
-
else:
|
|
600
|
-
if not token_mint:
|
|
601
|
-
raise WalletBackendError("token_mint is required for SPL Houdini simulation checks.")
|
|
602
|
-
input_delta = token_deltas.get(token_mint)
|
|
603
|
-
if input_delta is None:
|
|
604
|
-
warnings.append("token_input_delta_unavailable")
|
|
605
|
-
elif -input_delta > amount_raw:
|
|
606
|
-
raise WalletBackendError(
|
|
607
|
-
"Houdini funding transaction simulation spends more SPL token than approved.",
|
|
608
|
-
code="houdini_simulation_overspend",
|
|
609
|
-
details={
|
|
610
|
-
"token_mint": token_mint,
|
|
611
|
-
"approved_input_amount_raw": str(amount_raw),
|
|
612
|
-
"input_delta_raw": str(input_delta),
|
|
613
|
-
},
|
|
614
|
-
)
|
|
615
|
-
else:
|
|
616
|
-
enforced_checks.append("token_input_spend_within_approved_amount")
|
|
617
|
-
|
|
618
|
-
return {
|
|
619
|
-
"verified": True,
|
|
620
|
-
"simulation_err": None,
|
|
621
|
-
"wallet_address": wallet_address,
|
|
622
|
-
"wallet_account_index": wallet_account_index,
|
|
623
|
-
"token_mint": token_mint,
|
|
624
|
-
"amount_raw": str(amount_raw),
|
|
625
|
-
"is_native_input": is_native_input,
|
|
626
|
-
"token_deltas": {mint: str(delta) for mint, delta in sorted(token_deltas.items())},
|
|
627
|
-
"native_delta_lamports": str(native_delta) if native_delta is not None else None,
|
|
628
|
-
"enforced_checks": enforced_checks,
|
|
629
|
-
"warnings": warnings,
|
|
630
|
-
}
|
|
631
|
-
|
|
632
|
-
|
|
633
409
|
def verify_provider_bags_transaction(
|
|
634
410
|
message: Any,
|
|
635
411
|
*,
|
|
@@ -673,44 +449,6 @@ def verify_provider_bags_transaction(
|
|
|
673
449
|
}
|
|
674
450
|
|
|
675
451
|
|
|
676
|
-
def verify_provider_lend_transaction(
|
|
677
|
-
message: Any,
|
|
678
|
-
*,
|
|
679
|
-
wallet_address: str,
|
|
680
|
-
asset_mint: str,
|
|
681
|
-
action: str,
|
|
682
|
-
) -> dict[str, Any]:
|
|
683
|
-
binding = _assert_basic_wallet_binding(message, wallet_address=wallet_address)
|
|
684
|
-
keys = binding["account_keys"]
|
|
685
|
-
if asset_mint not in keys:
|
|
686
|
-
raise WalletBackendError(
|
|
687
|
-
f"{action} transaction does not reference the expected asset mint."
|
|
688
|
-
)
|
|
689
|
-
program_ids = _program_ids(message)
|
|
690
|
-
unknown_program_ids = _assert_program_allowlist(
|
|
691
|
-
program_ids,
|
|
692
|
-
allowed_programs=CORE_PROGRAM_IDS,
|
|
693
|
-
label=action,
|
|
694
|
-
reject_unknown=False,
|
|
695
|
-
)
|
|
696
|
-
return {
|
|
697
|
-
"wallet_address": wallet_address,
|
|
698
|
-
"fee_payer": binding["fee_payer"],
|
|
699
|
-
"required_signer_keys": binding["required_signer_keys"],
|
|
700
|
-
"required_signature_count": binding["required_signature_count"],
|
|
701
|
-
"wallet_signer_index": binding["wallet_signer_index"],
|
|
702
|
-
"sponsored_fee_payer": binding["sponsored_fee_payer"],
|
|
703
|
-
"program_ids": program_ids,
|
|
704
|
-
"unknown_program_ids": unknown_program_ids,
|
|
705
|
-
"non_core_program_ids": [pid for pid in program_ids if pid not in CORE_PROGRAM_IDS],
|
|
706
|
-
"account_key_count": len(keys),
|
|
707
|
-
"instruction_count": len(_compiled_instructions(message)),
|
|
708
|
-
"asset_mint": asset_mint,
|
|
709
|
-
"action": action,
|
|
710
|
-
"verified": True,
|
|
711
|
-
}
|
|
712
|
-
|
|
713
|
-
|
|
714
452
|
def verify_provider_kamino_lend_transaction(
|
|
715
453
|
message: Any,
|
|
716
454
|
*,
|
|
@@ -328,46 +328,6 @@ class AgentWalletBackend(ABC):
|
|
|
328
328
|
) -> dict[str, Any]:
|
|
329
329
|
raise WalletBackendError(f"{self.name} does not support Solana-origin LI.FI swap previews.")
|
|
330
330
|
|
|
331
|
-
async def preview_solana_private_swap(
|
|
332
|
-
self,
|
|
333
|
-
*,
|
|
334
|
-
input_token: str,
|
|
335
|
-
output_token: str,
|
|
336
|
-
destination_address: str,
|
|
337
|
-
amount_ui: float,
|
|
338
|
-
use_xmr: bool = False,
|
|
339
|
-
) -> dict[str, Any]:
|
|
340
|
-
raise WalletBackendError(f"{self.name} does not support Solana private swap previews.")
|
|
341
|
-
|
|
342
|
-
async def execute_solana_private_swap(
|
|
343
|
-
self,
|
|
344
|
-
*,
|
|
345
|
-
input_token: str,
|
|
346
|
-
output_token: str,
|
|
347
|
-
destination_address: str,
|
|
348
|
-
amount_ui: float,
|
|
349
|
-
use_xmr: bool = False,
|
|
350
|
-
approved_preview: dict[str, Any] | None = None,
|
|
351
|
-
existing_order: dict[str, Any] | None = None,
|
|
352
|
-
) -> dict[str, Any]:
|
|
353
|
-
raise WalletBackendError(f"{self.name} does not support Solana private swaps.")
|
|
354
|
-
|
|
355
|
-
async def get_solana_private_swap_status(
|
|
356
|
-
self,
|
|
357
|
-
*,
|
|
358
|
-
multi_id: str | None = None,
|
|
359
|
-
houdini_id: str | None = None,
|
|
360
|
-
) -> dict[str, Any]:
|
|
361
|
-
raise WalletBackendError(f"{self.name} does not support Solana private swap status lookup.")
|
|
362
|
-
|
|
363
|
-
async def continue_solana_private_swap(
|
|
364
|
-
self,
|
|
365
|
-
*,
|
|
366
|
-
approved_preview: dict[str, Any],
|
|
367
|
-
existing_order: dict[str, Any],
|
|
368
|
-
) -> dict[str, Any]:
|
|
369
|
-
raise WalletBackendError(f"{self.name} does not support continuing Solana private swaps.")
|
|
370
|
-
|
|
371
331
|
async def execute_solana_lifi_cross_chain_swap(
|
|
372
332
|
self,
|
|
373
333
|
*,
|
|
@@ -410,22 +370,6 @@ class AgentWalletBackend(ABC):
|
|
|
410
370
|
async def get_jupiter_staked_jup(self, address: str | None = None) -> dict[str, Any]:
|
|
411
371
|
raise WalletBackendError(f"{self.name} does not support Jupiter staked JUP lookup.")
|
|
412
372
|
|
|
413
|
-
async def get_jupiter_earn_tokens(self) -> dict[str, Any]:
|
|
414
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn token lookup.")
|
|
415
|
-
|
|
416
|
-
async def get_jupiter_earn_positions(
|
|
417
|
-
self,
|
|
418
|
-
users: list[str] | None = None,
|
|
419
|
-
) -> dict[str, Any]:
|
|
420
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn positions.")
|
|
421
|
-
|
|
422
|
-
async def get_jupiter_earn_earnings(
|
|
423
|
-
self,
|
|
424
|
-
user: str | None = None,
|
|
425
|
-
positions: list[str] | None = None,
|
|
426
|
-
) -> dict[str, Any]:
|
|
427
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn earnings.")
|
|
428
|
-
|
|
429
373
|
async def get_flash_trade_markets(
|
|
430
374
|
self,
|
|
431
375
|
pool_name: str | None = None,
|
|
@@ -639,50 +583,6 @@ class AgentWalletBackend(ABC):
|
|
|
639
583
|
) -> dict[str, Any]:
|
|
640
584
|
raise WalletBackendError(f"{self.name} does not support Kamino repays.")
|
|
641
585
|
|
|
642
|
-
async def preview_jupiter_earn_deposit(
|
|
643
|
-
self,
|
|
644
|
-
asset: str,
|
|
645
|
-
amount_raw: str,
|
|
646
|
-
) -> dict[str, Any]:
|
|
647
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn deposit previews.")
|
|
648
|
-
|
|
649
|
-
async def prepare_jupiter_earn_deposit(
|
|
650
|
-
self,
|
|
651
|
-
asset: str,
|
|
652
|
-
amount_raw: str,
|
|
653
|
-
) -> dict[str, Any]:
|
|
654
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn deposit preparation.")
|
|
655
|
-
|
|
656
|
-
async def execute_jupiter_earn_deposit(
|
|
657
|
-
self,
|
|
658
|
-
asset: str,
|
|
659
|
-
amount_raw: str,
|
|
660
|
-
) -> dict[str, Any]:
|
|
661
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn deposits.")
|
|
662
|
-
|
|
663
|
-
async def preview_jupiter_earn_withdraw(
|
|
664
|
-
self,
|
|
665
|
-
asset: str,
|
|
666
|
-
amount_raw: str,
|
|
667
|
-
) -> dict[str, Any]:
|
|
668
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn withdraw previews.")
|
|
669
|
-
|
|
670
|
-
async def prepare_jupiter_earn_withdraw(
|
|
671
|
-
self,
|
|
672
|
-
asset: str,
|
|
673
|
-
amount_raw: str,
|
|
674
|
-
) -> dict[str, Any]:
|
|
675
|
-
raise WalletBackendError(
|
|
676
|
-
f"{self.name} does not support Jupiter Earn withdraw preparation."
|
|
677
|
-
)
|
|
678
|
-
|
|
679
|
-
async def execute_jupiter_earn_withdraw(
|
|
680
|
-
self,
|
|
681
|
-
asset: str,
|
|
682
|
-
amount_raw: str,
|
|
683
|
-
) -> dict[str, Any]:
|
|
684
|
-
raise WalletBackendError(f"{self.name} does not support Jupiter Earn withdrawals.")
|
|
685
|
-
|
|
686
586
|
async def preview_close_empty_token_accounts(
|
|
687
587
|
self,
|
|
688
588
|
limit: int = 8,
|