From 27562dccaec404ade250d8500442e3127cb9f085 Mon Sep 17 00:00:00 2001 From: Mihail Lavric Date: Wed, 13 Aug 2025 19:37:47 +0300 Subject: [PATCH 1/2] update-13-aug --- .openapi-generator/FILES | 21 + docs/AccountApi.md | 80 ++++ docs/AccountPosition.md | 1 + docs/HasRefereeCode.md | 31 ++ docs/OrderApi.md | 76 ++++ docs/PublicPoolInfo.md | 4 +- docs/PublicPoolMetadata.md | 40 ++ docs/ReferralApi.md | 70 +++ docs/ReqGetAccountActiveOrders.md | 31 ++ docs/ReqGetPublicPoolsMetadata.md | 33 ++ docs/ReqHasRefereeByL1Address.md | 29 ++ docs/RespPublicPoolsMetadata.md | 31 ++ docs/SharePrice.md | 30 ++ lighter/__init__.py | 7 + lighter/api/account_api.py | 347 +++++++++++++++ lighter/api/order_api.py | 312 ++++++++++++++ lighter/api/referral_api.py | 264 ++++++++++++ lighter/models/__init__.py | 7 + lighter/models/account_position.py | 4 +- lighter/models/has_referee_code.py | 104 +++++ lighter/models/public_pool_info.py | 20 +- lighter/models/public_pool_metadata.py | 126 ++++++ .../models/req_get_account_active_orders.py | 104 +++++ .../models/req_get_public_pools_metadata.py | 119 +++++ .../models/req_has_referee_by_l1_address.py | 100 +++++ lighter/models/resp_public_pools_metadata.py | 112 +++++ lighter/models/share_price.py | 102 +++++ openapi.json | 405 +++++++++++++++++- 28 files changed, 2579 insertions(+), 31 deletions(-) create mode 100644 docs/HasRefereeCode.md create mode 100644 docs/PublicPoolMetadata.md create mode 100644 docs/ReqGetAccountActiveOrders.md create mode 100644 docs/ReqGetPublicPoolsMetadata.md create mode 100644 docs/ReqHasRefereeByL1Address.md create mode 100644 docs/RespPublicPoolsMetadata.md create mode 100644 docs/SharePrice.md create mode 100644 lighter/models/has_referee_code.py create mode 100644 lighter/models/public_pool_metadata.py create mode 100644 lighter/models/req_get_account_active_orders.py create mode 100644 lighter/models/req_get_public_pools_metadata.py create mode 100644 lighter/models/req_has_referee_by_l1_address.py create mode 100644 lighter/models/resp_public_pools_metadata.py create mode 100644 lighter/models/share_price.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 5a01738..1012fda 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -39,6 +39,7 @@ docs/FundingApi.md docs/FundingRate.md docs/FundingRates.md docs/Fundings.md +docs/HasRefereeCode.md docs/InfoApi.md docs/L1Metadata.md docs/L1ProviderInfo.md @@ -65,6 +66,7 @@ docs/PositionFundings.md docs/PriceLevel.md docs/PublicPool.md docs/PublicPoolInfo.md +docs/PublicPoolMetadata.md docs/PublicPoolShare.md docs/PublicPools.md docs/ReferralApi.md @@ -72,6 +74,7 @@ docs/ReferralPointEntry.md docs/ReferralPoints.md docs/ReqExportData.md docs/ReqGetAccount.md +docs/ReqGetAccountActiveOrders.md docs/ReqGetAccountApiKeys.md docs/ReqGetAccountByL1Address.md docs/ReqGetAccountInactiveOrders.md @@ -96,6 +99,7 @@ docs/ReqGetOrderBookOrders.md docs/ReqGetOrderBooks.md docs/ReqGetPositionFunding.md docs/ReqGetPublicPools.md +docs/ReqGetPublicPoolsMetadata.md docs/ReqGetRangeWithCursor.md docs/ReqGetRangeWithIndex.md docs/ReqGetRangeWithIndexSortable.md @@ -106,8 +110,10 @@ docs/ReqGetTransferFeeInfo.md docs/ReqGetTransferHistory.md docs/ReqGetTx.md docs/ReqGetWithdrawHistory.md +docs/ReqHasRefereeByL1Address.md docs/RespChangeAccountTier.md docs/RespGetFastBridgeInfo.md +docs/RespPublicPoolsMetadata.md docs/RespSendTx.md docs/RespSendTxBatch.md docs/RespWithdrawalDelay.md @@ -115,6 +121,7 @@ docs/ResultCode.md docs/RiskInfo.md docs/RiskParameters.md docs/RootApi.md +docs/SharePrice.md docs/SimpleOrder.md docs/Status.md docs/SubAccounts.md @@ -188,6 +195,7 @@ lighter/models/funding.py lighter/models/funding_rate.py lighter/models/funding_rates.py lighter/models/fundings.py +lighter/models/has_referee_code.py lighter/models/l1_metadata.py lighter/models/l1_provider_info.py lighter/models/liq_trade.py @@ -211,12 +219,14 @@ lighter/models/position_fundings.py lighter/models/price_level.py lighter/models/public_pool.py lighter/models/public_pool_info.py +lighter/models/public_pool_metadata.py lighter/models/public_pool_share.py lighter/models/public_pools.py lighter/models/referral_point_entry.py lighter/models/referral_points.py lighter/models/req_export_data.py lighter/models/req_get_account.py +lighter/models/req_get_account_active_orders.py lighter/models/req_get_account_api_keys.py lighter/models/req_get_account_by_l1_address.py lighter/models/req_get_account_inactive_orders.py @@ -241,6 +251,7 @@ lighter/models/req_get_order_book_orders.py lighter/models/req_get_order_books.py lighter/models/req_get_position_funding.py lighter/models/req_get_public_pools.py +lighter/models/req_get_public_pools_metadata.py lighter/models/req_get_range_with_cursor.py lighter/models/req_get_range_with_index.py lighter/models/req_get_range_with_index_sortable.py @@ -251,14 +262,17 @@ lighter/models/req_get_transfer_fee_info.py lighter/models/req_get_transfer_history.py lighter/models/req_get_tx.py lighter/models/req_get_withdraw_history.py +lighter/models/req_has_referee_by_l1_address.py lighter/models/resp_change_account_tier.py lighter/models/resp_get_fast_bridge_info.py +lighter/models/resp_public_pools_metadata.py lighter/models/resp_send_tx.py lighter/models/resp_send_tx_batch.py lighter/models/resp_withdrawal_delay.py lighter/models/result_code.py lighter/models/risk_info.py lighter/models/risk_parameters.py +lighter/models/share_price.py lighter/models/simple_order.py lighter/models/status.py lighter/models/sub_accounts.py @@ -281,4 +295,11 @@ lighter/rest.py setup.cfg test-requirements.txt test/__init__.py +test/test_has_referee_code.py +test/test_public_pool_metadata.py +test/test_req_get_account_active_orders.py +test/test_req_get_public_pools_metadata.py +test/test_req_has_referee_by_l1_address.py +test/test_resp_public_pools_metadata.py +test/test_share_price.py tox.ini diff --git a/docs/AccountApi.md b/docs/AccountApi.md index 24bcb76..9e90478 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -15,6 +15,7 @@ Method | HTTP request | Description [**pnl**](AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl [**position_funding**](AccountApi.md#position_funding) | **GET** /api/v1/positionFunding | positionFunding [**public_pools**](AccountApi.md#public_pools) | **GET** /api/v1/publicPools | publicPools +[**public_pools_metadata**](AccountApi.md#public_pools_metadata) | **GET** /api/v1/publicPoolsMetadata | publicPoolsMetadata # **account** @@ -848,3 +849,82 @@ No authorization required [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) +# **public_pools_metadata** +> RespPublicPoolsMetadata public_pools_metadata(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + +publicPoolsMetadata + +Get public pools metadata + +### Example + + +```python +import lighter +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.AccountApi(api_client) + index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + filter = 'filter_example' # str | (optional) + account_index = 56 # int | (optional) + + try: + # publicPoolsMetadata + api_response = await api_instance.public_pools_metadata(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + print("The response of AccountApi->public_pools_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->public_pools_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **filter** | **str**| | [optional] + **account_index** | **int**| | [optional] + +### Return type + +[**RespPublicPoolsMetadata**](RespPublicPoolsMetadata.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/AccountPosition.md b/docs/AccountPosition.md index c75cece..93f2825 100644 --- a/docs/AccountPosition.md +++ b/docs/AccountPosition.md @@ -17,6 +17,7 @@ Name | Type | Description | Notes **position_value** | **str** | | **unrealized_pnl** | **str** | | **realized_pnl** | **str** | | +**liquidation_price** | **str** | | **total_funding_paid_out** | **str** | | [optional] **margin_mode** | **int** | | **allocated_margin** | **str** | | diff --git a/docs/HasRefereeCode.md b/docs/HasRefereeCode.md new file mode 100644 index 0000000..c10a9ac --- /dev/null +++ b/docs/HasRefereeCode.md @@ -0,0 +1,31 @@ +# HasRefereeCode + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**has_referee** | **bool** | | + +## Example + +```python +from lighter.models.has_referee_code import HasRefereeCode + +# TODO update the JSON string below +json = "{}" +# create an instance of HasRefereeCode from a JSON string +has_referee_code_instance = HasRefereeCode.from_json(json) +# print the JSON string representation of the object +print(HasRefereeCode.to_json()) + +# convert the object into a dict +has_referee_code_dict = has_referee_code_instance.to_dict() +# create an instance of HasRefereeCode from a dict +has_referee_code_from_dict = HasRefereeCode.from_dict(has_referee_code_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/OrderApi.md b/docs/OrderApi.md index c7386cc..2b59510 100644 --- a/docs/OrderApi.md +++ b/docs/OrderApi.md @@ -4,6 +4,7 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**account_active_orders**](OrderApi.md#account_active_orders) | **GET** /api/v1/accountActiveOrders | accountActiveOrders [**account_inactive_orders**](OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders [**exchange_stats**](OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats [**export**](OrderApi.md#export) | **GET** /api/v1/export | export @@ -14,6 +15,81 @@ Method | HTTP request | Description [**trades**](OrderApi.md#trades) | **GET** /api/v1/trades | trades +# **account_active_orders** +> Orders account_active_orders(account_index, market_id, authorization=authorization, auth=auth) + +accountActiveOrders + +Get account active orders. `auth` can be generated using the SDK. + +### Example + + +```python +import lighter +from lighter.models.orders import Orders +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + account_index = 56 # int | + market_id = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # accountActiveOrders + api_response = await api_instance.account_active_orders(account_index, market_id, authorization=authorization, auth=auth) + print("The response of OrderApi->account_active_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->account_active_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **market_id** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**Orders**](Orders.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **account_inactive_orders** > Orders account_inactive_orders(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) diff --git a/docs/PublicPoolInfo.md b/docs/PublicPoolInfo.md index 1d8cc8f..d3aac46 100644 --- a/docs/PublicPoolInfo.md +++ b/docs/PublicPoolInfo.md @@ -10,11 +10,9 @@ Name | Type | Description | Notes **min_operator_share_rate** | **str** | | **total_shares** | **int** | | **operator_shares** | **int** | | -**share_price_1d** | **float** | | -**share_price_7d** | **float** | | -**share_price_30d** | **float** | | **annual_percentage_yield** | **float** | | **daily_returns** | [**List[DailyReturn]**](DailyReturn.md) | | +**share_prices** | [**List[SharePrice]**](SharePrice.md) | | ## Example diff --git a/docs/PublicPoolMetadata.md b/docs/PublicPoolMetadata.md new file mode 100644 index 0000000..f3769c2 --- /dev/null +++ b/docs/PublicPoolMetadata.md @@ -0,0 +1,40 @@ +# PublicPoolMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_index** | **int** | | +**account_type** | **int** | | +**name** | **str** | | +**l1_address** | **str** | | +**annual_percentage_yield** | **float** | | +**status** | **int** | | +**operator_fee** | **str** | | +**total_asset_value** | **str** | | +**total_shares** | **int** | | +**account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | [optional] + +## Example + +```python +from lighter.models.public_pool_metadata import PublicPoolMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPoolMetadata from a JSON string +public_pool_metadata_instance = PublicPoolMetadata.from_json(json) +# print the JSON string representation of the object +print(PublicPoolMetadata.to_json()) + +# convert the object into a dict +public_pool_metadata_dict = public_pool_metadata_instance.to_dict() +# create an instance of PublicPoolMetadata from a dict +public_pool_metadata_from_dict = PublicPoolMetadata.from_dict(public_pool_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ReferralApi.md b/docs/ReferralApi.md index 0ee3c8b..6b2e794 100644 --- a/docs/ReferralApi.md +++ b/docs/ReferralApi.md @@ -4,9 +4,79 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**referral_has_referee_by_address**](ReferralApi.md#referral_has_referee_by_address) | **GET** /api/v1/referral/hasRefereeByAddress | referral_hasRefereeByAddress [**referral_points**](ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points +# **referral_has_referee_by_address** +> HasRefereeCode referral_has_referee_by_address(l1_address) + +referral_hasRefereeByAddress + +Does L1 address have referee code? + +### Example + + +```python +import lighter +from lighter.models.has_referee_code import HasRefereeCode +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.ReferralApi(api_client) + l1_address = 'l1_address_example' # str | + + try: + # referral_hasRefereeByAddress + api_response = await api_instance.referral_has_referee_by_address(l1_address) + print("The response of ReferralApi->referral_has_referee_by_address:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_has_referee_by_address: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **l1_address** | **str**| | + +### Return type + +[**HasRefereeCode**](HasRefereeCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + # **referral_points** > ReferralPoints referral_points(account_index, authorization=authorization, auth=auth) diff --git a/docs/ReqGetAccountActiveOrders.md b/docs/ReqGetAccountActiveOrders.md new file mode 100644 index 0000000..d596417 --- /dev/null +++ b/docs/ReqGetAccountActiveOrders.md @@ -0,0 +1,31 @@ +# ReqGetAccountActiveOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**market_id** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountActiveOrders from a JSON string +req_get_account_active_orders_instance = ReqGetAccountActiveOrders.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountActiveOrders.to_json()) + +# convert the object into a dict +req_get_account_active_orders_dict = req_get_account_active_orders_instance.to_dict() +# create an instance of ReqGetAccountActiveOrders from a dict +req_get_account_active_orders_from_dict = ReqGetAccountActiveOrders.from_dict(req_get_account_active_orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ReqGetPublicPoolsMetadata.md b/docs/ReqGetPublicPoolsMetadata.md new file mode 100644 index 0000000..e62dbf5 --- /dev/null +++ b/docs/ReqGetPublicPoolsMetadata.md @@ -0,0 +1,33 @@ +# ReqGetPublicPoolsMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**filter** | **str** | | [optional] +**index** | **int** | | +**limit** | **int** | | +**account_index** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetPublicPoolsMetadata from a JSON string +req_get_public_pools_metadata_instance = ReqGetPublicPoolsMetadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetPublicPoolsMetadata.to_json()) + +# convert the object into a dict +req_get_public_pools_metadata_dict = req_get_public_pools_metadata_instance.to_dict() +# create an instance of ReqGetPublicPoolsMetadata from a dict +req_get_public_pools_metadata_from_dict = ReqGetPublicPoolsMetadata.from_dict(req_get_public_pools_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/ReqHasRefereeByL1Address.md b/docs/ReqHasRefereeByL1Address.md new file mode 100644 index 0000000..6bd9214 --- /dev/null +++ b/docs/ReqHasRefereeByL1Address.md @@ -0,0 +1,29 @@ +# ReqHasRefereeByL1Address + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | + +## Example + +```python +from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqHasRefereeByL1Address from a JSON string +req_has_referee_by_l1_address_instance = ReqHasRefereeByL1Address.from_json(json) +# print the JSON string representation of the object +print(ReqHasRefereeByL1Address.to_json()) + +# convert the object into a dict +req_has_referee_by_l1_address_dict = req_has_referee_by_l1_address_instance.to_dict() +# create an instance of ReqHasRefereeByL1Address from a dict +req_has_referee_by_l1_address_from_dict = ReqHasRefereeByL1Address.from_dict(req_has_referee_by_l1_address_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/RespPublicPoolsMetadata.md b/docs/RespPublicPoolsMetadata.md new file mode 100644 index 0000000..63b6d07 --- /dev/null +++ b/docs/RespPublicPoolsMetadata.md @@ -0,0 +1,31 @@ +# RespPublicPoolsMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**public_pools** | [**List[PublicPoolMetadata]**](PublicPoolMetadata.md) | | + +## Example + +```python +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of RespPublicPoolsMetadata from a JSON string +resp_public_pools_metadata_instance = RespPublicPoolsMetadata.from_json(json) +# print the JSON string representation of the object +print(RespPublicPoolsMetadata.to_json()) + +# convert the object into a dict +resp_public_pools_metadata_dict = resp_public_pools_metadata_instance.to_dict() +# create an instance of RespPublicPoolsMetadata from a dict +resp_public_pools_metadata_from_dict = RespPublicPoolsMetadata.from_dict(resp_public_pools_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/SharePrice.md b/docs/SharePrice.md new file mode 100644 index 0000000..a23c65c --- /dev/null +++ b/docs/SharePrice.md @@ -0,0 +1,30 @@ +# SharePrice + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**share_price** | **float** | | + +## Example + +```python +from lighter.models.share_price import SharePrice + +# TODO update the JSON string below +json = "{}" +# create an instance of SharePrice from a JSON string +share_price_instance = SharePrice.from_json(json) +# print the JSON string representation of the object +print(SharePrice.to_json()) + +# convert the object into a dict +share_price_dict = share_price_instance.to_dict() +# create an instance of SharePrice from a dict +share_price_from_dict = SharePrice.from_dict(share_price_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/lighter/__init__.py b/lighter/__init__.py index a6a804a..9a57bd5 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -77,6 +77,7 @@ from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings +from lighter.models.has_referee_code import HasRefereeCode from lighter.models.l1_metadata import L1Metadata from lighter.models.l1_provider_info import L1ProviderInfo from lighter.models.liq_trade import LiqTrade @@ -100,12 +101,14 @@ from lighter.models.price_level import PriceLevel from lighter.models.public_pool import PublicPool from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_metadata import PublicPoolMetadata from lighter.models.public_pool_share import PublicPoolShare from lighter.models.public_pools import PublicPools from lighter.models.referral_point_entry import ReferralPointEntry from lighter.models.referral_points import ReferralPoints from lighter.models.req_export_data import ReqExportData from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders @@ -130,6 +133,7 @@ from lighter.models.req_get_order_books import ReqGetOrderBooks from lighter.models.req_get_position_funding import ReqGetPositionFunding from lighter.models.req_get_public_pools import ReqGetPublicPools +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable @@ -140,14 +144,17 @@ from lighter.models.req_get_transfer_history import ReqGetTransferHistory from lighter.models.req_get_tx import ReqGetTx from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory +from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.resp_send_tx import RespSendTx from lighter.models.resp_send_tx_batch import RespSendTxBatch from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay from lighter.models.result_code import ResultCode from lighter.models.risk_info import RiskInfo from lighter.models.risk_parameters import RiskParameters +from lighter.models.share_price import SharePrice from lighter.models.simple_order import SimpleOrder from lighter.models.status import Status from lighter.models.sub_accounts import SubAccounts diff --git a/lighter/api/account_api.py b/lighter/api/account_api.py index aa7263c..c92f6dc 100644 --- a/lighter/api/account_api.py +++ b/lighter/api/account_api.py @@ -29,6 +29,7 @@ from lighter.models.position_fundings import PositionFundings from lighter.models.public_pools import PublicPools from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.sub_accounts import SubAccounts from lighter.api_client import ApiClient, RequestSerialized @@ -3543,3 +3544,349 @@ def _public_pools_serialize( ) + + + @validate_call + async def public_pools_metadata( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RespPublicPoolsMetadata: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def public_pools_metadata_with_http_info( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RespPublicPoolsMetadata]: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def public_pools_metadata_without_preload_content( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _public_pools_metadata_serialize( + self, + index, + limit, + authorization, + auth, + filter, + account_index, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if filter is not None: + + _query_params.append(('filter', filter)) + + if index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/publicPoolsMetadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/lighter/api/order_api.py b/lighter/api/order_api.py index 396ea69..6b89d83 100644 --- a/lighter/api/order_api.py +++ b/lighter/api/order_api.py @@ -45,6 +45,318 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + async def account_active_orders( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Orders: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_active_orders_with_http_info( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Orders]: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_active_orders_without_preload_content( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_active_orders_serialize( + self, + account_index, + market_id, + authorization, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if market_id is not None: + + _query_params.append(('market_id', market_id)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountActiveOrders', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call async def account_inactive_orders( self, diff --git a/lighter/api/referral_api.py b/lighter/api/referral_api.py index 733ac60..52d5ebc 100644 --- a/lighter/api/referral_api.py +++ b/lighter/api/referral_api.py @@ -19,6 +19,7 @@ from pydantic import Field, StrictInt, StrictStr from typing import Optional from typing_extensions import Annotated +from lighter.models.has_referee_code import HasRefereeCode from lighter.models.referral_points import ReferralPoints from lighter.api_client import ApiClient, RequestSerialized @@ -39,6 +40,269 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + async def referral_has_referee_by_address( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> HasRefereeCode: + """referral_hasRefereeByAddress + + Does L1 address have referee code? + + :param l1_address: (required) + :type l1_address: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._referral_has_referee_by_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HasRefereeCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def referral_has_referee_by_address_with_http_info( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[HasRefereeCode]: + """referral_hasRefereeByAddress + + Does L1 address have referee code? + + :param l1_address: (required) + :type l1_address: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._referral_has_referee_by_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HasRefereeCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def referral_has_referee_by_address_without_preload_content( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """referral_hasRefereeByAddress + + Does L1 address have referee code? + + :param l1_address: (required) + :type l1_address: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._referral_has_referee_by_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "HasRefereeCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_has_referee_by_address_serialize( + self, + l1_address, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if l1_address is not None: + + _query_params.append(('l1_address', l1_address)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/referral/hasRefereeByAddress', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + @validate_call async def referral_points( self, diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index c75e64c..542b69e 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -49,6 +49,7 @@ from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings +from lighter.models.has_referee_code import HasRefereeCode from lighter.models.l1_metadata import L1Metadata from lighter.models.l1_provider_info import L1ProviderInfo from lighter.models.liq_trade import LiqTrade @@ -72,12 +73,14 @@ from lighter.models.price_level import PriceLevel from lighter.models.public_pool import PublicPool from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_metadata import PublicPoolMetadata from lighter.models.public_pool_share import PublicPoolShare from lighter.models.public_pools import PublicPools from lighter.models.referral_point_entry import ReferralPointEntry from lighter.models.referral_points import ReferralPoints from lighter.models.req_export_data import ReqExportData from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders @@ -102,6 +105,7 @@ from lighter.models.req_get_order_books import ReqGetOrderBooks from lighter.models.req_get_position_funding import ReqGetPositionFunding from lighter.models.req_get_public_pools import ReqGetPublicPools +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable @@ -112,14 +116,17 @@ from lighter.models.req_get_transfer_history import ReqGetTransferHistory from lighter.models.req_get_tx import ReqGetTx from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory +from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.resp_send_tx import RespSendTx from lighter.models.resp_send_tx_batch import RespSendTxBatch from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay from lighter.models.result_code import ResultCode from lighter.models.risk_info import RiskInfo from lighter.models.risk_parameters import RiskParameters +from lighter.models.share_price import SharePrice from lighter.models.simple_order import SimpleOrder from lighter.models.status import Status from lighter.models.sub_accounts import SubAccounts diff --git a/lighter/models/account_position.py b/lighter/models/account_position.py index 655ba12..9942715 100644 --- a/lighter/models/account_position.py +++ b/lighter/models/account_position.py @@ -38,11 +38,12 @@ class AccountPosition(BaseModel): position_value: StrictStr unrealized_pnl: StrictStr realized_pnl: StrictStr + liquidation_price: StrictStr total_funding_paid_out: Optional[StrictStr] = None margin_mode: StrictInt allocated_margin: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["market_id", "symbol", "initial_margin_fraction", "open_order_count", "pending_order_count", "position_tied_order_count", "sign", "position", "avg_entry_price", "position_value", "unrealized_pnl", "realized_pnl", "total_funding_paid_out", "margin_mode", "allocated_margin"] + __properties: ClassVar[List[str]] = ["market_id", "symbol", "initial_margin_fraction", "open_order_count", "pending_order_count", "position_tied_order_count", "sign", "position", "avg_entry_price", "position_value", "unrealized_pnl", "realized_pnl", "liquidation_price", "total_funding_paid_out", "margin_mode", "allocated_margin"] model_config = ConfigDict( populate_by_name=True, @@ -114,6 +115,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "position_value": obj.get("position_value"), "unrealized_pnl": obj.get("unrealized_pnl"), "realized_pnl": obj.get("realized_pnl"), + "liquidation_price": obj.get("liquidation_price"), "total_funding_paid_out": obj.get("total_funding_paid_out"), "margin_mode": obj.get("margin_mode"), "allocated_margin": obj.get("allocated_margin") diff --git a/lighter/models/has_referee_code.py b/lighter/models/has_referee_code.py new file mode 100644 index 0000000..6036139 --- /dev/null +++ b/lighter/models/has_referee_code.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class HasRefereeCode(BaseModel): + """ + HasRefereeCode + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + has_referee: StrictBool + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "has_referee"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of HasRefereeCode from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of HasRefereeCode from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "has_referee": obj.get("has_referee") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/public_pool_info.py b/lighter/models/public_pool_info.py index 41a871d..7ee99d5 100644 --- a/lighter/models/public_pool_info.py +++ b/lighter/models/public_pool_info.py @@ -20,6 +20,7 @@ from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Union from lighter.models.daily_return import DailyReturn +from lighter.models.share_price import SharePrice from typing import Optional, Set from typing_extensions import Self @@ -32,13 +33,11 @@ class PublicPoolInfo(BaseModel): min_operator_share_rate: StrictStr total_shares: StrictInt operator_shares: StrictInt - share_price_1d: Optional[Union[StrictFloat, StrictInt]] - share_price_7d: Optional[Union[StrictFloat, StrictInt]] - share_price_30d: Optional[Union[StrictFloat, StrictInt]] annual_percentage_yield: Union[StrictFloat, StrictInt] daily_returns: List[DailyReturn] + share_prices: List[SharePrice] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares", "share_price_1d", "share_price_7d", "share_price_30d", "annual_percentage_yield", "daily_returns"] + __properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares", "annual_percentage_yield", "daily_returns", "share_prices"] model_config = ConfigDict( populate_by_name=True, @@ -88,6 +87,13 @@ def to_dict(self) -> Dict[str, Any]: if _item: _items.append(_item.to_dict()) _dict['daily_returns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in share_prices (list) + _items = [] + if self.share_prices: + for _item in self.share_prices: + if _item: + _items.append(_item.to_dict()) + _dict['share_prices'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: for _key, _value in self.additional_properties.items(): @@ -110,11 +116,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "min_operator_share_rate": obj.get("min_operator_share_rate"), "total_shares": obj.get("total_shares"), "operator_shares": obj.get("operator_shares"), - "share_price_1d": obj.get("share_price_1d"), - "share_price_7d": obj.get("share_price_7d"), - "share_price_30d": obj.get("share_price_30d"), "annual_percentage_yield": obj.get("annual_percentage_yield"), - "daily_returns": [DailyReturn.from_dict(_item) for _item in obj["daily_returns"]] if obj.get("daily_returns") is not None else None + "daily_returns": [DailyReturn.from_dict(_item) for _item in obj["daily_returns"]] if obj.get("daily_returns") is not None else None, + "share_prices": [SharePrice.from_dict(_item) for _item in obj["share_prices"]] if obj.get("share_prices") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/public_pool_metadata.py b/lighter/models/public_pool_metadata.py new file mode 100644 index 0000000..a0c5359 --- /dev/null +++ b/lighter/models/public_pool_metadata.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from lighter.models.public_pool_share import PublicPoolShare +from typing import Optional, Set +from typing_extensions import Self + +class PublicPoolMetadata(BaseModel): + """ + PublicPoolMetadata + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_index: StrictInt + account_type: StrictInt + name: StrictStr + l1_address: StrictStr + annual_percentage_yield: Union[StrictFloat, StrictInt] + status: StrictInt + operator_fee: StrictStr + total_asset_value: StrictStr + total_shares: StrictInt + account_share: Optional[PublicPoolShare] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "account_index", "account_type", "name", "l1_address", "annual_percentage_yield", "status", "operator_fee", "total_asset_value", "total_shares", "account_share"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPoolMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of account_share + if self.account_share: + _dict['account_share'] = self.account_share.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPoolMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_index": obj.get("account_index"), + "account_type": obj.get("account_type"), + "name": obj.get("name"), + "l1_address": obj.get("l1_address"), + "annual_percentage_yield": obj.get("annual_percentage_yield"), + "status": obj.get("status"), + "operator_fee": obj.get("operator_fee"), + "total_asset_value": obj.get("total_asset_value"), + "total_shares": obj.get("total_shares"), + "account_share": PublicPoolShare.from_dict(obj["account_share"]) if obj.get("account_share") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/req_get_account_active_orders.py b/lighter/models/req_get_account_active_orders.py new file mode 100644 index 0000000..bf3daff --- /dev/null +++ b/lighter/models/req_get_account_active_orders.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountActiveOrders(BaseModel): + """ + ReqGetAccountActiveOrders + """ # noqa: E501 + account_index: StrictInt + market_id: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "market_id", "auth"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountActiveOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountActiveOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/req_get_public_pools_metadata.py b/lighter/models/req_get_public_pools_metadata.py new file mode 100644 index 0000000..ccb7397 --- /dev/null +++ b/lighter/models/req_get_public_pools_metadata.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPublicPoolsMetadata(BaseModel): + """ + ReqGetPublicPoolsMetadata + """ # noqa: E501 + auth: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + index: StrictInt + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + account_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "filter", "index", "limit", "account_index"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'user', 'protocol', 'account_index']): + raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetPublicPoolsMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetPublicPoolsMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "filter": obj.get("filter"), + "index": obj.get("index"), + "limit": obj.get("limit"), + "account_index": obj.get("account_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/req_has_referee_by_l1_address.py b/lighter/models/req_has_referee_by_l1_address.py new file mode 100644 index 0000000..de8fa8d --- /dev/null +++ b/lighter/models/req_has_referee_by_l1_address.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqHasRefereeByL1Address(BaseModel): + """ + ReqHasRefereeByL1Address + """ # noqa: E501 + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqHasRefereeByL1Address from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqHasRefereeByL1Address from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/resp_public_pools_metadata.py b/lighter/models/resp_public_pools_metadata.py new file mode 100644 index 0000000..0719da8 --- /dev/null +++ b/lighter/models/resp_public_pools_metadata.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.public_pool_metadata import PublicPoolMetadata +from typing import Optional, Set +from typing_extensions import Self + +class RespPublicPoolsMetadata(BaseModel): + """ + RespPublicPoolsMetadata + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + public_pools: List[PublicPoolMetadata] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "public_pools"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespPublicPoolsMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in public_pools (list) + _items = [] + if self.public_pools: + for _item in self.public_pools: + if _item: + _items.append(_item.to_dict()) + _dict['public_pools'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespPublicPoolsMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "public_pools": [PublicPoolMetadata.from_dict(_item) for _item in obj["public_pools"]] if obj.get("public_pools") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/lighter/models/share_price.py b/lighter/models/share_price.py new file mode 100644 index 0000000..6f347b4 --- /dev/null +++ b/lighter/models/share_price.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class SharePrice(BaseModel): + """ + SharePrice + """ # noqa: E501 + timestamp: StrictInt + share_price: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "share_price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePrice from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePrice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "share_price": obj.get("share_price") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/openapi.json b/openapi.json index 86d4b68..fdd928e 100644 --- a/openapi.json +++ b/openapi.json @@ -84,6 +84,63 @@ "description": "Get account by account's index.
More details about account index: [Account Index](https://apidocs.lighter.xyz/docs/account-index)
**Response Description:**

1) **Status:** 1 is active 0 is inactive.
2) **Collateral:** The amount of collateral in the account.
**Position Details Description:**
1) **OOC:** Open order count in that market.
2) **Sign:** 1 for Long, -1 for Short.
3) **Position:** The amount of position in that market.
4) **Avg Entry Price:** The average entry price of the position.
5) **Position Value:** The value of the position.
6) **Unrealized PnL:** The unrealized profit and loss of the position.
7) **Realized PnL:** The realized profit and loss of the position." } }, + "/api/v1/accountActiveOrders": { + "get": { + "summary": "accountActiveOrders", + "operationId": "accountActiveOrders", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Orders" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "order" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get account active orders. `auth` can be generated using the SDK." + } + }, "/api/v1/accountInactiveOrders": { "get": { "summary": "accountInactiveOrders", @@ -1633,6 +1690,82 @@ "description": "Get public pools" } }, + "/api/v1/publicPoolsMetadata": { + "get": { + "summary": "publicPoolsMetadata", + "operationId": "publicPoolsMetadata", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RespPublicPoolsMetadata" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "all", + "user", + "protocol", + "account_index" + ] + }, + { + "name": "index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "account_index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get public pools metadata" + } + }, "/api/v1/recentTrades": { "get": { "summary": "recentTrades", @@ -1678,6 +1811,41 @@ "description": "Get recent trades" } }, + "/api/v1/referral/hasRefereeByAddress": { + "get": { + "summary": "referral_hasRefereeByAddress", + "operationId": "referral_hasRefereeByAddress", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/HasRefereeCode" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "l1_address", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "referral" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Does L1 address have referee code?" + } + }, "/api/v1/referral/points": { "get": { "summary": "referral_points", @@ -2663,6 +2831,10 @@ "type": "string", "example": "2.000000" }, + "liquidation_price": { + "type": "string", + "example": "3024.66" + }, "total_funding_paid_out": { "type": "string", "example": "34.2" @@ -2691,6 +2863,7 @@ "position_value", "unrealized_pnl", "realized_pnl", + "liquidation_price", "margin_mode", "allocated_margin" ] @@ -3726,6 +3899,28 @@ "fundings" ] }, + "HasRefereeCode": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "has_referee": { + "type": "boolean", + "format": "boolean" + } + }, + "title": "HasRefereeCode", + "required": [ + "code", + "has_referee" + ] + }, "L1Metadata": { "type": "object", "properties": { @@ -4949,21 +5144,6 @@ "format": "int64", "example": "20000" }, - "share_price_1d": { - "type": "number", - "format": "double", - "example": "0.0001" - }, - "share_price_7d": { - "type": "number", - "format": "double", - "example": "0.0001" - }, - "share_price_30d": { - "type": "number", - "format": "double", - "example": "0.0001" - }, "annual_percentage_yield": { "type": "number", "format": "double", @@ -4974,6 +5154,12 @@ "items": { "$ref": "#/definitions/DailyReturn" } + }, + "share_prices": { + "type": "array", + "items": { + "$ref": "#/definitions/SharePrice" + } } }, "title": "PublicPoolInfo", @@ -4983,11 +5169,78 @@ "min_operator_share_rate", "total_shares", "operator_shares", - "share_price_1d", - "share_price_7d", - "share_price_30d", "annual_percentage_yield", - "daily_returns" + "daily_returns", + "share_prices" + ] + }, + "PublicPoolMetadata": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "account_type": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "name": { + "type": "string" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "annual_percentage_yield": { + "type": "number", + "format": "double", + "example": "20.5000" + }, + "status": { + "type": "integer", + "format": "uint8", + "example": "0" + }, + "operator_fee": { + "type": "string", + "example": "100" + }, + "total_asset_value": { + "type": "string", + "example": "19995" + }, + "total_shares": { + "type": "integer", + "format": "int64", + "example": "100000" + }, + "account_share": { + "$ref": "#/definitions/PublicPoolShare" + } + }, + "title": "PublicPoolMetadata", + "required": [ + "code", + "account_index", + "account_type", + "name", + "l1_address", + "annual_percentage_yield", + "status", + "operator_fee", + "total_asset_value", + "total_shares" ] }, "PublicPoolShare": { @@ -5221,6 +5474,28 @@ "value" ] }, + "ReqGetAccountActiveOrders": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + } + }, + "title": "ReqGetAccountActiveOrders", + "required": [ + "account_index", + "market_id" + ] + }, "ReqGetAccountApiKeys": { "type": "object", "properties": { @@ -5827,6 +6102,42 @@ "limit" ] }, + "ReqGetPublicPoolsMetadata": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "filter": { + "type": "string", + "enum": [ + "all", + "user", + "protocol", + "account_index" + ] + }, + "index": { + "type": "integer", + "format": "int64" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + }, + "account_index": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqGetPublicPoolsMetadata", + "required": [ + "index", + "limit" + ] + }, "ReqGetRangeWithCursor": { "type": "object", "properties": { @@ -6075,6 +6386,18 @@ "account_index" ] }, + "ReqHasRefereeByL1Address": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + } + }, + "title": "ReqHasRefereeByL1Address", + "required": [ + "l1_address" + ] + }, "ReqSendTx": { "type": "object", "properties": { @@ -6151,6 +6474,30 @@ "fast_bridge_limit" ] }, + "RespPublicPoolsMetadata": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "public_pools": { + "type": "array", + "items": { + "$ref": "#/definitions/PublicPoolMetadata" + } + } + }, + "title": "RespPublicPoolsMetadata", + "required": [ + "code", + "public_pools" + ] + }, "RespSendTx": { "type": "object", "properties": { @@ -6292,6 +6639,26 @@ "close_out_margin_req" ] }, + "SharePrice": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "share_price": { + "type": "number", + "format": "double", + "example": "0.0001" + } + }, + "title": "SharePrice", + "required": [ + "timestamp", + "share_price" + ] + }, "SimpleOrder": { "type": "object", "properties": { From 3e6364ad4ce718433a4b6d2d7859388a06ae0e08 Mon Sep 17 00:00:00 2001 From: Mihail Lavric Date: Wed, 13 Aug 2025 20:56:49 +0300 Subject: [PATCH 2/2] adjust endpoints --- .openapi-generator/FILES | 11 - docs/HasRefereeCode.md | 31 -- docs/ReferralApi.md | 70 ----- docs/ReqHasRefereeByL1Address.md | 29 -- lighter/__init__.py | 2 - lighter/api/referral_api.py | 264 ------------------ lighter/models/__init__.py | 2 - lighter/models/has_referee_code.py | 104 ------- .../models/req_has_referee_by_l1_address.py | 100 ------- openapi.json | 69 ----- 10 files changed, 682 deletions(-) delete mode 100644 docs/HasRefereeCode.md delete mode 100644 docs/ReqHasRefereeByL1Address.md delete mode 100644 lighter/models/has_referee_code.py delete mode 100644 lighter/models/req_has_referee_by_l1_address.py diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 1012fda..2f225cd 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -39,7 +39,6 @@ docs/FundingApi.md docs/FundingRate.md docs/FundingRates.md docs/Fundings.md -docs/HasRefereeCode.md docs/InfoApi.md docs/L1Metadata.md docs/L1ProviderInfo.md @@ -110,7 +109,6 @@ docs/ReqGetTransferFeeInfo.md docs/ReqGetTransferHistory.md docs/ReqGetTx.md docs/ReqGetWithdrawHistory.md -docs/ReqHasRefereeByL1Address.md docs/RespChangeAccountTier.md docs/RespGetFastBridgeInfo.md docs/RespPublicPoolsMetadata.md @@ -195,7 +193,6 @@ lighter/models/funding.py lighter/models/funding_rate.py lighter/models/funding_rates.py lighter/models/fundings.py -lighter/models/has_referee_code.py lighter/models/l1_metadata.py lighter/models/l1_provider_info.py lighter/models/liq_trade.py @@ -262,7 +259,6 @@ lighter/models/req_get_transfer_fee_info.py lighter/models/req_get_transfer_history.py lighter/models/req_get_tx.py lighter/models/req_get_withdraw_history.py -lighter/models/req_has_referee_by_l1_address.py lighter/models/resp_change_account_tier.py lighter/models/resp_get_fast_bridge_info.py lighter/models/resp_public_pools_metadata.py @@ -295,11 +291,4 @@ lighter/rest.py setup.cfg test-requirements.txt test/__init__.py -test/test_has_referee_code.py -test/test_public_pool_metadata.py -test/test_req_get_account_active_orders.py -test/test_req_get_public_pools_metadata.py -test/test_req_has_referee_by_l1_address.py -test/test_resp_public_pools_metadata.py -test/test_share_price.py tox.ini diff --git a/docs/HasRefereeCode.md b/docs/HasRefereeCode.md deleted file mode 100644 index c10a9ac..0000000 --- a/docs/HasRefereeCode.md +++ /dev/null @@ -1,31 +0,0 @@ -# HasRefereeCode - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**code** | **int** | | -**message** | **str** | | [optional] -**has_referee** | **bool** | | - -## Example - -```python -from lighter.models.has_referee_code import HasRefereeCode - -# TODO update the JSON string below -json = "{}" -# create an instance of HasRefereeCode from a JSON string -has_referee_code_instance = HasRefereeCode.from_json(json) -# print the JSON string representation of the object -print(HasRefereeCode.to_json()) - -# convert the object into a dict -has_referee_code_dict = has_referee_code_instance.to_dict() -# create an instance of HasRefereeCode from a dict -has_referee_code_from_dict = HasRefereeCode.from_dict(has_referee_code_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/docs/ReferralApi.md b/docs/ReferralApi.md index 6b2e794..0ee3c8b 100644 --- a/docs/ReferralApi.md +++ b/docs/ReferralApi.md @@ -4,79 +4,9 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**referral_has_referee_by_address**](ReferralApi.md#referral_has_referee_by_address) | **GET** /api/v1/referral/hasRefereeByAddress | referral_hasRefereeByAddress [**referral_points**](ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points -# **referral_has_referee_by_address** -> HasRefereeCode referral_has_referee_by_address(l1_address) - -referral_hasRefereeByAddress - -Does L1 address have referee code? - -### Example - - -```python -import lighter -from lighter.models.has_referee_code import HasRefereeCode -from lighter.rest import ApiException -from pprint import pprint - -# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai -# See configuration.py for a list of all supported configuration parameters. -configuration = lighter.Configuration( - host = "https://mainnet.zklighter.elliot.ai" -) - - -# Enter a context with an instance of the API client -async with lighter.ApiClient(configuration) as api_client: - # Create an instance of the API class - api_instance = lighter.ReferralApi(api_client) - l1_address = 'l1_address_example' # str | - - try: - # referral_hasRefereeByAddress - api_response = await api_instance.referral_has_referee_by_address(l1_address) - print("The response of ReferralApi->referral_has_referee_by_address:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling ReferralApi->referral_has_referee_by_address: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **l1_address** | **str**| | - -### Return type - -[**HasRefereeCode**](HasRefereeCode.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined - - **Accept**: application/json - -### HTTP response details - -| Status code | Description | Response headers | -|-------------|-------------|------------------| -**200** | A successful response. | - | -**400** | Bad request | - | - -[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) - # **referral_points** > ReferralPoints referral_points(account_index, authorization=authorization, auth=auth) diff --git a/docs/ReqHasRefereeByL1Address.md b/docs/ReqHasRefereeByL1Address.md deleted file mode 100644 index 6bd9214..0000000 --- a/docs/ReqHasRefereeByL1Address.md +++ /dev/null @@ -1,29 +0,0 @@ -# ReqHasRefereeByL1Address - - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**l1_address** | **str** | | - -## Example - -```python -from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address - -# TODO update the JSON string below -json = "{}" -# create an instance of ReqHasRefereeByL1Address from a JSON string -req_has_referee_by_l1_address_instance = ReqHasRefereeByL1Address.from_json(json) -# print the JSON string representation of the object -print(ReqHasRefereeByL1Address.to_json()) - -# convert the object into a dict -req_has_referee_by_l1_address_dict = req_has_referee_by_l1_address_instance.to_dict() -# create an instance of ReqHasRefereeByL1Address from a dict -req_has_referee_by_l1_address_from_dict = ReqHasRefereeByL1Address.from_dict(req_has_referee_by_l1_address_dict) -``` -[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) - - diff --git a/lighter/__init__.py b/lighter/__init__.py index 9a57bd5..a0af3c2 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -77,7 +77,6 @@ from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings -from lighter.models.has_referee_code import HasRefereeCode from lighter.models.l1_metadata import L1Metadata from lighter.models.l1_provider_info import L1ProviderInfo from lighter.models.liq_trade import LiqTrade @@ -144,7 +143,6 @@ from lighter.models.req_get_transfer_history import ReqGetTransferHistory from lighter.models.req_get_tx import ReqGetTx from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory -from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata diff --git a/lighter/api/referral_api.py b/lighter/api/referral_api.py index 52d5ebc..733ac60 100644 --- a/lighter/api/referral_api.py +++ b/lighter/api/referral_api.py @@ -19,7 +19,6 @@ from pydantic import Field, StrictInt, StrictStr from typing import Optional from typing_extensions import Annotated -from lighter.models.has_referee_code import HasRefereeCode from lighter.models.referral_points import ReferralPoints from lighter.api_client import ApiClient, RequestSerialized @@ -40,269 +39,6 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - @validate_call - async def referral_has_referee_by_address( - self, - l1_address: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> HasRefereeCode: - """referral_hasRefereeByAddress - - Does L1 address have referee code? - - :param l1_address: (required) - :type l1_address: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._referral_has_referee_by_address_serialize( - l1_address=l1_address, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HasRefereeCode", - '400': "ResultCode", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ).data - - - @validate_call - async def referral_has_referee_by_address_with_http_info( - self, - l1_address: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[HasRefereeCode]: - """referral_hasRefereeByAddress - - Does L1 address have referee code? - - :param l1_address: (required) - :type l1_address: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._referral_has_referee_by_address_serialize( - l1_address=l1_address, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HasRefereeCode", - '400': "ResultCode", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - await response_data.read() - return self.api_client.response_deserialize( - response_data=response_data, - response_types_map=_response_types_map, - ) - - - @validate_call - async def referral_has_referee_by_address_without_preload_content( - self, - l1_address: StrictStr, - _request_timeout: Union[ - None, - Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - Annotated[StrictFloat, Field(gt=0)] - ] - ] = None, - _request_auth: Optional[Dict[StrictStr, Any]] = None, - _content_type: Optional[StrictStr] = None, - _headers: Optional[Dict[StrictStr, Any]] = None, - _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RESTResponseType: - """referral_hasRefereeByAddress - - Does L1 address have referee code? - - :param l1_address: (required) - :type l1_address: str - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :type _request_timeout: int, tuple(int, int), optional - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the - authentication in the spec for a single request. - :type _request_auth: dict, optional - :param _content_type: force content-type for the request. - :type _content_type: str, Optional - :param _headers: set to override the headers for a single - request; this effectively ignores the headers - in the spec for a single request. - :type _headers: dict, optional - :param _host_index: set to override the host_index for a single - request; this effectively ignores the host_index - in the spec for a single request. - :type _host_index: int, optional - :return: Returns the result object. - """ # noqa: E501 - - _param = self._referral_has_referee_by_address_serialize( - l1_address=l1_address, - _request_auth=_request_auth, - _content_type=_content_type, - _headers=_headers, - _host_index=_host_index - ) - - _response_types_map: Dict[str, Optional[str]] = { - '200': "HasRefereeCode", - '400': "ResultCode", - } - response_data = await self.api_client.call_api( - *_param, - _request_timeout=_request_timeout - ) - return response_data.response - - - def _referral_has_referee_by_address_serialize( - self, - l1_address, - _request_auth, - _content_type, - _headers, - _host_index, - ) -> RequestSerialized: - - _host = None - - _collection_formats: Dict[str, str] = { - } - - _path_params: Dict[str, str] = {} - _query_params: List[Tuple[str, str]] = [] - _header_params: Dict[str, Optional[str]] = _headers or {} - _form_params: List[Tuple[str, str]] = [] - _files: Dict[str, Union[str, bytes]] = {} - _body_params: Optional[bytes] = None - - # process the path parameters - # process the query parameters - if l1_address is not None: - - _query_params.append(('l1_address', l1_address)) - - # process the header parameters - # process the form parameters - # process the body parameter - - - # set the HTTP header `Accept` - if 'Accept' not in _header_params: - _header_params['Accept'] = self.api_client.select_header_accept( - [ - 'application/json' - ] - ) - - - # authentication setting - _auth_settings: List[str] = [ - ] - - return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/referral/hasRefereeByAddress', - path_params=_path_params, - query_params=_query_params, - header_params=_header_params, - body=_body_params, - post_params=_form_params, - files=_files, - auth_settings=_auth_settings, - collection_formats=_collection_formats, - _host=_host, - _request_auth=_request_auth - ) - - - - @validate_call async def referral_points( self, diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index 542b69e..f5abd92 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -49,7 +49,6 @@ from lighter.models.funding_rate import FundingRate from lighter.models.funding_rates import FundingRates from lighter.models.fundings import Fundings -from lighter.models.has_referee_code import HasRefereeCode from lighter.models.l1_metadata import L1Metadata from lighter.models.l1_provider_info import L1ProviderInfo from lighter.models.liq_trade import LiqTrade @@ -116,7 +115,6 @@ from lighter.models.req_get_transfer_history import ReqGetTransferHistory from lighter.models.req_get_tx import ReqGetTx from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory -from lighter.models.req_has_referee_by_l1_address import ReqHasRefereeByL1Address from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata diff --git a/lighter/models/has_referee_code.py b/lighter/models/has_referee_code.py deleted file mode 100644 index 6036139..0000000 --- a/lighter/models/has_referee_code.py +++ /dev/null @@ -1,104 +0,0 @@ -# coding: utf-8 - -""" - - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional -from typing import Optional, Set -from typing_extensions import Self - -class HasRefereeCode(BaseModel): - """ - HasRefereeCode - """ # noqa: E501 - code: StrictInt - message: Optional[StrictStr] = None - has_referee: StrictBool - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "has_referee"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of HasRefereeCode from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - * Fields in `self.additional_properties` are added to the output dict. - """ - excluded_fields: Set[str] = set([ - "additional_properties", - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of HasRefereeCode from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "code": obj.get("code"), - "message": obj.get("message"), - "has_referee": obj.get("has_referee") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/lighter/models/req_has_referee_by_l1_address.py b/lighter/models/req_has_referee_by_l1_address.py deleted file mode 100644 index de8fa8d..0000000 --- a/lighter/models/req_has_referee_by_l1_address.py +++ /dev/null @@ -1,100 +0,0 @@ -# coding: utf-8 - -""" - - - No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - - The version of the OpenAPI document: - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - -from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List -from typing import Optional, Set -from typing_extensions import Self - -class ReqHasRefereeByL1Address(BaseModel): - """ - ReqHasRefereeByL1Address - """ # noqa: E501 - l1_address: StrictStr - additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["l1_address"] - - model_config = ConfigDict( - populate_by_name=True, - validate_assignment=True, - protected_namespaces=(), - ) - - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Optional[Self]: - """Create an instance of ReqHasRefereeByL1Address from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self) -> Dict[str, Any]: - """Return the dictionary representation of the model using alias. - - This has the following differences from calling pydantic's - `self.model_dump(by_alias=True)`: - - * `None` is only added to the output dict for nullable fields that - were set at model initialization. Other fields with value `None` - are ignored. - * Fields in `self.additional_properties` are added to the output dict. - """ - excluded_fields: Set[str] = set([ - "additional_properties", - ]) - - _dict = self.model_dump( - by_alias=True, - exclude=excluded_fields, - exclude_none=True, - ) - # puts key-value pairs in additional_properties in the top level - if self.additional_properties is not None: - for _key, _value in self.additional_properties.items(): - _dict[_key] = _value - - return _dict - - @classmethod - def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: - """Create an instance of ReqHasRefereeByL1Address from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return cls.model_validate(obj) - - _obj = cls.model_validate({ - "l1_address": obj.get("l1_address") - }) - # store additional fields in additional_properties - for _key in obj.keys(): - if _key not in cls.__properties: - _obj.additional_properties[_key] = obj.get(_key) - - return _obj - - diff --git a/openapi.json b/openapi.json index fdd928e..c38679a 100644 --- a/openapi.json +++ b/openapi.json @@ -1811,41 +1811,6 @@ "description": "Get recent trades" } }, - "/api/v1/referral/hasRefereeByAddress": { - "get": { - "summary": "referral_hasRefereeByAddress", - "operationId": "referral_hasRefereeByAddress", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/HasRefereeCode" - } - }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, - "parameters": [ - { - "name": "l1_address", - "in": "query", - "required": true, - "type": "string" - } - ], - "tags": [ - "referral" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Does L1 address have referee code?" - } - }, "/api/v1/referral/points": { "get": { "summary": "referral_points", @@ -3899,28 +3864,6 @@ "fundings" ] }, - "HasRefereeCode": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "has_referee": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "HasRefereeCode", - "required": [ - "code", - "has_referee" - ] - }, "L1Metadata": { "type": "object", "properties": { @@ -6386,18 +6329,6 @@ "account_index" ] }, - "ReqHasRefereeByL1Address": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - } - }, - "title": "ReqHasRefereeByL1Address", - "required": [ - "l1_address" - ] - }, "ReqSendTx": { "type": "object", "properties": {