wayfinder-paths 0.1.20__py3-none-any.whl → 0.1.22__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.

@@ -5,8 +5,8 @@ from wayfinder_paths.adapters.token_adapter.adapter import TokenAdapter
5
5
  from wayfinder_paths.core.adapters.BaseAdapter import BaseAdapter
6
6
  from wayfinder_paths.core.clients.TokenClient import TokenClient
7
7
  from wayfinder_paths.core.clients.WalletClient import WalletClient
8
- from wayfinder_paths.core.utils.erc20_service import build_send_transaction
9
8
  from wayfinder_paths.core.utils.evm_helpers import resolve_chain_id
9
+ from wayfinder_paths.core.utils.tokens import build_send_transaction
10
10
  from wayfinder_paths.core.utils.transaction import send_transaction
11
11
 
12
12
 
@@ -15,7 +15,7 @@ from wayfinder_paths.core.clients.BRAPClient import (
15
15
  from wayfinder_paths.core.clients.LedgerClient import TransactionRecord
16
16
  from wayfinder_paths.core.clients.TokenClient import TokenClient
17
17
  from wayfinder_paths.core.constants import DEFAULT_SLIPPAGE, ZERO_ADDRESS
18
- from wayfinder_paths.core.utils.erc20_service import (
18
+ from wayfinder_paths.core.utils.tokens import (
19
19
  build_approve_transaction,
20
20
  get_token_allowance,
21
21
  )
@@ -16,7 +16,7 @@ from wayfinder_paths.core.constants.hyperlend_abi import (
16
16
  POOL_ABI,
17
17
  WRAPPED_TOKEN_GATEWAY_ABI,
18
18
  )
19
- from wayfinder_paths.core.utils.erc20_service import (
19
+ from wayfinder_paths.core.utils.tokens import (
20
20
  build_approve_transaction,
21
21
  get_token_allowance,
22
22
  )
@@ -14,7 +14,7 @@ from wayfinder_paths.core.constants.moonwell_abi import (
14
14
  REWARD_DISTRIBUTOR_ABI,
15
15
  WETH_ABI,
16
16
  )
17
- from wayfinder_paths.core.utils.erc20_service import (
17
+ from wayfinder_paths.core.utils.tokens import (
18
18
  build_approve_transaction,
19
19
  get_token_allowance,
20
20
  )
@@ -3,7 +3,7 @@ from web3 import AsyncWeb3
3
3
  from wayfinder_paths.core.constants.erc20_abi import ERC20_ABI
4
4
  from wayfinder_paths.core.utils.web3 import web3_from_chain_id
5
5
 
6
- NATIVE_CURRENCY_ADDRESSES: set = {
6
+ NATIVE_TOKEN_ADDRESSES: set = {
7
7
  "0x0000000000000000000000000000000000000000",
8
8
  "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",
9
9
  # TODO: This is not a proper SOL address, this short form is for LIFI only, fix this after fixing lifi
@@ -12,21 +12,26 @@ NATIVE_CURRENCY_ADDRESSES: set = {
12
12
  }
13
13
 
14
14
 
15
+ def is_native_token(token_address: str) -> bool:
16
+ return token_address.lower() in NATIVE_TOKEN_ADDRESSES
17
+
18
+
15
19
  async def get_token_balance(
16
20
  token_address: str, chain_id: int, wallet_address: str
17
21
  ) -> int:
18
22
  async with web3_from_chain_id(chain_id) as web3:
19
23
  checksum_wallet = AsyncWeb3.to_checksum_address(wallet_address)
20
- if not token_address or token_address.lower() in NATIVE_CURRENCY_ADDRESSES:
24
+
25
+ if is_native_token(token_address):
21
26
  balance = await web3.eth.get_balance(checksum_wallet)
22
27
  return int(balance)
23
-
24
- checksum_token = AsyncWeb3.to_checksum_address(token_address)
25
- contract = web3.eth.contract(address=checksum_token, abi=ERC20_ABI)
26
- balance = await contract.functions.balanceOf(checksum_wallet).call(
27
- block_identifier="pending"
28
- )
29
- return int(balance)
28
+ else:
29
+ checksum_token = AsyncWeb3.to_checksum_address(token_address)
30
+ contract = web3.eth.contract(address=checksum_token, abi=ERC20_ABI)
31
+ balance = await contract.functions.balanceOf(checksum_wallet).call(
32
+ block_identifier="pending"
33
+ )
34
+ return int(balance)
30
35
 
31
36
 
32
37
  async def get_token_allowance(
@@ -79,21 +84,21 @@ async def build_send_transaction(
79
84
  from_checksum = web3.to_checksum_address(from_address)
80
85
  to_checksum = web3.to_checksum_address(to_address)
81
86
 
82
- if not token_address or token_address.lower() in NATIVE_CURRENCY_ADDRESSES:
87
+ if is_native_token(token_address):
83
88
  return {
84
89
  "to": to_checksum,
85
90
  "from": from_checksum,
86
91
  "value": amount,
87
92
  "chainId": chain_id,
88
93
  }
94
+ else:
95
+ token_checksum = web3.to_checksum_address(token_address)
96
+ contract = web3.eth.contract(address=token_checksum, abi=ERC20_ABI)
97
+ data = contract.encode_abi("transfer", [to_checksum, amount])
89
98
 
90
- token_checksum = web3.to_checksum_address(token_address)
91
- contract = web3.eth.contract(address=token_checksum, abi=ERC20_ABI)
92
- data = contract.encode_abi("transfer", [to_checksum, amount])
93
-
94
- return {
95
- "to": token_checksum,
96
- "from": from_checksum,
97
- "data": data,
98
- "chainId": chain_id,
99
- }
99
+ return {
100
+ "to": token_checksum,
101
+ "from": from_checksum,
102
+ "data": data,
103
+ "chainId": chain_id,
104
+ }
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.3
1
+ Metadata-Version: 2.1
2
2
  Name: wayfinder-paths
3
- Version: 0.1.20
3
+ Version: 0.1.22
4
4
  Summary: Wayfinder Path: strategies and adapters
5
5
  Author: Wayfinder
6
6
  Author-email: dev@wayfinder.ai
@@ -1,16 +1,16 @@
1
1
  wayfinder_paths/__init__.py,sha256=xKU94QbtPMmpY-Y3ktZfHwC7Rgaspl69GE8a8LQdAHs,337
2
2
  wayfinder_paths/adapters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
3
3
  wayfinder_paths/adapters/balance_adapter/README.md,sha256=mq4cSYrrW5TNcXKnGBg9PwQcjCYZtXFNzEAfNGYumb8,2402
4
- wayfinder_paths/adapters/balance_adapter/adapter.py,sha256=bOPWOr11IfDPnTg5J6hQQ1wI2gyRlxJ_-qTn6o48aBg,10091
4
+ wayfinder_paths/adapters/balance_adapter/adapter.py,sha256=VrttK4gyZQbszU2qLYYKQSEdx09tyAow88ukoYvHL4c,10084
5
5
  wayfinder_paths/adapters/balance_adapter/examples.json,sha256=3R1M4B_VsIy29viAuFT9nQbnQShWl8ZbU-rnSNWUW9U,129
6
6
  wayfinder_paths/adapters/balance_adapter/test_adapter.py,sha256=gf7WlA-RkMmSDP1jIYi0hUXkMfqfGTjzUZjQa9H07nU,5334
7
7
  wayfinder_paths/adapters/brap_adapter/README.md,sha256=u_UZNB3RBLAHrwklgd-ZPftNiIpIutzfH1FulJ4QB-Y,2673
8
8
  wayfinder_paths/adapters/brap_adapter/__init__.py,sha256=Hx4JW1tDijXS5YQhVliE0syw1RD1YKO2MM37wN_to9M,60
9
- wayfinder_paths/adapters/brap_adapter/adapter.py,sha256=yhiP54TjcS1cbbAH1Is6yQtFe9Esw1ZfxoXMa_5TBjw,26217
9
+ wayfinder_paths/adapters/brap_adapter/adapter.py,sha256=z_uGXGx8IHd2fBXZUbnjFeAwX5mZCrM1c46ToIDEhqM,26210
10
10
  wayfinder_paths/adapters/brap_adapter/examples.json,sha256=FGZhNaMCAQ56KhovEGSsV1BHOcMd_QqQBNmCU6m8zfQ,5389
11
11
  wayfinder_paths/adapters/brap_adapter/test_adapter.py,sha256=CmK8TUxmnf4IzExToJ68FgUyE4FB7B2IOeB6GF5-B0E,11361
12
12
  wayfinder_paths/adapters/hyperlend_adapter/__init__.py,sha256=IDgYOx5rF2Zd8DjZ_VzmZc6EUGS34SfIVQ_M1PdZ0YQ,112
13
- wayfinder_paths/adapters/hyperlend_adapter/adapter.py,sha256=MCQcp8m_-Wp6702B9BxSXNnT8lkPaZc95bAFDCxnnys,9632
13
+ wayfinder_paths/adapters/hyperlend_adapter/adapter.py,sha256=y7zy09-bkCiYTsE3E3-DoWe8A4ft4pHzuQ527oyxGFE,9625
14
14
  wayfinder_paths/adapters/hyperlend_adapter/test_adapter.py,sha256=f7YEJTT8o8FdN8OmDFuNYcIZRZ99kCAWcDHEFsgYFIQ,10884
15
15
  wayfinder_paths/adapters/hyperliquid_adapter/__init__.py,sha256=QpA258RzVbxzsha86HQduAuNVG0g0qvsI5OcZunQ8DQ,467
16
16
  wayfinder_paths/adapters/hyperliquid_adapter/adapter.py,sha256=GCI4up7fGuyiiYd_5zw00y497UdggjDSJ_G-ZhU_tgA,25217
@@ -28,7 +28,7 @@ wayfinder_paths/adapters/ledger_adapter/examples.json,sha256=DdqTSe4vnBrfIycQVQQ
28
28
  wayfinder_paths/adapters/ledger_adapter/test_adapter.py,sha256=haPVZQGL0f-vZPvNMUcfoq63Bu7F4FumVBuAJKiRmwg,6827
29
29
  wayfinder_paths/adapters/moonwell_adapter/README.md,sha256=A-xKZo4ssLh1-uJqlp9ihMrnlZ8hB-KW2e0MRH4pnhU,3036
30
30
  wayfinder_paths/adapters/moonwell_adapter/__init__.py,sha256=5wMDRIM6z0QbSqKEqaV8tUGkpwrAABqz1T0hP4YJbMg,109
31
- wayfinder_paths/adapters/moonwell_adapter/adapter.py,sha256=SdVA4_wXjL3NR3yql8jWOrm5zBuFGSrJA62PmCKLTD4,39525
31
+ wayfinder_paths/adapters/moonwell_adapter/adapter.py,sha256=V6qoIOQm7JZqPgJRE435Q7zJOHifNooSc0J_KTDbbQI,39518
32
32
  wayfinder_paths/adapters/moonwell_adapter/test_adapter.py,sha256=Uv9jtHJEifAZ_IUafo5e5tsNkjslAhFhnZqRkwmxXQ0,25391
33
33
  wayfinder_paths/adapters/pool_adapter/README.md,sha256=qxXNcTgxQ4-YEDC-ZHiQ5wTpV_76t-vK58vyDh0IBgU,1282
34
34
  wayfinder_paths/adapters/pool_adapter/__init__.py,sha256=LTbty0SuACoj3X5yeGESDUdtJQt8zyB2Loq8BuEp7rE,60
@@ -72,8 +72,8 @@ wayfinder_paths/core/strategies/__init__.py,sha256=r3v5Eriz5mb7vurIGxB-2Hzo4ZApG
72
72
  wayfinder_paths/core/strategies/base.py,sha256=-s0qeiGZl5CHTUL2PavGXM7ACkNlaa0c4jeZR_4DuBM,155
73
73
  wayfinder_paths/core/strategies/descriptors.py,sha256=2Olef0VWols1CWb-TWcb5pil2rztC0jP6F_Trpv2hIw,1958
74
74
  wayfinder_paths/core/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
75
- wayfinder_paths/core/utils/erc20_service.py,sha256=0epXzo2vUWwb6AXNyP0RLhQTwiwoDvlkuHd8wKL_a3g,3376
76
75
  wayfinder_paths/core/utils/evm_helpers.py,sha256=VIXDd_4uDrnttqqapoPGd1PCfmWzX1T_CsMZ1bPe77w,4147
76
+ wayfinder_paths/core/utils/tokens.py,sha256=G7hHILLaFKw88uA0W03Qoeb1bgY10Y5yWoxydoSNS3M,3488
77
77
  wayfinder_paths/core/utils/transaction.py,sha256=OC-hig-H9IeCLFh64Hal2y-Du7RCK2ka7KjBohEV17c,6729
78
78
  wayfinder_paths/core/utils/wallets.py,sha256=ccCQ128lDShO265AFMOCdijzPLucWe-Neg5wjLrOsnk,1948
79
79
  wayfinder_paths/core/utils/web3.py,sha256=r0vHvKvFC167MygHhmxr2nfYtLYN0ttSUEI--hPetO0,1877
@@ -123,7 +123,7 @@ wayfinder_paths/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3h
123
123
  wayfinder_paths/tests/test_smoke_manifest.py,sha256=kTcIa4qikcspVh2ohQIk0aHUdIvBvcQBfNbm3PNiVvg,1636
124
124
  wayfinder_paths/tests/test_test_coverage.py,sha256=paZd0U-J7oVDtkJ-DCBBEOHdupMRLsvs7WG5NrpAPRA,7203
125
125
  wayfinder_paths/tests/test_utils.py,sha256=VzweYVaO20deZOwR8RKGYFrDnKTW0gZLm3dBwZiMK28,1015
126
- wayfinder_paths-0.1.20.dist-info/LICENSE,sha256=dYKnlkC_xosBAEQNUvB6cHMuhFgcUtN0oBR7E8_aR2Y,1066
127
- wayfinder_paths-0.1.20.dist-info/METADATA,sha256=UOXIWLq5N7RxpkrvETfbIpa7oV3pY9vZY2UHDINLwVQ,11638
128
- wayfinder_paths-0.1.20.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
129
- wayfinder_paths-0.1.20.dist-info/RECORD,,
126
+ wayfinder_paths-0.1.22.dist-info/LICENSE,sha256=dYKnlkC_xosBAEQNUvB6cHMuhFgcUtN0oBR7E8_aR2Y,1066
127
+ wayfinder_paths-0.1.22.dist-info/METADATA,sha256=bnBEwR7ggclbH5QFvJ1C29UK3Vz0yswJ-vHNiner9fw,11638
128
+ wayfinder_paths-0.1.22.dist-info/WHEEL,sha256=Nq82e9rUAnEjt98J6MlVmMCZb-t9cYE2Ir1kpBmnWfs,88
129
+ wayfinder_paths-0.1.22.dist-info/RECORD,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 2.1.1
2
+ Generator: poetry-core 1.9.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any