Skip to content
Open
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
211 changes: 154 additions & 57 deletions core/api-doc-config.generated.json

Large diffs are not rendered by default.

131 changes: 129 additions & 2 deletions sdks/python/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,133 @@ exchange.has
```


---
### `get_auth_nonce`

Override in subclasses to force specific capability values.


**Signature:**

```python
def get_auth_nonce(wallet_address: str) -> AuthNonceResponse:
```

**Parameters:**

- `wallet_address` (str): The wallet address to authenticate

**Returns:** AuthNonceResponse - Result

**Example:**

```python
exchange.get_auth_nonce(wallet_address="...")
```


---
### `login_with_signature`

Login with a signed nonce to obtain session credentials.


**Signature:**

```python
def login_with_signature(wallet_address: str, signature: str, nonce: str) -> AuthLoginResponse:
```

**Parameters:**

- `wallet_address` (str): The wallet address
- `signature` (str): The signature of the nonce message
- `nonce` (str): The nonce that was signed

**Returns:** AuthLoginResponse - Result

**Example:**

```python
exchange.login_with_signature(wallet_address="...", signature="...", nonce="...")
```


---
### `logout`

Logout and invalidate the current session.


**Signature:**

```python
def logout(wallet_address: Optional[str] = None) -> None:
```

**Parameters:**

- `wallet_address` (str) - **Optional**: The wallet address to logout (optional)

**Returns:** None - Result

**Example:**

```python
exchange.logout(wallet_address="...")
```


---
### `is_session_active`

Check if a session is active for the given wallet address.


**Signature:**

```python
def is_session_active(wallet_address: str) -> bool:
```

**Parameters:**

- `wallet_address` (str): The wallet address to check

**Returns:** bool - Result

**Example:**

```python
exchange.is_session_active(wallet_address="...")
```


---
### `get_session`

Get the stored session for a wallet address.


**Signature:**

```python
def get_session(wallet_address: str) -> Optional[AuthSession]:
```

**Parameters:**

- `wallet_address` (str): The wallet address

**Returns:** Optional[AuthSession] - Result

**Example:**

```python
exchange.get_session(wallet_address="...")
```


---
### `load_markets`

Expand Down Expand Up @@ -1172,12 +1299,12 @@ Compare live prices for the same market across venues. Finds identity matches an
**Signature:**

```python
def compare_market_prices(params: FetchMatchesParams) -> List[PriceComparison]:
def compare_market_prices(params: CompareMarketPricesParams) -> List[PriceComparison]:
```

**Parameters:**

- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally)
- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally)

**Returns:** List[[PriceComparison](#pricecomparison)] - Array of price comparisons across venues

Expand Down
8 changes: 8 additions & 0 deletions sdks/python/pmxt/_exchanges.py
Original file line number Diff line number Diff line change
Expand Up @@ -593,6 +593,7 @@ def __init__(
auto_start_server: Optional[bool] = None,
pmxt_api_key: Optional[str] = None,
wallet_address: Optional[str] = None,
api_base_url: Optional[str] = None,
signer: Optional[object] = None,
websocket: Optional[dict] = None,
) -> None:
Expand All @@ -604,6 +605,10 @@ def __init__(
auto_start_server: Automatically start server if not running (default: True)
pmxt_api_key: Hosted PMXT API key (optional; enables hosted mode)
wallet_address: Wallet address for hosted reads/writes (optional)
api_base_url: Base URL of the SuiBets exchange API itself (not the
sidecar — that is ``base_url``). Forwarded to the sidecar as the
``baseUrl`` credential; falls back to the SUIBETS_BASE_URL env
var on the sidecar side when unset (optional)
signer: Custom signer for hosted writes (optional)
websocket: WebSocket transport configuration dict (optional)
"""
Expand All @@ -616,11 +621,14 @@ def __init__(
signer=signer,
websocket=websocket,
)
self.api_base_url = api_base_url

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


Expand Down
1 change: 1 addition & 0 deletions sdks/python/pmxt/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -671,6 +671,7 @@ class PolymarketOptions(ExchangeOptions, total=False):
class SuiBetsOptions(ExchangeOptions, total=False):
"""Constructor options for SuiBets clients."""
wallet_address: str
api_base_url: str


class RouterOptions(TypedDict, total=False):
Expand Down
19 changes: 19 additions & 0 deletions sdks/python/tests/test_hosted_dispatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,25 @@ def test_suibets_constructor_accepts_wallet_address_for_hosted_mode() -> None:
assert api._get_credentials_dict() == {"walletAddress": WALLET_ADDRESS}


def test_suibets_constructor_forwards_api_base_url_credential() -> None:
api = SuiBets(
wallet_address=WALLET_ADDRESS,
api_base_url="https://suibets.example",
auto_start_server=False,
)

assert api._get_credentials_dict() == {
"walletAddress": WALLET_ADDRESS,
"baseUrl": "https://suibets.example",
}


def test_suibets_api_base_url_alone_produces_credentials() -> None:
api = SuiBets(api_base_url="https://suibets.example", auto_start_server=False)

assert api._get_credentials_dict() == {"baseUrl": "https://suibets.example"}


# --------------------------------------------------------------------------- #
# Read-method dispatch tests
# --------------------------------------------------------------------------- #
Expand Down
131 changes: 129 additions & 2 deletions sdks/typescript/API_REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,133 @@ exchange.has
```


---
### `getAuthNonce`

Override in subclasses to force specific capability values.


**Signature:**

```typescript
async getAuthNonce(walletAddress: string): Promise<AuthNonceResponse>
```

**Parameters:**

- `walletAddress` (string): The wallet address to authenticate

**Returns:** Promise<AuthNonceResponse> - Result

**Example:**

```typescript
await exchange.getAuthNonce("...")
```


---
### `loginWithSignature`

Login with a signed nonce to obtain session credentials.


**Signature:**

```typescript
async loginWithSignature(walletAddress: string, signature: string, nonce: string): Promise<AuthLoginResponse>
```

**Parameters:**

- `walletAddress` (string): The wallet address
- `signature` (string): The signature of the nonce message
- `nonce` (string): The nonce that was signed

**Returns:** Promise<AuthLoginResponse> - Result

**Example:**

```typescript
await exchange.loginWithSignature("...", "...", "...")
```


---
### `logout`

Logout and invalidate the current session.


**Signature:**

```typescript
async logout(walletAddress?: string): Promise<void>
```

**Parameters:**

- `walletAddress` (string) - **Optional**: The wallet address to logout (optional)

**Returns:** Promise<void> - Result

**Example:**

```typescript
await exchange.logout({ walletAddress: "..." })
```


---
### `isSessionActive`

Check if a session is active for the given wallet address.


**Signature:**

```typescript
async isSessionActive(walletAddress: string): Promise<boolean>
```

**Parameters:**

- `walletAddress` (string): The wallet address to check

**Returns:** Promise<boolean> - Result

**Example:**

```typescript
await exchange.isSessionActive("...")
```


---
### `getSession`

Get the stored session for a wallet address.


**Signature:**

```typescript
async getSession(walletAddress: string): Promise<AuthSession | undefined>
```

**Parameters:**

- `walletAddress` (string): The wallet address

**Returns:** Promise<AuthSession | undefined> - Result

**Example:**

```typescript
await exchange.getSession("...")
```


---
### `loadMarkets`

Expand Down Expand Up @@ -1174,12 +1301,12 @@ Compare live prices for the same market across venues. Finds identity matches an
**Signature:**

```typescript
async compareMarketPrices(params: FetchMatchesParams): Promise<PriceComparison[]>
async compareMarketPrices(params: CompareMarketPricesParams): Promise<PriceComparison[]>
```

**Parameters:**

- `params` (FetchMatchesParams): Match filter parameters (uses relation: 'identity' internally)
- `params` (CompareMarketPricesParams): Match filter parameters (uses relation: 'identity' internally)

**Returns:** Promise<[PriceComparison](#pricecomparison)[]> - Array of price comparisons across venues

Expand Down
Loading