xync-schema 0.6.35__tar.gz → 0.6.36.dev2__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xync-schema
3
- Version: 0.6.35
3
+ Version: 0.6.36.dev2
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -0,0 +1,252 @@
1
+ from enum import IntEnum
2
+
3
+
4
+ class AdStatus(IntEnum):
5
+ defActive = 0
6
+ active = 1
7
+ two = 2
8
+ old = 3
9
+ four = 4
10
+ notFound = 9
11
+
12
+
13
+ class OrderStatus(IntEnum):
14
+ zero = 0
15
+ active = 1
16
+ two = 2
17
+ three = 3
18
+ done = 4
19
+ fifth = 5
20
+ canceled = 6
21
+ paid_and_canceled = 7
22
+ # COMPLETED, PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM
23
+
24
+
25
+ class ExType(IntEnum):
26
+ p2p = 1
27
+ cex = 2
28
+ main = 3 # p2p+cex
29
+ dex = 4
30
+ futures = 8
31
+
32
+
33
+ class DepType(IntEnum):
34
+ earn = 1
35
+ stake = 2
36
+ beth = 3
37
+ lend = 4
38
+
39
+
40
+ class AssetType(IntEnum):
41
+ spot = 1
42
+ earn = 2
43
+ found = 3
44
+
45
+
46
+ class TradeType(IntEnum):
47
+ BUY = 0
48
+ SELL = 1
49
+
50
+
51
+ class PmType(IntEnum):
52
+ bank = 0
53
+ web_wallet = 1
54
+ cash = 2
55
+ gift_card = 3
56
+ credit_card = 4
57
+
58
+
59
+ class TaskType(IntEnum):
60
+ invite_approve = 1
61
+
62
+
63
+ class ExAction(IntEnum):
64
+ """Order"""
65
+
66
+ order_request = 1 # [T] Запрос на старт сделки
67
+ order_request_ask = -1 # [M] - Запрос мейкеру на сделку
68
+ cancel_request = 2 # [T] Отмена запроса на сделку
69
+ request_canceled = -2 # [M] - Уведомление об отмене запроса на сделку
70
+ accept_request = 3 # [M] Одобрить запрос на сделку
71
+ request_accepted = -3 # [T] Уведомление об одобрении запроса на сделку
72
+ reject_request = 4 # [M] Отклонить запрос на сделку
73
+ request_rejected = -4 # [T] Уведомление об отклонении запроса на сделку
74
+ mark_payed = 5 # [B] Перевод сделки в состояние "оплачено", c отправкой чека
75
+ payed = -5 # [S] Уведомиление продавца об оплате
76
+ cancel_order = 6 # [B] Отмена сделки
77
+ order_canceled = -6 # [S] Уведомиление продавцу об отмене оредера покупателем
78
+ confirm = 7 # [S] Подтвердить получение оплаты
79
+ order_completed = -7 # [B] Уведомиление покупателю об успешном завершении продавцом
80
+ appeal_available = -8 # [S,B] Уведомление о наступлении возможности подать аппеляцию
81
+ start_appeal = 9 # ,10 # [S,B] Подать аппеляцию cо скриншотом/видео/файлом
82
+ appeal_started = -9 # ,-10 # [S,B] Уведомление о поданной на меня аппеляци
83
+ dispute_appeal = 11 # ,12 # [S,B] Встречное оспаривание полученной аппеляции cо скриншотом/видео/файлом
84
+ appeal_disputed = -11 # ,-12 # [S,B] Уведомление о встречном оспаривание поданной аппеляции
85
+ order_completed_by_appeal = -13 # [S,B] Уведомление о завершении сделки по аппеляции
86
+ order_canceled_by_appeal = -14 # [B,S] Уведомление об отмене сделки по аппеляции
87
+ cancel_appeal = 15 # [B,S] Отмена аппеляции
88
+ appeal_canceled = -15 # [B,S] Уведомление об отмене аппеляции против меня
89
+ send_order_msg = 16 # Отправка сообщения юзеру в чат по ордеру с приложенным файлом
90
+ get_order_msg = -16 # Получение сообщения в чате по ордеру
91
+ send_appeal_msg = 17 # Отправка сообщения по апелляции
92
+ get_appeal_msg = -17 # Получение сообщения по апелляции
93
+ """ Ex: Public """
94
+ taker_curs = 21 # Список поддерживаемых валют тейкера
95
+ coins = 22 # Список торгуемых монет (с ограничениям по валютам, если есть)
96
+ pms = 23 # Список платежных методов по каждой валюте
97
+ ads = 24 # Список объяв по (buy/sell, cur, coin, pm)
98
+ """ Agent: Fiat """
99
+ my_fiats = 25 # Список реквизитов моих платежных методов
100
+ fiat_new = 26 # Создание
101
+ fiat_upd = 27 # Редактирование
102
+ fiat_del = 28 # Удаление
103
+ """ Agent: Ad """
104
+ my_ads = 29 # Список моих ad
105
+ ad_new = 30 # Создание ad:
106
+ ad_upd = 31 # Редактирование
107
+ ad_del = 32 # Удаление
108
+ ad_switch = 33 # Вкл/выкл объявления
109
+ ads_switch = 34 # Вкл/выкл всех объявлений
110
+ """ Agent: Taker """
111
+ get_user = 35 # Получить объект юзера по его ид
112
+ send_user_msg = 36 # Отправка сообщения юзеру с приложенным файлом
113
+ block_user = 37 # [Раз]Блокировать юзера
114
+ rate_user = 38 # Поставить отзыв юзеру
115
+ """ Agent: Inbound """
116
+ get_user_msg = -36 # Получение сообщения от юзера
117
+ got_blocked = -37 # Получение уведомления о [раз]блокировке юзером
118
+ got_rated = -38 # Получение уведомления о полученном отзыве
119
+
120
+
121
+ exs = {
122
+ "Beribit": (
123
+ ExType.p2p,
124
+ "https://sun9-41.userapi.com/impg/cZCGFTXH5-11_HjiWw9aWr3__SlbmMIiXSc-ig/YtOHJpjuVW0.jpg?size=604x604&quality=95&sign=def93bbe4283c563eb2d75a5968350f2",
125
+ "beribit.app",
126
+ "beribit.app",
127
+ "beribit.app/login",
128
+ ),
129
+ "Binance": (
130
+ ExType.main,
131
+ "https://assets.coingecko.com/markets/images/52/large/binance.jpg",
132
+ "binance.com",
133
+ "binance.com",
134
+ "accounts.binance.com/login",
135
+ ),
136
+ "BingX": (
137
+ ExType.p2p,
138
+ "https://assets.coingecko.com/markets/images/812/large/YtFwQwJr_400x400.jpg",
139
+ "bingx.com",
140
+ "bingx.com",
141
+ "bingx.com/login",
142
+ ),
143
+ "Bisq": (ExType.p2p, "", "", "", ""),
144
+ "BitcoinGlobal": (ExType.p2p, "", "", "", ""),
145
+ "BitGet": (
146
+ ExType.p2p,
147
+ "https://assets.coingecko.com/markets/images/591/large/2023-07-25_21.47.43.jpg",
148
+ "www.bitget.com",
149
+ "www.bitget.com",
150
+ "www.bitget.com/login",
151
+ ),
152
+ "BitPapa": (
153
+ ExType.p2p,
154
+ "https://avatars.mds.yandex.net/i?id=130c32d9900d514d738ef89b9c61bcd3_l-4767909-images-thumbs&n=13",
155
+ "bitpapa.com",
156
+ "bitpapa.com",
157
+ "bitpapa.com/log-in",
158
+ ),
159
+ "Bitvalve ": (ExType.p2p, "", "", "", ""),
160
+ "Bybit": (
161
+ ExType.main,
162
+ "https://assets.coingecko.com/markets/images/698/large/bybit_spot.png",
163
+ "bybit.com",
164
+ "bybit.com",
165
+ "bybit.com/login",
166
+ ),
167
+ "CoinCola": (ExType.main, "", "", "", ""),
168
+ "CRYPTED": (ExType.p2p, "", "", "", ""),
169
+ "Garantex": (ExType.p2p, "", "", "", ""),
170
+ "Gate": (
171
+ ExType.p2p,
172
+ "https://assets.coingecko.com/markets/images/403/large/gate_io_logo.jpg",
173
+ "gate.io",
174
+ "gate.io",
175
+ "www.gate.io/login",
176
+ ),
177
+ "HodlHodl": (ExType.p2p, "", "", "", ""),
178
+ "Htx": (
179
+ ExType.main,
180
+ "https://assets.coingecko.com/markets/images/25/large/logo_V_colour_black.png",
181
+ "www.htx.com",
182
+ "www.htx.com",
183
+ "htx.com/login",
184
+ ),
185
+ "Koshelek": (ExType.p2p, "", "", "", ""),
186
+ "KuCoin": (
187
+ ExType.main,
188
+ "https://assets.coingecko.com/markets/images/61/large/kucoin.png",
189
+ "kucoin.com",
190
+ "kucoin.com",
191
+ "www.kucoin.com/ucenter/signin",
192
+ ),
193
+ "LocalCoinSwap": (ExType.p2p, "", "", "", ""),
194
+ "LocalMonero": (ExType.p2p, "", "", "", ""),
195
+ "Mexc": (
196
+ ExType.main,
197
+ "https://assets.coingecko.com/markets/images/409/large/MEXC_logo_square.jpeg",
198
+ "www.mexc.com",
199
+ "www.mexc.com",
200
+ "www.mexc.com/login",
201
+ ),
202
+ "Noones ": (ExType.p2p, "", "", "", ""),
203
+ "Okx": (
204
+ ExType.main,
205
+ "https://assets.coingecko.com/markets/images/379/large/WeChat_Image_20220117220452.png",
206
+ "www.okx.cab",
207
+ "www.okx.cab",
208
+ "www.okx.cab/account/login",
209
+ ),
210
+ "Paxful": (ExType.p2p, "", "", "", ""),
211
+ "PeachBitcoin": (ExType.p2p, "", "", "", ""),
212
+ "Phemex": (ExType.p2p, "", "", "", ""),
213
+ "Poloniex": (ExType.main, "", "", "", ""),
214
+ "Remitano": (ExType.p2p, "", "", "", ""),
215
+ "RiseX": (ExType.p2p, "", "", "", ""),
216
+ "RoboSats": (ExType.p2p, "", "", "", ""),
217
+ "Sigen": (
218
+ ExType.p2p,
219
+ "https://yastatic.net/naydex/yandex-search/neZ1W6346/a21f02dA/2SvJ6dTLJwRiz_lTFP-fhywHqi1fxPNRcIxuKzcpwJ0DGlJzbzdT8ARet86SrINoGNj87R9U-t8HLZcrrBASQf0_6OkAL7cgl6uc0gCrHxI9Y369emE2MJF5yotCyODdZ5iXljtkQJMXTMV9VXsEL68seaiqQF578wnB3V",
220
+ "sigen.pro",
221
+ "sigen.pro",
222
+ "sigen.pro/p2p",
223
+ ),
224
+ "SkyCrypto": (ExType.p2p, "", "", "", ""),
225
+ "SmartSwap": (ExType.p2p, "", "", "", ""),
226
+ "Solid": (ExType.main, "", "", "", ""),
227
+ "TgWallet": (
228
+ ExType.p2p,
229
+ "https://telerock.ru/uploads/posts/2024-03/f658443d9e_c9d505bbf856e2360ba6812079ba02d0.webp",
230
+ "walletbot.me",
231
+ "p2p.walletbot.me",
232
+ "walletbot.me",
233
+ ),
234
+ "TotalCoin": (ExType.p2p, "", "", "", ""),
235
+ "WazirX": (ExType.p2p, "", "", "", ""),
236
+ "WebMoney": (
237
+ ExType.p2p,
238
+ "https://vectorseek.com/wp-content/uploads/2023/08/Webmoney-Icon-Logo-Vector.svg-.png",
239
+ "exchanger.money",
240
+ "exchanger.money",
241
+ "exchanger.money",
242
+ ),
243
+ "WhiteBIT": (ExType.p2p, "", "", "", ""),
244
+ "xRocket": (
245
+ ExType.p2p,
246
+ "https://cdn.allmylinks.com/prod/Upload/file/R/L/6/8G0TaGNtUV8C1V7VQsivDtJcpEz2z7Lc.jpg",
247
+ "",
248
+ "",
249
+ "",
250
+ ),
251
+ # "catalogop2p(.com": ExType.p2p, ''), todo: discover brazilian p2p platforms
252
+ }
@@ -1,5 +1,4 @@
1
1
  from datetime import datetime
2
- from enum import IntEnum
3
2
  from tortoise import fields
4
3
  from tortoise.queryset import QuerySet
5
4
  from x_auth.enums import Role
@@ -7,105 +6,7 @@ from x_auth.models import Model
7
6
  from x_model.models import TsTrait, DatetimeSecField
8
7
  from tg_auth.models import UserStatus, AuthUser
9
8
 
10
-
11
- class AdStatus(IntEnum):
12
- defActive = 0
13
- active = 1
14
- two = 2
15
- old = 3
16
- four = 4
17
- notFound = 9
18
-
19
-
20
- class OrderStatus(IntEnum):
21
- zero = 0
22
- active = 1
23
- two = 2
24
- three = 3
25
- done = 4
26
- fifth = 5
27
- canceled = 6
28
- paid_and_canceled = 7
29
- # COMPLETED, PENDING, TRADING, BUYER_PAYED, DISTRIBUTING, COMPLETED, IN_APPEAL, CANCELLED, CANCELLED_BY_SYSTEM
30
-
31
-
32
- class ExType(IntEnum):
33
- p2p = 1
34
- cex = 2
35
- main = 3 # p2p+cex
36
- dex = 4
37
- futures = 8
38
-
39
-
40
- class DepType(IntEnum):
41
- earn = 1
42
- stake = 2
43
- beth = 3
44
- lend = 4
45
-
46
-
47
- class AssetType(IntEnum):
48
- spot = 1
49
- earn = 2
50
- found = 3
51
-
52
-
53
- class TradeType(IntEnum):
54
- BUY = 0
55
- SELL = 1
56
-
57
-
58
- class PmType(IntEnum):
59
- bank = 0
60
- web_wallet = 1
61
- cash = 2
62
- gift_card = 3
63
- credit_card = 4
64
-
65
-
66
- class TaskType(IntEnum):
67
- invite_approve = 1
68
-
69
-
70
- class ExAction(IntEnum):
71
- """Public"""
72
-
73
- all_curs_taker = 1 # список поддерживаемых валют
74
- all_coins = 2 # список торгуемых монет по каждой валюте
75
- all_pms = 3 # список платежных методов по каждой валюте
76
- all_ads = 4 # список объяв по (buy/sell, cur, coin, pm)
77
- """ My PMs """
78
- fiats = 5 # список реквизитов моих платежных методов (fiats)
79
- fiat_new = 6 # создание моего fiat
80
- fiat_upd = 7 # редактирование моего fiat
81
- fiat_del = 8 # удаление моего fiat
82
- """ Ads """
83
- my_ads = 9 # список моих ad
84
- ad_new = 10 # создание ad: (buy/sell, cur, coin, [pm], price_type, price, details, autoreply)
85
- ad_upd = 11 # редактирование моего ad
86
- ad_del = 12 # удаление моего ad
87
- ad_on = 13 # включение моего ad
88
- ad_off = 14 # выключение моего ad
89
- """ Orders """
90
- order_approve = 15 # одобрить заявку
91
- order_reject = 16 # отклонить заявку
92
- take_ad = 17 # старт сделки (order) по чужому объявлению (ad) тейкером на сумму amount: (ad_id, amount)
93
- order_cancel = 18 # отмена order-a (только для buy заявок)
94
- order_paid = 19 # отправка статуса "оплачено" по buy ордеру
95
- order_payment_confirm = 20 # отправка подтверждения "получено" по sell ордеру
96
- get_chat = 21 # получение сообщений чата по ордеру
97
- send_msg = 22 # отправка сообщения в чат по ордеру с приложенным фото
98
- appeal_start = 23 # открыть апелляцию по ордеру
99
- appeal_accept = 24 # согласиться с чужой апелляцией
100
- appeal_cancel = 25 # отмена своей апелляции
101
- send_appeal_msg = 26 # сообщение по апелляции
102
- user_block = 27 # блокировать юзера
103
- user_review_post = 28 # поставить отзыв юзеру
104
- user_rating = 29 # рейтинг и отзывы юзера
105
- ws_chat = 30 # подписка на сообщения в чате
106
- ws_status = 31 # подписка на изменение статуса ордера
107
- get_orders = 32 # получшение заявок за заданное время, статус, направление, валюта, монета
108
- get_order = 33 # получшение инфы по конкретной заявке
9
+ from xync_schema.enums import ExType, AdStatus, PmType, AssetType, OrderStatus, ExAction
109
10
 
110
11
 
111
12
  class Country(Model):
@@ -182,6 +83,12 @@ class Ex(Model):
182
83
  class PydanticMeta(Model.PydanticMeta):
183
84
  include = "name", "logo"
184
85
 
86
+ async def client(self):
87
+ import sys
88
+
89
+ client = sys.modules[f"xync_client.{self.name}.ex"].Client
90
+ return client(self)
91
+
185
92
 
186
93
  class Curex(Model):
187
94
  cur: fields.ForeignKeyRelation[Cur] = fields.ForeignKeyField("models.Cur")
@@ -295,7 +202,7 @@ class Agent(Model, TsTrait):
295
202
  if isinstance(self.ex, QuerySet):
296
203
  # noinspection PyTypeChecker
297
204
  self.ex: Ex = await self.ex
298
- client = sys.modules[f"xync_client.{self.ex.name}.p2p"].AgentClient
205
+ client = sys.modules[f"xync_client.{self.ex.name}.agent"].Client
299
206
  return client(self)
300
207
 
301
208
 
@@ -354,6 +261,9 @@ class Pm(Model):
354
261
  class Meta:
355
262
  table_description = "Payment methods"
356
263
 
264
+ class PydanticMeta(Model.PydanticMeta):
265
+ include = ("logo",)
266
+
357
267
 
358
268
  class Pmcur(Model): # for fiat with no exs tie
359
269
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
@@ -371,7 +281,8 @@ class Pmcur(Model): # for fiat with no exs tie
371
281
  unique_together = (("pm", "cur"),)
372
282
 
373
283
  class PydanticMeta(Model.PydanticMeta):
374
- exclude_raw_fields: bool = False
284
+ max_recursion: int = 2 # default: 3
285
+ include = "cur_id", "pm"
375
286
 
376
287
 
377
288
  class Pmex(Model): # existence pm in ex with no cur tie
@@ -13,10 +13,3 @@ class FiatNew(FiatUpd):
13
13
  pm_id: int
14
14
  detail: str
15
15
  amount: float = 0
16
-
17
-
18
- class Agent(BaseModel):
19
- cur_id: int
20
- pm_id: int
21
- detail: str
22
- amount: float = 0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xync-schema
3
- Version: 0.6.35
3
+ Version: 0.6.36.dev2
4
4
  Summary: XyncNet project database model schema
5
5
  Author-email: Mike Artemiev <mixartemev@gmail.com>
6
6
  License: EULA
@@ -7,6 +7,7 @@ pyproject.toml
7
7
  tests/__init__.py
8
8
  tests/test_db.py
9
9
  xync_schema/__init__.py
10
+ xync_schema/enums.py
10
11
  xync_schema/models.py
11
12
  xync_schema/pydantic.py
12
13
  xync_schema.egg-info/PKG-INFO
File without changes