wayfinder-paths 0.1.13__py3-none-any.whl → 0.1.15__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 (61) hide show
  1. wayfinder_paths/adapters/balance_adapter/README.md +13 -14
  2. wayfinder_paths/adapters/balance_adapter/adapter.py +73 -32
  3. wayfinder_paths/adapters/balance_adapter/test_adapter.py +123 -0
  4. wayfinder_paths/adapters/brap_adapter/README.md +11 -16
  5. wayfinder_paths/adapters/brap_adapter/adapter.py +144 -78
  6. wayfinder_paths/adapters/brap_adapter/examples.json +63 -52
  7. wayfinder_paths/adapters/brap_adapter/test_adapter.py +127 -65
  8. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +30 -14
  9. wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +121 -67
  10. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter.py +6 -6
  11. wayfinder_paths/adapters/hyperliquid_adapter/test_adapter_live.py +12 -12
  12. wayfinder_paths/adapters/ledger_adapter/test_adapter.py +6 -6
  13. wayfinder_paths/adapters/moonwell_adapter/adapter.py +332 -9
  14. wayfinder_paths/adapters/moonwell_adapter/test_adapter.py +13 -13
  15. wayfinder_paths/adapters/pool_adapter/README.md +9 -10
  16. wayfinder_paths/adapters/pool_adapter/adapter.py +9 -10
  17. wayfinder_paths/adapters/pool_adapter/test_adapter.py +2 -2
  18. wayfinder_paths/adapters/token_adapter/README.md +2 -14
  19. wayfinder_paths/adapters/token_adapter/adapter.py +16 -10
  20. wayfinder_paths/adapters/token_adapter/examples.json +4 -8
  21. wayfinder_paths/adapters/token_adapter/test_adapter.py +9 -7
  22. wayfinder_paths/core/clients/BRAPClient.py +102 -61
  23. wayfinder_paths/core/clients/ClientManager.py +1 -68
  24. wayfinder_paths/core/clients/HyperlendClient.py +125 -64
  25. wayfinder_paths/core/clients/LedgerClient.py +1 -4
  26. wayfinder_paths/core/clients/PoolClient.py +122 -48
  27. wayfinder_paths/core/clients/TokenClient.py +91 -36
  28. wayfinder_paths/core/clients/WalletClient.py +26 -56
  29. wayfinder_paths/core/clients/WayfinderClient.py +28 -160
  30. wayfinder_paths/core/clients/__init__.py +0 -2
  31. wayfinder_paths/core/clients/protocols.py +35 -46
  32. wayfinder_paths/core/clients/sdk_example.py +37 -22
  33. wayfinder_paths/core/constants/erc20_abi.py +0 -11
  34. wayfinder_paths/core/engine/StrategyJob.py +10 -56
  35. wayfinder_paths/core/services/base.py +1 -0
  36. wayfinder_paths/core/services/local_evm_txn.py +25 -9
  37. wayfinder_paths/core/services/local_token_txn.py +2 -6
  38. wayfinder_paths/core/services/test_local_evm_txn.py +145 -0
  39. wayfinder_paths/core/strategies/Strategy.py +16 -4
  40. wayfinder_paths/core/utils/evm_helpers.py +2 -9
  41. wayfinder_paths/policies/erc20.py +1 -1
  42. wayfinder_paths/run_strategy.py +13 -19
  43. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +77 -11
  44. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +6 -6
  45. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +107 -23
  46. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +54 -9
  47. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +6 -5
  48. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +2246 -1279
  49. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +276 -109
  50. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +1 -1
  51. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +153 -56
  52. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +16 -12
  53. wayfinder_paths/templates/adapter/README.md +1 -1
  54. wayfinder_paths/templates/strategy/README.md +3 -3
  55. wayfinder_paths/templates/strategy/test_strategy.py +3 -2
  56. {wayfinder_paths-0.1.13.dist-info → wayfinder_paths-0.1.15.dist-info}/METADATA +14 -49
  57. {wayfinder_paths-0.1.13.dist-info → wayfinder_paths-0.1.15.dist-info}/RECORD +59 -60
  58. wayfinder_paths/abis/generic/erc20.json +0 -383
  59. wayfinder_paths/core/clients/AuthClient.py +0 -83
  60. {wayfinder_paths-0.1.13.dist-info → wayfinder_paths-0.1.15.dist-info}/LICENSE +0 -0
  61. {wayfinder_paths-0.1.13.dist-info → wayfinder_paths-0.1.15.dist-info}/WHEEL +0 -0
@@ -1,383 +0,0 @@
1
- [
2
- {
3
- "constant": true,
4
- "inputs": [
5
- {
6
- "name": "owner",
7
- "type": "address"
8
- },
9
- {
10
- "name": "spender",
11
- "type": "address"
12
- }
13
- ],
14
- "name": "allowance",
15
- "outputs": [
16
- {
17
- "name": "",
18
- "type": "uint256"
19
- }
20
- ],
21
- "type": "function"
22
- },
23
- {
24
- "constant": true,
25
- "inputs": [
26
- {
27
- "name": "account",
28
- "type": "address"
29
- }
30
- ],
31
- "name": "balanceOf",
32
- "outputs": [
33
- {
34
- "name": "",
35
- "type": "uint256"
36
- }
37
- ],
38
- "type": "function"
39
- },
40
- {
41
- "constant": true,
42
- "inputs": [],
43
- "name": "decimals",
44
- "outputs": [
45
- {
46
- "name": "",
47
- "type": "uint8"
48
- }
49
- ],
50
- "type": "function"
51
- },
52
- {
53
- "constant": true,
54
- "inputs": [],
55
- "name": "name",
56
- "outputs": [
57
- {
58
- "name": "",
59
- "type": "string"
60
- }
61
- ],
62
- "type": "function"
63
- },
64
- {
65
- "constant": true,
66
- "inputs": [],
67
- "name": "symbol",
68
- "outputs": [
69
- {
70
- "name": "",
71
- "type": "string"
72
- }
73
- ],
74
- "type": "function"
75
- },
76
- {
77
- "constant": false,
78
- "inputs": [
79
- {
80
- "name": "recipient",
81
- "type": "address"
82
- },
83
- {
84
- "name": "amount",
85
- "type": "uint256"
86
- }
87
- ],
88
- "name": "transfer",
89
- "outputs": [
90
- {
91
- "name": "",
92
- "type": "bool"
93
- }
94
- ],
95
- "type": "function"
96
- },
97
- {
98
- "constant": false,
99
- "inputs": [
100
- {
101
- "name": "spender",
102
- "type": "address"
103
- },
104
- {
105
- "name": "amount",
106
- "type": "uint256"
107
- }
108
- ],
109
- "name": "approve",
110
- "outputs": [
111
- {
112
- "name": "",
113
- "type": "bool"
114
- }
115
- ],
116
- "type": "function"
117
- },
118
- {
119
- "inputs": [
120
- {
121
- "internalType": "address",
122
- "name": "tokenA",
123
- "type": "address"
124
- },
125
- {
126
- "internalType": "address",
127
- "name": "tokenB",
128
- "type": "address"
129
- },
130
- {
131
- "internalType": "bool",
132
- "name": "stable",
133
- "type": "bool"
134
- },
135
- {
136
- "internalType": "uint256",
137
- "name": "amountADesired",
138
- "type": "uint256"
139
- },
140
- {
141
- "internalType": "uint256",
142
- "name": "amountBDesired",
143
- "type": "uint256"
144
- },
145
- {
146
- "internalType": "uint256",
147
- "name": "amountAMin",
148
- "type": "uint256"
149
- },
150
- {
151
- "internalType": "uint256",
152
- "name": "amountBMin",
153
- "type": "uint256"
154
- },
155
- {
156
- "internalType": "address",
157
- "name": "to",
158
- "type": "address"
159
- },
160
- {
161
- "internalType": "uint256",
162
- "name": "deadline",
163
- "type": "uint256"
164
- }
165
- ],
166
- "name": "addLiquidity",
167
- "outputs": [
168
- {
169
- "internalType": "uint256",
170
- "name": "amountA",
171
- "type": "uint256"
172
- },
173
- {
174
- "internalType": "uint256",
175
- "name": "amountB",
176
- "type": "uint256"
177
- },
178
- {
179
- "internalType": "uint256",
180
- "name": "liquidity",
181
- "type": "uint256"
182
- }
183
- ],
184
- "stateMutability": "nonpayable",
185
- "type": "function"
186
- },
187
- {
188
- "inputs": [
189
- {
190
- "internalType": "address",
191
- "name": "tokenA",
192
- "type": "address"
193
- },
194
- {
195
- "internalType": "address",
196
- "name": "tokenB",
197
- "type": "address"
198
- },
199
- {
200
- "internalType": "bool",
201
- "name": "stable",
202
- "type": "bool"
203
- },
204
- {
205
- "internalType": "address",
206
- "name": "_factory",
207
- "type": "address"
208
- },
209
- {
210
- "internalType": "uint256",
211
- "name": "amountADesired",
212
- "type": "uint256"
213
- },
214
- {
215
- "internalType": "uint256",
216
- "name": "amountBDesired",
217
- "type": "uint256"
218
- }
219
- ],
220
- "name": "quoteAddLiquidity",
221
- "outputs": [
222
- {
223
- "internalType": "uint256",
224
- "name": "amountA",
225
- "type": "uint256"
226
- },
227
- {
228
- "internalType": "uint256",
229
- "name": "amountB",
230
- "type": "uint256"
231
- },
232
- {
233
- "internalType": "uint256",
234
- "name": "liquidity",
235
- "type": "uint256"
236
- }
237
- ],
238
- "stateMutability": "view",
239
- "type": "function"
240
- },
241
- {
242
- "inputs": [],
243
- "name": "defaultFactory",
244
- "outputs": [
245
- {
246
- "internalType": "address",
247
- "name": "",
248
- "type": "address"
249
- }
250
- ],
251
- "stateMutability": "view",
252
- "type": "function"
253
- },
254
- {
255
- "inputs": [
256
- {
257
- "internalType": "address",
258
- "name": "tokenA",
259
- "type": "address"
260
- },
261
- {
262
- "internalType": "address",
263
- "name": "tokenB",
264
- "type": "address"
265
- },
266
- {
267
- "internalType": "bool",
268
- "name": "stable",
269
- "type": "bool"
270
- },
271
- {
272
- "internalType": "address",
273
- "name": "_factory",
274
- "type": "address"
275
- },
276
- {
277
- "internalType": "uint256",
278
- "name": "liquidity",
279
- "type": "uint256"
280
- }
281
- ],
282
- "name": "quoteRemoveLiquidity",
283
- "outputs": [
284
- {
285
- "internalType": "uint256",
286
- "name": "amountA",
287
- "type": "uint256"
288
- },
289
- {
290
- "internalType": "uint256",
291
- "name": "amountB",
292
- "type": "uint256"
293
- }
294
- ],
295
- "stateMutability": "view",
296
- "type": "function"
297
- },
298
- {
299
- "inputs": [
300
- {
301
- "internalType": "address",
302
- "name": "tokenA",
303
- "type": "address"
304
- },
305
- {
306
- "internalType": "address",
307
- "name": "tokenB",
308
- "type": "address"
309
- },
310
- {
311
- "internalType": "bool",
312
- "name": "stable",
313
- "type": "bool"
314
- },
315
- {
316
- "internalType": "uint256",
317
- "name": "liquidity",
318
- "type": "uint256"
319
- },
320
- {
321
- "internalType": "uint256",
322
- "name": "amountAMin",
323
- "type": "uint256"
324
- },
325
- {
326
- "internalType": "uint256",
327
- "name": "amountBMin",
328
- "type": "uint256"
329
- },
330
- {
331
- "internalType": "address",
332
- "name": "to",
333
- "type": "address"
334
- },
335
- {
336
- "internalType": "uint256",
337
- "name": "deadline",
338
- "type": "uint256"
339
- }
340
- ],
341
- "name": "removeLiquidity",
342
- "outputs": [
343
- {
344
- "internalType": "uint256",
345
- "name": "amountA",
346
- "type": "uint256"
347
- },
348
- {
349
- "internalType": "uint256",
350
- "name": "amountB",
351
- "type": "uint256"
352
- }
353
- ],
354
- "stateMutability": "nonpayable",
355
- "type": "function"
356
- },
357
- {
358
- "inputs": [
359
- {
360
- "internalType": "uint256",
361
- "name": "_amount",
362
- "type": "uint256"
363
- }
364
- ],
365
- "name": "deposit",
366
- "outputs": [],
367
- "stateMutability": "nonpayable",
368
- "type": "function"
369
- },
370
- {
371
- "inputs": [
372
- {
373
- "internalType": "uint256",
374
- "name": "_shares",
375
- "type": "uint256"
376
- }
377
- ],
378
- "name": "withdraw",
379
- "outputs": [],
380
- "stateMutability": "nonpayable",
381
- "type": "function"
382
- }
383
- ]
@@ -1,83 +0,0 @@
1
- import os
2
- from typing import Any
3
-
4
- from loguru import logger
5
-
6
- from wayfinder_paths.core.clients.WayfinderClient import WayfinderClient
7
- from wayfinder_paths.core.config import get_api_base_url
8
-
9
-
10
- class AuthClient(WayfinderClient):
11
- def __init__(self, api_key: str | None = None):
12
- """
13
- Initialize AuthClient.
14
-
15
- Args:
16
- api_key: Optional API key for service account authentication.
17
- If provided, uses API key auth. Otherwise falls back to config.json.
18
- """
19
- super().__init__(api_key=api_key)
20
-
21
- self.api_base_url = get_api_base_url()
22
- self.logger = logger.bind(client="AuthClient")
23
-
24
- def _is_using_api_key(self) -> bool:
25
- """Check if API key authentication is being used."""
26
- if self._api_key:
27
- return True
28
-
29
- try:
30
- creds = self._load_config_credentials()
31
- if creds.get("api_key"):
32
- return True
33
- if os.getenv("WAYFINDER_API_KEY"):
34
- return True
35
- except Exception:
36
- pass
37
-
38
- return False
39
-
40
- async def authenticate(
41
- self,
42
- username: str | None = None,
43
- password: str | None = None,
44
- *,
45
- refresh_token: str | None = None,
46
- ) -> dict[str, Any]:
47
- """
48
- Obtain an access token via username/password or refresh token.
49
-
50
- Expected endpoints:
51
- - POST {api_base_url}/token/ (username, password) -> { access, refresh }
52
- - POST {api_base_url}/token/refresh/ (refresh) -> { access }
53
- """
54
- if refresh_token:
55
- self.logger.debug(
56
- "AuthClient.authenticate -> POST /token/refresh (refresh provided)"
57
- )
58
- url = f"{self.api_base_url}/auth/token/refresh/"
59
- payload = {"refresh": refresh_token}
60
- elif username and password:
61
- self.logger.debug(
62
- f"AuthClient.authenticate -> POST /token (username provided={bool(username)})"
63
- )
64
- url = f"{self.api_base_url}/auth/token/"
65
- payload = {"username": username, "password": password}
66
- else:
67
- raise ValueError(
68
- "Credentials required: provide username+password or refresh_token"
69
- )
70
-
71
- response = await self._request("POST", url, json=payload)
72
- response.raise_for_status()
73
- data = response.json()
74
-
75
- access = data.get("access") or data.get("access_token")
76
- refresh = data.get("refresh") or data.get("refresh_token")
77
- if access or refresh:
78
- self.set_tokens(access, refresh)
79
- self.logger.debug(
80
- f"AuthClient.authenticate <- success (access={'yes' if access else 'no'}, refresh={'yes' if refresh else 'no'})"
81
- )
82
-
83
- return data