Skip to content

Commit 2014d1e

Browse files
authored
feat(express-relay): Add simulation_failed to bid status (#1503)
1 parent 93a71f2 commit 2014d1e

File tree

8 files changed

+26
-17
lines changed

8 files changed

+26
-17
lines changed

express_relay/sdk/js/package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

express_relay/sdk/js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@pythnetwork/express-relay-evm-js",
3-
"version": "0.4.0",
3+
"version": "0.4.1",
44
"description": "Utilities for interacting with the express relay protocol",
55
"homepage": "https://github.com/pyth-network/pyth-crosschain/tree/main/express_relay/sdk/js",
66
"author": "Douro Labs",

express_relay/sdk/js/src/examples/simpleSearcher.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ class SimpleSearcher {
3030
resultDetails = `, transaction ${bidStatus.result}`;
3131
}
3232
console.log(
33-
`Bid status for bid ${bidStatus.id}: ${bidStatus.type}${resultDetails}`
33+
`Bid status for bid ${bidStatus.id}: ${bidStatus.type.replaceAll(
34+
"_",
35+
" "
36+
)}${resultDetails}`
3437
);
3538
}
3639

express_relay/sdk/js/src/serverTypes.d.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,10 @@ export interface components {
9090
/** @enum {string} */
9191
type: "pending";
9292
}
93+
| {
94+
/** @enum {string} */
95+
type: "simulation_failed";
96+
}
9397
| {
9498
/**
9599
* Format: int32
@@ -188,7 +192,7 @@ export interface components {
188192
/** @example 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef12 */
189193
signature: string;
190194
/**
191-
* @description How long the bid will be valid for.
195+
* @description The latest unix timestamp in seconds until which the bid is valid
192196
* @example 1000000000000000000
193197
*/
194198
valid_until: string;

express_relay/sdk/python/express_relay/express_relay_types.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,13 +105,14 @@ class BidStatus(Enum):
105105
SUBMITTED = "submitted"
106106
LOST = "lost"
107107
PENDING = "pending"
108+
SIMULATION_FAILED = "simulation_failed"
108109

109110

110111
class BidStatusUpdate(BaseModel):
111112
"""
112113
Attributes:
113114
id: The ID of the bid.
114-
bid_status: The status enum, either SUBMITTED, LOST, or PENDING.
115+
bid_status: The current status of the bid.
115116
result: The result of the bid: a transaction hash if the status is SUBMITTED or LOST, else None.
116117
index: The index of the bid in the submitted transaction; None if the status is not SUBMITTED.
117118
"""
@@ -123,7 +124,10 @@ class BidStatusUpdate(BaseModel):
123124

124125
@model_validator(mode="after")
125126
def check_result(self):
126-
if self.bid_status == BidStatus("pending"):
127+
if self.bid_status in [
128+
BidStatus("pending"),
129+
BidStatus("simulation_failed"),
130+
]:
127131
assert self.result is None, "result must be None"
128132
else:
129133
assert self.result is not None, "result must be a valid 32-byte hash"

express_relay/sdk/python/express_relay/searcher/examples/simple_searcher.py

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,16 @@ async def bid_status_callback(self, bid_status_update: BidStatusUpdate):
7676
bid_status = bid_status_update.bid_status
7777
result = bid_status_update.result
7878

79+
result_details = ""
7980
if bid_status == BidStatus("submitted"):
80-
logger.info(
81-
f"Bid {id} has been submitted in transaction {result} at index {bid_status_update.index} of the multicall"
81+
result_details = (
82+
f", transaction {result}, index {bid_status_update.index} of multicall"
8283
)
8384
elif bid_status == BidStatus("lost"):
84-
logger.info(
85-
f"Bid {id} was unsuccessful, not included in transaction {result}"
86-
)
87-
elif bid_status == BidStatus("pending"):
88-
logger.info(f"Bid {id} is pending")
89-
else:
90-
logger.error(f"Unrecognized status {bid_status} for bid {id}")
85+
result_details = f", transaction {result}"
86+
logger.error(
87+
f"Bid status for bid {id}: {bid_status.value.replace('_', ' ')}{result_details}"
88+
)
9189

9290

9391
async def main():

express_relay/sdk/python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "express-relay"
3-
version = "0.4.1"
3+
version = "0.4.2"
44
description = "Utilities for searchers and protocols to interact with the Express Relay protocol."
55
authors = ["dourolabs"]
66
license = "Proprietary"

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)