xync-schema 0.6.36.dev1__tar.gz → 0.6.36.dev3__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.
Files changed (19) hide show
  1. {xync_schema-0.6.36.dev1/xync_schema.egg-info → xync_schema-0.6.36.dev3}/PKG-INFO +1 -1
  2. xync_schema-0.6.36.dev3/xync_schema/enums.py +252 -0
  3. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema/models.py +7 -122
  4. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema/pydantic.py +0 -7
  5. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3/xync_schema.egg-info}/PKG-INFO +1 -1
  6. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema.egg-info/SOURCES.txt +1 -0
  7. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/.env.sample +0 -0
  8. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/.gitignore +0 -0
  9. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/.pre-commit-config.yaml +0 -0
  10. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/README.md +0 -0
  11. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/makefile +0 -0
  12. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/pyproject.toml +0 -0
  13. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/setup.cfg +0 -0
  14. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/tests/__init__.py +0 -0
  15. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/tests/test_db.py +0 -0
  16. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema/__init__.py +0 -0
  17. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema.egg-info/dependency_links.txt +0 -0
  18. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema.egg-info/requires.txt +0 -0
  19. {xync_schema-0.6.36.dev1 → xync_schema-0.6.36.dev3}/xync_schema.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: xync-schema
3
- Version: 0.6.36.dev1
3
+ Version: 0.6.36.dev3
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,122 +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
- """Order"""
72
-
73
- order_request = 1 # [T] Запрос на старт сделки
74
- order_request_ask = -1 # [M] - Запрос мейкеру на сделку
75
- cancel_request = 2 # [T] Отмена запроса на сделку
76
- request_canceled = -2 # [M] - Уведомление об отмене запроса на сделку
77
- accept_request = 3 # [M] Одобрить запрос на сделку
78
- request_accepted = -3 # [T] Уведомление об одобрении запроса на сделку
79
- reject_request = 4 # [M] Отклонить запрос на сделку
80
- request_rejected = -4 # [T] Уведомление об отклонении запроса на сделку
81
- mark_payed = 5 # [B] Перевод сделки в состояние "оплачено", c отправкой чека
82
- payed = -5 # [S] Уведомиление продавца об оплате
83
- cancel_order = 6 # [B] Отмена сделки
84
- order_canceled = -6 # [S] Уведомиление продавцу об отмене оредера покупателем
85
- confirm = 7 # [S] Подтвердить получение оплаты
86
- order_completed = -7 # [B] Уведомиление покупателю об успешном завершении продавцом
87
- appeal_available = -8 # [S,B] Уведомление о наступлении возможности подать аппеляцию
88
- start_appeal = 9 # ,10 # [S,B] Подать аппеляцию cо скриншотом/видео/файлом
89
- appeal_started = -9 # ,-10 # [S,B] Уведомление о поданной на меня аппеляци
90
- dispute_appeal = 11 # ,12 # [S,B] Встречное оспаривание полученной аппеляции cо скриншотом/видео/файлом
91
- appeal_disputed = -11 # ,-12 # [S,B] Уведомление о встречном оспаривание поданной аппеляции
92
- order_completed_by_appeal = -13 # [S,B] Уведомление о завершении сделки по аппеляции
93
- order_canceled_by_appeal = -14 # [B,S] Уведомление об отмене сделки по аппеляции
94
- cancel_appeal = 15 # [B,S] Отмена аппеляции
95
- appeal_canceled = -15 # [B,S] Уведомление об отмене аппеляции против меня
96
- send_order_msg = 16 # Отправка сообщения юзеру в чат по ордеру с приложенным файлом
97
- get_order_msg = -16 # Получение сообщения в чате по ордеру
98
- send_appeal_msg = 17 # Отправка сообщения по апелляции
99
- get_appeal_msg = -17 # Получение сообщения по апелляции
100
- """ Ex: Public """
101
- taker_curs = 21 # Список поддерживаемых валют тейкера
102
- coins = 22 # Список торгуемых монет (с ограничениям по валютам, если есть)
103
- pms = 23 # Список платежных методов по каждой валюте
104
- ads = 24 # Список объяв по (buy/sell, cur, coin, pm)
105
- """ Agent: Fiat """
106
- my_fiats = 25 # Список реквизитов моих платежных методов
107
- fiat_new = 26 # Создание
108
- fiat_upd = 27 # Редактирование
109
- fiat_del = 28 # Удаление
110
- """ Agent: Ad """
111
- my_ads = 29 # Список моих ad
112
- ad_new = 30 # Создание ad:
113
- ad_upd = 31 # Редактирование
114
- ad_del = 32 # Удаление
115
- ad_switch = 33 # Вкл/выкл объявления
116
- ads_switch = 34 # Вкл/выкл всех объявлений
117
- """ Agent: Taker """
118
- get_user = 35 # Получить объект юзера по его ид
119
- send_user_msg = 36 # Отправка сообщения юзеру с приложенным файлом
120
- block_user = 37 # [Раз]Блокировать юзера
121
- rate_user = 38 # Поставить отзыв юзеру
122
- """ Agent: Inbound """
123
- get_user_msg = -36 # Получение сообщения от юзера
124
- got_blocked = -37 # Получение уведомления о [раз]блокировке юзером
125
- got_rated = -38 # Получение уведомления о полученном отзыве
9
+ from xync_schema.enums import ExType, AdStatus, PmType, AssetType, OrderStatus, ExAction
126
10
 
127
11
 
128
12
  class Country(Model):
@@ -360,16 +244,13 @@ class Pm(Model):
360
244
  type_: PmType | None = fields.IntEnumField(PmType, null=True)
361
245
  template: int | None = fields.SmallIntField(null=True)
362
246
  logo: str | None = fields.CharField(127, null=True)
363
- color: str | None = fields.CharField(7, null=True)
364
247
  multiAllow: bool | None = fields.BooleanField(null=True)
365
248
  riskLevel: int | None = fields.SmallIntField(null=True)
366
249
  chatNeed: bool | None = fields.BooleanField(null=True)
367
250
 
368
251
  ads: fields.ManyToManyRelation[Ad]
369
252
  curs: fields.ManyToManyRelation[Cur]
370
- exs: fields.ManyToManyRelation[Ex] = fields.ManyToManyField(
371
- "models.Ex", through="pmex"
372
- ) # no need. use pmexs[.exid]
253
+ exs: fields.ManyToManyRelation[Ex] = fields.ManyToManyField("models.Ex", "pmex") # no need. use pmexs[.exid]
373
254
  orders: fields.ReverseRelation["Order"]
374
255
  pmcurs: fields.ReverseRelation["Pmcur"] # no need. use curs
375
256
  pmexs: fields.ReverseRelation["Pmex"]
@@ -377,6 +258,9 @@ class Pm(Model):
377
258
  class Meta:
378
259
  table_description = "Payment methods"
379
260
 
261
+ class PydanticMeta(Model.PydanticMeta):
262
+ include = ("id", "name", "logo")
263
+
380
264
 
381
265
  class Pmcur(Model): # for fiat with no exs tie
382
266
  pm: fields.ForeignKeyRelation[Pm] = fields.ForeignKeyField("models.Pm")
@@ -394,7 +278,8 @@ class Pmcur(Model): # for fiat with no exs tie
394
278
  unique_together = (("pm", "cur"),)
395
279
 
396
280
  class PydanticMeta(Model.PydanticMeta):
397
- exclude_raw_fields: bool = False
281
+ max_recursion: int = 2 # default: 3
282
+ include = "cur_id", "pm"
398
283
 
399
284
 
400
285
  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.36.dev1
3
+ Version: 0.6.36.dev3
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