Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sdks/python/pmxt/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
OrderHistoryParams,
ExchangeOptions,
PolymarketOptions,
SuiBetsOptions,
RouterOptions,
FeedClientOptions,
MatchResult,
Expand Down Expand Up @@ -194,6 +195,7 @@ def restart_server() -> None:
"FeedClient",
"ExchangeOptions",
"PolymarketOptions",
"SuiBetsOptions",
"RouterOptions",
"FeedClientOptions",
# Environment
Expand Down
9 changes: 9 additions & 0 deletions sdks/python/pmxt/_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,7 @@ def __init__(
base_url: Optional[str] = None,
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
wallet_address: Optional[str] = None,
) -> None:
"""
Initialize SuiBets client.
Expand All @@ -508,14 +509,22 @@ def __init__(
base_url: Base URL of the PMXT sidecar server
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: Sui wallet address used for hosted reads
"""
super().__init__(
exchange_name="suibets",
base_url=base_url,
auto_start_server=auto_start_server,
pmxt_api_key=pmxt_api_key,
wallet_address=wallet_address,
)

def _get_credentials_dict(self) -> Optional[Dict[str, Any]]:
creds = super()._get_credentials_dict() or {}
if self.wallet_address:
creds["walletAddress"] = self.wallet_address
return creds if creds else None


class Rain(Exchange):
"""Rain exchange client."""
Expand Down
5 changes: 5 additions & 0 deletions sdks/python/pmxt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,6 +668,11 @@ class PolymarketOptions(ExchangeOptions, total=False):
signature_type: Union[Literal["eoa", "poly-proxy", "gnosis-safe"], int]


class SuiBetsOptions(ExchangeOptions, total=False):
"""Constructor options for SuiBets clients."""
wallet_address: str


class RouterOptions(TypedDict, total=False):
"""Constructor options for Router clients."""
pmxt_api_key: str
Expand Down
13 changes: 12 additions & 1 deletion sdks/python/tests/test_hosted_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from pmxt._hosted_routing import HOSTED_TRADING_BASE_URL
from pmxt._hosted_errors import MissingWalletAddress, NotSupported
from pmxt._exchanges import Hunch, Limitless, Myriad, Polymarket
from pmxt._exchanges import Hunch, Limitless, Myriad, Polymarket, SuiBets
from pmxt.errors import InvalidSignature
import pmxt.client as client_module
from pmxt.models import BuiltOrder
Expand Down Expand Up @@ -168,6 +168,17 @@ def test_hunch_constructor_accepts_wallet_address_for_hosted_mode():
assert api.wallet_address == WALLET_ADDRESS


def test_suibets_constructor_accepts_wallet_address_for_hosted_mode() -> None:
api = SuiBets(
pmxt_api_key="hosted-key",
wallet_address=WALLET_ADDRESS,
auto_start_server=False,
)

assert api.wallet_address == WALLET_ADDRESS
assert api._get_credentials_dict() == {"walletAddress": WALLET_ADDRESS}


# --------------------------------------------------------------------------- #
# Read-method dispatch tests
# --------------------------------------------------------------------------- #
Expand Down
2 changes: 1 addition & 1 deletion sdks/python/tests/test_public_exports.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def test_websocket_return_types_are_public_exports():
if isinstance(item, ast.Constant) and isinstance(item.value, str)
)

expected = {"FirehoseEvent", "SubscribedAddressSnapshot", "ExchangeOptions", "PolymarketOptions", "RouterOptions", "FeedClientOptions", "SeriesFetchParams", "TradesParams", "FetchOrderBookParams", "MatchedClusterSort", "FetchMatchedMarketClustersParams", "FetchMatchedEventClustersParams"}
expected = {"FirehoseEvent", "SubscribedAddressSnapshot", "ExchangeOptions", "PolymarketOptions", "SuiBetsOptions", "RouterOptions", "FeedClientOptions", "SeriesFetchParams", "TradesParams", "FetchOrderBookParams", "MatchedClusterSort", "FetchMatchedMarketClustersParams", "FetchMatchedEventClustersParams"}
assert expected <= imported_models
assert expected <= public_exports

Expand Down
Loading