wayfinder-paths 0.1.3__py3-none-any.whl → 0.1.5__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.
- wayfinder_paths/CONFIG_GUIDE.md +37 -32
- wayfinder_paths/__init__.py +3 -3
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/README.md +12 -12
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/adapter.py +12 -11
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/examples.json +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/balance_adapter/test_adapter.py +12 -6
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/README.md +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/adapter.py +30 -23
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/test_adapter.py +2 -2
- wayfinder_paths/adapters/hyperlend_adapter/__init__.py +7 -0
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/adapter.py +33 -26
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/hyperlend_adapter/test_adapter.py +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/README.md +27 -40
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/adapter.py +78 -75
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/examples.json +10 -4
- wayfinder_paths/adapters/ledger_adapter/manifest.yaml +11 -0
- wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/test_adapter.py +33 -28
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/README.md +2 -14
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/adapter.py +12 -19
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/test_adapter.py +2 -2
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/README.md +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/adapter.py +8 -4
- wayfinder_paths/adapters/token_adapter/examples.json +26 -0
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/adapters → adapters}/token_adapter/test_adapter.py +1 -1
- wayfinder_paths/config.example.json +3 -1
- wayfinder_paths/core/__init__.py +3 -3
- wayfinder_paths/core/adapters/BaseAdapter.py +20 -3
- wayfinder_paths/core/adapters/models.py +41 -0
- wayfinder_paths/core/clients/BRAPClient.py +21 -2
- wayfinder_paths/core/clients/ClientManager.py +42 -63
- wayfinder_paths/core/clients/HyperlendClient.py +46 -5
- wayfinder_paths/core/clients/LedgerClient.py +350 -124
- wayfinder_paths/core/clients/PoolClient.py +51 -19
- wayfinder_paths/core/clients/SimulationClient.py +16 -4
- wayfinder_paths/core/clients/TokenClient.py +34 -18
- wayfinder_paths/core/clients/TransactionClient.py +18 -2
- wayfinder_paths/core/clients/WalletClient.py +35 -4
- wayfinder_paths/core/clients/WayfinderClient.py +16 -5
- wayfinder_paths/core/clients/protocols.py +69 -62
- wayfinder_paths/core/clients/sdk_example.py +0 -5
- wayfinder_paths/core/config.py +192 -103
- wayfinder_paths/core/constants/base.py +17 -0
- wayfinder_paths/core/engine/{VaultJob.py → StrategyJob.py} +25 -19
- wayfinder_paths/core/engine/__init__.py +2 -2
- wayfinder_paths/core/engine/manifest.py +1 -1
- wayfinder_paths/core/services/base.py +6 -4
- wayfinder_paths/core/services/local_evm_txn.py +3 -2
- wayfinder_paths/core/settings.py +2 -2
- wayfinder_paths/core/strategies/Strategy.py +123 -37
- wayfinder_paths/core/utils/evm_helpers.py +12 -10
- wayfinder_paths/core/wallets/README.md +3 -3
- wayfinder_paths/core/wallets/WalletManager.py +3 -3
- wayfinder_paths/{vaults/policies → policies}/enso.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/hyper_evm.py +2 -2
- wayfinder_paths/{vaults/policies → policies}/hyperlend.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/moonwell.py +1 -1
- wayfinder_paths/{vaults/policies → policies}/prjx.py +1 -1
- wayfinder_paths/run_strategy.py +29 -27
- wayfinder_paths/scripts/create_strategy.py +3 -3
- wayfinder_paths/scripts/make_wallets.py +6 -6
- wayfinder_paths/scripts/validate_manifests.py +2 -2
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/README.md +10 -9
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/strategy.py +47 -167
- wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/test_strategy.py +10 -8
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/README.md +15 -14
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/manifest.yaml +2 -2
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/strategy.py +97 -97
- wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/test_strategy.py +8 -8
- wayfinder_paths/{vaults/templates → templates}/adapter/README.md +5 -5
- wayfinder_paths/{vaults/templates → templates}/adapter/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/adapter/test_adapter.py +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/README.md +10 -9
- wayfinder_paths/{vaults/templates → templates}/strategy/manifest.yaml +1 -1
- wayfinder_paths/{vaults/templates → templates}/strategy/test_strategy.py +8 -8
- wayfinder_paths/tests/test_test_coverage.py +5 -5
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/METADATA +146 -69
- wayfinder_paths-0.1.5.dist-info/RECORD +126 -0
- wayfinder_paths/vaults/adapters/hyperlend_adapter/__init__.py +0 -7
- wayfinder_paths/vaults/adapters/ledger_adapter/manifest.yaml +0 -11
- wayfinder_paths/vaults/adapters/token_adapter/examples.json +0 -26
- wayfinder_paths/vaults/strategies/__init__.py +0 -0
- wayfinder_paths-0.1.3.dist-info/RECORD +0 -126
- /wayfinder_paths/{vaults → adapters}/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/brap_adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/ledger_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/pool_adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/adapters → adapters}/token_adapter/__init__.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/erc20.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/evm.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/hyperliquid.py +0 -0
- /wayfinder_paths/{vaults/policies → policies}/util.py +0 -0
- /wayfinder_paths/{vaults/adapters → strategies}/__init__.py +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/config.py +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/hyperlend_stable_yield_strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/strategies → strategies}/stablecoin_yield_strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/adapter/adapter.py +0 -0
- /wayfinder_paths/{vaults/templates → templates}/adapter/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/strategy/examples.json +0 -0
- /wayfinder_paths/{vaults/templates → templates}/strategy/strategy.py +0 -0
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/LICENSE +0 -0
- {wayfinder_paths-0.1.3.dist-info → wayfinder_paths-0.1.5.dist-info}/WHEEL +0 -0
|
@@ -28,7 +28,7 @@ from wayfinder_paths.core.clients.WalletClient import WalletClient
|
|
|
28
28
|
|
|
29
29
|
class ClientManager:
|
|
30
30
|
"""
|
|
31
|
-
Manages all API client instances for a
|
|
31
|
+
Manages all API client instances for a strategy job.
|
|
32
32
|
|
|
33
33
|
Args:
|
|
34
34
|
clients: Optional dict of pre-instantiated clients to inject directly.
|
|
@@ -66,6 +66,33 @@ class ClientManager:
|
|
|
66
66
|
self._brap_client: BRAPClientProtocol | None = None
|
|
67
67
|
self._simulation_client: SimulationClientProtocol | None = None
|
|
68
68
|
|
|
69
|
+
def _get_or_create_client(
|
|
70
|
+
self,
|
|
71
|
+
client_attr: str,
|
|
72
|
+
injected_key: str,
|
|
73
|
+
client_class: type[Any],
|
|
74
|
+
) -> Any:
|
|
75
|
+
"""
|
|
76
|
+
Helper method to get or create a client instance.
|
|
77
|
+
|
|
78
|
+
Args:
|
|
79
|
+
client_attr: Name of the private attribute storing the client (e.g., "_token_client").
|
|
80
|
+
injected_key: Key to look up in _injected_clients dict.
|
|
81
|
+
client_class: Client class to instantiate if not injected.
|
|
82
|
+
|
|
83
|
+
Returns:
|
|
84
|
+
Client instance.
|
|
85
|
+
"""
|
|
86
|
+
client = getattr(self, client_attr)
|
|
87
|
+
if not client:
|
|
88
|
+
client = self._injected_clients.get(injected_key) or client_class(
|
|
89
|
+
api_key=self._api_key
|
|
90
|
+
)
|
|
91
|
+
setattr(self, client_attr, client)
|
|
92
|
+
if self._access_token and hasattr(client, "set_bearer_token"):
|
|
93
|
+
client.set_bearer_token(self._access_token)
|
|
94
|
+
return client
|
|
95
|
+
|
|
69
96
|
@property
|
|
70
97
|
def auth(self) -> AuthClient | None:
|
|
71
98
|
"""Get or create auth client. Returns None if skip_auth=True."""
|
|
@@ -80,96 +107,48 @@ class ClientManager:
|
|
|
80
107
|
@property
|
|
81
108
|
def token(self) -> TokenClientProtocol:
|
|
82
109
|
"""Get or create token client"""
|
|
83
|
-
|
|
84
|
-
self._token_client = self._injected_clients.get("token") or TokenClient(
|
|
85
|
-
api_key=self._api_key
|
|
86
|
-
)
|
|
87
|
-
if self._access_token and hasattr(self._token_client, "set_bearer_token"):
|
|
88
|
-
self._token_client.set_bearer_token(self._access_token)
|
|
89
|
-
return self._token_client
|
|
110
|
+
return self._get_or_create_client("_token_client", "token", TokenClient)
|
|
90
111
|
|
|
91
112
|
@property
|
|
92
113
|
def transaction(self) -> TransactionClientProtocol:
|
|
93
114
|
"""Get or create transaction client"""
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
) or TransactionClient(api_key=self._api_key)
|
|
98
|
-
if self._access_token and hasattr(
|
|
99
|
-
self._transaction_client, "set_bearer_token"
|
|
100
|
-
):
|
|
101
|
-
self._transaction_client.set_bearer_token(self._access_token)
|
|
102
|
-
return self._transaction_client
|
|
115
|
+
return self._get_or_create_client(
|
|
116
|
+
"_transaction_client", "transaction", TransactionClient
|
|
117
|
+
)
|
|
103
118
|
|
|
104
119
|
@property
|
|
105
120
|
def ledger(self) -> LedgerClientProtocol:
|
|
106
121
|
"""Get or create ledger client"""
|
|
107
|
-
|
|
108
|
-
self._ledger_client = self._injected_clients.get("ledger") or LedgerClient(
|
|
109
|
-
api_key=self._api_key
|
|
110
|
-
)
|
|
111
|
-
if self._access_token and hasattr(self._ledger_client, "set_bearer_token"):
|
|
112
|
-
self._ledger_client.set_bearer_token(self._access_token)
|
|
113
|
-
return self._ledger_client
|
|
122
|
+
return self._get_or_create_client("_ledger_client", "ledger", LedgerClient)
|
|
114
123
|
|
|
115
124
|
@property
|
|
116
125
|
def pool(self) -> PoolClientProtocol:
|
|
117
126
|
"""Get or create pool client"""
|
|
118
|
-
|
|
119
|
-
self._pool_client = self._injected_clients.get("pool") or PoolClient(
|
|
120
|
-
api_key=self._api_key
|
|
121
|
-
)
|
|
122
|
-
if self._access_token and hasattr(self._pool_client, "set_bearer_token"):
|
|
123
|
-
self._pool_client.set_bearer_token(self._access_token)
|
|
124
|
-
return self._pool_client
|
|
127
|
+
return self._get_or_create_client("_pool_client", "pool", PoolClient)
|
|
125
128
|
|
|
126
129
|
@property
|
|
127
130
|
def hyperlend(self) -> HyperlendClientProtocol:
|
|
128
131
|
"""Get or create hyperlend client"""
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
) or HyperlendClient(api_key=self._api_key)
|
|
133
|
-
if self._access_token and hasattr(
|
|
134
|
-
self._hyperlend_client, "set_bearer_token"
|
|
135
|
-
):
|
|
136
|
-
self._hyperlend_client.set_bearer_token(self._access_token)
|
|
137
|
-
return self._hyperlend_client
|
|
132
|
+
return self._get_or_create_client(
|
|
133
|
+
"_hyperlend_client", "hyperlend", HyperlendClient
|
|
134
|
+
)
|
|
138
135
|
|
|
139
136
|
@property
|
|
140
137
|
def wallet(self) -> WalletClientProtocol:
|
|
141
138
|
"""Get or create wallet client"""
|
|
142
|
-
|
|
143
|
-
self._wallet_client = self._injected_clients.get("wallet") or WalletClient(
|
|
144
|
-
api_key=self._api_key
|
|
145
|
-
)
|
|
146
|
-
if self._access_token and hasattr(self._wallet_client, "set_bearer_token"):
|
|
147
|
-
self._wallet_client.set_bearer_token(self._access_token)
|
|
148
|
-
return self._wallet_client
|
|
139
|
+
return self._get_or_create_client("_wallet_client", "wallet", WalletClient)
|
|
149
140
|
|
|
150
141
|
@property
|
|
151
142
|
def brap(self) -> BRAPClientProtocol:
|
|
152
143
|
"""Get or create BRAP client"""
|
|
153
|
-
|
|
154
|
-
self._brap_client = self._injected_clients.get("brap") or BRAPClient(
|
|
155
|
-
api_key=self._api_key
|
|
156
|
-
)
|
|
157
|
-
if self._access_token and hasattr(self._brap_client, "set_bearer_token"):
|
|
158
|
-
self._brap_client.set_bearer_token(self._access_token)
|
|
159
|
-
return self._brap_client
|
|
144
|
+
return self._get_or_create_client("_brap_client", "brap", BRAPClient)
|
|
160
145
|
|
|
161
146
|
@property
|
|
162
147
|
def simulation(self) -> SimulationClientProtocol:
|
|
163
148
|
"""Get or create simulation client"""
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
) or SimulationClient(api_key=self._api_key)
|
|
168
|
-
if self._access_token and hasattr(
|
|
169
|
-
self._simulation_client, "set_bearer_token"
|
|
170
|
-
):
|
|
171
|
-
self._simulation_client.set_bearer_token(self._access_token)
|
|
172
|
-
return self._simulation_client
|
|
149
|
+
return self._get_or_create_client(
|
|
150
|
+
"_simulation_client", "simulation", SimulationClient
|
|
151
|
+
)
|
|
173
152
|
|
|
174
153
|
async def authenticate(
|
|
175
154
|
self,
|
|
@@ -3,12 +3,53 @@ Hyperlend Client
|
|
|
3
3
|
Provides access to Hyperlend stable markets data via public endpoints.
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
-
from
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
8
|
+
from typing import Any, NotRequired, Required, TypedDict
|
|
7
9
|
|
|
8
10
|
from wayfinder_paths.core.clients.WayfinderClient import WayfinderClient
|
|
9
11
|
from wayfinder_paths.core.settings import settings
|
|
10
12
|
|
|
11
13
|
|
|
14
|
+
class StableMarket(TypedDict):
|
|
15
|
+
"""Stable market data structure"""
|
|
16
|
+
|
|
17
|
+
chain_id: Required[int]
|
|
18
|
+
token_address: Required[str]
|
|
19
|
+
symbol: Required[str]
|
|
20
|
+
name: Required[str]
|
|
21
|
+
underlying_tokens: Required[float]
|
|
22
|
+
buffer_bps: Required[int]
|
|
23
|
+
min_buffer_tokens: Required[float]
|
|
24
|
+
is_stable_symbol: Required[bool]
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
class AssetsView(TypedDict):
|
|
28
|
+
"""Assets view response structure"""
|
|
29
|
+
|
|
30
|
+
chain_id: Required[int]
|
|
31
|
+
user_address: Required[str]
|
|
32
|
+
assets: Required[list[dict[str, Any]]]
|
|
33
|
+
total_value: NotRequired[float | None]
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class MarketEntry(TypedDict):
|
|
37
|
+
"""Market entry data structure"""
|
|
38
|
+
|
|
39
|
+
chain_id: Required[int]
|
|
40
|
+
token_address: Required[str]
|
|
41
|
+
market_data: Required[dict[str, Any]]
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class LendRateHistory(TypedDict):
|
|
45
|
+
"""Lend rate history response structure"""
|
|
46
|
+
|
|
47
|
+
chain_id: Required[int]
|
|
48
|
+
token_address: Required[str]
|
|
49
|
+
lookback_hours: Required[int]
|
|
50
|
+
rates: Required[list[dict[str, Any]]]
|
|
51
|
+
|
|
52
|
+
|
|
12
53
|
class HyperlendClient(WayfinderClient):
|
|
13
54
|
"""Client for Hyperlend-related operations"""
|
|
14
55
|
|
|
@@ -24,7 +65,7 @@ class HyperlendClient(WayfinderClient):
|
|
|
24
65
|
buffer_bps: int | None = None,
|
|
25
66
|
min_buffer_tokens: float | None = None,
|
|
26
67
|
is_stable_symbol: bool | None = None,
|
|
27
|
-
) ->
|
|
68
|
+
) -> list[StableMarket]:
|
|
28
69
|
"""
|
|
29
70
|
Fetch stable markets from Hyperlend.
|
|
30
71
|
|
|
@@ -62,7 +103,7 @@ class HyperlendClient(WayfinderClient):
|
|
|
62
103
|
*,
|
|
63
104
|
chain_id: int,
|
|
64
105
|
user_address: str,
|
|
65
|
-
) ->
|
|
106
|
+
) -> AssetsView:
|
|
66
107
|
"""
|
|
67
108
|
Fetch assets view for a user address from Hyperlend.
|
|
68
109
|
|
|
@@ -92,7 +133,7 @@ class HyperlendClient(WayfinderClient):
|
|
|
92
133
|
*,
|
|
93
134
|
chain_id: int,
|
|
94
135
|
token_address: str,
|
|
95
|
-
) ->
|
|
136
|
+
) -> MarketEntry:
|
|
96
137
|
"""
|
|
97
138
|
Fetch market entry from Hyperlend.
|
|
98
139
|
|
|
@@ -123,7 +164,7 @@ class HyperlendClient(WayfinderClient):
|
|
|
123
164
|
chain_id: int,
|
|
124
165
|
token_address: str,
|
|
125
166
|
lookback_hours: int,
|
|
126
|
-
) ->
|
|
167
|
+
) -> LendRateHistory:
|
|
127
168
|
"""
|
|
128
169
|
Fetch lend rate history from Hyperlend.
|
|
129
170
|
|