wayfinder-paths 0.1.11__py3-none-any.whl → 0.1.14__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 (66) hide show
  1. wayfinder_paths/adapters/balance_adapter/README.md +13 -14
  2. wayfinder_paths/adapters/balance_adapter/adapter.py +36 -39
  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 +87 -75
  6. wayfinder_paths/adapters/brap_adapter/examples.json +63 -52
  7. wayfinder_paths/adapters/brap_adapter/test_adapter.py +121 -59
  8. wayfinder_paths/adapters/hyperlend_adapter/adapter.py +22 -23
  9. wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py +114 -60
  10. wayfinder_paths/adapters/hyperliquid_adapter/adapter.py +1 -1
  11. wayfinder_paths/adapters/hyperliquid_adapter/executor.py +44 -5
  12. wayfinder_paths/adapters/hyperliquid_adapter/test_executor.py +104 -0
  13. wayfinder_paths/adapters/moonwell_adapter/adapter.py +0 -3
  14. wayfinder_paths/adapters/pool_adapter/README.md +11 -27
  15. wayfinder_paths/adapters/pool_adapter/adapter.py +11 -37
  16. wayfinder_paths/adapters/pool_adapter/examples.json +6 -7
  17. wayfinder_paths/adapters/pool_adapter/test_adapter.py +8 -8
  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 +5 -3
  22. wayfinder_paths/core/clients/BRAPClient.py +103 -62
  23. wayfinder_paths/core/clients/ClientManager.py +1 -68
  24. wayfinder_paths/core/clients/HyperlendClient.py +127 -66
  25. wayfinder_paths/core/clients/LedgerClient.py +1 -4
  26. wayfinder_paths/core/clients/PoolClient.py +126 -88
  27. wayfinder_paths/core/clients/TokenClient.py +92 -37
  28. wayfinder_paths/core/clients/WalletClient.py +28 -58
  29. wayfinder_paths/core/clients/WayfinderClient.py +33 -166
  30. wayfinder_paths/core/clients/__init__.py +0 -2
  31. wayfinder_paths/core/clients/protocols.py +35 -52
  32. wayfinder_paths/core/clients/sdk_example.py +37 -22
  33. wayfinder_paths/core/config.py +60 -224
  34. wayfinder_paths/core/engine/StrategyJob.py +7 -55
  35. wayfinder_paths/core/services/local_evm_txn.py +28 -10
  36. wayfinder_paths/core/services/local_token_txn.py +1 -1
  37. wayfinder_paths/core/strategies/Strategy.py +3 -5
  38. wayfinder_paths/core/strategies/descriptors.py +7 -0
  39. wayfinder_paths/core/utils/evm_helpers.py +7 -3
  40. wayfinder_paths/core/utils/wallets.py +12 -19
  41. wayfinder_paths/core/wallets/README.md +1 -1
  42. wayfinder_paths/run_strategy.py +8 -17
  43. wayfinder_paths/scripts/create_strategy.py +5 -5
  44. wayfinder_paths/scripts/make_wallets.py +5 -5
  45. wayfinder_paths/scripts/run_strategy.py +3 -3
  46. wayfinder_paths/strategies/basis_trading_strategy/snapshot_mixin.py +1 -1
  47. wayfinder_paths/strategies/basis_trading_strategy/strategy.py +206 -526
  48. wayfinder_paths/strategies/basis_trading_strategy/test_strategy.py +228 -11
  49. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/README.md +2 -2
  50. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/strategy.py +41 -25
  51. wayfinder_paths/strategies/hyperlend_stable_yield_strategy/test_strategy.py +54 -9
  52. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/README.md +1 -1
  53. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/strategy.py +10 -9
  54. wayfinder_paths/strategies/moonwell_wsteth_loop_strategy/test_strategy.py +12 -6
  55. wayfinder_paths/strategies/stablecoin_yield_strategy/README.md +3 -3
  56. wayfinder_paths/strategies/stablecoin_yield_strategy/strategy.py +110 -78
  57. wayfinder_paths/strategies/stablecoin_yield_strategy/test_strategy.py +44 -21
  58. wayfinder_paths/templates/adapter/README.md +1 -1
  59. wayfinder_paths/templates/strategy/README.md +3 -3
  60. wayfinder_paths/templates/strategy/test_strategy.py +3 -2
  61. {wayfinder_paths-0.1.11.dist-info → wayfinder_paths-0.1.14.dist-info}/METADATA +21 -59
  62. {wayfinder_paths-0.1.11.dist-info → wayfinder_paths-0.1.14.dist-info}/RECORD +64 -65
  63. wayfinder_paths/core/clients/AuthClient.py +0 -83
  64. wayfinder_paths/core/settings.py +0 -61
  65. {wayfinder_paths-0.1.11.dist-info → wayfinder_paths-0.1.14.dist-info}/LICENSE +0 -0
  66. {wayfinder_paths-0.1.11.dist-info → wayfinder_paths-0.1.14.dist-info}/WHEEL +0 -0
@@ -4,7 +4,7 @@ Protocol definitions for API clients.
4
4
  These protocols define the interface that all client implementations must satisfy.
5
5
  When used as an SDK, users can provide custom implementations that match these protocols.
6
6
 
7
- Note: AuthClient is excluded as SDK users handle their own authentication.
7
+ Note: Authentication is handled via X-API-KEY header in WayfinderClient base class.
8
8
  """
9
9
 
10
10
  from __future__ import annotations
@@ -12,20 +12,19 @@ from __future__ import annotations
12
12
  from typing import TYPE_CHECKING, Any, Protocol
13
13
 
14
14
  if TYPE_CHECKING:
15
- from wayfinder_paths.core.clients.BRAPClient import BRAPQuote
15
+ from wayfinder_paths.core.clients.BRAPClient import BRAPQuoteResponse
16
16
  from wayfinder_paths.core.clients.HyperlendClient import (
17
17
  AssetsView,
18
18
  LendRateHistory,
19
19
  MarketEntry,
20
- StableMarket,
20
+ StableMarketsHeadroomResponse,
21
21
  )
22
22
  from wayfinder_paths.core.clients.LedgerClient import (
23
23
  StrategyTransactionList,
24
24
  TransactionRecord,
25
25
  )
26
26
  from wayfinder_paths.core.clients.PoolClient import (
27
- LlamaMatch,
28
- LlamaReport,
27
+ LlamaMatchesResponse,
29
28
  PoolList,
30
29
  )
31
30
  from wayfinder_paths.core.clients.TokenClient import (
@@ -33,8 +32,7 @@ if TYPE_CHECKING:
33
32
  TokenDetails,
34
33
  )
35
34
  from wayfinder_paths.core.clients.WalletClient import (
36
- PoolBalance,
37
- TokenBalance,
35
+ AddressBalance,
38
36
  )
39
37
 
40
38
 
@@ -42,7 +40,10 @@ class TokenClientProtocol(Protocol):
42
40
  """Protocol for token-related operations"""
43
41
 
44
42
  async def get_token_details(
45
- self, token_id: str, force_refresh: bool = False
43
+ self,
44
+ query: str,
45
+ market_data: bool = True,
46
+ chain_id: int | None = None,
46
47
  ) -> TokenDetails:
47
48
  """Get token data including price from the token-details endpoint"""
48
49
  ...
@@ -58,19 +59,16 @@ class HyperlendClientProtocol(Protocol):
58
59
  async def get_stable_markets(
59
60
  self,
60
61
  *,
61
- chain_id: int,
62
62
  required_underlying_tokens: float | None = None,
63
63
  buffer_bps: int | None = None,
64
64
  min_buffer_tokens: float | None = None,
65
- is_stable_symbol: bool | None = None,
66
- ) -> list[StableMarket]:
67
- """Fetch stable markets from Hyperlend"""
65
+ ) -> StableMarketsHeadroomResponse:
66
+ """Fetch stable markets headroom from Hyperlend"""
68
67
  ...
69
68
 
70
69
  async def get_assets_view(
71
70
  self,
72
71
  *,
73
- chain_id: int,
74
72
  user_address: str,
75
73
  ) -> AssetsView:
76
74
  """Fetch assets view for a user address from Hyperlend"""
@@ -79,8 +77,7 @@ class HyperlendClientProtocol(Protocol):
79
77
  async def get_market_entry(
80
78
  self,
81
79
  *,
82
- chain_id: int,
83
- token_address: str,
80
+ token: str,
84
81
  ) -> MarketEntry:
85
82
  """Fetch market entry from Hyperlend"""
86
83
  ...
@@ -88,9 +85,9 @@ class HyperlendClientProtocol(Protocol):
88
85
  async def get_lend_rate_history(
89
86
  self,
90
87
  *,
91
- chain_id: int,
92
- token_address: str,
88
+ token: str,
93
89
  lookback_hours: int,
90
+ force_refresh: bool | None = None,
94
91
  ) -> LendRateHistory:
95
92
  """Fetch lend rate history from Hyperlend"""
96
93
  ...
@@ -162,25 +159,14 @@ class LedgerClientProtocol(Protocol):
162
159
  class WalletClientProtocol(Protocol):
163
160
  """Protocol for wallet-related operations"""
164
161
 
165
- async def get_token_balance_for_wallet(
162
+ async def get_token_balance_for_address(
166
163
  self,
167
164
  *,
168
- token_id: str,
169
165
  wallet_address: str,
170
- human_readable: bool = True,
171
- ) -> TokenBalance:
172
- """Fetch a single token balance for an explicit wallet address"""
173
- ...
174
-
175
- async def get_pool_balance_for_wallet(
176
- self,
177
- *,
178
- pool_address: str,
179
- chain_id: int,
180
- user_address: str,
181
- human_readable: bool = True,
182
- ) -> PoolBalance:
183
- """Fetch a wallet's LP/share balance for a given pool address and chain"""
166
+ query: str,
167
+ chain_id: int | None = None,
168
+ ) -> AddressBalance:
169
+ """Fetch a balance for an address + chain + query (supports compound query formats)"""
184
170
  ...
185
171
 
186
172
 
@@ -190,18 +176,18 @@ class PoolClientProtocol(Protocol):
190
176
  async def get_pools_by_ids(
191
177
  self,
192
178
  *,
193
- pool_ids: str,
194
- merge_external: bool | None = None,
179
+ pool_ids: list[str] | str,
195
180
  ) -> PoolList:
196
- """Fetch pools by comma-separated pool ids"""
181
+ """Fetch pools by pool IDs (list or comma-separated string)"""
197
182
  ...
198
183
 
199
- async def get_llama_matches(self) -> dict[str, LlamaMatch]:
200
- """Fetch Llama matches for pools"""
201
- ...
202
-
203
- async def get_llama_reports(self, *, identifiers: str) -> dict[str, LlamaReport]:
204
- """Fetch Llama reports using identifiers"""
184
+ async def get_pools(
185
+ self,
186
+ *,
187
+ chain_id: int | None = None,
188
+ project: str | None = None,
189
+ ) -> LlamaMatchesResponse:
190
+ """Fetch pools (optionally filtered by chain_id and project)"""
205
191
  ...
206
192
 
207
193
 
@@ -211,16 +197,13 @@ class BRAPClientProtocol(Protocol):
211
197
  async def get_quote(
212
198
  self,
213
199
  *,
214
- from_token_address: str,
215
- to_token_address: str,
216
- from_chain_id: int,
217
- to_chain_id: int,
218
- from_address: str,
219
- to_address: str,
220
- amount1: str,
221
- slippage: float | None = None,
222
- wayfinder_fee: float | None = None,
223
- ) -> BRAPQuote:
200
+ from_token: str,
201
+ to_token: str,
202
+ from_chain: int,
203
+ to_chain: int,
204
+ from_wallet: str,
205
+ from_amount: str,
206
+ ) -> BRAPQuoteResponse:
224
207
  """Get a quote for a bridge/swap operation"""
225
208
  ...
226
209
 
@@ -38,59 +38,74 @@ class MockHyperlendClient:
38
38
  async def get_stable_markets(
39
39
  self,
40
40
  *,
41
- chain_id: int,
42
41
  required_underlying_tokens: float | None = None,
43
42
  buffer_bps: int | None = None,
44
43
  min_buffer_tokens: float | None = None,
45
- is_stable_symbol: bool | None = None,
46
44
  ) -> dict[str, Any]:
47
45
  return {
48
- "markets": [
49
- {
50
- "chain_id": chain_id,
51
- "token_address": "0xMockToken",
46
+ "markets": {
47
+ "0xMockToken": {
52
48
  "symbol": "USDC",
53
- "lend_rate": 0.05,
54
- "available_liquidity": 1000000.0,
49
+ "symbol_canonical": "usdc",
50
+ "display_symbol": "USDC",
51
+ "reserve": {},
52
+ "decimals": 6,
53
+ "headroom": 1000000000000,
54
+ "supply_cap": 5000000000000,
55
55
  }
56
- ]
56
+ },
57
+ "notes": [],
57
58
  }
58
59
 
59
60
  async def get_assets_view(
60
61
  self,
61
62
  *,
62
- chain_id: int,
63
63
  user_address: str,
64
64
  ) -> dict[str, Any]:
65
65
  return {
66
- "user_address": user_address,
67
- "chain_id": chain_id,
66
+ "block_number": 12345,
67
+ "user": user_address,
68
+ "native_balance_wei": 0,
69
+ "native_balance": 0.0,
68
70
  "assets": [],
71
+ "account_data": {
72
+ "total_collateral_base": 0,
73
+ "total_debt_base": 0,
74
+ "available_borrows_base": 0,
75
+ "current_liquidation_threshold": 0,
76
+ "ltv": 0,
77
+ "health_factor_wad": 0,
78
+ "health_factor": 0.0,
79
+ },
80
+ "base_currency_info": {
81
+ "marketReferenceCurrencyUnit": 100000000,
82
+ "marketReferenceCurrencyPriceInUsd": 100000000,
83
+ "networkBaseTokenPriceInUsd": 0,
84
+ "networkBaseTokenPriceDecimals": 8,
85
+ },
69
86
  }
70
87
 
71
88
  async def get_market_entry(
72
89
  self,
73
90
  *,
74
- chain_id: int,
75
- token_address: str,
91
+ token: str,
76
92
  ) -> dict[str, Any]:
77
93
  return {
78
- "chain_id": chain_id,
79
- "token_address": token_address,
80
- "market_data": {},
94
+ "symbol": "USDC",
95
+ "symbol_canonical": "usdc",
96
+ "display_symbol": "USDC",
97
+ "reserve": {},
81
98
  }
82
99
 
83
100
  async def get_lend_rate_history(
84
101
  self,
85
102
  *,
86
- chain_id: int,
87
- token_address: str,
103
+ token: str,
88
104
  lookback_hours: int,
105
+ force_refresh: bool | None = None,
89
106
  ) -> dict[str, Any]:
90
107
  return {
91
- "chain_id": chain_id,
92
- "token_address": token_address,
93
- "rates": [],
108
+ "history": [],
94
109
  }
95
110
 
96
111