prediction-market-agent-tooling 0.69.9__py3-none-any.whl → 0.69.10.dev1119__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.
- prediction_market_agent_tooling/tools/cow/cow_order.py +16 -0
- prediction_market_agent_tooling/tools/cow/models.py +114 -6
- {prediction_market_agent_tooling-0.69.9.dist-info → prediction_market_agent_tooling-0.69.10.dev1119.dist-info}/METADATA +1 -1
- {prediction_market_agent_tooling-0.69.9.dist-info → prediction_market_agent_tooling-0.69.10.dev1119.dist-info}/RECORD +7 -7
- {prediction_market_agent_tooling-0.69.9.dist-info → prediction_market_agent_tooling-0.69.10.dev1119.dist-info}/WHEEL +1 -1
- {prediction_market_agent_tooling-0.69.9.dist-info → prediction_market_agent_tooling-0.69.10.dev1119.dist-info}/entry_points.txt +0 -0
- {prediction_market_agent_tooling-0.69.9.dist-info → prediction_market_agent_tooling-0.69.10.dev1119.dist-info}/licenses/LICENSE +0 -0
@@ -399,6 +399,22 @@ def get_orders_by_owner(
|
|
399
399
|
return [Order.model_validate(i) for i in items]
|
400
400
|
|
401
401
|
|
402
|
+
@tenacity.retry(
|
403
|
+
stop=stop_after_attempt(3),
|
404
|
+
wait=wait_fixed(1),
|
405
|
+
after=lambda x: logger.debug(f"get_order_by_uid failed, {x.attempt_number=}."),
|
406
|
+
)
|
407
|
+
async def get_order_by_uid(
|
408
|
+
uid: HexBytes,
|
409
|
+
) -> Order:
|
410
|
+
async with httpx.AsyncClient() as client:
|
411
|
+
response = await client.get(
|
412
|
+
f"https://api.cow.fi/xdai/api/v1/orders/{uid.to_0x_hex()}"
|
413
|
+
)
|
414
|
+
response.raise_for_status()
|
415
|
+
return Order.model_validate(response.json())
|
416
|
+
|
417
|
+
|
402
418
|
@tenacity.retry(
|
403
419
|
stop=stop_after_attempt(3),
|
404
420
|
wait=wait_fixed(1),
|
@@ -1,23 +1,131 @@
|
|
1
|
-
from
|
1
|
+
from enum import Enum
|
2
|
+
from typing import Annotated, Optional
|
3
|
+
|
4
|
+
from pydantic import BaseModel, BeforeValidator, ConfigDict
|
2
5
|
from sqlmodel import Field, SQLModel
|
6
|
+
from web3 import Web3
|
3
7
|
|
4
|
-
from prediction_market_agent_tooling.gtypes import ChecksumAddress, HexBytes
|
8
|
+
from prediction_market_agent_tooling.gtypes import ChecksumAddress, HexBytes, Wei
|
5
9
|
from prediction_market_agent_tooling.tools.datetime_utc import DatetimeUTC
|
6
10
|
from prediction_market_agent_tooling.tools.utils import utcnow
|
7
11
|
|
8
12
|
|
9
13
|
class MinimalisticTrade(BaseModel):
|
10
|
-
sellToken: ChecksumAddress
|
11
|
-
buyToken: ChecksumAddress
|
14
|
+
sellToken: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
15
|
+
buyToken: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
12
16
|
orderUid: HexBytes
|
13
17
|
txHash: HexBytes
|
14
18
|
|
15
19
|
|
20
|
+
class EthFlowData(BaseModel):
|
21
|
+
refundTxHash: Optional[HexBytes]
|
22
|
+
userValidTo: int
|
23
|
+
|
24
|
+
|
25
|
+
class PlacementError(str, Enum):
|
26
|
+
QuoteNotFound = "QuoteNotFound"
|
27
|
+
ValidToTooFarInFuture = "ValidToTooFarInFuture"
|
28
|
+
PreValidationError = "PreValidationError"
|
29
|
+
|
30
|
+
|
31
|
+
class OnchainOrderData(BaseModel):
|
32
|
+
sender: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
33
|
+
placementError: Optional[PlacementError]
|
34
|
+
|
35
|
+
|
36
|
+
class OrderKind(str, Enum):
|
37
|
+
buy = "buy"
|
38
|
+
sell = "sell"
|
39
|
+
|
40
|
+
|
41
|
+
class SellTokenBalance(str, Enum):
|
42
|
+
external = "external"
|
43
|
+
internal = "internal"
|
44
|
+
erc20 = "erc20"
|
45
|
+
|
46
|
+
|
47
|
+
class BuyTokenBalance(str, Enum):
|
48
|
+
internal = "internal"
|
49
|
+
erc20 = "erc20"
|
50
|
+
|
51
|
+
|
52
|
+
class SigningScheme(str, Enum):
|
53
|
+
eip712 = "eip712"
|
54
|
+
ethsign = "ethsign"
|
55
|
+
presign = "presign"
|
56
|
+
eip1271 = "eip1271"
|
57
|
+
|
58
|
+
|
59
|
+
class OrderClass(str, Enum):
|
60
|
+
limit = "limit"
|
61
|
+
liquidity = "liquidity"
|
62
|
+
market = "market"
|
63
|
+
|
64
|
+
|
65
|
+
class OrderStatus(str, Enum):
|
66
|
+
presignaturePending = "presignaturePending"
|
67
|
+
open = "open"
|
68
|
+
fulfilled = "fulfilled"
|
69
|
+
cancelled = "cancelled"
|
70
|
+
expired = "expired"
|
71
|
+
|
72
|
+
|
16
73
|
class Order(BaseModel):
|
74
|
+
model_config = ConfigDict(validate_by_name=True, validate_by_alias=True)
|
75
|
+
|
17
76
|
uid: str
|
18
|
-
|
19
|
-
|
77
|
+
quoteId: int | None = None
|
78
|
+
validTo: int
|
79
|
+
sellAmount: Wei
|
80
|
+
sellToken: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
81
|
+
buyAmount: Wei
|
82
|
+
buyToken: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
83
|
+
receiver: Annotated[
|
84
|
+
ChecksumAddress | None,
|
85
|
+
BeforeValidator(
|
86
|
+
lambda x: Web3.to_checksum_address(x) if x is not None else None
|
87
|
+
),
|
88
|
+
]
|
89
|
+
feeAmount: Wei
|
20
90
|
creationDate: DatetimeUTC
|
91
|
+
kind: OrderKind
|
92
|
+
partiallyFillable: bool
|
93
|
+
sellTokenBalance: SellTokenBalance | None
|
94
|
+
buyTokenBalance: BuyTokenBalance | None
|
95
|
+
signingScheme: SigningScheme
|
96
|
+
signature: HexBytes
|
97
|
+
from_: Annotated[
|
98
|
+
ChecksumAddress | None,
|
99
|
+
BeforeValidator(
|
100
|
+
lambda x: Web3.to_checksum_address(x) if x is not None else None
|
101
|
+
),
|
102
|
+
] = Field(None, alias="from")
|
103
|
+
appData: str
|
104
|
+
fullAppData: str | None
|
105
|
+
appDataHash: HexBytes | None = None
|
106
|
+
class_: str = Field(None, alias="class")
|
107
|
+
owner: Annotated[ChecksumAddress, BeforeValidator(Web3.to_checksum_address)]
|
108
|
+
executedSellAmount: Wei
|
109
|
+
executedSellAmountBeforeFees: Wei
|
110
|
+
executedBuyAmount: Wei
|
111
|
+
executedFeeAmount: Wei | None
|
112
|
+
invalidated: bool
|
113
|
+
status: str
|
114
|
+
isLiquidityOrder: bool | None
|
115
|
+
ethflowData: EthFlowData | None = None
|
116
|
+
onchainUser: Annotated[
|
117
|
+
ChecksumAddress | None,
|
118
|
+
BeforeValidator(
|
119
|
+
lambda x: Web3.to_checksum_address(x) if x is not None else None
|
120
|
+
),
|
121
|
+
] = None
|
122
|
+
executedFee: Wei
|
123
|
+
executedFeeToken: Annotated[
|
124
|
+
ChecksumAddress | None,
|
125
|
+
BeforeValidator(
|
126
|
+
lambda x: Web3.to_checksum_address(x) if x is not None else None
|
127
|
+
),
|
128
|
+
]
|
21
129
|
|
22
130
|
|
23
131
|
class RateLimit(SQLModel, table=True):
|
@@ -95,8 +95,8 @@ prediction_market_agent_tooling/tools/caches/serializers.py,sha256=vFDx4fsPxclXp
|
|
95
95
|
prediction_market_agent_tooling/tools/contract.py,sha256=BzpAFcbKl_KqwgAlaXx63Fg8jzr0EO3qEeOs1K11CPA,33905
|
96
96
|
prediction_market_agent_tooling/tools/contract_utils.py,sha256=9X9raICUZkPDShilt02aYzS_ILZ62u0vG5081uWLdqk,2152
|
97
97
|
prediction_market_agent_tooling/tools/costs.py,sha256=EaAJ7v9laD4VEV3d8B44M4u3_oEO_H16jRVCdoZ93Uw,954
|
98
|
-
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=
|
99
|
-
prediction_market_agent_tooling/tools/cow/models.py,sha256=
|
98
|
+
prediction_market_agent_tooling/tools/cow/cow_order.py,sha256=DN_8cPrr4jWVpXdS4D0j1QB19nB8fxDoSheo2BFMc8M,14523
|
99
|
+
prediction_market_agent_tooling/tools/cow/models.py,sha256=y_zsPEw7sG-OV6ooycQ9mx75GtnG3SuwXc6xuxL_o3I,3799
|
100
100
|
prediction_market_agent_tooling/tools/cow/semaphore.py,sha256=LPB-4wNQf7El7dgBD4Tmol6vr5j1CP9qMeDm8dcs6RI,3741
|
101
101
|
prediction_market_agent_tooling/tools/custom_exceptions.py,sha256=Fh8z1fbwONvP4-j7AmV_PuEcoqb6-QXa9PJ9m7guMcM,93
|
102
102
|
prediction_market_agent_tooling/tools/datetime_utc.py,sha256=_oO6mMc28C9aSmQfrG-S7UQy5uMHVEQqia8arnscVCk,3213
|
@@ -137,8 +137,8 @@ prediction_market_agent_tooling/tools/tokens/usd.py,sha256=DPO-4HBTy1-TZHKL_9CnH
|
|
137
137
|
prediction_market_agent_tooling/tools/transaction_cache.py,sha256=K5YKNL2_tR10Iw2TD9fuP-CTGpBbZtNdgbd0B_R7pjg,1814
|
138
138
|
prediction_market_agent_tooling/tools/utils.py,sha256=ruq6P5TFs8CBHxeBLj1Plpx7kuNFPpDgMsJGQgDiRNs,8785
|
139
139
|
prediction_market_agent_tooling/tools/web3_utils.py,sha256=CDbaidlLeQ4VHzSg150L7QNfHfGveljSePGuDVFEYqc,13963
|
140
|
-
prediction_market_agent_tooling-0.69.
|
141
|
-
prediction_market_agent_tooling-0.69.
|
142
|
-
prediction_market_agent_tooling-0.69.
|
143
|
-
prediction_market_agent_tooling-0.69.
|
144
|
-
prediction_market_agent_tooling-0.69.
|
140
|
+
prediction_market_agent_tooling-0.69.10.dev1119.dist-info/METADATA,sha256=4cM7-CJ3tpEUsBYQasv-387chs1IoRw0L1l5Xs7CqIU,8899
|
141
|
+
prediction_market_agent_tooling-0.69.10.dev1119.dist-info/WHEEL,sha256=zp0Cn7JsFoX2ATtOhtaFYIiE2rmFAD4OcMhtUki8W3U,88
|
142
|
+
prediction_market_agent_tooling-0.69.10.dev1119.dist-info/entry_points.txt,sha256=m8PukHbeH5g0IAAmOf_1Ahm-sGAMdhSSRQmwtpmi2s8,81
|
143
|
+
prediction_market_agent_tooling-0.69.10.dev1119.dist-info/licenses/LICENSE,sha256=6or154nLLU6bELzjh0mCreFjt0m2v72zLi3yHE0QbeE,7650
|
144
|
+
prediction_market_agent_tooling-0.69.10.dev1119.dist-info/RECORD,,
|
File without changes
|