afp-sdk 0.2.0__py3-none-any.whl → 0.2.2__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.
@@ -2,79 +2,14 @@
2
2
 
3
3
  # This module has been generated using pyabigen v0.2.16
4
4
 
5
- import enum
6
5
  import typing
7
- from dataclasses import dataclass
8
6
 
9
7
  import eth_typing
10
8
  import hexbytes
11
9
  import web3
12
10
  from web3.contract import contract
13
11
 
14
-
15
- class Side(enum.IntEnum):
16
- """Port of `enum Side` on the TradingProtocol contract."""
17
-
18
- BID = 0
19
- ASK = 1
20
-
21
-
22
- @dataclass
23
- class IntentData:
24
- """Port of `struct IntentData` on the IClearing contract."""
25
-
26
- nonce: int
27
- trading_protocol_id: eth_typing.ChecksumAddress
28
- product_id: hexbytes.HexBytes
29
- limit_price: int
30
- quantity: int
31
- max_trading_fee_rate: int
32
- good_until: int
33
- side: Side
34
-
35
-
36
- @dataclass
37
- class Intent:
38
- """Port of `struct Intent` on the IClearing contract."""
39
-
40
- margin_account_id: eth_typing.ChecksumAddress
41
- intent_account_id: eth_typing.ChecksumAddress
42
- hash: hexbytes.HexBytes
43
- data: IntentData
44
- signature: hexbytes.HexBytes
45
-
46
-
47
- @dataclass
48
- class Trade:
49
- """Port of `struct Trade` on the IClearing contract."""
50
-
51
- product_id: hexbytes.HexBytes
52
- protocol_id: eth_typing.ChecksumAddress
53
- trade_id: int
54
- price: int
55
- timestamp: int
56
- accounts: typing.List[eth_typing.ChecksumAddress]
57
- quantities: typing.List[int]
58
- fee_rates: typing.List[int]
59
- intents: typing.List[Intent]
60
-
61
-
62
- @dataclass
63
- class Settlement:
64
- """Port of `struct Settlement` on the IMarginAccount contract."""
65
-
66
- position_id: hexbytes.HexBytes
67
- quantity: int
68
- price: int
69
-
70
-
71
- @dataclass
72
- class Order:
73
- """Port of `struct Order` on the ITradingProtocol contract."""
74
-
75
- margin_account_id: eth_typing.ChecksumAddress
76
- margin_account_contract: eth_typing.ChecksumAddress
77
- settlement: Settlement
12
+ from .clearing_facet import Trade
78
13
 
79
14
 
80
15
  class TradingProtocol:
@@ -473,36 +408,6 @@ class TradingProtocol:
473
408
  clearing_address,
474
409
  )
475
410
 
476
- def order_mae_check(
477
- self,
478
- orders: typing.List[Order],
479
- ) -> typing.List[bool]:
480
- """Binding for `orderMAECheck` on the TradingProtocol contract.
481
-
482
- Parameters
483
- ----------
484
- orders : typing.List[Order]
485
-
486
- Returns
487
- -------
488
- typing.List[bool]
489
- """
490
- return_value = self._contract.functions.orderMAECheck(
491
- [
492
- (
493
- item.margin_account_id,
494
- item.margin_account_contract,
495
- (
496
- item.settlement.position_id,
497
- item.settlement.quantity,
498
- item.settlement.price,
499
- ),
500
- )
501
- for item in orders
502
- ],
503
- ).call()
504
- return [bool(return_value_elem) for return_value_elem in return_value]
505
-
506
411
  def proxiable_uuid(
507
412
  self,
508
413
  ) -> hexbytes.HexBytes:
@@ -1172,55 +1077,6 @@ ABI = typing.cast(
1172
1077
  "stateMutability": "nonpayable",
1173
1078
  "type": "function",
1174
1079
  },
1175
- {
1176
- "inputs": [
1177
- {
1178
- "components": [
1179
- {
1180
- "internalType": "address",
1181
- "name": "marginAccountID",
1182
- "type": "address",
1183
- },
1184
- {
1185
- "internalType": "address",
1186
- "name": "marginAccountContract",
1187
- "type": "address",
1188
- },
1189
- {
1190
- "components": [
1191
- {
1192
- "internalType": "bytes32",
1193
- "name": "positionId",
1194
- "type": "bytes32",
1195
- },
1196
- {
1197
- "internalType": "int256",
1198
- "name": "quantity",
1199
- "type": "int256",
1200
- },
1201
- {
1202
- "internalType": "uint256",
1203
- "name": "price",
1204
- "type": "uint256",
1205
- },
1206
- ],
1207
- "internalType": "struct IMarginAccount.Settlement",
1208
- "name": "settlement",
1209
- "type": "tuple",
1210
- },
1211
- ],
1212
- "internalType": "struct ITradingProtocol.Order[]",
1213
- "name": "orders",
1214
- "type": "tuple[]",
1215
- }
1216
- ],
1217
- "name": "orderMAECheck",
1218
- "outputs": [
1219
- {"internalType": "bool[]", "name": "results", "type": "bool[]"}
1220
- ],
1221
- "stateMutability": "view",
1222
- "type": "function",
1223
- },
1224
1080
  {
1225
1081
  "inputs": [],
1226
1082
  "name": "proxiableUUID",
afp/config.py CHANGED
@@ -36,3 +36,6 @@ PRODUCT_REGISTRY_ADDRESS = Web3.to_checksum_address(
36
36
  "AFP_PRODUCT_REGISTRY_ADDRESS", "0x9b92EAC112c996a513e515Cf8c3BDd83619F730D"
37
37
  )
38
38
  )
39
+ SYSTEM_VIEWER_ADDRESS = Web3.to_checksum_address(
40
+ os.getenv("AFP_SYSTEM_VIEWER_ADDRESS", "0xcB3F71Db710544283a1FfB38FE1bEC554d0634A5")
41
+ )
afp/schemas.py CHANGED
@@ -109,7 +109,8 @@ class OrderSubmission(Model):
109
109
 
110
110
 
111
111
  class Trade(Model):
112
- id: int
112
+ # Convert ID from int to str for backward compatibility
113
+ id: Annotated[str, BeforeValidator(str)]
113
114
  product_id: str
114
115
  price: Decimal
115
116
  timestamp: Timestamp
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: afp-sdk
3
- Version: 0.2.0
3
+ Version: 0.2.2
4
4
  Summary: Autonomous Futures Protocol Python SDK
5
5
  Keywords: autonity,web3,trading,crypto,prediction,forecast,markets
6
6
  License-Expression: MIT
@@ -6,29 +6,30 @@ afp/api/builder.py,sha256=mde8XemEMKL76KgEd5rxg7RLBS6lyIfNOEGmE1_iK0M,7114
6
6
  afp/api/clearing.py,sha256=nMVjayFkf0XYYP3aKAdgR6NaFSG4Cl_QsEuADRuIO7M,12922
7
7
  afp/api/liquidation.py,sha256=CtME5524VVW9mXMMpORyUP205sTVqpLnHIPoTy2MGa8,5439
8
8
  afp/api/trading.py,sha256=HjskW4c13CwAB-AwyIsSBcvyXKKEJk7a9768tqcTzUE,10648
9
- afp/bindings/__init__.py,sha256=5PDdlk0aClsTt2NgbVqP-R-z2QQp99IfXaSB13Pmf5c,1155
10
- afp/bindings/auctioneer_facet.py,sha256=99FmK35trfOIJGqJqyc1NnpG0KavhH0_jNufszZ9VhA,24013
9
+ afp/bindings/__init__.py,sha256=_n9xoogYi8AAlSx_PE-wjnwP1ujVyDUwoRM0BSm243U,1271
10
+ afp/bindings/auctioneer_facet.py,sha256=4p906zdU2lUsqpWlsiLE3dlxTPrlNpqk8DtjiQUWJ8M,23919
11
11
  afp/bindings/bankruptcy_facet.py,sha256=Yg8sLhDU0crsL1ISSy4eoeQEP5jrAuiWBBlco5MtgPc,11370
12
- afp/bindings/clearing_facet.py,sha256=GLBtquybV1FRvDNlYXgpcvlpgw9pvZ5UJbLOYKayPMU,34168
12
+ afp/bindings/clearing_facet.py,sha256=DzRzzP9qXQ7kJMcMRwoLwLJ7S-w-2mid_CbF1fOVHaE,34081
13
13
  afp/bindings/erc20.py,sha256=-jw7ohcEbUL7g3PpK3-a5_7ClUDCDHt1bezm-w7exzo,10822
14
- afp/bindings/facade.py,sha256=FDKY6XLYsK6suDmWSsP5cek8y4ycY4soo9R4udvG1MM,2019
14
+ afp/bindings/facade.py,sha256=nZmAp7r26iszxtNyE5imdl_PKbG6vii_3oYJ3Q69iow,2278
15
15
  afp/bindings/final_settlement_facet.py,sha256=gYJXiUyZ_-L8i8LHnPUmB3mBhLxHr8GAtKurwsCypa0,7699
16
16
  afp/bindings/margin_account.py,sha256=ffkpf5HEXQCxiWuLpgDcHVAiaUVvbKU1Kt0K8tvgZcA,42461
17
17
  afp/bindings/margin_account_registry.py,sha256=mx9sAU6HuC09d-LAf9bzP57HPLa3M6qXpN7Lj-uiXSc,18800
18
18
  afp/bindings/mark_price_tracker_facet.py,sha256=vnVsAmpts_2Sv9Jmx3JlON8X8FJd9D2jOFhqSwXIA7A,2830
19
19
  afp/bindings/oracle_provider.py,sha256=CMpVAXdUuTP_W9ZE297B-m9MjuW90yCOhNLMVl3kCf0,15863
20
20
  afp/bindings/product_registry.py,sha256=HFWwbFKvXk0A2dZB6KBa0Ul8-vX9uvvtGj0dhRL9UUw,43701
21
- afp/bindings/trading_protocol.py,sha256=a8QLCQ9bKgV26IW1y4aY8js9ykO8l2_VTM8YPCo6SqM,43895
22
- afp/config.py,sha256=3S7k49n4ZaRko3FX6Hw95r5L-sw2XiAjWtqYiX3Omx0,1017
21
+ afp/bindings/system_viewer.py,sha256=Kwi-Kz2oKh5qWy17N0D2LyrAbkKz_sW9OxeWh6VX_j8,41347
22
+ afp/bindings/trading_protocol.py,sha256=ZloF3REbjFq9v0UGVsM0_Lk0EhfWJKdeJ0PzVEnyZo0,39573
23
+ afp/config.py,sha256=H5EV-ascn3SZyEgxrW-hOE81oMYhMHwg2ErlQTOfi_8,1158
23
24
  afp/decorators.py,sha256=Ustc15RbXGYIEqDb9lXnd-bdhZJ8ZrztN4h_vjkLsG0,2692
24
25
  afp/enums.py,sha256=4dglBx4Amcu0GrlJn0cIj-rp9uDHZGfDEP_vMAO02xo,485
25
26
  afp/exceptions.py,sha256=RE8IE6akDgbar2PobdpOiBdGZZCYkb4jWf1ozJmdLaI,342
26
27
  afp/exchange.py,sha256=l8Cartp0R4PPe6O_Wu10YDw-5P_PbaAkd7w-W5QrlWY,5272
27
28
  afp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- afp/schemas.py,sha256=nCR8FLnq8msTFW9wsLxjTrxIzcKG85BKG-WmQ5Oazrc,4903
29
+ afp/schemas.py,sha256=8nlNPq6t_jmYEpa_WWhOIr_yvpQv5tj86uvpGTNHWZY,4996
29
30
  afp/signing.py,sha256=7fohnAvoiDA4ems_3OcVnr16OmYLSg9NnnCSzDplg6s,2235
30
31
  afp/validators.py,sha256=m61ZpP385CxsdDGJavPkXKTXnJAHKLCzedoZ8mL6daI,1818
31
- afp_sdk-0.2.0.dist-info/licenses/LICENSE,sha256=ZdaKItgc2ppfqta2OJV0oHpSJiK87PUxmUkUo-_0SB8,1065
32
- afp_sdk-0.2.0.dist-info/WHEEL,sha256=NHRAbdxxzyL9K3IO2LjmlNqKSyPZnKv2BD16YYVKo18,79
33
- afp_sdk-0.2.0.dist-info/METADATA,sha256=GXQP-Cbxe6UAMmmveYzLeG8vDgRodS0N_9jz0Bx1FlE,5618
34
- afp_sdk-0.2.0.dist-info/RECORD,,
32
+ afp_sdk-0.2.2.dist-info/licenses/LICENSE,sha256=ZdaKItgc2ppfqta2OJV0oHpSJiK87PUxmUkUo-_0SB8,1065
33
+ afp_sdk-0.2.2.dist-info/WHEEL,sha256=NHRAbdxxzyL9K3IO2LjmlNqKSyPZnKv2BD16YYVKo18,79
34
+ afp_sdk-0.2.2.dist-info/METADATA,sha256=dEAvm4cSeP9IOn-Q5P8eML070Ar2F5Za3KsrvJhbVY8,5618
35
+ afp_sdk-0.2.2.dist-info/RECORD,,