xync-client 0.0.138__tar.gz → 0.0.141__tar.gz

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 xync-client might be problematic. Click here for more details.

Files changed (123) hide show
  1. {xync_client-0.0.138/xync_client.egg-info → xync_client-0.0.141}/PKG-INFO +1 -1
  2. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/PmAgent.py +16 -17
  3. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/ex.py +2 -2
  4. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/ex.py +2 -2
  5. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BitGet/ex.py +2 -2
  6. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/InAgent.py +6 -6
  7. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/agent.py +6 -6
  8. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/ex.py +2 -2
  9. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Gate/ex.py +2 -2
  10. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Gmail/__init__.py +4 -4
  11. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/ex.py +2 -2
  12. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/KuCoin/ex.py +2 -2
  13. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Mexc/ex.py +2 -2
  14. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Okx/ex.py +2 -2
  15. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Payeer/__init__.py +20 -5
  16. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Volet/__init__.py +90 -55
  17. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Volet/api.py +16 -13
  18. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/ex.py +2 -2
  19. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/loader.py +1 -1
  20. {xync_client-0.0.138 → xync_client-0.0.141/xync_client.egg-info}/PKG-INFO +1 -1
  21. {xync_client-0.0.138 → xync_client-0.0.141}/.env.sample +0 -0
  22. {xync_client-0.0.138 → xync_client-0.0.141}/.gitignore +0 -0
  23. {xync_client-0.0.138 → xync_client-0.0.141}/.pre-commit-config.yaml +0 -0
  24. {xync_client-0.0.138 → xync_client-0.0.141}/README.md +0 -0
  25. {xync_client-0.0.138 → xync_client-0.0.141}/__init__.py +0 -0
  26. {xync_client-0.0.138 → xync_client-0.0.141}/makefile +0 -0
  27. {xync_client-0.0.138 → xync_client-0.0.141}/pyproject.toml +0 -0
  28. {xync_client-0.0.138 → xync_client-0.0.141}/setup.cfg +0 -0
  29. {xync_client-0.0.138 → xync_client-0.0.141}/tests/TestAgent.py +0 -0
  30. {xync_client-0.0.138 → xync_client-0.0.141}/tests/TestAsset.py +0 -0
  31. {xync_client-0.0.138 → xync_client-0.0.141}/tests/TestEx.py +0 -0
  32. {xync_client-0.0.138 → xync_client-0.0.141}/tests/TestOrder.py +0 -0
  33. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Binance/test_binance.py +0 -0
  34. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Bybit/test_bybit.py +0 -0
  35. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Bybit/test_bybit_p2p.py +0 -0
  36. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Gate/test_gate.py +0 -0
  37. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Wallet/test_agent.py +0 -0
  38. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/Wallet/test_ex.py +0 -0
  39. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/__init__.py +0 -0
  40. {xync_client-0.0.138 → xync_client-0.0.141}/tests/_todo_refact/_test_ex.py +0 -0
  41. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Agent.py +0 -0
  42. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Asset.py +0 -0
  43. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Auth.py +0 -0
  44. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/BaseTest.py +0 -0
  45. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Ex.py +0 -0
  46. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Exception.py +0 -0
  47. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/InAgent.py +0 -0
  48. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/Order.py +0 -0
  49. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Abc/xtype.py +0 -0
  50. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/__init__.py +0 -0
  51. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/binance_async.py +0 -0
  52. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/earn_api.py +0 -0
  53. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/etype/ad.py +0 -0
  54. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/etype/pm.py +0 -0
  55. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/exceptions.py +0 -0
  56. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/sapi.py +0 -0
  57. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Binance/web_c2c.py +0 -0
  58. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/__init__.py +0 -0
  59. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/agent.py +0 -0
  60. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/base.py +0 -0
  61. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/etype/ad.py +0 -0
  62. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/etype/pm.py +0 -0
  63. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/req.mjs +0 -0
  64. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BingX/sign.js +0 -0
  65. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BitGet/__init__.py +0 -0
  66. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BitGet/agent.py +0 -0
  67. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BitGet/etype/ad.py +0 -0
  68. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/BitPapa/ex.py +0 -0
  69. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/etype/ad.py +0 -0
  70. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/etype/cred.py +0 -0
  71. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/etype/order.py +0 -0
  72. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/order.py +0 -0
  73. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/web_earn.py +0 -0
  74. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/web_p2p.py +0 -0
  75. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Bybit/ws.py +0 -0
  76. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Gate/etype/ad.py +0 -0
  77. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Gate/premarket.py +0 -0
  78. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/agent.py +0 -0
  79. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/earn.py +0 -0
  80. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/etype/__init__.py +0 -0
  81. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/etype/ad.py +0 -0
  82. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/etype/cred.py +0 -0
  83. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/etype/pm.py +0 -0
  84. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Htx/etype/test.py +0 -0
  85. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/KuCoin/etype/ad.py +0 -0
  86. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/KuCoin/etype/pm.py +0 -0
  87. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/KuCoin/web.py +0 -0
  88. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Mexc/etype/ad.py +0 -0
  89. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Mexc/etype/pm.py +0 -0
  90. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Okx/etype/ad.py +0 -0
  91. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Okx/etype/pm.py +0 -0
  92. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/.gitignore +0 -0
  93. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Alfa/__init__.py +0 -0
  94. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Alfa/state.json +0 -0
  95. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/MTS/__init__.py +0 -0
  96. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Ozon/__init__.py +0 -0
  97. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Payeer/.gitignore +0 -0
  98. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Payeer/api.py +0 -0
  99. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Payeer/login.py +0 -0
  100. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Sber/__init__.py +0 -0
  101. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Sber/utils.py +0 -0
  102. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Tinkoff/__init__.py +0 -0
  103. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Volet/_todo_req/req.mjs +0 -0
  104. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Volet/_todo_req/req.py +0 -0
  105. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Volet/pl.py +0 -0
  106. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Xync/__main__.py +0 -0
  107. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Xync/ed.py +0 -0
  108. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/Pms/Yandex/__init__.py +0 -0
  109. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/agent.py +0 -0
  110. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/asset.py +0 -0
  111. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/auth.py +0 -0
  112. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/inAgent.py +0 -0
  113. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/order.py +0 -0
  114. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/pyd.py +0 -0
  115. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/pyro.py +0 -0
  116. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/TgWallet/web.py +0 -0
  117. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/__init__.py +0 -0
  118. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/details.py +0 -0
  119. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client/pm_unifier.py +0 -0
  120. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client.egg-info/SOURCES.txt +0 -0
  121. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client.egg-info/dependency_links.txt +0 -0
  122. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client.egg-info/requires.txt +0 -0
  123. {xync_client-0.0.138 → xync_client-0.0.141}/xync_client.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-client
3
- Version: 0.0.138
3
+ Version: 0.0.141
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/client
@@ -6,7 +6,9 @@ from enum import StrEnum
6
6
 
7
7
  from playwright.async_api import Page, Playwright
8
8
  from pyro_client.client.file import FileClient
9
- from xync_client.loader import TOKEN
9
+ from pyro_client.client.user import UserClient
10
+
11
+ from xync_client.loader import NET_TOKEN
10
12
  from xync_schema.enums import UserStatus
11
13
  from xync_schema.models import PmAgent, User
12
14
 
@@ -22,29 +24,22 @@ class PmAgentClient(metaclass=ABCMeta):
22
24
  OTP_LOGIN = base + "login/otp"
23
25
 
24
26
  norm: str
25
- uid: int
26
27
  agent: PmAgent
27
- bot: FileClient
28
+ bot: FileClient | UserClient
28
29
  page: Page
29
30
  pages: type(StrEnum) = Pages
30
31
  last_page: int = 0
31
32
  last_active: datetime = datetime.now()
32
33
  _is_started: bool = False
33
34
 
34
- async def start(self, pw: Playwright, headed: bool = False) -> "PmAgentClient":
35
- dct = dict(user__status__gte=UserStatus.PAY, pm__norm=self.norm)
36
- if self.uid:
37
- dct.update({"user__username_id": self.uid})
38
-
39
- self.bot = FileClient(TOKEN)
35
+ async def start(self, pw: Playwright, headed: bool = False, userbot: bool = False) -> "PmAgentClient":
36
+ bot = FileClient(NET_TOKEN)
37
+ self.bot = UserClient(self.uid, bot) if userbot else bot
40
38
  await self.bot.start()
41
39
 
42
- self.agent = await PmAgent.get_or_none(**dct).prefetch_related("user__username__session")
43
- if not self.agent:
44
- await self.bot.send(f"No active users with agent for {self.norm}!", self.uid)
45
- raise Exception(f"No active users for {self.norm}!")
46
-
47
- self.browser = await pw.chromium.launch(channel="chromium-headless-shell", headless=not headed)
40
+ self.browser = await pw.chromium.launch(
41
+ channel="chromium" if headed else "chromium-headless-shell", headless=not headed
42
+ )
48
43
  context = await self.browser.new_context(storage_state=self.agent.state)
49
44
  self.page = await context.new_page()
50
45
  await self.page.goto(self.pages.SEND) # Оптимистично переходим сразу на страницу отправки
@@ -59,6 +54,8 @@ class PmAgentClient(metaclass=ABCMeta):
59
54
  self._is_started = True
60
55
  return self
61
56
 
57
+ def get_topup(self, tid: str) -> dict: ...
58
+
62
59
  async def _idle(self): # todo: не мешать другим процессам, обновлять на другой вкладке?
63
60
  while (await User.get(username_id=self.uid)).status >= UserStatus.ACTIVE:
64
61
  await self.page.wait_for_timeout(30 * 1000)
@@ -90,5 +87,7 @@ class PmAgentClient(metaclass=ABCMeta):
90
87
  @abstractmethod # видео входа в аккаунт, и переход в историю поступлений за последние сутки (минимум)
91
88
  async def proof(self) -> bytes: ...
92
89
 
93
- def __init__(self, uid: int = None):
94
- self.uid = uid
90
+ def __init__(self, agent: PmAgent):
91
+ self.agent = agent
92
+ self.uid = agent.user.username_id
93
+ self.norm = agent.pm.norm
@@ -6,7 +6,7 @@ from x_model import init_db
6
6
  from xync_client.Abc.Ex import BaseExClient
7
7
  from xync_client.Binance.etype import pm, ad
8
8
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
9
- from xync_client.loader import TOKEN, TORM
9
+ from xync_client.loader import NET_TOKEN, TORM
10
10
 
11
11
  from xync_schema.models import Ex
12
12
  from xync_schema import xtype
@@ -139,7 +139,7 @@ class ExClient(BaseExClient):
139
139
  async def main():
140
140
  _ = await init_db(TORM)
141
141
  ex = await Ex.get(name="Binance")
142
- async with FileClient(TOKEN) as b:
142
+ async with FileClient(NET_TOKEN) as b:
143
143
  cl = ExClient(ex, b)
144
144
  await cl.set_pms()
145
145
  await cl.set_coins()
@@ -8,7 +8,7 @@ from xync_schema import xtype
8
8
 
9
9
  from xync_client.Abc.Ex import BaseExClient
10
10
  from xync_client.BingX.base import BaseBingXClient
11
- from xync_client.loader import TOKEN, TORM
11
+ from xync_client.loader import NET_TOKEN, TORM
12
12
  from xync_client.Abc.xtype import MapOfIdsList
13
13
  from xync_client.BingX.etype import ad, pm
14
14
  from xync_client.Abc.xtype import PmEx
@@ -93,7 +93,7 @@ class ExClient(BaseExClient, BaseBingXClient):
93
93
  async def main():
94
94
  _ = await init_db(TORM, True)
95
95
  bg = await Ex.get(name="BingX").prefetch_related("pm_reps")
96
- async with FileClient(TOKEN) as b:
96
+ async with FileClient(NET_TOKEN) as b:
97
97
  b: FileClient
98
98
  cl = ExClient(bg, b)
99
99
  _ads = await cl.ads(
@@ -6,7 +6,7 @@ from xync_schema.models import Ex
6
6
  from xync_schema import xtype
7
7
 
8
8
  from xync_client.Abc.Ex import BaseExClient
9
- from xync_client.loader import TORM, TOKEN
9
+ from xync_client.loader import TORM, NET_TOKEN
10
10
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
11
11
  from xync_client.BitGet.etype import ad
12
12
 
@@ -94,7 +94,7 @@ class ExClient(BaseExClient):
94
94
  async def main():
95
95
  _ = await init_db(TORM, True)
96
96
  bg = await Ex.get(name="BitGet")
97
- cl = ExClient(bg, FileClient(TOKEN))
97
+ cl = ExClient(bg, FileClient(NET_TOKEN))
98
98
  _ads = await cl.ads("USDT", "RUB", False, [])
99
99
  await cl.curs()
100
100
  await cl.coins()
@@ -19,7 +19,6 @@ from xync_client.Abc.PmAgent import PmAgentClient
19
19
  from xync_schema import models
20
20
  from xync_schema.enums import UserStatus, OrderStatus
21
21
 
22
- from xync_client.Pms.Payeer import Client
23
22
  from xync_client.Bybit.etype.order import (
24
23
  StatusChange,
25
24
  CountDown,
@@ -29,7 +28,7 @@ from xync_client.Bybit.etype.order import (
29
28
  OrderFull,
30
29
  StatusApi,
31
30
  )
32
- from xync_client.loader import TOKEN
31
+ from xync_client.loader import NET_TOKEN
33
32
  from xync_client.Abc.InAgent import BaseInAgentClient
34
33
  from xync_client.Bybit.agent import AgentClient
35
34
 
@@ -407,17 +406,18 @@ async def main():
407
406
  person__user__status=UserStatus.ACTIVE,
408
407
  person__user__pm_agents__isnull=False,
409
408
  )
410
- .prefetch_related("ex", "agent", "person__user__pm_agents")
409
+ .prefetch_related("ex", "agent", "person__user__pm_agents__user", "person__user__pm_agents__pm")
411
410
  .first()
412
411
  )
413
412
 
414
- async with FileClient(TOKEN) as b:
413
+ async with FileClient(NET_TOKEN) as b:
415
414
  b: FileClient
416
415
  cl: InAgentClient = actor.in_client(b)
417
416
  # await cl.agent_client.export_my_ads()
418
- payeer_cl = Client(actor.person.user.username_id)
417
+ # payeer_cl = Client(actor.person.user.username_id)
419
418
  for pma in actor.person.user.pm_agents:
420
- cl.pmacs[pma.pm_id] = await payeer_cl.start(await async_playwright().start(), False)
419
+ pcl = pma.client()
420
+ cl.pmacs[pma.pm_id] = await pcl.start(await async_playwright().start(), False)
421
421
  try:
422
422
  _ = await cl.start_listen()
423
423
  except Exception as e:
@@ -43,7 +43,7 @@ from xync_client.Bybit.etype.order import (
43
43
  Message,
44
44
  Status,
45
45
  )
46
- from xync_client.loader import TORM, TOKEN
46
+ from xync_client.loader import TORM, NET_TOKEN
47
47
 
48
48
 
49
49
  class NoMakerException(Exception):
@@ -1264,7 +1264,7 @@ async def main():
1264
1264
  actor = (
1265
1265
  await models.Actor.filter(ex_id=4, agent__isnull=False).prefetch_related("ex", "agent", "person__user").first()
1266
1266
  )
1267
- filebot = FileClient(TOKEN)
1267
+ filebot = FileClient(NET_TOKEN)
1268
1268
  await filebot.start()
1269
1269
  # b.add_handler(MessageHandler(cond_start_handler, command("cond")))
1270
1270
  cl: AgentClient = actor.client(filebot)
@@ -1315,10 +1315,10 @@ async def main():
1315
1315
  hist |= papi.history(count=1000, append=list(hist.keys())[-1])
1316
1316
  cl.hist = hist
1317
1317
 
1318
- cl.completed_orders = await models.Order.filter(status=OrderStatus.completed, transfer__isnull=False).values_list(
1319
- "exid", flat=True
1320
- )
1321
- await cl.get_api_orders() # 43, 1741294800000, 1749157199999)
1318
+ # cl.completed_orders = await models.Order.filter(status=OrderStatus.completed, transfer__isnull=False).values_list(
1319
+ # "exid", flat=True
1320
+ # )
1321
+ # await cl.get_api_orders() # 43, 1741294800000, 1749157199999)
1322
1322
 
1323
1323
  races = await models.Race.filter(started=True).prefetch_related(
1324
1324
  "road__ad__pair_side__pair__cur",
@@ -7,7 +7,7 @@ from xync_schema import models, xtype
7
7
  from xync_schema.models import Ex, Agent
8
8
 
9
9
  from xync_client.Abc.Ex import BaseExClient
10
- from xync_client.loader import TOKEN
10
+ from xync_client.loader import NET_TOKEN
11
11
  from xync_client.Bybit.etype import ad
12
12
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
13
13
  from xync_client.loader import TORM
@@ -114,7 +114,7 @@ class ExClient(BaseExClient): # Bybit client
114
114
  async def main():
115
115
  _ = await init_db(TORM, True)
116
116
  ex = await Ex.get(name="Bybit")
117
- bot: FileClient = FileClient(TOKEN)
117
+ bot: FileClient = FileClient(NET_TOKEN)
118
118
  # await bot.start()
119
119
  cl = ExClient(ex, bot)
120
120
  await cl.set_pms()
@@ -6,7 +6,7 @@ from xync_schema.models import Ex
6
6
  from xync_schema import xtype
7
7
 
8
8
  from xync_client.Abc.Ex import BaseExClient
9
- from xync_client.loader import TOKEN, TORM
9
+ from xync_client.loader import NET_TOKEN, TORM
10
10
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
11
11
  from xync_client.Gate.etype import ad
12
12
 
@@ -93,7 +93,7 @@ class ExClient(BaseExClient):
93
93
  async def main():
94
94
  _ = await init_db(TORM, True)
95
95
  gt = await Ex.get(name="Gate")
96
- async with FileClient(TOKEN) as b:
96
+ async with FileClient(NET_TOKEN) as b:
97
97
  cl = ExClient(gt, b)
98
98
  await cl.set_pairs()
99
99
  pms = await cl.set_coins()
@@ -1,9 +1,9 @@
1
1
  from playwright.async_api import Page, Playwright
2
- from pyro_client.client.bot import BotClient
2
+ from pyro_client.client.file import FileClient
3
3
  from pyro_client.client.user import UserClient
4
4
  from xync_schema.models import User, Gmail
5
5
 
6
- from xync_client.loader import TOKEN
6
+ from xync_client.loader import NET_TOKEN
7
7
 
8
8
 
9
9
  class GmClient:
@@ -83,8 +83,8 @@ class GmClient:
83
83
 
84
84
  async def load_bot(self):
85
85
  if not self.bot:
86
- bot = await BotClient(TOKEN)
87
- self.bot = await UserClient(self.uid, bot)
86
+ bot = FileClient(NET_TOKEN)
87
+ self.bot = UserClient(self.uid, bot)
88
88
  if not self.bot.is_connected:
89
89
  await self.bot.start()
90
90
 
@@ -11,7 +11,7 @@ from xync_schema.enums import PmType
11
11
  from xync_client.Abc.Ex import BaseExClient
12
12
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
13
13
  from xync_client.Htx.etype import pm, Country, ad
14
- from xync_client.loader import TOKEN
14
+ from xync_client.loader import NET_TOKEN
15
15
  from xync_client.loader import TORM
16
16
 
17
17
 
@@ -156,7 +156,7 @@ class ExClient(BaseExClient):
156
156
  async def main():
157
157
  _ = await init_db(TORM, True)
158
158
  ex = await Ex.get(name="Htx")
159
- async with FileClient(TOKEN) as b:
159
+ async with FileClient(NET_TOKEN) as b:
160
160
  b: FileClient
161
161
  cl = ExClient(ex, b)
162
162
  await cl.set_curs()
@@ -2,7 +2,7 @@ from asyncio import run
2
2
 
3
3
  from pyro_client.client.file import FileClient
4
4
  from x_model import init_db
5
- from xync_client.loader import TORM, TOKEN
5
+ from xync_client.loader import TORM, NET_TOKEN
6
6
  from xync_schema import models
7
7
  from xync_schema import xtype
8
8
 
@@ -80,7 +80,7 @@ class ExClient(BaseExClient):
80
80
  async def main():
81
81
  _ = await init_db(TORM, True)
82
82
  bg = await models.Ex.get(name="KuCoin")
83
- async with FileClient(TOKEN) as b:
83
+ async with FileClient(NET_TOKEN) as b:
84
84
  cl: ExClient = bg.client(b)
85
85
  await cl.set_pms()
86
86
  await cl.set_coins()
@@ -3,7 +3,7 @@ from asyncio import run
3
3
  from pyro_client.client.file import FileClient
4
4
  from x_model import init_db
5
5
  import requests
6
- from xync_client.loader import TORM, TOKEN
6
+ from xync_client.loader import TORM, NET_TOKEN
7
7
 
8
8
  from xync_client.Abc.Ex import BaseExClient
9
9
  from xync_client.Abc.xtype import PmEx, MapOfIdsList
@@ -90,7 +90,7 @@ class ExClient(BaseExClient):
90
90
 
91
91
  async def main():
92
92
  _ = await init_db(TORM)
93
- async with FileClient(TOKEN) as b:
93
+ async with FileClient(NET_TOKEN) as b:
94
94
  ex = await Ex.get(name="Mexc")
95
95
  cl = ex.client(b)
96
96
  # await ex.curexs.filter(cur__ticker="EUR")
@@ -1,7 +1,7 @@
1
1
  from asyncio import run
2
2
 
3
3
  from pyro_client.client.file import FileClient
4
- from pyro_client.loader import TOKEN
4
+ from pyro_client.loader import NET_TOKEN
5
5
  from x_model import init_db
6
6
 
7
7
  from xync_client.Abc.Exception import NoPairOnEx
@@ -102,7 +102,7 @@ class ExClient(BaseExClient):
102
102
  async def main():
103
103
  _ = await init_db(TORM)
104
104
  bg = await models.Ex.get(name="Okx")
105
- cl = ExClient(bg, FileClient(TOKEN))
105
+ cl = ExClient(bg, FileClient(NET_TOKEN))
106
106
  await cl.ads("USDT", "EUR", True)
107
107
  # curs = await cl.curs()
108
108
  # coins = await cl.coins()
@@ -19,7 +19,7 @@ from cryptography.hazmat.primitives.ciphers.modes import CBC
19
19
  from payeer_api import PayeerAPI
20
20
  from playwright.async_api import async_playwright, Playwright, Error
21
21
  from playwright._impl._errors import TimeoutError
22
- from xync_schema.models import TopUp, TopUpAble
22
+ from xync_schema.models import TopUp, TopUpAble, PmAgent
23
23
 
24
24
  from xync_client.loader import TORM
25
25
 
@@ -65,11 +65,10 @@ class Client(PmAgentClient):
65
65
  pages: type(StrEnum) = Pages
66
66
  api: PayeerAPI
67
67
 
68
- async def start(self, pw: Playwright, headed: bool = False) -> "PmAgentClient":
69
- await super().start(pw, headed)
68
+ def __init__(self, agent: PmAgent):
69
+ super().__init__(agent)
70
70
  if api_id := self.agent.auth.get("api_id"):
71
71
  self.api = PayeerAPI(self.agent.auth["email"], api_id, self.agent.auth["api_sec"])
72
- return self
73
72
 
74
73
  async def _login(self):
75
74
  await login(self.agent)
@@ -121,6 +120,17 @@ class Client(PmAgentClient):
121
120
  url = "https://payeer.com/merchant/?" + urlencode(params)
122
121
  return url, None
123
122
 
123
+ def get_topup(self, tid: str) -> dict:
124
+ hi = self.api.get_history_info(tid)
125
+ ti = self.api.shop_order_info(hi["params"]["SHOP_ID"], hi["params"]["ORDER_ID"])["info"]
126
+ return ti["status"] == "execute" and {
127
+ "pmid": ti["id"],
128
+ "from_acc": hi["params"]["ACCOUNT_NUMBER"],
129
+ "oid": hi["params"]["ORDER_ID"],
130
+ "amount": int(float(ti["sumOut"]) * 100),
131
+ "ts": datetime.strptime(ti["dateCreate"], "%d.%m.%Y %H:%M:%S") - timedelta(hours=3),
132
+ }
133
+
124
134
  async def send(self, dest: str, amount: int, cur: str) -> tuple[int, bytes, int] | int:
125
135
  self.last_active = datetime.now()
126
136
  page = self.page
@@ -204,8 +214,13 @@ async def main(uid: int):
204
214
  from x_model import init_db
205
215
 
206
216
  _ = await init_db(TORM, True)
217
+ agent = await PmAgent.get_or_none(pm__norm="payeer", user__username_id=uid).prefetch_related(
218
+ "user__username__session", "pm"
219
+ )
220
+ if not agent:
221
+ raise Exception(f"No active user #{uid} with agent for volet!")
222
+ pyr = agent.client()
207
223
  playwright: Playwright = await async_playwright().start()
208
- pyr = Client(uid)
209
224
  try:
210
225
  dest, amount, cur = "P79619335", 4, "RUB"
211
226
  ta = await TopUpAble.get(pm__norm="payeer")
@@ -1,22 +1,23 @@
1
1
  import logging
2
2
  import re
3
3
  from asyncio import run, ensure_future
4
+ from decimal import Decimal
4
5
  from enum import StrEnum
5
- from typing import Literal
6
+ from hashlib import sha256
6
7
 
7
8
  from playwright.async_api import async_playwright, Page, Locator, Position, Playwright # , FloatRect
8
9
  from pyotp import TOTP
9
10
 
10
11
  # noinspection PyProtectedMember
11
12
  from playwright._impl._errors import TimeoutError
12
- from pyro_client.client.bot import BotClient
13
13
  from pyro_client.client.user import UserClient
14
+ from pyrogram.handlers import MessageHandler
14
15
  from xync_schema.enums import UserStatus
15
- from xync_schema.models import Cur, User, PmAgent, Cred, PmCur, Fiat
16
+ from xync_schema.models import Cur, User, PmAgent, Cred, PmCur, Fiat, TopUp
16
17
 
18
+ from xync_client.Abc.PmAgent import PmAgentClient
17
19
  from xync_client.Gmail import GmClient
18
20
  from xync_client.Pms.Volet.api import APIClient
19
- from xync_client.loader import TOKEN
20
21
 
21
22
 
22
23
  class CaptchaException(Exception): ...
@@ -31,14 +32,6 @@ class NoCodeException(Exception): ...
31
32
  class NoMailException(Exception): ...
32
33
 
33
34
 
34
- class Pages(StrEnum):
35
- base_url = "https://account.volet.com/"
36
- LOGIN = base_url + "login"
37
- OTP_LOGIN = base_url + "login/otp"
38
- HOME = base_url + "pages/transaction"
39
- SEND = base_url + "pages/transfer/wallet"
40
-
41
-
42
35
  def parse_transaction_info(text: str) -> dict[str, str] | None:
43
36
  # Поиск ID транзакции
44
37
  transaction_id_match = re.search(r"Transaction ID:\s*([\w-]+)", text)
@@ -57,65 +50,101 @@ def parse_transaction_info(text: str) -> dict[str, str] | None:
57
50
  return None
58
51
 
59
52
 
60
- class Client:
53
+ class Client(PmAgentClient):
54
+ class Pages(StrEnum):
55
+ base = "https://account.volet.com/"
56
+ LOGIN = base + "login"
57
+ OTP_LOGIN = base + "login/otp"
58
+ # HOME = base + "pages/transaction"
59
+ SEND = base + "pages/transfer/wallet"
60
+
61
+ async def check_in(self, amount: int | Decimal | float, cur: str, tid: str | int = None) -> float | None:
62
+ pass
63
+
64
+ async def proof(self) -> bytes:
65
+ pass
66
+
61
67
  uid: int
62
68
  agent: PmAgent
63
69
  bot: UserClient
64
70
  api: APIClient
65
71
  page: Page
66
72
  gmail: GmClient
73
+ norm: str = "payeer"
74
+ pages: type(StrEnum) = Pages
75
+
76
+ def __init__(self, agent: PmAgent):
77
+ super().__init__(agent)
78
+ self.gmail = GmClient(self.uid)
79
+ self.api = APIClient(self.agent.auth["api"], self.agent.auth["password"], self.agent.auth["login"])
67
80
 
68
- def __init__(self, uid: int):
69
- self.uid = uid
70
- self.gmail = GmClient(uid)
81
+ @staticmethod
82
+ def form_redirect(topup: TopUp) -> tuple[str, dict | None]:
83
+ ac_account_email = topup.topupable.auth["ac_account_email"]
84
+ ac_sci_name = topup.topupable.auth["ac_sci_name"]
85
+ ac_order_id = str(topup.id)
86
+ ac_amount = "{0:.2f}".format(topup.amount * 0.01)
87
+ ac_currency = topup.cur.ticker
88
+ ac_comments = "XyncPay top up"
89
+ secret = topup.topupable.auth["secret"]
90
+ data = [ac_account_email, ac_sci_name, ac_amount, ac_currency, secret, ac_order_id]
91
+
92
+ ac_sign = sha256(":".join(data).encode()).hexdigest()
93
+
94
+ params = {
95
+ "ac_account_email": ac_account_email,
96
+ "ac_sci_name": ac_sci_name,
97
+ "ac_amount": ac_amount,
98
+ "ac_currency": ac_currency,
99
+ "ac_order_id": ac_order_id,
100
+ "ac_sign": ac_sign,
101
+ "ac_comments": ac_comments,
102
+ }
103
+ url = "https://account.volet.com/sci/"
104
+ return url, params
105
+
106
+ def get_topup(self, tid: str) -> dict:
107
+ t = self.api.check_by_id(tid)
108
+ return t["status"] == "COMPLETED" and {
109
+ "pmid": t["id"],
110
+ "from_acc": t["walletSrcId"],
111
+ "oid": t["orderId"],
112
+ "amount": int(t["amount"] * 100),
113
+ "ts": t["updatedTime"],
114
+ }
71
115
 
72
116
  async def start(self, pw: Playwright, headed: bool = False):
73
- self.agent = await PmAgent.get(
74
- user__username_id=self.uid, user__status__gte=UserStatus.PAY, pm__norm="volet"
75
- ).prefetch_related("user__gmail", "user__username__session")
76
- self.api = APIClient(self.agent.auth["api"], self.agent.auth["password"], self.agent.auth["login"])
77
- # await self.upd_balances()
78
- bot = await BotClient(TOKEN)
79
- self.bot = await UserClient(self.uid, bot)
80
- await self.bot.start()
81
-
82
- browser = await pw.chromium.launch(channel="chrome", headless=not headed, timeout=9000)
83
- context = await browser.new_context(storage_state=self.agent.state, locale="en")
84
- self.page = await context.new_page()
85
- ensure_future(self.gmail.start(pw, headed))
86
- await self.go(Pages.HOME)
87
- if self.page.url == Pages.LOGIN:
88
- await self.login()
89
- # elif self.page.url == Pages.OTP_LOGIN:
90
- # await self.login_otp()
91
- if self.page.url != Pages.HOME:
92
- await self.bot.receive("Not logged in!", photo=await self.page.screenshot())
93
- raise Exception(f"User {self.agent.user_id} has not logged in")
94
-
95
- async def wait_for_code(self, typ: Literal["login", "send"]) -> str:
96
- code = await self.bot.wait_from(243630567, f"otp_{typ}")
97
- return code[-6:]
98
-
99
- async def login(self):
100
- await self.page.locator("input#j_username").fill("mixartemev@gmail.com")
117
+ ensure_future(self.gmail.start(pw, True))
118
+ return await super().start(pw, True, True)
119
+
120
+ async def wait_for_code(self, uid: int, topic: str, hg: tuple[MessageHandler, int]) -> str:
121
+ code = await self.bot.wait_from(uid, topic, hg)
122
+ return code and code[-6:]
123
+
124
+ async def _login(self):
125
+ ll = self.page.locator("input#j_username")
126
+ await ll.fill("mixartemev@gmail.com")
101
127
  await self.page.locator("input#j_password").fill("mixfixX98")
128
+ await self.page.wait_for_timeout(200)
129
+ await ll.click()
130
+ volet_bot_id, topic = 243630567, "otp_login"
102
131
  await self.page.locator("input#loginToAdvcashButton", has_text="log in").hover()
132
+ hg = self.bot.subscribe_for(volet_bot_id, topic) # 243630567 - is volet bot
103
133
  await self.page.locator("input#loginToAdvcashButton:not([disabled])", has_text="log in").click()
104
- await self.page.wait_for_url(Pages.OTP_LOGIN)
105
- await self.login_otp()
106
-
107
- async def login_otp(self):
108
- if not (code := await self.wait_for_code("login")):
134
+ await self.page.wait_for_url(self.pages.OTP_LOGIN)
135
+ if not (code := await self.wait_for_code(volet_bot_id, topic, hg)):
109
136
  await self.bot.receive("no login code", photo=await self.page.screenshot())
110
137
  raise NoCodeException(self.agent.user_id)
111
138
  await self.page.locator("input#otpId").fill(code)
112
139
  await self.page.click("input#checkOtpButton")
113
- await self.page.wait_for_url(Pages.HOME)
140
+ await self.page.wait_for_url(self.pages.SEND)
114
141
 
115
- async def send(self, dest: str, amount: float):
116
- await self.go(Pages.SEND)
142
+ async def send(self, dest: str, amount: float, cur: str) -> tuple[int, bytes, float]:
143
+ curs_map = {"RUB": "Ruble"}
144
+
145
+ await self.go(self.pages.SEND)
117
146
  await self.page.click("[class=combobox-account]")
118
- await self.page.click('[class=rf-ulst-itm] b:has-text("Ruble ")')
147
+ await self.page.click(f'[class=rf-ulst-itm] b:has-text("{curs_map[cur]}") ")')
119
148
  await self.page.wait_for_timeout(200)
120
149
  await self.page.fill("#srcAmount", str(amount))
121
150
  await self.page.fill("#destWalletId", dest)
@@ -135,7 +164,7 @@ class Client:
135
164
  raise OtpNotSetException(self.agent.user_id)
136
165
  await self.page.fill("#securityValue", code)
137
166
  await self.page.locator("input[type=submit]", has_text="confirm").click()
138
- await self.page.wait_for_url(Pages.SEND)
167
+ await self.page.wait_for_url(self.pages.SEND)
139
168
  await self.page.get_by_role("heading").click()
140
169
  slip = await self.page.screenshot(clip={"x": 440, "y": 205, "width": 420, "height": 360})
141
170
  await self.bot.receive(f"{amount} to {dest} sent", photo=slip)
@@ -223,7 +252,13 @@ async def _test():
223
252
  logging.basicConfig(level=logging.DEBUG)
224
253
  uid = 193017646
225
254
  playwright: Playwright = await async_playwright().start()
226
- va = Client(uid)
255
+ agent = await PmAgent.get_or_none(pm__norm="volet", user__username_id=uid).prefetch_related(
256
+ "user__username__session"
257
+ )
258
+ if not agent:
259
+ raise Exception(f"No active user #{uid} with agent for volet!")
260
+
261
+ va = agent.client()
227
262
  try:
228
263
  await va.start(playwright)
229
264
  await va.send("alena.artemeva25@gmail.com", 7.98)
@@ -9,6 +9,8 @@ from zeep.client import Client
9
9
 
10
10
  from xync_client.loader import TORM
11
11
 
12
+ period = 5
13
+
12
14
 
13
15
  class APIClient:
14
16
  wsdl = "https://wallet.advcash.com/wsm/merchantWebService?wsdl"
@@ -83,25 +85,26 @@ class APIClient:
83
85
  params.update(walletId=to)
84
86
  return self.make_request("sendMoney", params)
85
87
 
88
+ async def check_by_amount(self, amount: decimal, cur: str = "RUB", timeout: int = 5 * 60, past: int = 0):
89
+ hist: list = self.make_request("history", {"transactionDirection": "INCOMING", "count": 3, "from": 0})
90
+ if int(hist[0].amount) == int(amount):
91
+ return hist[0]
92
+ await sleep(period)
93
+ past += period
94
+ if past < timeout:
95
+ return await self.check_by_amount(amount, cur, timeout, past)
96
+ return False
86
97
 
87
- period = 5
88
-
89
-
90
- async def check_payment(cl: APIClient, amount: decimal, cur: str = "RUB", timeout: int = 5 * 60, past: int = 0):
91
- hist: list = cl.make_request("history", {"transactionDirection": "INCOMING", "count": 3, "from": 0})
92
- if int(hist[0].amount) == int(amount):
93
- return hist[0]
94
- await sleep(period)
95
- past += period
96
- if past < timeout:
97
- return await check_payment(cl, amount, cur, timeout, past)
98
- return False
98
+ def check_by_id(self, tid: str):
99
+ t: dict = self.make_request("findTransaction", tid)
100
+ return t
99
101
 
100
102
 
101
103
  async def main():
102
104
  _ = await init_db(TORM, True)
103
105
  cl = APIClient("main", "mixfixX98", "mixartemev@gmail.com")
104
- b = cl.get_balances()
106
+ # b = cl.get_balances()
107
+ b = cl.check_by_id("ce9a52be-8085-431e-8e6e-b0be427c6c55")
105
108
  cl.make_request("history", {"transactionDirection": "INCOMING", "count": 100, "from": 0})
106
109
  print(b)
107
110
 
@@ -16,7 +16,7 @@ from xync_client.TgWallet.pyd import (
16
16
  _PmsTrait,
17
17
  _BaseAd,
18
18
  )
19
- from xync_client.loader import TOKEN, TORM
19
+ from xync_client.loader import NET_TOKEN, TORM
20
20
  from xync_client.Abc.Ex import BaseExClient
21
21
  from xync_client.Abc.xtype import MapOfIdsList
22
22
  from xync_client.TgWallet.auth import AuthClient
@@ -156,7 +156,7 @@ class ExClient(BaseExClient, AuthClient):
156
156
  async def _test():
157
157
  await init_db(TORM)
158
158
  tgex = await models.Ex.get(name="TgWallet")
159
- async with FileClient(TOKEN) as b:
159
+ async with FileClient(NET_TOKEN) as b:
160
160
  cl: ExClient = tgex.client(b)
161
161
 
162
162
  await cl.set_coins()
@@ -4,7 +4,7 @@ from xync_schema import models
4
4
 
5
5
  load_dotenv()
6
6
 
7
- TOKEN = env("TOKEN")
7
+ NET_TOKEN = env("NET_TOKEN")
8
8
  PG_DSN = f"postgres://{env('POSTGRES_USER')}:{env('POSTGRES_PASSWORD')}@{env('POSTGRES_HOST', 'xyncdbs')}:{env('POSTGRES_PORT', 5432)}/{env('POSTGRES_DB', env('POSTGRES_USER'))}"
9
9
  TORM = {
10
10
  "connections": {"default": PG_DSN},
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: xync-client
3
- Version: 0.0.138
3
+ Version: 0.0.141
4
4
  Author-email: Mike Artemiev <mixartemev@gmail.com>
5
5
  Project-URL: Homepage, https://gitlab.com/XyncNet/client
6
6
  Project-URL: Repository, https://gitlab.com/XyncNet/client
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes