wayfinder-paths 0.1.1__py3-none-any.whl

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.

Potentially problematic release.


This version of wayfinder-paths might be problematic. Click here for more details.

Files changed (115) hide show
  1. wayfinder_paths/CONFIG_GUIDE.md +394 -0
  2. wayfinder_paths/__init__.py +21 -0
  3. wayfinder_paths/config.example.json +20 -0
  4. wayfinder_paths/conftest.py +31 -0
  5. wayfinder_paths/core/__init__.py +13 -0
  6. wayfinder_paths/core/adapters/BaseAdapter.py +48 -0
  7. wayfinder_paths/core/adapters/__init__.py +5 -0
  8. wayfinder_paths/core/adapters/base.py +5 -0
  9. wayfinder_paths/core/clients/AuthClient.py +83 -0
  10. wayfinder_paths/core/clients/BRAPClient.py +90 -0
  11. wayfinder_paths/core/clients/ClientManager.py +231 -0
  12. wayfinder_paths/core/clients/HyperlendClient.py +151 -0
  13. wayfinder_paths/core/clients/LedgerClient.py +222 -0
  14. wayfinder_paths/core/clients/PoolClient.py +96 -0
  15. wayfinder_paths/core/clients/SimulationClient.py +180 -0
  16. wayfinder_paths/core/clients/TokenClient.py +73 -0
  17. wayfinder_paths/core/clients/TransactionClient.py +47 -0
  18. wayfinder_paths/core/clients/WalletClient.py +90 -0
  19. wayfinder_paths/core/clients/WayfinderClient.py +258 -0
  20. wayfinder_paths/core/clients/__init__.py +48 -0
  21. wayfinder_paths/core/clients/protocols.py +295 -0
  22. wayfinder_paths/core/clients/sdk_example.py +115 -0
  23. wayfinder_paths/core/config.py +369 -0
  24. wayfinder_paths/core/constants/__init__.py +26 -0
  25. wayfinder_paths/core/constants/base.py +25 -0
  26. wayfinder_paths/core/constants/erc20_abi.py +118 -0
  27. wayfinder_paths/core/constants/hyperlend_abi.py +152 -0
  28. wayfinder_paths/core/engine/VaultJob.py +182 -0
  29. wayfinder_paths/core/engine/__init__.py +5 -0
  30. wayfinder_paths/core/engine/manifest.py +97 -0
  31. wayfinder_paths/core/services/__init__.py +0 -0
  32. wayfinder_paths/core/services/base.py +177 -0
  33. wayfinder_paths/core/services/local_evm_txn.py +429 -0
  34. wayfinder_paths/core/services/local_token_txn.py +231 -0
  35. wayfinder_paths/core/services/web3_service.py +45 -0
  36. wayfinder_paths/core/settings.py +61 -0
  37. wayfinder_paths/core/strategies/Strategy.py +183 -0
  38. wayfinder_paths/core/strategies/__init__.py +5 -0
  39. wayfinder_paths/core/strategies/base.py +7 -0
  40. wayfinder_paths/core/utils/__init__.py +1 -0
  41. wayfinder_paths/core/utils/evm_helpers.py +165 -0
  42. wayfinder_paths/core/utils/wallets.py +77 -0
  43. wayfinder_paths/core/wallets/README.md +91 -0
  44. wayfinder_paths/core/wallets/WalletManager.py +56 -0
  45. wayfinder_paths/core/wallets/__init__.py +7 -0
  46. wayfinder_paths/run_strategy.py +409 -0
  47. wayfinder_paths/scripts/__init__.py +0 -0
  48. wayfinder_paths/scripts/create_strategy.py +181 -0
  49. wayfinder_paths/scripts/make_wallets.py +160 -0
  50. wayfinder_paths/scripts/validate_manifests.py +213 -0
  51. wayfinder_paths/tests/__init__.py +0 -0
  52. wayfinder_paths/tests/test_smoke_manifest.py +48 -0
  53. wayfinder_paths/tests/test_test_coverage.py +212 -0
  54. wayfinder_paths/tests/test_utils.py +64 -0
  55. wayfinder_paths/vaults/__init__.py +0 -0
  56. wayfinder_paths/vaults/adapters/__init__.py +0 -0
  57. wayfinder_paths/vaults/adapters/balance_adapter/README.md +104 -0
  58. wayfinder_paths/vaults/adapters/balance_adapter/adapter.py +257 -0
  59. wayfinder_paths/vaults/adapters/balance_adapter/examples.json +6 -0
  60. wayfinder_paths/vaults/adapters/balance_adapter/manifest.yaml +8 -0
  61. wayfinder_paths/vaults/adapters/balance_adapter/test_adapter.py +83 -0
  62. wayfinder_paths/vaults/adapters/brap_adapter/README.md +249 -0
  63. wayfinder_paths/vaults/adapters/brap_adapter/__init__.py +7 -0
  64. wayfinder_paths/vaults/adapters/brap_adapter/adapter.py +717 -0
  65. wayfinder_paths/vaults/adapters/brap_adapter/examples.json +175 -0
  66. wayfinder_paths/vaults/adapters/brap_adapter/manifest.yaml +11 -0
  67. wayfinder_paths/vaults/adapters/brap_adapter/test_adapter.py +288 -0
  68. wayfinder_paths/vaults/adapters/hyperlend_adapter/__init__.py +7 -0
  69. wayfinder_paths/vaults/adapters/hyperlend_adapter/adapter.py +298 -0
  70. wayfinder_paths/vaults/adapters/hyperlend_adapter/manifest.yaml +10 -0
  71. wayfinder_paths/vaults/adapters/hyperlend_adapter/test_adapter.py +267 -0
  72. wayfinder_paths/vaults/adapters/ledger_adapter/README.md +158 -0
  73. wayfinder_paths/vaults/adapters/ledger_adapter/__init__.py +7 -0
  74. wayfinder_paths/vaults/adapters/ledger_adapter/adapter.py +286 -0
  75. wayfinder_paths/vaults/adapters/ledger_adapter/examples.json +131 -0
  76. wayfinder_paths/vaults/adapters/ledger_adapter/manifest.yaml +11 -0
  77. wayfinder_paths/vaults/adapters/ledger_adapter/test_adapter.py +202 -0
  78. wayfinder_paths/vaults/adapters/pool_adapter/README.md +218 -0
  79. wayfinder_paths/vaults/adapters/pool_adapter/__init__.py +7 -0
  80. wayfinder_paths/vaults/adapters/pool_adapter/adapter.py +289 -0
  81. wayfinder_paths/vaults/adapters/pool_adapter/examples.json +143 -0
  82. wayfinder_paths/vaults/adapters/pool_adapter/manifest.yaml +10 -0
  83. wayfinder_paths/vaults/adapters/pool_adapter/test_adapter.py +222 -0
  84. wayfinder_paths/vaults/adapters/token_adapter/README.md +101 -0
  85. wayfinder_paths/vaults/adapters/token_adapter/__init__.py +3 -0
  86. wayfinder_paths/vaults/adapters/token_adapter/adapter.py +92 -0
  87. wayfinder_paths/vaults/adapters/token_adapter/examples.json +26 -0
  88. wayfinder_paths/vaults/adapters/token_adapter/manifest.yaml +6 -0
  89. wayfinder_paths/vaults/adapters/token_adapter/test_adapter.py +135 -0
  90. wayfinder_paths/vaults/strategies/__init__.py +0 -0
  91. wayfinder_paths/vaults/strategies/config.py +85 -0
  92. wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/README.md +99 -0
  93. wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/examples.json +16 -0
  94. wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/manifest.yaml +7 -0
  95. wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/strategy.py +2328 -0
  96. wayfinder_paths/vaults/strategies/hyperlend_stable_yield_strategy/test_strategy.py +319 -0
  97. wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/README.md +95 -0
  98. wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/examples.json +17 -0
  99. wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/manifest.yaml +17 -0
  100. wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/strategy.py +1684 -0
  101. wayfinder_paths/vaults/strategies/stablecoin_yield_strategy/test_strategy.py +350 -0
  102. wayfinder_paths/vaults/templates/adapter/README.md +105 -0
  103. wayfinder_paths/vaults/templates/adapter/adapter.py +26 -0
  104. wayfinder_paths/vaults/templates/adapter/examples.json +8 -0
  105. wayfinder_paths/vaults/templates/adapter/manifest.yaml +6 -0
  106. wayfinder_paths/vaults/templates/adapter/test_adapter.py +49 -0
  107. wayfinder_paths/vaults/templates/strategy/README.md +152 -0
  108. wayfinder_paths/vaults/templates/strategy/examples.json +11 -0
  109. wayfinder_paths/vaults/templates/strategy/manifest.yaml +8 -0
  110. wayfinder_paths/vaults/templates/strategy/strategy.py +57 -0
  111. wayfinder_paths/vaults/templates/strategy/test_strategy.py +197 -0
  112. wayfinder_paths-0.1.1.dist-info/LICENSE +21 -0
  113. wayfinder_paths-0.1.1.dist-info/METADATA +727 -0
  114. wayfinder_paths-0.1.1.dist-info/RECORD +115 -0
  115. wayfinder_paths-0.1.1.dist-info/WHEEL +4 -0
@@ -0,0 +1,158 @@
1
+ # Ledger Adapter
2
+
3
+ A Wayfinder adapter that provides high-level operations for vault transaction history and bookkeeping. This adapter wraps the `LedgerClient` to offer strategy-friendly methods for recording and retrieving vault operations.
4
+
5
+ ## Capabilities
6
+
7
+ - `ledger.read`: Read vault transaction data and net deposits
8
+ - `ledger.write`: Record deposits, withdrawals, and operations
9
+ - `vault.transactions`: Access vault transaction history
10
+ - `vault.deposits`: Record deposit transactions
11
+ - `vault.withdrawals`: Record withdrawal transactions
12
+ - `vault.operations`: Record vault operations (swaps, rebalances, etc.)
13
+
14
+ ## Configuration
15
+
16
+ The adapter uses the LedgerClient which automatically handles authentication and API configuration through the Wayfinder settings. No additional configuration is required.
17
+
18
+ The LedgerClient will automatically:
19
+ - Use the WAYFINDER_API_URL from settings
20
+ - Handle authentication via environment variables or config.json
21
+ - Manage token refresh and retry logic
22
+
23
+ ## Usage
24
+
25
+ ### Initialize the Adapter
26
+
27
+ ```python
28
+ from wayfinder_paths.vaults.adapters.ledger_adapter.adapter import LedgerAdapter
29
+
30
+ # No configuration needed - uses LedgerClient with automatic settings
31
+ adapter = LedgerAdapter()
32
+ ```
33
+
34
+ ### Get Vault Transaction History
35
+
36
+ ```python
37
+ success, data = await adapter.get_vault_transactions(
38
+ wallet_address="0x1234567890123456789012345678901234567890",
39
+ limit=10,
40
+ offset=0
41
+ )
42
+ if success:
43
+ transactions = data.get("transactions", [])
44
+ print(f"Found {len(transactions)} transactions")
45
+ else:
46
+ print(f"Error: {data}")
47
+ ```
48
+
49
+ ### Get Net Deposit Amount
50
+
51
+ ```python
52
+ success, data = await adapter.get_vault_net_deposit(
53
+ wallet_address="0x1234567890123456789012345678901234567890"
54
+ )
55
+ if success:
56
+ net_deposit = data.get("net_deposit", 0)
57
+ print(f"Net deposit: {net_deposit} USDC")
58
+ else:
59
+ print(f"Error: {data}")
60
+ ```
61
+
62
+ ### Record a Deposit
63
+
64
+ ```python
65
+ success, data = await adapter.record_deposit(
66
+ wallet_address="0x1234567890123456789012345678901234567890",
67
+ chain_id=8453,
68
+ token_address="0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
69
+ token_amount="1000000000000000000",
70
+ usd_value="1000.00",
71
+ strategy_name="StablecoinYieldStrategy"
72
+ )
73
+ if success:
74
+ print(f"Deposit recorded: {data.get('transaction_id')}")
75
+ else:
76
+ print(f"Error: {data}")
77
+ ```
78
+
79
+ ### Record a Withdrawal
80
+
81
+ ```python
82
+ success, data = await adapter.record_withdrawal(
83
+ wallet_address="0x1234567890123456789012345678901234567890",
84
+ chain_id=8453,
85
+ token_address="0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
86
+ token_amount="500000000000000000",
87
+ usd_value="500.00",
88
+ strategy_name="StablecoinYieldStrategy"
89
+ )
90
+ if success:
91
+ print(f"Withdrawal recorded: {data.get('transaction_id')}")
92
+ else:
93
+ print(f"Error: {data}")
94
+ ```
95
+
96
+ ### Record an Operation or Cashflow
97
+
98
+ ```python
99
+ success, op = await adapter.record_operation(
100
+ wallet_address=vault_address,
101
+ operation_data={
102
+ "type": "SWAP",
103
+ "from_token": "...",
104
+ "to_token": "...",
105
+ "amount_in": "1000000000000000000",
106
+ "amount_out": "995000000000000000",
107
+ },
108
+ usd_value="1000.00",
109
+ strategy_name="StablecoinYieldStrategy",
110
+ )
111
+
112
+ success, cashflow = await adapter.record_cashflow(
113
+ wallet_address=vault_address,
114
+ block_timestamp=int(time.time()),
115
+ token_addr="0x...",
116
+ amount="250000000000000000",
117
+ description="reward",
118
+ strategy_name="StablecoinYieldStrategy",
119
+ )
120
+ ```
121
+
122
+ ### Latest Transactions and Summaries
123
+
124
+ ```python
125
+ success, latest = await adapter.get_vault_latest_transactions(wallet_address=vault_address)
126
+ success, summary = await adapter.get_transaction_summary(wallet_address=vault_address, limit=5)
127
+ if success:
128
+ print(f"Total transactions: {summary.get('total_transactions')}")
129
+ ```
130
+
131
+ ## API Endpoints
132
+
133
+ The adapter uses the following Wayfinder API endpoints:
134
+
135
+ - `GET /api/v1/public/vaults/transactions/` - Get vault transactions
136
+ - `GET /api/v1/public/vaults/net-deposit/` - Get net deposit amount
137
+ - `POST /api/v1/public/vaults/deposits/` - Record a deposit
138
+ - `POST /api/v1/public/vaults/withdrawals/` - Record a withdrawal
139
+ - `POST /api/v1/public/vaults/operations/` - Record an operation
140
+
141
+ ## Error Handling
142
+
143
+ All methods return a tuple of `(success: bool, data: Any)` where:
144
+ - `success` is `True` if the operation succeeded
145
+ - `data` contains the response data on success or error message on failure
146
+
147
+ ## Testing
148
+
149
+ Run the adapter tests:
150
+
151
+ ```bash
152
+ pytest wayfinder_paths/vaults/adapters/ledger_adapter/test_adapter.py -v
153
+ ```
154
+
155
+ ## Dependencies
156
+
157
+ - `LedgerClient` - Low-level API client for ledger operations
158
+ - `BaseAdapter` - Base adapter class with common functionality
@@ -0,0 +1,7 @@
1
+ """
2
+ Ledger Adapter Package
3
+ """
4
+
5
+ from .adapter import LedgerAdapter
6
+
7
+ __all__ = ["LedgerAdapter"]
@@ -0,0 +1,286 @@
1
+ from typing import Any
2
+
3
+ from wayfinder_paths.core.adapters.BaseAdapter import BaseAdapter
4
+ from wayfinder_paths.core.clients.LedgerClient import LedgerClient
5
+
6
+
7
+ class LedgerAdapter(BaseAdapter):
8
+ """
9
+ Ledger adapter for vault transaction history and bookkeeping operations.
10
+
11
+ Provides high-level operations for:
12
+ - Fetching vault transaction history
13
+ - Getting net deposit amounts
14
+ - Getting last rotation time
15
+ - Recording deposits, withdrawals, operations, and cashflows
16
+ """
17
+
18
+ adapter_type: str = "LEDGER"
19
+
20
+ def __init__(
21
+ self,
22
+ config: dict[str, Any] | None = None,
23
+ ledger_client: LedgerClient | None = None,
24
+ ):
25
+ super().__init__("ledger_adapter", config)
26
+ self.ledger_client = ledger_client or LedgerClient()
27
+
28
+ async def get_vault_transactions(
29
+ self, wallet_address: str, limit: int = 50, offset: int = 0
30
+ ) -> tuple[bool, Any]:
31
+ """
32
+ Get paginated vault transaction history.
33
+
34
+ Args:
35
+ wallet_address: Vault wallet address
36
+ limit: Maximum number of transactions to return
37
+ offset: Number of transactions to skip
38
+
39
+ Returns:
40
+ Tuple of (success, data) where data is transaction list or error message
41
+ """
42
+ try:
43
+ data = await self.ledger_client.get_vault_transactions(
44
+ wallet_address=wallet_address, limit=limit, offset=offset
45
+ )
46
+ return (True, data)
47
+ except Exception as e:
48
+ self.logger.error(f"Error fetching vault transactions: {e}")
49
+ return (False, str(e))
50
+
51
+ async def get_vault_net_deposit(self, wallet_address: str) -> tuple[bool, Any]:
52
+ """
53
+ Get net deposit amount (deposits - withdrawals) for a vault.
54
+
55
+ Args:
56
+ wallet_address: Vault wallet address
57
+
58
+ Returns:
59
+ Tuple of (success, data) where data contains net_deposit or error message
60
+ """
61
+ try:
62
+ data = await self.ledger_client.get_vault_net_deposit(
63
+ wallet_address=wallet_address
64
+ )
65
+ return (True, data)
66
+ except Exception as e:
67
+ self.logger.error(f"Error fetching vault net deposit: {e}")
68
+ return (False, str(e))
69
+
70
+ async def get_vault_latest_transactions(
71
+ self, wallet_address: str
72
+ ) -> tuple[bool, Any]:
73
+ """
74
+ Get the latest transactions for a vault.
75
+
76
+ Args:
77
+ wallet_address: Vault wallet address
78
+
79
+ Returns:
80
+ Tuple of (success, data) where data contains latest transactions or error message
81
+ """
82
+ try:
83
+ data = await self.ledger_client.get_vault_latest_transactions(
84
+ wallet_address=wallet_address
85
+ )
86
+ return (True, data)
87
+ except Exception as e:
88
+ self.logger.error(f"Error fetching vault last transactions: {e}")
89
+ return (False, str(e))
90
+
91
+ async def record_deposit(
92
+ self,
93
+ wallet_address: str,
94
+ chain_id: int,
95
+ token_address: str,
96
+ token_amount: str | float,
97
+ usd_value: str | float,
98
+ data: dict[str, Any] | None = None,
99
+ strategy_name: str | None = None,
100
+ ) -> tuple[bool, Any]:
101
+ """
102
+ Record a vault deposit transaction.
103
+
104
+ Args:
105
+ wallet_address: Vault wallet address
106
+ chain_id: Blockchain chain ID
107
+ token_address: Token contract address
108
+ token_amount: Amount deposited (in token units)
109
+ usd_value: USD value of the deposit
110
+ data: Additional transaction data
111
+ strategy_name: Name of the strategy making the deposit
112
+
113
+ Returns:
114
+ Tuple of (success, data) where data is transaction record or error message
115
+ """
116
+ try:
117
+ result = await self.ledger_client.add_vault_deposit(
118
+ wallet_address=wallet_address,
119
+ chain_id=chain_id,
120
+ token_address=token_address,
121
+ token_amount=token_amount,
122
+ usd_value=usd_value,
123
+ data=data,
124
+ strategy_name=strategy_name,
125
+ )
126
+ return (True, result)
127
+ except Exception as e:
128
+ self.logger.error(f"Error recording deposit: {e}")
129
+ return (False, str(e))
130
+
131
+ async def record_withdrawal(
132
+ self,
133
+ wallet_address: str,
134
+ chain_id: int,
135
+ token_address: str,
136
+ token_amount: str | float,
137
+ usd_value: str | float,
138
+ data: dict[str, Any] | None = None,
139
+ strategy_name: str | None = None,
140
+ ) -> tuple[bool, Any]:
141
+ """
142
+ Record a vault withdrawal transaction.
143
+
144
+ Args:
145
+ wallet_address: Vault wallet address
146
+ chain_id: Blockchain chain ID
147
+ token_address: Token contract address
148
+ token_amount: Amount withdrawn (in token units)
149
+ usd_value: USD value of the withdrawal
150
+ data: Additional transaction data
151
+ strategy_name: Name of the strategy making the withdrawal
152
+
153
+ Returns:
154
+ Tuple of (success, data) where data is transaction record or error message
155
+ """
156
+ try:
157
+ result = await self.ledger_client.add_vault_withdraw(
158
+ wallet_address=wallet_address,
159
+ chain_id=chain_id,
160
+ token_address=token_address,
161
+ token_amount=token_amount,
162
+ usd_value=usd_value,
163
+ data=data,
164
+ strategy_name=strategy_name,
165
+ )
166
+ return (True, result)
167
+ except Exception as e:
168
+ self.logger.error(f"Error recording withdrawal: {e}")
169
+ return (False, str(e))
170
+
171
+ async def record_operation(
172
+ self,
173
+ wallet_address: str,
174
+ operation_data: dict[str, Any],
175
+ usd_value: str | float,
176
+ strategy_name: str | None = None,
177
+ ) -> tuple[bool, Any]:
178
+ """
179
+ Record a vault operation (e.g., swaps, rebalances) for bookkeeping.
180
+
181
+ Args:
182
+ wallet_address: Vault wallet address
183
+ operation_data: Details of the operation performed
184
+ usd_value: USD value of the operation
185
+ strategy_name: Name of the strategy performing the operation
186
+
187
+ Returns:
188
+ Tuple of (success, data) where data is operation record or error message
189
+ """
190
+ try:
191
+ result = await self.ledger_client.add_vault_operation(
192
+ wallet_address=wallet_address,
193
+ operation_data=operation_data,
194
+ usd_value=usd_value,
195
+ strategy_name=strategy_name,
196
+ )
197
+ return (True, result)
198
+ except Exception as e:
199
+ self.logger.error(f"Error recording operation: {e}")
200
+ return (False, str(e))
201
+
202
+ async def record_cashflow(
203
+ self,
204
+ wallet_address: str,
205
+ block_timestamp: int,
206
+ token_addr: str,
207
+ amount: str | int | float,
208
+ description: str,
209
+ strategy_name: str | None = None,
210
+ ) -> tuple[bool, Any]:
211
+ """
212
+ Record a vault cashflow (interest, funding, reward, or fee).
213
+
214
+ Args:
215
+ wallet_address: Vault wallet address
216
+ block_timestamp: Block timestamp (Unix timestamp)
217
+ token_addr: Token contract address
218
+ amount: Cashflow amount (in token units)
219
+ description: Cashflow type - must be one of: "interest", "funding", "reward", "fee"
220
+ strategy_name: Optional strategy name
221
+
222
+ Returns:
223
+ Tuple of (success, data) where data is cashflow record or error message
224
+ """
225
+ try:
226
+ result = await self.ledger_client.add_vault_cashflow(
227
+ wallet_address=wallet_address,
228
+ block_timestamp=block_timestamp,
229
+ token_addr=token_addr,
230
+ amount=amount,
231
+ description=description,
232
+ strategy_name=strategy_name,
233
+ )
234
+ return (True, result)
235
+ except Exception as e:
236
+ self.logger.error(f"Error recording cashflow: {e}")
237
+ return (False, str(e))
238
+
239
+ async def get_transaction_summary(
240
+ self, wallet_address: str, limit: int = 10
241
+ ) -> tuple[bool, Any]:
242
+ """
243
+ Get a summary of recent vault transactions.
244
+
245
+ Args:
246
+ wallet_address: Vault wallet address
247
+ limit: Number of recent transactions to include
248
+
249
+ Returns:
250
+ Tuple of (success, data) where data is transaction summary or error message
251
+ """
252
+ try:
253
+ success, transactions_data = await self.get_vault_transactions(
254
+ wallet_address=wallet_address, limit=limit
255
+ )
256
+
257
+ if not success:
258
+ return (False, transactions_data)
259
+
260
+ transactions = transactions_data.get("transactions", [])
261
+
262
+ # Create summary
263
+ summary = {
264
+ "total_transactions": len(transactions),
265
+ "recent_transactions": transactions[:limit],
266
+ "operations": {
267
+ "deposits": len(
268
+ [t for t in transactions if t.get("operation") == "DEPOSIT"]
269
+ ),
270
+ "withdrawals": len(
271
+ [t for t in transactions if t.get("operation") == "WITHDRAW"]
272
+ ),
273
+ "operations": len(
274
+ [
275
+ t
276
+ for t in transactions
277
+ if t.get("operation") not in ["DEPOSIT", "WITHDRAW"]
278
+ ]
279
+ ),
280
+ },
281
+ }
282
+
283
+ return (True, summary)
284
+ except Exception as e:
285
+ self.logger.error(f"Error creating transaction summary: {e}")
286
+ return (False, str(e))
@@ -0,0 +1,131 @@
1
+ {
2
+ "get_vault_transactions": {
3
+ "description": "Get vault transaction history",
4
+ "input": {
5
+ "wallet_address": "0x1234567890123456789012345678901234567890",
6
+ "limit": 10,
7
+ "offset": 0
8
+ },
9
+ "output": {
10
+ "success": true,
11
+ "data": {
12
+ "transactions": [
13
+ {
14
+ "id": "tx_123",
15
+ "operation": "DEPOSIT",
16
+ "timestamp": "2024-01-15T10:30:00Z",
17
+ "amount": "1000000000000000000",
18
+ "token_address": "0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
19
+ "usd_value": "1000.00",
20
+ "strategy_name": "StablecoinYieldStrategy"
21
+ }
22
+ ],
23
+ "total": 1,
24
+ "limit": 10,
25
+ "offset": 0
26
+ }
27
+ }
28
+ },
29
+ "get_vault_net_deposit": {
30
+ "description": "Get net deposit amount for a vault",
31
+ "input": {
32
+ "wallet_address": "0x1234567890123456789012345678901234567890"
33
+ },
34
+ "output": {
35
+ "success": true,
36
+ "data": {
37
+ "net_deposit": "1000.00",
38
+ "total_deposits": "1500.00",
39
+ "total_withdrawals": "500.00"
40
+ }
41
+ }
42
+ },
43
+ "record_deposit": {
44
+ "description": "Record a vault deposit",
45
+ "input": {
46
+ "wallet_address": "0x1234567890123456789012345678901234567890",
47
+ "chain_id": 8453,
48
+ "token_address": "0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
49
+ "token_amount": "1000000000000000000",
50
+ "usd_value": "1000.00",
51
+ "strategy_name": "StablecoinYieldStrategy"
52
+ },
53
+ "output": {
54
+ "success": true,
55
+ "data": {
56
+ "transaction_id": "tx_456",
57
+ "status": "recorded",
58
+ "timestamp": "2024-01-15T10:30:00Z"
59
+ }
60
+ }
61
+ },
62
+ "record_withdrawal": {
63
+ "description": "Record a vault withdrawal",
64
+ "input": {
65
+ "wallet_address": "0x1234567890123456789012345678901234567890",
66
+ "chain_id": 8453,
67
+ "token_address": "0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
68
+ "token_amount": "500000000000000000",
69
+ "usd_value": "500.00",
70
+ "strategy_name": "StablecoinYieldStrategy"
71
+ },
72
+ "output": {
73
+ "success": true,
74
+ "data": {
75
+ "transaction_id": "tx_789",
76
+ "status": "recorded",
77
+ "timestamp": "2024-01-15T11:00:00Z"
78
+ }
79
+ }
80
+ },
81
+ "record_operation": {
82
+ "description": "Record a vault operation (swap, rebalance, etc.)",
83
+ "input": {
84
+ "wallet_address": "0x1234567890123456789012345678901234567890",
85
+ "operation_data": {
86
+ "type": "SWAP",
87
+ "from_token": "0xA0b86a33E6441c8C06DdD4D4c4c4c4c4c4c4c4c4c",
88
+ "to_token": "0xB1c97a44F7552d9Dd5e5e5e5e5e5e5e5e5e5e5e5e5e",
89
+ "amount_in": "1000000000000000000",
90
+ "amount_out": "995000000000000000"
91
+ },
92
+ "usd_value": "1000.00",
93
+ "strategy_name": "StablecoinYieldStrategy"
94
+ },
95
+ "output": {
96
+ "success": true,
97
+ "data": {
98
+ "operation_id": "op_123",
99
+ "status": "recorded",
100
+ "timestamp": "2024-01-15T10:45:00Z"
101
+ }
102
+ }
103
+ },
104
+ "get_transaction_summary": {
105
+ "description": "Get a summary of recent vault transactions",
106
+ "input": {
107
+ "wallet_address": "0x1234567890123456789012345678901234567890",
108
+ "limit": 5
109
+ },
110
+ "output": {
111
+ "success": true,
112
+ "data": {
113
+ "total_transactions": 3,
114
+ "recent_transactions": [
115
+ {
116
+ "id": "tx_123",
117
+ "operation": "DEPOSIT",
118
+ "timestamp": "2024-01-15T10:30:00Z",
119
+ "amount": "1000000000000000000",
120
+ "usd_value": "1000.00"
121
+ }
122
+ ],
123
+ "operations": {
124
+ "deposits": 1,
125
+ "withdrawals": 1,
126
+ "operations": 1
127
+ }
128
+ }
129
+ }
130
+ }
131
+ }
@@ -0,0 +1,11 @@
1
+ schema_version: "0.1"
2
+ entrypoint: "vaults.adapters.ledger_adapter.adapter.LedgerAdapter"
3
+ capabilities:
4
+ - "ledger.read"
5
+ - "ledger.write"
6
+ - "vault.transactions"
7
+ - "vault.deposits"
8
+ - "vault.withdrawals"
9
+ - "vault.operations"
10
+ dependencies:
11
+ - "LedgerClient"