From 8098f426621ddb36c415b210ceeb4df12ad4f293 Mon Sep 17 00:00:00 2001 From: mihaimarcu Date: Tue, 21 Apr 2026 11:45:37 +0200 Subject: [PATCH] MakerOnlyApiKeys --- .github/workflows/python.yml | 20 +- .gitignore | 16 +- .gitlab-ci.yml | 11 +- .openapi-generator/FILES | 149 +- .openapi-generator/VERSION | 2 +- .travis.yml | 5 +- README.md | 243 +- docs/Account.md | 2 +- docs/AccountApi.md | 338 +- docs/AccountAsset.md | 2 + docs/AccountLimits.md | 8 +- docs/AccountMetadata.md | 2 +- docs/AccountMetadatas.md | 1 - docs/AccountStats.md | 2 +- docs/AnnouncementApi.md | 2 +- docs/Asset.md | 7 + docs/BridgeApi.md | 134 +- docs/Candle.md | 25 +- docs/Candles.md | 4 +- docs/CandlestickApi.md | 2 +- docs/DepositHistoryItem.md | 2 +- docs/DetailedAccount.md | 12 +- docs/DetailedCandlestick.md | 8 +- docs/ExecuteStat.md | 4 +- docs/InfoApi.md | 82 +- docs/LeaseEntry.md | 16 +- docs/LeaseOptionEntry.md | 4 +- docs/MarketConfig.md | 2 +- docs/NotificationApi.md | 2 +- docs/Order.md | 6 +- docs/OrderApi.md | 106 +- docs/OrderBook.md | 4 +- docs/PerpsMarketStats.md | 8 +- docs/PerpsOrderBookDetail.md | 8 +- docs/PnLEntry.md | 13 +- docs/PositionFunding.md | 2 +- docs/PublicPoolInfo.md | 2 +- docs/PublicPoolMetadata.md | 10 +- docs/PublicPoolShare.md | 4 +- docs/Referral.md | 1 + docs/ReferralApi.md | 416 +- docs/ReqExportData.md | 4 +- docs/ReqGetAccount.md | 1 - docs/ReqGetAccountActiveOrders.md | 4 +- docs/ReqGetAccountByL1Address.md | 1 - docs/ReqGetAccountMetadata.md | 1 - docs/ReqGetAccountPnL.md | 2 +- docs/ReqGetAccountTxs.md | 2 +- docs/ReqGetDepositHistory.md | 2 +- docs/ReqGetFastWithdrawInfo.md | 2 +- docs/ReqGetMakerOnlyApiKeys.md | 1 - docs/ReqGetPositionFunding.md | 2 +- docs/ReqGetPublicPoolsMetadata.md | 2 +- docs/ReqGetTrades.md | 8 +- docs/ReqGetTransferFeeInfo.md | 4 +- docs/ReqGetTransferHistory.md | 2 +- docs/ReqGetWithdrawHistory.md | 2 +- docs/RespGetLeaseOptions.md | 6 +- docs/RespGetLeases.md | 6 +- docs/RespGetMakerOnlyApiKeys.md | 8 +- docs/SpotOrderBookDetail.md | 2 + docs/SubAccounts.md | 1 - docs/SystemConfig.md | 6 +- docs/Trade.md | 21 +- docs/TransactionApi.md | 345 +- docs/TransferHistoryItem.md | 6 +- docs/UserReferrals.md | 1 + docs/WithdrawHistoryItem.md | 2 +- examples/create_order_skip_nonce.py | 2 +- examples/set_maker_only_api_keys.py | 26 + lighter/__init__.py | 576 +- lighter/api/__init__.py | 2 + lighter/api/account_api.py | 2785 ++- lighter/api/announcement_api.py | 16 +- lighter/api/bridge_api.py | 510 +- lighter/api/candlestick_api.py | 23 +- lighter/api/funding_api.py | 10 +- lighter/api/info_api.py | 331 +- lighter/api/notification_api.py | 12 +- lighter/api/order_api.py | 357 +- lighter/api/pushnotif_api.py | 31 +- lighter/api/referral_api.py | 1755 +- lighter/api/root_api.py | 17 +- lighter/api/transaction_api.py | 2181 +- lighter/api_client.py | 55 +- lighter/configuration.py | 269 +- lighter/exceptions.py | 29 +- lighter/models/__init__.py | 40 +- lighter/models/account.py | 19 +- lighter/models/account_api_keys.py | 15 +- lighter/models/account_asset.py | 26 +- lighter/models/account_limits.py | 27 +- lighter/models/account_margin_stats.py | 9 +- lighter/models/account_market_stats.py | 9 +- lighter/models/account_metadata.py | 17 +- lighter/models/account_metadatas.py | 21 +- lighter/models/account_pn_l.py | 15 +- lighter/models/account_position.py | 9 +- lighter/models/account_stats.py | 17 +- lighter/models/account_trade_stats.py | 9 +- lighter/models/announcement.py | 9 +- lighter/models/announcements.py | 15 +- lighter/models/api_key.py | 9 +- lighter/models/api_token.py | 9 +- lighter/models/approved_integrator.py | 9 +- lighter/models/asset.py | 27 +- lighter/models/asset_details.py | 15 +- lighter/models/auth.py | 9 +- lighter/models/bridge.py | 9 +- lighter/models/bridge_supported_network.py | 9 +- lighter/models/candle.py | 49 +- lighter/models/candles.py | 25 +- lighter/models/contract_address.py | 9 +- lighter/models/cursor.py | 9 +- lighter/models/daily_return.py | 9 +- lighter/models/deposit_history.py | 15 +- lighter/models/deposit_history_item.py | 17 +- lighter/models/detailed_account.py | 65 +- lighter/models/detailed_accounts.py | 15 +- lighter/models/detailed_candlestick.py | 33 +- lighter/models/enriched_tx.py | 9 +- lighter/models/exchange_metric.py | 9 +- lighter/models/exchange_stats.py | 15 +- lighter/models/execute_stat.py | 21 +- lighter/models/export_data.py | 9 +- lighter/models/funding.py | 9 +- lighter/models/funding_rate.py | 9 +- lighter/models/funding_rates.py | 15 +- lighter/models/fundings.py | 15 +- lighter/models/l1_metadata.py | 9 +- lighter/models/l1_provider_info.py | 9 +- lighter/models/lease_entry.py | 27 +- lighter/models/lease_option_entry.py | 17 +- lighter/models/liq_trade.py | 9 +- lighter/models/liquidation.py | 9 +- lighter/models/liquidation_info.py | 15 +- lighter/models/liquidation_infos.py | 15 +- lighter/models/market_config.py | 17 +- lighter/models/next_nonce.py | 9 +- lighter/models/order.py | 25 +- lighter/models/order_book.py | 25 +- lighter/models/order_book_depth.py | 21 +- .../order_book_depth_with_begin_nonce.py | 21 +- lighter/models/order_book_details.py | 21 +- lighter/models/order_book_orders.py | 21 +- lighter/models/order_book_stats.py | 9 +- lighter/models/order_books.py | 15 +- lighter/models/orders.py | 15 +- lighter/models/partner_stats.py | 9 +- lighter/models/pending_unlock.py | 9 +- lighter/models/perps_market_stats.py | 29 +- lighter/models/perps_order_book_detail.py | 29 +- lighter/models/pn_l_entry.py | 37 +- lighter/models/position_funding.py | 17 +- lighter/models/position_fundings.py | 15 +- lighter/models/price_level.py | 9 +- lighter/models/public_pool_info.py | 33 +- lighter/models/public_pool_metadata.py | 39 +- lighter/models/public_pool_share.py | 21 +- lighter/models/push_notif_delivery_result.py | 9 +- lighter/models/referral.py | 15 +- lighter/models/req_do_faucet.py | 9 +- lighter/models/req_export_data.py | 15 +- lighter/models/req_get_account.py | 15 +- .../models/req_get_account_active_orders.py | 19 +- lighter/models/req_get_account_api_keys.py | 9 +- .../models/req_get_account_by_l1_address.py | 17 +- .../models/req_get_account_inactive_orders.py | 9 +- lighter/models/req_get_account_limits.py | 9 +- lighter/models/req_get_account_metadata.py | 15 +- lighter/models/req_get_account_pn_l.py | 11 +- lighter/models/req_get_account_txs.py | 17 +- lighter/models/req_get_api_tokens.py | 9 +- lighter/models/req_get_asset_details.py | 9 +- lighter/models/req_get_block.py | 9 +- lighter/models/req_get_block_txs.py | 9 +- lighter/models/req_get_bridges_by_l1_addr.py | 9 +- lighter/models/req_get_by_account.py | 9 +- lighter/models/req_get_candles.py | 9 +- lighter/models/req_get_deposit_history.py | 15 +- lighter/models/req_get_exchange_metrics.py | 9 +- lighter/models/req_get_execute_stats.py | 9 +- lighter/models/req_get_fast_withdraw_info.py | 17 +- lighter/models/req_get_fundings.py | 9 +- lighter/models/req_get_l1_metadata.py | 9 +- lighter/models/req_get_l1_tx.py | 9 +- lighter/models/req_get_latest_deposit.py | 9 +- lighter/models/req_get_leases.py | 9 +- lighter/models/req_get_liquidation_infos.py | 9 +- lighter/models/req_get_maker_only_api_keys.py | 17 +- lighter/models/req_get_next_nonce.py | 9 +- lighter/models/req_get_order_book_details.py | 9 +- lighter/models/req_get_order_book_orders.py | 11 +- lighter/models/req_get_order_books.py | 9 +- lighter/models/req_get_position_funding.py | 11 +- .../models/req_get_public_pools_metadata.py | 15 +- lighter/models/req_get_push_notif_settings.py | 9 +- lighter/models/req_get_range_with_cursor.py | 9 +- lighter/models/req_get_range_with_index.py | 9 +- .../req_get_range_with_index_sortable.py | 9 +- lighter/models/req_get_recent_trades.py | 9 +- lighter/models/req_get_trades.py | 25 +- lighter/models/req_get_transfer_fee_info.py | 17 +- lighter/models/req_get_transfer_history.py | 28 +- lighter/models/req_get_tx.py | 9 +- lighter/models/req_get_user_referrals.py | 9 +- lighter/models/req_get_withdraw_history.py | 15 +- lighter/models/resp_change_account_tier.py | 9 +- lighter/models/resp_get_api_tokens.py | 15 +- lighter/models/resp_get_bridges_by_l1_addr.py | 15 +- lighter/models/resp_get_exchange_metrics.py | 15 +- lighter/models/resp_get_execute_stats.py | 24 +- lighter/models/resp_get_fast_bridge_info.py | 9 +- .../models/resp_get_fastwithdrawal_info.py | 9 +- .../models/resp_get_is_next_bridge_fast.py | 9 +- lighter/models/resp_get_lease_options.py | 23 +- lighter/models/resp_get_leases.py | 23 +- .../models/resp_get_maker_only_api_keys.py | 18 +- .../models/resp_get_push_notif_settings.py | 9 +- lighter/models/resp_post_api_token.py | 9 +- lighter/models/resp_public_pools_metadata.py | 15 +- lighter/models/resp_revoke_api_token.py | 9 +- lighter/models/resp_send_tx.py | 11 +- lighter/models/resp_send_tx_batch.py | 9 +- .../models/resp_set_maker_only_api_keys.py | 9 +- lighter/models/resp_withdrawal_delay.py | 9 +- lighter/models/result_code.py | 9 +- lighter/models/risk_info.py | 15 +- lighter/models/risk_parameters.py | 9 +- lighter/models/share_price.py | 9 +- lighter/models/simple_order.py | 9 +- lighter/models/slippage_result.py | 9 +- lighter/models/spot_avg_entry_price.py | 9 +- lighter/models/spot_market_stats.py | 9 +- lighter/models/spot_order_book_detail.py | 21 +- lighter/models/status.py | 9 +- lighter/models/strategy.py | 9 +- lighter/models/sub_accounts.py | 21 +- lighter/models/system_config.py | 23 +- lighter/models/ticker.py | 9 +- lighter/models/trade.py | 51 +- lighter/models/trade_stats.py | 9 +- lighter/models/trades.py | 15 +- lighter/models/transfer_fee_info.py | 9 +- lighter/models/transfer_history.py | 15 +- lighter/models/transfer_history_item.py | 25 +- lighter/models/tx_hash.py | 9 +- lighter/models/tx_hashes.py | 9 +- lighter/models/user_referrals.py | 21 +- lighter/models/validator_info.py | 9 +- lighter/models/withdraw_history.py | 15 +- lighter/models/withdraw_history_item.py | 17 +- lighter/models/zk_lighter_info.py | 9 +- lighter/rest.py | 91 +- openapi.json | 18721 +++++++++------- pyproject.toml | 74 +- requirements.txt | 13 +- setup.py | 24 +- test-requirements.txt | 13 +- tox.ini | 2 +- 260 files changed, 19963 insertions(+), 12556 deletions(-) create mode 100644 examples/set_maker_only_api_keys.py diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index 7915efb..5b4dfff 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -7,16 +7,19 @@ name: lighter Python package on: [push, pull_request] +permissions: + contents: read + jobs: build: runs-on: ubuntu-latest strategy: matrix: - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -24,15 +27,8 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install flake8 pytest - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - if [ -f test-requirements.txt ]; then pip install -r test-requirements.txt; fi - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics + pip install -r requirements.txt + pip install -r test-requirements.txt - name: Test with pytest run: | - pytest --ignore-glob="*api.py" + pytest --cov=lighter diff --git a/.gitignore b/.gitignore index 416367f..65b06b9 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ __pycache__/ *.py[cod] *$py.class +# C extensions +*.so # Distribution / packaging .Python @@ -21,7 +23,6 @@ var/ *.egg-info/ .installed.cfg *.egg -dev/ # PyInstaller # Usually these files are written by a python script from a template @@ -61,16 +62,5 @@ docs/_build/ # PyBuilder target/ -#Ipython Notebook +# Ipython Notebook .ipynb_checkpoints -openapi-generator-cli.jar - - -.idea - -examples/secrets.py - -# Environment variables -.env -.env.* -api_key_config.json \ No newline at end of file diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index dd3ae62..41fa6ea 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,11 +12,8 @@ stages: script: - pip install -r requirements.txt - pip install -r test-requirements.txt - - pytest --cov=lighter --ignore-glob *api.py + - pytest --cov=lighter -pytest-3.8: - extends: .pytest - image: python:3.8-alpine pytest-3.9: extends: .pytest image: python:3.9-alpine @@ -26,3 +23,9 @@ pytest-3.10: pytest-3.11: extends: .pytest image: python:3.11-alpine +pytest-3.12: + extends: .pytest + image: python:3.12-alpine +pytest-3.13: + extends: .pytest + image: python:3.13-alpine diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 9c5af95..03981cf 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -1,3 +1,8 @@ +.github/workflows/python.yml +.gitignore +.gitlab-ci.yml +.travis.yml +README.md docs/Account.md docs/AccountApi.md docs/AccountApiKeys.md @@ -19,16 +24,23 @@ docs/ApiToken.md docs/ApprovedIntegrator.md docs/Asset.md docs/AssetDetails.md -docs/Auth.md -docs/Bridge.md +docs/Block.md +docs/BlockApi.md +docs/Blocks.md docs/BridgeApi.md docs/BridgeSupportedNetwork.md +docs/BridgeSupportedNetworks.md docs/Candle.md docs/Candles.md +docs/Candlestick.md docs/CandlestickApi.md +docs/Candlesticks.md docs/ContractAddress.md +docs/CreateIntentAddressResp.md +docs/CurrentHeight.md docs/Cursor.md docs/DailyReturn.md +docs/Deposit.md docs/DepositHistory.md docs/DepositHistoryItem.md docs/DetailedAccount.md @@ -47,6 +59,7 @@ docs/Fundings.md docs/InfoApi.md docs/L1Metadata.md docs/L1ProviderInfo.md +docs/Layer1BasicInfo.md docs/LeaseEntry.md docs/LeaseOptionEntry.md docs/LiqTrade.md @@ -60,12 +73,12 @@ docs/Order.md docs/OrderApi.md docs/OrderBook.md docs/OrderBookDepth.md -docs/OrderBookDepthWithBeginNonce.md docs/OrderBookDetails.md docs/OrderBookOrders.md docs/OrderBookStats.md docs/OrderBooks.md docs/Orders.md +docs/PartnerStats.md docs/PendingUnlock.md docs/PerpsMarketStats.md docs/PerpsOrderBookDetail.md @@ -76,11 +89,11 @@ docs/PriceLevel.md docs/PublicPoolInfo.md docs/PublicPoolMetadata.md docs/PublicPoolShare.md -docs/PushNotifDeliveryResult.md -docs/PushnotifApi.md docs/Referral.md docs/ReferralApi.md -docs/ReqDoFaucet.md +docs/ReferralCode.md +docs/ReferralPointEntry.md +docs/ReferralPoints.md docs/ReqExportData.md docs/ReqGetAccount.md docs/ReqGetAccountActiveOrders.md @@ -91,56 +104,52 @@ docs/ReqGetAccountLimits.md docs/ReqGetAccountMetadata.md docs/ReqGetAccountPnL.md docs/ReqGetAccountTxs.md -docs/ReqGetApiTokens.md -docs/ReqGetAssetDetails.md docs/ReqGetBlock.md docs/ReqGetBlockTxs.md -docs/ReqGetBridgesByL1Addr.md docs/ReqGetByAccount.md -docs/ReqGetCandles.md +docs/ReqGetCandlesticks.md docs/ReqGetDepositHistory.md -docs/ReqGetExchangeMetrics.md -docs/ReqGetExecuteStats.md docs/ReqGetFastWithdrawInfo.md docs/ReqGetFundings.md docs/ReqGetL1Metadata.md docs/ReqGetL1Tx.md docs/ReqGetLatestDeposit.md -docs/ReqGetLeases.md docs/ReqGetLiquidationInfos.md +docs/ReqGetMakerOnlyApiKeys.md docs/ReqGetNextNonce.md docs/ReqGetOrderBookDetails.md docs/ReqGetOrderBookOrders.md docs/ReqGetOrderBooks.md docs/ReqGetPositionFunding.md docs/ReqGetPublicPoolsMetadata.md -docs/ReqGetPushNotifSettings.md docs/ReqGetRangeWithCursor.md docs/ReqGetRangeWithIndex.md docs/ReqGetRangeWithIndexSortable.md docs/ReqGetRecentTrades.md +docs/ReqGetReferralPoints.md docs/ReqGetTrades.md docs/ReqGetTransferFeeInfo.md docs/ReqGetTransferHistory.md docs/ReqGetTx.md -docs/ReqGetUserReferrals.md docs/ReqGetWithdrawHistory.md +docs/ReqSetAccountMetadata.md docs/RespChangeAccountTier.md docs/RespGetApiTokens.md -docs/RespGetBridgesByL1Addr.md docs/RespGetExchangeMetrics.md docs/RespGetExecuteStats.md docs/RespGetFastBridgeInfo.md docs/RespGetFastwithdrawalInfo.md -docs/RespGetIsNextBridgeFast.md docs/RespGetLeaseOptions.md docs/RespGetLeases.md -docs/RespGetPushNotifSettings.md +docs/RespGetMakerOnlyApiKeys.md docs/RespPostApiToken.md docs/RespPublicPoolsMetadata.md docs/RespRevokeApiToken.md docs/RespSendTx.md docs/RespSendTxBatch.md +docs/RespSetMakerOnlyApiKeys.md +docs/RespUpdateKickback.md +docs/RespUpdateReferralCode.md docs/RespWithdrawalDelay.md docs/ResultCode.md docs/RiskInfo.md @@ -157,6 +166,9 @@ docs/Strategy.md docs/SubAccounts.md docs/SystemConfig.md docs/Ticker.md +docs/Token.md +docs/TokenList.md +docs/TokenlistApi.md docs/Trade.md docs/TradeStats.md docs/Trades.md @@ -164,8 +176,10 @@ docs/TransactionApi.md docs/TransferFeeInfo.md docs/TransferHistory.md docs/TransferHistoryItem.md +docs/Tx.md docs/TxHash.md docs/TxHashes.md +docs/Txs.md docs/UserReferrals.md docs/ValidatorInfo.md docs/WithdrawHistory.md @@ -176,15 +190,16 @@ lighter/__init__.py lighter/api/__init__.py lighter/api/account_api.py lighter/api/announcement_api.py +lighter/api/block_api.py lighter/api/bridge_api.py lighter/api/candlestick_api.py lighter/api/funding_api.py lighter/api/info_api.py lighter/api/notification_api.py lighter/api/order_api.py -lighter/api/pushnotif_api.py lighter/api/referral_api.py lighter/api/root_api.py +lighter/api/tokenlist_api.py lighter/api/transaction_api.py lighter/api_client.py lighter/api_response.py @@ -210,14 +225,20 @@ lighter/models/api_token.py lighter/models/approved_integrator.py lighter/models/asset.py lighter/models/asset_details.py -lighter/models/auth.py -lighter/models/bridge.py +lighter/models/block.py +lighter/models/blocks.py lighter/models/bridge_supported_network.py +lighter/models/bridge_supported_networks.py lighter/models/candle.py lighter/models/candles.py +lighter/models/candlestick.py +lighter/models/candlesticks.py lighter/models/contract_address.py +lighter/models/create_intent_address_resp.py +lighter/models/current_height.py lighter/models/cursor.py lighter/models/daily_return.py +lighter/models/deposit.py lighter/models/deposit_history.py lighter/models/deposit_history_item.py lighter/models/detailed_account.py @@ -234,6 +255,7 @@ lighter/models/funding_rates.py lighter/models/fundings.py lighter/models/l1_metadata.py lighter/models/l1_provider_info.py +lighter/models/layer1_basic_info.py lighter/models/lease_entry.py lighter/models/lease_option_entry.py lighter/models/liq_trade.py @@ -245,12 +267,12 @@ lighter/models/next_nonce.py lighter/models/order.py lighter/models/order_book.py lighter/models/order_book_depth.py -lighter/models/order_book_depth_with_begin_nonce.py lighter/models/order_book_details.py lighter/models/order_book_orders.py lighter/models/order_book_stats.py lighter/models/order_books.py lighter/models/orders.py +lighter/models/partner_stats.py lighter/models/pending_unlock.py lighter/models/perps_market_stats.py lighter/models/perps_order_book_detail.py @@ -261,9 +283,10 @@ lighter/models/price_level.py lighter/models/public_pool_info.py lighter/models/public_pool_metadata.py lighter/models/public_pool_share.py -lighter/models/push_notif_delivery_result.py lighter/models/referral.py -lighter/models/req_do_faucet.py +lighter/models/referral_code.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 @@ -274,56 +297,52 @@ lighter/models/req_get_account_limits.py lighter/models/req_get_account_metadata.py lighter/models/req_get_account_pn_l.py lighter/models/req_get_account_txs.py -lighter/models/req_get_api_tokens.py -lighter/models/req_get_asset_details.py lighter/models/req_get_block.py lighter/models/req_get_block_txs.py -lighter/models/req_get_bridges_by_l1_addr.py lighter/models/req_get_by_account.py -lighter/models/req_get_candles.py +lighter/models/req_get_candlesticks.py lighter/models/req_get_deposit_history.py -lighter/models/req_get_exchange_metrics.py -lighter/models/req_get_execute_stats.py lighter/models/req_get_fast_withdraw_info.py lighter/models/req_get_fundings.py lighter/models/req_get_l1_metadata.py lighter/models/req_get_l1_tx.py lighter/models/req_get_latest_deposit.py -lighter/models/req_get_leases.py lighter/models/req_get_liquidation_infos.py +lighter/models/req_get_maker_only_api_keys.py lighter/models/req_get_next_nonce.py lighter/models/req_get_order_book_details.py 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_metadata.py -lighter/models/req_get_push_notif_settings.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 lighter/models/req_get_recent_trades.py +lighter/models/req_get_referral_points.py lighter/models/req_get_trades.py 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_user_referrals.py lighter/models/req_get_withdraw_history.py +lighter/models/req_set_account_metadata.py lighter/models/resp_change_account_tier.py lighter/models/resp_get_api_tokens.py -lighter/models/resp_get_bridges_by_l1_addr.py lighter/models/resp_get_exchange_metrics.py lighter/models/resp_get_execute_stats.py lighter/models/resp_get_fast_bridge_info.py lighter/models/resp_get_fastwithdrawal_info.py -lighter/models/resp_get_is_next_bridge_fast.py lighter/models/resp_get_lease_options.py lighter/models/resp_get_leases.py -lighter/models/resp_get_push_notif_settings.py +lighter/models/resp_get_maker_only_api_keys.py lighter/models/resp_post_api_token.py lighter/models/resp_public_pools_metadata.py lighter/models/resp_revoke_api_token.py lighter/models/resp_send_tx.py lighter/models/resp_send_tx_batch.py +lighter/models/resp_set_maker_only_api_keys.py +lighter/models/resp_update_kickback.py +lighter/models/resp_update_referral_code.py lighter/models/resp_withdrawal_delay.py lighter/models/result_code.py lighter/models/risk_info.py @@ -339,14 +358,18 @@ lighter/models/strategy.py lighter/models/sub_accounts.py lighter/models/system_config.py lighter/models/ticker.py +lighter/models/token.py +lighter/models/token_list.py lighter/models/trade.py lighter/models/trade_stats.py lighter/models/trades.py lighter/models/transfer_fee_info.py lighter/models/transfer_history.py lighter/models/transfer_history_item.py +lighter/models/tx.py lighter/models/tx_hash.py lighter/models/tx_hashes.py +lighter/models/txs.py lighter/models/user_referrals.py lighter/models/validator_info.py lighter/models/withdraw_history.py @@ -354,33 +377,35 @@ lighter/models/withdraw_history_item.py lighter/models/zk_lighter_info.py lighter/py.typed lighter/rest.py +pyproject.toml +requirements.txt setup.cfg +setup.py test-requirements.txt test/__init__.py -test/test_approved_integrator.py -test/test_exchange_metric.py -test/test_execute_stat.py -test/test_lease_entry.py -test/test_lease_option_entry.py -test/test_pending_unlock.py -test/test_push_notif_delivery_result.py -test/test_pushnotif_api.py -test/test_referral.py -test/test_referral_api.py -test/test_req_get_exchange_metrics.py -test/test_req_get_execute_stats.py -test/test_req_get_leases.py -test/test_req_get_push_notif_settings.py -test/test_req_get_user_referrals.py -test/test_resp_get_exchange_metrics.py -test/test_resp_get_execute_stats.py -test/test_resp_get_lease_options.py -test/test_resp_get_leases.py -test/test_resp_get_push_notif_settings.py -test/test_slippage_result.py -test/test_spot_avg_entry_price.py -test/test_strategy.py -test/test_system_config.py -test/test_trade_stats.py -test/test_user_referrals.py +test/test_block.py +test/test_block_api.py +test/test_blocks.py +test/test_bridge_supported_networks.py +test/test_candlestick.py +test/test_candlesticks.py +test/test_create_intent_address_resp.py +test/test_current_height.py +test/test_deposit.py +test/test_layer1_basic_info.py +test/test_partner_stats.py +test/test_referral_code.py +test/test_referral_point_entry.py +test/test_referral_points.py +test/test_req_get_candlesticks.py +test/test_req_get_maker_only_api_keys.py +test/test_req_get_referral_points.py +test/test_req_set_account_metadata.py +test/test_resp_update_kickback.py +test/test_resp_update_referral_code.py +test/test_token.py +test/test_token_list.py +test/test_tokenlist_api.py +test/test_tx.py +test/test_txs.py tox.ini diff --git a/.openapi-generator/VERSION b/.openapi-generator/VERSION index 1985849..a29ba3d 100644 --- a/.openapi-generator/VERSION +++ b/.openapi-generator/VERSION @@ -1 +1 @@ -7.7.0 +7.21.0 diff --git a/.travis.yml b/.travis.yml index 35830c5..cb7d0e1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,12 +1,13 @@ # ref: https://docs.travis-ci.com/user/languages/python language: python python: - - "3.8" - "3.9" - "3.10" - "3.11" + - "3.12" + - "3.13" # uncomment the following if needed - #- "3.11-dev" # 3.11 development branch + #- "3.13-dev" # 3.13 development branch #- "nightly" # nightly build # command to install dependencies install: diff --git a/README.md b/README.md index ef57fd3..8ea200c 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,16 @@ -# Lighter Python +# lighter-sdk +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) -Python SDK for Lighter +This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: + +- API version: +- Package version: 1.0.0 +- Generator version: 7.21.0 +- Build package: org.openapitools.codegen.languages.PythonClientCodegen ## Requirements. -Python 3.8+ +Python 3.9+ ## Installation & Usage ### pip install @@ -12,9 +18,23 @@ Python 3.8+ If the python package is hosted on a repository, you can install directly using: ```sh -pip install git+https://github.com/elliottech/lighter-python.git +pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git +``` +(you may need to run `pip` with root permission: `sudo pip install git+https://github.com/GIT_USER_ID/GIT_REPO_ID.git`) + +Then import the package: +```python +import lighter ``` +### Setuptools + +Install via [Setuptools](http://pypi.python.org/pypi/setuptools). + +```sh +python setup.py install --user +``` +(or `sudo python setup.py install` to install the package for all users) Then import the package: ```python @@ -32,36 +52,34 @@ Please follow the [installation procedure](#installation--usage) and then run th ```python import lighter -import asyncio +from lighter.rest import ApiException +from pprint import pprint -async def main(): - client = lighter.ApiClient() - try: - account_api = lighter.AccountApi(client) - account = await account_api.account(by="index", value="1") - print(account) - finally: - await client.close() # Make sure connection is cleanly closed +# 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" +) -if __name__ == "__main__": - asyncio.run(main()) -``` -# Examples -## [Read API Functions](examples/get_info.py) -```sh -python examples/get_info.py -``` +# 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) + by = 'by_example' # str | + value = 'value_example' # str | + active_only = False # bool | Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. (optional) (default to False) + cursor = 'cursor_example' # str | (optional) -## [Websocket Sync Order Books & Accounts](examples/ws.py) -```sh -python examples/ws.py -``` + try: + # account + api_response = await api_instance.account(by, value, active_only=active_only, cursor=cursor) + print("The response of AccountApi->account:\n") + pprint(api_response) + except ApiException as e: + print("Exception when calling AccountApi->account: %s\n" % e) -## [Create & Cancel Orders](examples/create_cancel_order.py) -```sh -python examples/create_cancel_order.py ``` ## Documentation for API Endpoints @@ -71,23 +89,74 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *AccountApi* | [**account**](docs/AccountApi.md#account) | **GET** /api/v1/account | account +*AccountApi* | [**account_limits**](docs/AccountApi.md#account_limits) | **GET** /api/v1/accountLimits | accountLimits +*AccountApi* | [**account_metadata**](docs/AccountApi.md#account_metadata) | **GET** /api/v1/accountMetadata | accountMetadata *AccountApi* | [**accounts_by_l1_address**](docs/AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address *AccountApi* | [**apikeys**](docs/AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys +*AccountApi* | [**change_account_tier**](docs/AccountApi.md#change_account_tier) | **POST** /api/v1/changeAccountTier | changeAccountTier +*AccountApi* | [**get_maker_only_api_keys**](docs/AccountApi.md#get_maker_only_api_keys) | **GET** /api/v1/getMakerOnlyApiKeys | getMakerOnlyApiKeys +*AccountApi* | [**l1_metadata**](docs/AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata +*AccountApi* | [**lease_options**](docs/AccountApi.md#lease_options) | **GET** /api/v1/leaseOptions | leaseOptions +*AccountApi* | [**leases**](docs/AccountApi.md#leases) | **GET** /api/v1/leases | leases +*AccountApi* | [**liquidations**](docs/AccountApi.md#liquidations) | **GET** /api/v1/liquidations | liquidations +*AccountApi* | [**lit_lease**](docs/AccountApi.md#lit_lease) | **POST** /api/v1/litLease | litLease +*AccountApi* | [**partner_stats**](docs/AccountApi.md#partner_stats) | **GET** /api/v1/partnerStats | partnerStats *AccountApi* | [**pnl**](docs/AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl +*AccountApi* | [**position_funding**](docs/AccountApi.md#position_funding) | **GET** /api/v1/positionFunding | positionFunding +*AccountApi* | [**public_pools_metadata**](docs/AccountApi.md#public_pools_metadata) | **GET** /api/v1/publicPoolsMetadata | publicPoolsMetadata +*AccountApi* | [**set_maker_only_api_keys**](docs/AccountApi.md#set_maker_only_api_keys) | **POST** /api/v1/setMakerOnlyApiKeys | setMakerOnlyApiKeys +*AccountApi* | [**tokens**](docs/AccountApi.md#tokens) | **GET** /api/v1/tokens | tokens +*AccountApi* | [**tokens_create**](docs/AccountApi.md#tokens_create) | **POST** /api/v1/tokens/create | tokens_create +*AccountApi* | [**tokens_revoke**](docs/AccountApi.md#tokens_revoke) | **POST** /api/v1/tokens/revoke | tokens_revoke +*AccountApi* | [**user_referrals**](docs/AccountApi.md#user_referrals) | **GET** /api/v1/referral/userReferrals | userReferrals +*AnnouncementApi* | [**announcement**](docs/AnnouncementApi.md#announcement) | **GET** /api/v1/announcement | announcement +*BlockApi* | [**block**](docs/BlockApi.md#block) | **GET** /api/v1/block | block +*BlockApi* | [**blocks**](docs/BlockApi.md#blocks) | **GET** /api/v1/blocks | blocks +*BlockApi* | [**current_height**](docs/BlockApi.md#current_height) | **GET** /api/v1/currentHeight | currentHeight +*BridgeApi* | [**create_intent_address**](docs/BridgeApi.md#create_intent_address) | **POST** /api/v1/createIntentAddress | createIntentAddress +*BridgeApi* | [**deposit_latest**](docs/BridgeApi.md#deposit_latest) | **GET** /api/v1/deposit/latest | deposit_latest +*BridgeApi* | [**deposit_networks**](docs/BridgeApi.md#deposit_networks) | **GET** /api/v1/deposit/networks | deposit_networks +*BridgeApi* | [**fastbridge_info**](docs/BridgeApi.md#fastbridge_info) | **GET** /api/v1/fastbridge/info | fastbridge_info +*BridgeApi* | [**fastwithdraw**](docs/BridgeApi.md#fastwithdraw) | **POST** /api/v1/fastwithdraw | fastwithdraw +*BridgeApi* | [**fastwithdraw_info**](docs/BridgeApi.md#fastwithdraw_info) | **GET** /api/v1/fastwithdraw/info | fastwithdraw_info +*CandlestickApi* | [**candles**](docs/CandlestickApi.md#candles) | **GET** /api/v1/candles | candles *CandlestickApi* | [**fundings**](docs/CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings +*FundingApi* | [**funding_rates**](docs/FundingApi.md#funding_rates) | **GET** /api/v1/funding-rates | funding-rates +*InfoApi* | [**layer1_basic_info**](docs/InfoApi.md#layer1_basic_info) | **GET** /api/v1/layer1BasicInfo | layer1BasicInfo +*InfoApi* | [**system_config**](docs/InfoApi.md#system_config) | **GET** /api/v1/systemConfig | systemConfig +*InfoApi* | [**transfer_fee_info**](docs/InfoApi.md#transfer_fee_info) | **GET** /api/v1/transferFeeInfo | transferFeeInfo +*InfoApi* | [**withdrawal_delay**](docs/InfoApi.md#withdrawal_delay) | **GET** /api/v1/withdrawalDelay | withdrawalDelay +*NotificationApi* | [**notification_ack**](docs/NotificationApi.md#notification_ack) | **POST** /api/v1/notification/ack | notification_ack +*OrderApi* | [**account_active_orders**](docs/OrderApi.md#account_active_orders) | **GET** /api/v1/accountActiveOrders | accountActiveOrders *OrderApi* | [**account_inactive_orders**](docs/OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders +*OrderApi* | [**asset_details**](docs/OrderApi.md#asset_details) | **GET** /api/v1/assetDetails | assetDetails +*OrderApi* | [**exchange_metrics**](docs/OrderApi.md#exchange_metrics) | **GET** /api/v1/exchangeMetrics | exchangeMetrics *OrderApi* | [**exchange_stats**](docs/OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats +*OrderApi* | [**execute_stats**](docs/OrderApi.md#execute_stats) | **GET** /api/v1/executeStats | executeStats +*OrderApi* | [**export**](docs/OrderApi.md#export) | **GET** /api/v1/export | export *OrderApi* | [**order_book_details**](docs/OrderApi.md#order_book_details) | **GET** /api/v1/orderBookDetails | orderBookDetails *OrderApi* | [**order_book_orders**](docs/OrderApi.md#order_book_orders) | **GET** /api/v1/orderBookOrders | orderBookOrders *OrderApi* | [**order_books**](docs/OrderApi.md#order_books) | **GET** /api/v1/orderBooks | orderBooks *OrderApi* | [**recent_trades**](docs/OrderApi.md#recent_trades) | **GET** /api/v1/recentTrades | recentTrades *OrderApi* | [**trades**](docs/OrderApi.md#trades) | **GET** /api/v1/trades | trades +*ReferralApi* | [**referral_create**](docs/ReferralApi.md#referral_create) | **POST** /api/v1/referral/create | referral_create +*ReferralApi* | [**referral_get**](docs/ReferralApi.md#referral_get) | **GET** /api/v1/referral/get | referral_get +*ReferralApi* | [**referral_kickback_update**](docs/ReferralApi.md#referral_kickback_update) | **POST** /api/v1/referral/kickback/update | referral_kickback_update +*ReferralApi* | [**referral_points**](docs/ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points +*ReferralApi* | [**referral_update**](docs/ReferralApi.md#referral_update) | **POST** /api/v1/referral/update | referral_update +*ReferralApi* | [**referral_use**](docs/ReferralApi.md#referral_use) | **POST** /api/v1/referral/use | referral_use *RootApi* | [**info**](docs/RootApi.md#info) | **GET** /info | info *RootApi* | [**status**](docs/RootApi.md#status) | **GET** / | status +*TokenlistApi* | [**tokenlist**](docs/TokenlistApi.md#tokenlist) | **GET** /api/v1/tokenlist | tokenlist +*TransactionApi* | [**account_txs**](docs/TransactionApi.md#account_txs) | **GET** /api/v1/accountTxs | accountTxs +*TransactionApi* | [**block_txs**](docs/TransactionApi.md#block_txs) | **GET** /api/v1/blockTxs | blockTxs *TransactionApi* | [**deposit_history**](docs/TransactionApi.md#deposit_history) | **GET** /api/v1/deposit/history | deposit_history *TransactionApi* | [**next_nonce**](docs/TransactionApi.md#next_nonce) | **GET** /api/v1/nextNonce | nextNonce *TransactionApi* | [**send_tx**](docs/TransactionApi.md#send_tx) | **POST** /api/v1/sendTx | sendTx *TransactionApi* | [**send_tx_batch**](docs/TransactionApi.md#send_tx_batch) | **POST** /api/v1/sendTxBatch | sendTxBatch +*TransactionApi* | [**set_account_metadata**](docs/TransactionApi.md#set_account_metadata) | **POST** /api/v1/setAccountMetadata | setAccountMetadata +*TransactionApi* | [**transfer_history**](docs/TransactionApi.md#transfer_history) | **GET** /api/v1/transfer/history | transfer_history +*TransactionApi* | [**tx**](docs/TransactionApi.md#tx) | **GET** /api/v1/tx | tx *TransactionApi* | [**tx_from_l1_tx_hash**](docs/TransactionApi.md#tx_from_l1_tx_hash) | **GET** /api/v1/txFromL1TxHash | txFromL1TxHash *TransactionApi* | [**txs**](docs/TransactionApi.md#txs) | **GET** /api/v1/txs | txs *TransactionApi* | [**withdraw_history**](docs/TransactionApi.md#withdraw_history) | **GET** /api/v1/withdraw/history | withdraw_history @@ -97,48 +166,93 @@ Class | Method | HTTP request | Description - [Account](docs/Account.md) - [AccountApiKeys](docs/AccountApiKeys.md) + - [AccountAsset](docs/AccountAsset.md) + - [AccountLimits](docs/AccountLimits.md) + - [AccountMarginStats](docs/AccountMarginStats.md) - [AccountMarketStats](docs/AccountMarketStats.md) - [AccountMetadata](docs/AccountMetadata.md) + - [AccountMetadatas](docs/AccountMetadatas.md) - [AccountPnL](docs/AccountPnL.md) - [AccountPosition](docs/AccountPosition.md) - [AccountStats](docs/AccountStats.md) + - [AccountTradeStats](docs/AccountTradeStats.md) + - [Announcement](docs/Announcement.md) + - [Announcements](docs/Announcements.md) - [ApiKey](docs/ApiKey.md) + - [ApiToken](docs/ApiToken.md) + - [ApprovedIntegrator](docs/ApprovedIntegrator.md) + - [Asset](docs/Asset.md) + - [AssetDetails](docs/AssetDetails.md) + - [Block](docs/Block.md) + - [Blocks](docs/Blocks.md) - [BridgeSupportedNetwork](docs/BridgeSupportedNetwork.md) + - [BridgeSupportedNetworks](docs/BridgeSupportedNetworks.md) + - [Candle](docs/Candle.md) + - [Candles](docs/Candles.md) + - [Candlestick](docs/Candlestick.md) + - [Candlesticks](docs/Candlesticks.md) - [ContractAddress](docs/ContractAddress.md) + - [CreateIntentAddressResp](docs/CreateIntentAddressResp.md) + - [CurrentHeight](docs/CurrentHeight.md) - [Cursor](docs/Cursor.md) + - [DailyReturn](docs/DailyReturn.md) + - [Deposit](docs/Deposit.md) - [DepositHistory](docs/DepositHistory.md) - [DepositHistoryItem](docs/DepositHistoryItem.md) - [DetailedAccount](docs/DetailedAccount.md) - [DetailedAccounts](docs/DetailedAccounts.md) - [DetailedCandlestick](docs/DetailedCandlestick.md) - [EnrichedTx](docs/EnrichedTx.md) + - [ExchangeMetric](docs/ExchangeMetric.md) - [ExchangeStats](docs/ExchangeStats.md) + - [ExecuteStat](docs/ExecuteStat.md) + - [ExportData](docs/ExportData.md) - [Funding](docs/Funding.md) + - [FundingRate](docs/FundingRate.md) + - [FundingRates](docs/FundingRates.md) - [Fundings](docs/Fundings.md) + - [L1Metadata](docs/L1Metadata.md) - [L1ProviderInfo](docs/L1ProviderInfo.md) + - [Layer1BasicInfo](docs/Layer1BasicInfo.md) + - [LeaseEntry](docs/LeaseEntry.md) + - [LeaseOptionEntry](docs/LeaseOptionEntry.md) + - [LiqTrade](docs/LiqTrade.md) - [Liquidation](docs/Liquidation.md) - - [MarketInfo](docs/MarketInfo.md) + - [LiquidationInfo](docs/LiquidationInfo.md) + - [LiquidationInfos](docs/LiquidationInfos.md) + - [MarketConfig](docs/MarketConfig.md) - [NextNonce](docs/NextNonce.md) - [Order](docs/Order.md) - [OrderBook](docs/OrderBook.md) - [OrderBookDepth](docs/OrderBookDepth.md) - - [OrderBookDetail](docs/OrderBookDetail.md) - [OrderBookDetails](docs/OrderBookDetails.md) - [OrderBookOrders](docs/OrderBookOrders.md) - [OrderBookStats](docs/OrderBookStats.md) - [OrderBooks](docs/OrderBooks.md) - [Orders](docs/Orders.md) + - [PartnerStats](docs/PartnerStats.md) + - [PendingUnlock](docs/PendingUnlock.md) + - [PerpsMarketStats](docs/PerpsMarketStats.md) + - [PerpsOrderBookDetail](docs/PerpsOrderBookDetail.md) - [PnLEntry](docs/PnLEntry.md) - [PositionFunding](docs/PositionFunding.md) + - [PositionFundings](docs/PositionFundings.md) - [PriceLevel](docs/PriceLevel.md) - - [PublicPool](docs/PublicPool.md) - [PublicPoolInfo](docs/PublicPoolInfo.md) + - [PublicPoolMetadata](docs/PublicPoolMetadata.md) - [PublicPoolShare](docs/PublicPoolShare.md) - - [PublicPools](docs/PublicPools.md) + - [Referral](docs/Referral.md) + - [ReferralCode](docs/ReferralCode.md) + - [ReferralPointEntry](docs/ReferralPointEntry.md) + - [ReferralPoints](docs/ReferralPoints.md) + - [ReqExportData](docs/ReqExportData.md) - [ReqGetAccount](docs/ReqGetAccount.md) + - [ReqGetAccountActiveOrders](docs/ReqGetAccountActiveOrders.md) - [ReqGetAccountApiKeys](docs/ReqGetAccountApiKeys.md) - [ReqGetAccountByL1Address](docs/ReqGetAccountByL1Address.md) - [ReqGetAccountInactiveOrders](docs/ReqGetAccountInactiveOrders.md) + - [ReqGetAccountLimits](docs/ReqGetAccountLimits.md) + - [ReqGetAccountMetadata](docs/ReqGetAccountMetadata.md) - [ReqGetAccountPnL](docs/ReqGetAccountPnL.md) - [ReqGetAccountTxs](docs/ReqGetAccountTxs.md) - [ReqGetBlock](docs/ReqGetBlock.md) @@ -146,41 +260,96 @@ Class | Method | HTTP request | Description - [ReqGetByAccount](docs/ReqGetByAccount.md) - [ReqGetCandlesticks](docs/ReqGetCandlesticks.md) - [ReqGetDepositHistory](docs/ReqGetDepositHistory.md) + - [ReqGetFastWithdrawInfo](docs/ReqGetFastWithdrawInfo.md) - [ReqGetFundings](docs/ReqGetFundings.md) + - [ReqGetL1Metadata](docs/ReqGetL1Metadata.md) - [ReqGetL1Tx](docs/ReqGetL1Tx.md) - [ReqGetLatestDeposit](docs/ReqGetLatestDeposit.md) + - [ReqGetLiquidationInfos](docs/ReqGetLiquidationInfos.md) + - [ReqGetMakerOnlyApiKeys](docs/ReqGetMakerOnlyApiKeys.md) - [ReqGetNextNonce](docs/ReqGetNextNonce.md) - [ReqGetOrderBookDetails](docs/ReqGetOrderBookDetails.md) - [ReqGetOrderBookOrders](docs/ReqGetOrderBookOrders.md) - [ReqGetOrderBooks](docs/ReqGetOrderBooks.md) - - [ReqGetPublicPools](docs/ReqGetPublicPools.md) + - [ReqGetPositionFunding](docs/ReqGetPositionFunding.md) + - [ReqGetPublicPoolsMetadata](docs/ReqGetPublicPoolsMetadata.md) - [ReqGetRangeWithCursor](docs/ReqGetRangeWithCursor.md) - [ReqGetRangeWithIndex](docs/ReqGetRangeWithIndex.md) - [ReqGetRangeWithIndexSortable](docs/ReqGetRangeWithIndexSortable.md) - [ReqGetRecentTrades](docs/ReqGetRecentTrades.md) + - [ReqGetReferralPoints](docs/ReqGetReferralPoints.md) - [ReqGetTrades](docs/ReqGetTrades.md) + - [ReqGetTransferFeeInfo](docs/ReqGetTransferFeeInfo.md) + - [ReqGetTransferHistory](docs/ReqGetTransferHistory.md) - [ReqGetTx](docs/ReqGetTx.md) - [ReqGetWithdrawHistory](docs/ReqGetWithdrawHistory.md) + - [ReqSetAccountMetadata](docs/ReqSetAccountMetadata.md) + - [RespChangeAccountTier](docs/RespChangeAccountTier.md) + - [RespGetApiTokens](docs/RespGetApiTokens.md) + - [RespGetExchangeMetrics](docs/RespGetExchangeMetrics.md) + - [RespGetExecuteStats](docs/RespGetExecuteStats.md) + - [RespGetFastBridgeInfo](docs/RespGetFastBridgeInfo.md) + - [RespGetFastwithdrawalInfo](docs/RespGetFastwithdrawalInfo.md) + - [RespGetLeaseOptions](docs/RespGetLeaseOptions.md) + - [RespGetLeases](docs/RespGetLeases.md) + - [RespGetMakerOnlyApiKeys](docs/RespGetMakerOnlyApiKeys.md) + - [RespPostApiToken](docs/RespPostApiToken.md) + - [RespPublicPoolsMetadata](docs/RespPublicPoolsMetadata.md) + - [RespRevokeApiToken](docs/RespRevokeApiToken.md) + - [RespSendTx](docs/RespSendTx.md) + - [RespSendTxBatch](docs/RespSendTxBatch.md) + - [RespSetMakerOnlyApiKeys](docs/RespSetMakerOnlyApiKeys.md) + - [RespUpdateKickback](docs/RespUpdateKickback.md) + - [RespUpdateReferralCode](docs/RespUpdateReferralCode.md) + - [RespWithdrawalDelay](docs/RespWithdrawalDelay.md) - [ResultCode](docs/ResultCode.md) + - [RiskInfo](docs/RiskInfo.md) + - [RiskParameters](docs/RiskParameters.md) + - [SharePrice](docs/SharePrice.md) - [SimpleOrder](docs/SimpleOrder.md) + - [SlippageResult](docs/SlippageResult.md) + - [SpotAvgEntryPrice](docs/SpotAvgEntryPrice.md) + - [SpotMarketStats](docs/SpotMarketStats.md) + - [SpotOrderBookDetail](docs/SpotOrderBookDetail.md) - [Status](docs/Status.md) + - [Strategy](docs/Strategy.md) - [SubAccounts](docs/SubAccounts.md) + - [SystemConfig](docs/SystemConfig.md) - [Ticker](docs/Ticker.md) + - [Token](docs/Token.md) + - [TokenList](docs/TokenList.md) - [Trade](docs/Trade.md) + - [TradeStats](docs/TradeStats.md) - [Trades](docs/Trades.md) + - [TransferFeeInfo](docs/TransferFeeInfo.md) + - [TransferHistory](docs/TransferHistory.md) + - [TransferHistoryItem](docs/TransferHistoryItem.md) + - [Tx](docs/Tx.md) - [TxHash](docs/TxHash.md) - [TxHashes](docs/TxHashes.md) + - [Txs](docs/Txs.md) + - [UserReferrals](docs/UserReferrals.md) - [ValidatorInfo](docs/ValidatorInfo.md) - [WithdrawHistory](docs/WithdrawHistory.md) - [WithdrawHistoryItem](docs/WithdrawHistoryItem.md) - [ZkLighterInfo](docs/ZkLighterInfo.md) -[//]: # () + +## Documentation For Authorization + + +Authentication schemes defined for the API: + +### apiKey + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + + +## Author -[//]: # (## Documentation For Authorization) -[//]: # () -[//]: # (Endpoints do not require authorization.) diff --git a/docs/Account.md b/docs/Account.md index 75cdc2e..e2dc303 100644 --- a/docs/Account.md +++ b/docs/Account.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **account_type** | **int** | | +**account_trading_mode** | **int** | Classic=0 and Unified=1 | **index** | **int** | | **l1_address** | **str** | | **cancel_all_time** | **int** | | @@ -18,7 +19,6 @@ Name | Type | Description | Notes **status** | **int** | | **collateral** | **str** | | **transaction_time** | **int** | | -**account_trading_mode** | **int** | | ## Example diff --git a/docs/AccountApi.md b/docs/AccountApi.md index b3347dc..61484e5 100644 --- a/docs/AccountApi.md +++ b/docs/AccountApi.md @@ -10,7 +10,6 @@ Method | HTTP request | Description [**accounts_by_l1_address**](AccountApi.md#accounts_by_l1_address) | **GET** /api/v1/accountsByL1Address | accountsByL1Address [**apikeys**](AccountApi.md#apikeys) | **GET** /api/v1/apikeys | apikeys [**change_account_tier**](AccountApi.md#change_account_tier) | **POST** /api/v1/changeAccountTier | changeAccountTier -[**faucet**](AccountApi.md#faucet) | **GET** /api/v1/faucet | faucet [**get_maker_only_api_keys**](AccountApi.md#get_maker_only_api_keys) | **GET** /api/v1/getMakerOnlyApiKeys | getMakerOnlyApiKeys [**l1_metadata**](AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata [**lease_options**](AccountApi.md#lease_options) | **GET** /api/v1/leaseOptions | leaseOptions @@ -25,6 +24,7 @@ Method | HTTP request | Description [**tokens**](AccountApi.md#tokens) | **GET** /api/v1/tokens | tokens [**tokens_create**](AccountApi.md#tokens_create) | **POST** /api/v1/tokens/create | tokens_create [**tokens_revoke**](AccountApi.md#tokens_revoke) | **POST** /api/v1/tokens/revoke | tokens_revoke +[**user_referrals**](AccountApi.md#user_referrals) | **GET** /api/v1/referral/userReferrals | userReferrals # **account** @@ -32,7 +32,7 @@ Method | HTTP request | Description account -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. +Get account by an account's index, or L1 address ### Example @@ -56,7 +56,7 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.AccountApi(api_client) by = 'by_example' # str | value = 'value_example' # str | - active_only = False # bool | (optional) (default to False) + active_only = False # bool | Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. (optional) (default to False) cursor = 'cursor_example' # str | (optional) try: @@ -77,7 +77,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **by** | **str**| | **value** | **str**| | - **active_only** | **bool**| | [optional] [default to False] + **active_only** | **bool**| Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. | [optional] [default to False] **cursor** | **str**| | [optional] ### Return type @@ -103,11 +103,11 @@ 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) # **account_limits** -> AccountLimits account_limits(account_index, authorization=authorization, auth=auth) +> AccountLimits account_limits(account_index, authorization) accountLimits -Get account limits +Get account limits. For more details on account types, see this page: https://apidocs.lighter.xyz/docs/account-types ### Example @@ -130,12 +130,11 @@ async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) account_index = 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) + authorization = 'authorization_example' # str | try: # accountLimits - api_response = await api_instance.account_limits(account_index, authorization=authorization, auth=auth) + api_response = await api_instance.account_limits(account_index, authorization) print("The response of AccountApi->account_limits:\n") pprint(api_response) except Exception as e: @@ -150,8 +149,7 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] + **authorization** | **str**| | ### Return type @@ -176,7 +174,7 @@ 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) # **account_metadata** -> AccountMetadatas account_metadata(by, value, authorization=authorization, auth=auth, cursor=cursor) +> AccountMetadatas account_metadata(by, value, authorization=authorization, cursor=cursor) accountMetadata @@ -205,12 +203,11 @@ async with lighter.ApiClient(configuration) as api_client: by = 'by_example' # str | value = 'value_example' # str | authorization = 'authorization_example' # str | (optional) - auth = 'auth_example' # str | (optional) cursor = 'cursor_example' # str | (optional) try: # accountMetadata - api_response = await api_instance.account_metadata(by, value, authorization=authorization, auth=auth, cursor=cursor) + api_response = await api_instance.account_metadata(by, value, authorization=authorization, cursor=cursor) print("The response of AccountApi->account_metadata:\n") pprint(api_response) except Exception as e: @@ -227,7 +224,6 @@ Name | Type | Description | Notes **by** | **str**| | **value** | **str**| | **authorization** | **str**| | [optional] - **auth** | **str**| | [optional] **cursor** | **str**| | [optional] ### Return type @@ -257,7 +253,7 @@ No authorization required accountsByL1Address -Get accounts by l1_address returns all accounts associated with the given L1 address +Returns all accounts associated with the given L1 address ### Example @@ -351,7 +347,7 @@ async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) account_index = 56 # int | - api_key_index = 255 # int | (optional) (default to 255) + api_key_index = 56 # int | (optional) try: # apikeys @@ -370,7 +366,7 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | - **api_key_index** | **int**| | [optional] [default to 255] + **api_key_index** | **int**| | [optional] ### Return type @@ -399,7 +395,7 @@ No authorization required changeAccountTier -Change account tier +Change account tier. You can only perform this action once every 24 hours, and with no orders or positions open. ### Example @@ -457,78 +453,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data - - **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) - -# **faucet** -> ResultCode faucet(l1_address, do_l1_transfer) - -faucet - -Request funds from faucet - -### Example - - -```python -import lighter -from lighter.models.result_code import ResultCode -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) - l1_address = 'l1_address_example' # str | - do_l1_transfer = False # bool | (default to False) - - try: - # faucet - api_response = await api_instance.faucet(l1_address, do_l1_transfer) - print("The response of AccountApi->faucet:\n") - pprint(api_response) - except Exception as e: - print("Exception when calling AccountApi->faucet: %s\n" % e) -``` - - - -### Parameters - - -Name | Type | Description | Notes -------------- | ------------- | ------------- | ------------- - **l1_address** | **str**| | - **do_l1_transfer** | **bool**| | [default to False] - -### Return type - -[**ResultCode**](ResultCode.md) - -### Authorization - -No authorization required - -### HTTP request headers - - - **Content-Type**: Not defined + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -541,7 +466,7 @@ 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) # **get_maker_only_api_keys** -> RespGetMakerOnlyApiKeys get_maker_only_api_keys(account_index, authorization=authorization, auth=auth) +> RespGetMakerOnlyApiKeys get_maker_only_api_keys(authorization, account_index) getMakerOnlyApiKeys @@ -567,13 +492,12 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) + authorization = 'authorization_example' # str | account_index = 56 # int | - authorization = 'authorization_example' # str | (optional) - auth = 'auth_example' # str | (optional) try: # getMakerOnlyApiKeys - api_response = await api_instance.get_maker_only_api_keys(account_index, authorization=authorization, auth=auth) + api_response = await api_instance.get_maker_only_api_keys(authorization, account_index) print("The response of AccountApi->get_maker_only_api_keys:\n") pprint(api_response) except Exception as e: @@ -587,9 +511,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | - **authorization** | **str**| | [optional] - **auth** | **str**| | [optional] ### Return type @@ -614,7 +537,7 @@ 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) # **l1_metadata** -> L1Metadata l1_metadata(l1_address, authorization=authorization, auth=auth) +> L1Metadata l1_metadata(authorization, l1_address) l1Metadata @@ -640,13 +563,12 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) + authorization = 'authorization_example' # str | l1_address = 'l1_address_example' # str | - authorization = 'authorization_example' # str | make required after integ is done (optional) - auth = 'auth_example' # str | made optional to support header auth clients (optional) try: # l1Metadata - api_response = await api_instance.l1_metadata(l1_address, authorization=authorization, auth=auth) + api_response = await api_instance.l1_metadata(authorization, l1_address) print("The response of AccountApi->l1_metadata:\n") pprint(api_response) except Exception as e: @@ -660,9 +582,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **l1_address** | **str**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] ### Return type @@ -691,7 +612,7 @@ No authorization required leaseOptions -Get lease options +Returns available lease duration/rate tiers, sorted by duration descending. ### Example @@ -752,11 +673,11 @@ 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) # **leases** -> RespGetLeases leases(account_index, authorization=authorization, auth=auth, cursor=cursor, limit=limit) +> RespGetLeases leases(account_index, authorization=authorization, cursor=cursor, limit=limit, auth=auth) leases -Get leases +Returns paginated lease entries for an account, most recent first. Supports read-only auth via signature/account_index/timestamp query params. ### Example @@ -778,15 +699,15 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) - account_index = 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) - cursor = 'cursor_example' # str | (optional) - limit = 20 # int | (optional) (default to 20) + account_index = 56 # int | Account index to fetch leases for + authorization = 'authorization_example' # str | API token authorization (optional) + cursor = 'cursor_example' # str | Pagination cursor from a previous response (optional) + limit = 20 # int | Number of results to return (1–100, default 20) (optional) (default to 20) + auth = 'auth_example' # str | Read-only auth (alternative to header authorization) (optional) try: # leases - api_response = await api_instance.leases(account_index, authorization=authorization, auth=auth, cursor=cursor, limit=limit) + api_response = await api_instance.leases(account_index, authorization=authorization, cursor=cursor, limit=limit, auth=auth) print("The response of AccountApi->leases:\n") pprint(api_response) except Exception as e: @@ -800,11 +721,11 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **cursor** | **str**| | [optional] - **limit** | **int**| | [optional] [default to 20] + **account_index** | **int**| Account index to fetch leases for | + **authorization** | **str**| API token authorization | [optional] + **cursor** | **str**| Pagination cursor from a previous response | [optional] + **limit** | **int**| Number of results to return (1–100, default 20) | [optional] [default to 20] + **auth** | **str**| Read-only auth (alternative to header authorization) | [optional] ### Return type @@ -829,7 +750,7 @@ 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) # **liquidations** -> LiquidationInfos liquidations(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor) +> LiquidationInfos liquidations(authorization, account_index, limit, market_id=market_id, cursor=cursor) liquidations @@ -855,16 +776,15 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) + authorization = 'authorization_example' # str | account_index = 56 # int | limit = 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) - market_id = 255 # int | (optional) (default to 255) + market_id = 56 # int | (optional) cursor = 'cursor_example' # str | (optional) try: # liquidations - api_response = await api_instance.liquidations(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor) + api_response = await api_instance.liquidations(authorization, account_index, limit, market_id=market_id, cursor=cursor) print("The response of AccountApi->liquidations:\n") pprint(api_response) except Exception as e: @@ -878,11 +798,10 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | **limit** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **market_id** | **int**| | [optional] [default to 255] + **market_id** | **int**| | [optional] **cursor** | **str**| | [optional] ### Return type @@ -908,11 +827,11 @@ 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) # **lit_lease** -> TxHash lit_lease(tx_info, lease_amount, duration_days, authorization=authorization) +> TxHash lit_lease(authorization=authorization, tx_info=tx_info, lease_amount=lease_amount, duration_days=duration_days) litLease -Submit LIT lease transfer +Submit a LIT lease transfer. The server calculates the required fee based on lease_amount and duration_days, then executes the transfer. Fee formula (integer arithmetic): fee = lease_amount × (annual_rate × 100) × duration_days / (360 × 10000). ### Example @@ -934,14 +853,14 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) - tx_info = 'tx_info_example' # str | - lease_amount = 'lease_amount_example' # str | - duration_days = 56 # int | - authorization = 'authorization_example' # str | (optional) + authorization = 'authorization_example' # str | API token authorization (optional) + tx_info = 'tx_info_example' # str | Signed transaction info (JSON with L2 signature, L1 signature, etc.) (optional) + lease_amount = 'lease_amount_example' # str | Amount of LIT to lease in raw units (1 LIT = 100000000) (optional) + duration_days = 56 # int | Lease duration in days. Must match one of the available lease options. (optional) try: # litLease - api_response = await api_instance.lit_lease(tx_info, lease_amount, duration_days, authorization=authorization) + api_response = await api_instance.lit_lease(authorization=authorization, tx_info=tx_info, lease_amount=lease_amount, duration_days=duration_days) print("The response of AccountApi->lit_lease:\n") pprint(api_response) except Exception as e: @@ -955,10 +874,10 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **tx_info** | **str**| | - **lease_amount** | **str**| | - **duration_days** | **int**| | - **authorization** | **str**| | [optional] + **authorization** | **str**| API token authorization | [optional] + **tx_info** | **str**| Signed transaction info (JSON with L2 signature, L1 signature, etc.) | [optional] + **lease_amount** | **str**| Amount of LIT to lease in raw units (1 LIT = 100000000) | [optional] + **duration_days** | **int**| Lease duration in days. Must match one of the available lease options. | [optional] ### Return type @@ -970,7 +889,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -987,7 +906,7 @@ No authorization required partnerStats -Get partner stats +Get partner stats. If timestamps are not provided, all-time stats will be returned. ### Example @@ -1056,7 +975,7 @@ 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) # **pnl** -> AccountPnL pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, auth=auth, ignore_transfers=ignore_transfers) +> AccountPnL pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, ignore_transfers=ignore_transfers) pnl @@ -1088,13 +1007,12 @@ async with lighter.ApiClient(configuration) as api_client: start_timestamp = 56 # int | end_timestamp = 56 # int | count_back = 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) + authorization = 'authorization_example' # str | (optional) ignore_transfers = False # bool | (optional) (default to False) try: # pnl - api_response = await api_instance.pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, auth=auth, ignore_transfers=ignore_transfers) + api_response = await api_instance.pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, ignore_transfers=ignore_transfers) print("The response of AccountApi->pnl:\n") pprint(api_response) except Exception as e: @@ -1114,8 +1032,7 @@ Name | Type | Description | Notes **start_timestamp** | **int**| | **end_timestamp** | **int**| | **count_back** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] + **authorization** | **str**| | [optional] **ignore_transfers** | **bool**| | [optional] [default to False] ### Return type @@ -1141,7 +1058,7 @@ 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) # **position_funding** -> PositionFundings position_funding(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor, side=side) +> PositionFundings position_funding(account_index, limit, authorization=authorization, market_id=market_id, cursor=cursor, side=side) positionFunding @@ -1169,15 +1086,14 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.AccountApi(api_client) account_index = 56 # int | limit = 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) - market_id = 255 # int | (optional) (default to 255) + authorization = 'authorization_example' # str | (optional) + market_id = 56 # int | (optional) cursor = 'cursor_example' # str | (optional) side = all # str | (optional) (default to all) try: # positionFunding - api_response = await api_instance.position_funding(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor, side=side) + api_response = await api_instance.position_funding(account_index, limit, authorization=authorization, market_id=market_id, cursor=cursor, side=side) print("The response of AccountApi->position_funding:\n") pprint(api_response) except Exception as e: @@ -1193,9 +1109,8 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | **limit** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **market_id** | **int**| | [optional] [default to 255] + **authorization** | **str**| | [optional] + **market_id** | **int**| | [optional] **cursor** | **str**| | [optional] **side** | **str**| | [optional] [default to all] @@ -1222,11 +1137,11 @@ 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) +> RespPublicPoolsMetadata public_pools_metadata(index, limit, authorization=authorization, filter=filter, account_index=account_index) publicPoolsMetadata -Get public pools metadata +Get public pools metadata. `auth` is required in case you specify an account_index. You will see public pools with an index that starts an n-1 of the one you specify. To see staking pools, use `filter=stake` ### Example @@ -1250,14 +1165,13 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.AccountApi(api_client) index = 56 # int | limit = 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) + authorization = 'authorization_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) + api_response = await api_instance.public_pools_metadata(index, limit, authorization=authorization, filter=filter, account_index=account_index) print("The response of AccountApi->public_pools_metadata:\n") pprint(api_response) except Exception as e: @@ -1273,8 +1187,7 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **index** | **int**| | **limit** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] + **authorization** | **str**| | [optional] **filter** | **str**| | [optional] **account_index** | **int**| | [optional] @@ -1301,11 +1214,11 @@ 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) # **set_maker_only_api_keys** -> RespSetMakerOnlyApiKeys set_maker_only_api_keys(account_index, api_key_indexes, authorization=authorization, auth=auth) +> RespSetMakerOnlyApiKeys set_maker_only_api_keys(authorization, account_index, api_key_indexes) setMakerOnlyApiKeys -Set maker-only API key indexes +Set maker-only API key indexes. This replaces the current list; pass all indexes you want marked as maker-only. Pass [] to clear all maker-only restrictions. ### Example @@ -1327,14 +1240,13 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.AccountApi(api_client) + authorization = 'authorization_example' # str | account_index = 56 # int | - api_key_indexes = 'api_key_indexes_example' # str | JSON array of int16, e.g. \\\"[1,2]\\\" - authorization = 'authorization_example' # str | (optional) - auth = 'auth_example' # str | (optional) + api_key_indexes = 'api_key_indexes_example' # str | JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions. try: # setMakerOnlyApiKeys - api_response = await api_instance.set_maker_only_api_keys(account_index, api_key_indexes, authorization=authorization, auth=auth) + api_response = await api_instance.set_maker_only_api_keys(authorization, account_index, api_key_indexes) print("The response of AccountApi->set_maker_only_api_keys:\n") pprint(api_response) except Exception as e: @@ -1348,10 +1260,9 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | - **api_key_indexes** | **str**| JSON array of int16, e.g. \\\"[1,2]\\\" | - **authorization** | **str**| | [optional] - **auth** | **str**| | [optional] + **api_key_indexes** | **str**| JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions. | ### Return type @@ -1363,7 +1274,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded, multipart/form-data - **Accept**: application/json ### HTTP response details @@ -1380,7 +1291,7 @@ No authorization required tokens -Get api tokens of an account +Get read only auth tokens for an account ### Example @@ -1451,7 +1362,7 @@ No authorization required tokens_create -Create api token +Create an API token for read-only access ### Example @@ -1513,7 +1424,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -1530,7 +1441,7 @@ No authorization required tokens_revoke -Revoke api token +Revoke read only auth token for an account ### Example @@ -1586,7 +1497,86 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **user_referrals** +> UserReferrals user_referrals(l1_address, authorization=authorization, cursor=cursor, auth=auth, stats_start_timestamp=stats_start_timestamp, stats_end_timestamp=stats_end_timestamp) + +userReferrals + +Get user referrals + +### Example + + +```python +import lighter +from lighter.models.user_referrals import UserReferrals +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) + l1_address = 'l1_address_example' # str | + authorization = 'authorization_example' # str | (optional) + cursor = 'cursor_example' # str | (optional) + auth = 'auth_example' # str | (optional) + stats_start_timestamp = 56 # int | (optional) + stats_end_timestamp = 56 # int | (optional) + + try: + # userReferrals + api_response = await api_instance.user_referrals(l1_address, authorization=authorization, cursor=cursor, auth=auth, stats_start_timestamp=stats_start_timestamp, stats_end_timestamp=stats_end_timestamp) + print("The response of AccountApi->user_referrals:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->user_referrals: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **l1_address** | **str**| | + **authorization** | **str**| | [optional] + **cursor** | **str**| | [optional] + **auth** | **str**| | [optional] + **stats_start_timestamp** | **int**| | [optional] + **stats_end_timestamp** | **int**| | [optional] + +### Return type + +[**UserReferrals**](UserReferrals.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined - **Accept**: application/json ### HTTP response details diff --git a/docs/AccountAsset.md b/docs/AccountAsset.md index 45956b9..5ccf383 100644 --- a/docs/AccountAsset.md +++ b/docs/AccountAsset.md @@ -9,6 +9,8 @@ Name | Type | Description | Notes **asset_id** | **int** | | **balance** | **str** | | **locked_balance** | **str** | | +**margin_balance** | **str** | | +**margin_mode** | **str** | | ## Example diff --git a/docs/AccountLimits.md b/docs/AccountLimits.md index 8e536ac..ae80e24 100644 --- a/docs/AccountLimits.md +++ b/docs/AccountLimits.md @@ -8,14 +8,14 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **max_llp_percentage** | **int** | | -**max_llp_amount** | **str** | | **user_tier** | **str** | | **can_create_public_pool** | **bool** | | -**user_tier_name** | **str** | | +**max_llp_amount** | **str** | | **current_maker_fee_tick** | **int** | | **current_taker_fee_tick** | **int** | | -**leased_lit** | **str** | | -**effective_lit_stakes** | **str** | | +**effective_lit_stakes** | **str** | Effective staked LIT shares including active leases. | +**leased_lit** | **str** | Total actively leased LIT. | +**user_tier_name** | **str** | | ## Example diff --git a/docs/AccountMetadata.md b/docs/AccountMetadata.md index b726ad2..b9b3f00 100644 --- a/docs/AccountMetadata.md +++ b/docs/AccountMetadata.md @@ -10,8 +10,8 @@ Name | Type | Description | Notes **description** | **str** | | **can_invite** | **bool** | Remove After FE uses L1 meta endpoint | **referral_points_percentage** | **str** | Remove After FE uses L1 meta endpoint | -**can_rfq** | **bool** | | **created_at** | **int** | | +**can_rfq** | **bool** | | ## Example diff --git a/docs/AccountMetadatas.md b/docs/AccountMetadatas.md index 9d3ab6e..2eaa6c2 100644 --- a/docs/AccountMetadatas.md +++ b/docs/AccountMetadatas.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **account_metadatas** | [**List[AccountMetadata]**](AccountMetadata.md) | | -**next_cursor** | **str** | | [optional] ## Example diff --git a/docs/AccountStats.md b/docs/AccountStats.md index 89f38ed..da1737c 100644 --- a/docs/AccountStats.md +++ b/docs/AccountStats.md @@ -11,9 +11,9 @@ Name | Type | Description | Notes **available_balance** | **str** | | **margin_usage** | **str** | | **buying_power** | **str** | | -**account_trading_mode** | **int** | | **cross_stats** | [**AccountMarginStats**](AccountMarginStats.md) | | **total_stats** | [**AccountMarginStats**](AccountMarginStats.md) | | +**account_trading_mode** | **int** | | ## Example diff --git a/docs/AnnouncementApi.md b/docs/AnnouncementApi.md index 11d1f03..bc66f17 100644 --- a/docs/AnnouncementApi.md +++ b/docs/AnnouncementApi.md @@ -12,7 +12,7 @@ Method | HTTP request | Description announcement -Get announcement +Get announcements ### Example diff --git a/docs/Asset.md b/docs/Asset.md index 1987347..08fef73 100644 --- a/docs/Asset.md +++ b/docs/Asset.md @@ -14,6 +14,13 @@ Name | Type | Description | Notes **margin_mode** | **str** | | **index_price** | **str** | | **l1_address** | **str** | | +**global_supply_cap** | **str** | | +**liquidation_fee** | **str** | | +**liquidation_threshold** | **str** | | +**loan_to_value** | **str** | | +**price_decimals** | **int** | | +**total_supplied** | **str** | | +**user_supply_cap** | **str** | | ## Example diff --git a/docs/BridgeApi.md b/docs/BridgeApi.md index ecad9cc..343f087 100644 --- a/docs/BridgeApi.md +++ b/docs/BridgeApi.md @@ -4,26 +4,27 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**bridges**](BridgeApi.md#bridges) | **GET** /api/v1/bridges | bridges -[**bridges_is_next_bridge_fast**](BridgeApi.md#bridges_is_next_bridge_fast) | **GET** /api/v1/bridges/isNextBridgeFast | bridges_isNextBridgeFast +[**create_intent_address**](BridgeApi.md#create_intent_address) | **POST** /api/v1/createIntentAddress | createIntentAddress +[**deposit_latest**](BridgeApi.md#deposit_latest) | **GET** /api/v1/deposit/latest | deposit_latest +[**deposit_networks**](BridgeApi.md#deposit_networks) | **GET** /api/v1/deposit/networks | deposit_networks [**fastbridge_info**](BridgeApi.md#fastbridge_info) | **GET** /api/v1/fastbridge/info | fastbridge_info [**fastwithdraw**](BridgeApi.md#fastwithdraw) | **POST** /api/v1/fastwithdraw | fastwithdraw [**fastwithdraw_info**](BridgeApi.md#fastwithdraw_info) | **GET** /api/v1/fastwithdraw/info | fastwithdraw_info -# **bridges** -> RespGetBridgesByL1Addr bridges(l1_address) +# **create_intent_address** +> CreateIntentAddressResp create_intent_address(chain_id, from_addr, amount, is_external_deposit=is_external_deposit) -bridges +createIntentAddress -Get bridges for given l1 address +Create a bridge intent address for CCTP bridge ### Example ```python import lighter -from lighter.models.resp_get_bridges_by_l1_addr import RespGetBridgesByL1Addr +from lighter.models.create_intent_address_resp import CreateIntentAddressResp from lighter.rest import ApiException from pprint import pprint @@ -38,15 +39,18 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.BridgeApi(api_client) - l1_address = 'l1_address_example' # str | + chain_id = 'chain_id_example' # str | + from_addr = 'from_addr_example' # str | + amount = 'amount_example' # str | + is_external_deposit = True # bool | (optional) try: - # bridges - api_response = await api_instance.bridges(l1_address) - print("The response of BridgeApi->bridges:\n") + # createIntentAddress + api_response = await api_instance.create_intent_address(chain_id, from_addr, amount, is_external_deposit=is_external_deposit) + print("The response of BridgeApi->create_intent_address:\n") pprint(api_response) except Exception as e: - print("Exception when calling BridgeApi->bridges: %s\n" % e) + print("Exception when calling BridgeApi->create_intent_address: %s\n" % e) ``` @@ -56,11 +60,14 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **l1_address** | **str**| | + **chain_id** | **str**| | + **from_addr** | **str**| | + **amount** | **str**| | + **is_external_deposit** | **bool**| | [optional] ### Return type -[**RespGetBridgesByL1Addr**](RespGetBridgesByL1Addr.md) +[**CreateIntentAddressResp**](CreateIntentAddressResp.md) ### Authorization @@ -68,7 +75,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -80,19 +87,19 @@ 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) -# **bridges_is_next_bridge_fast** -> RespGetIsNextBridgeFast bridges_is_next_bridge_fast(l1_address) +# **deposit_latest** +> Deposit deposit_latest(l1_address) -bridges_isNextBridgeFast +deposit_latest -Get if next bridge is fast +Get most recent deposit for given l1 address ### Example ```python import lighter -from lighter.models.resp_get_is_next_bridge_fast import RespGetIsNextBridgeFast +from lighter.models.deposit import Deposit from lighter.rest import ApiException from pprint import pprint @@ -110,12 +117,12 @@ async with lighter.ApiClient(configuration) as api_client: l1_address = 'l1_address_example' # str | try: - # bridges_isNextBridgeFast - api_response = await api_instance.bridges_is_next_bridge_fast(l1_address) - print("The response of BridgeApi->bridges_is_next_bridge_fast:\n") + # deposit_latest + api_response = await api_instance.deposit_latest(l1_address) + print("The response of BridgeApi->deposit_latest:\n") pprint(api_response) except Exception as e: - print("Exception when calling BridgeApi->bridges_is_next_bridge_fast: %s\n" % e) + print("Exception when calling BridgeApi->deposit_latest: %s\n" % e) ``` @@ -129,7 +136,72 @@ Name | Type | Description | Notes ### Return type -[**RespGetIsNextBridgeFast**](RespGetIsNextBridgeFast.md) +[**Deposit**](Deposit.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) + +# **deposit_networks** +> BridgeSupportedNetworks deposit_networks() + +deposit_networks + +Get networks that support deposits via intent address + +### Example + + +```python +import lighter +from lighter.models.bridge_supported_networks import BridgeSupportedNetworks +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.BridgeApi(api_client) + + try: + # deposit_networks + api_response = await api_instance.deposit_networks() + print("The response of BridgeApi->deposit_networks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BridgeApi->deposit_networks: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**BridgeSupportedNetworks**](BridgeSupportedNetworks.md) ### Authorization @@ -277,7 +349,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -290,7 +362,7 @@ 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) # **fastwithdraw_info** -> RespGetFastwithdrawalInfo fastwithdraw_info(account_index, authorization=authorization, auth=auth) +> RespGetFastwithdrawalInfo fastwithdraw_info(authorization, account_index) fastwithdraw_info @@ -316,13 +388,12 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.BridgeApi(api_client) + authorization = 'authorization_example' # str | account_index = 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: # fastwithdraw_info - api_response = await api_instance.fastwithdraw_info(account_index, authorization=authorization, auth=auth) + api_response = await api_instance.fastwithdraw_info(authorization, account_index) print("The response of BridgeApi->fastwithdraw_info:\n") pprint(api_response) except Exception as e: @@ -336,9 +407,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] ### Return type diff --git a/docs/Candle.md b/docs/Candle.md index 6742064..b704240 100644 --- a/docs/Candle.md +++ b/docs/Candle.md @@ -1,22 +1,23 @@ # Candle +Abbreviated candle format. Zero values are omitted. ## Properties Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**t** | **int** | timestamp | -**o** | **float** | open | -**h** | **float** | high | -**l** | **float** | low | -**c** | **float** | close | -**o** | **float** | open_raw | -**h** | **float** | high_raw | -**l** | **float** | low_raw | -**c** | **float** | close_raw | -**v** | **float** | volume0 | -**v** | **float** | volume1 | -**i** | **int** | last_trade_id | +**t** | **int** | Timestamp | [optional] +**o** | **float** | Open price | [optional] +**h** | **float** | High price | [optional] +**l** | **float** | Low price | [optional] +**c** | **float** | Close price | [optional] +**v** | **float** | Base token volume (volume0) | [optional] +**v** | **float** | Quote token volume (volume1) | [optional] +**i** | **int** | Last trade ID | [optional] +**c** | **float** | close_raw | [optional] +**h** | **float** | high_raw | [optional] +**l** | **float** | low_raw | [optional] +**o** | **float** | open_raw | [optional] ## Example diff --git a/docs/Candles.md b/docs/Candles.md index 3467403..f4d14ae 100644 --- a/docs/Candles.md +++ b/docs/Candles.md @@ -6,9 +6,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **code** | **int** | | +**r** | **str** | Resolution | +**c** | [**List[Candle]**](Candle.md) | Array of candles (max 500 per call) | **message** | **str** | | [optional] -**r** | **str** | resolution | -**c** | [**List[Candle]**](Candle.md) | candles | ## Example diff --git a/docs/CandlestickApi.md b/docs/CandlestickApi.md index 7975c88..a524abc 100644 --- a/docs/CandlestickApi.md +++ b/docs/CandlestickApi.md @@ -13,7 +13,7 @@ Method | HTTP request | Description candles -Get candles (optimized with shortened fields and smaller response size) +Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response. ### Example diff --git a/docs/DepositHistoryItem.md b/docs/DepositHistoryItem.md index c046dfc..0c94c1b 100644 --- a/docs/DepositHistoryItem.md +++ b/docs/DepositHistoryItem.md @@ -6,11 +6,11 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | -**asset_id** | **int** | | **amount** | **str** | | **timestamp** | **int** | | **status** | **str** | | **l1_tx_hash** | **str** | | +**asset_id** | **int** | | ## Example diff --git a/docs/DetailedAccount.md b/docs/DetailedAccount.md index d3abdbb..eb3861d 100644 --- a/docs/DetailedAccount.md +++ b/docs/DetailedAccount.md @@ -8,6 +8,7 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **account_type** | **int** | | +**account_trading_mode** | **int** | Classic=0 and Unified=1 | **index** | **int** | | **l1_address** | **str** | | **cancel_all_time** | **int** | | @@ -17,23 +18,24 @@ Name | Type | Description | Notes **available_balance** | **str** | | **status** | **int** | | **collateral** | **str** | | -**transaction_time** | **int** | | -**account_trading_mode** | **int** | | **account_index** | **int** | | **name** | **str** | | **description** | **str** | | **can_invite** | **bool** | Remove After FE uses L1 meta endpoint | **referral_points_percentage** | **str** | Remove After FE uses L1 meta endpoint | -**can_rfq** | **bool** | | -**created_at** | **int** | | **positions** | [**List[AccountPosition]**](AccountPosition.md) | | **assets** | [**List[AccountAsset]**](AccountAsset.md) | | **total_asset_value** | **str** | | **cross_asset_value** | **str** | | **pool_info** | [**PublicPoolInfo**](PublicPoolInfo.md) | | **shares** | [**List[PublicPoolShare]**](PublicPoolShare.md) | | +**created_at** | **int** | | +**transaction_time** | **int** | | **pending_unlocks** | [**List[PendingUnlock]**](PendingUnlock.md) | | -**approved_integrators** | [**List[ApprovedIntegrator]**](ApprovedIntegrator.md) | | +**approved_integrators** | [**List[ApprovedIntegrator]**](ApprovedIntegrator.md) | | [optional] +**can_rfq** | **bool** | | +**cross_initial_margin_requirement** | **str** | | [optional] +**cross_maintenance_margin_requirement** | **str** | | [optional] ## Example diff --git a/docs/DetailedCandlestick.md b/docs/DetailedCandlestick.md index f00f2e1..25808e9 100644 --- a/docs/DetailedCandlestick.md +++ b/docs/DetailedCandlestick.md @@ -10,14 +10,14 @@ Name | Type | Description | Notes **high** | **float** | | **low** | **float** | | **close** | **float** | | -**open_raw** | **float** | | -**high_raw** | **float** | | -**low_raw** | **float** | | -**close_raw** | **float** | | **volume0** | **float** | | **volume1** | **float** | | **last_trade_id** | **int** | | **trade_count** | **int** | | +**close_raw** | **str** | | [optional] +**high_raw** | **str** | | [optional] +**low_raw** | **str** | | [optional] +**open_raw** | **str** | | [optional] ## Example diff --git a/docs/ExecuteStat.md b/docs/ExecuteStat.md index 7351713..5a8aab9 100644 --- a/docs/ExecuteStat.md +++ b/docs/ExecuteStat.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**timestamp** | **int** | | -**slippage** | [**List[SlippageResult]**](SlippageResult.md) | | +**timestamp** | **int** | | [optional] +**slippage** | [**List[SlippageResult]**](SlippageResult.md) | | [optional] ## Example diff --git a/docs/InfoApi.md b/docs/InfoApi.md index dd63e2d..2d7f3ed 100644 --- a/docs/InfoApi.md +++ b/docs/InfoApi.md @@ -4,17 +4,83 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**layer1_basic_info**](InfoApi.md#layer1_basic_info) | **GET** /api/v1/layer1BasicInfo | layer1BasicInfo [**system_config**](InfoApi.md#system_config) | **GET** /api/v1/systemConfig | systemConfig [**transfer_fee_info**](InfoApi.md#transfer_fee_info) | **GET** /api/v1/transferFeeInfo | transferFeeInfo [**withdrawal_delay**](InfoApi.md#withdrawal_delay) | **GET** /api/v1/withdrawalDelay | withdrawalDelay +# **layer1_basic_info** +> Layer1BasicInfo layer1_basic_info() + +layer1BasicInfo + +Get zklighter l1 general info, including contract address and rpc info + +### Example + + +```python +import lighter +from lighter.models.layer1_basic_info import Layer1BasicInfo +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.InfoApi(api_client) + + try: + # layer1BasicInfo + api_response = await api_instance.layer1_basic_info() + print("The response of InfoApi->layer1_basic_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->layer1_basic_info: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Layer1BasicInfo**](Layer1BasicInfo.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) + # **system_config** > SystemConfig system_config() systemConfig -Get system configuration including pool indexes and lockup/cooldown periods +Get system config ### Example @@ -75,7 +141,7 @@ 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) # **transfer_fee_info** -> TransferFeeInfo transfer_fee_info(account_index, authorization=authorization, auth=auth, to_account_index=to_account_index) +> TransferFeeInfo transfer_fee_info(authorization, account_index, to_account_index=to_account_index) transferFeeInfo @@ -101,14 +167,13 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.InfoApi(api_client) + authorization = 'authorization_example' # str | account_index = 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) - to_account_index = -1 # int | (optional) (default to -1) + to_account_index = 56 # int | (optional) try: # transferFeeInfo - api_response = await api_instance.transfer_fee_info(account_index, authorization=authorization, auth=auth, to_account_index=to_account_index) + api_response = await api_instance.transfer_fee_info(authorization, account_index, to_account_index=to_account_index) print("The response of InfoApi->transfer_fee_info:\n") pprint(api_response) except Exception as e: @@ -122,10 +187,9 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **to_account_index** | **int**| | [optional] [default to -1] + **to_account_index** | **int**| | [optional] ### Return type diff --git a/docs/LeaseEntry.md b/docs/LeaseEntry.md index 5c85cec..e051eb0 100644 --- a/docs/LeaseEntry.md +++ b/docs/LeaseEntry.md @@ -5,14 +5,14 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**id** | **int** | | -**master_account_index** | **int** | | -**lease_amount** | **int** | | -**fee_amount** | **int** | | -**start** | **int** | | -**end** | **int** | | -**status** | **str** | | -**error** | **str** | | +**id** | **int** | Lease ID | +**master_account_index** | **int** | Master account index | +**lease_amount** | **int** | Leased LIT amount in raw units (1 LIT = 1e8) | +**fee_amount** | **int** | Fee paid in raw units | +**start** | **int** | Lease start time (Unix milliseconds) | +**end** | **int** | Lease end time (Unix milliseconds) | +**status** | **str** | Lease status | +**error** | **str** | Error message if lease was canceled | ## Example diff --git a/docs/LeaseOptionEntry.md b/docs/LeaseOptionEntry.md index 15af9a2..60894a2 100644 --- a/docs/LeaseOptionEntry.md +++ b/docs/LeaseOptionEntry.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**duration_days** | **int** | | -**annual_rate** | **float** | | +**duration_days** | **int** | Lease duration in days | [optional] +**annual_rate** | **float** | Annual rate as a percentage (e.g. 25.0 means 25%) | [optional] ## Example diff --git a/docs/MarketConfig.md b/docs/MarketConfig.md index 8417308..20c173f 100644 --- a/docs/MarketConfig.md +++ b/docs/MarketConfig.md @@ -9,8 +9,8 @@ Name | Type | Description | Notes **insurance_fund_account_index** | **int** | | **liquidation_mode** | **int** | | **force_reduce_only** | **bool** | | +**funding_fee_discounts_enabled** | **bool** | | [optional] **trading_hours** | **str** | | -**funding_fee_discounts_enabled** | **bool** | | **hidden** | **bool** | | ## Example diff --git a/docs/NotificationApi.md b/docs/NotificationApi.md index 4bdc22d..38d2daa 100644 --- a/docs/NotificationApi.md +++ b/docs/NotificationApi.md @@ -70,7 +70,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details diff --git a/docs/Order.md b/docs/Order.md index 72c269c..f05cb19 100644 --- a/docs/Order.md +++ b/docs/Order.md @@ -34,14 +34,14 @@ Name | Type | Description | Notes **to_trigger_order_id_0** | **str** | | **to_trigger_order_id_1** | **str** | | **to_cancel_order_id_0** | **str** | | -**integrator_fee_collector_index** | **str** | | -**integrator_taker_fee** | **str** | | -**integrator_maker_fee** | **str** | | **block_height** | **int** | | **timestamp** | **int** | | **created_at** | **int** | | **updated_at** | **int** | | **transaction_time** | **int** | | +**integrator_fee_collector_index** | **str** | | +**integrator_maker_fee** | **str** | | +**integrator_taker_fee** | **str** | | ## Example diff --git a/docs/OrderApi.md b/docs/OrderApi.md index 77fe83b..f785099 100644 --- a/docs/OrderApi.md +++ b/docs/OrderApi.md @@ -19,7 +19,7 @@ Method | HTTP request | Description # **account_active_orders** -> Orders account_active_orders(account_index, market_id, authorization=authorization, auth=auth) +> Orders account_active_orders(authorization, account_index, market_id=market_id, market_type=market_type) accountActiveOrders @@ -45,14 +45,14 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) + authorization = 'authorization_example' # str | 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) + market_id = 56 # int | If not specified, returns active orders for all markets. (optional) + market_type = 'market_type_example' # str | (optional) try: # accountActiveOrders - api_response = await api_instance.account_active_orders(account_index, market_id, authorization=authorization, auth=auth) + api_response = await api_instance.account_active_orders(authorization, account_index, market_id=market_id, market_type=market_type) print("The response of OrderApi->account_active_orders:\n") pprint(api_response) except Exception as e: @@ -66,10 +66,10 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **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] + **market_id** | **int**| If not specified, returns active orders for all markets. | [optional] + **market_type** | **str**| | [optional] ### Return type @@ -94,11 +94,11 @@ 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) # **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) +> Orders account_inactive_orders(authorization, account_index, limit, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor, market_type=market_type) accountInactiveOrders -Get account inactive orders +Get account inactive orders. `auth` can be generated using the SDK. ### Example @@ -120,18 +120,18 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) + authorization = 'authorization_example' # str | account_index = 56 # int | limit = 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) - market_id = 255 # int | (optional) (default to 255) - ask_filter = -1 # int | (optional) (default to -1) + market_id = 56 # int | (optional) + ask_filter = 56 # int | (optional) between_timestamps = 'between_timestamps_example' # str | (optional) cursor = 'cursor_example' # str | (optional) + market_type = 'market_type_example' # str | (optional) try: # accountInactiveOrders - api_response = await api_instance.account_inactive_orders(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) + api_response = await api_instance.account_inactive_orders(authorization, account_index, limit, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor, market_type=market_type) print("The response of OrderApi->account_inactive_orders:\n") pprint(api_response) except Exception as e: @@ -145,14 +145,14 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | **limit** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **market_id** | **int**| | [optional] [default to 255] - **ask_filter** | **int**| | [optional] [default to -1] + **market_id** | **int**| | [optional] + **ask_filter** | **int**| | [optional] **between_timestamps** | **str**| | [optional] **cursor** | **str**| | [optional] + **market_type** | **str**| | [optional] ### Return type @@ -181,7 +181,7 @@ No authorization required assetDetails -Get asset details +Get asset details for a specific asset or all assets ### Example @@ -203,7 +203,7 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) - asset_id = 0 # int | (optional) (default to 0) + asset_id = 56 # int | (optional) try: # assetDetails @@ -221,7 +221,7 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **asset_id** | **int**| | [optional] [default to 0] + **asset_id** | **int**| | [optional] ### Return type @@ -250,7 +250,7 @@ No authorization required exchangeMetrics -Get exchange metrics +Get exchange metrics. When filtering by market, use the market symbol as a value. ### Example @@ -455,11 +455,11 @@ 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) # **export** -> ExportData export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, end_timestamp=end_timestamp, side=side, role=role, trade_type=trade_type) +> ExportData export(authorization, type, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, end_timestamp=end_timestamp, side=side, role=role, trade_type=trade_type) export -Export data +Export trades and funding payments, limited to 12 months or 1M trades. END_TS_IN_MS - START_TS_IN_MS should not be larger than 12 months in milliseconds, both timestamps should be greater than or equal to 17 January 2025 00:00:00 UTC (lighter's mainnet genesis) ### Example @@ -481,11 +481,10 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) + authorization = 'authorization_example' # str | type = 'type_example' # str | - authorization = 'authorization_example' # str | make required after integ is done (optional) - auth = 'auth_example' # str | made optional to support header auth clients (optional) - account_index = -1 # int | (optional) (default to -1) - market_id = 255 # int | (optional) (default to 255) + account_index = 56 # int | (optional) + market_id = 56 # int | (optional) start_timestamp = 56 # int | (optional) end_timestamp = 56 # int | (optional) side = all # str | (optional) (default to all) @@ -494,7 +493,7 @@ async with lighter.ApiClient(configuration) as api_client: try: # export - api_response = await api_instance.export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, end_timestamp=end_timestamp, side=side, role=role, trade_type=trade_type) + api_response = await api_instance.export(authorization, type, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, end_timestamp=end_timestamp, side=side, role=role, trade_type=trade_type) print("The response of OrderApi->export:\n") pprint(api_response) except Exception as e: @@ -508,11 +507,10 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **type** | **str**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **account_index** | **int**| | [optional] [default to -1] - **market_id** | **int**| | [optional] [default to 255] + **account_index** | **int**| | [optional] + **market_id** | **int**| | [optional] **start_timestamp** | **int**| | [optional] **end_timestamp** | **int**| | [optional] **side** | **str**| | [optional] [default to all] @@ -568,8 +566,8 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) - market_id = 255 # int | (optional) (default to 255) - filter = all # str | (optional) (default to all) + market_id = 56 # int | (optional) + filter = all # str | Filter order books by type (optional) (default to all) try: # orderBookDetails @@ -587,8 +585,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **market_id** | **int**| | [optional] [default to 255] - **filter** | **str**| | [optional] [default to all] + **market_id** | **int**| | [optional] + **filter** | **str**| Filter order books by type | [optional] [default to all] ### Return type @@ -710,7 +708,7 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.OrderApi(api_client) - market_id = 255 # int | (optional) (default to 255) + market_id = 56 # int | (optional) filter = all # str | (optional) (default to all) try: @@ -729,7 +727,7 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **market_id** | **int**| | [optional] [default to 255] + **market_id** | **int**| | [optional] **filter** | **str**| | [optional] [default to all] ### Return type @@ -826,11 +824,11 @@ 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) # **trades** -> Trades trades(sort_by, limit, authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate) +> Trades trades(sort_by, limit, authorization=authorization, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate) trades -Get trades +Get trades for lighter accounts, including sub-accounts and public pools. `auth` is required for master accounts and sub accounts. ### Example @@ -854,22 +852,21 @@ async with lighter.ApiClient(configuration) as api_client: api_instance = lighter.OrderApi(api_client) sort_by = 'sort_by_example' # str | limit = 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) - market_id = 255 # int | (optional) (default to 255) - account_index = -1 # int | (optional) (default to -1) + authorization = 'authorization_example' # str | (optional) + market_id = 56 # int | (optional) + account_index = 56 # int | (optional) order_index = 56 # int | (optional) sort_dir = desc # str | (optional) (default to desc) cursor = 'cursor_example' # str | (optional) - var_from = -1 # int | (optional) (default to -1) - ask_filter = -1 # int | (optional) (default to -1) + var_from = 56 # int | (optional) + ask_filter = 56 # int | (optional) role = all # str | (optional) (default to all) type = all # str | (optional) (default to all) aggregate = False # bool | (optional) (default to False) try: # trades - api_response = await api_instance.trades(sort_by, limit, authorization=authorization, auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate) + api_response = await api_instance.trades(sort_by, limit, authorization=authorization, market_id=market_id, account_index=account_index, order_index=order_index, sort_dir=sort_dir, cursor=cursor, var_from=var_from, ask_filter=ask_filter, role=role, type=type, aggregate=aggregate) print("The response of OrderApi->trades:\n") pprint(api_response) except Exception as e: @@ -885,15 +882,14 @@ Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **sort_by** | **str**| | **limit** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] - **market_id** | **int**| | [optional] [default to 255] - **account_index** | **int**| | [optional] [default to -1] + **authorization** | **str**| | [optional] + **market_id** | **int**| | [optional] + **account_index** | **int**| | [optional] **order_index** | **int**| | [optional] **sort_dir** | **str**| | [optional] [default to desc] **cursor** | **str**| | [optional] - **var_from** | **int**| | [optional] [default to -1] - **ask_filter** | **int**| | [optional] [default to -1] + **var_from** | **int**| | [optional] + **ask_filter** | **int**| | [optional] **role** | **str**| | [optional] [default to all] **type** | **str**| | [optional] [default to all] **aggregate** | **bool**| | [optional] [default to False] diff --git a/docs/OrderBook.md b/docs/OrderBook.md index 18d7edb..e245096 100644 --- a/docs/OrderBook.md +++ b/docs/OrderBook.md @@ -16,10 +16,12 @@ Name | Type | Description | Notes **liquidation_fee** | **str** | | **min_base_amount** | **str** | | **min_quote_amount** | **str** | | -**order_quote_limit** | **str** | | **supported_size_decimals** | **int** | | **supported_price_decimals** | **int** | | **supported_quote_decimals** | **int** | | +**order_quote_limit** | **str** | | +**is_maker_fee_enabled** | **bool** | | [optional] +**is_taker_fee_enabled** | **bool** | | [optional] ## Example diff --git a/docs/PerpsMarketStats.md b/docs/PerpsMarketStats.md index bd2ed7b..fa2df2d 100644 --- a/docs/PerpsMarketStats.md +++ b/docs/PerpsMarketStats.md @@ -5,14 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**symbol** | **str** | | **market_id** | **int** | | **index_price** | **str** | | **mark_price** | **str** | | **open_interest** | **str** | | -**open_interest_limit** | **str** | | -**funding_clamp_small** | **str** | | -**funding_clamp_big** | **str** | | **last_trade_price** | **str** | | **current_funding_rate** | **str** | | **funding_rate** | **str** | | @@ -22,6 +18,10 @@ Name | Type | Description | Notes **daily_price_low** | **float** | | **daily_price_high** | **float** | | **daily_price_change** | **float** | | +**symbol** | **str** | | +**funding_clamp_small** | **str** | | +**funding_clamp_big** | **str** | | +**open_interest_limit** | **str** | | ## Example diff --git a/docs/PerpsOrderBookDetail.md b/docs/PerpsOrderBookDetail.md index ba0ed8d..a3ce1ec 100644 --- a/docs/PerpsOrderBookDetail.md +++ b/docs/PerpsOrderBookDetail.md @@ -16,10 +16,10 @@ Name | Type | Description | Notes **liquidation_fee** | **str** | | **min_base_amount** | **str** | | **min_quote_amount** | **str** | | -**order_quote_limit** | **str** | | **supported_size_decimals** | **int** | | **supported_price_decimals** | **int** | | **supported_quote_decimals** | **int** | | +**order_quote_limit** | **str** | | [optional] **size_decimals** | **int** | | **price_decimals** | **int** | | **quote_multiplier** | **int** | | @@ -36,8 +36,10 @@ Name | Type | Description | Notes **daily_price_change** | **float** | | **open_interest** | **float** | | **daily_chart** | **Dict[str, float]** | | -**market_config** | [**MarketConfig**](MarketConfig.md) | | -**strategy_index** | **int** | | +**market_config** | [**MarketConfig**](MarketConfig.md) | | [optional] +**strategy_index** | **int** | | [optional] +**is_maker_fee_enabled** | **bool** | | [optional] +**is_taker_fee_enabled** | **bool** | | [optional] ## Example diff --git a/docs/PnLEntry.md b/docs/PnLEntry.md index 3c9019d..246ee57 100644 --- a/docs/PnLEntry.md +++ b/docs/PnLEntry.md @@ -7,19 +7,20 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **timestamp** | **int** | | **trade_pnl** | **float** | | -**trade_spot_pnl** | **float** | | **inflow** | **float** | | **outflow** | **float** | | -**spot_outflow** | **float** | | -**spot_inflow** | **float** | | **pool_pnl** | **float** | | **pool_inflow** | **float** | | **pool_outflow** | **float** | | -**staking_pnl** | **float** | | -**staking_inflow** | **float** | | -**staking_outflow** | **float** | | **pool_total_shares** | **float** | | +**spot_inflow** | **float** | | +**spot_outflow** | **float** | | **staked_lit** | **float** | | +**staking_inflow** | **float** | | +**staking_outflow** | **float** | | +**staking_pnl** | **float** | | +**trade_spot_pnl** | **float** | | +**volume** | **float** | | ## Example diff --git a/docs/PositionFunding.md b/docs/PositionFunding.md index 1a2f584..7079869 100644 --- a/docs/PositionFunding.md +++ b/docs/PositionFunding.md @@ -9,10 +9,10 @@ Name | Type | Description | Notes **market_id** | **int** | | **funding_id** | **int** | | **change** | **str** | | +**discount** | **str** | | **rate** | **str** | | **position_size** | **str** | | **position_side** | **str** | | -**discount** | **str** | | ## Example diff --git a/docs/PublicPoolInfo.md b/docs/PublicPoolInfo.md index 5ab4114..15e2b39 100644 --- a/docs/PublicPoolInfo.md +++ b/docs/PublicPoolInfo.md @@ -11,9 +11,9 @@ Name | Type | Description | Notes **total_shares** | **int** | | **operator_shares** | **int** | | **annual_percentage_yield** | **float** | | -**sharpe_ratio** | **float** | | **daily_returns** | [**List[DailyReturn]**](DailyReturn.md) | | **share_prices** | [**List[SharePrice]**](SharePrice.md) | | +**sharpe_ratio** | **float** | | **strategies** | [**List[Strategy]**](Strategy.md) | | ## Example diff --git a/docs/PublicPoolMetadata.md b/docs/PublicPoolMetadata.md index e5c0f61..8cf999d 100644 --- a/docs/PublicPoolMetadata.md +++ b/docs/PublicPoolMetadata.md @@ -8,21 +8,21 @@ Name | Type | Description | Notes **code** | **int** | | **message** | **str** | | [optional] **account_index** | **int** | | -**created_at** | **int** | | -**master_account_index** | **int** | | **account_type** | **int** | | **name** | **str** | | **l1_address** | **str** | | **annual_percentage_yield** | **float** | | -**sharpe_ratio** | **float** | | **status** | **int** | | **operator_fee** | **str** | | **total_asset_value** | **str** | | -**total_spot_value** | **str** | | -**total_perps_value** | **str** | | **total_shares** | **int** | | **account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | [optional] **assets** | [**List[AccountAsset]**](AccountAsset.md) | | +**created_at** | **int** | | +**master_account_index** | **int** | | +**sharpe_ratio** | **float** | | +**total_perps_value** | **str** | | +**total_spot_value** | **str** | | ## Example diff --git a/docs/PublicPoolShare.md b/docs/PublicPoolShare.md index 15d62d5..73b9a53 100644 --- a/docs/PublicPoolShare.md +++ b/docs/PublicPoolShare.md @@ -7,9 +7,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **public_pool_index** | **int** | | **shares_amount** | **int** | | -**entry_usdc** | **str** | For public pools and insurance fund | -**principal_amount** | **str** | | +**entry_usdc** | **str** | | **entry_timestamp** | **int** | | +**principal_amount** | **str** | | ## Example diff --git a/docs/Referral.md b/docs/Referral.md index 35fa907..0f8b27b 100644 --- a/docs/Referral.md +++ b/docs/Referral.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **referral_code** | **str** | | **used_at** | **int** | | **trade_stats** | [**TradeStats**](TradeStats.md) | | +**tier** | **str** | | ## Example diff --git a/docs/ReferralApi.md b/docs/ReferralApi.md index 7195a2f..6347934 100644 --- a/docs/ReferralApi.md +++ b/docs/ReferralApi.md @@ -4,22 +4,394 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- -[**referral_user_referrals**](ReferralApi.md#referral_user_referrals) | **GET** /api/v1/referral/userReferrals | referral_userReferrals +[**referral_create**](ReferralApi.md#referral_create) | **POST** /api/v1/referral/create | referral_create +[**referral_get**](ReferralApi.md#referral_get) | **GET** /api/v1/referral/get | referral_get +[**referral_kickback_update**](ReferralApi.md#referral_kickback_update) | **POST** /api/v1/referral/kickback/update | referral_kickback_update +[**referral_points**](ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points +[**referral_update**](ReferralApi.md#referral_update) | **POST** /api/v1/referral/update | referral_update +[**referral_use**](ReferralApi.md#referral_use) | **POST** /api/v1/referral/use | referral_use -# **referral_user_referrals** -> UserReferrals referral_user_referrals(l1_address, authorization=authorization, auth=auth, cursor=cursor) +# **referral_create** +> ReferralCode referral_create(account_index, authorization=authorization, auth=auth) -referral_userReferrals +referral_create -Get user referrals +Create referral code ### Example ```python import lighter -from lighter.models.user_referrals import UserReferrals +from lighter.models.referral_code import ReferralCode +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) + account_index = 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: + # referral_create + api_response = await api_instance.referral_create(account_index, authorization=authorization, auth=auth) + print("The response of ReferralApi->referral_create:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_create: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**ReferralCode**](ReferralCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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_get** +> ReferralCode referral_get(account_index, authorization=authorization, auth=auth) + +referral_get + +Get referral code + +### Example + + +```python +import lighter +from lighter.models.referral_code import ReferralCode +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) + account_index = 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: + # referral_get + api_response = await api_instance.referral_get(account_index, authorization=authorization, auth=auth) + print("The response of ReferralApi->referral_get:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_get: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**ReferralCode**](ReferralCode.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_kickback_update** +> RespUpdateKickback referral_kickback_update(account_index, kickback_percentage, authorization=authorization, auth=auth) + +referral_kickback_update + +Update kickback percentage for referral rewards (allowed once per day) + +### Example + + +```python +import lighter +from lighter.models.resp_update_kickback import RespUpdateKickback +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) + account_index = 56 # int | + kickback_percentage = 3.4 # float | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # referral_kickback_update + api_response = await api_instance.referral_kickback_update(account_index, kickback_percentage, authorization=authorization, auth=auth) + print("The response of ReferralApi->referral_kickback_update:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_kickback_update: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **kickback_percentage** | **float**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**RespUpdateKickback**](RespUpdateKickback.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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(authorization, account_index) + +referral_points + +Get referral points + +### Example + + +```python +import lighter +from lighter.models.referral_points import ReferralPoints +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) + authorization = 'authorization_example' # str | + account_index = 56 # int | + + try: + # referral_points + api_response = await api_instance.referral_points(authorization, account_index) + print("The response of ReferralApi->referral_points:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_points: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | + **account_index** | **int**| | + +### Return type + +[**ReferralPoints**](ReferralPoints.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_update** +> RespUpdateReferralCode referral_update(account_index, new_referral_code, authorization=authorization, auth=auth) + +referral_update + +Update referral code (allowed once per account) + +### Example + + +```python +import lighter +from lighter.models.resp_update_referral_code import RespUpdateReferralCode +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) + account_index = 56 # int | + new_referral_code = 'new_referral_code_example' # str | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # referral_update + api_response = await api_instance.referral_update(account_index, new_referral_code, authorization=authorization, auth=auth) + print("The response of ReferralApi->referral_update:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling ReferralApi->referral_update: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **new_referral_code** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**RespUpdateReferralCode**](RespUpdateReferralCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/x-www-form-urlencoded + - **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_use** +> ResultCode referral_use(l1_address, referral_code, x, authorization=authorization, auth=auth, discord=discord, telegram=telegram, signature=signature) + +referral_use + +Use referral code + +### Example + + +```python +import lighter +from lighter.models.result_code import ResultCode from lighter.rest import ApiException from pprint import pprint @@ -35,17 +407,21 @@ 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 | - authorization = 'authorization_example' # str | (optional) - auth = 'auth_example' # str | (optional) - cursor = 'cursor_example' # str | (optional) + referral_code = 'referral_code_example' # str | + x = 'x_example' # str | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + discord = 'discord_example' # str | (optional) + telegram = 'telegram_example' # str | (optional) + signature = 'signature_example' # str | (optional) try: - # referral_userReferrals - api_response = await api_instance.referral_user_referrals(l1_address, authorization=authorization, auth=auth, cursor=cursor) - print("The response of ReferralApi->referral_user_referrals:\n") + # referral_use + api_response = await api_instance.referral_use(l1_address, referral_code, x, authorization=authorization, auth=auth, discord=discord, telegram=telegram, signature=signature) + print("The response of ReferralApi->referral_use:\n") pprint(api_response) except Exception as e: - print("Exception when calling ReferralApi->referral_user_referrals: %s\n" % e) + print("Exception when calling ReferralApi->referral_use: %s\n" % e) ``` @@ -56,13 +432,17 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **l1_address** | **str**| | - **authorization** | **str**| | [optional] - **auth** | **str**| | [optional] - **cursor** | **str**| | [optional] + **referral_code** | **str**| | + **x** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + **discord** | **str**| | [optional] + **telegram** | **str**| | [optional] + **signature** | **str**| | [optional] ### Return type -[**UserReferrals**](UserReferrals.md) +[**ResultCode**](ResultCode.md) ### Authorization @@ -70,7 +450,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: Not defined + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details diff --git a/docs/ReqExportData.md b/docs/ReqExportData.md index 8ecd9d4..ec42371 100644 --- a/docs/ReqExportData.md +++ b/docs/ReqExportData.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] -**account_index** | **int** | | [optional] [default to -1] +**auth** | **str** | | [optional] +**account_index** | **int** | | [optional] **market_id** | **int** | | [optional] **type** | **str** | | **start_timestamp** | **int** | | [optional] diff --git a/docs/ReqGetAccount.md b/docs/ReqGetAccount.md index 492d423..e8aeced 100644 --- a/docs/ReqGetAccount.md +++ b/docs/ReqGetAccount.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **by** | **str** | | **value** | **str** | | **active_only** | **bool** | | [optional] [default to False] -**cursor** | **str** | | [optional] ## Example diff --git a/docs/ReqGetAccountActiveOrders.md b/docs/ReqGetAccountActiveOrders.md index 9900779..6ad1af9 100644 --- a/docs/ReqGetAccountActiveOrders.md +++ b/docs/ReqGetAccountActiveOrders.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | -**market_id** | **int** | | +**market_id** | **int** | | [optional] +**auth** | **str** | made optional to support header auth clients | [optional] ## Example diff --git a/docs/ReqGetAccountByL1Address.md b/docs/ReqGetAccountByL1Address.md index cd76093..66e85b8 100644 --- a/docs/ReqGetAccountByL1Address.md +++ b/docs/ReqGetAccountByL1Address.md @@ -6,7 +6,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **l1_address** | **str** | | -**cursor** | **str** | | [optional] ## Example diff --git a/docs/ReqGetAccountMetadata.md b/docs/ReqGetAccountMetadata.md index 8bad7c0..1674b09 100644 --- a/docs/ReqGetAccountMetadata.md +++ b/docs/ReqGetAccountMetadata.md @@ -8,7 +8,6 @@ Name | Type | Description | Notes **by** | **str** | | **value** | **str** | | **auth** | **str** | | [optional] -**cursor** | **str** | | [optional] ## Example diff --git a/docs/ReqGetAccountPnL.md b/docs/ReqGetAccountPnL.md index 77233f8..4f5f48d 100644 --- a/docs/ReqGetAccountPnL.md +++ b/docs/ReqGetAccountPnL.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] +**auth** | **str** | | [optional] **by** | **str** | | **value** | **str** | | **resolution** | **str** | | diff --git a/docs/ReqGetAccountTxs.md b/docs/ReqGetAccountTxs.md index 0072602..dbf8ffb 100644 --- a/docs/ReqGetAccountTxs.md +++ b/docs/ReqGetAccountTxs.md @@ -9,8 +9,8 @@ Name | Type | Description | Notes **limit** | **int** | | [optional] **by** | **str** | | [optional] **value** | **str** | | [optional] -**auth** | **str** | made optional to support header auth clients | [optional] **types** | **List[int]** | | [optional] +**auth** | **str** | | [optional] ## Example diff --git a/docs/ReqGetDepositHistory.md b/docs/ReqGetDepositHistory.md index 37fccdc..d0f0cc1 100644 --- a/docs/ReqGetDepositHistory.md +++ b/docs/ReqGetDepositHistory.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] **l1_address** | **str** | | **cursor** | **str** | | [optional] **filter** | **str** | | [optional] diff --git a/docs/ReqGetFastWithdrawInfo.md b/docs/ReqGetFastWithdrawInfo.md index ce0a224..99a79ec 100644 --- a/docs/ReqGetFastWithdrawInfo.md +++ b/docs/ReqGetFastWithdrawInfo.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] ## Example diff --git a/docs/ReqGetMakerOnlyApiKeys.md b/docs/ReqGetMakerOnlyApiKeys.md index fd7de11..716da16 100644 --- a/docs/ReqGetMakerOnlyApiKeys.md +++ b/docs/ReqGetMakerOnlyApiKeys.md @@ -5,7 +5,6 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | | [optional] **account_index** | **int** | | ## Example diff --git a/docs/ReqGetPositionFunding.md b/docs/ReqGetPositionFunding.md index af72ef1..83399b2 100644 --- a/docs/ReqGetPositionFunding.md +++ b/docs/ReqGetPositionFunding.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] +**auth** | **str** | | [optional] **account_index** | **int** | | **market_id** | **int** | | [optional] **cursor** | **str** | | [optional] diff --git a/docs/ReqGetPublicPoolsMetadata.md b/docs/ReqGetPublicPoolsMetadata.md index b1cc952..e62dbf5 100644 --- a/docs/ReqGetPublicPoolsMetadata.md +++ b/docs/ReqGetPublicPoolsMetadata.md @@ -5,7 +5,7 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] +**auth** | **str** | | [optional] **filter** | **str** | | [optional] **index** | **int** | | **limit** | **int** | | diff --git a/docs/ReqGetTrades.md b/docs/ReqGetTrades.md index 6ec8aad..5f64335 100644 --- a/docs/ReqGetTrades.md +++ b/docs/ReqGetTrades.md @@ -5,18 +5,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] +**auth** | **str** | | [optional] **market_id** | **int** | | [optional] -**account_index** | **int** | | [optional] [default to -1] +**account_index** | **int** | | [optional] **order_index** | **int** | | [optional] **sort_by** | **str** | | **sort_dir** | **str** | | [optional] [default to 'desc'] **cursor** | **str** | | [optional] -**var_from** | **int** | | [optional] [default to -1] +**var_from** | **int** | | [optional] **ask_filter** | **int** | | [optional] +**limit** | **int** | | **role** | **str** | | [optional] [default to 'all'] **type** | **str** | | [optional] [default to 'all'] -**limit** | **int** | | **aggregate** | **bool** | | [optional] [default to False] ## Example diff --git a/docs/ReqGetTransferFeeInfo.md b/docs/ReqGetTransferFeeInfo.md index 4715488..50be527 100644 --- a/docs/ReqGetTransferFeeInfo.md +++ b/docs/ReqGetTransferFeeInfo.md @@ -5,9 +5,9 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] +**auth** | **str** | | [optional] **account_index** | **int** | | -**to_account_index** | **int** | | [optional] [default to -1] +**to_account_index** | **int** | | [optional] ## Example diff --git a/docs/ReqGetTransferHistory.md b/docs/ReqGetTransferHistory.md index 181e5c9..429a004 100644 --- a/docs/ReqGetTransferHistory.md +++ b/docs/ReqGetTransferHistory.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] **cursor** | **str** | | [optional] **type** | **List[str]** | | [optional] diff --git a/docs/ReqGetWithdrawHistory.md b/docs/ReqGetWithdrawHistory.md index 65c6485..a8297ba 100644 --- a/docs/ReqGetWithdrawHistory.md +++ b/docs/ReqGetWithdrawHistory.md @@ -5,8 +5,8 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**auth** | **str** | made optional to support header auth clients | [optional] **account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] **cursor** | **str** | | [optional] **filter** | **str** | | [optional] diff --git a/docs/RespGetLeaseOptions.md b/docs/RespGetLeaseOptions.md index 8a85584..9e4b57a 100644 --- a/docs/RespGetLeaseOptions.md +++ b/docs/RespGetLeaseOptions.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | +**code** | **int** | | [optional] **message** | **str** | | [optional] -**options** | [**List[LeaseOptionEntry]**](LeaseOptionEntry.md) | | -**lit_incentives_account_index** | **int** | | +**options** | [**List[LeaseOptionEntry]**](LeaseOptionEntry.md) | | [optional] +**lit_incentives_account_index** | **int** | Account index that receives the leasing fee | [optional] ## Example diff --git a/docs/RespGetLeases.md b/docs/RespGetLeases.md index b1c16e9..1c90745 100644 --- a/docs/RespGetLeases.md +++ b/docs/RespGetLeases.md @@ -5,10 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**code** | **int** | | +**code** | **int** | | [optional] **message** | **str** | | [optional] -**leases** | [**List[LeaseEntry]**](LeaseEntry.md) | | -**next_cursor** | **str** | | [optional] +**leases** | [**List[LeaseEntry]**](LeaseEntry.md) | | [optional] +**next_cursor** | **str** | Cursor to pass as the cursor param to fetch the next page. Absent if no more pages. | [optional] ## Example diff --git a/docs/RespGetMakerOnlyApiKeys.md b/docs/RespGetMakerOnlyApiKeys.md index 9256257..dd37f64 100644 --- a/docs/RespGetMakerOnlyApiKeys.md +++ b/docs/RespGetMakerOnlyApiKeys.md @@ -3,10 +3,10 @@ ## Properties -Name | Type | Description | Notes ------------- |---------------| ------------- | ------------- -**code** | **int** | | -**message** | **str** | | [optional] +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] **api_key_indexes** | **List[int]** | | ## Example diff --git a/docs/SpotOrderBookDetail.md b/docs/SpotOrderBookDetail.md index a41e15e..a3e1d18 100644 --- a/docs/SpotOrderBookDetail.md +++ b/docs/SpotOrderBookDetail.md @@ -30,6 +30,8 @@ Name | Type | Description | Notes **daily_price_high** | **float** | | **daily_price_change** | **float** | | **daily_chart** | **Dict[str, float]** | | +**is_maker_fee_enabled** | **bool** | | [optional] +**is_taker_fee_enabled** | **bool** | | [optional] ## Example diff --git a/docs/SubAccounts.md b/docs/SubAccounts.md index ae13399..d61d833 100644 --- a/docs/SubAccounts.md +++ b/docs/SubAccounts.md @@ -9,7 +9,6 @@ Name | Type | Description | Notes **message** | **str** | | [optional] **l1_address** | **str** | | **sub_accounts** | [**List[Account]**](Account.md) | | -**next_cursor** | **str** | | [optional] ## Example diff --git a/docs/SystemConfig.md b/docs/SystemConfig.md index ac5cc1d..80ad4f2 100644 --- a/docs/SystemConfig.md +++ b/docs/SystemConfig.md @@ -12,10 +12,10 @@ Name | Type | Description | Notes **funding_fee_rebate_account_index** | **int** | | **liquidity_pool_cooldown_period** | **int** | | **staking_pool_lockup_period** | **int** | | -**max_integrator_spot_taker_fee** | **int** | | -**max_integrator_spot_maker_fee** | **int** | | -**max_integrator_perps_taker_fee** | **int** | | **max_integrator_perps_maker_fee** | **int** | | +**max_integrator_perps_taker_fee** | **int** | | +**max_integrator_spot_maker_fee** | **int** | | +**max_integrator_spot_taker_fee** | **int** | | ## Example diff --git a/docs/Trade.md b/docs/Trade.md index e49bd76..53f0ff9 100644 --- a/docs/Trade.md +++ b/docs/Trade.md @@ -14,26 +14,35 @@ Name | Type | Description | Notes **usd_amount** | **str** | | **ask_id** | **int** | | **bid_id** | **int** | | -**ask_client_id** | **int** | | -**bid_client_id** | **int** | | **ask_account_id** | **int** | | **bid_account_id** | **int** | | **is_maker_ask** | **bool** | | **block_height** | **int** | | **timestamp** | **int** | | -**taker_fee** | **int** | | +**taker_fee** | **int** | | [optional] **taker_position_size_before** | **str** | | **taker_entry_quote_before** | **str** | | **taker_initial_margin_fraction_before** | **int** | | **taker_position_sign_changed** | **bool** | | -**maker_fee** | **int** | | +**maker_fee** | **int** | | [optional] **maker_position_size_before** | **str** | | **maker_entry_quote_before** | **str** | | **maker_initial_margin_fraction_before** | **int** | | **maker_position_sign_changed** | **bool** | | **transaction_time** | **int** | | -**ask_account_pnl** | **str** | | -**bid_account_pnl** | **str** | | +**bid_account_pnl** | **str** | Realized PnL for the queried account index, triggered by reducing a short position | +**ask_account_pnl** | **str** | Realized PnL for the queried account index, triggered by reducing a long position, or a spot position | +**ask_client_id** | **int** | | +**bid_client_id** | **int** | | +**ask_client_id_str** | **str** | | +**bid_client_id_str** | **str** | | +**ask_id_str** | **str** | | [optional] +**bid_id_str** | **str** | | [optional] +**trade_id_str** | **str** | | +**integrator_maker_fee** | **int** | | +**integrator_maker_fee_collector_index** | **int** | | +**integrator_taker_fee** | **int** | | +**integrator_taker_fee_collector_index** | **int** | | ## Example diff --git a/docs/TransactionApi.md b/docs/TransactionApi.md index 1f6a691..dd3fa16 100644 --- a/docs/TransactionApi.md +++ b/docs/TransactionApi.md @@ -4,18 +4,174 @@ All URIs are relative to *https://mainnet.zklighter.elliot.ai* Method | HTTP request | Description ------------- | ------------- | ------------- +[**account_txs**](TransactionApi.md#account_txs) | **GET** /api/v1/accountTxs | accountTxs +[**block_txs**](TransactionApi.md#block_txs) | **GET** /api/v1/blockTxs | blockTxs [**deposit_history**](TransactionApi.md#deposit_history) | **GET** /api/v1/deposit/history | deposit_history [**next_nonce**](TransactionApi.md#next_nonce) | **GET** /api/v1/nextNonce | nextNonce [**send_tx**](TransactionApi.md#send_tx) | **POST** /api/v1/sendTx | sendTx [**send_tx_batch**](TransactionApi.md#send_tx_batch) | **POST** /api/v1/sendTxBatch | sendTxBatch +[**set_account_metadata**](TransactionApi.md#set_account_metadata) | **POST** /api/v1/setAccountMetadata | setAccountMetadata [**transfer_history**](TransactionApi.md#transfer_history) | **GET** /api/v1/transfer/history | transfer_history [**tx**](TransactionApi.md#tx) | **GET** /api/v1/tx | tx [**tx_from_l1_tx_hash**](TransactionApi.md#tx_from_l1_tx_hash) | **GET** /api/v1/txFromL1TxHash | txFromL1TxHash +[**txs**](TransactionApi.md#txs) | **GET** /api/v1/txs | txs [**withdraw_history**](TransactionApi.md#withdraw_history) | **GET** /api/v1/withdraw/history | withdraw_history +# **account_txs** +> Txs account_txs(limit, by, value, index=index, authorization=authorization, auth=auth, types=types) + +accountTxs + +Get transactions of a specific account + +### Example + + +```python +import lighter +from lighter.models.txs import Txs +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.TransactionApi(api_client) + limit = 56 # int | + by = 'by_example' # str | + value = 'value_example' # str | + index = 56 # int | (optional) + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + types = [56] # List[int] | (optional) + + try: + # accountTxs + api_response = await api_instance.account_txs(limit, by, value, index=index, authorization=authorization, auth=auth, types=types) + print("The response of TransactionApi->account_txs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->account_txs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| | + **by** | **str**| | + **value** | **str**| | + **index** | **int**| | [optional] + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + **types** | [**List[int]**](int.md)| | [optional] + +### Return type + +[**Txs**](Txs.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) + +# **block_txs** +> Txs block_txs(by, value) + +blockTxs + +Get transactions in a block + +### Example + + +```python +import lighter +from lighter.models.txs import Txs +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.TransactionApi(api_client) + by = 'by_example' # str | + value = 'value_example' # str | + + try: + # blockTxs + api_response = await api_instance.block_txs(by, value) + print("The response of TransactionApi->block_txs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->block_txs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + +### Return type + +[**Txs**](Txs.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) + # **deposit_history** -> DepositHistory deposit_history(account_index, l1_address, authorization=authorization, auth=auth, cursor=cursor, filter=filter) +> DepositHistory deposit_history(authorization, account_index, l1_address, cursor=cursor, filter=filter) deposit_history @@ -41,16 +197,15 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.TransactionApi(api_client) + authorization = 'authorization_example' # str | account_index = 56 # int | l1_address = 'l1_address_example' # str | - authorization = 'authorization_example' # str | make required after integ is done (optional) - auth = 'auth_example' # str | made optional to support header auth clients (optional) cursor = 'cursor_example' # str | (optional) filter = 'filter_example' # str | (optional) try: # deposit_history - api_response = await api_instance.deposit_history(account_index, l1_address, authorization=authorization, auth=auth, cursor=cursor, filter=filter) + api_response = await api_instance.deposit_history(authorization, account_index, l1_address, cursor=cursor, filter=filter) print("The response of TransactionApi->deposit_history:\n") pprint(api_response) except Exception as e: @@ -64,10 +219,9 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | **l1_address** | **str**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] **cursor** | **str**| | [optional] **filter** | **str**| | [optional] @@ -169,7 +323,7 @@ No authorization required sendTx -You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) +You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started ### Example @@ -225,7 +379,7 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded - **Accept**: application/json ### HTTP response details @@ -242,7 +396,7 @@ No authorization required sendTxBatch -You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) +You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started ### Example @@ -296,7 +450,79 @@ No authorization required ### HTTP request headers - - **Content-Type**: multipart/form-data + - **Content-Type**: application/x-www-form-urlencoded + - **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) + +# **set_account_metadata** +> ResultCode set_account_metadata(req_set_account_metadata, authorization=authorization) + +setAccountMetadata + +Set account metadata + +### Example + + +```python +import lighter +from lighter.models.req_set_account_metadata import ReqSetAccountMetadata +from lighter.models.result_code import ResultCode +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.TransactionApi(api_client) + req_set_account_metadata = lighter.ReqSetAccountMetadata() # ReqSetAccountMetadata | + authorization = 'authorization_example' # str | (optional) + + try: + # setAccountMetadata + api_response = await api_instance.set_account_metadata(req_set_account_metadata, authorization=authorization) + print("The response of TransactionApi->set_account_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->set_account_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **req_set_account_metadata** | [**ReqSetAccountMetadata**](ReqSetAccountMetadata.md)| | + **authorization** | **str**| | [optional] + +### Return type + +[**ResultCode**](ResultCode.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: application/json - **Accept**: application/json ### HTTP response details @@ -309,11 +535,11 @@ 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) # **transfer_history** -> TransferHistory transfer_history(account_index, authorization=authorization, auth=auth, cursor=cursor, type=type) +> TransferHistory transfer_history(account_index, authorization=authorization, cursor=cursor, type=type) transfer_history -Get transfer history +Get transfer history. To fetch an account index, you will need to `auth` the request, unless it's a public pool. ### Example @@ -336,14 +562,13 @@ async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.TransactionApi(api_client) account_index = 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) + authorization = 'authorization_example' # str | (optional) cursor = 'cursor_example' # str | (optional) - type = 'type_example' # str | (optional) + type = ['type_example'] # List[str] | (optional) try: # transfer_history - api_response = await api_instance.transfer_history(account_index, authorization=authorization, auth=auth, cursor=cursor, type=type) + api_response = await api_instance.transfer_history(account_index, authorization=authorization, cursor=cursor, type=type) print("The response of TransactionApi->transfer_history:\n") pprint(api_response) except Exception as e: @@ -358,10 +583,9 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] + **authorization** | **str**| | [optional] **cursor** | **str**| | [optional] - **type** | **str**| | [optional] + **type** | [**List[str]**](str.md)| | [optional] ### Return type @@ -525,12 +749,83 @@ 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) +# **txs** +> Txs txs(limit, index=index) + +txs + +Get transactions which are already packed into blocks + +### Example + + +```python +import lighter +from lighter.models.txs import Txs +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.TransactionApi(api_client) + limit = 56 # int | + index = 56 # int | (optional) + + try: + # txs + api_response = await api_instance.txs(limit, index=index) + print("The response of TransactionApi->txs:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->txs: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| | + **index** | **int**| | [optional] + +### Return type + +[**Txs**](Txs.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) + # **withdraw_history** -> WithdrawHistory withdraw_history(account_index, authorization=authorization, auth=auth, cursor=cursor, filter=filter) +> WithdrawHistory withdraw_history(authorization, account_index, cursor=cursor, filter=filter) withdraw_history -Get withdraw history +Get withdraw history. Secure withdrawals are only set to `claimable` when ready. You should only expect the `completed` status on fast withdrawals via Arbitrum. ### Example @@ -552,15 +847,14 @@ configuration = lighter.Configuration( async with lighter.ApiClient(configuration) as api_client: # Create an instance of the API class api_instance = lighter.TransactionApi(api_client) + authorization = 'authorization_example' # str | account_index = 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) cursor = 'cursor_example' # str | (optional) filter = 'filter_example' # str | (optional) try: # withdraw_history - api_response = await api_instance.withdraw_history(account_index, authorization=authorization, auth=auth, cursor=cursor, filter=filter) + api_response = await api_instance.withdraw_history(authorization, account_index, cursor=cursor, filter=filter) print("The response of TransactionApi->withdraw_history:\n") pprint(api_response) except Exception as e: @@ -574,9 +868,8 @@ async with lighter.ApiClient(configuration) as api_client: Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- + **authorization** | **str**| | **account_index** | **int**| | - **authorization** | **str**| make required after integ is done | [optional] - **auth** | **str**| made optional to support header auth clients | [optional] **cursor** | **str**| | [optional] **filter** | **str**| | [optional] diff --git a/docs/TransferHistoryItem.md b/docs/TransferHistoryItem.md index 56b71aa..11201e8 100644 --- a/docs/TransferHistoryItem.md +++ b/docs/TransferHistoryItem.md @@ -6,18 +6,18 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | -**asset_id** | **int** | | **amount** | **str** | | -**fee** | **str** | | **timestamp** | **int** | | **type** | **str** | | **from_l1_address** | **str** | | **to_l1_address** | **str** | | **from_account_index** | **int** | | **to_account_index** | **int** | | +**tx_hash** | **str** | | +**asset_id** | **int** | | +**fee** | **str** | | **from_route** | **str** | | **to_route** | **str** | | -**tx_hash** | **str** | | ## Example diff --git a/docs/UserReferrals.md b/docs/UserReferrals.md index ccb0f1b..d4b727c 100644 --- a/docs/UserReferrals.md +++ b/docs/UserReferrals.md @@ -9,6 +9,7 @@ Name | Type | Description | Notes **message** | **str** | | [optional] **cursor** | **str** | | **referrals** | [**List[Referral]**](Referral.md) | | +**used_code** | **str** | | ## Example diff --git a/docs/WithdrawHistoryItem.md b/docs/WithdrawHistoryItem.md index 8ce329d..0293e65 100644 --- a/docs/WithdrawHistoryItem.md +++ b/docs/WithdrawHistoryItem.md @@ -6,12 +6,12 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- **id** | **str** | | -**asset_id** | **int** | | **amount** | **str** | | **timestamp** | **int** | | **status** | **str** | | **type** | **str** | | **l1_tx_hash** | **str** | | +**asset_id** | **int** | | ## Example diff --git a/examples/create_order_skip_nonce.py b/examples/create_order_skip_nonce.py index 25a8086..0002a59 100644 --- a/examples/create_order_skip_nonce.py +++ b/examples/create_order_skip_nonce.py @@ -12,7 +12,7 @@ async def main(): tx, tx_hash, err = await client.create_market_order( market_index=market_index, client_order_index=0, - base_amount=1000, # 0.1 ETH + base_amount=100, # 0.1 ETH avg_execution_price=4000_00, # $4000 -- worst acceptable price for the order is_ask=False, skip_nonce=1, diff --git a/examples/set_maker_only_api_keys.py b/examples/set_maker_only_api_keys.py new file mode 100644 index 0000000..3e48515 --- /dev/null +++ b/examples/set_maker_only_api_keys.py @@ -0,0 +1,26 @@ +import asyncio, json, lighter +from utils import default_example_setup + +async def main(): + client, api_client, _ = default_example_setup() + auth_token, err = client.create_auth_token_with_expiry() + assert err is None + + account_api = lighter.AccountApi(api_client) + resp = await account_api.set_maker_only_api_keys( + account_index=client.account_index, + api_key_indexes=json.dumps([4, 5, 6]), + authorization=auth_token, + ) + print("set:", resp) + + got = await account_api.get_maker_only_api_keys( + account_index=client.account_index, + authorization=auth_token, + ) + print("get:", got.api_key_indexes) + await client.close() + await api_client.close() + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/lighter/__init__.py b/lighter/__init__.py index 2264126..9edac32 100644 --- a/lighter/__init__.py +++ b/lighter/__init__.py @@ -3,11 +3,11 @@ # flake8: noqa """ - zkLighter API + - Public APIs for Lighter + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0 + The version of the OpenAPI document: Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -16,192 +16,396 @@ __version__ = "1.0.0" +# Define package exports +__all__ = [ + "AccountApi", + "AnnouncementApi", + "BlockApi", + "BridgeApi", + "CandlestickApi", + "FundingApi", + "InfoApi", + "NotificationApi", + "OrderApi", + "ReferralApi", + "RootApi", + "TokenlistApi", + "TransactionApi", + "ApiResponse", + "ApiClient", + "Configuration", + "OpenApiException", + "ApiTypeError", + "ApiValueError", + "ApiKeyError", + "ApiAttributeError", + "ApiException", + "Account", + "AccountApiKeys", + "AccountAsset", + "AccountLimits", + "AccountMarginStats", + "AccountMarketStats", + "AccountMetadata", + "AccountMetadatas", + "AccountPnL", + "AccountPosition", + "AccountStats", + "AccountTradeStats", + "Announcement", + "Announcements", + "ApiKey", + "ApiToken", + "ApprovedIntegrator", + "Asset", + "AssetDetails", + "Block", + "Blocks", + "BridgeSupportedNetwork", + "BridgeSupportedNetworks", + "Candle", + "Candles", + "Candlestick", + "Candlesticks", + "ContractAddress", + "CreateIntentAddressResp", + "CurrentHeight", + "Cursor", + "DailyReturn", + "Deposit", + "DepositHistory", + "DepositHistoryItem", + "DetailedAccount", + "DetailedAccounts", + "DetailedCandlestick", + "EnrichedTx", + "ExchangeMetric", + "ExchangeStats", + "ExecuteStat", + "ExportData", + "Funding", + "FundingRate", + "FundingRates", + "Fundings", + "L1Metadata", + "L1ProviderInfo", + "Layer1BasicInfo", + "LeaseEntry", + "LeaseOptionEntry", + "LiqTrade", + "Liquidation", + "LiquidationInfo", + "LiquidationInfos", + "MarketConfig", + "NextNonce", + "Order", + "OrderBook", + "OrderBookDepth", + "OrderBookDetails", + "OrderBookOrders", + "OrderBookStats", + "OrderBooks", + "Orders", + "PartnerStats", + "PendingUnlock", + "PerpsMarketStats", + "PerpsOrderBookDetail", + "PnLEntry", + "PositionFunding", + "PositionFundings", + "PriceLevel", + "PublicPoolInfo", + "PublicPoolMetadata", + "PublicPoolShare", + "Referral", + "ReferralCode", + "ReferralPointEntry", + "ReferralPoints", + "ReqExportData", + "ReqGetAccount", + "ReqGetAccountActiveOrders", + "ReqGetAccountApiKeys", + "ReqGetAccountByL1Address", + "ReqGetAccountInactiveOrders", + "ReqGetAccountLimits", + "ReqGetAccountMetadata", + "ReqGetAccountPnL", + "ReqGetAccountTxs", + "ReqGetBlock", + "ReqGetBlockTxs", + "ReqGetByAccount", + "ReqGetCandlesticks", + "ReqGetDepositHistory", + "ReqGetFastWithdrawInfo", + "ReqGetFundings", + "ReqGetL1Metadata", + "ReqGetL1Tx", + "ReqGetLatestDeposit", + "ReqGetLiquidationInfos", + "ReqGetMakerOnlyApiKeys", + "ReqGetNextNonce", + "ReqGetOrderBookDetails", + "ReqGetOrderBookOrders", + "ReqGetOrderBooks", + "ReqGetPositionFunding", + "ReqGetPublicPoolsMetadata", + "ReqGetRangeWithCursor", + "ReqGetRangeWithIndex", + "ReqGetRangeWithIndexSortable", + "ReqGetRecentTrades", + "ReqGetReferralPoints", + "ReqGetTrades", + "ReqGetTransferFeeInfo", + "ReqGetTransferHistory", + "ReqGetTx", + "ReqGetWithdrawHistory", + "ReqSetAccountMetadata", + "RespChangeAccountTier", + "RespGetApiTokens", + "RespGetExchangeMetrics", + "RespGetExecuteStats", + "RespGetFastBridgeInfo", + "RespGetFastwithdrawalInfo", + "RespGetLeaseOptions", + "RespGetLeases", + "RespGetMakerOnlyApiKeys", + "RespPostApiToken", + "RespPublicPoolsMetadata", + "RespRevokeApiToken", + "RespSendTx", + "RespSendTxBatch", + "RespSetMakerOnlyApiKeys", + "RespUpdateKickback", + "RespUpdateReferralCode", + "RespWithdrawalDelay", + "ResultCode", + "RiskInfo", + "RiskParameters", + "SharePrice", + "SimpleOrder", + "SlippageResult", + "SpotAvgEntryPrice", + "SpotMarketStats", + "SpotOrderBookDetail", + "Status", + "Strategy", + "SubAccounts", + "SystemConfig", + "Ticker", + "Token", + "TokenList", + "Trade", + "TradeStats", + "Trades", + "TransferFeeInfo", + "TransferHistory", + "TransferHistoryItem", + "Tx", + "TxHash", + "TxHashes", + "Txs", + "UserReferrals", + "ValidatorInfo", + "WithdrawHistory", + "WithdrawHistoryItem", + "ZkLighterInfo", +] + # import apis into sdk package -from lighter.api.account_api import AccountApi -from lighter.api.announcement_api import AnnouncementApi -from lighter.api.bridge_api import BridgeApi -from lighter.api.candlestick_api import CandlestickApi -from lighter.api.funding_api import FundingApi -from lighter.api.info_api import InfoApi -from lighter.api.notification_api import NotificationApi -from lighter.api.order_api import OrderApi -from lighter.api.pushnotif_api import PushnotifApi -from lighter.api.referral_api import ReferralApi -from lighter.api.root_api import RootApi -from lighter.api.transaction_api import TransactionApi +from lighter.api.account_api import AccountApi as AccountApi +from lighter.api.announcement_api import AnnouncementApi as AnnouncementApi +from lighter.api.block_api import BlockApi as BlockApi +from lighter.api.bridge_api import BridgeApi as BridgeApi +from lighter.api.candlestick_api import CandlestickApi as CandlestickApi +from lighter.api.funding_api import FundingApi as FundingApi +from lighter.api.info_api import InfoApi as InfoApi +from lighter.api.notification_api import NotificationApi as NotificationApi +from lighter.api.order_api import OrderApi as OrderApi +from lighter.api.referral_api import ReferralApi as ReferralApi +from lighter.api.root_api import RootApi as RootApi +from lighter.api.tokenlist_api import TokenlistApi as TokenlistApi +from lighter.api.transaction_api import TransactionApi as TransactionApi # import ApiClient -from lighter.api_response import ApiResponse -from lighter.api_client import ApiClient -from lighter.configuration import Configuration -from lighter.exceptions import OpenApiException -from lighter.exceptions import ApiTypeError -from lighter.exceptions import ApiValueError -from lighter.exceptions import ApiKeyError -from lighter.exceptions import ApiAttributeError -from lighter.exceptions import ApiException +from lighter.api_response import ApiResponse as ApiResponse +from lighter.api_client import ApiClient as ApiClient +from lighter.configuration import Configuration as Configuration +from lighter.exceptions import OpenApiException as OpenApiException +from lighter.exceptions import ApiTypeError as ApiTypeError +from lighter.exceptions import ApiValueError as ApiValueError +from lighter.exceptions import ApiKeyError as ApiKeyError +from lighter.exceptions import ApiAttributeError as ApiAttributeError +from lighter.exceptions import ApiException as ApiException # import models into sdk package -from lighter.models.account import Account -from lighter.models.account_api_keys import AccountApiKeys -from lighter.models.account_asset import AccountAsset -from lighter.models.account_limits import AccountLimits -from lighter.models.account_margin_stats import AccountMarginStats -from lighter.models.account_market_stats import AccountMarketStats -from lighter.models.account_metadata import AccountMetadata -from lighter.models.account_metadatas import AccountMetadatas -from lighter.models.account_pn_l import AccountPnL -from lighter.models.account_position import AccountPosition -from lighter.models.account_stats import AccountStats -from lighter.models.account_trade_stats import AccountTradeStats -from lighter.models.announcement import Announcement -from lighter.models.announcements import Announcements -from lighter.models.api_key import ApiKey -from lighter.models.api_token import ApiToken -from lighter.models.approved_integrator import ApprovedIntegrator -from lighter.models.asset import Asset -from lighter.models.asset_details import AssetDetails -from lighter.models.auth import Auth -from lighter.models.bridge import Bridge -from lighter.models.bridge_supported_network import BridgeSupportedNetwork -from lighter.models.candle import Candle -from lighter.models.candles import Candles -from lighter.models.contract_address import ContractAddress -from lighter.models.cursor import Cursor -from lighter.models.daily_return import DailyReturn -from lighter.models.deposit_history import DepositHistory -from lighter.models.deposit_history_item import DepositHistoryItem -from lighter.models.detailed_account import DetailedAccount -from lighter.models.detailed_accounts import DetailedAccounts -from lighter.models.detailed_candlestick import DetailedCandlestick -from lighter.models.enriched_tx import EnrichedTx -from lighter.models.exchange_metric import ExchangeMetric -from lighter.models.exchange_stats import ExchangeStats -from lighter.models.execute_stat import ExecuteStat -from lighter.models.export_data import ExportData -from lighter.models.funding import Funding -from lighter.models.funding_rate import FundingRate -from lighter.models.funding_rates import FundingRates -from lighter.models.fundings import Fundings -from lighter.models.l1_metadata import L1Metadata -from lighter.models.l1_provider_info import L1ProviderInfo -from lighter.models.lease_entry import LeaseEntry -from lighter.models.lease_option_entry import LeaseOptionEntry -from lighter.models.liq_trade import LiqTrade -from lighter.models.liquidation import Liquidation -from lighter.models.liquidation_info import LiquidationInfo -from lighter.models.liquidation_infos import LiquidationInfos -from lighter.models.market_config import MarketConfig -from lighter.models.next_nonce import NextNonce -from lighter.models.order import Order -from lighter.models.order_book import OrderBook -from lighter.models.order_book_depth import OrderBookDepth -from lighter.models.order_book_depth_with_begin_nonce import OrderBookDepthWithBeginNonce -from lighter.models.order_book_details import OrderBookDetails -from lighter.models.order_book_orders import OrderBookOrders -from lighter.models.order_book_stats import OrderBookStats -from lighter.models.order_books import OrderBooks -from lighter.models.orders import Orders -from lighter.models.pending_unlock import PendingUnlock -from lighter.models.perps_market_stats import PerpsMarketStats -from lighter.models.perps_order_book_detail import PerpsOrderBookDetail -from lighter.models.pn_l_entry import PnLEntry -from lighter.models.position_funding import PositionFunding -from lighter.models.position_fundings import PositionFundings -from lighter.models.price_level import PriceLevel -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.push_notif_delivery_result import PushNotifDeliveryResult -from lighter.models.referral import Referral -from lighter.models.req_do_faucet import ReqDoFaucet -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 -from lighter.models.req_get_account_limits import ReqGetAccountLimits -from lighter.models.req_get_account_metadata import ReqGetAccountMetadata -from lighter.models.req_get_account_pn_l import ReqGetAccountPnL -from lighter.models.req_get_account_txs import ReqGetAccountTxs -from lighter.models.req_get_api_tokens import ReqGetApiTokens -from lighter.models.req_get_asset_details import ReqGetAssetDetails -from lighter.models.req_get_block import ReqGetBlock -from lighter.models.req_get_block_txs import ReqGetBlockTxs -from lighter.models.req_get_bridges_by_l1_addr import ReqGetBridgesByL1Addr -from lighter.models.req_get_by_account import ReqGetByAccount -from lighter.models.req_get_candles import ReqGetCandles -from lighter.models.req_get_deposit_history import ReqGetDepositHistory -from lighter.models.req_get_exchange_metrics import ReqGetExchangeMetrics -from lighter.models.req_get_execute_stats import ReqGetExecuteStats -from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo -from lighter.models.req_get_fundings import ReqGetFundings -from lighter.models.req_get_l1_metadata import ReqGetL1Metadata -from lighter.models.req_get_l1_tx import ReqGetL1Tx -from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit -from lighter.models.req_get_leases import ReqGetLeases -from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos -from lighter.models.req_get_next_nonce import ReqGetNextNonce -from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails -from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders -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_metadata import ReqGetPublicPoolsMetadata -from lighter.models.req_get_push_notif_settings import ReqGetPushNotifSettings -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 -from lighter.models.req_get_recent_trades import ReqGetRecentTrades -from lighter.models.req_get_trades import ReqGetTrades -from lighter.models.req_get_transfer_fee_info import ReqGetTransferFeeInfo -from lighter.models.req_get_transfer_history import ReqGetTransferHistory -from lighter.models.req_get_tx import ReqGetTx -from lighter.models.req_get_user_referrals import ReqGetUserReferrals -from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory -from lighter.models.resp_change_account_tier import RespChangeAccountTier -from lighter.models.resp_get_api_tokens import RespGetApiTokens -from lighter.models.resp_get_bridges_by_l1_addr import RespGetBridgesByL1Addr -from lighter.models.resp_get_exchange_metrics import RespGetExchangeMetrics -from lighter.models.resp_get_execute_stats import RespGetExecuteStats -from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo -from lighter.models.resp_get_fastwithdrawal_info import RespGetFastwithdrawalInfo -from lighter.models.resp_get_is_next_bridge_fast import RespGetIsNextBridgeFast -from lighter.models.resp_get_lease_options import RespGetLeaseOptions -from lighter.models.resp_get_leases import RespGetLeases -from lighter.models.resp_get_push_notif_settings import RespGetPushNotifSettings -from lighter.models.resp_post_api_token import RespPostApiToken -from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata -from lighter.models.resp_revoke_api_token import RespRevokeApiToken -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.slippage_result import SlippageResult -from lighter.models.spot_avg_entry_price import SpotAvgEntryPrice -from lighter.models.spot_market_stats import SpotMarketStats -from lighter.models.spot_order_book_detail import SpotOrderBookDetail -from lighter.models.status import Status -from lighter.models.strategy import Strategy -from lighter.models.sub_accounts import SubAccounts -from lighter.models.system_config import SystemConfig -from lighter.models.ticker import Ticker -from lighter.models.trade import Trade -from lighter.models.trade_stats import TradeStats -from lighter.models.trades import Trades -from lighter.models.transfer_fee_info import TransferFeeInfo -from lighter.models.transfer_history import TransferHistory -from lighter.models.transfer_history_item import TransferHistoryItem -from lighter.models.tx_hash import TxHash -from lighter.models.tx_hashes import TxHashes -from lighter.models.user_referrals import UserReferrals -from lighter.models.validator_info import ValidatorInfo -from lighter.models.withdraw_history import WithdrawHistory -from lighter.models.withdraw_history_item import WithdrawHistoryItem -from lighter.models.zk_lighter_info import ZkLighterInfo +from lighter.models.account import Account as Account +from lighter.models.account_api_keys import AccountApiKeys as AccountApiKeys +from lighter.models.account_asset import AccountAsset as AccountAsset +from lighter.models.account_limits import AccountLimits as AccountLimits +from lighter.models.account_margin_stats import AccountMarginStats as AccountMarginStats +from lighter.models.account_market_stats import AccountMarketStats as AccountMarketStats +from lighter.models.account_metadata import AccountMetadata as AccountMetadata +from lighter.models.account_metadatas import AccountMetadatas as AccountMetadatas +from lighter.models.account_pn_l import AccountPnL as AccountPnL +from lighter.models.account_position import AccountPosition as AccountPosition +from lighter.models.account_stats import AccountStats as AccountStats +from lighter.models.account_trade_stats import AccountTradeStats as AccountTradeStats +from lighter.models.announcement import Announcement as Announcement +from lighter.models.announcements import Announcements as Announcements +from lighter.models.api_key import ApiKey as ApiKey +from lighter.models.api_token import ApiToken as ApiToken +from lighter.models.approved_integrator import ApprovedIntegrator as ApprovedIntegrator +from lighter.models.asset import Asset as Asset +from lighter.models.asset_details import AssetDetails as AssetDetails +from lighter.models.block import Block as Block +from lighter.models.blocks import Blocks as Blocks +from lighter.models.bridge_supported_network import BridgeSupportedNetwork as BridgeSupportedNetwork +from lighter.models.bridge_supported_networks import BridgeSupportedNetworks as BridgeSupportedNetworks +from lighter.models.candle import Candle as Candle +from lighter.models.candles import Candles as Candles +from lighter.models.candlestick import Candlestick as Candlestick +from lighter.models.candlesticks import Candlesticks as Candlesticks +from lighter.models.contract_address import ContractAddress as ContractAddress +from lighter.models.create_intent_address_resp import CreateIntentAddressResp as CreateIntentAddressResp +from lighter.models.current_height import CurrentHeight as CurrentHeight +from lighter.models.cursor import Cursor as Cursor +from lighter.models.daily_return import DailyReturn as DailyReturn +from lighter.models.deposit import Deposit as Deposit +from lighter.models.deposit_history import DepositHistory as DepositHistory +from lighter.models.deposit_history_item import DepositHistoryItem as DepositHistoryItem +from lighter.models.detailed_account import DetailedAccount as DetailedAccount +from lighter.models.detailed_accounts import DetailedAccounts as DetailedAccounts +from lighter.models.detailed_candlestick import DetailedCandlestick as DetailedCandlestick +from lighter.models.enriched_tx import EnrichedTx as EnrichedTx +from lighter.models.exchange_metric import ExchangeMetric as ExchangeMetric +from lighter.models.exchange_stats import ExchangeStats as ExchangeStats +from lighter.models.execute_stat import ExecuteStat as ExecuteStat +from lighter.models.export_data import ExportData as ExportData +from lighter.models.funding import Funding as Funding +from lighter.models.funding_rate import FundingRate as FundingRate +from lighter.models.funding_rates import FundingRates as FundingRates +from lighter.models.fundings import Fundings as Fundings +from lighter.models.l1_metadata import L1Metadata as L1Metadata +from lighter.models.l1_provider_info import L1ProviderInfo as L1ProviderInfo +from lighter.models.layer1_basic_info import Layer1BasicInfo as Layer1BasicInfo +from lighter.models.lease_entry import LeaseEntry as LeaseEntry +from lighter.models.lease_option_entry import LeaseOptionEntry as LeaseOptionEntry +from lighter.models.liq_trade import LiqTrade as LiqTrade +from lighter.models.liquidation import Liquidation as Liquidation +from lighter.models.liquidation_info import LiquidationInfo as LiquidationInfo +from lighter.models.liquidation_infos import LiquidationInfos as LiquidationInfos +from lighter.models.market_config import MarketConfig as MarketConfig +from lighter.models.next_nonce import NextNonce as NextNonce +from lighter.models.order import Order as Order +from lighter.models.order_book import OrderBook as OrderBook +from lighter.models.order_book_depth import OrderBookDepth as OrderBookDepth +from lighter.models.order_book_details import OrderBookDetails as OrderBookDetails +from lighter.models.order_book_orders import OrderBookOrders as OrderBookOrders +from lighter.models.order_book_stats import OrderBookStats as OrderBookStats +from lighter.models.order_books import OrderBooks as OrderBooks +from lighter.models.orders import Orders as Orders +from lighter.models.partner_stats import PartnerStats as PartnerStats +from lighter.models.pending_unlock import PendingUnlock as PendingUnlock +from lighter.models.perps_market_stats import PerpsMarketStats as PerpsMarketStats +from lighter.models.perps_order_book_detail import PerpsOrderBookDetail as PerpsOrderBookDetail +from lighter.models.pn_l_entry import PnLEntry as PnLEntry +from lighter.models.position_funding import PositionFunding as PositionFunding +from lighter.models.position_fundings import PositionFundings as PositionFundings +from lighter.models.price_level import PriceLevel as PriceLevel +from lighter.models.public_pool_info import PublicPoolInfo as PublicPoolInfo +from lighter.models.public_pool_metadata import PublicPoolMetadata as PublicPoolMetadata +from lighter.models.public_pool_share import PublicPoolShare as PublicPoolShare +from lighter.models.referral import Referral as Referral +from lighter.models.referral_code import ReferralCode as ReferralCode +from lighter.models.referral_point_entry import ReferralPointEntry as ReferralPointEntry +from lighter.models.referral_points import ReferralPoints as ReferralPoints +from lighter.models.req_export_data import ReqExportData as ReqExportData +from lighter.models.req_get_account import ReqGetAccount as ReqGetAccount +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders as ReqGetAccountActiveOrders +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys as ReqGetAccountApiKeys +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address as ReqGetAccountByL1Address +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders as ReqGetAccountInactiveOrders +from lighter.models.req_get_account_limits import ReqGetAccountLimits as ReqGetAccountLimits +from lighter.models.req_get_account_metadata import ReqGetAccountMetadata as ReqGetAccountMetadata +from lighter.models.req_get_account_pn_l import ReqGetAccountPnL as ReqGetAccountPnL +from lighter.models.req_get_account_txs import ReqGetAccountTxs as ReqGetAccountTxs +from lighter.models.req_get_block import ReqGetBlock as ReqGetBlock +from lighter.models.req_get_block_txs import ReqGetBlockTxs as ReqGetBlockTxs +from lighter.models.req_get_by_account import ReqGetByAccount as ReqGetByAccount +from lighter.models.req_get_candlesticks import ReqGetCandlesticks as ReqGetCandlesticks +from lighter.models.req_get_deposit_history import ReqGetDepositHistory as ReqGetDepositHistory +from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo as ReqGetFastWithdrawInfo +from lighter.models.req_get_fundings import ReqGetFundings as ReqGetFundings +from lighter.models.req_get_l1_metadata import ReqGetL1Metadata as ReqGetL1Metadata +from lighter.models.req_get_l1_tx import ReqGetL1Tx as ReqGetL1Tx +from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit as ReqGetLatestDeposit +from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos as ReqGetLiquidationInfos +from lighter.models.req_get_maker_only_api_keys import ReqGetMakerOnlyApiKeys as ReqGetMakerOnlyApiKeys +from lighter.models.req_get_next_nonce import ReqGetNextNonce as ReqGetNextNonce +from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails as ReqGetOrderBookDetails +from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders as ReqGetOrderBookOrders +from lighter.models.req_get_order_books import ReqGetOrderBooks as ReqGetOrderBooks +from lighter.models.req_get_position_funding import ReqGetPositionFunding as ReqGetPositionFunding +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata as ReqGetPublicPoolsMetadata +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor as ReqGetRangeWithCursor +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex as ReqGetRangeWithIndex +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable as ReqGetRangeWithIndexSortable +from lighter.models.req_get_recent_trades import ReqGetRecentTrades as ReqGetRecentTrades +from lighter.models.req_get_referral_points import ReqGetReferralPoints as ReqGetReferralPoints +from lighter.models.req_get_trades import ReqGetTrades as ReqGetTrades +from lighter.models.req_get_transfer_fee_info import ReqGetTransferFeeInfo as ReqGetTransferFeeInfo +from lighter.models.req_get_transfer_history import ReqGetTransferHistory as ReqGetTransferHistory +from lighter.models.req_get_tx import ReqGetTx as ReqGetTx +from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory as ReqGetWithdrawHistory +from lighter.models.req_set_account_metadata import ReqSetAccountMetadata as ReqSetAccountMetadata +from lighter.models.resp_change_account_tier import RespChangeAccountTier as RespChangeAccountTier +from lighter.models.resp_get_api_tokens import RespGetApiTokens as RespGetApiTokens +from lighter.models.resp_get_exchange_metrics import RespGetExchangeMetrics as RespGetExchangeMetrics +from lighter.models.resp_get_execute_stats import RespGetExecuteStats as RespGetExecuteStats +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo as RespGetFastBridgeInfo +from lighter.models.resp_get_fastwithdrawal_info import RespGetFastwithdrawalInfo as RespGetFastwithdrawalInfo +from lighter.models.resp_get_lease_options import RespGetLeaseOptions as RespGetLeaseOptions +from lighter.models.resp_get_leases import RespGetLeases as RespGetLeases +from lighter.models.resp_get_maker_only_api_keys import RespGetMakerOnlyApiKeys as RespGetMakerOnlyApiKeys +from lighter.models.resp_post_api_token import RespPostApiToken as RespPostApiToken +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata as RespPublicPoolsMetadata +from lighter.models.resp_revoke_api_token import RespRevokeApiToken as RespRevokeApiToken +from lighter.models.resp_send_tx import RespSendTx as RespSendTx +from lighter.models.resp_send_tx_batch import RespSendTxBatch as RespSendTxBatch +from lighter.models.resp_set_maker_only_api_keys import RespSetMakerOnlyApiKeys as RespSetMakerOnlyApiKeys +from lighter.models.resp_update_kickback import RespUpdateKickback as RespUpdateKickback +from lighter.models.resp_update_referral_code import RespUpdateReferralCode as RespUpdateReferralCode +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay as RespWithdrawalDelay +from lighter.models.result_code import ResultCode as ResultCode +from lighter.models.risk_info import RiskInfo as RiskInfo +from lighter.models.risk_parameters import RiskParameters as RiskParameters +from lighter.models.share_price import SharePrice as SharePrice +from lighter.models.simple_order import SimpleOrder as SimpleOrder +from lighter.models.slippage_result import SlippageResult as SlippageResult +from lighter.models.spot_avg_entry_price import SpotAvgEntryPrice as SpotAvgEntryPrice +from lighter.models.spot_market_stats import SpotMarketStats as SpotMarketStats +from lighter.models.spot_order_book_detail import SpotOrderBookDetail as SpotOrderBookDetail +from lighter.models.status import Status as Status +from lighter.models.strategy import Strategy as Strategy +from lighter.models.sub_accounts import SubAccounts as SubAccounts +from lighter.models.system_config import SystemConfig as SystemConfig +from lighter.models.ticker import Ticker as Ticker +from lighter.models.token import Token as Token +from lighter.models.token_list import TokenList as TokenList +from lighter.models.trade import Trade as Trade +from lighter.models.trade_stats import TradeStats as TradeStats +from lighter.models.trades import Trades as Trades +from lighter.models.transfer_fee_info import TransferFeeInfo as TransferFeeInfo +from lighter.models.transfer_history import TransferHistory as TransferHistory +from lighter.models.transfer_history_item import TransferHistoryItem as TransferHistoryItem +from lighter.models.tx import Tx as Tx +from lighter.models.tx_hash import TxHash as TxHash +from lighter.models.tx_hashes import TxHashes as TxHashes +from lighter.models.txs import Txs as Txs +from lighter.models.user_referrals import UserReferrals as UserReferrals +from lighter.models.validator_info import ValidatorInfo as ValidatorInfo +from lighter.models.withdraw_history import WithdrawHistory as WithdrawHistory +from lighter.models.withdraw_history_item import WithdrawHistoryItem as WithdrawHistoryItem +from lighter.models.zk_lighter_info import ZkLighterInfo as ZkLighterInfo from lighter.ws_client import WsClient -from lighter.signer_client import SignerClient, create_api_key \ No newline at end of file +from lighter.signer_client import SignerClient, create_api_key diff --git a/lighter/api/__init__.py b/lighter/api/__init__.py index 112ca77..de30699 100644 --- a/lighter/api/__init__.py +++ b/lighter/api/__init__.py @@ -3,6 +3,7 @@ # import apis into api package from lighter.api.account_api import AccountApi from lighter.api.announcement_api import AnnouncementApi +from lighter.api.block_api import BlockApi from lighter.api.bridge_api import BridgeApi from lighter.api.candlestick_api import CandlestickApi from lighter.api.funding_api import FundingApi @@ -12,5 +13,6 @@ from lighter.api.pushnotif_api import PushnotifApi from lighter.api.referral_api import ReferralApi from lighter.api.root_api import RootApi +from lighter.api.tokenlist_api import TokenlistApi from lighter.api.transaction_api import TransactionApi diff --git a/lighter/api/account_api.py b/lighter/api/account_api.py index dd17c6e..7ba7c3a 100644 --- a/lighter/api/account_api.py +++ b/lighter/api/account_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -36,9 +35,10 @@ from lighter.models.resp_post_api_token import RespPostApiToken from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.resp_revoke_api_token import RespRevokeApiToken -from lighter.models.result_code import ResultCode +from lighter.models.resp_set_maker_only_api_keys import RespSetMakerOnlyApiKeys from lighter.models.sub_accounts import SubAccounts from lighter.models.tx_hash import TxHash +from lighter.models.user_referrals import UserReferrals from lighter.api_client import ApiClient, RequestSerialized from lighter.api_response import ApiResponse @@ -58,11 +58,12 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def account( self, by: StrictStr, value: StrictStr, - active_only: Optional[StrictBool] = None, + active_only: Annotated[Optional[StrictBool], Field(description="Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position.")] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -79,13 +80,13 @@ async def account( ) -> DetailedAccounts: """account - 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. + Get account by an account's index, or L1 address :param by: (required) :type by: str :param value: (required) :type value: str - :param active_only: + :param active_only: Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. :type active_only: bool :param cursor: :type cursor: str @@ -137,11 +138,12 @@ async def account( ).data + @validate_call async def account_with_http_info( self, by: StrictStr, value: StrictStr, - active_only: Optional[StrictBool] = None, + active_only: Annotated[Optional[StrictBool], Field(description="Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position.")] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -158,13 +160,13 @@ async def account_with_http_info( ) -> ApiResponse[DetailedAccounts]: """account - 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. + Get account by an account's index, or L1 address :param by: (required) :type by: str :param value: (required) :type value: str - :param active_only: + :param active_only: Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. :type active_only: bool :param cursor: :type cursor: str @@ -216,11 +218,12 @@ async def account_with_http_info( ) + @validate_call async def account_without_preload_content( self, by: StrictStr, value: StrictStr, - active_only: Optional[StrictBool] = None, + active_only: Annotated[Optional[StrictBool], Field(description="Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position.")] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -237,13 +240,13 @@ async def account_without_preload_content( ) -> RESTResponseType: """account - 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. + Get account by an account's index, or L1 address :param by: (required) :type by: str :param value: (required) :type value: str - :param active_only: + :param active_only: Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position. :type active_only: bool :param cursor: :type cursor: str @@ -312,7 +315,9 @@ def _account_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -369,11 +374,11 @@ def _account_serialize( + @validate_call async def account_limits( self, account_index: 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, + authorization: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -389,14 +394,12 @@ async def account_limits( ) -> AccountLimits: """accountLimits - Get account limits + Get account limits. For more details on account types, see this page: https://apidocs.lighter.xyz/docs/account-types :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param authorization: (required) :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 @@ -422,7 +425,6 @@ async def account_limits( _param = self._account_limits_serialize( account_index=account_index, authorization=authorization, - auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -444,11 +446,11 @@ async def account_limits( ).data + @validate_call async def account_limits_with_http_info( self, account_index: 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, + authorization: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -464,14 +466,12 @@ async def account_limits_with_http_info( ) -> ApiResponse[AccountLimits]: """accountLimits - Get account limits + Get account limits. For more details on account types, see this page: https://apidocs.lighter.xyz/docs/account-types :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param authorization: (required) :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 @@ -497,7 +497,6 @@ async def account_limits_with_http_info( _param = self._account_limits_serialize( account_index=account_index, authorization=authorization, - auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -519,11 +518,11 @@ async def account_limits_with_http_info( ) + @validate_call async def account_limits_without_preload_content( self, account_index: 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, + authorization: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -539,14 +538,12 @@ async def account_limits_without_preload_content( ) -> RESTResponseType: """accountLimits - Get account limits + Get account limits. For more details on account types, see this page: https://apidocs.lighter.xyz/docs/account-types :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param authorization: (required) :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 @@ -572,7 +569,6 @@ async def account_limits_without_preload_content( _param = self._account_limits_serialize( account_index=account_index, authorization=authorization, - auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -594,7 +590,6 @@ def _account_limits_serialize( self, account_index, authorization, - auth, _request_auth, _content_type, _headers, @@ -610,7 +605,9 @@ def _account_limits_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -619,15 +616,9 @@ def _account_limits_serialize( _query_params.append(('account_index', account_index)) - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - 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 @@ -663,12 +654,12 @@ def _account_limits_serialize( + @validate_call async def account_metadata( self, by: StrictStr, value: StrictStr, authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -693,8 +684,6 @@ async def account_metadata( :type value: str :param authorization: :type authorization: str - :param auth: - :type auth: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -723,7 +712,6 @@ async def account_metadata( by=by, value=value, authorization=authorization, - auth=auth, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -746,12 +734,12 @@ async def account_metadata( ).data + @validate_call async def account_metadata_with_http_info( self, by: StrictStr, value: StrictStr, authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -776,8 +764,6 @@ async def account_metadata_with_http_info( :type value: str :param authorization: :type authorization: str - :param auth: - :type auth: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -806,7 +792,6 @@ async def account_metadata_with_http_info( by=by, value=value, authorization=authorization, - auth=auth, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -829,12 +814,12 @@ async def account_metadata_with_http_info( ) + @validate_call async def account_metadata_without_preload_content( self, by: StrictStr, value: StrictStr, authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, _request_timeout: Union[ None, @@ -859,8 +844,6 @@ async def account_metadata_without_preload_content( :type value: str :param authorization: :type authorization: str - :param auth: - :type auth: str :param cursor: :type cursor: str :param _request_timeout: timeout setting for this request. If one @@ -889,7 +872,6 @@ async def account_metadata_without_preload_content( by=by, value=value, authorization=authorization, - auth=auth, cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, @@ -913,7 +895,6 @@ def _account_metadata_serialize( by, value, authorization, - auth, cursor, _request_auth, _content_type, @@ -930,7 +911,9 @@ def _account_metadata_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -943,10 +926,6 @@ def _account_metadata_serialize( _query_params.append(('value', value)) - if auth is not None: - - _query_params.append(('auth', auth)) - if cursor is not None: _query_params.append(('cursor', cursor)) @@ -989,6 +968,7 @@ def _account_metadata_serialize( + @validate_call async def accounts_by_l1_address( self, l1_address: StrictStr, @@ -1008,7 +988,7 @@ async def accounts_by_l1_address( ) -> SubAccounts: """accountsByL1Address - Get accounts by l1_address returns all accounts associated with the given L1 address + Returns all accounts associated with the given L1 address :param l1_address: (required) :type l1_address: str @@ -1060,6 +1040,7 @@ async def accounts_by_l1_address( ).data + @validate_call async def accounts_by_l1_address_with_http_info( self, l1_address: StrictStr, @@ -1079,7 +1060,7 @@ async def accounts_by_l1_address_with_http_info( ) -> ApiResponse[SubAccounts]: """accountsByL1Address - Get accounts by l1_address returns all accounts associated with the given L1 address + Returns all accounts associated with the given L1 address :param l1_address: (required) :type l1_address: str @@ -1131,6 +1112,7 @@ async def accounts_by_l1_address_with_http_info( ) + @validate_call async def accounts_by_l1_address_without_preload_content( self, l1_address: StrictStr, @@ -1150,7 +1132,7 @@ async def accounts_by_l1_address_without_preload_content( ) -> RESTResponseType: """accountsByL1Address - Get accounts by l1_address returns all accounts associated with the given L1 address + Returns all accounts associated with the given L1 address :param l1_address: (required) :type l1_address: str @@ -1217,7 +1199,9 @@ def _accounts_by_l1_address_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1266,6 +1250,7 @@ def _accounts_by_l1_address_serialize( + @validate_call async def apikeys( self, account_index: StrictInt, @@ -1337,6 +1322,7 @@ async def apikeys( ).data + @validate_call async def apikeys_with_http_info( self, account_index: StrictInt, @@ -1408,6 +1394,7 @@ async def apikeys_with_http_info( ) + @validate_call async def apikeys_without_preload_content( self, account_index: StrictInt, @@ -1494,7 +1481,9 @@ def _apikeys_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1543,6 +1532,7 @@ def _apikeys_serialize( + @validate_call async def change_account_tier( self, account_index: StrictInt, @@ -1564,7 +1554,7 @@ async def change_account_tier( ) -> RespChangeAccountTier: """changeAccountTier - Change account tier + Change account tier. You can only perform this action once every 24 hours, and with no orders or positions open. :param account_index: (required) :type account_index: int @@ -1622,6 +1612,7 @@ async def change_account_tier( ).data + @validate_call async def change_account_tier_with_http_info( self, account_index: StrictInt, @@ -1643,7 +1634,7 @@ async def change_account_tier_with_http_info( ) -> ApiResponse[RespChangeAccountTier]: """changeAccountTier - Change account tier + Change account tier. You can only perform this action once every 24 hours, and with no orders or positions open. :param account_index: (required) :type account_index: int @@ -1701,6 +1692,7 @@ async def change_account_tier_with_http_info( ) + @validate_call async def change_account_tier_without_preload_content( self, account_index: StrictInt, @@ -1722,7 +1714,7 @@ async def change_account_tier_without_preload_content( ) -> RESTResponseType: """changeAccountTier - Change account tier + Change account tier. You can only perform this action once every 24 hours, and with no orders or positions open. :param account_index: (required) :type account_index: int @@ -1797,7 +1789,9 @@ def _change_account_tier_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1830,7 +1824,7 @@ def _change_account_tier_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'multipart/form-data' + 'application/x-www-form-urlencoded' ] ) ) @@ -1859,10 +1853,11 @@ def _change_account_tier_serialize( - async def faucet( + @validate_call + async def get_maker_only_api_keys( self, - l1_address: StrictStr, - do_l1_transfer: StrictBool, + authorization: StrictStr, + account_index: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1875,15 +1870,15 @@ async def faucet( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ResultCode: - """faucet + ) -> RespGetMakerOnlyApiKeys: + """getMakerOnlyApiKeys - Request funds from faucet + Get maker-only API key indexes - :param l1_address: (required) - :type l1_address: str - :param do_l1_transfer: (required) - :type do_l1_transfer: bool + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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 @@ -1906,9 +1901,9 @@ async def faucet( :return: Returns the result object. """ # noqa: E501 - _param = self._faucet_serialize( - l1_address=l1_address, - do_l1_transfer=do_l1_transfer, + _param = self._get_maker_only_api_keys_serialize( + authorization=authorization, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1916,7 +1911,7 @@ async def faucet( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ResultCode", + '200': "RespGetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1930,10 +1925,11 @@ async def faucet( ).data - async def faucet_with_http_info( + @validate_call + async def get_maker_only_api_keys_with_http_info( self, - l1_address: StrictStr, - do_l1_transfer: StrictBool, + authorization: StrictStr, + account_index: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1946,15 +1942,15 @@ async def faucet_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[ResultCode]: - """faucet + ) -> ApiResponse[RespGetMakerOnlyApiKeys]: + """getMakerOnlyApiKeys - Request funds from faucet + Get maker-only API key indexes - :param l1_address: (required) - :type l1_address: str - :param do_l1_transfer: (required) - :type do_l1_transfer: bool + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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 @@ -1977,9 +1973,9 @@ async def faucet_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._faucet_serialize( - l1_address=l1_address, - do_l1_transfer=do_l1_transfer, + _param = self._get_maker_only_api_keys_serialize( + authorization=authorization, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1987,7 +1983,7 @@ async def faucet_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ResultCode", + '200': "RespGetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2001,10 +1997,11 @@ async def faucet_with_http_info( ) - async def faucet_without_preload_content( + @validate_call + async def get_maker_only_api_keys_without_preload_content( self, - l1_address: StrictStr, - do_l1_transfer: StrictBool, + authorization: StrictStr, + account_index: StrictInt, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2018,14 +2015,14 @@ async def faucet_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """faucet + """getMakerOnlyApiKeys - Request funds from faucet + Get maker-only API key indexes - :param l1_address: (required) - :type l1_address: str - :param do_l1_transfer: (required) - :type do_l1_transfer: bool + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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 @@ -2048,9 +2045,9 @@ async def faucet_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._faucet_serialize( - l1_address=l1_address, - do_l1_transfer=do_l1_transfer, + _param = self._get_maker_only_api_keys_serialize( + authorization=authorization, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2058,7 +2055,7 @@ async def faucet_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "ResultCode", + '200': "RespGetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2068,10 +2065,10 @@ async def faucet_without_preload_content( return response_data.response - def _faucet_serialize( + def _get_maker_only_api_keys_serialize( self, - l1_address, - do_l1_transfer, + authorization, + account_index, _request_auth, _content_type, _headers, @@ -2087,20 +2084,20 @@ def _faucet_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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)) - - if do_l1_transfer is not None: + if account_index is not None: - _query_params.append(('do_l1_transfer', do_l1_transfer)) + _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 @@ -2120,7 +2117,7 @@ def _faucet_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/faucet', + resource_path='/api/v1/getMakerOnlyApiKeys', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2136,11 +2133,11 @@ def _faucet_serialize( - async def get_maker_only_api_keys( + @validate_call + async def l1_metadata( self, - account_index: StrictInt, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, + authorization: StrictStr, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2153,17 +2150,15 @@ async def get_maker_only_api_keys( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetMakerOnlyApiKeys: - """getMakerOnlyApiKeys + ) -> L1Metadata: + """l1Metadata - Get maker-only API key indexes + Get L1 metadata - :param account_index: (required) - :type account_index: int - :param authorization: + :param authorization: (required) :type authorization: str - :param auth: - :type auth: str + :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 @@ -2186,10 +2181,9 @@ async def get_maker_only_api_keys( :return: Returns the result object. """ # noqa: E501 - _param = self._get_maker_only_api_keys_serialize( - account_index=account_index, + _param = self._l1_metadata_serialize( authorization=authorization, - auth=auth, + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2197,7 +2191,7 @@ async def get_maker_only_api_keys( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetMakerOnlyApiKeys", + '200': "L1Metadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2211,11 +2205,11 @@ async def get_maker_only_api_keys( ).data - async def get_maker_only_api_keys_with_http_info( + @validate_call + async def l1_metadata_with_http_info( self, - account_index: StrictInt, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, + authorization: StrictStr, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2228,17 +2222,15 @@ async def get_maker_only_api_keys_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetMakerOnlyApiKeys]: - """getMakerOnlyApiKeys + ) -> ApiResponse[L1Metadata]: + """l1Metadata - Get maker-only API key indexes + Get L1 metadata - :param account_index: (required) - :type account_index: int - :param authorization: + :param authorization: (required) :type authorization: str - :param auth: - :type auth: str + :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 @@ -2261,10 +2253,9 @@ async def get_maker_only_api_keys_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._get_maker_only_api_keys_serialize( - account_index=account_index, + _param = self._l1_metadata_serialize( authorization=authorization, - auth=auth, + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2272,7 +2263,7 @@ async def get_maker_only_api_keys_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetMakerOnlyApiKeys", + '200': "L1Metadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2286,11 +2277,11 @@ async def get_maker_only_api_keys_with_http_info( ) - async def get_maker_only_api_keys_without_preload_content( + @validate_call + async def l1_metadata_without_preload_content( self, - account_index: StrictInt, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, + authorization: StrictStr, + l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2304,16 +2295,14 @@ async def get_maker_only_api_keys_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """getMakerOnlyApiKeys + """l1Metadata - Get maker-only API key indexes + Get L1 metadata - :param account_index: (required) - :type account_index: int - :param authorization: + :param authorization: (required) :type authorization: str - :param auth: - :type auth: str + :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 @@ -2336,10 +2325,9 @@ async def get_maker_only_api_keys_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._get_maker_only_api_keys_serialize( - account_index=account_index, + _param = self._l1_metadata_serialize( authorization=authorization, - auth=auth, + l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2347,7 +2335,7 @@ async def get_maker_only_api_keys_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetMakerOnlyApiKeys", + '200': "L1Metadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2357,11 +2345,10 @@ async def get_maker_only_api_keys_without_preload_content( return response_data.response - def _get_maker_only_api_keys_serialize( + def _l1_metadata_serialize( self, - account_index, authorization, - auth, + l1_address, _request_auth, _content_type, _headers, @@ -2377,18 +2364,16 @@ def _get_maker_only_api_keys_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 account_index is not None: + if l1_address is not None: - _query_params.append(('account_index', account_index)) + _query_params.append(('l1_address', l1_address)) # process the header parameters if authorization is not None: @@ -2412,7 +2397,7 @@ def _get_maker_only_api_keys_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/getMakerOnlyApiKeys', + resource_path='/api/v1/l1Metadata', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2428,11 +2413,9 @@ def _get_maker_only_api_keys_serialize( - async def l1_metadata( + @validate_call + async def lease_options( self, - l1_address: StrictStr, - 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)], @@ -2445,17 +2428,11 @@ async def l1_metadata( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> L1Metadata: - """l1Metadata + ) -> RespGetLeaseOptions: + """leaseOptions - Get L1 metadata + Returns available lease duration/rate tiers, sorted by duration descending. - :param l1_address: (required) - :type l1_address: str - :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 @@ -2478,10 +2455,7 @@ async def l1_metadata( :return: Returns the result object. """ # noqa: E501 - _param = self._l1_metadata_serialize( - l1_address=l1_address, - authorization=authorization, - auth=auth, + _param = self._lease_options_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2489,7 +2463,7 @@ async def l1_metadata( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "L1Metadata", + '200': "RespGetLeaseOptions", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2503,11 +2477,9 @@ async def l1_metadata( ).data - async def l1_metadata_with_http_info( + @validate_call + async def lease_options_with_http_info( self, - l1_address: StrictStr, - 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)], @@ -2520,17 +2492,11 @@ async def l1_metadata_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[L1Metadata]: - """l1Metadata + ) -> ApiResponse[RespGetLeaseOptions]: + """leaseOptions - Get L1 metadata + Returns available lease duration/rate tiers, sorted by duration descending. - :param l1_address: (required) - :type l1_address: str - :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 @@ -2553,10 +2519,7 @@ async def l1_metadata_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._l1_metadata_serialize( - l1_address=l1_address, - authorization=authorization, - auth=auth, + _param = self._lease_options_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2564,7 +2527,7 @@ async def l1_metadata_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "L1Metadata", + '200': "RespGetLeaseOptions", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2578,11 +2541,9 @@ async def l1_metadata_with_http_info( ) - async def l1_metadata_without_preload_content( + @validate_call + async def lease_options_without_preload_content( self, - l1_address: StrictStr, - 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)], @@ -2596,16 +2557,10 @@ async def l1_metadata_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """l1Metadata + """leaseOptions - Get L1 metadata + Returns available lease duration/rate tiers, sorted by duration descending. - :param l1_address: (required) - :type l1_address: str - :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 @@ -2628,10 +2583,7 @@ async def l1_metadata_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._l1_metadata_serialize( - l1_address=l1_address, - authorization=authorization, - auth=auth, + _param = self._lease_options_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2639,7 +2591,7 @@ async def l1_metadata_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "L1Metadata", + '200': "RespGetLeaseOptions", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2649,11 +2601,8 @@ async def l1_metadata_without_preload_content( return response_data.response - def _l1_metadata_serialize( + def _lease_options_serialize( self, - l1_address, - authorization, - auth, _request_auth, _content_type, _headers, @@ -2669,22 +2618,14 @@ def _l1_metadata_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 l1_address is not None: - - _query_params.append(('l1_address', l1_address)) - # process the header parameters - if authorization is not None: - _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -2704,7 +2645,7 @@ def _l1_metadata_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/l1Metadata', + resource_path='/api/v1/leaseOptions', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2720,8 +2661,14 @@ def _l1_metadata_serialize( - async def lease_options( + @validate_call + async def leases( self, + account_index: Annotated[StrictInt, Field(description="Account index to fetch leases for")], + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + cursor: Annotated[Optional[StrictStr], Field(description="Pagination cursor from a previous response")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of results to return (1–100, default 20)")] = None, + auth: Annotated[Optional[StrictStr], Field(description="Read-only auth (alternative to header authorization)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2734,11 +2681,21 @@ async def lease_options( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetLeaseOptions: - """leaseOptions + ) -> RespGetLeases: + """leases - Get lease options + Returns paginated lease entries for an account, most recent first. Supports read-only auth via signature/account_index/timestamp query params. + :param account_index: Account index to fetch leases for (required) + :type account_index: int + :param authorization: API token authorization + :type authorization: str + :param cursor: Pagination cursor from a previous response + :type cursor: str + :param limit: Number of results to return (1–100, default 20) + :type limit: int + :param auth: Read-only auth (alternative to header authorization) + :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 @@ -2761,7 +2718,12 @@ async def lease_options( :return: Returns the result object. """ # noqa: E501 - _param = self._lease_options_serialize( + _param = self._leases_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + limit=limit, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2769,7 +2731,7 @@ async def lease_options( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeaseOptions", + '200': "RespGetLeases", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2783,8 +2745,14 @@ async def lease_options( ).data - async def lease_options_with_http_info( + @validate_call + async def leases_with_http_info( self, + account_index: Annotated[StrictInt, Field(description="Account index to fetch leases for")], + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + cursor: Annotated[Optional[StrictStr], Field(description="Pagination cursor from a previous response")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of results to return (1–100, default 20)")] = None, + auth: Annotated[Optional[StrictStr], Field(description="Read-only auth (alternative to header authorization)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2797,11 +2765,21 @@ async def lease_options_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetLeaseOptions]: - """leaseOptions + ) -> ApiResponse[RespGetLeases]: + """leases - Get lease options + Returns paginated lease entries for an account, most recent first. Supports read-only auth via signature/account_index/timestamp query params. + :param account_index: Account index to fetch leases for (required) + :type account_index: int + :param authorization: API token authorization + :type authorization: str + :param cursor: Pagination cursor from a previous response + :type cursor: str + :param limit: Number of results to return (1–100, default 20) + :type limit: int + :param auth: Read-only auth (alternative to header authorization) + :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 @@ -2824,7 +2802,12 @@ async def lease_options_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._lease_options_serialize( + _param = self._leases_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + limit=limit, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2832,7 +2815,7 @@ async def lease_options_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeaseOptions", + '200': "RespGetLeases", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2846,8 +2829,14 @@ async def lease_options_with_http_info( ) - async def lease_options_without_preload_content( + @validate_call + async def leases_without_preload_content( self, + account_index: Annotated[StrictInt, Field(description="Account index to fetch leases for")], + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + cursor: Annotated[Optional[StrictStr], Field(description="Pagination cursor from a previous response")] = None, + limit: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Number of results to return (1–100, default 20)")] = None, + auth: Annotated[Optional[StrictStr], Field(description="Read-only auth (alternative to header authorization)")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2861,10 +2850,20 @@ async def lease_options_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """leaseOptions + """leases - Get lease options + Returns paginated lease entries for an account, most recent first. Supports read-only auth via signature/account_index/timestamp query params. + :param account_index: Account index to fetch leases for (required) + :type account_index: int + :param authorization: API token authorization + :type authorization: str + :param cursor: Pagination cursor from a previous response + :type cursor: str + :param limit: Number of results to return (1–100, default 20) + :type limit: int + :param auth: Read-only auth (alternative to header authorization) + :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 @@ -2887,7 +2886,12 @@ async def lease_options_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._lease_options_serialize( + _param = self._leases_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + limit=limit, + auth=auth, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2895,7 +2899,7 @@ async def lease_options_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeaseOptions", + '200': "RespGetLeases", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2905,8 +2909,13 @@ async def lease_options_without_preload_content( return response_data.response - def _lease_options_serialize( + def _leases_serialize( self, + account_index, + authorization, + cursor, + limit, + auth, _request_auth, _content_type, _headers, @@ -2922,12 +2931,32 @@ def _lease_options_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 cursor is not None: + + _query_params.append(('cursor', cursor)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + 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 @@ -2947,7 +2976,7 @@ def _lease_options_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/leaseOptions', + resource_path='/api/v1/leases', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2963,13 +2992,14 @@ def _lease_options_serialize( - async def leases( + @validate_call + async def liquidations( self, + authorization: StrictStr, account_index: 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, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, cursor: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2982,21 +3012,21 @@ async def leases( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetLeases: - """leases + ) -> LiquidationInfos: + """liquidations - Get leases + Get liquidation infos + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 limit: (required) + :type limit: int + :param market_id: + :type market_id: int :param cursor: :type cursor: str - :param limit: - :type limit: 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 @@ -3019,12 +3049,12 @@ async def leases( :return: Returns the result object. """ # noqa: E501 - _param = self._leases_serialize( - account_index=account_index, + _param = self._liquidations_serialize( authorization=authorization, - auth=auth, - cursor=cursor, + account_index=account_index, limit=limit, + market_id=market_id, + cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3032,7 +3062,7 @@ async def leases( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeases", + '200': "LiquidationInfos", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3046,13 +3076,14 @@ async def leases( ).data - async def leases_with_http_info( + @validate_call + async def liquidations_with_http_info( self, + authorization: StrictStr, account_index: 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, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, cursor: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3065,21 +3096,21 @@ async def leases_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetLeases]: - """leases + ) -> ApiResponse[LiquidationInfos]: + """liquidations - Get leases + Get liquidation infos + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 limit: (required) + :type limit: int + :param market_id: + :type market_id: int :param cursor: :type cursor: str - :param limit: - :type limit: 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 @@ -3102,12 +3133,12 @@ async def leases_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._leases_serialize( - account_index=account_index, + _param = self._liquidations_serialize( authorization=authorization, - auth=auth, - cursor=cursor, + account_index=account_index, limit=limit, + market_id=market_id, + cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3115,7 +3146,7 @@ async def leases_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeases", + '200': "LiquidationInfos", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3129,13 +3160,14 @@ async def leases_with_http_info( ) - async def leases_without_preload_content( + @validate_call + async def liquidations_without_preload_content( self, + authorization: StrictStr, account_index: 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, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + market_id: Optional[StrictInt] = None, cursor: Optional[StrictStr] = None, - limit: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3149,20 +3181,20 @@ async def leases_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """leases + """liquidations - Get leases + Get liquidation infos + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 limit: (required) + :type limit: int + :param market_id: + :type market_id: int :param cursor: :type cursor: str - :param limit: - :type limit: 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 @@ -3185,12 +3217,12 @@ async def leases_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._leases_serialize( - account_index=account_index, + _param = self._liquidations_serialize( authorization=authorization, - auth=auth, - cursor=cursor, + account_index=account_index, limit=limit, + market_id=market_id, + cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3198,7 +3230,7 @@ async def leases_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetLeases", + '200': "LiquidationInfos", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3208,13 +3240,13 @@ async def leases_without_preload_content( return response_data.response - def _leases_serialize( + def _liquidations_serialize( self, - account_index, authorization, - auth, - cursor, + account_index, limit, + market_id, + cursor, _request_auth, _content_type, _headers, @@ -3230,23 +3262,21 @@ def _leases_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - 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 cursor is not None: _query_params.append(('cursor', cursor)) @@ -3256,6 +3286,8 @@ def _leases_serialize( _query_params.append(('limit', limit)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -3275,7 +3307,7 @@ def _leases_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/leases', + resource_path='/api/v1/liquidations', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3291,14 +3323,13 @@ def _leases_serialize( - async def liquidations( + @validate_call + async def lit_lease( self, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + tx_info: Annotated[Optional[StrictStr], Field(description="Signed transaction info (JSON with L2 signature, L1 signature, etc.)")] = None, + lease_amount: Annotated[Optional[StrictStr], Field(description="Amount of LIT to lease in raw units (1 LIT = 100000000)")] = None, + duration_days: Annotated[Optional[StrictInt], Field(description="Lease duration in days. Must match one of the available lease options.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3311,23 +3342,19 @@ async def liquidations( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> LiquidationInfos: - """liquidations + ) -> TxHash: + """litLease - Get liquidation infos + Submit a LIT lease transfer. The server calculates the required fee based on lease_amount and duration_days, then executes the transfer. Fee formula (integer arithmetic): fee = lease_amount × (annual_rate × 100) × duration_days / (360 × 10000). - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param authorization: make required after integ is done + :param authorization: API token authorization :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param market_id: - :type market_id: int - :param cursor: - :type cursor: str + :param tx_info: Signed transaction info (JSON with L2 signature, L1 signature, etc.) + :type tx_info: str + :param lease_amount: Amount of LIT to lease in raw units (1 LIT = 100000000) + :type lease_amount: str + :param duration_days: Lease duration in days. Must match one of the available lease options. + :type duration_days: 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 @@ -3350,13 +3377,11 @@ async def liquidations( :return: Returns the result object. """ # noqa: E501 - _param = self._liquidations_serialize( - account_index=account_index, - limit=limit, + _param = self._lit_lease_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, + tx_info=tx_info, + lease_amount=lease_amount, + duration_days=duration_days, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3364,7 +3389,7 @@ async def liquidations( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LiquidationInfos", + '200': "TxHash", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3378,14 +3403,13 @@ async def liquidations( ).data - async def liquidations_with_http_info( + @validate_call + async def lit_lease_with_http_info( self, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + tx_info: Annotated[Optional[StrictStr], Field(description="Signed transaction info (JSON with L2 signature, L1 signature, etc.)")] = None, + lease_amount: Annotated[Optional[StrictStr], Field(description="Amount of LIT to lease in raw units (1 LIT = 100000000)")] = None, + duration_days: Annotated[Optional[StrictInt], Field(description="Lease duration in days. Must match one of the available lease options.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3398,23 +3422,19 @@ async def liquidations_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[LiquidationInfos]: - """liquidations + ) -> ApiResponse[TxHash]: + """litLease - Get liquidation infos + Submit a LIT lease transfer. The server calculates the required fee based on lease_amount and duration_days, then executes the transfer. Fee formula (integer arithmetic): fee = lease_amount × (annual_rate × 100) × duration_days / (360 × 10000). - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param authorization: make required after integ is done + :param authorization: API token authorization :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param market_id: - :type market_id: int - :param cursor: - :type cursor: str + :param tx_info: Signed transaction info (JSON with L2 signature, L1 signature, etc.) + :type tx_info: str + :param lease_amount: Amount of LIT to lease in raw units (1 LIT = 100000000) + :type lease_amount: str + :param duration_days: Lease duration in days. Must match one of the available lease options. + :type duration_days: 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 @@ -3437,13 +3457,11 @@ async def liquidations_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._liquidations_serialize( - account_index=account_index, - limit=limit, + _param = self._lit_lease_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, + tx_info=tx_info, + lease_amount=lease_amount, + duration_days=duration_days, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3451,7 +3469,7 @@ async def liquidations_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LiquidationInfos", + '200': "TxHash", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3465,14 +3483,13 @@ async def liquidations_with_http_info( ) - async def liquidations_without_preload_content( + @validate_call + async def lit_lease_without_preload_content( self, - account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, + authorization: Annotated[Optional[StrictStr], Field(description="API token authorization")] = None, + tx_info: Annotated[Optional[StrictStr], Field(description="Signed transaction info (JSON with L2 signature, L1 signature, etc.)")] = None, + lease_amount: Annotated[Optional[StrictStr], Field(description="Amount of LIT to lease in raw units (1 LIT = 100000000)")] = None, + duration_days: Annotated[Optional[StrictInt], Field(description="Lease duration in days. Must match one of the available lease options.")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3486,22 +3503,18 @@ async def liquidations_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """liquidations + """litLease - Get liquidation infos + Submit a LIT lease transfer. The server calculates the required fee based on lease_amount and duration_days, then executes the transfer. Fee formula (integer arithmetic): fee = lease_amount × (annual_rate × 100) × duration_days / (360 × 10000). - :param account_index: (required) - :type account_index: int - :param limit: (required) - :type limit: int - :param authorization: make required after integ is done + :param authorization: API token authorization :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param market_id: - :type market_id: int - :param cursor: - :type cursor: str + :param tx_info: Signed transaction info (JSON with L2 signature, L1 signature, etc.) + :type tx_info: str + :param lease_amount: Amount of LIT to lease in raw units (1 LIT = 100000000) + :type lease_amount: str + :param duration_days: Lease duration in days. Must match one of the available lease options. + :type duration_days: 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 @@ -3524,13 +3537,11 @@ async def liquidations_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._liquidations_serialize( - account_index=account_index, - limit=limit, + _param = self._lit_lease_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, + tx_info=tx_info, + lease_amount=lease_amount, + duration_days=duration_days, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3538,7 +3549,7 @@ async def liquidations_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "LiquidationInfos", + '200': "TxHash", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3548,14 +3559,12 @@ async def liquidations_without_preload_content( return response_data.response - def _liquidations_serialize( + def _lit_lease_serialize( self, - account_index, - limit, authorization, - auth, - market_id, - cursor, + tx_info, + lease_amount, + duration_days, _request_auth, _content_type, _headers, @@ -3571,37 +3580,23 @@ def _liquidations_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - - 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 cursor is not None: - - _query_params.append(('cursor', cursor)) - - if limit is not None: - - _query_params.append(('limit', limit)) - # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters + if tx_info is not None: + _form_params.append(('tx_info', tx_info)) + if lease_amount is not None: + _form_params.append(('lease_amount', lease_amount)) + if duration_days is not None: + _form_params.append(('duration_days', duration_days)) # process the body parameter @@ -3613,14 +3608,27 @@ def _liquidations_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/liquidations', + method='POST', + resource_path='/api/v1/litLease', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3636,12 +3644,12 @@ def _liquidations_serialize( - async def lit_lease( + @validate_call + async def partner_stats( self, - tx_info: StrictStr, - lease_amount: StrictStr, - duration_days: StrictInt, - authorization: Optional[StrictStr] = None, + account_index: StrictInt, + start_timestamp: Optional[StrictInt] = None, + end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3654,19 +3662,17 @@ async def lit_lease( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> TxHash: - """litLease + ) -> PartnerStats: + """partnerStats - Submit LIT lease transfer + Get partner stats. If timestamps are not provided, all-time stats will be returned. - :param tx_info: (required) - :type tx_info: str - :param lease_amount: (required) - :type lease_amount: str - :param duration_days: (required) - :type duration_days: int - :param authorization: - :type authorization: str + :param account_index: (required) + :type account_index: int + :param start_timestamp: + :type start_timestamp: int + :param end_timestamp: + :type end_timestamp: 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 @@ -3689,11 +3695,10 @@ async def lit_lease( :return: Returns the result object. """ # noqa: E501 - _param = self._lit_lease_serialize( - tx_info=tx_info, - lease_amount=lease_amount, - duration_days=duration_days, - authorization=authorization, + _param = self._partner_stats_serialize( + account_index=account_index, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3701,7 +3706,7 @@ async def lit_lease( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TxHash", + '200': "PartnerStats", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3715,12 +3720,12 @@ async def lit_lease( ).data - async def lit_lease_with_http_info( + @validate_call + async def partner_stats_with_http_info( self, - tx_info: StrictStr, - lease_amount: StrictStr, - duration_days: StrictInt, - authorization: Optional[StrictStr] = None, + account_index: StrictInt, + start_timestamp: Optional[StrictInt] = None, + end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3733,19 +3738,17 @@ async def lit_lease_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[TxHash]: - """litLease + ) -> ApiResponse[PartnerStats]: + """partnerStats - Submit LIT lease transfer + Get partner stats. If timestamps are not provided, all-time stats will be returned. - :param tx_info: (required) - :type tx_info: str - :param lease_amount: (required) - :type lease_amount: str - :param duration_days: (required) - :type duration_days: int - :param authorization: - :type authorization: str + :param account_index: (required) + :type account_index: int + :param start_timestamp: + :type start_timestamp: int + :param end_timestamp: + :type end_timestamp: 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 @@ -3768,11 +3771,10 @@ async def lit_lease_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._lit_lease_serialize( - tx_info=tx_info, - lease_amount=lease_amount, - duration_days=duration_days, - authorization=authorization, + _param = self._partner_stats_serialize( + account_index=account_index, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3780,7 +3782,7 @@ async def lit_lease_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TxHash", + '200': "PartnerStats", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3794,12 +3796,12 @@ async def lit_lease_with_http_info( ) - async def lit_lease_without_preload_content( + @validate_call + async def partner_stats_without_preload_content( self, - tx_info: StrictStr, - lease_amount: StrictStr, - duration_days: StrictInt, - authorization: Optional[StrictStr] = None, + account_index: StrictInt, + start_timestamp: Optional[StrictInt] = None, + end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -3813,18 +3815,16 @@ async def lit_lease_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """litLease + """partnerStats - Submit LIT lease transfer + Get partner stats. If timestamps are not provided, all-time stats will be returned. - :param tx_info: (required) - :type tx_info: str - :param lease_amount: (required) - :type lease_amount: str - :param duration_days: (required) - :type duration_days: int - :param authorization: - :type authorization: str + :param account_index: (required) + :type account_index: int + :param start_timestamp: + :type start_timestamp: int + :param end_timestamp: + :type end_timestamp: 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 @@ -3847,11 +3847,10 @@ async def lit_lease_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._lit_lease_serialize( - tx_info=tx_info, - lease_amount=lease_amount, - duration_days=duration_days, - authorization=authorization, + _param = self._partner_stats_serialize( + account_index=account_index, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -3859,7 +3858,7 @@ async def lit_lease_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TxHash", + '200': "PartnerStats", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -3869,12 +3868,11 @@ async def lit_lease_without_preload_content( return response_data.response - def _lit_lease_serialize( + def _partner_stats_serialize( self, - tx_info, - lease_amount, - duration_days, - authorization, + account_index, + start_timestamp, + end_timestamp, _request_auth, _content_type, _headers, @@ -3890,21 +3888,27 @@ def _lit_lease_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 start_timestamp is not None: + + _query_params.append(('start_timestamp', start_timestamp)) + + if end_timestamp is not None: + + _query_params.append(('end_timestamp', end_timestamp)) + # process the header parameters - if authorization is not None: - _header_params['authorization'] = authorization # process the form parameters - if tx_info is not None: - _form_params.append(('tx_info', tx_info)) - if lease_amount is not None: - _form_params.append(('lease_amount', lease_amount)) - if duration_days is not None: - _form_params.append(('duration_days', duration_days)) # process the body parameter @@ -3916,27 +3920,14 @@ def _lit_lease_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'multipart/form-data' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/litLease', + method='GET', + resource_path='/api/v1/partnerStats', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -3952,34 +3943,50 @@ def _lit_lease_serialize( - async def partner_stats( - self, - account_index: StrictInt, - start_timestamp: Optional[StrictInt] = None, - end_timestamp: Optional[StrictInt] = None, - _request_timeout: Union[ - None, + @validate_call + async def pnl( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ 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, - ) -> PartnerStats: - """partnerStats + 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, + ) -> AccountPnL: + """pnl - Get partner stats + Get account PnL chart - :param account_index: (required) - :type account_index: int - :param start_timestamp: + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) :type start_timestamp: int - :param end_timestamp: + :param end_timestamp: (required) :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param ignore_transfers: + :type ignore_transfers: bool :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 @@ -4000,12 +4007,17 @@ async def partner_stats( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 + """ # noqa: E501 - _param = self._partner_stats_serialize( - account_index=account_index, + _param = self._pnl_serialize( + by=by, + value=value, + resolution=resolution, start_timestamp=start_timestamp, end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + ignore_transfers=ignore_transfers, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4013,7 +4025,7 @@ async def partner_stats( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PartnerStats", + '200': "AccountPnL", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4026,34 +4038,419 @@ async def partner_stats( response_types_map=_response_types_map, ).data - async def partner_stats_with_http_info( - self, - account_index: StrictInt, - start_timestamp: Optional[StrictInt] = None, - end_timestamp: Optional[StrictInt] = None, - _request_timeout: Union[ - None, + + @validate_call + async def pnl_with_http_info( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = 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[AccountPnL]: + """pnl + + Get account PnL chart + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) + :type start_timestamp: int + :param end_timestamp: (required) + :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param ignore_transfers: + :type ignore_transfers: bool + :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._pnl_serialize( + by=by, + value=value, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + ignore_transfers=ignore_transfers, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountPnL", + '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 pnl_without_preload_content( + self, + by: StrictStr, + value: StrictStr, + resolution: StrictStr, + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], + count_back: StrictInt, + authorization: Optional[StrictStr] = None, + ignore_transfers: Optional[StrictBool] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ Annotated[StrictFloat, Field(gt=0)], - Tuple[ - Annotated[StrictFloat, Field(gt=0)], - 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: + """pnl + + Get account PnL chart + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param resolution: (required) + :type resolution: str + :param start_timestamp: (required) + :type start_timestamp: int + :param end_timestamp: (required) + :type end_timestamp: int + :param count_back: (required) + :type count_back: int + :param authorization: + :type authorization: str + :param ignore_transfers: + :type ignore_transfers: bool + :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._pnl_serialize( + by=by, + value=value, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + authorization=authorization, + ignore_transfers=ignore_transfers, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "AccountPnL", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _pnl_serialize( + self, + by, + value, + resolution, + start_timestamp, + end_timestamp, + count_back, + authorization, + ignore_transfers, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + if resolution is not None: + + _query_params.append(('resolution', resolution)) + + if start_timestamp is not None: + + _query_params.append(('start_timestamp', start_timestamp)) + + if end_timestamp is not None: + + _query_params.append(('end_timestamp', end_timestamp)) + + if count_back is not None: + + _query_params.append(('count_back', count_back)) + + if ignore_transfers is not None: + + _query_params.append(('ignore_transfers', ignore_transfers)) + + # 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' ] - ] = 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[PartnerStats]: - """partnerStats + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/pnl', + 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 position_funding( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: Optional[StrictStr] = 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, + ) -> PositionFundings: + """positionFunding + + Get accounts position fundings + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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._position_funding_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + market_id=market_id, + cursor=cursor, + side=side, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PositionFundings", + '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 position_funding_with_http_info( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: Optional[StrictStr] = 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[PositionFundings]: + """positionFunding - Get partner stats + Get accounts position fundings :param account_index: (required) :type account_index: int - :param start_timestamp: - :type start_timestamp: int - :param end_timestamp: - :type end_timestamp: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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 @@ -4074,12 +4471,15 @@ async def partner_stats_with_http_info( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 + """ # noqa: E501 - _param = self._partner_stats_serialize( + _param = self._position_funding_serialize( account_index=account_index, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, + limit=limit, + authorization=authorization, + market_id=market_id, + cursor=cursor, + side=side, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4087,7 +4487,7 @@ async def partner_stats_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PartnerStats", + '200': "PositionFundings", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4100,34 +4500,45 @@ async def partner_stats_with_http_info( response_types_map=_response_types_map, ) - async def partner_stats_without_preload_content( - self, - account_index: StrictInt, - start_timestamp: Optional[StrictInt] = None, - end_timestamp: Optional[StrictInt] = None, - _request_timeout: Union[ - None, + + @validate_call + async def position_funding_without_preload_content( + self, + account_index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + cursor: Optional[StrictStr] = None, + side: Optional[StrictStr] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ 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, + 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: - """partnerStats + """positionFunding - Get partner stats + Get accounts position fundings :param account_index: (required) :type account_index: int - :param start_timestamp: - :type start_timestamp: int - :param end_timestamp: - :type end_timestamp: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param market_id: + :type market_id: int + :param cursor: + :type cursor: str + :param side: + :type side: 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 @@ -4148,12 +4559,15 @@ async def partner_stats_without_preload_content( in the spec for a single request. :type _host_index: int, optional :return: Returns the result object. - """ # noqa: E501 + """ # noqa: E501 - _param = self._partner_stats_serialize( + _param = self._position_funding_serialize( account_index=account_index, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, + limit=limit, + authorization=authorization, + market_id=market_id, + cursor=cursor, + side=side, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4161,7 +4575,7 @@ async def partner_stats_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PartnerStats", + '200': "PositionFundings", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4170,15 +4584,19 @@ async def partner_stats_without_preload_content( ) return response_data.response - def _partner_stats_serialize( - self, - account_index, - start_timestamp, - end_timestamp, - _request_auth, - _content_type, - _headers, - _host_index, + + def _position_funding_serialize( + self, + account_index, + limit, + authorization, + market_id, + cursor, + side, + _request_auth, + _content_type, + _headers, + _host_index, ) -> RequestSerialized: _host = None @@ -4190,24 +4608,40 @@ def _partner_stats_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 start_timestamp is not None: - _query_params.append(('start_timestamp', start_timestamp)) - - if end_timestamp is not None: - _query_params.append(('end_timestamp', end_timestamp)) - + + if market_id is not None: + + _query_params.append(('market_id', market_id)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if side is not None: + + _query_params.append(('side', side)) + # 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( @@ -4216,13 +4650,14 @@ def _partner_stats_serialize( ] ) + # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/partnerStats', + resource_path='/api/v1/positionFunding', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4238,17 +4673,14 @@ def _partner_stats_serialize( - async def pnl( + @validate_call + async def public_pools_metadata( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: 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, - ignore_transfers: Optional[StrictBool] = None, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4261,29 +4693,21 @@ async def pnl( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> AccountPnL: - """pnl + ) -> RespPublicPoolsMetadata: + """publicPoolsMetadata - Get account PnL chart + Get public pools metadata. `auth` is required in case you specify an account_index. You will see public pools with an index that starts an n-1 of the one you specify. To see staking pools, use `filter=stake` - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int - :param authorization: make required after integ is done + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :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 @@ -4306,16 +4730,12 @@ async def pnl( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, authorization=authorization, - auth=auth, - ignore_transfers=ignore_transfers, + filter=filter, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4323,7 +4743,7 @@ async def pnl( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "RespPublicPoolsMetadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4337,17 +4757,14 @@ async def pnl( ).data - async def pnl_with_http_info( + @validate_call + async def public_pools_metadata_with_http_info( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: 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, - ignore_transfers: Optional[StrictBool] = None, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4360,29 +4777,21 @@ async def pnl_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[AccountPnL]: - """pnl + ) -> ApiResponse[RespPublicPoolsMetadata]: + """publicPoolsMetadata - Get account PnL chart + Get public pools metadata. `auth` is required in case you specify an account_index. You will see public pools with an index that starts an n-1 of the one you specify. To see staking pools, use `filter=stake` - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int - :param authorization: make required after integ is done + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :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 @@ -4405,16 +4814,12 @@ async def pnl_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, authorization=authorization, - auth=auth, - ignore_transfers=ignore_transfers, + filter=filter, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4422,7 +4827,7 @@ async def pnl_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "RespPublicPoolsMetadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4436,17 +4841,14 @@ async def pnl_with_http_info( ) - async def pnl_without_preload_content( + @validate_call + async def public_pools_metadata_without_preload_content( self, - by: StrictStr, - value: StrictStr, - resolution: StrictStr, - start_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - end_timestamp: Annotated[int, Field(le=5000000000000, strict=True, ge=0)], - count_back: 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, - ignore_transfers: Optional[StrictBool] = None, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4460,28 +4862,20 @@ async def pnl_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """pnl + """publicPoolsMetadata - Get account PnL chart + Get public pools metadata. `auth` is required in case you specify an account_index. You will see public pools with an index that starts an n-1 of the one you specify. To see staking pools, use `filter=stake` - :param by: (required) - :type by: str - :param value: (required) - :type value: str - :param resolution: (required) - :type resolution: str - :param start_timestamp: (required) - :type start_timestamp: int - :param end_timestamp: (required) - :type end_timestamp: int - :param count_back: (required) - :type count_back: int - :param authorization: make required after integ is done + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str - :param ignore_transfers: - :type ignore_transfers: bool + :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 @@ -4504,16 +4898,12 @@ async def pnl_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._pnl_serialize( - by=by, - value=value, - resolution=resolution, - start_timestamp=start_timestamp, - end_timestamp=end_timestamp, - count_back=count_back, + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, authorization=authorization, - auth=auth, - ignore_transfers=ignore_transfers, + filter=filter, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4521,7 +4911,7 @@ async def pnl_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "AccountPnL", + '200': "RespPublicPoolsMetadata", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4531,17 +4921,13 @@ async def pnl_without_preload_content( return response_data.response - def _pnl_serialize( + def _public_pools_metadata_serialize( self, - by, - value, - resolution, - start_timestamp, - end_timestamp, - count_back, + index, + limit, authorization, - auth, - ignore_transfers, + filter, + account_index, _request_auth, _content_type, _headers, @@ -4557,48 +4943,32 @@ def _pnl_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - - if by is not None: - - _query_params.append(('by', by)) - - if value is not None: - - _query_params.append(('value', value)) - - if resolution is not None: - - _query_params.append(('resolution', resolution)) - - if start_timestamp is not None: + if filter is not None: - _query_params.append(('start_timestamp', start_timestamp)) + _query_params.append(('filter', filter)) - if end_timestamp is not None: + if index is not None: - _query_params.append(('end_timestamp', end_timestamp)) + _query_params.append(('index', index)) - if count_back is not None: + if limit is not None: - _query_params.append(('count_back', count_back)) + _query_params.append(('limit', limit)) - if ignore_transfers is not None: + if account_index is not None: - _query_params.append(('ignore_transfers', ignore_transfers)) + _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 @@ -4618,7 +4988,7 @@ def _pnl_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/pnl', + resource_path='/api/v1/publicPoolsMetadata', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4634,15 +5004,12 @@ def _pnl_serialize( - async def position_funding( + @validate_call + async def set_maker_only_api_keys( self, + authorization: StrictStr, account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, - side: Optional[StrictStr] = None, + api_key_indexes: Annotated[StrictStr, Field(description="JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4655,25 +5022,17 @@ async def position_funding( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> PositionFundings: - """positionFunding + ) -> RespSetMakerOnlyApiKeys: + """setMakerOnlyApiKeys - Get accounts position fundings + Set maker-only API key indexes. This replaces the current list; pass all indexes you want marked as maker-only. Pass [] to clear all maker-only restrictions. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param limit: (required) - :type limit: 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 market_id: - :type market_id: int - :param cursor: - :type cursor: str - :param side: - :type side: str + :param api_key_indexes: JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions. (required) + :type api_key_indexes: 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 @@ -4696,14 +5055,10 @@ async def position_funding( :return: Returns the result object. """ # noqa: E501 - _param = self._position_funding_serialize( - account_index=account_index, - limit=limit, + _param = self._set_maker_only_api_keys_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, - side=side, + account_index=account_index, + api_key_indexes=api_key_indexes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4711,7 +5066,7 @@ async def position_funding( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PositionFundings", + '200': "RespSetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4725,15 +5080,12 @@ async def position_funding( ).data - async def position_funding_with_http_info( + @validate_call + async def set_maker_only_api_keys_with_http_info( self, + authorization: StrictStr, account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, - side: Optional[StrictStr] = None, + api_key_indexes: Annotated[StrictStr, Field(description="JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4746,25 +5098,17 @@ async def position_funding_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[PositionFundings]: - """positionFunding + ) -> ApiResponse[RespSetMakerOnlyApiKeys]: + """setMakerOnlyApiKeys - Get accounts position fundings + Set maker-only API key indexes. This replaces the current list; pass all indexes you want marked as maker-only. Pass [] to clear all maker-only restrictions. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param limit: (required) - :type limit: 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 market_id: - :type market_id: int - :param cursor: - :type cursor: str - :param side: - :type side: str + :param api_key_indexes: JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions. (required) + :type api_key_indexes: 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 @@ -4787,14 +5131,10 @@ async def position_funding_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._position_funding_serialize( - account_index=account_index, - limit=limit, + _param = self._set_maker_only_api_keys_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, - side=side, + account_index=account_index, + api_key_indexes=api_key_indexes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4802,7 +5142,7 @@ async def position_funding_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PositionFundings", + '200': "RespSetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4816,15 +5156,12 @@ async def position_funding_with_http_info( ) - async def position_funding_without_preload_content( + @validate_call + async def set_maker_only_api_keys_without_preload_content( self, + authorization: StrictStr, account_index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, - market_id: Optional[StrictInt] = None, - cursor: Optional[StrictStr] = None, - side: Optional[StrictStr] = None, + api_key_indexes: Annotated[StrictStr, Field(description="JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions.")], _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -4838,24 +5175,16 @@ async def position_funding_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """positionFunding + """setMakerOnlyApiKeys - Get accounts position fundings + Set maker-only API key indexes. This replaces the current list; pass all indexes you want marked as maker-only. Pass [] to clear all maker-only restrictions. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param limit: (required) - :type limit: 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 market_id: - :type market_id: int - :param cursor: - :type cursor: str - :param side: - :type side: str + :param api_key_indexes: JSON array string of API key indexes, e.g. \\\"[4,5]\\\". Use [] to clear all maker-only restrictions. (required) + :type api_key_indexes: 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 @@ -4878,14 +5207,10 @@ async def position_funding_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._position_funding_serialize( - account_index=account_index, - limit=limit, + _param = self._set_maker_only_api_keys_serialize( authorization=authorization, - auth=auth, - market_id=market_id, - cursor=cursor, - side=side, + account_index=account_index, + api_key_indexes=api_key_indexes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -4893,7 +5218,7 @@ async def position_funding_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "PositionFundings", + '200': "RespSetMakerOnlyApiKeys", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -4903,65 +5228,41 @@ async def position_funding_without_preload_content( return response_data.response - def _position_funding_serialize( + def _set_maker_only_api_keys_serialize( self, - account_index, - limit, authorization, - auth, - market_id, - cursor, - side, + account_index, + api_key_indexes, _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 authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - - 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 cursor is not None: - - _query_params.append(('cursor', cursor)) - - if limit is not None: - - _query_params.append(('limit', limit)) - - if side is not None: - - _query_params.append(('side', side)) - + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters + if account_index is not None: + _form_params.append(('account_index', account_index)) + if api_key_indexes is not None: + _form_params.append(('api_key_indexes', api_key_indexes)) # process the body parameter @@ -4973,14 +5274,28 @@ def _position_funding_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded', + 'multipart/form-data' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/positionFunding', + method='POST', + resource_path='/api/v1/setMakerOnlyApiKeys', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -4996,14 +5311,11 @@ def _position_funding_serialize( - async def public_pools_metadata( + @validate_call + async def tokens( self, - index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + account_index: 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, - filter: Optional[StrictStr] = None, - account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5016,23 +5328,15 @@ async def public_pools_metadata( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespPublicPoolsMetadata: - """publicPoolsMetadata + ) -> RespGetApiTokens: + """tokens - Get public pools metadata + Get read only auth tokens for an account - :param index: (required) - :type index: int - :param limit: (required) - :type limit: int + :param account_index: (required) + :type account_index: 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 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 @@ -5055,13 +5359,9 @@ async def public_pools_metadata( :return: Returns the result object. """ # noqa: E501 - _param = self._public_pools_metadata_serialize( - index=index, - limit=limit, - authorization=authorization, - auth=auth, - filter=filter, + _param = self._tokens_serialize( account_index=account_index, + authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5069,7 +5369,7 @@ async def public_pools_metadata( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPublicPoolsMetadata", + '200': "RespGetApiTokens", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5083,14 +5383,11 @@ async def public_pools_metadata( ).data - async def public_pools_metadata_with_http_info( + @validate_call + async def tokens_with_http_info( self, - index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + account_index: 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, - filter: Optional[StrictStr] = None, - account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5103,23 +5400,15 @@ async def public_pools_metadata_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespPublicPoolsMetadata]: - """publicPoolsMetadata + ) -> ApiResponse[RespGetApiTokens]: + """tokens - Get public pools metadata + Get read only auth tokens for an account - :param index: (required) - :type index: int - :param limit: (required) - :type limit: int + :param account_index: (required) + :type account_index: 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 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 @@ -5142,13 +5431,9 @@ async def public_pools_metadata_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._public_pools_metadata_serialize( - index=index, - limit=limit, - authorization=authorization, - auth=auth, - filter=filter, + _param = self._tokens_serialize( account_index=account_index, + authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5156,7 +5441,7 @@ async def public_pools_metadata_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPublicPoolsMetadata", + '200': "RespGetApiTokens", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5170,14 +5455,11 @@ async def public_pools_metadata_with_http_info( ) - async def public_pools_metadata_without_preload_content( + @validate_call + async def tokens_without_preload_content( self, - index: StrictInt, - limit: Annotated[int, Field(le=100, strict=True, ge=1)], + account_index: 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, - filter: Optional[StrictStr] = None, - account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5191,22 +5473,14 @@ async def public_pools_metadata_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """publicPoolsMetadata + """tokens - Get public pools metadata + Get read only auth tokens for an account - :param index: (required) - :type index: int - :param limit: (required) - :type limit: int + :param account_index: (required) + :type account_index: 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 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 @@ -5229,13 +5503,9 @@ async def public_pools_metadata_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._public_pools_metadata_serialize( - index=index, - limit=limit, - authorization=authorization, - auth=auth, - filter=filter, + _param = self._tokens_serialize( account_index=account_index, + authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5243,7 +5513,7 @@ async def public_pools_metadata_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPublicPoolsMetadata", + '200': "RespGetApiTokens", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5253,14 +5523,10 @@ async def public_pools_metadata_without_preload_content( return response_data.response - def _public_pools_metadata_serialize( + def _tokens_serialize( self, - index, - limit, - authorization, - auth, - filter, account_index, + authorization, _request_auth, _content_type, _headers, @@ -5276,36 +5542,20 @@ def _public_pools_metadata_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - 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 @@ -5325,7 +5575,7 @@ def _public_pools_metadata_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/publicPoolsMetadata', + resource_path='/api/v1/tokens', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5341,10 +5591,15 @@ def _public_pools_metadata_serialize( - async def tokens( + @validate_call + async def tokens_create( self, + name: StrictStr, account_index: StrictInt, - authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + expiry: StrictInt, + sub_account_access: StrictBool, + authorization: Optional[StrictStr] = None, + scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5357,15 +5612,23 @@ async def tokens( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetApiTokens: - """tokens + ) -> RespPostApiToken: + """tokens_create - Get api tokens of an account + Create an API token for read-only access + :param name: (required) + :type name: str :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param expiry: (required) + :type expiry: int + :param sub_account_access: (required) + :type sub_account_access: bool + :param authorization: :type authorization: str + :param scopes: + :type scopes: 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 @@ -5388,9 +5651,13 @@ async def tokens( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_serialize( + _param = self._tokens_create_serialize( + name=name, account_index=account_index, + expiry=expiry, + sub_account_access=sub_account_access, authorization=authorization, + scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5398,7 +5665,7 @@ async def tokens( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetApiTokens", + '200': "RespPostApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5412,10 +5679,15 @@ async def tokens( ).data - async def tokens_with_http_info( + @validate_call + async def tokens_create_with_http_info( self, + name: StrictStr, account_index: StrictInt, - authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + expiry: StrictInt, + sub_account_access: StrictBool, + authorization: Optional[StrictStr] = None, + scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5428,15 +5700,23 @@ async def tokens_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetApiTokens]: - """tokens + ) -> ApiResponse[RespPostApiToken]: + """tokens_create - Get api tokens of an account + Create an API token for read-only access + :param name: (required) + :type name: str :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param expiry: (required) + :type expiry: int + :param sub_account_access: (required) + :type sub_account_access: bool + :param authorization: :type authorization: str + :param scopes: + :type scopes: 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 @@ -5459,9 +5739,13 @@ async def tokens_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_serialize( + _param = self._tokens_create_serialize( + name=name, account_index=account_index, + expiry=expiry, + sub_account_access=sub_account_access, authorization=authorization, + scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5469,7 +5753,7 @@ async def tokens_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetApiTokens", + '200': "RespPostApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5483,10 +5767,15 @@ async def tokens_with_http_info( ) - async def tokens_without_preload_content( + @validate_call + async def tokens_create_without_preload_content( self, + name: StrictStr, account_index: StrictInt, - authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + expiry: StrictInt, + sub_account_access: StrictBool, + authorization: Optional[StrictStr] = None, + scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5500,14 +5789,22 @@ async def tokens_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """tokens + """tokens_create - Get api tokens of an account + Create an API token for read-only access + :param name: (required) + :type name: str :param account_index: (required) :type account_index: int - :param authorization: make required after integ is done + :param expiry: (required) + :type expiry: int + :param sub_account_access: (required) + :type sub_account_access: bool + :param authorization: :type authorization: str + :param scopes: + :type scopes: 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 @@ -5530,9 +5827,13 @@ async def tokens_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_serialize( + _param = self._tokens_create_serialize( + name=name, account_index=account_index, + expiry=expiry, + sub_account_access=sub_account_access, authorization=authorization, + scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5540,7 +5841,7 @@ async def tokens_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetApiTokens", + '200': "RespPostApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5550,10 +5851,14 @@ async def tokens_without_preload_content( return response_data.response - def _tokens_serialize( + def _tokens_create_serialize( self, + name, account_index, + expiry, + sub_account_access, authorization, + scopes, _request_auth, _content_type, _headers, @@ -5569,19 +5874,27 @@ def _tokens_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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)) - # process the header parameters if authorization is not None: _header_params['authorization'] = authorization # process the form parameters + if name is not None: + _form_params.append(('name', name)) + if account_index is not None: + _form_params.append(('account_index', account_index)) + if expiry is not None: + _form_params.append(('expiry', expiry)) + if sub_account_access is not None: + _form_params.append(('sub_account_access', sub_account_access)) + if scopes is not None: + _form_params.append(('scopes', scopes)) # process the body parameter @@ -5593,14 +5906,27 @@ def _tokens_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/tokens', + method='POST', + resource_path='/api/v1/tokens/create', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5616,14 +5942,12 @@ def _tokens_serialize( - async def tokens_create( + @validate_call + async def tokens_revoke( self, - name: StrictStr, + token_id: StrictInt, account_index: StrictInt, - expiry: StrictInt, - sub_account_access: StrictBool, authorization: Optional[StrictStr] = None, - scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5636,23 +5960,17 @@ async def tokens_create( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespPostApiToken: - """tokens_create + ) -> RespRevokeApiToken: + """tokens_revoke - Create api token + Revoke read only auth token for an account - :param name: (required) - :type name: str + :param token_id: (required) + :type token_id: int :param account_index: (required) :type account_index: int - :param expiry: (required) - :type expiry: int - :param sub_account_access: (required) - :type sub_account_access: bool :param authorization: :type authorization: str - :param scopes: - :type scopes: 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 @@ -5675,13 +5993,10 @@ async def tokens_create( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_create_serialize( - name=name, + _param = self._tokens_revoke_serialize( + token_id=token_id, account_index=account_index, - expiry=expiry, - sub_account_access=sub_account_access, authorization=authorization, - scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5689,7 +6004,7 @@ async def tokens_create( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPostApiToken", + '200': "RespRevokeApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5703,14 +6018,12 @@ async def tokens_create( ).data - async def tokens_create_with_http_info( + @validate_call + async def tokens_revoke_with_http_info( self, - name: StrictStr, + token_id: StrictInt, account_index: StrictInt, - expiry: StrictInt, - sub_account_access: StrictBool, authorization: Optional[StrictStr] = None, - scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5723,23 +6036,17 @@ async def tokens_create_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespPostApiToken]: - """tokens_create + ) -> ApiResponse[RespRevokeApiToken]: + """tokens_revoke - Create api token + Revoke read only auth token for an account - :param name: (required) - :type name: str + :param token_id: (required) + :type token_id: int :param account_index: (required) :type account_index: int - :param expiry: (required) - :type expiry: int - :param sub_account_access: (required) - :type sub_account_access: bool :param authorization: :type authorization: str - :param scopes: - :type scopes: 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 @@ -5762,13 +6069,10 @@ async def tokens_create_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_create_serialize( - name=name, + _param = self._tokens_revoke_serialize( + token_id=token_id, account_index=account_index, - expiry=expiry, - sub_account_access=sub_account_access, authorization=authorization, - scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5776,7 +6080,7 @@ async def tokens_create_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPostApiToken", + '200': "RespRevokeApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5790,14 +6094,12 @@ async def tokens_create_with_http_info( ) - async def tokens_create_without_preload_content( + @validate_call + async def tokens_revoke_without_preload_content( self, - name: StrictStr, + token_id: StrictInt, account_index: StrictInt, - expiry: StrictInt, - sub_account_access: StrictBool, authorization: Optional[StrictStr] = None, - scopes: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5811,22 +6113,16 @@ async def tokens_create_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """tokens_create + """tokens_revoke - Create api token + Revoke read only auth token for an account - :param name: (required) - :type name: str + :param token_id: (required) + :type token_id: int :param account_index: (required) :type account_index: int - :param expiry: (required) - :type expiry: int - :param sub_account_access: (required) - :type sub_account_access: bool :param authorization: :type authorization: str - :param scopes: - :type scopes: 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 @@ -5849,13 +6145,10 @@ async def tokens_create_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_create_serialize( - name=name, + _param = self._tokens_revoke_serialize( + token_id=token_id, account_index=account_index, - expiry=expiry, - sub_account_access=sub_account_access, authorization=authorization, - scopes=scopes, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -5863,7 +6156,7 @@ async def tokens_create_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespPostApiToken", + '200': "RespRevokeApiToken", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -5873,14 +6166,11 @@ async def tokens_create_without_preload_content( return response_data.response - def _tokens_create_serialize( + def _tokens_revoke_serialize( self, - name, + token_id, account_index, - expiry, - sub_account_access, authorization, - scopes, _request_auth, _content_type, _headers, @@ -5896,7 +6186,9 @@ def _tokens_create_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -5905,16 +6197,10 @@ def _tokens_create_serialize( if authorization is not None: _header_params['authorization'] = authorization # process the form parameters - if name is not None: - _form_params.append(('name', name)) + if token_id is not None: + _form_params.append(('token_id', token_id)) if account_index is not None: _form_params.append(('account_index', account_index)) - if expiry is not None: - _form_params.append(('expiry', expiry)) - if sub_account_access is not None: - _form_params.append(('sub_account_access', sub_account_access)) - if scopes is not None: - _form_params.append(('scopes', scopes)) # process the body parameter @@ -5933,7 +6219,7 @@ def _tokens_create_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'multipart/form-data' + 'application/x-www-form-urlencoded' ] ) ) @@ -5946,7 +6232,7 @@ def _tokens_create_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/api/v1/tokens/create', + resource_path='/api/v1/tokens/revoke', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -5962,11 +6248,15 @@ def _tokens_create_serialize( - async def tokens_revoke( + @validate_call + async def user_referrals( self, - token_id: StrictInt, - account_index: StrictInt, + l1_address: StrictStr, authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + stats_start_timestamp: Optional[StrictInt] = None, + stats_end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -5979,17 +6269,23 @@ async def tokens_revoke( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespRevokeApiToken: - """tokens_revoke + ) -> UserReferrals: + """userReferrals - Revoke api token + Get user referrals - :param token_id: (required) - :type token_id: int - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: str :param authorization: :type authorization: str + :param cursor: + :type cursor: str + :param auth: + :type auth: str + :param stats_start_timestamp: + :type stats_start_timestamp: int + :param stats_end_timestamp: + :type stats_end_timestamp: 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 @@ -6012,10 +6308,13 @@ async def tokens_revoke( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_revoke_serialize( - token_id=token_id, - account_index=account_index, + _param = self._user_referrals_serialize( + l1_address=l1_address, authorization=authorization, + cursor=cursor, + auth=auth, + stats_start_timestamp=stats_start_timestamp, + stats_end_timestamp=stats_end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -6023,7 +6322,7 @@ async def tokens_revoke( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespRevokeApiToken", + '200': "UserReferrals", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -6037,11 +6336,15 @@ async def tokens_revoke( ).data - async def tokens_revoke_with_http_info( + @validate_call + async def user_referrals_with_http_info( self, - token_id: StrictInt, - account_index: StrictInt, + l1_address: StrictStr, authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + stats_start_timestamp: Optional[StrictInt] = None, + stats_end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -6054,17 +6357,23 @@ async def tokens_revoke_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespRevokeApiToken]: - """tokens_revoke + ) -> ApiResponse[UserReferrals]: + """userReferrals - Revoke api token + Get user referrals - :param token_id: (required) - :type token_id: int - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: str :param authorization: :type authorization: str + :param cursor: + :type cursor: str + :param auth: + :type auth: str + :param stats_start_timestamp: + :type stats_start_timestamp: int + :param stats_end_timestamp: + :type stats_end_timestamp: 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 @@ -6087,10 +6396,13 @@ async def tokens_revoke_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_revoke_serialize( - token_id=token_id, - account_index=account_index, + _param = self._user_referrals_serialize( + l1_address=l1_address, authorization=authorization, + cursor=cursor, + auth=auth, + stats_start_timestamp=stats_start_timestamp, + stats_end_timestamp=stats_end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -6098,7 +6410,7 @@ async def tokens_revoke_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespRevokeApiToken", + '200': "UserReferrals", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -6112,11 +6424,15 @@ async def tokens_revoke_with_http_info( ) - async def tokens_revoke_without_preload_content( + @validate_call + async def user_referrals_without_preload_content( self, - token_id: StrictInt, - account_index: StrictInt, + l1_address: StrictStr, authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + stats_start_timestamp: Optional[StrictInt] = None, + stats_end_timestamp: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -6130,16 +6446,22 @@ async def tokens_revoke_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """tokens_revoke + """userReferrals - Revoke api token + Get user referrals - :param token_id: (required) - :type token_id: int - :param account_index: (required) - :type account_index: int + :param l1_address: (required) + :type l1_address: str :param authorization: :type authorization: str + :param cursor: + :type cursor: str + :param auth: + :type auth: str + :param stats_start_timestamp: + :type stats_start_timestamp: int + :param stats_end_timestamp: + :type stats_end_timestamp: 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 @@ -6162,10 +6484,13 @@ async def tokens_revoke_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._tokens_revoke_serialize( - token_id=token_id, - account_index=account_index, + _param = self._user_referrals_serialize( + l1_address=l1_address, authorization=authorization, + cursor=cursor, + auth=auth, + stats_start_timestamp=stats_start_timestamp, + stats_end_timestamp=stats_end_timestamp, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -6173,7 +6498,7 @@ async def tokens_revoke_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespRevokeApiToken", + '200': "UserReferrals", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -6183,11 +6508,14 @@ async def tokens_revoke_without_preload_content( return response_data.response - def _tokens_revoke_serialize( + def _user_referrals_serialize( self, - token_id, - account_index, + l1_address, authorization, + cursor, + auth, + stats_start_timestamp, + stats_end_timestamp, _request_auth, _content_type, _headers, @@ -6203,19 +6531,37 @@ def _tokens_revoke_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + if stats_start_timestamp is not None: + + _query_params.append(('stats_start_timestamp', stats_start_timestamp)) + + if stats_end_timestamp is not None: + + _query_params.append(('stats_end_timestamp', stats_end_timestamp)) + # process the header parameters if authorization is not None: _header_params['authorization'] = authorization # process the form parameters - if token_id is not None: - _form_params.append(('token_id', token_id)) - if account_index is not None: - _form_params.append(('account_index', account_index)) # process the body parameter @@ -6227,27 +6573,14 @@ def _tokens_revoke_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'multipart/form-data' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/tokens/revoke', + method='GET', + resource_path='/api/v1/referral/userReferrals', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/lighter/api/announcement_api.py b/lighter/api/announcement_api.py index 2f62113..faf82f3 100644 --- a/lighter/api/announcement_api.py +++ b/lighter/api/announcement_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -36,6 +35,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def announcement( self, _request_timeout: Union[ @@ -53,7 +53,7 @@ async def announcement( ) -> Announcements: """announcement - Get announcement + Get announcements :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -99,6 +99,7 @@ async def announcement( ).data + @validate_call async def announcement_with_http_info( self, _request_timeout: Union[ @@ -116,7 +117,7 @@ async def announcement_with_http_info( ) -> ApiResponse[Announcements]: """announcement - Get announcement + Get announcements :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -162,6 +163,7 @@ async def announcement_with_http_info( ) + @validate_call async def announcement_without_preload_content( self, _request_timeout: Union[ @@ -179,7 +181,7 @@ async def announcement_without_preload_content( ) -> RESTResponseType: """announcement - Get announcement + Get announcements :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -238,7 +240,9 @@ def _announcement_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/bridge_api.py b/lighter/api/bridge_api.py index 6f1fb9b..ce75a59 100644 --- a/lighter/api/bridge_api.py +++ b/lighter/api/bridge_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,18 +9,20 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr +from pydantic import Field, StrictBool, StrictInt, StrictStr from typing import Optional from typing_extensions import Annotated -from lighter.models.resp_get_bridges_by_l1_addr import RespGetBridgesByL1Addr +from lighter.models.bridge_supported_networks import BridgeSupportedNetworks +from lighter.models.create_intent_address_resp import CreateIntentAddressResp +from lighter.models.deposit import Deposit from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo from lighter.models.resp_get_fastwithdrawal_info import RespGetFastwithdrawalInfo -from lighter.models.resp_get_is_next_bridge_fast import RespGetIsNextBridgeFast from lighter.models.result_code import ResultCode from lighter.api_client import ApiClient, RequestSerialized @@ -43,7 +43,329 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - async def bridges( + @validate_call + async def create_intent_address( + self, + chain_id: StrictStr, + from_addr: StrictStr, + amount: StrictStr, + is_external_deposit: Optional[StrictBool] = 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, + ) -> CreateIntentAddressResp: + """createIntentAddress + + Create a bridge intent address for CCTP bridge + + :param chain_id: (required) + :type chain_id: str + :param from_addr: (required) + :type from_addr: str + :param amount: (required) + :type amount: str + :param is_external_deposit: + :type is_external_deposit: bool + :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._create_intent_address_serialize( + chain_id=chain_id, + from_addr=from_addr, + amount=amount, + is_external_deposit=is_external_deposit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateIntentAddressResp", + '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 create_intent_address_with_http_info( + self, + chain_id: StrictStr, + from_addr: StrictStr, + amount: StrictStr, + is_external_deposit: Optional[StrictBool] = 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[CreateIntentAddressResp]: + """createIntentAddress + + Create a bridge intent address for CCTP bridge + + :param chain_id: (required) + :type chain_id: str + :param from_addr: (required) + :type from_addr: str + :param amount: (required) + :type amount: str + :param is_external_deposit: + :type is_external_deposit: bool + :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._create_intent_address_serialize( + chain_id=chain_id, + from_addr=from_addr, + amount=amount, + is_external_deposit=is_external_deposit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateIntentAddressResp", + '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 create_intent_address_without_preload_content( + self, + chain_id: StrictStr, + from_addr: StrictStr, + amount: StrictStr, + is_external_deposit: Optional[StrictBool] = 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: + """createIntentAddress + + Create a bridge intent address for CCTP bridge + + :param chain_id: (required) + :type chain_id: str + :param from_addr: (required) + :type from_addr: str + :param amount: (required) + :type amount: str + :param is_external_deposit: + :type is_external_deposit: bool + :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._create_intent_address_serialize( + chain_id=chain_id, + from_addr=from_addr, + amount=amount, + is_external_deposit=is_external_deposit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CreateIntentAddressResp", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _create_intent_address_serialize( + self, + chain_id, + from_addr, + amount, + is_external_deposit, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if chain_id is not None: + _form_params.append(('chain_id', chain_id)) + if from_addr is not None: + _form_params.append(('from_addr', from_addr)) + if amount is not None: + _form_params.append(('amount', amount)) + if is_external_deposit is not None: + _form_params.append(('is_external_deposit', is_external_deposit)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/createIntentAddress', + 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 deposit_latest( self, l1_address: StrictStr, _request_timeout: Union[ @@ -58,10 +380,10 @@ async def bridges( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetBridgesByL1Addr: - """bridges + ) -> Deposit: + """deposit_latest - Get bridges for given l1 address + Get most recent deposit for given l1 address :param l1_address: (required) :type l1_address: str @@ -87,7 +409,7 @@ async def bridges( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_serialize( + _param = self._deposit_latest_serialize( l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, @@ -96,7 +418,7 @@ async def bridges( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetBridgesByL1Addr", + '200': "Deposit", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -110,7 +432,8 @@ async def bridges( ).data - async def bridges_with_http_info( + @validate_call + async def deposit_latest_with_http_info( self, l1_address: StrictStr, _request_timeout: Union[ @@ -125,10 +448,10 @@ async def bridges_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetBridgesByL1Addr]: - """bridges + ) -> ApiResponse[Deposit]: + """deposit_latest - Get bridges for given l1 address + Get most recent deposit for given l1 address :param l1_address: (required) :type l1_address: str @@ -154,7 +477,7 @@ async def bridges_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_serialize( + _param = self._deposit_latest_serialize( l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, @@ -163,7 +486,7 @@ async def bridges_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetBridgesByL1Addr", + '200': "Deposit", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -177,7 +500,8 @@ async def bridges_with_http_info( ) - async def bridges_without_preload_content( + @validate_call + async def deposit_latest_without_preload_content( self, l1_address: StrictStr, _request_timeout: Union[ @@ -193,9 +517,9 @@ async def bridges_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """bridges + """deposit_latest - Get bridges for given l1 address + Get most recent deposit for given l1 address :param l1_address: (required) :type l1_address: str @@ -221,7 +545,7 @@ async def bridges_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_serialize( + _param = self._deposit_latest_serialize( l1_address=l1_address, _request_auth=_request_auth, _content_type=_content_type, @@ -230,7 +554,7 @@ async def bridges_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetBridgesByL1Addr", + '200': "Deposit", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -240,7 +564,7 @@ async def bridges_without_preload_content( return response_data.response - def _bridges_serialize( + def _deposit_latest_serialize( self, l1_address, _request_auth, @@ -258,7 +582,9 @@ def _bridges_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -287,7 +613,7 @@ def _bridges_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/bridges', + resource_path='/api/v1/deposit/latest', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -303,9 +629,9 @@ def _bridges_serialize( - async def bridges_is_next_bridge_fast( + @validate_call + async def deposit_networks( self, - l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -318,13 +644,11 @@ async def bridges_is_next_bridge_fast( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespGetIsNextBridgeFast: - """bridges_isNextBridgeFast + ) -> BridgeSupportedNetworks: + """deposit_networks - Get if next bridge is fast + Get networks that support deposits via intent address - :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 @@ -347,8 +671,7 @@ async def bridges_is_next_bridge_fast( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_is_next_bridge_fast_serialize( - l1_address=l1_address, + _param = self._deposit_networks_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -356,7 +679,7 @@ async def bridges_is_next_bridge_fast( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetIsNextBridgeFast", + '200': "BridgeSupportedNetworks", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -370,9 +693,9 @@ async def bridges_is_next_bridge_fast( ).data - async def bridges_is_next_bridge_fast_with_http_info( + @validate_call + async def deposit_networks_with_http_info( self, - l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -385,13 +708,11 @@ async def bridges_is_next_bridge_fast_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespGetIsNextBridgeFast]: - """bridges_isNextBridgeFast + ) -> ApiResponse[BridgeSupportedNetworks]: + """deposit_networks - Get if next bridge is fast + Get networks that support deposits via intent address - :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 @@ -414,8 +735,7 @@ async def bridges_is_next_bridge_fast_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_is_next_bridge_fast_serialize( - l1_address=l1_address, + _param = self._deposit_networks_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -423,7 +743,7 @@ async def bridges_is_next_bridge_fast_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetIsNextBridgeFast", + '200': "BridgeSupportedNetworks", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -437,9 +757,9 @@ async def bridges_is_next_bridge_fast_with_http_info( ) - async def bridges_is_next_bridge_fast_without_preload_content( + @validate_call + async def deposit_networks_without_preload_content( self, - l1_address: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -453,12 +773,10 @@ async def bridges_is_next_bridge_fast_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """bridges_isNextBridgeFast + """deposit_networks - Get if next bridge is fast + Get networks that support deposits via intent address - :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 @@ -481,8 +799,7 @@ async def bridges_is_next_bridge_fast_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._bridges_is_next_bridge_fast_serialize( - l1_address=l1_address, + _param = self._deposit_networks_serialize( _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -490,7 +807,7 @@ async def bridges_is_next_bridge_fast_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespGetIsNextBridgeFast", + '200': "BridgeSupportedNetworks", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -500,9 +817,8 @@ async def bridges_is_next_bridge_fast_without_preload_content( return response_data.response - def _bridges_is_next_bridge_fast_serialize( + def _deposit_networks_serialize( self, - l1_address, _request_auth, _content_type, _headers, @@ -518,15 +834,13 @@ def _bridges_is_next_bridge_fast_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 @@ -547,7 +861,7 @@ def _bridges_is_next_bridge_fast_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/bridges/isNextBridgeFast', + resource_path='/api/v1/deposit/networks', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -563,6 +877,7 @@ def _bridges_is_next_bridge_fast_serialize( + @validate_call async def fastbridge_info( self, _request_timeout: Union[ @@ -626,6 +941,7 @@ async def fastbridge_info( ).data + @validate_call async def fastbridge_info_with_http_info( self, _request_timeout: Union[ @@ -689,6 +1005,7 @@ async def fastbridge_info_with_http_info( ) + @validate_call async def fastbridge_info_without_preload_content( self, _request_timeout: Union[ @@ -765,7 +1082,9 @@ def _fastbridge_info_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -806,6 +1125,7 @@ def _fastbridge_info_serialize( + @validate_call async def fastwithdraw( self, tx_info: StrictStr, @@ -885,6 +1205,7 @@ async def fastwithdraw( ).data + @validate_call async def fastwithdraw_with_http_info( self, tx_info: StrictStr, @@ -964,6 +1285,7 @@ async def fastwithdraw_with_http_info( ) + @validate_call async def fastwithdraw_without_preload_content( self, tx_info: StrictStr, @@ -1060,7 +1382,9 @@ def _fastwithdraw_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1093,7 +1417,7 @@ def _fastwithdraw_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'multipart/form-data' + 'application/x-www-form-urlencoded' ] ) ) @@ -1122,11 +1446,11 @@ def _fastwithdraw_serialize( + @validate_call async def fastwithdraw_info( self, + authorization: StrictStr, account_index: 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)], @@ -1144,12 +1468,10 @@ async def fastwithdraw_info( Get fast withdraw info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 @@ -1173,9 +1495,8 @@ async def fastwithdraw_info( """ # noqa: E501 _param = self._fastwithdraw_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1197,11 +1518,11 @@ async def fastwithdraw_info( ).data + @validate_call async def fastwithdraw_info_with_http_info( self, + authorization: StrictStr, account_index: 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)], @@ -1219,12 +1540,10 @@ async def fastwithdraw_info_with_http_info( Get fast withdraw info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 @@ -1248,9 +1567,8 @@ async def fastwithdraw_info_with_http_info( """ # noqa: E501 _param = self._fastwithdraw_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1272,11 +1590,11 @@ async def fastwithdraw_info_with_http_info( ) + @validate_call async def fastwithdraw_info_without_preload_content( self, + authorization: StrictStr, account_index: 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)], @@ -1294,12 +1612,10 @@ async def fastwithdraw_info_without_preload_content( Get fast withdraw info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 @@ -1323,9 +1639,8 @@ async def fastwithdraw_info_without_preload_content( """ # noqa: E501 _param = self._fastwithdraw_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1345,9 +1660,8 @@ async def fastwithdraw_info_without_preload_content( def _fastwithdraw_info_serialize( self, - account_index, authorization, - auth, + account_index, _request_auth, _content_type, _headers, @@ -1363,24 +1677,20 @@ def _fastwithdraw_info_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - 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 diff --git a/lighter/api/candlestick_api.py b/lighter/api/candlestick_api.py index 2486ab1..b9bb061 100644 --- a/lighter/api/candlestick_api.py +++ b/lighter/api/candlestick_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -40,6 +39,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def candles( self, market_id: StrictInt, @@ -63,7 +63,7 @@ async def candles( ) -> Candles: """candles - Get candles (optimized with shortened fields and smaller response size) + Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response. :param market_id: (required) :type market_id: int @@ -127,6 +127,7 @@ async def candles( ).data + @validate_call async def candles_with_http_info( self, market_id: StrictInt, @@ -150,7 +151,7 @@ async def candles_with_http_info( ) -> ApiResponse[Candles]: """candles - Get candles (optimized with shortened fields and smaller response size) + Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response. :param market_id: (required) :type market_id: int @@ -214,6 +215,7 @@ async def candles_with_http_info( ) + @validate_call async def candles_without_preload_content( self, market_id: StrictInt, @@ -237,7 +239,7 @@ async def candles_without_preload_content( ) -> RESTResponseType: """candles - Get candles (optimized with shortened fields and smaller response size) + Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response. :param market_id: (required) :type market_id: int @@ -320,7 +322,9 @@ def _candles_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -385,6 +389,7 @@ def _candles_serialize( + @validate_call async def fundings( self, market_id: StrictInt, @@ -468,6 +473,7 @@ async def fundings( ).data + @validate_call async def fundings_with_http_info( self, market_id: StrictInt, @@ -551,6 +557,7 @@ async def fundings_with_http_info( ) + @validate_call async def fundings_without_preload_content( self, market_id: StrictInt, @@ -652,7 +659,9 @@ def _fundings_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/funding_api.py b/lighter/api/funding_api.py index 9095e82..7522a94 100644 --- a/lighter/api/funding_api.py +++ b/lighter/api/funding_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -36,6 +35,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def funding_rates( self, _request_timeout: Union[ @@ -99,6 +99,7 @@ async def funding_rates( ).data + @validate_call async def funding_rates_with_http_info( self, _request_timeout: Union[ @@ -162,6 +163,7 @@ async def funding_rates_with_http_info( ) + @validate_call async def funding_rates_without_preload_content( self, _request_timeout: Union[ @@ -238,7 +240,9 @@ def _funding_rates_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/info_api.py b/lighter/api/info_api.py index e2d501c..f5e7f05 100644 --- a/lighter/api/info_api.py +++ b/lighter/api/info_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,14 +9,15 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import Field, StrictInt, StrictStr +from pydantic import StrictInt, StrictStr from typing import Optional -from typing_extensions import Annotated +from lighter.models.layer1_basic_info import Layer1BasicInfo from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay from lighter.models.system_config import SystemConfig from lighter.models.transfer_fee_info import TransferFeeInfo @@ -41,6 +40,255 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call + async def layer1_basic_info( + self, + _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, + ) -> Layer1BasicInfo: + """layer1BasicInfo + + Get zklighter l1 general info, including contract address and rpc info + + :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._layer1_basic_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Layer1BasicInfo", + '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 layer1_basic_info_with_http_info( + self, + _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[Layer1BasicInfo]: + """layer1BasicInfo + + Get zklighter l1 general info, including contract address and rpc info + + :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._layer1_basic_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Layer1BasicInfo", + '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 layer1_basic_info_without_preload_content( + self, + _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: + """layer1BasicInfo + + Get zklighter l1 general info, including contract address and rpc info + + :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._layer1_basic_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Layer1BasicInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _layer1_basic_info_serialize( + self, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # 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/layer1BasicInfo', + 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 system_config( self, _request_timeout: Union[ @@ -58,7 +306,7 @@ async def system_config( ) -> SystemConfig: """systemConfig - Get system configuration including pool indexes and lockup/cooldown periods + Get system config :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -104,6 +352,7 @@ async def system_config( ).data + @validate_call async def system_config_with_http_info( self, _request_timeout: Union[ @@ -121,7 +370,7 @@ async def system_config_with_http_info( ) -> ApiResponse[SystemConfig]: """systemConfig - Get system configuration including pool indexes and lockup/cooldown periods + Get system config :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -167,6 +416,7 @@ async def system_config_with_http_info( ) + @validate_call async def system_config_without_preload_content( self, _request_timeout: Union[ @@ -184,7 +434,7 @@ async def system_config_without_preload_content( ) -> RESTResponseType: """systemConfig - Get system configuration including pool indexes and lockup/cooldown periods + Get system config :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -243,7 +493,9 @@ def _system_config_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -284,11 +536,11 @@ def _system_config_serialize( + @validate_call async def transfer_fee_info( self, + authorization: StrictStr, account_index: 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, to_account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -307,12 +559,10 @@ async def transfer_fee_info( Transfer fee info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 to_account_index: :type to_account_index: int :param _request_timeout: timeout setting for this request. If one @@ -338,9 +588,8 @@ async def transfer_fee_info( """ # noqa: E501 _param = self._transfer_fee_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, to_account_index=to_account_index, _request_auth=_request_auth, _content_type=_content_type, @@ -363,11 +612,11 @@ async def transfer_fee_info( ).data + @validate_call async def transfer_fee_info_with_http_info( self, + authorization: StrictStr, account_index: 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, to_account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -386,12 +635,10 @@ async def transfer_fee_info_with_http_info( Transfer fee info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 to_account_index: :type to_account_index: int :param _request_timeout: timeout setting for this request. If one @@ -417,9 +664,8 @@ async def transfer_fee_info_with_http_info( """ # noqa: E501 _param = self._transfer_fee_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, to_account_index=to_account_index, _request_auth=_request_auth, _content_type=_content_type, @@ -442,11 +688,11 @@ async def transfer_fee_info_with_http_info( ) + @validate_call async def transfer_fee_info_without_preload_content( self, + authorization: StrictStr, account_index: 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, to_account_index: Optional[StrictInt] = None, _request_timeout: Union[ None, @@ -465,12 +711,10 @@ async def transfer_fee_info_without_preload_content( Transfer fee info + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 to_account_index: :type to_account_index: int :param _request_timeout: timeout setting for this request. If one @@ -496,9 +740,8 @@ async def transfer_fee_info_without_preload_content( """ # noqa: E501 _param = self._transfer_fee_info_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, to_account_index=to_account_index, _request_auth=_request_auth, _content_type=_content_type, @@ -519,9 +762,8 @@ async def transfer_fee_info_without_preload_content( def _transfer_fee_info_serialize( self, - account_index, authorization, - auth, + account_index, to_account_index, _request_auth, _content_type, @@ -538,19 +780,13 @@ def _transfer_fee_info_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if account_index is not None: _query_params.append(('account_index', account_index)) @@ -560,6 +796,8 @@ def _transfer_fee_info_serialize( _query_params.append(('to_account_index', to_account_index)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -595,6 +833,7 @@ def _transfer_fee_info_serialize( + @validate_call async def withdrawal_delay( self, _request_timeout: Union[ @@ -658,6 +897,7 @@ async def withdrawal_delay( ).data + @validate_call async def withdrawal_delay_with_http_info( self, _request_timeout: Union[ @@ -721,6 +961,7 @@ async def withdrawal_delay_with_http_info( ) + @validate_call async def withdrawal_delay_without_preload_content( self, _request_timeout: Union[ @@ -797,7 +1038,9 @@ def _withdrawal_delay_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/notification_api.py b/lighter/api/notification_api.py index f514353..a10ac52 100644 --- a/lighter/api/notification_api.py +++ b/lighter/api/notification_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -39,6 +38,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def notification_ack( self, notif_id: StrictStr, @@ -118,6 +118,7 @@ async def notification_ack( ).data + @validate_call async def notification_ack_with_http_info( self, notif_id: StrictStr, @@ -197,6 +198,7 @@ async def notification_ack_with_http_info( ) + @validate_call async def notification_ack_without_preload_content( self, notif_id: StrictStr, @@ -293,7 +295,9 @@ def _notification_ack_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -326,7 +330,7 @@ def _notification_ack_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'multipart/form-data' + 'application/x-www-form-urlencoded' ] ) ) diff --git a/lighter/api/order_api.py b/lighter/api/order_api.py index 45358f6..54286e1 100644 --- a/lighter/api/order_api.py +++ b/lighter/api/order_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -48,12 +47,13 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def account_active_orders( self, + authorization: StrictStr, 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, + market_id: Annotated[Optional[StrictInt], Field(description="If not specified, returns active orders for all markets.")] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -71,14 +71,14 @@ async def account_active_orders( Get account active orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param market_id: (required) + :param market_id: If not specified, returns active orders for all markets. :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 market_type: + :type market_type: 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 @@ -102,10 +102,10 @@ async def account_active_orders( """ # noqa: E501 _param = self._account_active_orders_serialize( + authorization=authorization, account_index=account_index, market_id=market_id, - authorization=authorization, - auth=auth, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -127,12 +127,13 @@ async def account_active_orders( ).data + @validate_call async def account_active_orders_with_http_info( self, + authorization: StrictStr, 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, + market_id: Annotated[Optional[StrictInt], Field(description="If not specified, returns active orders for all markets.")] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -150,14 +151,14 @@ async def account_active_orders_with_http_info( Get account active orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param market_id: (required) + :param market_id: If not specified, returns active orders for all markets. :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 market_type: + :type market_type: 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 @@ -181,10 +182,10 @@ async def account_active_orders_with_http_info( """ # noqa: E501 _param = self._account_active_orders_serialize( + authorization=authorization, account_index=account_index, market_id=market_id, - authorization=authorization, - auth=auth, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -206,12 +207,13 @@ async def account_active_orders_with_http_info( ) + @validate_call async def account_active_orders_without_preload_content( self, + authorization: StrictStr, 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, + market_id: Annotated[Optional[StrictInt], Field(description="If not specified, returns active orders for all markets.")] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -229,14 +231,14 @@ async def account_active_orders_without_preload_content( Get account active orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int - :param market_id: (required) + :param market_id: If not specified, returns active orders for all markets. :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 market_type: + :type market_type: 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 @@ -260,10 +262,10 @@ async def account_active_orders_without_preload_content( """ # noqa: E501 _param = self._account_active_orders_serialize( + authorization=authorization, account_index=account_index, market_id=market_id, - authorization=authorization, - auth=auth, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -283,10 +285,10 @@ async def account_active_orders_without_preload_content( def _account_active_orders_serialize( self, + authorization, account_index, market_id, - authorization, - auth, + market_type, _request_auth, _content_type, _headers, @@ -302,19 +304,13 @@ def _account_active_orders_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if account_index is not None: _query_params.append(('account_index', account_index)) @@ -323,7 +319,13 @@ def _account_active_orders_serialize( _query_params.append(('market_id', market_id)) + if market_type is not None: + + _query_params.append(('market_type', market_type)) + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -359,16 +361,17 @@ def _account_active_orders_serialize( + @validate_call async def account_inactive_orders( self, + authorization: StrictStr, account_index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, market_id: Optional[StrictInt] = None, ask_filter: Optional[StrictInt] = None, between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -384,16 +387,14 @@ async def account_inactive_orders( ) -> Orders: """accountInactiveOrders - Get account inactive orders + Get account inactive orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int :param limit: (required) :type limit: 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 market_id: :type market_id: int :param ask_filter: @@ -402,6 +403,8 @@ async def account_inactive_orders( :type between_timestamps: str :param cursor: :type cursor: str + :param market_type: + :type market_type: 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 @@ -425,14 +428,14 @@ async def account_inactive_orders( """ # noqa: E501 _param = self._account_inactive_orders_serialize( + authorization=authorization, account_index=account_index, limit=limit, - authorization=authorization, - auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -454,16 +457,17 @@ async def account_inactive_orders( ).data + @validate_call async def account_inactive_orders_with_http_info( self, + authorization: StrictStr, account_index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, market_id: Optional[StrictInt] = None, ask_filter: Optional[StrictInt] = None, between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -479,16 +483,14 @@ async def account_inactive_orders_with_http_info( ) -> ApiResponse[Orders]: """accountInactiveOrders - Get account inactive orders + Get account inactive orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int :param limit: (required) :type limit: 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 market_id: :type market_id: int :param ask_filter: @@ -497,6 +499,8 @@ async def account_inactive_orders_with_http_info( :type between_timestamps: str :param cursor: :type cursor: str + :param market_type: + :type market_type: 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 @@ -520,14 +524,14 @@ async def account_inactive_orders_with_http_info( """ # noqa: E501 _param = self._account_inactive_orders_serialize( + authorization=authorization, account_index=account_index, limit=limit, - authorization=authorization, - auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -549,16 +553,17 @@ async def account_inactive_orders_with_http_info( ) + @validate_call async def account_inactive_orders_without_preload_content( self, + authorization: StrictStr, account_index: StrictInt, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, market_id: Optional[StrictInt] = None, ask_filter: Optional[StrictInt] = None, between_timestamps: Optional[StrictStr] = None, cursor: Optional[StrictStr] = None, + market_type: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -574,16 +579,14 @@ async def account_inactive_orders_without_preload_content( ) -> RESTResponseType: """accountInactiveOrders - Get account inactive orders + Get account inactive orders. `auth` can be generated using the SDK. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: int :param limit: (required) :type limit: 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 market_id: :type market_id: int :param ask_filter: @@ -592,6 +595,8 @@ async def account_inactive_orders_without_preload_content( :type between_timestamps: str :param cursor: :type cursor: str + :param market_type: + :type market_type: 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 @@ -615,14 +620,14 @@ async def account_inactive_orders_without_preload_content( """ # noqa: E501 _param = self._account_inactive_orders_serialize( + authorization=authorization, account_index=account_index, limit=limit, - authorization=authorization, - auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor, + market_type=market_type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -642,14 +647,14 @@ async def account_inactive_orders_without_preload_content( def _account_inactive_orders_serialize( self, + authorization, account_index, limit, - authorization, - auth, market_id, ask_filter, between_timestamps, cursor, + market_type, _request_auth, _content_type, _headers, @@ -665,19 +670,13 @@ def _account_inactive_orders_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if account_index is not None: _query_params.append(('account_index', account_index)) @@ -702,7 +701,13 @@ def _account_inactive_orders_serialize( _query_params.append(('limit', limit)) + if market_type is not None: + + _query_params.append(('market_type', market_type)) + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -738,6 +743,7 @@ def _account_inactive_orders_serialize( + @validate_call async def asset_details( self, asset_id: Optional[StrictInt] = None, @@ -756,7 +762,7 @@ async def asset_details( ) -> AssetDetails: """assetDetails - Get asset details + Get asset details for a specific asset or all assets :param asset_id: :type asset_id: int @@ -805,6 +811,7 @@ async def asset_details( ).data + @validate_call async def asset_details_with_http_info( self, asset_id: Optional[StrictInt] = None, @@ -823,7 +830,7 @@ async def asset_details_with_http_info( ) -> ApiResponse[AssetDetails]: """assetDetails - Get asset details + Get asset details for a specific asset or all assets :param asset_id: :type asset_id: int @@ -872,6 +879,7 @@ async def asset_details_with_http_info( ) + @validate_call async def asset_details_without_preload_content( self, asset_id: Optional[StrictInt] = None, @@ -890,7 +898,7 @@ async def asset_details_without_preload_content( ) -> RESTResponseType: """assetDetails - Get asset details + Get asset details for a specific asset or all assets :param asset_id: :type asset_id: int @@ -953,7 +961,9 @@ def _asset_details_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -998,6 +1008,7 @@ def _asset_details_serialize( + @validate_call async def exchange_metrics( self, period: StrictStr, @@ -1019,7 +1030,7 @@ async def exchange_metrics( ) -> RespGetExchangeMetrics: """exchangeMetrics - Get exchange metrics + Get exchange metrics. When filtering by market, use the market symbol as a value. :param period: (required) :type period: str @@ -1077,6 +1088,7 @@ async def exchange_metrics( ).data + @validate_call async def exchange_metrics_with_http_info( self, period: StrictStr, @@ -1098,7 +1110,7 @@ async def exchange_metrics_with_http_info( ) -> ApiResponse[RespGetExchangeMetrics]: """exchangeMetrics - Get exchange metrics + Get exchange metrics. When filtering by market, use the market symbol as a value. :param period: (required) :type period: str @@ -1156,6 +1168,7 @@ async def exchange_metrics_with_http_info( ) + @validate_call async def exchange_metrics_without_preload_content( self, period: StrictStr, @@ -1177,7 +1190,7 @@ async def exchange_metrics_without_preload_content( ) -> RESTResponseType: """exchangeMetrics - Get exchange metrics + Get exchange metrics. When filtering by market, use the market symbol as a value. :param period: (required) :type period: str @@ -1252,7 +1265,9 @@ def _exchange_metrics_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1309,6 +1324,7 @@ def _exchange_metrics_serialize( + @validate_call async def exchange_stats( self, _request_timeout: Union[ @@ -1372,6 +1388,7 @@ async def exchange_stats( ).data + @validate_call async def exchange_stats_with_http_info( self, _request_timeout: Union[ @@ -1435,6 +1452,7 @@ async def exchange_stats_with_http_info( ) + @validate_call async def exchange_stats_without_preload_content( self, _request_timeout: Union[ @@ -1511,7 +1529,9 @@ def _exchange_stats_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1552,6 +1572,7 @@ def _exchange_stats_serialize( + @validate_call async def execute_stats( self, period: StrictStr, @@ -1619,6 +1640,7 @@ async def execute_stats( ).data + @validate_call async def execute_stats_with_http_info( self, period: StrictStr, @@ -1686,6 +1708,7 @@ async def execute_stats_with_http_info( ) + @validate_call async def execute_stats_without_preload_content( self, period: StrictStr, @@ -1767,7 +1790,9 @@ def _execute_stats_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -1812,11 +1837,11 @@ def _execute_stats_serialize( + @validate_call async def export( self, + authorization: StrictStr, type: StrictStr, - 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, account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, start_timestamp: Optional[Annotated[int, Field(le=1830297600000, strict=True, ge=1735689600000)]] = None, @@ -1839,14 +1864,12 @@ async def export( ) -> ExportData: """export - Export data + Export trades and funding payments, limited to 12 months or 1M trades. END_TS_IN_MS - START_TS_IN_MS should not be larger than 12 months in milliseconds, both timestamps should be greater than or equal to 17 January 2025 00:00:00 UTC (lighter's mainnet genesis) + :param authorization: (required) + :type authorization: str :param type: (required) :type type: str - :param authorization: make required after integ is done - :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param account_index: :type account_index: int :param market_id: @@ -1884,9 +1907,8 @@ async def export( """ # noqa: E501 _param = self._export_serialize( - type=type, authorization=authorization, - auth=auth, + type=type, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, @@ -1915,11 +1937,11 @@ async def export( ).data + @validate_call async def export_with_http_info( self, + authorization: StrictStr, type: StrictStr, - 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, account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, start_timestamp: Optional[Annotated[int, Field(le=1830297600000, strict=True, ge=1735689600000)]] = None, @@ -1942,14 +1964,12 @@ async def export_with_http_info( ) -> ApiResponse[ExportData]: """export - Export data + Export trades and funding payments, limited to 12 months or 1M trades. END_TS_IN_MS - START_TS_IN_MS should not be larger than 12 months in milliseconds, both timestamps should be greater than or equal to 17 January 2025 00:00:00 UTC (lighter's mainnet genesis) + :param authorization: (required) + :type authorization: str :param type: (required) :type type: str - :param authorization: make required after integ is done - :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param account_index: :type account_index: int :param market_id: @@ -1987,9 +2007,8 @@ async def export_with_http_info( """ # noqa: E501 _param = self._export_serialize( - type=type, authorization=authorization, - auth=auth, + type=type, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, @@ -2018,11 +2037,11 @@ async def export_with_http_info( ) + @validate_call async def export_without_preload_content( self, + authorization: StrictStr, type: StrictStr, - 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, account_index: Optional[StrictInt] = None, market_id: Optional[StrictInt] = None, start_timestamp: Optional[Annotated[int, Field(le=1830297600000, strict=True, ge=1735689600000)]] = None, @@ -2045,14 +2064,12 @@ async def export_without_preload_content( ) -> RESTResponseType: """export - Export data + Export trades and funding payments, limited to 12 months or 1M trades. END_TS_IN_MS - START_TS_IN_MS should not be larger than 12 months in milliseconds, both timestamps should be greater than or equal to 17 January 2025 00:00:00 UTC (lighter's mainnet genesis) + :param authorization: (required) + :type authorization: str :param type: (required) :type type: str - :param authorization: make required after integ is done - :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param account_index: :type account_index: int :param market_id: @@ -2090,9 +2107,8 @@ async def export_without_preload_content( """ # noqa: E501 _param = self._export_serialize( - type=type, authorization=authorization, - auth=auth, + type=type, account_index=account_index, market_id=market_id, start_timestamp=start_timestamp, @@ -2119,9 +2135,8 @@ async def export_without_preload_content( def _export_serialize( self, - type, authorization, - auth, + type, account_index, market_id, start_timestamp, @@ -2144,19 +2159,13 @@ def _export_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if account_index is not None: _query_params.append(('account_index', account_index)) @@ -2190,6 +2199,8 @@ def _export_serialize( _query_params.append(('trade_type', trade_type)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -2225,10 +2236,11 @@ def _export_serialize( + @validate_call async def order_book_details( self, market_id: Optional[StrictInt] = None, - filter: Optional[StrictStr] = None, + filter: Annotated[Optional[StrictStr], Field(description="Filter order books by type")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2248,7 +2260,7 @@ async def order_book_details( :param market_id: :type market_id: int - :param filter: + :param filter: Filter order books by type :type filter: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -2296,10 +2308,11 @@ async def order_book_details( ).data + @validate_call async def order_book_details_with_http_info( self, market_id: Optional[StrictInt] = None, - filter: Optional[StrictStr] = None, + filter: Annotated[Optional[StrictStr], Field(description="Filter order books by type")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2319,7 +2332,7 @@ async def order_book_details_with_http_info( :param market_id: :type market_id: int - :param filter: + :param filter: Filter order books by type :type filter: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -2367,10 +2380,11 @@ async def order_book_details_with_http_info( ) + @validate_call async def order_book_details_without_preload_content( self, market_id: Optional[StrictInt] = None, - filter: Optional[StrictStr] = None, + filter: Annotated[Optional[StrictStr], Field(description="Filter order books by type")] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2390,7 +2404,7 @@ async def order_book_details_without_preload_content( :param market_id: :type market_id: int - :param filter: + :param filter: Filter order books by type :type filter: str :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -2453,7 +2467,9 @@ def _order_book_details_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2502,6 +2518,7 @@ def _order_book_details_serialize( + @validate_call async def order_book_orders( self, market_id: StrictInt, @@ -2573,6 +2590,7 @@ async def order_book_orders( ).data + @validate_call async def order_book_orders_with_http_info( self, market_id: StrictInt, @@ -2644,6 +2662,7 @@ async def order_book_orders_with_http_info( ) + @validate_call async def order_book_orders_without_preload_content( self, market_id: StrictInt, @@ -2730,7 +2749,9 @@ def _order_book_orders_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -2779,6 +2800,7 @@ def _order_book_orders_serialize( + @validate_call async def order_books( self, market_id: Optional[StrictInt] = None, @@ -2850,6 +2872,7 @@ async def order_books( ).data + @validate_call async def order_books_with_http_info( self, market_id: Optional[StrictInt] = None, @@ -2921,6 +2944,7 @@ async def order_books_with_http_info( ) + @validate_call async def order_books_without_preload_content( self, market_id: Optional[StrictInt] = None, @@ -3007,7 +3031,9 @@ def _order_books_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -3056,6 +3082,7 @@ def _order_books_serialize( + @validate_call async def recent_trades( self, market_id: StrictInt, @@ -3127,6 +3154,7 @@ async def recent_trades( ).data + @validate_call async def recent_trades_with_http_info( self, market_id: StrictInt, @@ -3198,6 +3226,7 @@ async def recent_trades_with_http_info( ) + @validate_call async def recent_trades_without_preload_content( self, market_id: StrictInt, @@ -3284,7 +3313,9 @@ def _recent_trades_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -3333,12 +3364,12 @@ def _recent_trades_serialize( + @validate_call async def trades( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, + authorization: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, order_index: Optional[StrictInt] = None, @@ -3364,16 +3395,14 @@ async def trades( ) -> Trades: """trades - Get trades + Get trades for lighter accounts, including sub-accounts and public pools. `auth` is required for master accounts and sub accounts. :param sort_by: (required) :type sort_by: str :param limit: (required) :type limit: int - :param authorization: make required after integ is done + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param market_id: :type market_id: int :param account_index: @@ -3420,7 +3449,6 @@ async def trades( sort_by=sort_by, limit=limit, authorization=authorization, - auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, @@ -3452,12 +3480,12 @@ async def trades( ).data + @validate_call async def trades_with_http_info( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, + authorization: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, order_index: Optional[StrictInt] = None, @@ -3483,16 +3511,14 @@ async def trades_with_http_info( ) -> ApiResponse[Trades]: """trades - Get trades + Get trades for lighter accounts, including sub-accounts and public pools. `auth` is required for master accounts and sub accounts. :param sort_by: (required) :type sort_by: str :param limit: (required) :type limit: int - :param authorization: make required after integ is done + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param market_id: :type market_id: int :param account_index: @@ -3539,7 +3565,6 @@ async def trades_with_http_info( sort_by=sort_by, limit=limit, authorization=authorization, - auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, @@ -3571,12 +3596,12 @@ async def trades_with_http_info( ) + @validate_call async def trades_without_preload_content( self, sort_by: StrictStr, limit: Annotated[int, Field(le=100, strict=True, ge=1)], - 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, + authorization: Optional[StrictStr] = None, market_id: Optional[StrictInt] = None, account_index: Optional[StrictInt] = None, order_index: Optional[StrictInt] = None, @@ -3602,16 +3627,14 @@ async def trades_without_preload_content( ) -> RESTResponseType: """trades - Get trades + Get trades for lighter accounts, including sub-accounts and public pools. `auth` is required for master accounts and sub accounts. :param sort_by: (required) :type sort_by: str :param limit: (required) :type limit: int - :param authorization: make required after integ is done + :param authorization: :type authorization: str - :param auth: made optional to support header auth clients - :type auth: str :param market_id: :type market_id: int :param account_index: @@ -3658,7 +3681,6 @@ async def trades_without_preload_content( sort_by=sort_by, limit=limit, authorization=authorization, - auth=auth, market_id=market_id, account_index=account_index, order_index=order_index, @@ -3691,7 +3713,6 @@ def _trades_serialize( sort_by, limit, authorization, - auth, market_id, account_index, order_index, @@ -3717,19 +3738,13 @@ def _trades_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if market_id is not None: _query_params.append(('market_id', market_id)) @@ -3779,6 +3794,8 @@ def _trades_serialize( _query_params.append(('aggregate', aggregate)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter diff --git a/lighter/api/pushnotif_api.py b/lighter/api/pushnotif_api.py index 3c0f4fd..cd5c1d7 100644 --- a/lighter/api/pushnotif_api.py +++ b/lighter/api/pushnotif_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -40,6 +39,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def get_pushnotif_settings( self, account_index: StrictInt, @@ -119,6 +119,7 @@ async def get_pushnotif_settings( ).data + @validate_call async def get_pushnotif_settings_with_http_info( self, account_index: StrictInt, @@ -198,6 +199,7 @@ async def get_pushnotif_settings_with_http_info( ) + @validate_call async def get_pushnotif_settings_without_preload_content( self, account_index: StrictInt, @@ -294,7 +296,9 @@ def _get_pushnotif_settings_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -351,6 +355,7 @@ def _get_pushnotif_settings_serialize( + @validate_call async def post_pushnotif_settings( self, account_index: StrictInt, @@ -430,6 +435,7 @@ async def post_pushnotif_settings( ).data + @validate_call async def post_pushnotif_settings_with_http_info( self, account_index: StrictInt, @@ -509,6 +515,7 @@ async def post_pushnotif_settings_with_http_info( ) + @validate_call async def post_pushnotif_settings_without_preload_content( self, account_index: StrictInt, @@ -605,7 +612,9 @@ def _post_pushnotif_settings_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -667,6 +676,7 @@ def _post_pushnotif_settings_serialize( + @validate_call async def pushnotif_register( self, account_index: StrictInt, @@ -750,6 +760,7 @@ async def pushnotif_register( ).data + @validate_call async def pushnotif_register_with_http_info( self, account_index: StrictInt, @@ -833,6 +844,7 @@ async def pushnotif_register_with_http_info( ) + @validate_call async def pushnotif_register_without_preload_content( self, account_index: StrictInt, @@ -934,7 +946,9 @@ def _pushnotif_register_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -998,6 +1012,7 @@ def _pushnotif_register_serialize( + @validate_call async def pushnotif_unregister( self, account_index: StrictInt, @@ -1073,6 +1088,7 @@ async def pushnotif_unregister( ).data + @validate_call async def pushnotif_unregister_with_http_info( self, account_index: StrictInt, @@ -1148,6 +1164,7 @@ async def pushnotif_unregister_with_http_info( ) + @validate_call async def pushnotif_unregister_without_preload_content( self, account_index: StrictInt, @@ -1239,7 +1256,9 @@ def _pushnotif_unregister_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/referral_api.py b/lighter/api/referral_api.py index 353ed4c..7f46159 100644 --- a/lighter/api/referral_api.py +++ b/lighter/api/referral_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,14 +9,20 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated -from pydantic import StrictStr -from typing import Optional -from lighter.models.user_referrals import UserReferrals +from pydantic import Field, StrictInt, StrictStr +from typing import Optional, Union +from typing_extensions import Annotated +from lighter.models.referral_code import ReferralCode +from lighter.models.referral_points import ReferralPoints +from lighter.models.resp_update_kickback import RespUpdateKickback +from lighter.models.resp_update_referral_code import RespUpdateReferralCode +from lighter.models.result_code import ResultCode from lighter.api_client import ApiClient, RequestSerialized from lighter.api_response import ApiResponse @@ -38,12 +42,12 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - async def referral_user_referrals( + @validate_call + async def referral_create( self, - l1_address: StrictStr, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, - cursor: Optional[StrictStr] = None, + account_index: 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)], @@ -56,19 +60,17 @@ async def referral_user_referrals( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> UserReferrals: - """referral_userReferrals + ) -> ReferralCode: + """referral_create - Get user referrals + Create referral code - :param l1_address: (required) - :type l1_address: str - :param authorization: + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done :type authorization: str - :param auth: + :param auth: made optional to support header auth clients :type auth: str - :param cursor: - :type cursor: 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 @@ -91,11 +93,10 @@ async def referral_user_referrals( :return: Returns the result object. """ # noqa: E501 - _param = self._referral_user_referrals_serialize( - l1_address=l1_address, + _param = self._referral_create_serialize( + account_index=account_index, authorization=authorization, auth=auth, - cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -103,7 +104,7 @@ async def referral_user_referrals( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserReferrals", + '200': "ReferralCode", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -117,12 +118,12 @@ async def referral_user_referrals( ).data - async def referral_user_referrals_with_http_info( + @validate_call + async def referral_create_with_http_info( self, - l1_address: StrictStr, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, - cursor: Optional[StrictStr] = None, + account_index: 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)], @@ -135,19 +136,17 @@ async def referral_user_referrals_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[UserReferrals]: - """referral_userReferrals + ) -> ApiResponse[ReferralCode]: + """referral_create - Get user referrals + Create referral code - :param l1_address: (required) - :type l1_address: str - :param authorization: + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done :type authorization: str - :param auth: + :param auth: made optional to support header auth clients :type auth: str - :param cursor: - :type cursor: 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 @@ -170,11 +169,10 @@ async def referral_user_referrals_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._referral_user_referrals_serialize( - l1_address=l1_address, + _param = self._referral_create_serialize( + account_index=account_index, authorization=authorization, auth=auth, - cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -182,7 +180,7 @@ async def referral_user_referrals_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserReferrals", + '200': "ReferralCode", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -196,12 +194,12 @@ async def referral_user_referrals_with_http_info( ) - async def referral_user_referrals_without_preload_content( + @validate_call + async def referral_create_without_preload_content( self, - l1_address: StrictStr, - authorization: Optional[StrictStr] = None, - auth: Optional[StrictStr] = None, - cursor: Optional[StrictStr] = None, + account_index: 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)], @@ -215,18 +213,16 @@ async def referral_user_referrals_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """referral_userReferrals + """referral_create - Get user referrals + Create referral code - :param l1_address: (required) - :type l1_address: str - :param authorization: + :param account_index: (required) + :type account_index: int + :param authorization: make required after integ is done :type authorization: str - :param auth: + :param auth: made optional to support header auth clients :type auth: str - :param cursor: - :type cursor: 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 @@ -249,11 +245,10 @@ async def referral_user_referrals_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._referral_user_referrals_serialize( - l1_address=l1_address, + _param = self._referral_create_serialize( + account_index=account_index, authorization=authorization, auth=auth, - cursor=cursor, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -261,7 +256,7 @@ async def referral_user_referrals_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "UserReferrals", + '200': "ReferralCode", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -271,12 +266,11 @@ async def referral_user_referrals_without_preload_content( return response_data.response - def _referral_user_referrals_serialize( + def _referral_create_serialize( self, - l1_address, + account_index, authorization, auth, - cursor, _request_auth, _content_type, _headers, @@ -292,27 +286,21 @@ def _referral_user_referrals_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 l1_address is not None: - - _query_params.append(('l1_address', l1_address)) - - if cursor is not None: - - _query_params.append(('cursor', cursor)) - # process the header parameters if authorization is not None: _header_params['authorization'] = authorization # process the form parameters + if auth is not None: + _form_params.append(('auth', auth)) + if account_index is not None: + _form_params.append(('account_index', account_index)) # process the body parameter @@ -324,14 +312,1629 @@ def _referral_user_referrals_serialize( ] ) + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='GET', - resource_path='/api/v1/referral/userReferrals', + method='POST', + resource_path='/api/v1/referral/create', + 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_get( + self, + account_index: 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, + ) -> ReferralCode: + """referral_get + + Get referral code + + :param account_index: (required) + :type account_index: 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._referral_get_serialize( + account_index=account_index, + 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': "ReferralCode", + '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_get_with_http_info( + self, + account_index: 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[ReferralCode]: + """referral_get + + Get referral code + + :param account_index: (required) + :type account_index: 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._referral_get_serialize( + account_index=account_index, + 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': "ReferralCode", + '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_get_without_preload_content( + self, + account_index: 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: + """referral_get + + Get referral code + + :param account_index: (required) + :type account_index: 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._referral_get_serialize( + account_index=account_index, + 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': "ReferralCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_get_serialize( + self, + account_index, + 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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if authorization is not None: + + _query_params.append(('authorization', authorization)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + # 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/get', + 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_kickback_update( + self, + account_index: StrictInt, + kickback_percentage: Union[Annotated[float, Field(le=100, strict=True)], Annotated[int, Field(le=100, strict=True)]], + 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, + ) -> RespUpdateKickback: + """referral_kickback_update + + Update kickback percentage for referral rewards (allowed once per day) + + :param account_index: (required) + :type account_index: int + :param kickback_percentage: (required) + :type kickback_percentage: float + :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._referral_kickback_update_serialize( + account_index=account_index, + kickback_percentage=kickback_percentage, + 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': "RespUpdateKickback", + '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_kickback_update_with_http_info( + self, + account_index: StrictInt, + kickback_percentage: Union[Annotated[float, Field(le=100, strict=True)], Annotated[int, Field(le=100, strict=True)]], + 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[RespUpdateKickback]: + """referral_kickback_update + + Update kickback percentage for referral rewards (allowed once per day) + + :param account_index: (required) + :type account_index: int + :param kickback_percentage: (required) + :type kickback_percentage: float + :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._referral_kickback_update_serialize( + account_index=account_index, + kickback_percentage=kickback_percentage, + 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': "RespUpdateKickback", + '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_kickback_update_without_preload_content( + self, + account_index: StrictInt, + kickback_percentage: Union[Annotated[float, Field(le=100, strict=True)], Annotated[int, Field(le=100, strict=True)]], + 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: + """referral_kickback_update + + Update kickback percentage for referral rewards (allowed once per day) + + :param account_index: (required) + :type account_index: int + :param kickback_percentage: (required) + :type kickback_percentage: float + :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._referral_kickback_update_serialize( + account_index=account_index, + kickback_percentage=kickback_percentage, + 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': "RespUpdateKickback", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_kickback_update_serialize( + self, + account_index, + kickback_percentage, + 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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if auth is not None: + _form_params.append(('auth', auth)) + if account_index is not None: + _form_params.append(('account_index', account_index)) + if kickback_percentage is not None: + _form_params.append(('kickback_percentage', kickback_percentage)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/referral/kickback/update', + 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, + authorization: StrictStr, + account_index: StrictInt, + _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, + ) -> ReferralPoints: + """referral_points + + Get referral points + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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._referral_points_serialize( + authorization=authorization, + 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': "ReferralPoints", + '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_points_with_http_info( + self, + authorization: StrictStr, + account_index: StrictInt, + _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[ReferralPoints]: + """referral_points + + Get referral points + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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._referral_points_serialize( + authorization=authorization, + 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': "ReferralPoints", + '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_points_without_preload_content( + self, + authorization: StrictStr, + account_index: StrictInt, + _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_points + + Get referral points + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :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._referral_points_serialize( + authorization=authorization, + 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': "ReferralPoints", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_points_serialize( + self, + authorization, + 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, List[str], List[bytes], List[Tuple[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)) + + # 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/referral/points', + 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_update( + self, + account_index: StrictInt, + new_referral_code: StrictStr, + 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, + ) -> RespUpdateReferralCode: + """referral_update + + Update referral code (allowed once per account) + + :param account_index: (required) + :type account_index: int + :param new_referral_code: (required) + :type new_referral_code: str + :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._referral_update_serialize( + account_index=account_index, + new_referral_code=new_referral_code, + 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': "RespUpdateReferralCode", + '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_update_with_http_info( + self, + account_index: StrictInt, + new_referral_code: StrictStr, + 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[RespUpdateReferralCode]: + """referral_update + + Update referral code (allowed once per account) + + :param account_index: (required) + :type account_index: int + :param new_referral_code: (required) + :type new_referral_code: str + :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._referral_update_serialize( + account_index=account_index, + new_referral_code=new_referral_code, + 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': "RespUpdateReferralCode", + '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_update_without_preload_content( + self, + account_index: StrictInt, + new_referral_code: StrictStr, + 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: + """referral_update + + Update referral code (allowed once per account) + + :param account_index: (required) + :type account_index: int + :param new_referral_code: (required) + :type new_referral_code: str + :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._referral_update_serialize( + account_index=account_index, + new_referral_code=new_referral_code, + 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': "RespUpdateReferralCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_update_serialize( + self, + account_index, + new_referral_code, + 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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if auth is not None: + _form_params.append(('auth', auth)) + if account_index is not None: + _form_params.append(('account_index', account_index)) + if new_referral_code is not None: + _form_params.append(('new_referral_code', new_referral_code)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/referral/update', + 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_use( + self, + l1_address: StrictStr, + referral_code: StrictStr, + x: StrictStr, + 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, + discord: Optional[StrictStr] = None, + telegram: Optional[StrictStr] = None, + signature: Optional[StrictStr] = 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, + ) -> ResultCode: + """referral_use + + Use referral code + + :param l1_address: (required) + :type l1_address: str + :param referral_code: (required) + :type referral_code: str + :param x: (required) + :type x: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param discord: + :type discord: str + :param telegram: + :type telegram: str + :param signature: + :type signature: 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_use_serialize( + l1_address=l1_address, + referral_code=referral_code, + x=x, + authorization=authorization, + auth=auth, + discord=discord, + telegram=telegram, + signature=signature, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '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_use_with_http_info( + self, + l1_address: StrictStr, + referral_code: StrictStr, + x: StrictStr, + 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, + discord: Optional[StrictStr] = None, + telegram: Optional[StrictStr] = None, + signature: Optional[StrictStr] = 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[ResultCode]: + """referral_use + + Use referral code + + :param l1_address: (required) + :type l1_address: str + :param referral_code: (required) + :type referral_code: str + :param x: (required) + :type x: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param discord: + :type discord: str + :param telegram: + :type telegram: str + :param signature: + :type signature: 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_use_serialize( + l1_address=l1_address, + referral_code=referral_code, + x=x, + authorization=authorization, + auth=auth, + discord=discord, + telegram=telegram, + signature=signature, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '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_use_without_preload_content( + self, + l1_address: StrictStr, + referral_code: StrictStr, + x: StrictStr, + 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, + discord: Optional[StrictStr] = None, + telegram: Optional[StrictStr] = None, + signature: Optional[StrictStr] = 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: + """referral_use + + Use referral code + + :param l1_address: (required) + :type l1_address: str + :param referral_code: (required) + :type referral_code: str + :param x: (required) + :type x: str + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param discord: + :type discord: str + :param telegram: + :type telegram: str + :param signature: + :type signature: 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_use_serialize( + l1_address=l1_address, + referral_code=referral_code, + x=x, + authorization=authorization, + auth=auth, + discord=discord, + telegram=telegram, + signature=signature, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _referral_use_serialize( + self, + l1_address, + referral_code, + x, + authorization, + auth, + discord, + telegram, + signature, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + if auth is not None: + _form_params.append(('auth', auth)) + if l1_address is not None: + _form_params.append(('l1_address', l1_address)) + if referral_code is not None: + _form_params.append(('referral_code', referral_code)) + if discord is not None: + _form_params.append(('discord', discord)) + if telegram is not None: + _form_params.append(('telegram', telegram)) + if x is not None: + _form_params.append(('x', x)) + if signature is not None: + _form_params.append(('signature', signature)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/referral/use', path_params=_path_params, query_params=_query_params, header_params=_header_params, diff --git a/lighter/api/root_api.py b/lighter/api/root_api.py index 82d9cb0..02ae0e4 100644 --- a/lighter/api/root_api.py +++ b/lighter/api/root_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union @@ -37,6 +36,7 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client + @validate_call async def info( self, _request_timeout: Union[ @@ -100,6 +100,7 @@ async def info( ).data + @validate_call async def info_with_http_info( self, _request_timeout: Union[ @@ -163,6 +164,7 @@ async def info_with_http_info( ) + @validate_call async def info_without_preload_content( self, _request_timeout: Union[ @@ -239,7 +241,9 @@ def _info_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters @@ -280,6 +284,7 @@ def _info_serialize( + @validate_call async def status( self, _request_timeout: Union[ @@ -343,6 +348,7 @@ async def status( ).data + @validate_call async def status_with_http_info( self, _request_timeout: Union[ @@ -406,6 +412,7 @@ async def status_with_http_info( ) + @validate_call async def status_without_preload_content( self, _request_timeout: Union[ @@ -482,7 +489,9 @@ def _status_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters diff --git a/lighter/api/transaction_api.py b/lighter/api/transaction_api.py index fb5df75..c921a8f 100644 --- a/lighter/api/transaction_api.py +++ b/lighter/api/transaction_api.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,20 +9,24 @@ Do not edit the class manually. """ # noqa: E501 + import warnings from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt from typing import Any, Dict, List, Optional, Tuple, Union from typing_extensions import Annotated from pydantic import Field, StrictBool, StrictInt, StrictStr, field_validator -from typing import Optional +from typing import List, Optional from typing_extensions import Annotated from lighter.models.deposit_history import DepositHistory from lighter.models.enriched_tx import EnrichedTx from lighter.models.next_nonce import NextNonce +from lighter.models.req_set_account_metadata import ReqSetAccountMetadata from lighter.models.resp_send_tx import RespSendTx from lighter.models.resp_send_tx_batch import RespSendTxBatch +from lighter.models.result_code import ResultCode from lighter.models.transfer_history import TransferHistory +from lighter.models.txs import Txs from lighter.models.withdraw_history import WithdrawHistory from lighter.api_client import ApiClient, RequestSerialized @@ -45,14 +47,16 @@ def __init__(self, api_client=None) -> None: self.api_client = api_client - async def deposit_history( + @validate_call + async def account_txs( self, - account_index: StrictInt, - l1_address: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + index: Optional[StrictInt] = None, 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, - cursor: Optional[StrictStr] = None, - filter: Optional[StrictStr] = None, + types: Optional[List[StrictInt]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -65,23 +69,25 @@ async def deposit_history( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> DepositHistory: - """deposit_history + ) -> Txs: + """accountTxs - Get deposit history + Get transactions of a specific account - :param account_index: (required) - :type account_index: int - :param l1_address: (required) - :type l1_address: str + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param index: + :type index: 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 cursor: - :type cursor: str - :param filter: - :type filter: str + :param types: + :type types: List[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 @@ -104,13 +110,14 @@ async def deposit_history( :return: Returns the result object. """ # noqa: E501 - _param = self._deposit_history_serialize( - account_index=account_index, - l1_address=l1_address, + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + index=index, authorization=authorization, auth=auth, - cursor=cursor, - filter=filter, + types=types, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -118,7 +125,7 @@ async def deposit_history( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DepositHistory", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -132,14 +139,16 @@ async def deposit_history( ).data - async def deposit_history_with_http_info( + @validate_call + async def account_txs_with_http_info( self, - account_index: StrictInt, - l1_address: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + index: Optional[StrictInt] = None, 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, - cursor: Optional[StrictStr] = None, - filter: Optional[StrictStr] = None, + types: Optional[List[StrictInt]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -152,23 +161,25 @@ async def deposit_history_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[DepositHistory]: - """deposit_history + ) -> ApiResponse[Txs]: + """accountTxs - Get deposit history + Get transactions of a specific account - :param account_index: (required) - :type account_index: int - :param l1_address: (required) - :type l1_address: str + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param index: + :type index: 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 cursor: - :type cursor: str - :param filter: - :type filter: str + :param types: + :type types: List[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 @@ -191,13 +202,14 @@ async def deposit_history_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._deposit_history_serialize( - account_index=account_index, - l1_address=l1_address, + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + index=index, authorization=authorization, auth=auth, - cursor=cursor, - filter=filter, + types=types, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -205,7 +217,7 @@ async def deposit_history_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DepositHistory", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -219,14 +231,16 @@ async def deposit_history_with_http_info( ) - async def deposit_history_without_preload_content( + @validate_call + async def account_txs_without_preload_content( self, - account_index: StrictInt, - l1_address: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + index: Optional[StrictInt] = None, 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, - cursor: Optional[StrictStr] = None, - filter: Optional[StrictStr] = None, + types: Optional[List[StrictInt]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -240,22 +254,24 @@ async def deposit_history_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """deposit_history + """accountTxs - Get deposit history + Get transactions of a specific account - :param account_index: (required) - :type account_index: int - :param l1_address: (required) - :type l1_address: str + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param index: + :type index: 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 cursor: - :type cursor: str - :param filter: - :type filter: str + :param types: + :type types: List[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 @@ -278,13 +294,14 @@ async def deposit_history_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._deposit_history_serialize( - account_index=account_index, - l1_address=l1_address, + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + index=index, authorization=authorization, auth=auth, - cursor=cursor, - filter=filter, + types=types, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -292,7 +309,7 @@ async def deposit_history_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "DepositHistory", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -302,14 +319,15 @@ async def deposit_history_without_preload_content( return response_data.response - def _deposit_history_serialize( + def _account_txs_serialize( self, - account_index, - l1_address, + limit, + by, + value, + index, authorization, auth, - cursor, - filter, + types, _request_auth, _content_type, _headers, @@ -319,42 +337,47 @@ def _deposit_history_serialize( _host = None _collection_formats: Dict[str, str] = { + 'types': 'multi', } _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: + if index is not None: - _query_params.append(('authorization', authorization)) + _query_params.append(('index', index)) - if auth is not None: + if limit is not None: - _query_params.append(('auth', auth)) + _query_params.append(('limit', limit)) - if account_index is not None: + if by is not None: - _query_params.append(('account_index', account_index)) + _query_params.append(('by', by)) - if l1_address is not None: + if value is not None: - _query_params.append(('l1_address', l1_address)) + _query_params.append(('value', value)) - if cursor is not None: + if auth is not None: - _query_params.append(('cursor', cursor)) + _query_params.append(('auth', auth)) - if filter is not None: + if types is not None: - _query_params.append(('filter', filter)) + _query_params.append(('types', types)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter @@ -374,7 +397,7 @@ def _deposit_history_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/deposit/history', + resource_path='/api/v1/accountTxs', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -390,10 +413,11 @@ def _deposit_history_serialize( - async def next_nonce( + @validate_call + async def block_txs( self, - account_index: StrictInt, - api_key_index: StrictInt, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -406,15 +430,15 @@ async def next_nonce( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> NextNonce: - """nextNonce + ) -> Txs: + """blockTxs - Get next nonce for a specific account and api key + Get transactions in a block - :param account_index: (required) - :type account_index: int - :param api_key_index: (required) - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -437,9 +461,9 @@ async def next_nonce( :return: Returns the result object. """ # noqa: E501 - _param = self._next_nonce_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._block_txs_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -447,7 +471,7 @@ async def next_nonce( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "NextNonce", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -461,10 +485,11 @@ async def next_nonce( ).data - async def next_nonce_with_http_info( + @validate_call + async def block_txs_with_http_info( self, - account_index: StrictInt, - api_key_index: StrictInt, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -477,15 +502,15 @@ async def next_nonce_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[NextNonce]: - """nextNonce + ) -> ApiResponse[Txs]: + """blockTxs - Get next nonce for a specific account and api key + Get transactions in a block - :param account_index: (required) - :type account_index: int - :param api_key_index: (required) - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -508,9 +533,9 @@ async def next_nonce_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._next_nonce_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._block_txs_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -518,7 +543,7 @@ async def next_nonce_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "NextNonce", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -532,10 +557,11 @@ async def next_nonce_with_http_info( ) - async def next_nonce_without_preload_content( + @validate_call + async def block_txs_without_preload_content( self, - account_index: StrictInt, - api_key_index: StrictInt, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -549,14 +575,14 @@ async def next_nonce_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """nextNonce + """blockTxs - Get next nonce for a specific account and api key + Get transactions in a block - :param account_index: (required) - :type account_index: int - :param api_key_index: (required) - :type api_key_index: int + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -579,9 +605,9 @@ async def next_nonce_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._next_nonce_serialize( - account_index=account_index, - api_key_index=api_key_index, + _param = self._block_txs_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -589,7 +615,7 @@ async def next_nonce_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "NextNonce", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -599,10 +625,10 @@ async def next_nonce_without_preload_content( return response_data.response - def _next_nonce_serialize( + def _block_txs_serialize( self, - account_index, - api_key_index, + by, + value, _request_auth, _content_type, _headers, @@ -618,18 +644,20 @@ def _next_nonce_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if account_index is not None: + if by is not None: - _query_params.append(('account_index', account_index)) + _query_params.append(('by', by)) - if api_key_index is not None: + if value is not None: - _query_params.append(('api_key_index', api_key_index)) + _query_params.append(('value', value)) # process the header parameters # process the form parameters @@ -651,7 +679,7 @@ def _next_nonce_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/nextNonce', + resource_path='/api/v1/blockTxs', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -667,11 +695,14 @@ def _next_nonce_serialize( - async def send_tx( + @validate_call + async def deposit_history( self, - tx_type: StrictInt, - tx_info: StrictStr, - price_protection: Optional[StrictBool] = None, + authorization: StrictStr, + account_index: StrictInt, + l1_address: StrictStr, + cursor: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -684,17 +715,21 @@ async def send_tx( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespSendTx: - """sendTx + ) -> DepositHistory: + """deposit_history - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Get deposit history - :param tx_type: (required) - :type tx_type: int - :param tx_info: (required) - :type tx_info: str - :param price_protection: - :type price_protection: bool + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param l1_address: (required) + :type l1_address: str + :param cursor: + :type cursor: str + :param filter: + :type filter: 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 @@ -717,10 +752,12 @@ async def send_tx( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_serialize( - tx_type=tx_type, - tx_info=tx_info, - price_protection=price_protection, + _param = self._deposit_history_serialize( + authorization=authorization, + account_index=account_index, + l1_address=l1_address, + cursor=cursor, + filter=filter, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -728,7 +765,7 @@ async def send_tx( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTx", + '200': "DepositHistory", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -742,11 +779,14 @@ async def send_tx( ).data - async def send_tx_with_http_info( + @validate_call + async def deposit_history_with_http_info( self, - tx_type: StrictInt, - tx_info: StrictStr, - price_protection: Optional[StrictBool] = None, + authorization: StrictStr, + account_index: StrictInt, + l1_address: StrictStr, + cursor: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -759,16 +799,695 @@ async def send_tx_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespSendTx]: - """sendTx + ) -> ApiResponse[DepositHistory]: + """deposit_history - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Get deposit history - :param tx_type: (required) - :type tx_type: int - :param tx_info: (required) - :type tx_info: str - :param price_protection: + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param l1_address: (required) + :type l1_address: str + :param cursor: + :type cursor: str + :param filter: + :type filter: 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._deposit_history_serialize( + authorization=authorization, + account_index=account_index, + l1_address=l1_address, + cursor=cursor, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DepositHistory", + '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 deposit_history_without_preload_content( + self, + authorization: StrictStr, + account_index: StrictInt, + l1_address: StrictStr, + cursor: Optional[StrictStr] = None, + filter: Optional[StrictStr] = 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: + """deposit_history + + Get deposit history + + :param authorization: (required) + :type authorization: str + :param account_index: (required) + :type account_index: int + :param l1_address: (required) + :type l1_address: str + :param cursor: + :type cursor: str + :param filter: + :type filter: 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._deposit_history_serialize( + authorization=authorization, + account_index=account_index, + l1_address=l1_address, + cursor=cursor, + filter=filter, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DepositHistory", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _deposit_history_serialize( + self, + authorization, + account_index, + l1_address, + cursor, + filter, + _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, List[str], List[bytes], List[Tuple[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 l1_address is not None: + + _query_params.append(('l1_address', l1_address)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if filter is not None: + + _query_params.append(('filter', filter)) + + # 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/deposit/history', + 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 next_nonce( + self, + account_index: StrictInt, + api_key_index: StrictInt, + _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, + ) -> NextNonce: + """nextNonce + + Get next nonce for a specific account and api key + + :param account_index: (required) + :type account_index: int + :param api_key_index: (required) + :type api_key_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._next_nonce_serialize( + account_index=account_index, + api_key_index=api_key_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "NextNonce", + '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 next_nonce_with_http_info( + self, + account_index: StrictInt, + api_key_index: StrictInt, + _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[NextNonce]: + """nextNonce + + Get next nonce for a specific account and api key + + :param account_index: (required) + :type account_index: int + :param api_key_index: (required) + :type api_key_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._next_nonce_serialize( + account_index=account_index, + api_key_index=api_key_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "NextNonce", + '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 next_nonce_without_preload_content( + self, + account_index: StrictInt, + api_key_index: StrictInt, + _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: + """nextNonce + + Get next nonce for a specific account and api key + + :param account_index: (required) + :type account_index: int + :param api_key_index: (required) + :type api_key_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._next_nonce_serialize( + account_index=account_index, + api_key_index=api_key_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "NextNonce", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _next_nonce_serialize( + self, + account_index, + api_key_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, List[str], List[bytes], List[Tuple[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 api_key_index is not None: + + _query_params.append(('api_key_index', api_key_index)) + + # 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/nextNonce', + 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 send_tx( + self, + tx_type: StrictInt, + tx_info: StrictStr, + price_protection: Optional[StrictBool] = 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, + ) -> RespSendTx: + """sendTx + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_type: (required) + :type tx_type: int + :param tx_info: (required) + :type tx_info: str + :param price_protection: + :type price_protection: bool + :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._send_tx_serialize( + tx_type=tx_type, + tx_info=tx_info, + price_protection=price_protection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTx", + '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 send_tx_with_http_info( + self, + tx_type: StrictInt, + tx_info: StrictStr, + price_protection: Optional[StrictBool] = 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[RespSendTx]: + """sendTx + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_type: (required) + :type tx_type: int + :param tx_info: (required) + :type tx_info: str + :param price_protection: + :type price_protection: bool + :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._send_tx_serialize( + tx_type=tx_type, + tx_info=tx_info, + price_protection=price_protection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTx", + '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 send_tx_without_preload_content( + self, + tx_type: StrictInt, + tx_info: StrictStr, + price_protection: Optional[StrictBool] = 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: + """sendTx + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_type: (required) + :type tx_type: int + :param tx_info: (required) + :type tx_info: str + :param price_protection: :type price_protection: bool :param _request_timeout: timeout setting for this request. If one number provided, it will be total request @@ -792,10 +1511,523 @@ async def send_tx_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_serialize( - tx_type=tx_type, - tx_info=tx_info, - price_protection=price_protection, + _param = self._send_tx_serialize( + tx_type=tx_type, + tx_info=tx_info, + price_protection=price_protection, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTx", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _send_tx_serialize( + self, + tx_type, + tx_info, + price_protection, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if tx_type is not None: + _form_params.append(('tx_type', tx_type)) + if tx_info is not None: + _form_params.append(('tx_info', tx_info)) + if price_protection is not None: + _form_params.append(('price_protection', price_protection)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/sendTx', + 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 send_tx_batch( + self, + tx_types: StrictStr, + tx_infos: 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, + ) -> RespSendTxBatch: + """sendTxBatch + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_types: (required) + :type tx_types: str + :param tx_infos: (required) + :type tx_infos: 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._send_tx_batch_serialize( + tx_types=tx_types, + tx_infos=tx_infos, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTxBatch", + '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 send_tx_batch_with_http_info( + self, + tx_types: StrictStr, + tx_infos: 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[RespSendTxBatch]: + """sendTxBatch + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_types: (required) + :type tx_types: str + :param tx_infos: (required) + :type tx_infos: 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._send_tx_batch_serialize( + tx_types=tx_types, + tx_infos=tx_infos, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTxBatch", + '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 send_tx_batch_without_preload_content( + self, + tx_types: StrictStr, + tx_infos: 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: + """sendTxBatch + + You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started + + :param tx_types: (required) + :type tx_types: str + :param tx_infos: (required) + :type tx_infos: 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._send_tx_batch_serialize( + tx_types=tx_types, + tx_infos=tx_infos, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespSendTxBatch", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _send_tx_batch_serialize( + self, + tx_types, + tx_infos, + _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, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # process the header parameters + # process the form parameters + if tx_types is not None: + _form_params.append(('tx_types', tx_types)) + if tx_infos is not None: + _form_params.append(('tx_infos', tx_infos)) + # 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' + ] + ) + + # set the HTTP header `Content-Type` + if _content_type: + _header_params['Content-Type'] = _content_type + else: + _default_content_type = ( + self.api_client.select_header_content_type( + [ + 'application/x-www-form-urlencoded' + ] + ) + ) + if _default_content_type is not None: + _header_params['Content-Type'] = _default_content_type + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='POST', + resource_path='/api/v1/sendTxBatch', + 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 set_account_metadata( + self, + req_set_account_metadata: ReqSetAccountMetadata, + authorization: Optional[StrictStr] = 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, + ) -> ResultCode: + """setAccountMetadata + + Set account metadata + + :param req_set_account_metadata: (required) + :type req_set_account_metadata: ReqSetAccountMetadata + :param authorization: + :type authorization: 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._set_account_metadata_serialize( + req_set_account_metadata=req_set_account_metadata, + authorization=authorization, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ResultCode", + '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 set_account_metadata_with_http_info( + self, + req_set_account_metadata: ReqSetAccountMetadata, + authorization: Optional[StrictStr] = 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[ResultCode]: + """setAccountMetadata + + Set account metadata + + :param req_set_account_metadata: (required) + :type req_set_account_metadata: ReqSetAccountMetadata + :param authorization: + :type authorization: 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._set_account_metadata_serialize( + req_set_account_metadata=req_set_account_metadata, + authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -803,7 +2035,7 @@ async def send_tx_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTx", + '200': "ResultCode", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -817,11 +2049,11 @@ async def send_tx_with_http_info( ) - async def send_tx_without_preload_content( + @validate_call + async def set_account_metadata_without_preload_content( self, - tx_type: StrictInt, - tx_info: StrictStr, - price_protection: Optional[StrictBool] = None, + req_set_account_metadata: ReqSetAccountMetadata, + authorization: Optional[StrictStr] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -835,16 +2067,14 @@ async def send_tx_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """sendTx + """setAccountMetadata - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Set account metadata - :param tx_type: (required) - :type tx_type: int - :param tx_info: (required) - :type tx_info: str - :param price_protection: - :type price_protection: bool + :param req_set_account_metadata: (required) + :type req_set_account_metadata: ReqSetAccountMetadata + :param authorization: + :type authorization: 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 @@ -867,10 +2097,9 @@ async def send_tx_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_serialize( - tx_type=tx_type, - tx_info=tx_info, - price_protection=price_protection, + _param = self._set_account_metadata_serialize( + req_set_account_metadata=req_set_account_metadata, + authorization=authorization, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -878,7 +2107,7 @@ async def send_tx_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTx", + '200': "ResultCode", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -888,11 +2117,10 @@ async def send_tx_without_preload_content( return response_data.response - def _send_tx_serialize( + def _set_account_metadata_serialize( self, - tx_type, - tx_info, - price_protection, + req_set_account_metadata, + authorization, _request_auth, _content_type, _headers, @@ -908,20 +2136,20 @@ def _send_tx_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters - if tx_type is not None: - _form_params.append(('tx_type', tx_type)) - if tx_info is not None: - _form_params.append(('tx_info', tx_info)) - if price_protection is not None: - _form_params.append(('price_protection', price_protection)) # process the body parameter + if req_set_account_metadata is not None: + _body_params = req_set_account_metadata # set the HTTP header `Accept` @@ -939,7 +2167,7 @@ def _send_tx_serialize( _default_content_type = ( self.api_client.select_header_content_type( [ - 'multipart/form-data' + 'application/json' ] ) ) @@ -952,7 +2180,7 @@ def _send_tx_serialize( return self.api_client.param_serialize( method='POST', - resource_path='/api/v1/sendTx', + resource_path='/api/v1/setAccountMetadata', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -968,10 +2196,13 @@ def _send_tx_serialize( - async def send_tx_batch( + @validate_call + async def transfer_history( self, - tx_types: StrictStr, - tx_infos: StrictStr, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + type: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -984,15 +2215,19 @@ async def send_tx_batch( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> RespSendTxBatch: - """sendTxBatch + ) -> TransferHistory: + """transfer_history - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Get transfer history. To fetch an account index, you will need to `auth` the request, unless it's a public pool. - :param tx_types: (required) - :type tx_types: str - :param tx_infos: (required) - :type tx_infos: str + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param cursor: + :type cursor: str + :param type: + :type type: List[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 @@ -1015,9 +2250,11 @@ async def send_tx_batch( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_batch_serialize( - tx_types=tx_types, - tx_infos=tx_infos, + _param = self._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + type=type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1025,7 +2262,7 @@ async def send_tx_batch( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTxBatch", + '200': "TransferHistory", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1039,10 +2276,13 @@ async def send_tx_batch( ).data - async def send_tx_batch_with_http_info( + @validate_call + async def transfer_history_with_http_info( self, - tx_types: StrictStr, - tx_infos: StrictStr, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + type: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1055,15 +2295,19 @@ async def send_tx_batch_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[RespSendTxBatch]: - """sendTxBatch + ) -> ApiResponse[TransferHistory]: + """transfer_history - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Get transfer history. To fetch an account index, you will need to `auth` the request, unless it's a public pool. - :param tx_types: (required) - :type tx_types: str - :param tx_infos: (required) - :type tx_infos: str + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param cursor: + :type cursor: str + :param type: + :type type: List[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 @@ -1086,9 +2330,11 @@ async def send_tx_batch_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_batch_serialize( - tx_types=tx_types, - tx_infos=tx_infos, + _param = self._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + type=type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1096,7 +2342,7 @@ async def send_tx_batch_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTxBatch", + '200': "TransferHistory", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1110,10 +2356,13 @@ async def send_tx_batch_with_http_info( ) - async def send_tx_batch_without_preload_content( + @validate_call + async def transfer_history_without_preload_content( self, - tx_types: StrictStr, - tx_infos: StrictStr, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + type: Optional[List[StrictStr]] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1127,14 +2376,18 @@ async def send_tx_batch_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """sendTxBatch + """transfer_history - You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + Get transfer history. To fetch an account index, you will need to `auth` the request, unless it's a public pool. - :param tx_types: (required) - :type tx_types: str - :param tx_infos: (required) - :type tx_infos: str + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param cursor: + :type cursor: str + :param type: + :type type: List[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 @@ -1157,9 +2410,11 @@ async def send_tx_batch_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._send_tx_batch_serialize( - tx_types=tx_types, - tx_infos=tx_infos, + _param = self._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + cursor=cursor, + type=type, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1167,7 +2422,7 @@ async def send_tx_batch_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "RespSendTxBatch", + '200': "TransferHistory", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1177,10 +2432,12 @@ async def send_tx_batch_without_preload_content( return response_data.response - def _send_tx_batch_serialize( + def _transfer_history_serialize( self, - tx_types, - tx_infos, + account_index, + authorization, + cursor, + type, _request_auth, _content_type, _headers, @@ -1190,23 +2447,36 @@ def _send_tx_batch_serialize( _host = None _collection_formats: Dict[str, str] = { + 'type': 'multi', } _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[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 cursor is not None: + + _query_params.append(('cursor', cursor)) + + if type is not None: + + _query_params.append(('type', type)) + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters - if tx_types is not None: - _form_params.append(('tx_types', tx_types)) - if tx_infos is not None: - _form_params.append(('tx_infos', tx_infos)) # process the body parameter @@ -1218,27 +2488,14 @@ def _send_tx_batch_serialize( ] ) - # set the HTTP header `Content-Type` - if _content_type: - _header_params['Content-Type'] = _content_type - else: - _default_content_type = ( - self.api_client.select_header_content_type( - [ - 'multipart/form-data' - ] - ) - ) - if _default_content_type is not None: - _header_params['Content-Type'] = _default_content_type # authentication setting _auth_settings: List[str] = [ ] return self.api_client.param_serialize( - method='POST', - resource_path='/api/v1/sendTxBatch', + method='GET', + resource_path='/api/v1/transfer/history', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1254,13 +2511,11 @@ def _send_tx_batch_serialize( - async def transfer_history( + @validate_call + async def tx( self, - account_index: 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, - cursor: Optional[StrictStr] = None, - type: Optional[StrictStr] = None, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1273,21 +2528,15 @@ async def transfer_history( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> TransferHistory: - """transfer_history + ) -> EnrichedTx: + """tx - Get transfer history + Get transaction by hash or sequence index - :param account_index: (required) - :type account_index: 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 cursor: - :type cursor: str - :param type: - :type type: str + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -1310,12 +2559,9 @@ async def transfer_history( :return: Returns the result object. """ # noqa: E501 - _param = self._transfer_history_serialize( - account_index=account_index, - authorization=authorization, - auth=auth, - cursor=cursor, - type=type, + _param = self._tx_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1323,7 +2569,7 @@ async def transfer_history( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TransferHistory", + '200': "EnrichedTx", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1337,13 +2583,11 @@ async def transfer_history( ).data - async def transfer_history_with_http_info( + @validate_call + async def tx_with_http_info( self, - account_index: 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, - cursor: Optional[StrictStr] = None, - type: Optional[StrictStr] = None, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1356,21 +2600,15 @@ async def transfer_history_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[TransferHistory]: - """transfer_history + ) -> ApiResponse[EnrichedTx]: + """tx - Get transfer history + Get transaction by hash or sequence index - :param account_index: (required) - :type account_index: 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 cursor: - :type cursor: str - :param type: - :type type: str + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -1393,12 +2631,9 @@ async def transfer_history_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._transfer_history_serialize( - account_index=account_index, - authorization=authorization, - auth=auth, - cursor=cursor, - type=type, + _param = self._tx_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1406,7 +2641,7 @@ async def transfer_history_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TransferHistory", + '200': "EnrichedTx", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1420,13 +2655,11 @@ async def transfer_history_with_http_info( ) - async def transfer_history_without_preload_content( + @validate_call + async def tx_without_preload_content( self, - account_index: 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, - cursor: Optional[StrictStr] = None, - type: Optional[StrictStr] = None, + by: StrictStr, + value: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1440,20 +2673,14 @@ async def transfer_history_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """transfer_history + """tx - Get transfer history + Get transaction by hash or sequence index - :param account_index: (required) - :type account_index: 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 cursor: - :type cursor: str - :param type: - :type type: str + :param by: (required) + :type by: str + :param value: (required) + :type value: 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 @@ -1476,12 +2703,9 @@ async def transfer_history_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._transfer_history_serialize( - account_index=account_index, - authorization=authorization, - auth=auth, - cursor=cursor, - type=type, + _param = self._tx_serialize( + by=by, + value=value, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1489,7 +2713,7 @@ async def transfer_history_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "TransferHistory", + '200': "EnrichedTx", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1499,13 +2723,10 @@ async def transfer_history_without_preload_content( return response_data.response - def _transfer_history_serialize( + def _tx_serialize( self, - account_index, - authorization, - auth, - cursor, - type, + by, + value, _request_auth, _content_type, _headers, @@ -1521,30 +2742,20 @@ def _transfer_history_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - - if account_index is not None: - - _query_params.append(('account_index', account_index)) - - if cursor is not None: + if by is not None: - _query_params.append(('cursor', cursor)) + _query_params.append(('by', by)) - if type is not None: + if value is not None: - _query_params.append(('type', type)) + _query_params.append(('value', value)) # process the header parameters # process the form parameters @@ -1566,7 +2777,7 @@ def _transfer_history_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/transfer/history', + resource_path='/api/v1/tx', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1582,10 +2793,10 @@ def _transfer_history_serialize( - async def tx( + @validate_call + async def tx_from_l1_tx_hash( self, - by: StrictStr, - value: StrictStr, + hash: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1599,14 +2810,12 @@ async def tx( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> EnrichedTx: - """tx + """txFromL1TxHash - Get transaction by hash or sequence index + Get L1 transaction by L1 transaction hash - :param by: (required) - :type by: str - :param value: (required) - :type value: str + :param hash: (required) + :type hash: 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 @@ -1629,9 +2838,8 @@ async def tx( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_serialize( - by=by, - value=value, + _param = self._tx_from_l1_tx_hash_serialize( + hash=hash, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1653,10 +2861,10 @@ async def tx( ).data - async def tx_with_http_info( + @validate_call + async def tx_from_l1_tx_hash_with_http_info( self, - by: StrictStr, - value: StrictStr, + hash: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1670,14 +2878,12 @@ async def tx_with_http_info( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> ApiResponse[EnrichedTx]: - """tx + """txFromL1TxHash - Get transaction by hash or sequence index + Get L1 transaction by L1 transaction hash - :param by: (required) - :type by: str - :param value: (required) - :type value: str + :param hash: (required) + :type hash: 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 @@ -1700,9 +2906,8 @@ async def tx_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_serialize( - by=by, - value=value, + _param = self._tx_from_l1_tx_hash_serialize( + hash=hash, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1724,10 +2929,10 @@ async def tx_with_http_info( ) - async def tx_without_preload_content( + @validate_call + async def tx_from_l1_tx_hash_without_preload_content( self, - by: StrictStr, - value: StrictStr, + hash: StrictStr, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1741,14 +2946,12 @@ async def tx_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """tx + """txFromL1TxHash - Get transaction by hash or sequence index + Get L1 transaction by L1 transaction hash - :param by: (required) - :type by: str - :param value: (required) - :type value: str + :param hash: (required) + :type hash: 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 @@ -1771,9 +2974,8 @@ async def tx_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_serialize( - by=by, - value=value, + _param = self._tx_from_l1_tx_hash_serialize( + hash=hash, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1791,10 +2993,9 @@ async def tx_without_preload_content( return response_data.response - def _tx_serialize( + def _tx_from_l1_tx_hash_serialize( self, - by, - value, + hash, _request_auth, _content_type, _headers, @@ -1810,18 +3011,16 @@ def _tx_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if by is not None: - - _query_params.append(('by', by)) - - if value is not None: + if hash is not None: - _query_params.append(('value', value)) + _query_params.append(('hash', hash)) # process the header parameters # process the form parameters @@ -1843,7 +3042,7 @@ def _tx_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/tx', + resource_path='/api/v1/txFromL1TxHash', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -1859,9 +3058,11 @@ def _tx_serialize( - async def tx_from_l1_tx_hash( + @validate_call + async def txs( self, - hash: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1874,13 +3075,15 @@ async def tx_from_l1_tx_hash( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> EnrichedTx: - """txFromL1TxHash + ) -> Txs: + """txs - Get L1 transaction by L1 transaction hash + Get transactions which are already packed into blocks - :param hash: (required) - :type hash: str + :param limit: (required) + :type limit: int + :param index: + :type 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 @@ -1903,8 +3106,9 @@ async def tx_from_l1_tx_hash( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_from_l1_tx_hash_serialize( - hash=hash, + _param = self._txs_serialize( + limit=limit, + index=index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1912,7 +3116,7 @@ async def tx_from_l1_tx_hash( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "EnrichedTx", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1926,9 +3130,11 @@ async def tx_from_l1_tx_hash( ).data - async def tx_from_l1_tx_hash_with_http_info( + @validate_call + async def txs_with_http_info( self, - hash: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -1941,13 +3147,15 @@ async def tx_from_l1_tx_hash_with_http_info( _content_type: Optional[StrictStr] = None, _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, - ) -> ApiResponse[EnrichedTx]: - """txFromL1TxHash + ) -> ApiResponse[Txs]: + """txs - Get L1 transaction by L1 transaction hash + Get transactions which are already packed into blocks - :param hash: (required) - :type hash: str + :param limit: (required) + :type limit: int + :param index: + :type 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 @@ -1970,8 +3178,9 @@ async def tx_from_l1_tx_hash_with_http_info( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_from_l1_tx_hash_serialize( - hash=hash, + _param = self._txs_serialize( + limit=limit, + index=index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -1979,7 +3188,7 @@ async def tx_from_l1_tx_hash_with_http_info( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "EnrichedTx", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -1993,9 +3202,11 @@ async def tx_from_l1_tx_hash_with_http_info( ) - async def tx_from_l1_tx_hash_without_preload_content( + @validate_call + async def txs_without_preload_content( self, - hash: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, _request_timeout: Union[ None, Annotated[StrictFloat, Field(gt=0)], @@ -2009,12 +3220,14 @@ async def tx_from_l1_tx_hash_without_preload_content( _headers: Optional[Dict[StrictStr, Any]] = None, _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, ) -> RESTResponseType: - """txFromL1TxHash + """txs - Get L1 transaction by L1 transaction hash + Get transactions which are already packed into blocks - :param hash: (required) - :type hash: str + :param limit: (required) + :type limit: int + :param index: + :type 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 @@ -2037,8 +3250,9 @@ async def tx_from_l1_tx_hash_without_preload_content( :return: Returns the result object. """ # noqa: E501 - _param = self._tx_from_l1_tx_hash_serialize( - hash=hash, + _param = self._txs_serialize( + limit=limit, + index=index, _request_auth=_request_auth, _content_type=_content_type, _headers=_headers, @@ -2046,7 +3260,7 @@ async def tx_from_l1_tx_hash_without_preload_content( ) _response_types_map: Dict[str, Optional[str]] = { - '200': "EnrichedTx", + '200': "Txs", '400': "ResultCode", } response_data = await self.api_client.call_api( @@ -2056,9 +3270,10 @@ async def tx_from_l1_tx_hash_without_preload_content( return response_data.response - def _tx_from_l1_tx_hash_serialize( + def _txs_serialize( self, - hash, + limit, + index, _request_auth, _content_type, _headers, @@ -2074,14 +3289,20 @@ def _tx_from_l1_tx_hash_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if hash is not None: + if index is not None: - _query_params.append(('hash', hash)) + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) # process the header parameters # process the form parameters @@ -2103,7 +3324,7 @@ def _tx_from_l1_tx_hash_serialize( return self.api_client.param_serialize( method='GET', - resource_path='/api/v1/txFromL1TxHash', + resource_path='/api/v1/txs', path_params=_path_params, query_params=_query_params, header_params=_header_params, @@ -2119,11 +3340,11 @@ def _tx_from_l1_tx_hash_serialize( + @validate_call async def withdraw_history( self, + authorization: StrictStr, account_index: 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, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2141,14 +3362,12 @@ async def withdraw_history( ) -> WithdrawHistory: """withdraw_history - Get withdraw history + Get withdraw history. Secure withdrawals are only set to `claimable` when ready. You should only expect the `completed` status on fast withdrawals via Arbitrum. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 cursor: :type cursor: str :param filter: @@ -2176,9 +3395,8 @@ async def withdraw_history( """ # noqa: E501 _param = self._withdraw_history_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -2202,11 +3420,11 @@ async def withdraw_history( ).data + @validate_call async def withdraw_history_with_http_info( self, + authorization: StrictStr, account_index: 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, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2224,14 +3442,12 @@ async def withdraw_history_with_http_info( ) -> ApiResponse[WithdrawHistory]: """withdraw_history - Get withdraw history + Get withdraw history. Secure withdrawals are only set to `claimable` when ready. You should only expect the `completed` status on fast withdrawals via Arbitrum. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 cursor: :type cursor: str :param filter: @@ -2259,9 +3475,8 @@ async def withdraw_history_with_http_info( """ # noqa: E501 _param = self._withdraw_history_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -2285,11 +3500,11 @@ async def withdraw_history_with_http_info( ) + @validate_call async def withdraw_history_without_preload_content( self, + authorization: StrictStr, account_index: 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, cursor: Optional[StrictStr] = None, filter: Optional[StrictStr] = None, _request_timeout: Union[ @@ -2307,14 +3522,12 @@ async def withdraw_history_without_preload_content( ) -> RESTResponseType: """withdraw_history - Get withdraw history + Get withdraw history. Secure withdrawals are only set to `claimable` when ready. You should only expect the `completed` status on fast withdrawals via Arbitrum. + :param authorization: (required) + :type authorization: str :param account_index: (required) :type account_index: 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 cursor: :type cursor: str :param filter: @@ -2342,9 +3555,8 @@ async def withdraw_history_without_preload_content( """ # noqa: E501 _param = self._withdraw_history_serialize( - account_index=account_index, authorization=authorization, - auth=auth, + account_index=account_index, cursor=cursor, filter=filter, _request_auth=_request_auth, @@ -2366,9 +3578,8 @@ async def withdraw_history_without_preload_content( def _withdraw_history_serialize( self, - account_index, authorization, - auth, + account_index, cursor, filter, _request_auth, @@ -2386,19 +3597,13 @@ def _withdraw_history_serialize( _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]] = {} + _files: Dict[ + str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]] + ] = {} _body_params: Optional[bytes] = None # process the path parameters # process the query parameters - if authorization is not None: - - _query_params.append(('authorization', authorization)) - - if auth is not None: - - _query_params.append(('auth', auth)) - if account_index is not None: _query_params.append(('account_index', account_index)) @@ -2412,6 +3617,8 @@ def _withdraw_history_serialize( _query_params.append(('filter', filter)) # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization # process the form parameters # process the body parameter diff --git a/lighter/api_client.py b/lighter/api_client.py index c3c5849..65f6456 100644 --- a/lighter/api_client.py +++ b/lighter/api_client.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -12,14 +10,17 @@ """ # noqa: E501 + import datetime from dateutil.parser import parse from enum import Enum +import decimal import json import mimetypes import os import re import tempfile +import uuid from urllib.parse import quote from typing import Tuple, Optional, List, Dict, Union @@ -66,6 +67,8 @@ class ApiClient: 'bool': bool, 'date': datetime.date, 'datetime': datetime.datetime, + 'decimal': decimal.Decimal, + 'UUID': uuid.UUID, 'object': object, } _pool = None @@ -306,13 +309,13 @@ def response_deserialize( response_text = None return_data = None try: - if response_type == "bytearray": + if response_type in ("bytearray", "bytes"): return_data = response_data.data elif response_type == "file": return_data = self.__deserialize_file(response_data) elif response_type is not None: match = None - content_type = response_data.getheader('content-type') + content_type = response_data.headers.get('content-type') if content_type is not None: match = re.search(r"charset=([a-zA-Z\-\d]+)[\s;]?", content_type) encoding = match.group(1) if match else "utf-8" @@ -329,7 +332,7 @@ def response_deserialize( return ApiResponse( status_code = response_data.status, data = return_data, - headers = response_data.getheaders(), + headers = response_data.headers, raw_data = response_data.data ) @@ -341,6 +344,7 @@ def sanitize_for_serialization(self, obj): If obj is str, int, long, float, bool, return directly. If obj is datetime.datetime, datetime.date convert to string in iso8601 format. + If obj is decimal.Decimal return string representation. If obj is list, sanitize each element in the list. If obj is dict, return the dict. If obj is OpenAPI model, return the properties dict. @@ -356,6 +360,8 @@ def sanitize_for_serialization(self, obj): return obj.get_secret_value() elif isinstance(obj, self.PRIMITIVE_TYPES): return obj + elif isinstance(obj, uuid.UUID): + return str(obj) elif isinstance(obj, list): return [ self.sanitize_for_serialization(sub_obj) for sub_obj in obj @@ -366,6 +372,8 @@ def sanitize_for_serialization(self, obj): ) elif isinstance(obj, (datetime.datetime, datetime.date)): return obj.isoformat() + elif isinstance(obj, decimal.Decimal): + return str(obj) elif isinstance(obj, dict): obj_dict = obj @@ -380,6 +388,10 @@ def sanitize_for_serialization(self, obj): else: obj_dict = obj.__dict__ + if isinstance(obj_dict, list): + # here we handle instances that can either be a list or something else, and only became a real list by calling to_dict() + return self.sanitize_for_serialization(obj_dict) + return { key: self.sanitize_for_serialization(val) for key, val in obj_dict.items() @@ -402,12 +414,12 @@ def deserialize(self, response_text: str, response_type: str, content_type: Opti data = json.loads(response_text) except ValueError: data = response_text - elif content_type.startswith("application/json"): + elif re.match(r'^application/(json|[\w!#$&.+\-^_]+\+json)\s*(;|$)', content_type, re.IGNORECASE): if response_text == "": data = "" else: data = json.loads(response_text) - elif content_type.startswith("text/plain"): + elif re.match(r'^text\/[a-z.+-]+\s*(;|$)', content_type, re.IGNORECASE): data = response_text else: raise ApiException( @@ -451,12 +463,16 @@ def __deserialize(self, data, klass): if klass in self.PRIMITIVE_TYPES: return self.__deserialize_primitive(data, klass) - elif klass == object: + elif klass is object: return self.__deserialize_object(data) - elif klass == datetime.date: + elif klass is datetime.date: return self.__deserialize_date(data) - elif klass == datetime.datetime: + elif klass is datetime.datetime: return self.__deserialize_datetime(data) + elif klass is decimal.Decimal: + return decimal.Decimal(data) + elif klass is uuid.UUID: + return uuid.UUID(data) elif issubclass(klass, Enum): return self.__deserialize_enum(data, klass) else: @@ -513,7 +529,7 @@ def parameters_to_url_query(self, params, collection_formats): if k in collection_formats: collection_format = collection_formats[k] if collection_format == 'multi': - new_params.extend((k, str(value)) for value in v) + new_params.extend((k, quote(str(value))) for value in v) else: if collection_format == 'ssv': delimiter = ' ' @@ -531,7 +547,10 @@ def parameters_to_url_query(self, params, collection_formats): return "&".join(["=".join(map(str, item)) for item in new_params]) - def files_parameters(self, files: Dict[str, Union[str, bytes]]): + def files_parameters( + self, + files: Dict[str, Union[str, bytes, List[str], List[bytes], Tuple[str, bytes]]], + ): """Builds form parameters. :param files: File parameters. @@ -546,6 +565,12 @@ def files_parameters(self, files: Dict[str, Union[str, bytes]]): elif isinstance(v, bytes): filename = k filedata = v + elif isinstance(v, tuple): + filename, filedata = v + elif isinstance(v, list): + for file_param in v: + params.extend(self.files_parameters({k: file_param})) + continue else: raise ValueError("Unsupported file value") mimetype = ( @@ -681,14 +706,16 @@ def __deserialize_file(self, response): os.close(fd) os.remove(path) - content_disposition = response.getheader("Content-Disposition") + content_disposition = response.headers.get("Content-Disposition") if content_disposition: m = re.search( r'filename=[\'"]?([^\'"\s]+)[\'"]?', content_disposition ) assert m is not None, "Unexpected 'content-disposition' header value" - filename = m.group(1) + filename = os.path.basename(m.group(1)) # Strip any directory traversal + if filename in ("", ".", ".."): # fall back to tmp filename + filename = os.path.basename(path) path = os.path.join(os.path.dirname(path), filename) with open(path, "wb") as f: diff --git a/lighter/configuration.py b/lighter/configuration.py index ff0507e..c2ee6b9 100644 --- a/lighter/configuration.py +++ b/lighter/configuration.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -12,14 +10,16 @@ """ # noqa: E501 +import base64 import copy +import http.client as httplib import logging from logging import FileHandler import sys -from typing import Optional -import urllib3 +from typing import Any, ClassVar, Dict, List, Literal, Optional, TypedDict, Union +from typing_extensions import NotRequired, Self + -import http.client as httplib JSON_SCHEMA_VALIDATION_KEYWORDS = { 'multipleOf', 'maximum', 'exclusiveMaximum', @@ -27,6 +27,107 @@ 'minLength', 'pattern', 'maxItems', 'minItems' } +ServerVariablesT = Dict[str, str] + +GenericAuthSetting = TypedDict( + "GenericAuthSetting", + { + "type": str, + "in": str, + "key": str, + "value": str, + }, +) + + +OAuth2AuthSetting = TypedDict( + "OAuth2AuthSetting", + { + "type": Literal["oauth2"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +APIKeyAuthSetting = TypedDict( + "APIKeyAuthSetting", + { + "type": Literal["api_key"], + "in": str, + "key": str, + "value": Optional[str], + }, +) + + +BasicAuthSetting = TypedDict( + "BasicAuthSetting", + { + "type": Literal["basic"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": Optional[str], + }, +) + + +BearerFormatAuthSetting = TypedDict( + "BearerFormatAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "format": Literal["JWT"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +BearerAuthSetting = TypedDict( + "BearerAuthSetting", + { + "type": Literal["bearer"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": str, + }, +) + + +HTTPSignatureAuthSetting = TypedDict( + "HTTPSignatureAuthSetting", + { + "type": Literal["http-signature"], + "in": Literal["header"], + "key": Literal["Authorization"], + "value": None, + }, +) + + +AuthSettings = TypedDict( + "AuthSettings", + { + "apiKey": APIKeyAuthSetting, + }, + total=False, +) + + +class HostSettingVariable(TypedDict): + description: str + default_value: str + enum_values: List[str] + + +class HostSetting(TypedDict): + url: str + description: str + variables: NotRequired[Dict[str, HostSettingVariable]] + + class Configuration: """This class contains various settings of the API client. @@ -54,9 +155,25 @@ class Configuration: string values to replace variables in templated server configuration. The validation of enums is performed for variables with defined enum values before. + :param verify_ssl: bool - Set this to false to skip verifying SSL certificate + when calling API from https server. :param ssl_ca_cert: str - the path to a file of concatenated CA certificates in PEM format. - :param retries: Number of retries for API requests. + :param retries: int | aiohttp_retry.RetryOptionsBase - Retry configuration. + :param ca_cert_data: verify the peer using concatenated CA certificate data + in PEM (str) or DER (bytes) format. + :param cert_file: the path to a client certificate file, for mTLS. + :param key_file: the path to a client key file, for mTLS. + :param assert_hostname: Set this to True/False to enable/disable SSL hostname verification. + :param tls_server_name: SSL/TLS Server Name Indication (SNI). Set this to the SNI value expected by the server. + :param connection_pool_maxsize: Connection pool max size. None in the constructor is coerced to 100 for async and cpu_count * 5 for sync. + :param proxy: Proxy URL. + :param proxy_headers: Proxy headers. + :param safe_chars_for_path_param: Safe characters for path parameter encoding. + :param client_side_validation: Enable client-side validation. Default True. + :param socket_options: Options to pass down to the underlying urllib3 socket. + :param datetime_format: Datetime format string for serialization. + :param date_format: Date format string for serialization. :Example: @@ -80,20 +197,40 @@ class Configuration: Cookie: JSESSIONID abc123 """ - _default = None - - def __init__(self, host=None, - api_key=None, api_key_prefix=None, - username=None, password=None, - access_token=None, - server_index=None, server_variables=None, - server_operation_index=None, server_operation_variables=None, - ignore_operation_servers=False, - ssl_ca_cert=None, - retries=None, - *, - debug: Optional[bool] = None - ) -> None: + _default: ClassVar[Optional[Self]] = None + + def __init__( + self, + host: Optional[str]=None, + api_key: Optional[Dict[str, str]]=None, + api_key_prefix: Optional[Dict[str, str]]=None, + username: Optional[str]=None, + password: Optional[str]=None, + access_token: Optional[str]=None, + server_index: Optional[int]=None, + server_variables: Optional[ServerVariablesT]=None, + server_operation_index: Optional[Dict[int, int]]=None, + server_operation_variables: Optional[Dict[int, ServerVariablesT]]=None, + ignore_operation_servers: bool=False, + ssl_ca_cert: Optional[str]=None, + retries: Optional[Union[int, Any]] = None, + ca_cert_data: Optional[Union[str, bytes]] = None, + cert_file: Optional[str]=None, + key_file: Optional[str]=None, + verify_ssl: bool=True, + assert_hostname: Optional[bool]=None, + tls_server_name: Optional[str]=None, + connection_pool_maxsize: Optional[int]=None, + proxy: Optional[str]=None, + proxy_headers: Optional[Any]=None, + safe_chars_for_path_param: str='', + client_side_validation: bool=True, + socket_options: Optional[Any]=None, + datetime_format: str="%Y-%m-%dT%H:%M:%S.%f%z", + date_format: str="%Y-%m-%d", + *, + debug: Optional[bool] = None, + ) -> None: """Constructor """ self._base_path = "https://mainnet.zklighter.elliot.ai" if host is None else host @@ -140,7 +277,6 @@ def __init__(self, host=None, """Logging Settings """ self.logger["package_logger"] = logging.getLogger("lighter") - self.logger["urllib3_logger"] = logging.getLogger("urllib3") self.logger_format = '%(asctime)s %(levelname)s %(message)s' """Log format """ @@ -160,7 +296,7 @@ def __init__(self, host=None, """Debug switch """ - self.verify_ssl = True + self.verify_ssl = verify_ssl """SSL/TLS verification Set this to false to skip verifying SSL certificate when calling API from https server. @@ -168,53 +304,57 @@ def __init__(self, host=None, self.ssl_ca_cert = ssl_ca_cert """Set this to customize the certificate file to verify the peer. """ - self.cert_file = None + self.ca_cert_data = ca_cert_data + """Set this to verify the peer using PEM (str) or DER (bytes) + certificate data. + """ + self.cert_file = cert_file """client certificate file """ - self.key_file = None + self.key_file = key_file """client key file """ - self.assert_hostname = None + self.assert_hostname = assert_hostname """Set this to True/False to enable/disable SSL hostname verification. """ - self.tls_server_name = None + self.tls_server_name = tls_server_name """SSL/TLS Server Name Indication (SNI) Set this to the SNI value expected by the server. """ - self.connection_pool_maxsize = 100 + self.connection_pool_maxsize = connection_pool_maxsize if connection_pool_maxsize is not None else 100 """This value is passed to the aiohttp to limit simultaneous connections. - Default values is 100, None means no-limit. + None in the constructor is coerced to default 100. """ - self.proxy: Optional[str] = None + self.proxy = proxy """Proxy URL """ - self.proxy_headers = None + self.proxy_headers = proxy_headers """Proxy headers """ - self.safe_chars_for_path_param = '' + self.safe_chars_for_path_param = safe_chars_for_path_param """Safe chars for path_param """ self.retries = retries - """Adding retries to override urllib3 default value 3 + """Retry configuration """ # Enable client side validation - self.client_side_validation = True + self.client_side_validation = client_side_validation - self.socket_options = None + self.socket_options = socket_options """Options to pass down to the underlying urllib3 socket """ - self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + self.datetime_format = datetime_format """datetime format """ - self.date_format = "%Y-%m-%d" + self.date_format = date_format """date format """ - def __deepcopy__(self, memo): + def __deepcopy__(self, memo: Dict[int, Any]) -> Self: cls = self.__class__ result = cls.__new__(cls) memo[id(self)] = result @@ -228,11 +368,11 @@ def __deepcopy__(self, memo): result.debug = self.debug return result - def __setattr__(self, name, value): + def __setattr__(self, name: str, value: Any) -> None: object.__setattr__(self, name, value) @classmethod - def set_default(cls, default): + def set_default(cls, default: Optional[Self]) -> None: """Set default instance of configuration. It stores default configuration, which can be @@ -243,7 +383,7 @@ def set_default(cls, default): cls._default = default @classmethod - def get_default_copy(cls): + def get_default_copy(cls) -> Self: """Deprecated. Please use `get_default` instead. Deprecated. Please use `get_default` instead. @@ -253,7 +393,7 @@ def get_default_copy(cls): return cls.get_default() @classmethod - def get_default(cls): + def get_default(cls) -> Self: """Return the default configuration. This method returns newly created, based on default constructor, @@ -263,11 +403,11 @@ def get_default(cls): :return: The configuration object. """ if cls._default is None: - cls._default = Configuration() + cls._default = cls() return cls._default @property - def logger_file(self): + def logger_file(self) -> Optional[str]: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -279,7 +419,7 @@ def logger_file(self): return self.__logger_file @logger_file.setter - def logger_file(self, value): + def logger_file(self, value: Optional[str]) -> None: """The logger file. If the logger_file is None, then add stream handler and remove file @@ -298,7 +438,7 @@ def logger_file(self, value): logger.addHandler(self.logger_file_handler) @property - def debug(self): + def debug(self) -> bool: """Debug status :param value: The debug status, True or False. @@ -307,7 +447,7 @@ def debug(self): return self.__debug @debug.setter - def debug(self, value): + def debug(self, value: bool) -> None: """Debug status :param value: The debug status, True or False. @@ -329,7 +469,7 @@ def debug(self, value): httplib.HTTPConnection.debuglevel = 0 @property - def logger_format(self): + def logger_format(self) -> str: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -340,7 +480,7 @@ def logger_format(self): return self.__logger_format @logger_format.setter - def logger_format(self, value): + def logger_format(self, value: str) -> None: """The logger format. The logger_formatter will be updated when sets logger_format. @@ -351,7 +491,7 @@ def logger_format(self, value): self.__logger_format = value self.logger_formatter = logging.Formatter(self.__logger_format) - def get_api_key_with_prefix(self, identifier, alias=None): + def get_api_key_with_prefix(self, identifier: str, alias: Optional[str]=None) -> Optional[str]: """Gets API key (with prefix if set). :param identifier: The identifier of apiKey. @@ -368,7 +508,9 @@ def get_api_key_with_prefix(self, identifier, alias=None): else: return key - def get_basic_auth_token(self): + return None + + def get_basic_auth_token(self) -> Optional[str]: """Gets HTTP basic authentication header (string). :return: The token for basic HTTP authentication. @@ -379,16 +521,17 @@ def get_basic_auth_token(self): password = "" if self.password is not None: password = self.password - return urllib3.util.make_headers( - basic_auth=username + ':' + password - ).get('authorization') - def auth_settings(self): + return "Basic " + base64.b64encode( + (username + ":" + password).encode('utf-8') + ).decode('utf-8') + + def auth_settings(self)-> AuthSettings: """Gets Auth Settings dict for api client. :return: The Auth Settings information dict. """ - auth = {} + auth: AuthSettings = {} if 'apiKey' in self.api_key: auth['apiKey'] = { 'type': 'api_key', @@ -400,7 +543,7 @@ def auth_settings(self): } return auth - def to_debug_report(self): + def to_debug_report(self) -> str: """Gets the essential information for debugging. :return: The report for debugging. @@ -412,7 +555,7 @@ def to_debug_report(self): "SDK Package Version: 1.0.0".\ format(env=sys.platform, pyversion=sys.version) - def get_host_settings(self): + def get_host_settings(self) -> List[HostSetting]: """Gets an array of host settings :return: An array of host settings @@ -424,7 +567,12 @@ def get_host_settings(self): } ] - def get_host_from_settings(self, index, variables=None, servers=None): + def get_host_from_settings( + self, + index: Optional[int], + variables: Optional[ServerVariablesT]=None, + servers: Optional[List[HostSetting]]=None, + ) -> str: """Gets host URL based on the index and variables :param index: array index of the host settings :param variables: hash of variable and the corresponding value @@ -452,6 +600,7 @@ def get_host_from_settings(self, index, variables=None, servers=None): variable_name, variable['default_value']) if 'enum_values' in variable \ + and variable['enum_values'] \ and used_value not in variable['enum_values']: raise ValueError( "The variable `{0}` in the host URL has invalid value " @@ -464,12 +613,12 @@ def get_host_from_settings(self, index, variables=None, servers=None): return url @property - def host(self): + def host(self) -> str: """Return generated host.""" return self.get_host_from_settings(self.server_index, variables=self.server_variables) @host.setter - def host(self, value): + def host(self, value: str) -> None: """Fix base path.""" self._base_path = value self.server_index = None diff --git a/lighter/exceptions.py b/lighter/exceptions.py index a2fd39d..c599422 100644 --- a/lighter/exceptions.py +++ b/lighter/exceptions.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -11,6 +9,7 @@ Do not edit the class manually. """ # noqa: E501 + from typing import Any, Optional from typing_extensions import Self @@ -128,7 +127,7 @@ def __init__( self.body = http_resp.data.decode('utf-8') except Exception: pass - self.headers = http_resp.getheaders() + self.headers = http_resp.headers @classmethod def from_response( @@ -150,6 +149,13 @@ def from_response( if http_resp.status == 404: raise NotFoundException(http_resp=http_resp, body=body, data=data) + # Added new conditions for 409 and 422 + if http_resp.status == 409: + raise ConflictException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 422: + raise UnprocessableEntityException(http_resp=http_resp, body=body, data=data) + if 500 <= http_resp.status <= 599: raise ServiceException(http_resp=http_resp, body=body, data=data) raise ApiException(http_resp=http_resp, body=body, data=data) @@ -162,8 +168,11 @@ def __str__(self): error_message += "HTTP response headers: {0}\n".format( self.headers) - if self.data or self.body: - error_message += "HTTP response body: {0}\n".format(self.data or self.body) + if self.body: + error_message += "HTTP response body: {0}\n".format(self.body) + + if self.data: + error_message += "HTTP response data: {0}\n".format(self.data) return error_message @@ -188,6 +197,16 @@ class ServiceException(ApiException): pass +class ConflictException(ApiException): + """Exception for HTTP 409 Conflict.""" + pass + + +class UnprocessableEntityException(ApiException): + """Exception for HTTP 422 Unprocessable Entity.""" + pass + + def render_path(path_to_item): """Returns a string representation of a path""" result = "" diff --git a/lighter/models/__init__.py b/lighter/models/__init__.py index a8bf7f6..5f0bbeb 100644 --- a/lighter/models/__init__.py +++ b/lighter/models/__init__.py @@ -12,7 +12,6 @@ Do not edit the class manually. """ # noqa: E501 - # import models into model package from lighter.models.account import Account from lighter.models.account_api_keys import AccountApiKeys @@ -33,14 +32,20 @@ from lighter.models.approved_integrator import ApprovedIntegrator from lighter.models.asset import Asset from lighter.models.asset_details import AssetDetails -from lighter.models.auth import Auth -from lighter.models.bridge import Bridge +from lighter.models.block import Block +from lighter.models.blocks import Blocks from lighter.models.bridge_supported_network import BridgeSupportedNetwork +from lighter.models.bridge_supported_networks import BridgeSupportedNetworks from lighter.models.candle import Candle from lighter.models.candles import Candles +from lighter.models.candlestick import Candlestick +from lighter.models.candlesticks import Candlesticks from lighter.models.contract_address import ContractAddress +from lighter.models.create_intent_address_resp import CreateIntentAddressResp +from lighter.models.current_height import CurrentHeight from lighter.models.cursor import Cursor from lighter.models.daily_return import DailyReturn +from lighter.models.deposit import Deposit from lighter.models.deposit_history import DepositHistory from lighter.models.deposit_history_item import DepositHistoryItem from lighter.models.detailed_account import DetailedAccount @@ -57,6 +62,7 @@ from lighter.models.fundings import Fundings from lighter.models.l1_metadata import L1Metadata from lighter.models.l1_provider_info import L1ProviderInfo +from lighter.models.layer1_basic_info import Layer1BasicInfo from lighter.models.lease_entry import LeaseEntry from lighter.models.lease_option_entry import LeaseOptionEntry from lighter.models.liq_trade import LiqTrade @@ -68,7 +74,6 @@ from lighter.models.order import Order from lighter.models.order_book import OrderBook from lighter.models.order_book_depth import OrderBookDepth -from lighter.models.order_book_depth_with_begin_nonce import OrderBookDepthWithBeginNonce from lighter.models.order_book_details import OrderBookDetails from lighter.models.order_book_orders import OrderBookOrders from lighter.models.order_book_stats import OrderBookStats @@ -85,9 +90,10 @@ 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.push_notif_delivery_result import PushNotifDeliveryResult from lighter.models.referral import Referral -from lighter.models.req_do_faucet import ReqDoFaucet +from lighter.models.referral_code import ReferralCode +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 @@ -98,60 +104,52 @@ from lighter.models.req_get_account_metadata import ReqGetAccountMetadata from lighter.models.req_get_account_pn_l import ReqGetAccountPnL from lighter.models.req_get_account_txs import ReqGetAccountTxs -from lighter.models.req_get_api_tokens import ReqGetApiTokens -from lighter.models.req_get_asset_details import ReqGetAssetDetails from lighter.models.req_get_block import ReqGetBlock from lighter.models.req_get_block_txs import ReqGetBlockTxs -from lighter.models.req_get_bridges_by_l1_addr import ReqGetBridgesByL1Addr from lighter.models.req_get_by_account import ReqGetByAccount -from lighter.models.req_get_candles import ReqGetCandles +from lighter.models.req_get_candlesticks import ReqGetCandlesticks from lighter.models.req_get_deposit_history import ReqGetDepositHistory -from lighter.models.req_get_exchange_metrics import ReqGetExchangeMetrics -from lighter.models.req_get_execute_stats import ReqGetExecuteStats from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo from lighter.models.req_get_fundings import ReqGetFundings from lighter.models.req_get_l1_metadata import ReqGetL1Metadata from lighter.models.req_get_l1_tx import ReqGetL1Tx from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit -from lighter.models.req_get_leases import ReqGetLeases from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos from lighter.models.req_get_maker_only_api_keys import ReqGetMakerOnlyApiKeys from lighter.models.req_get_next_nonce import ReqGetNextNonce from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders from lighter.models.req_get_order_books import ReqGetOrderBooks -from lighter.models.req_get_partner_stats import ReqGetPartnerStats from lighter.models.req_get_position_funding import ReqGetPositionFunding from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata -from lighter.models.req_get_push_notif_settings import ReqGetPushNotifSettings 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 from lighter.models.req_get_recent_trades import ReqGetRecentTrades +from lighter.models.req_get_referral_points import ReqGetReferralPoints from lighter.models.req_get_trades import ReqGetTrades from lighter.models.req_get_transfer_fee_info import ReqGetTransferFeeInfo from lighter.models.req_get_transfer_history import ReqGetTransferHistory from lighter.models.req_get_tx import ReqGetTx -from lighter.models.req_get_user_referrals import ReqGetUserReferrals from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory +from lighter.models.req_set_account_metadata import ReqSetAccountMetadata from lighter.models.resp_change_account_tier import RespChangeAccountTier from lighter.models.resp_get_api_tokens import RespGetApiTokens -from lighter.models.resp_get_bridges_by_l1_addr import RespGetBridgesByL1Addr from lighter.models.resp_get_exchange_metrics import RespGetExchangeMetrics from lighter.models.resp_get_execute_stats import RespGetExecuteStats from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo from lighter.models.resp_get_fastwithdrawal_info import RespGetFastwithdrawalInfo -from lighter.models.resp_get_is_next_bridge_fast import RespGetIsNextBridgeFast from lighter.models.resp_get_lease_options import RespGetLeaseOptions from lighter.models.resp_get_leases import RespGetLeases from lighter.models.resp_get_maker_only_api_keys import RespGetMakerOnlyApiKeys -from lighter.models.resp_get_push_notif_settings import RespGetPushNotifSettings from lighter.models.resp_post_api_token import RespPostApiToken from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata from lighter.models.resp_revoke_api_token import RespRevokeApiToken from lighter.models.resp_send_tx import RespSendTx from lighter.models.resp_send_tx_batch import RespSendTxBatch from lighter.models.resp_set_maker_only_api_keys import RespSetMakerOnlyApiKeys +from lighter.models.resp_update_kickback import RespUpdateKickback +from lighter.models.resp_update_referral_code import RespUpdateReferralCode from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay from lighter.models.result_code import ResultCode from lighter.models.risk_info import RiskInfo @@ -167,14 +165,18 @@ from lighter.models.sub_accounts import SubAccounts from lighter.models.system_config import SystemConfig from lighter.models.ticker import Ticker +from lighter.models.token import Token +from lighter.models.token_list import TokenList from lighter.models.trade import Trade from lighter.models.trade_stats import TradeStats from lighter.models.trades import Trades from lighter.models.transfer_fee_info import TransferFeeInfo from lighter.models.transfer_history import TransferHistory from lighter.models.transfer_history_item import TransferHistoryItem +from lighter.models.tx import Tx from lighter.models.tx_hash import TxHash from lighter.models.tx_hashes import TxHashes +from lighter.models.txs import Txs from lighter.models.user_referrals import UserReferrals from lighter.models.validator_info import ValidatorInfo from lighter.models.withdraw_history import WithdrawHistory diff --git a/lighter/models/account.py b/lighter/models/account.py index 78d42db..4dd485a 100644 --- a/lighter/models/account.py +++ b/lighter/models/account.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +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 +from pydantic_core import to_jsonable_python class Account(BaseModel): """ @@ -29,6 +30,7 @@ class Account(BaseModel): code: StrictInt message: Optional[StrictStr] = None account_type: StrictInt + account_trading_mode: StrictInt = Field(description="Classic=0 and Unified=1") index: StrictInt l1_address: StrictStr cancel_all_time: StrictInt @@ -39,12 +41,12 @@ class Account(BaseModel): status: StrictInt collateral: StrictStr transaction_time: StrictInt - account_trading_mode: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "transaction_time", "account_trading_mode"] + __properties: ClassVar[List[str]] = ["code", "message", "account_type", "account_trading_mode", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "transaction_time"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -100,10 +101,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "account_type": obj.get("account_type"), + "account_trading_mode": obj.get("account_trading_mode"), "index": obj.get("index"), "l1_address": obj.get("l1_address"), "cancel_all_time": obj.get("cancel_all_time"), @@ -113,8 +115,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "available_balance": obj.get("available_balance"), "status": obj.get("status"), "collateral": obj.get("collateral"), - "transaction_time": obj.get("transaction_time"), - "account_trading_mode": obj.get("account_trading_mode") + "transaction_time": obj.get("transaction_time") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_api_keys.py b/lighter/models/account_api_keys.py index 78d7dbd..d2ab143 100644 --- a/lighter/models/account_api_keys.py +++ b/lighter/models/account_api_keys.py @@ -22,6 +22,7 @@ from lighter.models.api_key import ApiKey from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountApiKeys(BaseModel): """ @@ -34,7 +35,8 @@ class AccountApiKeys(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "api_keys"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in api_keys (list) _items = [] if self.api_keys: - for _item in self.api_keys: - if _item: - _items.append(_item.to_dict()) + for _item_api_keys in self.api_keys: + if _item_api_keys: + _items.append(_item_api_keys.to_dict()) _dict['api_keys'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "api_keys": [ApiKey.from_dict(_item) for _item in obj["api_keys"]] if obj.get("api_keys") is not None else None diff --git a/lighter/models/account_asset.py b/lighter/models/account_asset.py index c6ca30a..6d91462 100644 --- a/lighter/models/account_asset.py +++ b/lighter/models/account_asset.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountAsset(BaseModel): """ @@ -30,11 +31,21 @@ class AccountAsset(BaseModel): asset_id: StrictInt balance: StrictStr locked_balance: StrictStr + margin_balance: StrictStr + margin_mode: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["symbol", "asset_id", "balance", "locked_balance"] + __properties: ClassVar[List[str]] = ["symbol", "asset_id", "balance", "locked_balance", "margin_balance", "margin_mode"] + + @field_validator('margin_mode') + def margin_mode_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['enabled', 'disabled']): + raise ValueError("must be one of enum values ('enabled', 'disabled')") + return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,11 +100,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "asset_id": obj.get("asset_id"), "balance": obj.get("balance"), - "locked_balance": obj.get("locked_balance") + "locked_balance": obj.get("locked_balance"), + "margin_balance": obj.get("margin_balance"), + "margin_mode": obj.get("margin_mode") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_limits.py b/lighter/models/account_limits.py index 4803894..d91937c 100644 --- a/lighter/models/account_limits.py +++ b/lighter/models/account_limits.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountLimits(BaseModel): """ @@ -29,19 +30,20 @@ class AccountLimits(BaseModel): code: StrictInt message: Optional[StrictStr] = None max_llp_percentage: StrictInt - max_llp_amount: StrictStr user_tier: StrictStr can_create_public_pool: StrictBool - user_tier_name: StrictStr + max_llp_amount: StrictStr current_maker_fee_tick: StrictInt current_taker_fee_tick: StrictInt - leased_lit: StrictStr - effective_lit_stakes: StrictStr + effective_lit_stakes: StrictStr = Field(description="Effective staked LIT shares including active leases.") + leased_lit: StrictStr = Field(description="Total actively leased LIT.") + user_tier_name: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage", "max_llp_amount", "user_tier", "can_create_public_pool", "user_tier_name", "current_maker_fee_tick", "current_taker_fee_tick", "leased_lit", "effective_lit_stakes"] + __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage", "user_tier", "can_create_public_pool", "max_llp_amount", "current_maker_fee_tick", "current_taker_fee_tick", "effective_lit_stakes", "leased_lit", "user_tier_name"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -97,18 +98,18 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "max_llp_percentage": obj.get("max_llp_percentage"), - "max_llp_amount": obj.get("max_llp_amount"), "user_tier": obj.get("user_tier"), "can_create_public_pool": obj.get("can_create_public_pool"), - "user_tier_name": obj.get("user_tier_name"), + "max_llp_amount": obj.get("max_llp_amount"), "current_maker_fee_tick": obj.get("current_maker_fee_tick"), "current_taker_fee_tick": obj.get("current_taker_fee_tick"), + "effective_lit_stakes": obj.get("effective_lit_stakes"), "leased_lit": obj.get("leased_lit"), - "effective_lit_stakes": obj.get("effective_lit_stakes") + "user_tier_name": obj.get("user_tier_name") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_margin_stats.py b/lighter/models/account_margin_stats.py index 03e5dea..565da79 100644 --- a/lighter/models/account_margin_stats.py +++ b/lighter/models/account_margin_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountMarginStats(BaseModel): """ @@ -36,7 +37,8 @@ class AccountMarginStats(BaseModel): __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -92,7 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "collateral": obj.get("collateral"), "portfolio_value": obj.get("portfolio_value"), "leverage": obj.get("leverage"), diff --git a/lighter/models/account_market_stats.py b/lighter/models/account_market_stats.py index 7065b2d..68b2a72 100644 --- a/lighter/models/account_market_stats.py +++ b/lighter/models/account_market_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountMarketStats(BaseModel): """ @@ -43,7 +44,8 @@ class AccountMarketStats(BaseModel): __properties: ClassVar[List[str]] = ["market_id", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "weekly_trades_count", "weekly_base_token_volume", "weekly_quote_token_volume", "monthly_trades_count", "monthly_base_token_volume", "monthly_quote_token_volume", "total_trades_count", "total_base_token_volume", "total_quote_token_volume"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -99,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "daily_trades_count": obj.get("daily_trades_count"), "daily_base_token_volume": obj.get("daily_base_token_volume"), diff --git a/lighter/models/account_metadata.py b/lighter/models/account_metadata.py index feb1ae6..af09201 100644 --- a/lighter/models/account_metadata.py +++ b/lighter/models/account_metadata.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountMetadata(BaseModel): """ @@ -31,13 +32,14 @@ class AccountMetadata(BaseModel): description: StrictStr can_invite: StrictBool = Field(description=" Remove After FE uses L1 meta endpoint") referral_points_percentage: StrictStr = Field(description=" Remove After FE uses L1 meta endpoint") - can_rfq: StrictBool created_at: StrictInt + can_rfq: StrictBool additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["account_index", "name", "description", "can_invite", "referral_points_percentage", "can_rfq", "created_at"] + __properties: ClassVar[List[str]] = ["account_index", "name", "description", "can_invite", "referral_points_percentage", "created_at", "can_rfq"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,14 +94,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "name": obj.get("name"), "description": obj.get("description"), "can_invite": obj.get("can_invite"), "referral_points_percentage": obj.get("referral_points_percentage"), - "can_rfq": obj.get("can_rfq"), - "created_at": obj.get("created_at") + "created_at": obj.get("created_at"), + "can_rfq": obj.get("can_rfq") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_metadatas.py b/lighter/models/account_metadatas.py index 13d1d3b..2385431 100644 --- a/lighter/models/account_metadatas.py +++ b/lighter/models/account_metadatas.py @@ -22,6 +22,7 @@ from lighter.models.account_metadata import AccountMetadata from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountMetadatas(BaseModel): """ @@ -30,12 +31,12 @@ class AccountMetadatas(BaseModel): code: StrictInt message: Optional[StrictStr] = None account_metadatas: List[AccountMetadata] - next_cursor: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_metadatas", "next_cursor"] + __properties: ClassVar[List[str]] = ["code", "message", "account_metadatas"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in account_metadatas (list) _items = [] if self.account_metadatas: - for _item in self.account_metadatas: - if _item: - _items.append(_item.to_dict()) + for _item_account_metadatas in self.account_metadatas: + if _item_account_metadatas: + _items.append(_item_account_metadatas.to_dict()) _dict['account_metadatas'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,11 +98,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), - "account_metadatas": [AccountMetadata.from_dict(_item) for _item in obj["account_metadatas"]] if obj.get("account_metadatas") is not None else None, - "next_cursor": obj.get("next_cursor") + "account_metadatas": [AccountMetadata.from_dict(_item) for _item in obj["account_metadatas"]] if obj.get("account_metadatas") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_pn_l.py b/lighter/models/account_pn_l.py index 55ec511..57fd270 100644 --- a/lighter/models/account_pn_l.py +++ b/lighter/models/account_pn_l.py @@ -22,6 +22,7 @@ from lighter.models.pn_l_entry import PnLEntry from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountPnL(BaseModel): """ @@ -35,7 +36,8 @@ class AccountPnL(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "resolution", "pnl"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in pnl (list) _items = [] if self.pnl: - for _item in self.pnl: - if _item: - _items.append(_item.to_dict()) + for _item_pnl in self.pnl: + if _item_pnl: + _items.append(_item_pnl.to_dict()) _dict['pnl'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "resolution": obj.get("resolution"), diff --git a/lighter/models/account_position.py b/lighter/models/account_position.py index 1881645..6ce7cc1 100644 --- a/lighter/models/account_position.py +++ b/lighter/models/account_position.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountPosition(BaseModel): """ @@ -47,7 +48,8 @@ class AccountPosition(BaseModel): __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", "total_discount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -103,7 +104,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "symbol": obj.get("symbol"), "initial_margin_fraction": obj.get("initial_margin_fraction"), diff --git a/lighter/models/account_stats.py b/lighter/models/account_stats.py index 1dbc3a5..47071d6 100644 --- a/lighter/models/account_stats.py +++ b/lighter/models/account_stats.py @@ -22,6 +22,7 @@ from lighter.models.account_margin_stats import AccountMarginStats from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountStats(BaseModel): """ @@ -33,14 +34,15 @@ class AccountStats(BaseModel): available_balance: StrictStr margin_usage: StrictStr buying_power: StrictStr - account_trading_mode: StrictInt cross_stats: AccountMarginStats total_stats: AccountMarginStats + account_trading_mode: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power", "account_trading_mode", "cross_stats", "total_stats"] + __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power", "cross_stats", "total_stats", "account_trading_mode"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -102,16 +103,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "collateral": obj.get("collateral"), "portfolio_value": obj.get("portfolio_value"), "leverage": obj.get("leverage"), "available_balance": obj.get("available_balance"), "margin_usage": obj.get("margin_usage"), "buying_power": obj.get("buying_power"), - "account_trading_mode": obj.get("account_trading_mode"), "cross_stats": AccountMarginStats.from_dict(obj["cross_stats"]) if obj.get("cross_stats") is not None else None, - "total_stats": AccountMarginStats.from_dict(obj["total_stats"]) if obj.get("total_stats") is not None else None + "total_stats": AccountMarginStats.from_dict(obj["total_stats"]) if obj.get("total_stats") is not None else None, + "account_trading_mode": obj.get("account_trading_mode") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/account_trade_stats.py b/lighter/models/account_trade_stats.py index 2a783fc..a94d8bb 100644 --- a/lighter/models/account_trade_stats.py +++ b/lighter/models/account_trade_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AccountTradeStats(BaseModel): """ @@ -38,7 +39,8 @@ class AccountTradeStats(BaseModel): __properties: ClassVar[List[str]] = ["daily_trades_count", "daily_volume", "weekly_trades_count", "weekly_volume", "monthly_trades_count", "monthly_volume", "total_trades_count", "total_volume"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "daily_trades_count": obj.get("daily_trades_count"), "daily_volume": obj.get("daily_volume"), "weekly_trades_count": obj.get("weekly_trades_count"), diff --git a/lighter/models/announcement.py b/lighter/models/announcement.py index a721cf3..6d1f97a 100644 --- a/lighter/models/announcement.py +++ b/lighter/models/announcement.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Announcement(BaseModel): """ @@ -34,7 +35,8 @@ class Announcement(BaseModel): __properties: ClassVar[List[str]] = ["title", "content", "created_at", "expired_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "title": obj.get("title"), "content": obj.get("content"), "created_at": obj.get("created_at"), diff --git a/lighter/models/announcements.py b/lighter/models/announcements.py index 4eb8081..a5fa666 100644 --- a/lighter/models/announcements.py +++ b/lighter/models/announcements.py @@ -22,6 +22,7 @@ from lighter.models.announcement import Announcement from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Announcements(BaseModel): """ @@ -34,7 +35,8 @@ class Announcements(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "announcements"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in announcements (list) _items = [] if self.announcements: - for _item in self.announcements: - if _item: - _items.append(_item.to_dict()) + for _item_announcements in self.announcements: + if _item_announcements: + _items.append(_item_announcements.to_dict()) _dict['announcements'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "announcements": [Announcement.from_dict(_item) for _item in obj["announcements"]] if obj.get("announcements") is not None else None diff --git a/lighter/models/api_key.py b/lighter/models/api_key.py index 96e9d91..e04e968 100644 --- a/lighter/models/api_key.py +++ b/lighter/models/api_key.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiKey(BaseModel): """ @@ -35,7 +36,8 @@ class ApiKey(BaseModel): __properties: ClassVar[List[str]] = ["account_index", "api_key_index", "nonce", "public_key", "transaction_time"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "api_key_index": obj.get("api_key_index"), "nonce": obj.get("nonce"), diff --git a/lighter/models/api_token.py b/lighter/models/api_token.py index c61cff1..5659c56 100644 --- a/lighter/models/api_token.py +++ b/lighter/models/api_token.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApiToken(BaseModel): """ @@ -38,7 +39,8 @@ class ApiToken(BaseModel): __properties: ClassVar[List[str]] = ["token_id", "api_token", "name", "account_index", "expiry", "sub_account_access", "revoked", "scopes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "token_id": obj.get("token_id"), "api_token": obj.get("api_token"), "name": obj.get("name"), diff --git a/lighter/models/approved_integrator.py b/lighter/models/approved_integrator.py index b46e887..2c6fa06 100644 --- a/lighter/models/approved_integrator.py +++ b/lighter/models/approved_integrator.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ApprovedIntegrator(BaseModel): """ @@ -37,7 +38,8 @@ class ApprovedIntegrator(BaseModel): __properties: ClassVar[List[str]] = ["account_index", "name", "max_perps_taker_fee", "max_perps_maker_fee", "max_spot_taker_fee", "max_spot_maker_fee", "approval_expiry"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,7 +94,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "name": obj.get("name"), "max_perps_taker_fee": obj.get("max_perps_taker_fee"), diff --git a/lighter/models/asset.py b/lighter/models/asset.py index 462bac2..5a2be4a 100644 --- a/lighter/models/asset.py +++ b/lighter/models/asset.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Asset(BaseModel): """ @@ -35,8 +36,15 @@ class Asset(BaseModel): margin_mode: StrictStr index_price: StrictStr l1_address: StrictStr + global_supply_cap: StrictStr + liquidation_fee: StrictStr + liquidation_threshold: StrictStr + loan_to_value: StrictStr + price_decimals: StrictInt + total_supplied: StrictStr + user_supply_cap: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["asset_id", "symbol", "l1_decimals", "decimals", "min_transfer_amount", "min_withdrawal_amount", "margin_mode", "index_price", "l1_address"] + __properties: ClassVar[List[str]] = ["asset_id", "symbol", "l1_decimals", "decimals", "min_transfer_amount", "min_withdrawal_amount", "margin_mode", "index_price", "l1_address", "global_supply_cap", "liquidation_fee", "liquidation_threshold", "loan_to_value", "price_decimals", "total_supplied", "user_supply_cap"] @field_validator('margin_mode') def margin_mode_validate_enum(cls, value): @@ -46,7 +54,8 @@ def margin_mode_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -58,8 +67,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -102,7 +110,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "asset_id": obj.get("asset_id"), "symbol": obj.get("symbol"), "l1_decimals": obj.get("l1_decimals"), @@ -111,7 +119,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "min_withdrawal_amount": obj.get("min_withdrawal_amount"), "margin_mode": obj.get("margin_mode"), "index_price": obj.get("index_price"), - "l1_address": obj.get("l1_address") + "l1_address": obj.get("l1_address"), + "global_supply_cap": obj.get("global_supply_cap"), + "liquidation_fee": obj.get("liquidation_fee"), + "liquidation_threshold": obj.get("liquidation_threshold"), + "loan_to_value": obj.get("loan_to_value"), + "price_decimals": obj.get("price_decimals"), + "total_supplied": obj.get("total_supplied"), + "user_supply_cap": obj.get("user_supply_cap") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/asset_details.py b/lighter/models/asset_details.py index 7935030..2b9d51e 100644 --- a/lighter/models/asset_details.py +++ b/lighter/models/asset_details.py @@ -22,6 +22,7 @@ from lighter.models.asset import Asset from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class AssetDetails(BaseModel): """ @@ -34,7 +35,8 @@ class AssetDetails(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "asset_details"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in asset_details (list) _items = [] if self.asset_details: - for _item in self.asset_details: - if _item: - _items.append(_item.to_dict()) + for _item_asset_details in self.asset_details: + if _item_asset_details: + _items.append(_item_asset_details.to_dict()) _dict['asset_details'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "asset_details": [Asset.from_dict(_item) for _item in obj["asset_details"]] if obj.get("asset_details") is not None else None diff --git a/lighter/models/auth.py b/lighter/models/auth.py index 7f590f7..aa856d2 100644 --- a/lighter/models/auth.py +++ b/lighter/models/auth.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Auth(BaseModel): """ @@ -31,7 +32,8 @@ class Auth(BaseModel): __properties: ClassVar[List[str]] = ["auth"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth") }) # store additional fields in additional_properties diff --git a/lighter/models/bridge.py b/lighter/models/bridge.py index 2b4f5f6..5e282af 100644 --- a/lighter/models/bridge.py +++ b/lighter/models/bridge.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Bridge(BaseModel): """ @@ -59,7 +60,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -71,8 +73,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -115,7 +116,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), "version": obj.get("version"), "source": obj.get("source"), diff --git a/lighter/models/bridge_supported_network.py b/lighter/models/bridge_supported_network.py index 158afc6..6e54911 100644 --- a/lighter/models/bridge_supported_network.py +++ b/lighter/models/bridge_supported_network.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class BridgeSupportedNetwork(BaseModel): """ @@ -33,7 +34,8 @@ class BridgeSupportedNetwork(BaseModel): __properties: ClassVar[List[str]] = ["name", "chain_id", "explorer"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "name": obj.get("name"), "chain_id": obj.get("chain_id"), "explorer": obj.get("explorer") diff --git a/lighter/models/candle.py b/lighter/models/candle.py index b9255a6..7e9fe64 100644 --- a/lighter/models/candle.py +++ b/lighter/models/candle.py @@ -18,31 +18,33 @@ import json from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt -from typing import Any, ClassVar, Dict, List, Union +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Candle(BaseModel): """ - Candle + Abbreviated candle format. Zero values are omitted. """ # noqa: E501 - t: StrictInt = Field(description=" timestamp") - o: Union[StrictFloat, StrictInt] = Field(description=" open") - h: Union[StrictFloat, StrictInt] = Field(description=" high") - l: Union[StrictFloat, StrictInt] = Field(description=" low") - c: Union[StrictFloat, StrictInt] = Field(description=" close") - O: Union[StrictFloat, StrictInt] = Field(description=" open_raw", alias="O") - H: Union[StrictFloat, StrictInt] = Field(description=" high_raw", alias="H") - L: Union[StrictFloat, StrictInt] = Field(description=" low_raw", alias="L") - C: Union[StrictFloat, StrictInt] = Field(description=" close_raw", alias="C") - v: Union[StrictFloat, StrictInt] = Field(description=" volume0") - V: Union[StrictFloat, StrictInt] = Field(description=" volume1", alias="V") - i: StrictInt = Field(description=" last_trade_id") + t: Optional[StrictInt] = Field(default=None, description="Timestamp") + o: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Open price") + h: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="High price") + l: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Low price") + c: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Close price") + v: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Base token volume (volume0)") + v: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Quote token volume (volume1)", alias="V") + i: Optional[StrictInt] = Field(default=None, description="Last trade ID") + c: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description=" close_raw", alias="C") + h: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description=" high_raw", alias="H") + l: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description=" low_raw", alias="L") + o: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description=" open_raw", alias="O") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["t", "o", "h", "l", "c", "O", "H", "L", "C", "v", "V", "i"] + __properties: ClassVar[List[str]] = ["t", "o", "h", "l", "c", "v", "V", "i", "C", "H", "L", "O"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,19 +99,19 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "t": obj.get("t"), "o": obj.get("o"), "h": obj.get("h"), "l": obj.get("l"), "c": obj.get("c"), - "O": obj.get("O"), - "H": obj.get("H"), - "L": obj.get("L"), - "C": obj.get("C"), "v": obj.get("v"), "V": obj.get("V"), - "i": obj.get("i") + "i": obj.get("i"), + "C": obj.get("C"), + "H": obj.get("H"), + "L": obj.get("L"), + "O": obj.get("O") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/candles.py b/lighter/models/candles.py index 53a41de..a19d811 100644 --- a/lighter/models/candles.py +++ b/lighter/models/candles.py @@ -22,20 +22,22 @@ from lighter.models.candle import Candle from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Candles(BaseModel): """ Candles """ # noqa: E501 code: StrictInt + r: StrictStr = Field(description="Resolution") + c: List[Candle] = Field(description="Array of candles (max 500 per call)") message: Optional[StrictStr] = None - r: StrictStr = Field(description=" resolution") - c: List[Candle] = Field(description=" candles") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "r", "c"] + __properties: ClassVar[List[str]] = ["code", "r", "c", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in c (list) _items = [] if self.c: - for _item in self.c: - if _item: - _items.append(_item.to_dict()) + for _item_c in self.c: + if _item_c: + _items.append(_item_c.to_dict()) _dict['c'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,11 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), - "message": obj.get("message"), "r": obj.get("r"), - "c": [Candle.from_dict(_item) for _item in obj["c"]] if obj.get("c") is not None else None + "c": [Candle.from_dict(_item) for _item in obj["c"]] if obj.get("c") is not None else None, + "message": obj.get("message") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/contract_address.py b/lighter/models/contract_address.py index 662540a..ba7bc3e 100644 --- a/lighter/models/contract_address.py +++ b/lighter/models/contract_address.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ContractAddress(BaseModel): """ @@ -32,7 +33,8 @@ class ContractAddress(BaseModel): __properties: ClassVar[List[str]] = ["name", "address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "name": obj.get("name"), "address": obj.get("address") }) diff --git a/lighter/models/cursor.py b/lighter/models/cursor.py index 4468d46..61c2641 100644 --- a/lighter/models/cursor.py +++ b/lighter/models/cursor.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Cursor(BaseModel): """ @@ -31,7 +32,8 @@ class Cursor(BaseModel): __properties: ClassVar[List[str]] = ["next_cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "next_cursor": obj.get("next_cursor") }) # store additional fields in additional_properties diff --git a/lighter/models/daily_return.py b/lighter/models/daily_return.py index af99736..4dcef63 100644 --- a/lighter/models/daily_return.py +++ b/lighter/models/daily_return.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DailyReturn(BaseModel): """ @@ -32,7 +33,8 @@ class DailyReturn(BaseModel): __properties: ClassVar[List[str]] = ["timestamp", "daily_return"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "daily_return": obj.get("daily_return") }) diff --git a/lighter/models/deposit_history.py b/lighter/models/deposit_history.py index b0a68ab..a6f8627 100644 --- a/lighter/models/deposit_history.py +++ b/lighter/models/deposit_history.py @@ -22,6 +22,7 @@ from lighter.models.deposit_history_item import DepositHistoryItem from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DepositHistory(BaseModel): """ @@ -35,7 +36,8 @@ class DepositHistory(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "deposits", "cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in deposits (list) _items = [] if self.deposits: - for _item in self.deposits: - if _item: - _items.append(_item.to_dict()) + for _item_deposits in self.deposits: + if _item_deposits: + _items.append(_item_deposits.to_dict()) _dict['deposits'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "deposits": [DepositHistoryItem.from_dict(_item) for _item in obj["deposits"]] if obj.get("deposits") is not None else None, diff --git a/lighter/models/deposit_history_item.py b/lighter/models/deposit_history_item.py index 49f6186..4bbd8f6 100644 --- a/lighter/models/deposit_history_item.py +++ b/lighter/models/deposit_history_item.py @@ -21,19 +21,20 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DepositHistoryItem(BaseModel): """ DepositHistoryItem """ # noqa: E501 id: StrictStr - asset_id: StrictInt amount: StrictStr timestamp: StrictInt status: StrictStr l1_tx_hash: StrictStr + asset_id: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "asset_id", "amount", "timestamp", "status", "l1_tx_hash"] + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "status", "l1_tx_hash", "asset_id"] @field_validator('status') def status_validate_enum(cls, value): @@ -43,7 +44,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -99,13 +100,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), - "asset_id": obj.get("asset_id"), "amount": obj.get("amount"), "timestamp": obj.get("timestamp"), "status": obj.get("status"), - "l1_tx_hash": obj.get("l1_tx_hash") + "l1_tx_hash": obj.get("l1_tx_hash"), + "asset_id": obj.get("asset_id") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/detailed_account.py b/lighter/models/detailed_account.py index d068815..c4ea183 100644 --- a/lighter/models/detailed_account.py +++ b/lighter/models/detailed_account.py @@ -27,6 +27,7 @@ from lighter.models.public_pool_share import PublicPoolShare from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DetailedAccount(BaseModel): """ @@ -35,6 +36,7 @@ class DetailedAccount(BaseModel): code: StrictInt message: Optional[StrictStr] = None account_type: StrictInt + account_trading_mode: StrictInt = Field(description="Classic=0 and Unified=1") index: StrictInt l1_address: StrictStr cancel_all_time: StrictInt @@ -44,28 +46,30 @@ class DetailedAccount(BaseModel): available_balance: StrictStr status: StrictInt collateral: StrictStr - transaction_time: StrictInt - account_trading_mode: StrictInt account_index: StrictInt name: StrictStr description: StrictStr can_invite: StrictBool = Field(description=" Remove After FE uses L1 meta endpoint") referral_points_percentage: StrictStr = Field(description=" Remove After FE uses L1 meta endpoint") - can_rfq: StrictBool - created_at: StrictInt positions: List[AccountPosition] assets: List[AccountAsset] total_asset_value: StrictStr cross_asset_value: StrictStr pool_info: PublicPoolInfo shares: List[PublicPoolShare] + created_at: StrictInt + transaction_time: StrictInt pending_unlocks: List[PendingUnlock] - approved_integrators: List[ApprovedIntegrator] + approved_integrators: Optional[List[ApprovedIntegrator]] = None + can_rfq: StrictBool + cross_initial_margin_requirement: Optional[StrictStr] = None + cross_maintenance_margin_requirement: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_type", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "transaction_time", "account_trading_mode", "account_index", "name", "description", "can_invite", "referral_points_percentage", "can_rfq", "created_at", "positions", "assets", "total_asset_value", "cross_asset_value", "pool_info", "shares", "pending_unlocks", "approved_integrators"] + __properties: ClassVar[List[str]] = ["code", "message", "account_type", "account_trading_mode", "index", "l1_address", "cancel_all_time", "total_order_count", "total_isolated_order_count", "pending_order_count", "available_balance", "status", "collateral", "account_index", "name", "description", "can_invite", "referral_points_percentage", "positions", "assets", "total_asset_value", "cross_asset_value", "pool_info", "shares", "created_at", "transaction_time", "pending_unlocks", "approved_integrators", "can_rfq", "cross_initial_margin_requirement", "cross_maintenance_margin_requirement"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -77,8 +81,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -108,16 +111,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in positions (list) _items = [] if self.positions: - for _item in self.positions: - if _item: - _items.append(_item.to_dict()) + for _item_positions in self.positions: + if _item_positions: + _items.append(_item_positions.to_dict()) _dict['positions'] = _items # override the default output from pydantic by calling `to_dict()` of each item in assets (list) _items = [] if self.assets: - for _item in self.assets: - if _item: - _items.append(_item.to_dict()) + for _item_assets in self.assets: + if _item_assets: + _items.append(_item_assets.to_dict()) _dict['assets'] = _items # override the default output from pydantic by calling `to_dict()` of pool_info if self.pool_info: @@ -125,23 +128,23 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in shares (list) _items = [] if self.shares: - for _item in self.shares: - if _item: - _items.append(_item.to_dict()) + for _item_shares in self.shares: + if _item_shares: + _items.append(_item_shares.to_dict()) _dict['shares'] = _items # override the default output from pydantic by calling `to_dict()` of each item in pending_unlocks (list) _items = [] if self.pending_unlocks: - for _item in self.pending_unlocks: - if _item: - _items.append(_item.to_dict()) + for _item_pending_unlocks in self.pending_unlocks: + if _item_pending_unlocks: + _items.append(_item_pending_unlocks.to_dict()) _dict['pending_unlocks'] = _items # override the default output from pydantic by calling `to_dict()` of each item in approved_integrators (list) _items = [] if self.approved_integrators: - for _item in self.approved_integrators: - if _item: - _items.append(_item.to_dict()) + for _item_approved_integrators in self.approved_integrators: + if _item_approved_integrators: + _items.append(_item_approved_integrators.to_dict()) _dict['approved_integrators'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -159,10 +162,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "account_type": obj.get("account_type"), + "account_trading_mode": obj.get("account_trading_mode"), "index": obj.get("index"), "l1_address": obj.get("l1_address"), "cancel_all_time": obj.get("cancel_all_time"), @@ -172,23 +176,24 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "available_balance": obj.get("available_balance"), "status": obj.get("status"), "collateral": obj.get("collateral"), - "transaction_time": obj.get("transaction_time"), - "account_trading_mode": obj.get("account_trading_mode"), "account_index": obj.get("account_index"), "name": obj.get("name"), "description": obj.get("description"), "can_invite": obj.get("can_invite"), "referral_points_percentage": obj.get("referral_points_percentage"), - "can_rfq": obj.get("can_rfq"), - "created_at": obj.get("created_at"), "positions": [AccountPosition.from_dict(_item) for _item in obj["positions"]] if obj.get("positions") is not None else None, "assets": [AccountAsset.from_dict(_item) for _item in obj["assets"]] if obj.get("assets") is not None else None, "total_asset_value": obj.get("total_asset_value"), "cross_asset_value": obj.get("cross_asset_value"), "pool_info": PublicPoolInfo.from_dict(obj["pool_info"]) if obj.get("pool_info") is not None else None, "shares": [PublicPoolShare.from_dict(_item) for _item in obj["shares"]] if obj.get("shares") is not None else None, + "created_at": obj.get("created_at"), + "transaction_time": obj.get("transaction_time"), "pending_unlocks": [PendingUnlock.from_dict(_item) for _item in obj["pending_unlocks"]] if obj.get("pending_unlocks") is not None else None, - "approved_integrators": [ApprovedIntegrator.from_dict(_item) for _item in obj["approved_integrators"]] if obj.get("approved_integrators") is not None else None + "approved_integrators": [ApprovedIntegrator.from_dict(_item) for _item in obj["approved_integrators"]] if obj.get("approved_integrators") is not None else None, + "can_rfq": obj.get("can_rfq"), + "cross_initial_margin_requirement": obj.get("cross_initial_margin_requirement"), + "cross_maintenance_margin_requirement": obj.get("cross_maintenance_margin_requirement") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/detailed_accounts.py b/lighter/models/detailed_accounts.py index cb14759..1601908 100644 --- a/lighter/models/detailed_accounts.py +++ b/lighter/models/detailed_accounts.py @@ -22,6 +22,7 @@ from lighter.models.detailed_account import DetailedAccount from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DetailedAccounts(BaseModel): """ @@ -36,7 +37,8 @@ class DetailedAccounts(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "total", "accounts", "next_cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in accounts (list) _items = [] if self.accounts: - for _item in self.accounts: - if _item: - _items.append(_item.to_dict()) + for _item_accounts in self.accounts: + if _item_accounts: + _items.append(_item_accounts.to_dict()) _dict['accounts'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -99,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "total": obj.get("total"), diff --git a/lighter/models/detailed_candlestick.py b/lighter/models/detailed_candlestick.py index 4ff5987..5d41876 100644 --- a/lighter/models/detailed_candlestick.py +++ b/lighter/models/detailed_candlestick.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt -from typing import Any, ClassVar, Dict, List, Union +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class DetailedCandlestick(BaseModel): """ @@ -31,19 +32,20 @@ class DetailedCandlestick(BaseModel): high: Union[StrictFloat, StrictInt] low: Union[StrictFloat, StrictInt] close: Union[StrictFloat, StrictInt] - open_raw: Union[StrictFloat, StrictInt] - high_raw: Union[StrictFloat, StrictInt] - low_raw: Union[StrictFloat, StrictInt] - close_raw: Union[StrictFloat, StrictInt] volume0: Union[StrictFloat, StrictInt] volume1: Union[StrictFloat, StrictInt] last_trade_id: StrictInt trade_count: StrictInt + close_raw: Optional[StrictStr] = None + high_raw: Optional[StrictStr] = None + low_raw: Optional[StrictStr] = None + open_raw: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["timestamp", "open", "high", "low", "close", "open_raw", "high_raw", "low_raw", "close_raw", "volume0", "volume1", "last_trade_id", "trade_count"] + __properties: ClassVar[List[str]] = ["timestamp", "open", "high", "low", "close", "volume0", "volume1", "last_trade_id", "trade_count", "close_raw", "high_raw", "low_raw", "open_raw"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -99,20 +100,20 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "open": obj.get("open"), "high": obj.get("high"), "low": obj.get("low"), "close": obj.get("close"), - "open_raw": obj.get("open_raw"), - "high_raw": obj.get("high_raw"), - "low_raw": obj.get("low_raw"), - "close_raw": obj.get("close_raw"), "volume0": obj.get("volume0"), "volume1": obj.get("volume1"), "last_trade_id": obj.get("last_trade_id"), - "trade_count": obj.get("trade_count") + "trade_count": obj.get("trade_count"), + "close_raw": obj.get("close_raw"), + "high_raw": obj.get("high_raw"), + "low_raw": obj.get("low_raw"), + "open_raw": obj.get("open_raw") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/enriched_tx.py b/lighter/models/enriched_tx.py index 7956354..3fd3aaa 100644 --- a/lighter/models/enriched_tx.py +++ b/lighter/models/enriched_tx.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class EnrichedTx(BaseModel): """ @@ -52,7 +53,8 @@ class EnrichedTx(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "hash", "type", "info", "event_info", "status", "transaction_index", "l1_address", "account_index", "nonce", "expire_at", "block_height", "queued_at", "executed_at", "sequence_index", "parent_hash", "api_key_index", "transaction_time", "committed_at", "verified_at"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -64,8 +66,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -108,7 +109,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "hash": obj.get("hash"), diff --git a/lighter/models/exchange_metric.py b/lighter/models/exchange_metric.py index 03817b5..0432662 100644 --- a/lighter/models/exchange_metric.py +++ b/lighter/models/exchange_metric.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExchangeMetric(BaseModel): """ @@ -32,7 +33,8 @@ class ExchangeMetric(BaseModel): __properties: ClassVar[List[str]] = ["timestamp", "data"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "data": obj.get("data") }) diff --git a/lighter/models/exchange_stats.py b/lighter/models/exchange_stats.py index f3e6fc5..df8e57b 100644 --- a/lighter/models/exchange_stats.py +++ b/lighter/models/exchange_stats.py @@ -22,6 +22,7 @@ from lighter.models.order_book_stats import OrderBookStats from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExchangeStats(BaseModel): """ @@ -37,7 +38,8 @@ class ExchangeStats(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "total", "order_book_stats", "daily_usd_volume", "daily_trades_count"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -80,9 +81,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in order_book_stats (list) _items = [] if self.order_book_stats: - for _item in self.order_book_stats: - if _item: - _items.append(_item.to_dict()) + for _item_order_book_stats in self.order_book_stats: + if _item_order_book_stats: + _items.append(_item_order_book_stats.to_dict()) _dict['order_book_stats'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -100,7 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "total": obj.get("total"), diff --git a/lighter/models/execute_stat.py b/lighter/models/execute_stat.py index 71ef908..9fcbf26 100644 --- a/lighter/models/execute_stat.py +++ b/lighter/models/execute_stat.py @@ -18,22 +18,24 @@ import json from pydantic import BaseModel, ConfigDict, StrictInt -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional from lighter.models.slippage_result import SlippageResult from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExecuteStat(BaseModel): """ ExecuteStat """ # noqa: E501 - timestamp: StrictInt - slippage: List[SlippageResult] + timestamp: Optional[StrictInt] = None + slippage: Optional[List[SlippageResult]] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["timestamp", "slippage"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -76,9 +77,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in slippage (list) _items = [] if self.slippage: - for _item in self.slippage: - if _item: - _items.append(_item.to_dict()) + for _item_slippage in self.slippage: + if _item_slippage: + _items.append(_item_slippage.to_dict()) _dict['slippage'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -96,7 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "slippage": [SlippageResult.from_dict(_item) for _item in obj["slippage"]] if obj.get("slippage") is not None else None }) diff --git a/lighter/models/export_data.py b/lighter/models/export_data.py index f16b03e..8917ad8 100644 --- a/lighter/models/export_data.py +++ b/lighter/models/export_data.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ExportData(BaseModel): """ @@ -33,7 +34,8 @@ class ExportData(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "data_url"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "data_url": obj.get("data_url") diff --git a/lighter/models/funding.py b/lighter/models/funding.py index 99e0204..1e78c4b 100644 --- a/lighter/models/funding.py +++ b/lighter/models/funding.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Funding(BaseModel): """ @@ -34,7 +35,8 @@ class Funding(BaseModel): __properties: ClassVar[List[str]] = ["timestamp", "value", "rate", "direction"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "value": obj.get("value"), "rate": obj.get("rate"), diff --git a/lighter/models/funding_rate.py b/lighter/models/funding_rate.py index 7b8129a..6ce20e1 100644 --- a/lighter/models/funding_rate.py +++ b/lighter/models/funding_rate.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class FundingRate(BaseModel): """ @@ -41,7 +42,8 @@ def exchange_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "exchange": obj.get("exchange"), "symbol": obj.get("symbol"), diff --git a/lighter/models/funding_rates.py b/lighter/models/funding_rates.py index 73d4e95..c890fbe 100644 --- a/lighter/models/funding_rates.py +++ b/lighter/models/funding_rates.py @@ -22,6 +22,7 @@ from lighter.models.funding_rate import FundingRate from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class FundingRates(BaseModel): """ @@ -34,7 +35,8 @@ class FundingRates(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "funding_rates"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in funding_rates (list) _items = [] if self.funding_rates: - for _item in self.funding_rates: - if _item: - _items.append(_item.to_dict()) + for _item_funding_rates in self.funding_rates: + if _item_funding_rates: + _items.append(_item_funding_rates.to_dict()) _dict['funding_rates'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "funding_rates": [FundingRate.from_dict(_item) for _item in obj["funding_rates"]] if obj.get("funding_rates") is not None else None diff --git a/lighter/models/fundings.py b/lighter/models/fundings.py index 3aaa32c..daebb3f 100644 --- a/lighter/models/fundings.py +++ b/lighter/models/fundings.py @@ -22,6 +22,7 @@ from lighter.models.funding import Funding from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Fundings(BaseModel): """ @@ -35,7 +36,8 @@ class Fundings(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "resolution", "fundings"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in fundings (list) _items = [] if self.fundings: - for _item in self.fundings: - if _item: - _items.append(_item.to_dict()) + for _item_fundings in self.fundings: + if _item_fundings: + _items.append(_item_fundings.to_dict()) _dict['fundings'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "resolution": obj.get("resolution"), diff --git a/lighter/models/l1_metadata.py b/lighter/models/l1_metadata.py index 736c0c2..5aa82a1 100644 --- a/lighter/models/l1_metadata.py +++ b/lighter/models/l1_metadata.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class L1Metadata(BaseModel): """ @@ -33,7 +34,8 @@ class L1Metadata(BaseModel): __properties: ClassVar[List[str]] = ["l1_address", "can_invite", "referral_points_percentage"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "l1_address": obj.get("l1_address"), "can_invite": obj.get("can_invite"), "referral_points_percentage": obj.get("referral_points_percentage") diff --git a/lighter/models/l1_provider_info.py b/lighter/models/l1_provider_info.py index 55d9ee5..77f8c5d 100644 --- a/lighter/models/l1_provider_info.py +++ b/lighter/models/l1_provider_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class L1ProviderInfo(BaseModel): """ @@ -33,7 +34,8 @@ class L1ProviderInfo(BaseModel): __properties: ClassVar[List[str]] = ["chainId", "networkId", "latestBlockNumber"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "chainId": obj.get("chainId"), "networkId": obj.get("networkId"), "latestBlockNumber": obj.get("latestBlockNumber") diff --git a/lighter/models/lease_entry.py b/lighter/models/lease_entry.py index e5a2ed5..a328171 100644 --- a/lighter/models/lease_entry.py +++ b/lighter/models/lease_entry.py @@ -17,23 +17,24 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LeaseEntry(BaseModel): """ LeaseEntry """ # noqa: E501 - id: StrictInt - master_account_index: StrictInt - lease_amount: StrictInt - fee_amount: StrictInt - start: StrictInt - end: StrictInt - status: StrictStr - error: StrictStr + id: StrictInt = Field(description="Lease ID") + master_account_index: StrictInt = Field(description="Master account index") + lease_amount: StrictInt = Field(description="Leased LIT amount in raw units (1 LIT = 1e8)") + fee_amount: StrictInt = Field(description="Fee paid in raw units") + start: StrictInt = Field(description="Lease start time (Unix milliseconds)") + end: StrictInt = Field(description="Lease end time (Unix milliseconds)") + status: StrictStr = Field(description="Lease status") + error: StrictStr = Field(description="Error message if lease was canceled") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["id", "master_account_index", "lease_amount", "fee_amount", "start", "end", "status", "error"] @@ -45,7 +46,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -101,7 +102,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), "master_account_index": obj.get("master_account_index"), "lease_amount": obj.get("lease_amount"), diff --git a/lighter/models/lease_option_entry.py b/lighter/models/lease_option_entry.py index 4b481c7..ffa04ab 100644 --- a/lighter/models/lease_option_entry.py +++ b/lighter/models/lease_option_entry.py @@ -17,22 +17,24 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt -from typing import Any, ClassVar, Dict, List, Union +from pydantic import BaseModel, ConfigDict, Field, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LeaseOptionEntry(BaseModel): """ LeaseOptionEntry """ # noqa: E501 - duration_days: StrictInt - annual_rate: Union[StrictFloat, StrictInt] + duration_days: Optional[StrictInt] = Field(default=None, description="Lease duration in days") + annual_rate: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="Annual rate as a percentage (e.g. 25.0 means 25%)") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["duration_days", "annual_rate"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "duration_days": obj.get("duration_days"), "annual_rate": obj.get("annual_rate") }) diff --git a/lighter/models/liq_trade.py b/lighter/models/liq_trade.py index 5d00ace..3be63f4 100644 --- a/lighter/models/liq_trade.py +++ b/lighter/models/liq_trade.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LiqTrade(BaseModel): """ @@ -35,7 +36,8 @@ class LiqTrade(BaseModel): __properties: ClassVar[List[str]] = ["price", "size", "taker_fee", "maker_fee", "transaction_time"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "price": obj.get("price"), "size": obj.get("size"), "taker_fee": obj.get("taker_fee"), diff --git a/lighter/models/liquidation.py b/lighter/models/liquidation.py index e8fc2a2..8f07d9b 100644 --- a/lighter/models/liquidation.py +++ b/lighter/models/liquidation.py @@ -23,6 +23,7 @@ from lighter.models.liquidation_info import LiquidationInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Liquidation(BaseModel): """ @@ -45,7 +46,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -107,7 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), "market_id": obj.get("market_id"), "type": obj.get("type"), diff --git a/lighter/models/liquidation_info.py b/lighter/models/liquidation_info.py index ad0a781..cdcc56f 100644 --- a/lighter/models/liquidation_info.py +++ b/lighter/models/liquidation_info.py @@ -23,6 +23,7 @@ from lighter.models.risk_info import RiskInfo from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LiquidationInfo(BaseModel): """ @@ -36,7 +37,8 @@ class LiquidationInfo(BaseModel): __properties: ClassVar[List[str]] = ["positions", "risk_info_before", "risk_info_after", "mark_prices"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in positions (list) _items = [] if self.positions: - for _item in self.positions: - if _item: - _items.append(_item.to_dict()) + for _item_positions in self.positions: + if _item_positions: + _items.append(_item_positions.to_dict()) _dict['positions'] = _items # override the default output from pydantic by calling `to_dict()` of risk_info_before if self.risk_info_before: @@ -105,7 +106,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "positions": [AccountPosition.from_dict(_item) for _item in obj["positions"]] if obj.get("positions") is not None else None, "risk_info_before": RiskInfo.from_dict(obj["risk_info_before"]) if obj.get("risk_info_before") is not None else None, "risk_info_after": RiskInfo.from_dict(obj["risk_info_after"]) if obj.get("risk_info_after") is not None else None, diff --git a/lighter/models/liquidation_infos.py b/lighter/models/liquidation_infos.py index 9e5b6b2..2eb29ec 100644 --- a/lighter/models/liquidation_infos.py +++ b/lighter/models/liquidation_infos.py @@ -22,6 +22,7 @@ from lighter.models.liquidation import Liquidation from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class LiquidationInfos(BaseModel): """ @@ -35,7 +36,8 @@ class LiquidationInfos(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "liquidations", "next_cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in liquidations (list) _items = [] if self.liquidations: - for _item in self.liquidations: - if _item: - _items.append(_item.to_dict()) + for _item_liquidations in self.liquidations: + if _item_liquidations: + _items.append(_item_liquidations.to_dict()) _dict['liquidations'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "liquidations": [Liquidation.from_dict(_item) for _item in obj["liquidations"]] if obj.get("liquidations") is not None else None, diff --git a/lighter/models/market_config.py b/lighter/models/market_config.py index 168ca30..d767338 100644 --- a/lighter/models/market_config.py +++ b/lighter/models/market_config.py @@ -18,9 +18,10 @@ import json from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class MarketConfig(BaseModel): """ @@ -30,14 +31,15 @@ class MarketConfig(BaseModel): insurance_fund_account_index: StrictInt liquidation_mode: StrictInt force_reduce_only: StrictBool + funding_fee_discounts_enabled: Optional[StrictBool] = None trading_hours: StrictStr - funding_fee_discounts_enabled: StrictBool hidden: StrictBool additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["market_margin_mode", "insurance_fund_account_index", "liquidation_mode", "force_reduce_only", "trading_hours", "funding_fee_discounts_enabled", "hidden"] + __properties: ClassVar[List[str]] = ["market_margin_mode", "insurance_fund_account_index", "liquidation_mode", "force_reduce_only", "funding_fee_discounts_enabled", "trading_hours", "hidden"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -93,13 +94,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_margin_mode": obj.get("market_margin_mode"), "insurance_fund_account_index": obj.get("insurance_fund_account_index"), "liquidation_mode": obj.get("liquidation_mode"), "force_reduce_only": obj.get("force_reduce_only"), - "trading_hours": obj.get("trading_hours"), "funding_fee_discounts_enabled": obj.get("funding_fee_discounts_enabled"), + "trading_hours": obj.get("trading_hours"), "hidden": obj.get("hidden") }) # store additional fields in additional_properties diff --git a/lighter/models/next_nonce.py b/lighter/models/next_nonce.py index 5d698f1..ee055c3 100644 --- a/lighter/models/next_nonce.py +++ b/lighter/models/next_nonce.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class NextNonce(BaseModel): """ @@ -33,7 +34,8 @@ class NextNonce(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "nonce"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "nonce": obj.get("nonce") diff --git a/lighter/models/order.py b/lighter/models/order.py index 0e56204..2443dc6 100644 --- a/lighter/models/order.py +++ b/lighter/models/order.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Order(BaseModel): """ @@ -55,16 +56,16 @@ class Order(BaseModel): to_trigger_order_id_0: StrictStr to_trigger_order_id_1: StrictStr to_cancel_order_id_0: StrictStr - integrator_fee_collector_index: StrictStr - integrator_taker_fee: StrictStr - integrator_maker_fee: StrictStr block_height: StrictInt timestamp: StrictInt created_at: StrictInt updated_at: StrictInt transaction_time: StrictInt + integrator_fee_collector_index: StrictStr + integrator_maker_fee: StrictStr + integrator_taker_fee: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["order_index", "client_order_index", "order_id", "client_order_id", "market_index", "owner_account_index", "initial_base_amount", "price", "nonce", "remaining_base_amount", "is_ask", "base_size", "base_price", "filled_base_amount", "filled_quote_amount", "side", "type", "time_in_force", "reduce_only", "trigger_price", "order_expiry", "status", "trigger_status", "trigger_time", "parent_order_index", "parent_order_id", "to_trigger_order_id_0", "to_trigger_order_id_1", "to_cancel_order_id_0", "integrator_fee_collector_index", "integrator_taker_fee", "integrator_maker_fee", "block_height", "timestamp", "created_at", "updated_at", "transaction_time"] + __properties: ClassVar[List[str]] = ["order_index", "client_order_index", "order_id", "client_order_id", "market_index", "owner_account_index", "initial_base_amount", "price", "nonce", "remaining_base_amount", "is_ask", "base_size", "base_price", "filled_base_amount", "filled_quote_amount", "side", "type", "time_in_force", "reduce_only", "trigger_price", "order_expiry", "status", "trigger_status", "trigger_time", "parent_order_index", "parent_order_id", "to_trigger_order_id_0", "to_trigger_order_id_1", "to_cancel_order_id_0", "block_height", "timestamp", "created_at", "updated_at", "transaction_time", "integrator_fee_collector_index", "integrator_maker_fee", "integrator_taker_fee"] @field_validator('type') def type_validate_enum(cls, value): @@ -95,7 +96,8 @@ def trigger_status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -107,8 +109,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -151,7 +152,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "order_index": obj.get("order_index"), "client_order_index": obj.get("client_order_index"), "order_id": obj.get("order_id"), @@ -181,14 +182,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "to_trigger_order_id_0": obj.get("to_trigger_order_id_0"), "to_trigger_order_id_1": obj.get("to_trigger_order_id_1"), "to_cancel_order_id_0": obj.get("to_cancel_order_id_0"), - "integrator_fee_collector_index": obj.get("integrator_fee_collector_index"), - "integrator_taker_fee": obj.get("integrator_taker_fee"), - "integrator_maker_fee": obj.get("integrator_maker_fee"), "block_height": obj.get("block_height"), "timestamp": obj.get("timestamp"), "created_at": obj.get("created_at"), "updated_at": obj.get("updated_at"), - "transaction_time": obj.get("transaction_time") + "transaction_time": obj.get("transaction_time"), + "integrator_fee_collector_index": obj.get("integrator_fee_collector_index"), + "integrator_maker_fee": obj.get("integrator_maker_fee"), + "integrator_taker_fee": obj.get("integrator_taker_fee") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/order_book.py b/lighter/models/order_book.py index c269137..91f0156 100644 --- a/lighter/models/order_book.py +++ b/lighter/models/order_book.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBook(BaseModel): """ @@ -37,12 +38,14 @@ class OrderBook(BaseModel): liquidation_fee: StrictStr min_base_amount: StrictStr min_quote_amount: StrictStr - order_quote_limit: StrictStr supported_size_decimals: StrictInt supported_price_decimals: StrictInt supported_quote_decimals: StrictInt + order_quote_limit: StrictStr + is_maker_fee_enabled: Optional[StrictBool] = None + is_taker_fee_enabled: Optional[StrictBool] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "order_quote_limit", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals"] + __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "order_quote_limit", "is_maker_fee_enabled", "is_taker_fee_enabled"] @field_validator('market_type') def market_type_validate_enum(cls, value): @@ -59,7 +62,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -71,8 +75,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -115,7 +118,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "market_id": obj.get("market_id"), "market_type": obj.get("market_type"), @@ -127,10 +130,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "liquidation_fee": obj.get("liquidation_fee"), "min_base_amount": obj.get("min_base_amount"), "min_quote_amount": obj.get("min_quote_amount"), - "order_quote_limit": obj.get("order_quote_limit"), "supported_size_decimals": obj.get("supported_size_decimals"), "supported_price_decimals": obj.get("supported_price_decimals"), - "supported_quote_decimals": obj.get("supported_quote_decimals") + "supported_quote_decimals": obj.get("supported_quote_decimals"), + "order_quote_limit": obj.get("order_quote_limit"), + "is_maker_fee_enabled": obj.get("is_maker_fee_enabled"), + "is_taker_fee_enabled": obj.get("is_taker_fee_enabled") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/order_book_depth.py b/lighter/models/order_book_depth.py index 485558a..eb1d9b4 100644 --- a/lighter/models/order_book_depth.py +++ b/lighter/models/order_book_depth.py @@ -22,6 +22,7 @@ from lighter.models.price_level import PriceLevel from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBookDepth(BaseModel): """ @@ -37,7 +38,8 @@ class OrderBookDepth(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "asks", "bids", "offset", "nonce"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -80,16 +81,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in asks (list) _items = [] if self.asks: - for _item in self.asks: - if _item: - _items.append(_item.to_dict()) + for _item_asks in self.asks: + if _item_asks: + _items.append(_item_asks.to_dict()) _dict['asks'] = _items # override the default output from pydantic by calling `to_dict()` of each item in bids (list) _items = [] if self.bids: - for _item in self.bids: - if _item: - _items.append(_item.to_dict()) + for _item_bids in self.bids: + if _item_bids: + _items.append(_item_bids.to_dict()) _dict['bids'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -107,7 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "asks": [PriceLevel.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None, diff --git a/lighter/models/order_book_depth_with_begin_nonce.py b/lighter/models/order_book_depth_with_begin_nonce.py index 641ab10..a485c84 100644 --- a/lighter/models/order_book_depth_with_begin_nonce.py +++ b/lighter/models/order_book_depth_with_begin_nonce.py @@ -22,6 +22,7 @@ from lighter.models.price_level import PriceLevel from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBookDepthWithBeginNonce(BaseModel): """ @@ -36,7 +37,8 @@ class OrderBookDepthWithBeginNonce(BaseModel): __properties: ClassVar[List[str]] = ["asks", "bids", "offset", "nonce", "begin_nonce"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,16 +80,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in asks (list) _items = [] if self.asks: - for _item in self.asks: - if _item: - _items.append(_item.to_dict()) + for _item_asks in self.asks: + if _item_asks: + _items.append(_item_asks.to_dict()) _dict['asks'] = _items # override the default output from pydantic by calling `to_dict()` of each item in bids (list) _items = [] if self.bids: - for _item in self.bids: - if _item: - _items.append(_item.to_dict()) + for _item_bids in self.bids: + if _item_bids: + _items.append(_item_bids.to_dict()) _dict['bids'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -106,7 +107,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "asks": [PriceLevel.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None, "bids": [PriceLevel.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None, "offset": obj.get("offset"), diff --git a/lighter/models/order_book_details.py b/lighter/models/order_book_details.py index 6daf960..fa19c9f 100644 --- a/lighter/models/order_book_details.py +++ b/lighter/models/order_book_details.py @@ -23,6 +23,7 @@ from lighter.models.spot_order_book_detail import SpotOrderBookDetail from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBookDetails(BaseModel): """ @@ -36,7 +37,8 @@ class OrderBookDetails(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "order_book_details", "spot_order_book_details"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,16 +80,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in order_book_details (list) _items = [] if self.order_book_details: - for _item in self.order_book_details: - if _item: - _items.append(_item.to_dict()) + for _item_order_book_details in self.order_book_details: + if _item_order_book_details: + _items.append(_item_order_book_details.to_dict()) _dict['order_book_details'] = _items # override the default output from pydantic by calling `to_dict()` of each item in spot_order_book_details (list) _items = [] if self.spot_order_book_details: - for _item in self.spot_order_book_details: - if _item: - _items.append(_item.to_dict()) + for _item_spot_order_book_details in self.spot_order_book_details: + if _item_spot_order_book_details: + _items.append(_item_spot_order_book_details.to_dict()) _dict['spot_order_book_details'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -106,7 +107,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "order_book_details": [PerpsOrderBookDetail.from_dict(_item) for _item in obj["order_book_details"]] if obj.get("order_book_details") is not None else None, diff --git a/lighter/models/order_book_orders.py b/lighter/models/order_book_orders.py index 1e69164..7f0b8c3 100644 --- a/lighter/models/order_book_orders.py +++ b/lighter/models/order_book_orders.py @@ -22,6 +22,7 @@ from lighter.models.simple_order import SimpleOrder from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBookOrders(BaseModel): """ @@ -37,7 +38,8 @@ class OrderBookOrders(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "total_asks", "asks", "total_bids", "bids"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -49,8 +51,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -80,16 +81,16 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in asks (list) _items = [] if self.asks: - for _item in self.asks: - if _item: - _items.append(_item.to_dict()) + for _item_asks in self.asks: + if _item_asks: + _items.append(_item_asks.to_dict()) _dict['asks'] = _items # override the default output from pydantic by calling `to_dict()` of each item in bids (list) _items = [] if self.bids: - for _item in self.bids: - if _item: - _items.append(_item.to_dict()) + for _item_bids in self.bids: + if _item_bids: + _items.append(_item_bids.to_dict()) _dict['bids'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -107,7 +108,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "total_asks": obj.get("total_asks"), diff --git a/lighter/models/order_book_stats.py b/lighter/models/order_book_stats.py index 8719552..beb34bb 100644 --- a/lighter/models/order_book_stats.py +++ b/lighter/models/order_book_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBookStats(BaseModel): """ @@ -36,7 +37,8 @@ class OrderBookStats(BaseModel): __properties: ClassVar[List[str]] = ["symbol", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_change"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -92,7 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "last_trade_price": obj.get("last_trade_price"), "daily_trades_count": obj.get("daily_trades_count"), diff --git a/lighter/models/order_books.py b/lighter/models/order_books.py index f94a315..507a9fa 100644 --- a/lighter/models/order_books.py +++ b/lighter/models/order_books.py @@ -22,6 +22,7 @@ from lighter.models.order_book import OrderBook from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class OrderBooks(BaseModel): """ @@ -34,7 +35,8 @@ class OrderBooks(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "order_books"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in order_books (list) _items = [] if self.order_books: - for _item in self.order_books: - if _item: - _items.append(_item.to_dict()) + for _item_order_books in self.order_books: + if _item_order_books: + _items.append(_item_order_books.to_dict()) _dict['order_books'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "order_books": [OrderBook.from_dict(_item) for _item in obj["order_books"]] if obj.get("order_books") is not None else None diff --git a/lighter/models/orders.py b/lighter/models/orders.py index 788b2c5..4237a1d 100644 --- a/lighter/models/orders.py +++ b/lighter/models/orders.py @@ -22,6 +22,7 @@ from lighter.models.order import Order from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Orders(BaseModel): """ @@ -35,7 +36,8 @@ class Orders(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "orders"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in orders (list) _items = [] if self.orders: - for _item in self.orders: - if _item: - _items.append(_item.to_dict()) + for _item_orders in self.orders: + if _item_orders: + _items.append(_item_orders.to_dict()) _dict['orders'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "next_cursor": obj.get("next_cursor"), diff --git a/lighter/models/partner_stats.py b/lighter/models/partner_stats.py index bc82c6d..8dd8f70 100644 --- a/lighter/models/partner_stats.py +++ b/lighter/models/partner_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PartnerStats(BaseModel): """ @@ -42,7 +43,8 @@ class PartnerStats(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "total_fees_earned", "total_taker_fees_earned", "total_maker_fees_earned", "total_volume", "total_taker_volume", "total_maker_volume", "total_trades", "total_taker_trades", "total_maker_trades", "unique_clients"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "total_fees_earned": obj.get("total_fees_earned"), diff --git a/lighter/models/pending_unlock.py b/lighter/models/pending_unlock.py index f432c73..7c48f02 100644 --- a/lighter/models/pending_unlock.py +++ b/lighter/models/pending_unlock.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PendingUnlock(BaseModel): """ @@ -33,7 +34,8 @@ class PendingUnlock(BaseModel): __properties: ClassVar[List[str]] = ["unlock_timestamp", "asset_index", "amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "unlock_timestamp": obj.get("unlock_timestamp"), "asset_index": obj.get("asset_index"), "amount": obj.get("amount") diff --git a/lighter/models/perps_market_stats.py b/lighter/models/perps_market_stats.py index d28434f..6ec29c6 100644 --- a/lighter/models/perps_market_stats.py +++ b/lighter/models/perps_market_stats.py @@ -21,19 +21,16 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PerpsMarketStats(BaseModel): """ PerpsMarketStats """ # noqa: E501 - symbol: StrictStr market_id: StrictInt index_price: StrictStr mark_price: StrictStr open_interest: StrictStr - open_interest_limit: StrictStr - funding_clamp_small: StrictStr - funding_clamp_big: StrictStr last_trade_price: StrictStr current_funding_rate: StrictStr funding_rate: StrictStr @@ -43,11 +40,16 @@ class PerpsMarketStats(BaseModel): daily_price_low: Union[StrictFloat, StrictInt] daily_price_high: Union[StrictFloat, StrictInt] daily_price_change: Union[StrictFloat, StrictInt] + symbol: StrictStr + funding_clamp_small: StrictStr + funding_clamp_big: StrictStr + open_interest_limit: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["symbol", "market_id", "index_price", "mark_price", "open_interest", "open_interest_limit", "funding_clamp_small", "funding_clamp_big", "last_trade_price", "current_funding_rate", "funding_rate", "funding_timestamp", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change"] + __properties: ClassVar[List[str]] = ["market_id", "index_price", "mark_price", "open_interest", "last_trade_price", "current_funding_rate", "funding_rate", "funding_timestamp", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "symbol", "funding_clamp_small", "funding_clamp_big", "open_interest_limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -103,15 +104,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "symbol": obj.get("symbol"), + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "index_price": obj.get("index_price"), "mark_price": obj.get("mark_price"), "open_interest": obj.get("open_interest"), - "open_interest_limit": obj.get("open_interest_limit"), - "funding_clamp_small": obj.get("funding_clamp_small"), - "funding_clamp_big": obj.get("funding_clamp_big"), "last_trade_price": obj.get("last_trade_price"), "current_funding_rate": obj.get("current_funding_rate"), "funding_rate": obj.get("funding_rate"), @@ -120,7 +117,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "daily_quote_token_volume": obj.get("daily_quote_token_volume"), "daily_price_low": obj.get("daily_price_low"), "daily_price_high": obj.get("daily_price_high"), - "daily_price_change": obj.get("daily_price_change") + "daily_price_change": obj.get("daily_price_change"), + "symbol": obj.get("symbol"), + "funding_clamp_small": obj.get("funding_clamp_small"), + "funding_clamp_big": obj.get("funding_clamp_big"), + "open_interest_limit": obj.get("open_interest_limit") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/perps_order_book_detail.py b/lighter/models/perps_order_book_detail.py index 7dc4b62..b680009 100644 --- a/lighter/models/perps_order_book_detail.py +++ b/lighter/models/perps_order_book_detail.py @@ -17,11 +17,12 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Union +from pydantic import BaseModel, ConfigDict, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from lighter.models.market_config import MarketConfig from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PerpsOrderBookDetail(BaseModel): """ @@ -38,10 +39,10 @@ class PerpsOrderBookDetail(BaseModel): liquidation_fee: StrictStr min_base_amount: StrictStr min_quote_amount: StrictStr - order_quote_limit: StrictStr supported_size_decimals: StrictInt supported_price_decimals: StrictInt supported_quote_decimals: StrictInt + order_quote_limit: Optional[StrictStr] = None size_decimals: StrictInt price_decimals: StrictInt quote_multiplier: StrictInt @@ -58,10 +59,12 @@ class PerpsOrderBookDetail(BaseModel): daily_price_change: Union[StrictFloat, StrictInt] open_interest: Union[StrictFloat, StrictInt] daily_chart: Dict[str, Union[StrictFloat, StrictInt]] - market_config: MarketConfig - strategy_index: StrictInt + market_config: Optional[MarketConfig] = None + strategy_index: Optional[StrictInt] = None + is_maker_fee_enabled: Optional[StrictBool] = None + is_taker_fee_enabled: Optional[StrictBool] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "order_quote_limit", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "size_decimals", "price_decimals", "quote_multiplier", "default_initial_margin_fraction", "min_initial_margin_fraction", "maintenance_margin_fraction", "closeout_margin_fraction", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "open_interest", "daily_chart", "market_config", "strategy_index"] + __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "order_quote_limit", "size_decimals", "price_decimals", "quote_multiplier", "default_initial_margin_fraction", "min_initial_margin_fraction", "maintenance_margin_fraction", "closeout_margin_fraction", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "open_interest", "daily_chart", "market_config", "strategy_index", "is_maker_fee_enabled", "is_taker_fee_enabled"] @field_validator('market_type') def market_type_validate_enum(cls, value): @@ -78,7 +81,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -90,8 +94,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -137,7 +140,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "market_id": obj.get("market_id"), "market_type": obj.get("market_type"), @@ -149,10 +152,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "liquidation_fee": obj.get("liquidation_fee"), "min_base_amount": obj.get("min_base_amount"), "min_quote_amount": obj.get("min_quote_amount"), - "order_quote_limit": obj.get("order_quote_limit"), "supported_size_decimals": obj.get("supported_size_decimals"), "supported_price_decimals": obj.get("supported_price_decimals"), "supported_quote_decimals": obj.get("supported_quote_decimals"), + "order_quote_limit": obj.get("order_quote_limit"), "size_decimals": obj.get("size_decimals"), "price_decimals": obj.get("price_decimals"), "quote_multiplier": obj.get("quote_multiplier"), @@ -170,7 +173,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "open_interest": obj.get("open_interest"), "daily_chart": obj.get("daily_chart"), "market_config": MarketConfig.from_dict(obj["market_config"]) if obj.get("market_config") is not None else None, - "strategy_index": obj.get("strategy_index") + "strategy_index": obj.get("strategy_index"), + "is_maker_fee_enabled": obj.get("is_maker_fee_enabled"), + "is_taker_fee_enabled": obj.get("is_taker_fee_enabled") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/pn_l_entry.py b/lighter/models/pn_l_entry.py index b360dcb..e6edf42 100644 --- a/lighter/models/pn_l_entry.py +++ b/lighter/models/pn_l_entry.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PnLEntry(BaseModel): """ @@ -28,24 +29,26 @@ class PnLEntry(BaseModel): """ # noqa: E501 timestamp: StrictInt trade_pnl: Union[StrictFloat, StrictInt] - trade_spot_pnl: Union[StrictFloat, StrictInt] inflow: Union[StrictFloat, StrictInt] outflow: Union[StrictFloat, StrictInt] - spot_outflow: Union[StrictFloat, StrictInt] - spot_inflow: Union[StrictFloat, StrictInt] pool_pnl: Union[StrictFloat, StrictInt] pool_inflow: Union[StrictFloat, StrictInt] pool_outflow: Union[StrictFloat, StrictInt] - staking_pnl: Union[StrictFloat, StrictInt] - staking_inflow: Union[StrictFloat, StrictInt] - staking_outflow: Union[StrictFloat, StrictInt] pool_total_shares: Union[StrictFloat, StrictInt] + spot_inflow: Union[StrictFloat, StrictInt] + spot_outflow: Union[StrictFloat, StrictInt] staked_lit: Union[StrictFloat, StrictInt] + staking_inflow: Union[StrictFloat, StrictInt] + staking_outflow: Union[StrictFloat, StrictInt] + staking_pnl: Union[StrictFloat, StrictInt] + trade_spot_pnl: Union[StrictFloat, StrictInt] + volume: Union[StrictFloat, StrictInt] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["timestamp", "trade_pnl", "trade_spot_pnl", "inflow", "outflow", "spot_outflow", "spot_inflow", "pool_pnl", "pool_inflow", "pool_outflow", "staking_pnl", "staking_inflow", "staking_outflow", "pool_total_shares", "staked_lit"] + __properties: ClassVar[List[str]] = ["timestamp", "trade_pnl", "inflow", "outflow", "pool_pnl", "pool_inflow", "pool_outflow", "pool_total_shares", "spot_inflow", "spot_outflow", "staked_lit", "staking_inflow", "staking_outflow", "staking_pnl", "trade_spot_pnl", "volume"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +60,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -101,22 +103,23 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "trade_pnl": obj.get("trade_pnl"), - "trade_spot_pnl": obj.get("trade_spot_pnl"), "inflow": obj.get("inflow"), "outflow": obj.get("outflow"), - "spot_outflow": obj.get("spot_outflow"), - "spot_inflow": obj.get("spot_inflow"), "pool_pnl": obj.get("pool_pnl"), "pool_inflow": obj.get("pool_inflow"), "pool_outflow": obj.get("pool_outflow"), - "staking_pnl": obj.get("staking_pnl"), + "pool_total_shares": obj.get("pool_total_shares"), + "spot_inflow": obj.get("spot_inflow"), + "spot_outflow": obj.get("spot_outflow"), + "staked_lit": obj.get("staked_lit"), "staking_inflow": obj.get("staking_inflow"), "staking_outflow": obj.get("staking_outflow"), - "pool_total_shares": obj.get("pool_total_shares"), - "staked_lit": obj.get("staked_lit") + "staking_pnl": obj.get("staking_pnl"), + "trade_spot_pnl": obj.get("trade_spot_pnl"), + "volume": obj.get("volume") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/position_funding.py b/lighter/models/position_funding.py index 5eeb65b..7c0c7c2 100644 --- a/lighter/models/position_funding.py +++ b/lighter/models/position_funding.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PositionFunding(BaseModel): """ @@ -30,12 +31,12 @@ class PositionFunding(BaseModel): market_id: StrictInt funding_id: StrictInt change: StrictStr + discount: StrictStr rate: StrictStr position_size: StrictStr position_side: StrictStr - discount: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["timestamp", "market_id", "funding_id", "change", "rate", "position_size", "position_side", "discount"] + __properties: ClassVar[List[str]] = ["timestamp", "market_id", "funding_id", "change", "discount", "rate", "position_size", "position_side"] @field_validator('position_side') def position_side_validate_enum(cls, value): @@ -45,7 +46,8 @@ def position_side_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -101,15 +102,15 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "market_id": obj.get("market_id"), "funding_id": obj.get("funding_id"), "change": obj.get("change"), + "discount": obj.get("discount"), "rate": obj.get("rate"), "position_size": obj.get("position_size"), - "position_side": obj.get("position_side"), - "discount": obj.get("discount") + "position_side": obj.get("position_side") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/position_fundings.py b/lighter/models/position_fundings.py index c5b603e..3ad4929 100644 --- a/lighter/models/position_fundings.py +++ b/lighter/models/position_fundings.py @@ -22,6 +22,7 @@ from lighter.models.position_funding import PositionFunding from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PositionFundings(BaseModel): """ @@ -35,7 +36,8 @@ class PositionFundings(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "position_fundings", "next_cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in position_fundings (list) _items = [] if self.position_fundings: - for _item in self.position_fundings: - if _item: - _items.append(_item.to_dict()) + for _item_position_fundings in self.position_fundings: + if _item_position_fundings: + _items.append(_item_position_fundings.to_dict()) _dict['position_fundings'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "position_fundings": [PositionFunding.from_dict(_item) for _item in obj["position_fundings"]] if obj.get("position_fundings") is not None else None, diff --git a/lighter/models/price_level.py b/lighter/models/price_level.py index 188551a..473b3f4 100644 --- a/lighter/models/price_level.py +++ b/lighter/models/price_level.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PriceLevel(BaseModel): """ @@ -32,7 +33,8 @@ class PriceLevel(BaseModel): __properties: ClassVar[List[str]] = ["price", "size"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "price": obj.get("price"), "size": obj.get("size") }) diff --git a/lighter/models/public_pool_info.py b/lighter/models/public_pool_info.py index 3e528fd..deadb66 100644 --- a/lighter/models/public_pool_info.py +++ b/lighter/models/public_pool_info.py @@ -24,6 +24,7 @@ from lighter.models.strategy import Strategy from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PublicPoolInfo(BaseModel): """ @@ -35,15 +36,16 @@ class PublicPoolInfo(BaseModel): total_shares: StrictInt operator_shares: StrictInt annual_percentage_yield: Union[StrictFloat, StrictInt] - sharpe_ratio: Union[StrictFloat, StrictInt] daily_returns: List[DailyReturn] share_prices: List[SharePrice] + sharpe_ratio: Union[StrictFloat, StrictInt] strategies: List[Strategy] additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares", "annual_percentage_yield", "sharpe_ratio", "daily_returns", "share_prices", "strategies"] + __properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares", "annual_percentage_yield", "daily_returns", "share_prices", "sharpe_ratio", "strategies"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -86,23 +87,23 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in daily_returns (list) _items = [] if self.daily_returns: - for _item in self.daily_returns: - if _item: - _items.append(_item.to_dict()) + for _item_daily_returns in self.daily_returns: + if _item_daily_returns: + _items.append(_item_daily_returns.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()) + for _item_share_prices in self.share_prices: + if _item_share_prices: + _items.append(_item_share_prices.to_dict()) _dict['share_prices'] = _items # override the default output from pydantic by calling `to_dict()` of each item in strategies (list) _items = [] if self.strategies: - for _item in self.strategies: - if _item: - _items.append(_item.to_dict()) + for _item_strategies in self.strategies: + if _item_strategies: + _items.append(_item_strategies.to_dict()) _dict['strategies'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -120,16 +121,16 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "status": obj.get("status"), "operator_fee": obj.get("operator_fee"), "min_operator_share_rate": obj.get("min_operator_share_rate"), "total_shares": obj.get("total_shares"), "operator_shares": obj.get("operator_shares"), "annual_percentage_yield": obj.get("annual_percentage_yield"), - "sharpe_ratio": obj.get("sharpe_ratio"), "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, + "sharpe_ratio": obj.get("sharpe_ratio"), "strategies": [Strategy.from_dict(_item) for _item in obj["strategies"]] if obj.get("strategies") is not None else None }) # store additional fields in additional_properties diff --git a/lighter/models/public_pool_metadata.py b/lighter/models/public_pool_metadata.py index 3c61207..4f15bb0 100644 --- a/lighter/models/public_pool_metadata.py +++ b/lighter/models/public_pool_metadata.py @@ -23,6 +23,7 @@ from lighter.models.public_pool_share import PublicPoolShare from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PublicPoolMetadata(BaseModel): """ @@ -31,26 +32,27 @@ class PublicPoolMetadata(BaseModel): code: StrictInt message: Optional[StrictStr] = None account_index: StrictInt - created_at: StrictInt - master_account_index: StrictInt account_type: StrictInt name: StrictStr l1_address: StrictStr annual_percentage_yield: Union[StrictFloat, StrictInt] - sharpe_ratio: Union[StrictFloat, StrictInt] status: StrictInt operator_fee: StrictStr total_asset_value: StrictStr - total_spot_value: StrictStr - total_perps_value: StrictStr total_shares: StrictInt account_share: Optional[PublicPoolShare] = None assets: List[AccountAsset] + created_at: StrictInt + master_account_index: StrictInt + sharpe_ratio: Union[StrictFloat, StrictInt] + total_perps_value: StrictStr + total_spot_value: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "account_index", "created_at", "master_account_index", "account_type", "name", "l1_address", "annual_percentage_yield", "sharpe_ratio", "status", "operator_fee", "total_asset_value", "total_spot_value", "total_perps_value", "total_shares", "account_share", "assets"] + __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", "assets", "created_at", "master_account_index", "sharpe_ratio", "total_perps_value", "total_spot_value"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -62,8 +64,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -96,9 +97,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in assets (list) _items = [] if self.assets: - for _item in self.assets: - if _item: - _items.append(_item.to_dict()) + for _item_assets in self.assets: + if _item_assets: + _items.append(_item_assets.to_dict()) _dict['assets'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -116,25 +117,25 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "account_index": obj.get("account_index"), - "created_at": obj.get("created_at"), - "master_account_index": obj.get("master_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"), - "sharpe_ratio": obj.get("sharpe_ratio"), "status": obj.get("status"), "operator_fee": obj.get("operator_fee"), "total_asset_value": obj.get("total_asset_value"), - "total_spot_value": obj.get("total_spot_value"), - "total_perps_value": obj.get("total_perps_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, - "assets": [AccountAsset.from_dict(_item) for _item in obj["assets"]] if obj.get("assets") is not None else None + "assets": [AccountAsset.from_dict(_item) for _item in obj["assets"]] if obj.get("assets") is not None else None, + "created_at": obj.get("created_at"), + "master_account_index": obj.get("master_account_index"), + "sharpe_ratio": obj.get("sharpe_ratio"), + "total_perps_value": obj.get("total_perps_value"), + "total_spot_value": obj.get("total_spot_value") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/public_pool_share.py b/lighter/models/public_pool_share.py index 90e7203..5418f9d 100644 --- a/lighter/models/public_pool_share.py +++ b/lighter/models/public_pool_share.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PublicPoolShare(BaseModel): """ @@ -28,14 +29,15 @@ class PublicPoolShare(BaseModel): """ # noqa: E501 public_pool_index: StrictInt shares_amount: StrictInt - entry_usdc: StrictStr = Field(description=" For public pools and insurance fund") - principal_amount: StrictStr + entry_usdc: StrictStr entry_timestamp: StrictInt + principal_amount: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["public_pool_index", "shares_amount", "entry_usdc", "principal_amount", "entry_timestamp"] + __properties: ClassVar[List[str]] = ["public_pool_index", "shares_amount", "entry_usdc", "entry_timestamp", "principal_amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,12 +92,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "public_pool_index": obj.get("public_pool_index"), "shares_amount": obj.get("shares_amount"), "entry_usdc": obj.get("entry_usdc"), - "principal_amount": obj.get("principal_amount"), - "entry_timestamp": obj.get("entry_timestamp") + "entry_timestamp": obj.get("entry_timestamp"), + "principal_amount": obj.get("principal_amount") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/push_notif_delivery_result.py b/lighter/models/push_notif_delivery_result.py index 5d757b0..9c37183 100644 --- a/lighter/models/push_notif_delivery_result.py +++ b/lighter/models/push_notif_delivery_result.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class PushNotifDeliveryResult(BaseModel): """ @@ -33,7 +34,8 @@ class PushNotifDeliveryResult(BaseModel): __properties: ClassVar[List[str]] = ["expo_token", "status", "error"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "expo_token": obj.get("expo_token"), "status": obj.get("status"), "error": obj.get("error") diff --git a/lighter/models/referral.py b/lighter/models/referral.py index 2dc106a..5092fc9 100644 --- a/lighter/models/referral.py +++ b/lighter/models/referral.py @@ -22,6 +22,7 @@ from lighter.models.trade_stats import TradeStats from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Referral(BaseModel): """ @@ -31,11 +32,13 @@ class Referral(BaseModel): referral_code: StrictStr used_at: StrictInt trade_stats: TradeStats + tier: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["l1_address", "referral_code", "used_at", "trade_stats"] + __properties: ClassVar[List[str]] = ["l1_address", "referral_code", "used_at", "trade_stats", "tier"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,11 +96,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "l1_address": obj.get("l1_address"), "referral_code": obj.get("referral_code"), "used_at": obj.get("used_at"), - "trade_stats": TradeStats.from_dict(obj["trade_stats"]) if obj.get("trade_stats") is not None else None + "trade_stats": TradeStats.from_dict(obj["trade_stats"]) if obj.get("trade_stats") is not None else None, + "tier": obj.get("tier") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_do_faucet.py b/lighter/models/req_do_faucet.py index 16281b1..f2ad271 100644 --- a/lighter/models/req_do_faucet.py +++ b/lighter/models/req_do_faucet.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqDoFaucet(BaseModel): """ @@ -32,7 +33,8 @@ class ReqDoFaucet(BaseModel): __properties: ClassVar[List[str]] = ["l1_address", "do_l1_transfer"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "l1_address": obj.get("l1_address"), "do_l1_transfer": obj.get("do_l1_transfer") if obj.get("do_l1_transfer") is not None else False }) diff --git a/lighter/models/req_export_data.py b/lighter/models/req_export_data.py index f800a93..965f67a 100644 --- a/lighter/models/req_export_data.py +++ b/lighter/models/req_export_data.py @@ -22,13 +22,14 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqExportData(BaseModel): """ ReqExportData """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") - account_index: Optional[StrictInt] = -1 + auth: Optional[StrictStr] = None + account_index: Optional[StrictInt] = None market_id: Optional[StrictInt] = None type: StrictStr start_timestamp: Optional[Annotated[int, Field(le=1830297600000, strict=True, ge=1735689600000)]] = None @@ -77,7 +78,8 @@ def trade_type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -89,8 +91,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -133,9 +134,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), - "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "account_index": obj.get("account_index"), "market_id": obj.get("market_id"), "type": obj.get("type"), "start_timestamp": obj.get("start_timestamp"), diff --git a/lighter/models/req_get_account.py b/lighter/models/req_get_account.py index 50c4fd3..0d07d6d 100644 --- a/lighter/models/req_get_account.py +++ b/lighter/models/req_get_account.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccount(BaseModel): """ @@ -29,9 +30,8 @@ class ReqGetAccount(BaseModel): by: StrictStr value: StrictStr active_only: Optional[StrictBool] = False - cursor: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["by", "value", "active_only", "cursor"] + __properties: ClassVar[List[str]] = ["by", "value", "active_only"] @field_validator('by') def by_validate_enum(cls, value): @@ -41,7 +41,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -97,11 +97,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value"), - "active_only": obj.get("active_only") if obj.get("active_only") is not None else False, - "cursor": obj.get("cursor") + "active_only": obj.get("active_only") if obj.get("active_only") is not None else False }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_account_active_orders.py b/lighter/models/req_get_account_active_orders.py index 7e976cd..0d50fc3 100644 --- a/lighter/models/req_get_account_active_orders.py +++ b/lighter/models/req_get_account_active_orders.py @@ -21,19 +21,21 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountActiveOrders(BaseModel): """ ReqGetAccountActiveOrders """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") account_index: StrictInt - market_id: StrictInt + market_id: Optional[StrictInt] = None + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id"] + __properties: ClassVar[List[str]] = ["account_index", "market_id", "auth"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,10 +90,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), + _obj = cls.model_validate({ "account_index": obj.get("account_index"), - "market_id": obj.get("market_id") + "market_id": obj.get("market_id"), + "auth": obj.get("auth") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_account_api_keys.py b/lighter/models/req_get_account_api_keys.py index ce423e3..1361cc7 100644 --- a/lighter/models/req_get_account_api_keys.py +++ b/lighter/models/req_get_account_api_keys.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountApiKeys(BaseModel): """ @@ -32,7 +33,8 @@ class ReqGetAccountApiKeys(BaseModel): __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "api_key_index": obj.get("api_key_index") }) diff --git a/lighter/models/req_get_account_by_l1_address.py b/lighter/models/req_get_account_by_l1_address.py index 4174b82..2e9bbc3 100644 --- a/lighter/models/req_get_account_by_l1_address.py +++ b/lighter/models/req_get_account_by_l1_address.py @@ -18,21 +18,22 @@ import json from pydantic import BaseModel, ConfigDict, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountByL1Address(BaseModel): """ ReqGetAccountByL1Address """ # noqa: E501 l1_address: StrictStr - cursor: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["l1_address", "cursor"] + __properties: ClassVar[List[str]] = ["l1_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,9 +88,8 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "l1_address": obj.get("l1_address"), - "cursor": obj.get("cursor") + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_account_inactive_orders.py b/lighter/models/req_get_account_inactive_orders.py index 6ab3288..70cff76 100644 --- a/lighter/models/req_get_account_inactive_orders.py +++ b/lighter/models/req_get_account_inactive_orders.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountInactiveOrders(BaseModel): """ @@ -38,7 +39,8 @@ class ReqGetAccountInactiveOrders(BaseModel): __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "ask_filter", "between_timestamps", "cursor", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), "market_id": obj.get("market_id"), diff --git a/lighter/models/req_get_account_limits.py b/lighter/models/req_get_account_limits.py index eb483ac..e27785d 100644 --- a/lighter/models/req_get_account_limits.py +++ b/lighter/models/req_get_account_limits.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountLimits(BaseModel): """ @@ -32,7 +33,8 @@ class ReqGetAccountLimits(BaseModel): __properties: ClassVar[List[str]] = ["account_index", "auth"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "auth": obj.get("auth") }) diff --git a/lighter/models/req_get_account_metadata.py b/lighter/models/req_get_account_metadata.py index 98e6c71..21cf0d3 100644 --- a/lighter/models/req_get_account_metadata.py +++ b/lighter/models/req_get_account_metadata.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountMetadata(BaseModel): """ @@ -29,9 +30,8 @@ class ReqGetAccountMetadata(BaseModel): by: StrictStr value: StrictStr auth: Optional[StrictStr] = None - cursor: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["by", "value", "auth", "cursor"] + __properties: ClassVar[List[str]] = ["by", "value", "auth"] @field_validator('by') def by_validate_enum(cls, value): @@ -41,7 +41,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -97,11 +97,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value"), - "auth": obj.get("auth"), - "cursor": obj.get("cursor") + "auth": obj.get("auth") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_account_pn_l.py b/lighter/models/req_get_account_pn_l.py index ed47aa4..2d5e465 100644 --- a/lighter/models/req_get_account_pn_l.py +++ b/lighter/models/req_get_account_pn_l.py @@ -22,12 +22,13 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountPnL(BaseModel): """ ReqGetAccountPnL """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + auth: Optional[StrictStr] = None by: StrictStr value: StrictStr resolution: StrictStr @@ -53,7 +54,8 @@ def resolution_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -65,8 +67,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -109,7 +110,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "by": obj.get("by"), "value": obj.get("value"), diff --git a/lighter/models/req_get_account_txs.py b/lighter/models/req_get_account_txs.py index e9fa53f..1a7ced0 100644 --- a/lighter/models/req_get_account_txs.py +++ b/lighter/models/req_get_account_txs.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAccountTxs(BaseModel): """ @@ -31,10 +32,10 @@ class ReqGetAccountTxs(BaseModel): limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None by: Optional[StrictStr] = None value: Optional[StrictStr] = None - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") types: Optional[List[StrictInt]] = None + auth: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["index", "limit", "by", "value", "auth", "types"] + __properties: ClassVar[List[str]] = ["index", "limit", "by", "value", "types", "auth"] @field_validator('by') def by_validate_enum(cls, value): @@ -47,7 +48,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -103,13 +104,13 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "index": obj.get("index"), "limit": obj.get("limit"), "by": obj.get("by"), "value": obj.get("value"), - "auth": obj.get("auth"), - "types": obj.get("types") + "types": obj.get("types"), + "auth": obj.get("auth") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_api_tokens.py b/lighter/models/req_get_api_tokens.py index e0de034..2d0384d 100644 --- a/lighter/models/req_get_api_tokens.py +++ b/lighter/models/req_get_api_tokens.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetApiTokens(BaseModel): """ @@ -31,7 +32,8 @@ class ReqGetApiTokens(BaseModel): __properties: ClassVar[List[str]] = ["account_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_asset_details.py b/lighter/models/req_get_asset_details.py index 93dae58..3b40b28 100644 --- a/lighter/models/req_get_asset_details.py +++ b/lighter/models/req_get_asset_details.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetAssetDetails(BaseModel): """ @@ -31,7 +32,8 @@ class ReqGetAssetDetails(BaseModel): __properties: ClassVar[List[str]] = ["asset_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "asset_id": obj.get("asset_id") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_block.py b/lighter/models/req_get_block.py index d0fe811..5f8997d 100644 --- a/lighter/models/req_get_block.py +++ b/lighter/models/req_get_block.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetBlock(BaseModel): """ @@ -39,7 +40,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -95,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value") }) diff --git a/lighter/models/req_get_block_txs.py b/lighter/models/req_get_block_txs.py index 6a3aa66..f502076 100644 --- a/lighter/models/req_get_block_txs.py +++ b/lighter/models/req_get_block_txs.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetBlockTxs(BaseModel): """ @@ -39,7 +40,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -95,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value") }) diff --git a/lighter/models/req_get_bridges_by_l1_addr.py b/lighter/models/req_get_bridges_by_l1_addr.py index 6ba63fe..422bd8e 100644 --- a/lighter/models/req_get_bridges_by_l1_addr.py +++ b/lighter/models/req_get_bridges_by_l1_addr.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetBridgesByL1Addr(BaseModel): """ @@ -31,7 +32,8 @@ class ReqGetBridgesByL1Addr(BaseModel): __properties: ClassVar[List[str]] = ["l1_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "l1_address": obj.get("l1_address") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_by_account.py b/lighter/models/req_get_by_account.py index 85557cf..0f66d2f 100644 --- a/lighter/models/req_get_by_account.py +++ b/lighter/models/req_get_by_account.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetByAccount(BaseModel): """ @@ -39,7 +40,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -95,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value") }) diff --git a/lighter/models/req_get_candles.py b/lighter/models/req_get_candles.py index 8814c7e..4ef5f1b 100644 --- a/lighter/models/req_get_candles.py +++ b/lighter/models/req_get_candles.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetCandles(BaseModel): """ @@ -44,7 +45,8 @@ def resolution_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -100,7 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "resolution": obj.get("resolution"), "start_timestamp": obj.get("start_timestamp"), diff --git a/lighter/models/req_get_deposit_history.py b/lighter/models/req_get_deposit_history.py index c090e2f..62c50ee 100644 --- a/lighter/models/req_get_deposit_history.py +++ b/lighter/models/req_get_deposit_history.py @@ -21,18 +21,19 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetDepositHistory(BaseModel): """ ReqGetDepositHistory """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") l1_address: StrictStr cursor: Optional[StrictStr] = None filter: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index", "l1_address", "cursor", "filter"] + __properties: ClassVar[List[str]] = ["account_index", "auth", "l1_address", "cursor", "filter"] @field_validator('filter') def filter_validate_enum(cls, value): @@ -45,7 +46,8 @@ def filter_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -57,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -101,9 +102,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), + _obj = cls.model_validate({ "account_index": obj.get("account_index"), + "auth": obj.get("auth"), "l1_address": obj.get("l1_address"), "cursor": obj.get("cursor"), "filter": obj.get("filter") diff --git a/lighter/models/req_get_exchange_metrics.py b/lighter/models/req_get_exchange_metrics.py index 6089da1..b369657 100644 --- a/lighter/models/req_get_exchange_metrics.py +++ b/lighter/models/req_get_exchange_metrics.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetExchangeMetrics(BaseModel): """ @@ -58,7 +59,8 @@ def filter_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -70,8 +72,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -114,7 +115,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "period": obj.get("period"), "kind": obj.get("kind"), "filter": obj.get("filter"), diff --git a/lighter/models/req_get_execute_stats.py b/lighter/models/req_get_execute_stats.py index 266d02a..afec874 100644 --- a/lighter/models/req_get_execute_stats.py +++ b/lighter/models/req_get_execute_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetExecuteStats(BaseModel): """ @@ -38,7 +39,8 @@ def period_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "period": obj.get("period") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_fast_withdraw_info.py b/lighter/models/req_get_fast_withdraw_info.py index 401af0a..410bcbf 100644 --- a/lighter/models/req_get_fast_withdraw_info.py +++ b/lighter/models/req_get_fast_withdraw_info.py @@ -21,18 +21,20 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetFastWithdrawInfo(BaseModel): """ ReqGetFastWithdrawInfo """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index"] + __properties: ClassVar[List[str]] = ["account_index", "auth"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,9 +89,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), - "account_index": obj.get("account_index") + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_fundings.py b/lighter/models/req_get_fundings.py index d879d47..868be32 100644 --- a/lighter/models/req_get_fundings.py +++ b/lighter/models/req_get_fundings.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetFundings(BaseModel): """ @@ -43,7 +44,8 @@ def resolution_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -55,8 +57,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -99,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "resolution": obj.get("resolution"), "start_timestamp": obj.get("start_timestamp"), diff --git a/lighter/models/req_get_l1_metadata.py b/lighter/models/req_get_l1_metadata.py index 5ee9d19..cce0fc6 100644 --- a/lighter/models/req_get_l1_metadata.py +++ b/lighter/models/req_get_l1_metadata.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetL1Metadata(BaseModel): """ @@ -32,7 +33,8 @@ class ReqGetL1Metadata(BaseModel): __properties: ClassVar[List[str]] = ["auth", "l1_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "l1_address": obj.get("l1_address") }) diff --git a/lighter/models/req_get_l1_tx.py b/lighter/models/req_get_l1_tx.py index 02f7f87..8f1635f 100644 --- a/lighter/models/req_get_l1_tx.py +++ b/lighter/models/req_get_l1_tx.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetL1Tx(BaseModel): """ @@ -31,7 +32,8 @@ class ReqGetL1Tx(BaseModel): __properties: ClassVar[List[str]] = ["hash"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "hash": obj.get("hash") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_latest_deposit.py b/lighter/models/req_get_latest_deposit.py index 7bd652d..2376c79 100644 --- a/lighter/models/req_get_latest_deposit.py +++ b/lighter/models/req_get_latest_deposit.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetLatestDeposit(BaseModel): """ @@ -31,7 +32,8 @@ class ReqGetLatestDeposit(BaseModel): __properties: ClassVar[List[str]] = ["l1_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "l1_address": obj.get("l1_address") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_leases.py b/lighter/models/req_get_leases.py index 37c02d0..393cfbe 100644 --- a/lighter/models/req_get_leases.py +++ b/lighter/models/req_get_leases.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetLeases(BaseModel): """ @@ -34,7 +35,8 @@ class ReqGetLeases(BaseModel): __properties: ClassVar[List[str]] = ["auth", "account_index", "cursor", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), "cursor": obj.get("cursor"), diff --git a/lighter/models/req_get_liquidation_infos.py b/lighter/models/req_get_liquidation_infos.py index aa7f818..d2c9a55 100644 --- a/lighter/models/req_get_liquidation_infos.py +++ b/lighter/models/req_get_liquidation_infos.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetLiquidationInfos(BaseModel): """ @@ -36,7 +37,8 @@ class ReqGetLiquidationInfos(BaseModel): __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "cursor", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -92,7 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), "market_id": obj.get("market_id"), diff --git a/lighter/models/req_get_maker_only_api_keys.py b/lighter/models/req_get_maker_only_api_keys.py index 28d562d..5f029dd 100644 --- a/lighter/models/req_get_maker_only_api_keys.py +++ b/lighter/models/req_get_maker_only_api_keys.py @@ -17,22 +17,23 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr -from typing import Any, ClassVar, Dict, List, Optional +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetMakerOnlyApiKeys(BaseModel): """ ReqGetMakerOnlyApiKeys """ # noqa: E501 - auth: Optional[StrictStr] = None account_index: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index"] + __properties: ClassVar[List[str]] = ["account_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,8 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), + _obj = cls.model_validate({ "account_index": obj.get("account_index") }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_next_nonce.py b/lighter/models/req_get_next_nonce.py index 1ae8fbc..1dc2f4b 100644 --- a/lighter/models/req_get_next_nonce.py +++ b/lighter/models/req_get_next_nonce.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetNextNonce(BaseModel): """ @@ -32,7 +33,8 @@ class ReqGetNextNonce(BaseModel): __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "account_index": obj.get("account_index"), "api_key_index": obj.get("api_key_index") }) diff --git a/lighter/models/req_get_order_book_details.py b/lighter/models/req_get_order_book_details.py index 50dd1d0..aafc6a5 100644 --- a/lighter/models/req_get_order_book_details.py +++ b/lighter/models/req_get_order_book_details.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetOrderBookDetails(BaseModel): """ @@ -42,7 +43,8 @@ def filter_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "filter": obj.get("filter") if obj.get("filter") is not None else 'all' }) diff --git a/lighter/models/req_get_order_book_orders.py b/lighter/models/req_get_order_book_orders.py index 4e72111..fb17b36 100644 --- a/lighter/models/req_get_order_book_orders.py +++ b/lighter/models/req_get_order_book_orders.py @@ -22,18 +22,20 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetOrderBookOrders(BaseModel): """ ReqGetOrderBookOrders """ # noqa: E501 market_id: StrictInt - limit: Annotated[int, Field(le=250, strict=True, ge=1)] + limit: Annotated[int, Field(le=100, strict=True, ge=1)] additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["market_id", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "limit": obj.get("limit") }) diff --git a/lighter/models/req_get_order_books.py b/lighter/models/req_get_order_books.py index be80217..136fb2c 100644 --- a/lighter/models/req_get_order_books.py +++ b/lighter/models/req_get_order_books.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetOrderBooks(BaseModel): """ @@ -42,7 +43,8 @@ def filter_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -54,8 +56,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "filter": obj.get("filter") if obj.get("filter") is not None else 'all' }) diff --git a/lighter/models/req_get_position_funding.py b/lighter/models/req_get_position_funding.py index 08ab0d9..bd3e567 100644 --- a/lighter/models/req_get_position_funding.py +++ b/lighter/models/req_get_position_funding.py @@ -22,12 +22,13 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetPositionFunding(BaseModel): """ ReqGetPositionFunding """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + auth: Optional[StrictStr] = None account_index: StrictInt market_id: Optional[StrictInt] = None cursor: Optional[StrictStr] = None @@ -47,7 +48,8 @@ def side_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -59,8 +61,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -103,7 +104,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), "market_id": obj.get("market_id"), diff --git a/lighter/models/req_get_public_pools_metadata.py b/lighter/models/req_get_public_pools_metadata.py index 4c05fa4..3560d2d 100644 --- a/lighter/models/req_get_public_pools_metadata.py +++ b/lighter/models/req_get_public_pools_metadata.py @@ -22,12 +22,13 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetPublicPoolsMetadata(BaseModel): """ ReqGetPublicPoolsMetadata """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + auth: Optional[StrictStr] = None filter: Optional[StrictStr] = None index: StrictInt limit: Annotated[int, Field(le=100, strict=True, ge=1)] @@ -41,12 +42,13 @@ def filter_validate_enum(cls, value): if value is None: return value - if value not in set(['all', 'user', 'protocol', 'account_index', 'stake']): - raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index', 'stake')") + 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_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -58,8 +60,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -102,7 +103,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "filter": obj.get("filter"), "index": obj.get("index"), diff --git a/lighter/models/req_get_push_notif_settings.py b/lighter/models/req_get_push_notif_settings.py index 3795d7d..1004ad0 100644 --- a/lighter/models/req_get_push_notif_settings.py +++ b/lighter/models/req_get_push_notif_settings.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetPushNotifSettings(BaseModel): """ @@ -33,7 +34,8 @@ class ReqGetPushNotifSettings(BaseModel): __properties: ClassVar[List[str]] = ["auth", "account_index", "expo_token"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), "expo_token": obj.get("expo_token") diff --git a/lighter/models/req_get_range_with_cursor.py b/lighter/models/req_get_range_with_cursor.py index e7ea2e5..198f062 100644 --- a/lighter/models/req_get_range_with_cursor.py +++ b/lighter/models/req_get_range_with_cursor.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetRangeWithCursor(BaseModel): """ @@ -33,7 +34,8 @@ class ReqGetRangeWithCursor(BaseModel): __properties: ClassVar[List[str]] = ["cursor", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "cursor": obj.get("cursor"), "limit": obj.get("limit") }) diff --git a/lighter/models/req_get_range_with_index.py b/lighter/models/req_get_range_with_index.py index 4e5f7f9..7daf5bc 100644 --- a/lighter/models/req_get_range_with_index.py +++ b/lighter/models/req_get_range_with_index.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetRangeWithIndex(BaseModel): """ @@ -33,7 +34,8 @@ class ReqGetRangeWithIndex(BaseModel): __properties: ClassVar[List[str]] = ["index", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "index": obj.get("index"), "limit": obj.get("limit") }) diff --git a/lighter/models/req_get_range_with_index_sortable.py b/lighter/models/req_get_range_with_index_sortable.py index 920b5bb..7e44070 100644 --- a/lighter/models/req_get_range_with_index_sortable.py +++ b/lighter/models/req_get_range_with_index_sortable.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetRangeWithIndexSortable(BaseModel): """ @@ -44,7 +45,8 @@ def sort_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -100,7 +101,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "index": obj.get("index"), "limit": obj.get("limit"), "sort": obj.get("sort") if obj.get("sort") is not None else 'asc' diff --git a/lighter/models/req_get_recent_trades.py b/lighter/models/req_get_recent_trades.py index f2f32ba..cd12680 100644 --- a/lighter/models/req_get_recent_trades.py +++ b/lighter/models/req_get_recent_trades.py @@ -22,6 +22,7 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetRecentTrades(BaseModel): """ @@ -33,7 +34,8 @@ class ReqGetRecentTrades(BaseModel): __properties: ClassVar[List[str]] = ["market_id", "limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "limit": obj.get("limit") }) diff --git a/lighter/models/req_get_trades.py b/lighter/models/req_get_trades.py index acc205c..bcdac53 100644 --- a/lighter/models/req_get_trades.py +++ b/lighter/models/req_get_trades.py @@ -22,26 +22,27 @@ from typing_extensions import Annotated from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetTrades(BaseModel): """ ReqGetTrades """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + auth: Optional[StrictStr] = None market_id: Optional[StrictInt] = None - account_index: Optional[StrictInt] = -1 + account_index: Optional[StrictInt] = None order_index: Optional[StrictInt] = None sort_by: StrictStr sort_dir: Optional[StrictStr] = 'desc' cursor: Optional[StrictStr] = None - var_from: Optional[StrictInt] = Field(default=-1, alias="from") + var_from: Optional[StrictInt] = Field(default=None, alias="from") ask_filter: Optional[StrictInt] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] role: Optional[StrictStr] = 'all' type: Optional[StrictStr] = 'all' - limit: Annotated[int, Field(le=100, strict=True, ge=1)] aggregate: Optional[StrictBool] = False additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "market_id", "account_index", "order_index", "sort_by", "sort_dir", "cursor", "from", "ask_filter", "role", "type", "limit", "aggregate"] + __properties: ClassVar[List[str]] = ["auth", "market_id", "account_index", "order_index", "sort_by", "sort_dir", "cursor", "from", "ask_filter", "limit", "role", "type", "aggregate"] @field_validator('sort_by') def sort_by_validate_enum(cls, value): @@ -81,7 +82,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -93,8 +95,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -137,19 +138,19 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "market_id": obj.get("market_id"), - "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "account_index": obj.get("account_index"), "order_index": obj.get("order_index"), "sort_by": obj.get("sort_by"), "sort_dir": obj.get("sort_dir") if obj.get("sort_dir") is not None else 'desc', "cursor": obj.get("cursor"), - "from": obj.get("from") if obj.get("from") is not None else -1, + "from": obj.get("from"), "ask_filter": obj.get("ask_filter"), + "limit": obj.get("limit"), "role": obj.get("role") if obj.get("role") is not None else 'all', "type": obj.get("type") if obj.get("type") is not None else 'all', - "limit": obj.get("limit"), "aggregate": obj.get("aggregate") if obj.get("aggregate") is not None else False }) # store additional fields in additional_properties diff --git a/lighter/models/req_get_transfer_fee_info.py b/lighter/models/req_get_transfer_fee_info.py index 1636b55..58635f1 100644 --- a/lighter/models/req_get_transfer_fee_info.py +++ b/lighter/models/req_get_transfer_fee_info.py @@ -17,23 +17,25 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetTransferFeeInfo(BaseModel): """ ReqGetTransferFeeInfo """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + auth: Optional[StrictStr] = None account_index: StrictInt - to_account_index: Optional[StrictInt] = -1 + to_account_index: Optional[StrictInt] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["auth", "account_index", "to_account_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,10 +90,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "account_index": obj.get("account_index"), - "to_account_index": obj.get("to_account_index") if obj.get("to_account_index") is not None else -1 + "to_account_index": obj.get("to_account_index") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/req_get_transfer_history.py b/lighter/models/req_get_transfer_history.py index d128bd4..68dd326 100644 --- a/lighter/models/req_get_transfer_history.py +++ b/lighter/models/req_get_transfer_history.py @@ -17,24 +17,37 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetTransferHistory(BaseModel): """ ReqGetTransferHistory """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") cursor: Optional[StrictStr] = None type: Optional[List[StrictStr]] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index", "cursor", "type"] + __properties: ClassVar[List[str]] = ["account_index", "auth", "cursor", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + for i in value: + if i not in set(['all', 'L2Transfer', 'L2MintShares', 'L2BurnShares', 'L2StakeAssets', 'L2UnstakeAssets']): + raise ValueError("each list item must be one of ('all', 'L2Transfer', 'L2MintShares', 'L2BurnShares', 'L2StakeAssets', 'L2UnstakeAssets')") + return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +59,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,9 +102,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), + _obj = cls.model_validate({ "account_index": obj.get("account_index"), + "auth": obj.get("auth"), "cursor": obj.get("cursor"), "type": obj.get("type") }) diff --git a/lighter/models/req_get_tx.py b/lighter/models/req_get_tx.py index 70706fd..4c27859 100644 --- a/lighter/models/req_get_tx.py +++ b/lighter/models/req_get_tx.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetTx(BaseModel): """ @@ -39,7 +40,8 @@ def by_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -51,8 +53,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -95,7 +96,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "by": obj.get("by"), "value": obj.get("value") }) diff --git a/lighter/models/req_get_user_referrals.py b/lighter/models/req_get_user_referrals.py index 4149ffd..1ef4c4b 100644 --- a/lighter/models/req_get_user_referrals.py +++ b/lighter/models/req_get_user_referrals.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetUserReferrals(BaseModel): """ @@ -33,7 +34,8 @@ class ReqGetUserReferrals(BaseModel): __properties: ClassVar[List[str]] = ["auth", "l1_address", "cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "auth": obj.get("auth"), "l1_address": obj.get("l1_address"), "cursor": obj.get("cursor") diff --git a/lighter/models/req_get_withdraw_history.py b/lighter/models/req_get_withdraw_history.py index fc2f730..06452d5 100644 --- a/lighter/models/req_get_withdraw_history.py +++ b/lighter/models/req_get_withdraw_history.py @@ -21,17 +21,18 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ReqGetWithdrawHistory(BaseModel): """ ReqGetWithdrawHistory """ # noqa: E501 - auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") cursor: Optional[StrictStr] = None filter: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["auth", "account_index", "cursor", "filter"] + __properties: ClassVar[List[str]] = ["account_index", "auth", "cursor", "filter"] @field_validator('filter') def filter_validate_enum(cls, value): @@ -44,7 +45,8 @@ def filter_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -56,8 +58,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -100,9 +101,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ - "auth": obj.get("auth"), + _obj = cls.model_validate({ "account_index": obj.get("account_index"), + "auth": obj.get("auth"), "cursor": obj.get("cursor"), "filter": obj.get("filter") }) diff --git a/lighter/models/resp_change_account_tier.py b/lighter/models/resp_change_account_tier.py index 9e9b797..3ffe898 100644 --- a/lighter/models/resp_change_account_tier.py +++ b/lighter/models/resp_change_account_tier.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespChangeAccountTier(BaseModel): """ @@ -32,7 +33,8 @@ class RespChangeAccountTier(BaseModel): __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message") }) diff --git a/lighter/models/resp_get_api_tokens.py b/lighter/models/resp_get_api_tokens.py index 7cb52b7..bea399b 100644 --- a/lighter/models/resp_get_api_tokens.py +++ b/lighter/models/resp_get_api_tokens.py @@ -22,6 +22,7 @@ from lighter.models.api_token import ApiToken from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetApiTokens(BaseModel): """ @@ -34,7 +35,8 @@ class RespGetApiTokens(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "api_tokens"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in api_tokens (list) _items = [] if self.api_tokens: - for _item in self.api_tokens: - if _item: - _items.append(_item.to_dict()) + for _item_api_tokens in self.api_tokens: + if _item_api_tokens: + _items.append(_item_api_tokens.to_dict()) _dict['api_tokens'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "api_tokens": [ApiToken.from_dict(_item) for _item in obj["api_tokens"]] if obj.get("api_tokens") is not None else None diff --git a/lighter/models/resp_get_bridges_by_l1_addr.py b/lighter/models/resp_get_bridges_by_l1_addr.py index 923f331..3dac3e4 100644 --- a/lighter/models/resp_get_bridges_by_l1_addr.py +++ b/lighter/models/resp_get_bridges_by_l1_addr.py @@ -22,6 +22,7 @@ from lighter.models.bridge import Bridge from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetBridgesByL1Addr(BaseModel): """ @@ -34,7 +35,8 @@ class RespGetBridgesByL1Addr(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "bridges"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in bridges (list) _items = [] if self.bridges: - for _item in self.bridges: - if _item: - _items.append(_item.to_dict()) + for _item_bridges in self.bridges: + if _item_bridges: + _items.append(_item_bridges.to_dict()) _dict['bridges'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "bridges": [Bridge.from_dict(_item) for _item in obj["bridges"]] if obj.get("bridges") is not None else None diff --git a/lighter/models/resp_get_exchange_metrics.py b/lighter/models/resp_get_exchange_metrics.py index dd65001..7b91782 100644 --- a/lighter/models/resp_get_exchange_metrics.py +++ b/lighter/models/resp_get_exchange_metrics.py @@ -22,6 +22,7 @@ from lighter.models.exchange_metric import ExchangeMetric from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetExchangeMetrics(BaseModel): """ @@ -34,7 +35,8 @@ class RespGetExchangeMetrics(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "metrics"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in metrics (list) _items = [] if self.metrics: - for _item in self.metrics: - if _item: - _items.append(_item.to_dict()) + for _item_metrics in self.metrics: + if _item_metrics: + _items.append(_item_metrics.to_dict()) _dict['metrics'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "metrics": [ExchangeMetric.from_dict(_item) for _item in obj["metrics"]] if obj.get("metrics") is not None else None diff --git a/lighter/models/resp_get_execute_stats.py b/lighter/models/resp_get_execute_stats.py index 8b36038..359ef83 100644 --- a/lighter/models/resp_get_execute_stats.py +++ b/lighter/models/resp_get_execute_stats.py @@ -17,11 +17,12 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from pydantic import BaseModel, ConfigDict, StrictStr from typing import Any, ClassVar, Dict, List from lighter.models.execute_stat import ExecuteStat from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetExecuteStats(BaseModel): """ @@ -32,15 +33,9 @@ class RespGetExecuteStats(BaseModel): additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["period", "result"] - @field_validator('period') - def period_validate_enum(cls, value): - """Validates the enum""" - if value not in set(['d', 'w', 'm', 'q', 'y', 'all']): - raise ValueError("must be one of enum values ('d', 'w', 'm', 'q', 'y', 'all')") - return value - model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -83,9 +77,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in result (list) _items = [] if self.result: - for _item in self.result: - if _item: - _items.append(_item.to_dict()) + for _item_result in self.result: + if _item_result: + _items.append(_item_result.to_dict()) _dict['result'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -103,7 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "period": obj.get("period"), "result": [ExecuteStat.from_dict(_item) for _item in obj["result"]] if obj.get("result") is not None else None }) diff --git a/lighter/models/resp_get_fast_bridge_info.py b/lighter/models/resp_get_fast_bridge_info.py index 8e38c73..a79c992 100644 --- a/lighter/models/resp_get_fast_bridge_info.py +++ b/lighter/models/resp_get_fast_bridge_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetFastBridgeInfo(BaseModel): """ @@ -33,7 +34,8 @@ class RespGetFastBridgeInfo(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "fast_bridge_limit"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "fast_bridge_limit": obj.get("fast_bridge_limit") diff --git a/lighter/models/resp_get_fastwithdrawal_info.py b/lighter/models/resp_get_fastwithdrawal_info.py index 38ece6c..d01dfe2 100644 --- a/lighter/models/resp_get_fastwithdrawal_info.py +++ b/lighter/models/resp_get_fastwithdrawal_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetFastwithdrawalInfo(BaseModel): """ @@ -35,7 +36,8 @@ class RespGetFastwithdrawalInfo(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "to_account_index", "withdraw_limit", "max_withdrawal_amount"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "to_account_index": obj.get("to_account_index"), diff --git a/lighter/models/resp_get_is_next_bridge_fast.py b/lighter/models/resp_get_is_next_bridge_fast.py index 8245973..e411d38 100644 --- a/lighter/models/resp_get_is_next_bridge_fast.py +++ b/lighter/models/resp_get_is_next_bridge_fast.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetIsNextBridgeFast(BaseModel): """ @@ -33,7 +34,8 @@ class RespGetIsNextBridgeFast(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "is_next_bridge_fast"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "is_next_bridge_fast": obj.get("is_next_bridge_fast") diff --git a/lighter/models/resp_get_lease_options.py b/lighter/models/resp_get_lease_options.py index cc153ca..6161698 100644 --- a/lighter/models/resp_get_lease_options.py +++ b/lighter/models/resp_get_lease_options.py @@ -17,25 +17,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from lighter.models.lease_option_entry import LeaseOptionEntry from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetLeaseOptions(BaseModel): """ RespGetLeaseOptions """ # noqa: E501 - code: StrictInt + code: Optional[StrictInt] = None message: Optional[StrictStr] = None - options: List[LeaseOptionEntry] - lit_incentives_account_index: StrictInt + options: Optional[List[LeaseOptionEntry]] = None + lit_incentives_account_index: Optional[StrictInt] = Field(default=None, description="Account index that receives the leasing fee") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message", "options", "lit_incentives_account_index"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in options (list) _items = [] if self.options: - for _item in self.options: - if _item: - _items.append(_item.to_dict()) + for _item_options in self.options: + if _item_options: + _items.append(_item_options.to_dict()) _dict['options'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "options": [LeaseOptionEntry.from_dict(_item) for _item in obj["options"]] if obj.get("options") is not None else None, diff --git a/lighter/models/resp_get_leases.py b/lighter/models/resp_get_leases.py index bfd03db..c890d8a 100644 --- a/lighter/models/resp_get_leases.py +++ b/lighter/models/resp_get_leases.py @@ -17,25 +17,27 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr from typing import Any, ClassVar, Dict, List, Optional from lighter.models.lease_entry import LeaseEntry from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetLeases(BaseModel): """ RespGetLeases """ # noqa: E501 - code: StrictInt + code: Optional[StrictInt] = None message: Optional[StrictStr] = None - leases: List[LeaseEntry] - next_cursor: Optional[StrictStr] = None + leases: Optional[List[LeaseEntry]] = None + next_cursor: Optional[StrictStr] = Field(default=None, description="Cursor to pass as the cursor param to fetch the next page. Absent if no more pages.") additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message", "leases", "next_cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in leases (list) _items = [] if self.leases: - for _item in self.leases: - if _item: - _items.append(_item.to_dict()) + for _item_leases in self.leases: + if _item_leases: + _items.append(_item_leases.to_dict()) _dict['leases'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "leases": [LeaseEntry.from_dict(_item) for _item in obj["leases"]] if obj.get("leases") is not None else None, diff --git a/lighter/models/resp_get_maker_only_api_keys.py b/lighter/models/resp_get_maker_only_api_keys.py index 189f906..433d599 100644 --- a/lighter/models/resp_get_maker_only_api_keys.py +++ b/lighter/models/resp_get_maker_only_api_keys.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetMakerOnlyApiKeys(BaseModel): """ @@ -33,7 +34,8 @@ class RespGetMakerOnlyApiKeys(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "api_key_indexes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -73,13 +74,6 @@ def to_dict(self) -> Dict[str, Any]: exclude=excluded_fields, exclude_none=True, ) - # override the default output from pydantic by calling `to_dict()` of each item in api_key_indexes (list) - _items = [] - if self.api_key_indexes: - for _item in self.api_key_indexes: - if _item: - _items.append(_item.to_dict()) - _dict['api_key_indexes'] = _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(): @@ -96,10 +90,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), - "api_key_indexes": obj.get("api_key_indexes"), + "api_key_indexes": obj.get("api_key_indexes") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/resp_get_push_notif_settings.py b/lighter/models/resp_get_push_notif_settings.py index c839303..c930623 100644 --- a/lighter/models/resp_get_push_notif_settings.py +++ b/lighter/models/resp_get_push_notif_settings.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespGetPushNotifSettings(BaseModel): """ @@ -34,7 +35,8 @@ class RespGetPushNotifSettings(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "account_index", "enabled"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "account_index": obj.get("account_index"), diff --git a/lighter/models/resp_post_api_token.py b/lighter/models/resp_post_api_token.py index b8b3ee2..520d808 100644 --- a/lighter/models/resp_post_api_token.py +++ b/lighter/models/resp_post_api_token.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespPostApiToken(BaseModel): """ @@ -40,7 +41,8 @@ class RespPostApiToken(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "token_id", "api_token", "name", "account_index", "expiry", "sub_account_access", "revoked", "scopes"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -96,7 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "token_id": obj.get("token_id"), diff --git a/lighter/models/resp_public_pools_metadata.py b/lighter/models/resp_public_pools_metadata.py index f3406e7..3ac423a 100644 --- a/lighter/models/resp_public_pools_metadata.py +++ b/lighter/models/resp_public_pools_metadata.py @@ -22,6 +22,7 @@ from lighter.models.public_pool_metadata import PublicPoolMetadata from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespPublicPoolsMetadata(BaseModel): """ @@ -34,7 +35,8 @@ class RespPublicPoolsMetadata(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "public_pools"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -77,9 +78,9 @@ def to_dict(self) -> Dict[str, Any]: # 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()) + for _item_public_pools in self.public_pools: + if _item_public_pools: + _items.append(_item_public_pools.to_dict()) _dict['public_pools'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _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 diff --git a/lighter/models/resp_revoke_api_token.py b/lighter/models/resp_revoke_api_token.py index 91359b4..ec3dc5d 100644 --- a/lighter/models/resp_revoke_api_token.py +++ b/lighter/models/resp_revoke_api_token.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespRevokeApiToken(BaseModel): """ @@ -34,7 +35,8 @@ class RespRevokeApiToken(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "token_id", "revoked"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "token_id": obj.get("token_id"), diff --git a/lighter/models/resp_send_tx.py b/lighter/models/resp_send_tx.py index 5bbdaa8..c6cd9ae 100644 --- a/lighter/models/resp_send_tx.py +++ b/lighter/models/resp_send_tx.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespSendTx(BaseModel): """ @@ -30,12 +31,13 @@ class RespSendTx(BaseModel): message: Optional[StrictStr] = None tx_hash: StrictStr predicted_execution_time_ms: StrictInt - volume_quota_remaining: StrictInt + volume_quota_remaining: Optional[StrictInt] = None additional_properties: Dict[str, Any] = {} __properties: ClassVar[List[str]] = ["code", "message", "tx_hash", "predicted_execution_time_ms", "volume_quota_remaining"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "tx_hash": obj.get("tx_hash"), diff --git a/lighter/models/resp_send_tx_batch.py b/lighter/models/resp_send_tx_batch.py index 0e408a2..99f6d68 100644 --- a/lighter/models/resp_send_tx_batch.py +++ b/lighter/models/resp_send_tx_batch.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespSendTxBatch(BaseModel): """ @@ -35,7 +36,8 @@ class RespSendTxBatch(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "tx_hash", "predicted_execution_time_ms", "volume_quota_remaining"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "tx_hash": obj.get("tx_hash"), diff --git a/lighter/models/resp_set_maker_only_api_keys.py b/lighter/models/resp_set_maker_only_api_keys.py index ab4a148..524af51 100644 --- a/lighter/models/resp_set_maker_only_api_keys.py +++ b/lighter/models/resp_set_maker_only_api_keys.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespSetMakerOnlyApiKeys(BaseModel): """ @@ -32,7 +33,8 @@ class RespSetMakerOnlyApiKeys(BaseModel): __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message") }) diff --git a/lighter/models/resp_withdrawal_delay.py b/lighter/models/resp_withdrawal_delay.py index dac6ebf..6eeca78 100644 --- a/lighter/models/resp_withdrawal_delay.py +++ b/lighter/models/resp_withdrawal_delay.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RespWithdrawalDelay(BaseModel): """ @@ -31,7 +32,8 @@ class RespWithdrawalDelay(BaseModel): __properties: ClassVar[List[str]] = ["seconds"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "seconds": obj.get("seconds") }) # store additional fields in additional_properties diff --git a/lighter/models/result_code.py b/lighter/models/result_code.py index 6e8eb96..6187168 100644 --- a/lighter/models/result_code.py +++ b/lighter/models/result_code.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ResultCode(BaseModel): """ @@ -32,7 +33,8 @@ class ResultCode(BaseModel): __properties: ClassVar[List[str]] = ["code", "message"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message") }) diff --git a/lighter/models/risk_info.py b/lighter/models/risk_info.py index d0a5d2b..69e84f7 100644 --- a/lighter/models/risk_info.py +++ b/lighter/models/risk_info.py @@ -22,6 +22,7 @@ from lighter.models.risk_parameters import RiskParameters from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RiskInfo(BaseModel): """ @@ -33,7 +34,8 @@ class RiskInfo(BaseModel): __properties: ClassVar[List[str]] = ["cross_risk_parameters", "isolated_risk_parameters"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in isolated_risk_parameters (list) _items = [] if self.isolated_risk_parameters: - for _item in self.isolated_risk_parameters: - if _item: - _items.append(_item.to_dict()) + for _item_isolated_risk_parameters in self.isolated_risk_parameters: + if _item_isolated_risk_parameters: + _items.append(_item_isolated_risk_parameters.to_dict()) _dict['isolated_risk_parameters'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -99,7 +100,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "cross_risk_parameters": RiskParameters.from_dict(obj["cross_risk_parameters"]) if obj.get("cross_risk_parameters") is not None else None, "isolated_risk_parameters": [RiskParameters.from_dict(_item) for _item in obj["isolated_risk_parameters"]] if obj.get("isolated_risk_parameters") is not None else None }) diff --git a/lighter/models/risk_parameters.py b/lighter/models/risk_parameters.py index 2d0463c..0480b76 100644 --- a/lighter/models/risk_parameters.py +++ b/lighter/models/risk_parameters.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class RiskParameters(BaseModel): """ @@ -36,7 +37,8 @@ class RiskParameters(BaseModel): __properties: ClassVar[List[str]] = ["market_id", "collateral", "total_account_value", "initial_margin_req", "maintenance_margin_req", "close_out_margin_req"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -92,7 +93,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "market_id": obj.get("market_id"), "collateral": obj.get("collateral"), "total_account_value": obj.get("total_account_value"), diff --git a/lighter/models/share_price.py b/lighter/models/share_price.py index 923acec..6e293df 100644 --- a/lighter/models/share_price.py +++ b/lighter/models/share_price.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SharePrice(BaseModel): """ @@ -32,7 +33,8 @@ class SharePrice(BaseModel): __properties: ClassVar[List[str]] = ["timestamp", "share_price"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "timestamp": obj.get("timestamp"), "share_price": obj.get("share_price") }) diff --git a/lighter/models/simple_order.py b/lighter/models/simple_order.py index b11a3a2..896b890 100644 --- a/lighter/models/simple_order.py +++ b/lighter/models/simple_order.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SimpleOrder(BaseModel): """ @@ -38,7 +39,8 @@ class SimpleOrder(BaseModel): __properties: ClassVar[List[str]] = ["order_index", "order_id", "owner_account_index", "initial_base_amount", "remaining_base_amount", "price", "order_expiry", "transaction_time"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "order_index": obj.get("order_index"), "order_id": obj.get("order_id"), "owner_account_index": obj.get("owner_account_index"), diff --git a/lighter/models/slippage_result.py b/lighter/models/slippage_result.py index 3840821..a798c72 100644 --- a/lighter/models/slippage_result.py +++ b/lighter/models/slippage_result.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SlippageResult(BaseModel): """ @@ -35,7 +36,8 @@ class SlippageResult(BaseModel): __properties: ClassVar[List[str]] = ["exchange", "market", "size_usd", "avg_slippage", "data_count"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -91,7 +92,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "exchange": obj.get("exchange"), "market": obj.get("market"), "size_usd": obj.get("size_usd"), diff --git a/lighter/models/spot_avg_entry_price.py b/lighter/models/spot_avg_entry_price.py index 3139afd..a4288b7 100644 --- a/lighter/models/spot_avg_entry_price.py +++ b/lighter/models/spot_avg_entry_price.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SpotAvgEntryPrice(BaseModel): """ @@ -34,7 +35,8 @@ class SpotAvgEntryPrice(BaseModel): __properties: ClassVar[List[str]] = ["asset_id", "avg_entry_price", "asset_size", "last_trade_id"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -90,7 +91,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "asset_id": obj.get("asset_id"), "avg_entry_price": obj.get("avg_entry_price"), "asset_size": obj.get("asset_size"), diff --git a/lighter/models/spot_market_stats.py b/lighter/models/spot_market_stats.py index 60e7945..7c251c4 100644 --- a/lighter/models/spot_market_stats.py +++ b/lighter/models/spot_market_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SpotMarketStats(BaseModel): """ @@ -40,7 +41,8 @@ class SpotMarketStats(BaseModel): __properties: ClassVar[List[str]] = ["symbol", "market_id", "index_price", "mid_price", "last_trade_price", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -52,8 +54,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -96,7 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "market_id": obj.get("market_id"), "index_price": obj.get("index_price"), diff --git a/lighter/models/spot_order_book_detail.py b/lighter/models/spot_order_book_detail.py index b606737..dd854ce 100644 --- a/lighter/models/spot_order_book_detail.py +++ b/lighter/models/spot_order_book_detail.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List, Union +from pydantic import BaseModel, ConfigDict, StrictBool, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional, Union from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SpotOrderBookDetail(BaseModel): """ @@ -51,8 +52,10 @@ class SpotOrderBookDetail(BaseModel): daily_price_high: Union[StrictFloat, StrictInt] daily_price_change: Union[StrictFloat, StrictInt] daily_chart: Dict[str, Union[StrictFloat, StrictInt]] + is_maker_fee_enabled: Optional[StrictBool] = None + is_taker_fee_enabled: Optional[StrictBool] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "order_quote_limit", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "size_decimals", "price_decimals", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "daily_chart"] + __properties: ClassVar[List[str]] = ["symbol", "market_id", "market_type", "base_asset_id", "quote_asset_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "order_quote_limit", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals", "size_decimals", "price_decimals", "last_trade_price", "daily_trades_count", "daily_base_token_volume", "daily_quote_token_volume", "daily_price_low", "daily_price_high", "daily_price_change", "daily_chart", "is_maker_fee_enabled", "is_taker_fee_enabled"] @field_validator('market_type') def market_type_validate_enum(cls, value): @@ -69,7 +72,8 @@ def status_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -81,8 +85,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -125,7 +128,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "symbol": obj.get("symbol"), "market_id": obj.get("market_id"), "market_type": obj.get("market_type"), @@ -150,7 +153,9 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "daily_price_low": obj.get("daily_price_low"), "daily_price_high": obj.get("daily_price_high"), "daily_price_change": obj.get("daily_price_change"), - "daily_chart": obj.get("daily_chart") + "daily_chart": obj.get("daily_chart"), + "is_maker_fee_enabled": obj.get("is_maker_fee_enabled"), + "is_taker_fee_enabled": obj.get("is_taker_fee_enabled") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/status.py b/lighter/models/status.py index 5c85974..310e8ee 100644 --- a/lighter/models/status.py +++ b/lighter/models/status.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Status(BaseModel): """ @@ -33,7 +34,8 @@ class Status(BaseModel): __properties: ClassVar[List[str]] = ["status", "network_id", "timestamp"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "status": obj.get("status"), "network_id": obj.get("network_id"), "timestamp": obj.get("timestamp") diff --git a/lighter/models/strategy.py b/lighter/models/strategy.py index 914cbfc..8170f61 100644 --- a/lighter/models/strategy.py +++ b/lighter/models/strategy.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Strategy(BaseModel): """ @@ -31,7 +32,8 @@ class Strategy(BaseModel): __properties: ClassVar[List[str]] = ["collateral"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "collateral": obj.get("collateral") }) # store additional fields in additional_properties diff --git a/lighter/models/sub_accounts.py b/lighter/models/sub_accounts.py index b64b77c..820c032 100644 --- a/lighter/models/sub_accounts.py +++ b/lighter/models/sub_accounts.py @@ -22,6 +22,7 @@ from lighter.models.account import Account from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SubAccounts(BaseModel): """ @@ -31,12 +32,12 @@ class SubAccounts(BaseModel): message: Optional[StrictStr] = None l1_address: StrictStr sub_accounts: List[Account] - next_cursor: Optional[StrictStr] = None additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "l1_address", "sub_accounts", "next_cursor"] + __properties: ClassVar[List[str]] = ["code", "message", "l1_address", "sub_accounts"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -48,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -79,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in sub_accounts (list) _items = [] if self.sub_accounts: - for _item in self.sub_accounts: - if _item: - _items.append(_item.to_dict()) + for _item_sub_accounts in self.sub_accounts: + if _item_sub_accounts: + _items.append(_item_sub_accounts.to_dict()) _dict['sub_accounts'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -99,12 +99,11 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "l1_address": obj.get("l1_address"), - "sub_accounts": [Account.from_dict(_item) for _item in obj["sub_accounts"]] if obj.get("sub_accounts") is not None else None, - "next_cursor": obj.get("next_cursor") + "sub_accounts": [Account.from_dict(_item) for _item in obj["sub_accounts"]] if obj.get("sub_accounts") is not None else None }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/system_config.py b/lighter/models/system_config.py index 61a814b..052f22d 100644 --- a/lighter/models/system_config.py +++ b/lighter/models/system_config.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class SystemConfig(BaseModel): """ @@ -33,15 +34,16 @@ class SystemConfig(BaseModel): funding_fee_rebate_account_index: StrictInt liquidity_pool_cooldown_period: StrictInt staking_pool_lockup_period: StrictInt - max_integrator_spot_taker_fee: StrictInt - max_integrator_spot_maker_fee: StrictInt - max_integrator_perps_taker_fee: StrictInt max_integrator_perps_maker_fee: StrictInt + max_integrator_perps_taker_fee: StrictInt + max_integrator_spot_maker_fee: StrictInt + max_integrator_spot_taker_fee: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "liquidity_pool_index", "staking_pool_index", "funding_fee_rebate_account_index", "liquidity_pool_cooldown_period", "staking_pool_lockup_period", "max_integrator_spot_taker_fee", "max_integrator_spot_maker_fee", "max_integrator_perps_taker_fee", "max_integrator_perps_maker_fee"] + __properties: ClassVar[List[str]] = ["code", "message", "liquidity_pool_index", "staking_pool_index", "funding_fee_rebate_account_index", "liquidity_pool_cooldown_period", "staking_pool_lockup_period", "max_integrator_perps_maker_fee", "max_integrator_perps_taker_fee", "max_integrator_spot_maker_fee", "max_integrator_spot_taker_fee"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -53,8 +55,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -97,7 +98,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "liquidity_pool_index": obj.get("liquidity_pool_index"), @@ -105,10 +106,10 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "funding_fee_rebate_account_index": obj.get("funding_fee_rebate_account_index"), "liquidity_pool_cooldown_period": obj.get("liquidity_pool_cooldown_period"), "staking_pool_lockup_period": obj.get("staking_pool_lockup_period"), - "max_integrator_spot_taker_fee": obj.get("max_integrator_spot_taker_fee"), - "max_integrator_spot_maker_fee": obj.get("max_integrator_spot_maker_fee"), + "max_integrator_perps_maker_fee": obj.get("max_integrator_perps_maker_fee"), "max_integrator_perps_taker_fee": obj.get("max_integrator_perps_taker_fee"), - "max_integrator_perps_maker_fee": obj.get("max_integrator_perps_maker_fee") + "max_integrator_spot_maker_fee": obj.get("max_integrator_spot_maker_fee"), + "max_integrator_spot_taker_fee": obj.get("max_integrator_spot_taker_fee") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/ticker.py b/lighter/models/ticker.py index 7c262c2..0e8701c 100644 --- a/lighter/models/ticker.py +++ b/lighter/models/ticker.py @@ -22,6 +22,7 @@ from lighter.models.price_level import PriceLevel from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Ticker(BaseModel): """ @@ -34,7 +35,8 @@ class Ticker(BaseModel): __properties: ClassVar[List[str]] = ["s", "a", "b"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -46,8 +48,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -96,7 +97,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "s": obj.get("s"), "a": PriceLevel.from_dict(obj["a"]) if obj.get("a") is not None else None, "b": PriceLevel.from_dict(obj["b"]) if obj.get("b") is not None else None diff --git a/lighter/models/trade.py b/lighter/models/trade.py index b9000c5..614087a 100644 --- a/lighter/models/trade.py +++ b/lighter/models/trade.py @@ -17,10 +17,11 @@ import re # noqa: F401 import json -from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator -from typing import Any, ClassVar, Dict, List +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Trade(BaseModel): """ @@ -35,28 +36,37 @@ class Trade(BaseModel): usd_amount: StrictStr ask_id: StrictInt bid_id: StrictInt - ask_client_id: StrictInt - bid_client_id: StrictInt ask_account_id: StrictInt bid_account_id: StrictInt is_maker_ask: StrictBool block_height: StrictInt timestamp: StrictInt - taker_fee: StrictInt + taker_fee: Optional[StrictInt] = None taker_position_size_before: StrictStr taker_entry_quote_before: StrictStr taker_initial_margin_fraction_before: StrictInt taker_position_sign_changed: StrictBool - maker_fee: StrictInt + maker_fee: Optional[StrictInt] = None maker_position_size_before: StrictStr maker_entry_quote_before: StrictStr maker_initial_margin_fraction_before: StrictInt maker_position_sign_changed: StrictBool transaction_time: StrictInt - ask_account_pnl: StrictStr - bid_account_pnl: StrictStr + bid_account_pnl: StrictStr = Field(description="Realized PnL for the queried account index, triggered by reducing a short position") + ask_account_pnl: StrictStr = Field(description="Realized PnL for the queried account index, triggered by reducing a long position, or a spot position") + ask_client_id: StrictInt + bid_client_id: StrictInt + ask_client_id_str: StrictStr + bid_client_id_str: StrictStr + ask_id_str: Optional[StrictStr] = None + bid_id_str: Optional[StrictStr] = None + trade_id_str: StrictStr + integrator_maker_fee: StrictInt + integrator_maker_fee_collector_index: StrictInt + integrator_taker_fee: StrictInt + integrator_taker_fee_collector_index: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["trade_id", "tx_hash", "type", "market_id", "size", "price", "usd_amount", "ask_id", "bid_id", "ask_client_id", "bid_client_id", "ask_account_id", "bid_account_id", "is_maker_ask", "block_height", "timestamp", "taker_fee", "taker_position_size_before", "taker_entry_quote_before", "taker_initial_margin_fraction_before", "taker_position_sign_changed", "maker_fee", "maker_position_size_before", "maker_entry_quote_before", "maker_initial_margin_fraction_before", "maker_position_sign_changed", "transaction_time", "ask_account_pnl", "bid_account_pnl"] + __properties: ClassVar[List[str]] = ["trade_id", "tx_hash", "type", "market_id", "size", "price", "usd_amount", "ask_id", "bid_id", "ask_account_id", "bid_account_id", "is_maker_ask", "block_height", "timestamp", "taker_fee", "taker_position_size_before", "taker_entry_quote_before", "taker_initial_margin_fraction_before", "taker_position_sign_changed", "maker_fee", "maker_position_size_before", "maker_entry_quote_before", "maker_initial_margin_fraction_before", "maker_position_sign_changed", "transaction_time", "bid_account_pnl", "ask_account_pnl", "ask_client_id", "bid_client_id", "ask_client_id_str", "bid_client_id_str", "ask_id_str", "bid_id_str", "trade_id_str", "integrator_maker_fee", "integrator_maker_fee_collector_index", "integrator_taker_fee", "integrator_taker_fee_collector_index"] @field_validator('type') def type_validate_enum(cls, value): @@ -66,7 +76,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -78,8 +89,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -122,7 +132,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "trade_id": obj.get("trade_id"), "tx_hash": obj.get("tx_hash"), "type": obj.get("type"), @@ -132,8 +142,6 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "usd_amount": obj.get("usd_amount"), "ask_id": obj.get("ask_id"), "bid_id": obj.get("bid_id"), - "ask_client_id": obj.get("ask_client_id"), - "bid_client_id": obj.get("bid_client_id"), "ask_account_id": obj.get("ask_account_id"), "bid_account_id": obj.get("bid_account_id"), "is_maker_ask": obj.get("is_maker_ask"), @@ -150,8 +158,19 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: "maker_initial_margin_fraction_before": obj.get("maker_initial_margin_fraction_before"), "maker_position_sign_changed": obj.get("maker_position_sign_changed"), "transaction_time": obj.get("transaction_time"), + "bid_account_pnl": obj.get("bid_account_pnl"), "ask_account_pnl": obj.get("ask_account_pnl"), - "bid_account_pnl": obj.get("bid_account_pnl") + "ask_client_id": obj.get("ask_client_id"), + "bid_client_id": obj.get("bid_client_id"), + "ask_client_id_str": obj.get("ask_client_id_str"), + "bid_client_id_str": obj.get("bid_client_id_str"), + "ask_id_str": obj.get("ask_id_str"), + "bid_id_str": obj.get("bid_id_str"), + "trade_id_str": obj.get("trade_id_str"), + "integrator_maker_fee": obj.get("integrator_maker_fee"), + "integrator_maker_fee_collector_index": obj.get("integrator_maker_fee_collector_index"), + "integrator_taker_fee": obj.get("integrator_taker_fee"), + "integrator_taker_fee_collector_index": obj.get("integrator_taker_fee_collector_index") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/trade_stats.py b/lighter/models/trade_stats.py index 28e48ef..73f5ca9 100644 --- a/lighter/models/trade_stats.py +++ b/lighter/models/trade_stats.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TradeStats(BaseModel): """ @@ -38,7 +39,8 @@ class TradeStats(BaseModel): __properties: ClassVar[List[str]] = ["count", "volume", "web_count", "web_volume", "mobile_app_count", "mobile_app_volume", "mobile_browser_count", "mobile_browser_volume"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -50,8 +52,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -94,7 +95,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "count": obj.get("count"), "volume": obj.get("volume"), "web_count": obj.get("web_count"), diff --git a/lighter/models/trades.py b/lighter/models/trades.py index 9d1bd0e..64d045a 100644 --- a/lighter/models/trades.py +++ b/lighter/models/trades.py @@ -22,6 +22,7 @@ from lighter.models.trade import Trade from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class Trades(BaseModel): """ @@ -35,7 +36,8 @@ class Trades(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "trades"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in trades (list) _items = [] if self.trades: - for _item in self.trades: - if _item: - _items.append(_item.to_dict()) + for _item_trades in self.trades: + if _item_trades: + _items.append(_item_trades.to_dict()) _dict['trades'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "next_cursor": obj.get("next_cursor"), diff --git a/lighter/models/transfer_fee_info.py b/lighter/models/transfer_fee_info.py index 27d8ab8..6bf7dac 100644 --- a/lighter/models/transfer_fee_info.py +++ b/lighter/models/transfer_fee_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferFeeInfo(BaseModel): """ @@ -33,7 +34,8 @@ class TransferFeeInfo(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "transfer_fee_usdc"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "transfer_fee_usdc": obj.get("transfer_fee_usdc") diff --git a/lighter/models/transfer_history.py b/lighter/models/transfer_history.py index 3f5d1b7..761b7a6 100644 --- a/lighter/models/transfer_history.py +++ b/lighter/models/transfer_history.py @@ -22,6 +22,7 @@ from lighter.models.transfer_history_item import TransferHistoryItem from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferHistory(BaseModel): """ @@ -35,7 +36,8 @@ class TransferHistory(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "transfers", "cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in transfers (list) _items = [] if self.transfers: - for _item in self.transfers: - if _item: - _items.append(_item.to_dict()) + for _item_transfers in self.transfers: + if _item_transfers: + _items.append(_item_transfers.to_dict()) _dict['transfers'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "transfers": [TransferHistoryItem.from_dict(_item) for _item in obj["transfers"]] if obj.get("transfers") is not None else None, diff --git a/lighter/models/transfer_history_item.py b/lighter/models/transfer_history_item.py index 0f5aa82..bb3bbfa 100644 --- a/lighter/models/transfer_history_item.py +++ b/lighter/models/transfer_history_item.py @@ -21,26 +21,27 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TransferHistoryItem(BaseModel): """ TransferHistoryItem """ # noqa: E501 id: StrictStr - asset_id: StrictInt amount: StrictStr - fee: StrictStr timestamp: StrictInt type: StrictStr from_l1_address: StrictStr to_l1_address: StrictStr from_account_index: StrictInt to_account_index: StrictInt + tx_hash: StrictStr + asset_id: StrictInt + fee: StrictStr from_route: StrictStr to_route: StrictStr - tx_hash: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "asset_id", "amount", "fee", "timestamp", "type", "from_l1_address", "to_l1_address", "from_account_index", "to_account_index", "from_route", "to_route", "tx_hash"] + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "type", "from_l1_address", "to_l1_address", "from_account_index", "to_account_index", "tx_hash", "asset_id", "fee", "from_route", "to_route"] @field_validator('type') def type_validate_enum(cls, value): @@ -64,7 +65,8 @@ def to_route_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -76,8 +78,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -120,20 +121,20 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), - "asset_id": obj.get("asset_id"), "amount": obj.get("amount"), - "fee": obj.get("fee"), "timestamp": obj.get("timestamp"), "type": obj.get("type"), "from_l1_address": obj.get("from_l1_address"), "to_l1_address": obj.get("to_l1_address"), "from_account_index": obj.get("from_account_index"), "to_account_index": obj.get("to_account_index"), + "tx_hash": obj.get("tx_hash"), + "asset_id": obj.get("asset_id"), + "fee": obj.get("fee"), "from_route": obj.get("from_route"), - "to_route": obj.get("to_route"), - "tx_hash": obj.get("tx_hash") + "to_route": obj.get("to_route") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/tx_hash.py b/lighter/models/tx_hash.py index 06cfc5e..308369b 100644 --- a/lighter/models/tx_hash.py +++ b/lighter/models/tx_hash.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TxHash(BaseModel): """ @@ -33,7 +34,8 @@ class TxHash(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "tx_hash"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "tx_hash": obj.get("tx_hash") diff --git a/lighter/models/tx_hashes.py b/lighter/models/tx_hashes.py index a313f12..a21b32a 100644 --- a/lighter/models/tx_hashes.py +++ b/lighter/models/tx_hashes.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List, Optional from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class TxHashes(BaseModel): """ @@ -33,7 +34,8 @@ class TxHashes(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "tx_hash"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -45,8 +47,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -89,7 +90,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "tx_hash": obj.get("tx_hash") diff --git a/lighter/models/user_referrals.py b/lighter/models/user_referrals.py index b1b113c..06c1697 100644 --- a/lighter/models/user_referrals.py +++ b/lighter/models/user_referrals.py @@ -22,6 +22,7 @@ from lighter.models.referral import Referral from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class UserReferrals(BaseModel): """ @@ -31,11 +32,13 @@ class UserReferrals(BaseModel): message: Optional[StrictStr] = None cursor: StrictStr referrals: List[Referral] + used_code: StrictStr additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["code", "message", "cursor", "referrals"] + __properties: ClassVar[List[str]] = ["code", "message", "cursor", "referrals", "used_code"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +50,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +80,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in referrals (list) _items = [] if self.referrals: - for _item in self.referrals: - if _item: - _items.append(_item.to_dict()) + for _item_referrals in self.referrals: + if _item_referrals: + _items.append(_item_referrals.to_dict()) _dict['referrals'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,11 +100,12 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "cursor": obj.get("cursor"), - "referrals": [Referral.from_dict(_item) for _item in obj["referrals"]] if obj.get("referrals") is not None else None + "referrals": [Referral.from_dict(_item) for _item in obj["referrals"]] if obj.get("referrals") is not None else None, + "used_code": obj.get("used_code") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/validator_info.py b/lighter/models/validator_info.py index 7af526e..f5ea84a 100644 --- a/lighter/models/validator_info.py +++ b/lighter/models/validator_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ValidatorInfo(BaseModel): """ @@ -32,7 +33,8 @@ class ValidatorInfo(BaseModel): __properties: ClassVar[List[str]] = ["address", "is_active"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -44,8 +46,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -88,7 +89,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "address": obj.get("address"), "is_active": obj.get("is_active") }) diff --git a/lighter/models/withdraw_history.py b/lighter/models/withdraw_history.py index a25230c..cac52e1 100644 --- a/lighter/models/withdraw_history.py +++ b/lighter/models/withdraw_history.py @@ -22,6 +22,7 @@ from lighter.models.withdraw_history_item import WithdrawHistoryItem from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WithdrawHistory(BaseModel): """ @@ -35,7 +36,8 @@ class WithdrawHistory(BaseModel): __properties: ClassVar[List[str]] = ["code", "message", "withdraws", "cursor"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -47,8 +49,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -78,9 +79,9 @@ def to_dict(self) -> Dict[str, Any]: # override the default output from pydantic by calling `to_dict()` of each item in withdraws (list) _items = [] if self.withdraws: - for _item in self.withdraws: - if _item: - _items.append(_item.to_dict()) + for _item_withdraws in self.withdraws: + if _item_withdraws: + _items.append(_item_withdraws.to_dict()) _dict['withdraws'] = _items # puts key-value pairs in additional_properties in the top level if self.additional_properties is not None: @@ -98,7 +99,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "code": obj.get("code"), "message": obj.get("message"), "withdraws": [WithdrawHistoryItem.from_dict(_item) for _item in obj["withdraws"]] if obj.get("withdraws") is not None else None, diff --git a/lighter/models/withdraw_history_item.py b/lighter/models/withdraw_history_item.py index 9812939..cc60319 100644 --- a/lighter/models/withdraw_history_item.py +++ b/lighter/models/withdraw_history_item.py @@ -21,20 +21,21 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class WithdrawHistoryItem(BaseModel): """ WithdrawHistoryItem """ # noqa: E501 id: StrictStr - asset_id: StrictInt amount: StrictStr timestamp: StrictInt status: StrictStr type: StrictStr l1_tx_hash: StrictStr + asset_id: StrictInt additional_properties: Dict[str, Any] = {} - __properties: ClassVar[List[str]] = ["id", "asset_id", "amount", "timestamp", "status", "type", "l1_tx_hash"] + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "status", "type", "l1_tx_hash", "asset_id"] @field_validator('status') def status_validate_enum(cls, value): @@ -51,7 +52,8 @@ def type_validate_enum(cls, value): return value model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -63,8 +65,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -107,14 +108,14 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "id": obj.get("id"), - "asset_id": obj.get("asset_id"), "amount": obj.get("amount"), "timestamp": obj.get("timestamp"), "status": obj.get("status"), "type": obj.get("type"), - "l1_tx_hash": obj.get("l1_tx_hash") + "l1_tx_hash": obj.get("l1_tx_hash"), + "asset_id": obj.get("asset_id") }) # store additional fields in additional_properties for _key in obj.keys(): diff --git a/lighter/models/zk_lighter_info.py b/lighter/models/zk_lighter_info.py index e3bbace..423108b 100644 --- a/lighter/models/zk_lighter_info.py +++ b/lighter/models/zk_lighter_info.py @@ -21,6 +21,7 @@ from typing import Any, ClassVar, Dict, List from typing import Optional, Set from typing_extensions import Self +from pydantic_core import to_jsonable_python class ZkLighterInfo(BaseModel): """ @@ -31,7 +32,8 @@ class ZkLighterInfo(BaseModel): __properties: ClassVar[List[str]] = ["contract_address"] model_config = ConfigDict( - populate_by_name=True, + validate_by_name=True, + validate_by_alias=True, validate_assignment=True, protected_namespaces=(), ) @@ -43,8 +45,7 @@ def to_str(self) -> str: 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()) + return json.dumps(to_jsonable_python(self.to_dict())) @classmethod def from_json(cls, json_str: str) -> Optional[Self]: @@ -87,7 +88,7 @@ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: if not isinstance(obj, dict): return cls.model_validate(obj) - _obj = cls.model_construct(**{ + _obj = cls.model_validate({ "contract_address": obj.get("contract_address") }) # store additional fields in additional_properties diff --git a/lighter/rest.py b/lighter/rest.py index e996812..bc008f0 100644 --- a/lighter/rest.py +++ b/lighter/rest.py @@ -40,12 +40,17 @@ async def read(self): self.data = await self.response.read() return self.data + @property + def headers(self): + """Returns a CIMultiDictProxy of response headers.""" + return self.response.headers + def getheaders(self): - """Returns a CIMultiDictProxy of the response headers.""" + """Returns a CIMultiDictProxy of the response headers; use ``headers`` instead.""" return self.response.headers def getheader(self, name, default=None): - """Returns a given response header.""" + """Returns a given response header; use ``headers.get()`` instead.""" return self.response.headers.get(name, default) @@ -54,51 +59,45 @@ class RESTClientObject: def __init__(self, configuration) -> None: # maxsize is number of requests to host that are allowed in parallel - maxsize = configuration.connection_pool_maxsize + self.maxsize = configuration.connection_pool_maxsize - ssl_context = ssl.create_default_context( - cafile=configuration.ssl_ca_cert + self.ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert, + cadata=configuration.ca_cert_data, ) if configuration.cert_file: - ssl_context.load_cert_chain( + self.ssl_context.load_cert_chain( configuration.cert_file, keyfile=configuration.key_file ) if not configuration.verify_ssl: - ssl_context.check_hostname = False - ssl_context.verify_mode = ssl.CERT_NONE - - connector = aiohttp.TCPConnector( - limit=maxsize, - ssl=ssl_context - ) + self.ssl_context.check_hostname = False + self.ssl_context.verify_mode = ssl.CERT_NONE self.proxy = configuration.proxy self.proxy_headers = configuration.proxy_headers - # https pool manager - self.pool_manager = aiohttp.ClientSession( - connector=connector, - trust_env=True - ) - retries = configuration.retries - self.retry_client: Optional[aiohttp_retry.RetryClient] - if retries is not None: - self.retry_client = aiohttp_retry.RetryClient( - client_session=self.pool_manager, - retry_options=aiohttp_retry.ExponentialRetry( - attempts=retries, - factor=0.0, - start_timeout=0.0, - max_timeout=120.0 - ) + if retries is None: + self._effective_retry_options = None + elif isinstance(retries, aiohttp_retry.RetryOptionsBase): + self._effective_retry_options = retries + elif isinstance(retries, int): + self._effective_retry_options = aiohttp_retry.ExponentialRetry( + attempts=retries, + factor=2.0, + start_timeout=0.1, + max_timeout=120.0 ) else: - self.retry_client = None + self._effective_retry_options = None - async def close(self): - await self.pool_manager.close() + self.pool_manager: Optional[aiohttp.ClientSession] = None + self.retry_client: Optional[aiohttp_retry.RetryClient] = None + + async def close(self) -> None: + if self.pool_manager: + await self.pool_manager.close() if self.retry_client is not None: await self.retry_client.close() @@ -184,6 +183,11 @@ async def request( content_type=v[2] ) else: + # Ensures that dict objects are serialized + if isinstance(v, dict): + v = json.dumps(v) + elif isinstance(v, int): + v = str(v) data.add_field(k, v) args["data"] = data @@ -200,16 +204,23 @@ async def request( raise ApiException(status=0, reason=msg) pool_manager: Union[aiohttp.ClientSession, aiohttp_retry.RetryClient] - if self.retry_client is not None and method in ALLOW_RETRY_METHODS: + + # https pool manager + if self.pool_manager is None: + self.pool_manager = aiohttp.ClientSession( + connector=aiohttp.TCPConnector(limit=self.maxsize, ssl=self.ssl_context), + trust_env=True, + ) + pool_manager = self.pool_manager + + if self._effective_retry_options is not None and method in ALLOW_RETRY_METHODS: + if self.retry_client is None: + self.retry_client = aiohttp_retry.RetryClient( + client_session=self.pool_manager, + retry_options=self._effective_retry_options + ) pool_manager = self.retry_client - else: - pool_manager = self.pool_manager r = await pool_manager.request(**args) return RESTResponse(r) - - - - - diff --git a/openapi.json b/openapi.json index 5c56e0d..09cbe01 100644 --- a/openapi.json +++ b/openapi.json @@ -1,9670 +1,11655 @@ { - "swagger": "2.0", + "openapi": "3.0.0", "info": { "title": "", "version": "" }, - "host": "mainnet.zklighter.elliot.ai", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], "paths": { "/": { "get": { "summary": "status", "operationId": "status", + "tags": [ + "root" + ], + "description": "Get status of zklighter", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Status" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Status" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "root" - ], - "description": "Get status of zklighter" + } } }, "/api/v1/account": { "get": { "summary": "account", "operationId": "account", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/DetailedAccounts" - } - }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, + "tags": [ + "account" + ], + "description": "Get account by an account's index, or L1 address", "parameters": [ { "name": "by", "in": "query", "required": true, - "type": "string", - "enum": [ - "index", - "l1_address" - ] + "schema": { + "type": "string", + "enum": [ + "index", + "l1_address" + ] + } }, { "name": "value", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "string" + } + }, + { + "name": "active_only", + "in": "query", + "required": false, + "description": "Hide markets for which leverage and margin settings are present (meaning the account traded it at least once), but with no active position.", + "schema": { + "type": "boolean", + "default": false + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "string" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "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" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DetailedAccounts" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountActiveOrders": { + "get": { + "summary": "accountActiveOrders", + "operationId": "accountActiveOrders", + "tags": [ + "order" + ], + "description": "Get account active orders. `auth` can be generated using the SDK.", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" + "in": "header", + "required": true, + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + } }, { "name": "market_id", "in": "query", - "required": true, - "type": "integer", - "format": "int16" + "required": false, + "description": "If not specified, returns active orders for all markets.", + "schema": { + "type": "integer", + "format": "int16" + } + }, + { + "name": "market_type", + "in": "query", + "required": false, + "schema": { + "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", - "operationId": "accountInactiveOrders", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Orders" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Orders" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountInactiveOrders": { + "get": { + "summary": "accountInactiveOrders", + "operationId": "accountInactiveOrders", + "tags": [ + "order" + ], + "description": "Get account inactive orders. `auth` can be generated using the SDK.", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" + "in": "header", + "required": true, + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + } }, { "name": "market_id", "in": "query", "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { "name": "ask_filter", "in": "query", "required": false, - "type": "integer", - "format": "int8", - "default": "-1" + "schema": { + "type": "integer", + "format": "int8", + "default": "-1" + } }, { "name": "between_timestamps", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { "name": "cursor", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "market_type", + "in": "query", + "required": false, + "schema": { + "type": "string" + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get account inactive orders" - } - }, - "/api/v1/accountLimits": { - "get": { - "summary": "accountLimits", - "operationId": "accountLimits", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/AccountLimits" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Orders" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountLimits": { + "get": { + "summary": "accountLimits", + "operationId": "accountLimits", + "tags": [ + "account" + ], + "description": "Get account limits. For more details on account types, see this page: https://apidocs.lighter.xyz/docs/account-types", "parameters": [ { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + } }, { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" + "in": "header", + "required": true, + "schema": { + "type": "string" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get account limits" - } - }, - "/api/v1/accountMetadata": { - "get": { - "summary": "accountMetadata", - "operationId": "accountMetadata", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/AccountMetadatas" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountLimits" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountMetadata": { + "get": { + "summary": "accountMetadata", + "operationId": "accountMetadata", + "tags": [ + "account" + ], + "description": "Get account metadatas", "parameters": [ { "name": "authorization", "in": "header", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { "name": "by", "in": "query", "required": true, - "type": "string", - "enum": [ - "index", - "l1_address" - ] + "schema": { + "type": "string", + "enum": [ + "index", + "l1_address" + ] + } }, { "name": "value", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "string" + } }, { - "name": "auth", + "name": "cursor", "in": "query", "required": false, - "type": "string" - } - ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" + "schema": { + "type": "string" + } + } ], - "description": "Get account metadatas" - } - }, - "/api/v1/accountsByL1Address": { - "get": { - "summary": "accountsByL1Address", - "operationId": "accountsByL1Address", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/SubAccounts" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountMetadatas" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountTxs": { + "get": { + "summary": "accountTxs", + "operationId": "accountTxs", + "tags": [ + "transaction" + ], + "description": "Get transactions of a specific account", "parameters": [ { - "name": "l1_address", + "name": "index", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "limit", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "by", + "in": "query", + "required": true, + "schema": { + "type": "string", + "enum": [ + "account_index" + ] + } + }, + { + "name": "value", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", + "schema": { + "type": "string" + } + }, + { + "name": "auth", + "in": "query", + "required": false, + "description": " made optional to support header auth clients", + "schema": { + "type": "string" + } + }, + { + "name": "types", + "in": "query", + "required": false, + "schema": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + } + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get accounts by l1_address returns all accounts associated with the given L1 address" - } - }, - "/api/v1/announcement": { - "get": { - "summary": "announcement", - "operationId": "announcement", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Announcements" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Txs" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "announcement" - ], - "description": "Get announcement" + } } }, - "/api/v1/apikeys": { + "/api/v1/assetDetails": { "get": { - "summary": "apikeys", - "operationId": "apikeys", + "summary": "assetDetails", + "operationId": "assetDetails", + "tags": [ + "order" + ], + "description": "Get asset details for a specific asset or all assets", + "parameters": [ + { + "name": "asset_id", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int16", + "default": "0" + } + } + ], "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/AccountApiKeys" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AssetDetails" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/accountsByL1Address": { + "get": { + "summary": "accountsByL1Address", + "operationId": "accountsByL1Address", + "tags": [ + "account" + ], + "description": "Returns all accounts associated with the given L1 address", "parameters": [ { - "name": "account_index", + "name": "l1_address", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "string" + } }, { - "name": "api_key_index", + "name": "cursor", "in": "query", "required": false, - "type": "integer", - "format": "uint8", - "default": "255" + "schema": { + "type": "string" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account." - } - }, - "/api/v1/assetDetails": { - "get": { - "summary": "assetDetails", - "operationId": "assetDetails", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/AssetDetails" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SubAccounts" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "parameters": [ - { - "name": "asset_id", - "in": "query", - "required": false, - "type": "integer", - "format": "int16", - "default": "0" - } - ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get asset details" + } } }, - "/api/v1/bridges": { + "/api/v1/announcement": { "get": { - "summary": "bridges", - "operationId": "bridges", + "summary": "announcement", + "operationId": "announcement", + "tags": [ + "announcement" + ], + "description": "Get announcements", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetBridgesByL1Addr" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Announcements" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/apikeys": { + "get": { + "summary": "apikeys", + "operationId": "apikeys", + "tags": [ + "account" + ], + "description": "Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account.", "parameters": [ { - "name": "l1_address", + "name": "account_index", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "api_key_index", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "uint8", + "default": "255" + } } ], - "tags": [ - "bridge" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get bridges for given l1 address" - } - }, - "/api/v1/bridges/isNextBridgeFast": { - "get": { - "summary": "bridges_isNextBridgeFast", - "operationId": "bridges_isNextBridgeFast", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetIsNextBridgeFast" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountApiKeys" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/block": { + "get": { + "summary": "block", + "operationId": "block", + "tags": [ + "block" + ], + "description": "Get block by its height or commitment", "parameters": [ { - "name": "l1_address", + "name": "by", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "commitment", + "height" + ] + } + }, + { + "name": "value", + "in": "query", + "required": true, + "schema": { + "type": "string" + } } ], - "tags": [ - "bridge" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get if next bridge is fast" - } - }, - "/api/v1/candles": { - "get": { - "summary": "candles", - "operationId": "candles", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Candles" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Blocks" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/blockTxs": { + "get": { + "summary": "blockTxs", + "operationId": "blockTxs", + "tags": [ + "transaction" + ], + "description": "Get transactions in a block", "parameters": [ { - "name": "market_id", + "name": "by", "in": "query", "required": true, - "type": "integer", - "format": "int16" + "schema": { + "type": "string", + "enum": [ + "block_height", + "block_commitment" + ] + } }, { - "name": "resolution", + "name": "value", "in": "query", "required": true, - "type": "string", - "enum": [ - "1m", - "5m", - "15m", - "30m", - "1h", - "4h", - "12h", - "1d", - "1w" - ] - }, - { - "name": "start_timestamp", - "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 - }, - { - "name": "end_timestamp", - "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 - }, - { - "name": "count_back", - "in": "query", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "set_timestamp_to_end", - "in": "query", - "required": false, - "type": "boolean", - "format": "boolean", - "default": "false" + "schema": { + "type": "string" + } } ], - "tags": [ - "candlestick" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get candles (optimized with shortened fields and smaller response size)" - } - }, - "/api/v1/changeAccountTier": { - "post": { - "summary": "changeAccountTier", - "operationId": "changeAccountTier", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespChangeAccountTier" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Txs" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/blocks": { + "get": { + "summary": "blocks", + "operationId": "blocks", + "tags": [ + "block" + ], + "description": "Get blocks", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", - "in": "header", + "name": "index", + "in": "query", "required": false, - "type": "string" + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "body", - "in": "body", + "name": "limit", + "in": "query", "required": true, "schema": { - "$ref": "#/definitions/ReqChangeAccountTier" + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + }, + { + "name": "sort", + "in": "query", + "required": false, + "schema": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "default": "asc" } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Change account tier" - } - }, - "/api/v1/deposit/history": { - "get": { - "summary": "deposit_history", - "operationId": "deposit_history", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/DepositHistory" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Blocks" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/candles": { + "get": { + "summary": "candles", + "operationId": "candles", + "tags": [ + "candlestick" + ], + "description": "Get candles data. Returns at most 500 candles per call. Zero values are omitted from the response.", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "market_id", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "integer", + "format": "int16" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "resolution", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "string", + "enum": [ + "1m", + "5m", + "15m", + "30m", + "1h", + "4h", + "12h", + "1d", + "1w" + ] + } }, { - "name": "account_index", + "name": "start_timestamp", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } }, { - "name": "l1_address", + "name": "end_timestamp", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } }, { - "name": "cursor", + "name": "count_back", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "filter", + "name": "set_timestamp_to_end", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "pending", - "claimable" - ] + "schema": { + "type": "boolean", + "format": "boolean", + "default": "false" + } } ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Candles" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/changeAccountTier": { + "post": { + "summary": "changeAccountTier", + "operationId": "changeAccountTier", "tags": [ - "transaction" + "account" ], - "consumes": [ - "multipart/form-data" + "description": "Change account tier. You can only perform this action once every 24 hours, and with no orders or positions open.", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", + "schema": { + "type": "string" + } + } ], - "description": "Get deposit history" + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqChangeAccountTier" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespChangeAccountTier" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/exchangeMetrics": { + "/api/v1/currentHeight": { "get": { - "summary": "exchangeMetrics", - "operationId": "exchangeMetrics", + "summary": "currentHeight", + "operationId": "currentHeight", + "tags": [ + "block" + ], + "description": "Get current height", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetExchangeMetrics" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CurrentHeight" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/deposit/history": { + "get": { + "summary": "deposit_history", + "operationId": "deposit_history", + "tags": [ + "transaction" + ], + "description": "Get deposit history", "parameters": [ { - "name": "period", + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "account_index", "in": "query", "required": true, - "type": "string", - "enum": [ - "h", - "d", - "w", - "m", - "q", - "y", - "all" - ] + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "kind", + "name": "l1_address", "in": "query", "required": true, - "type": "string", - "enum": [ - "volume", - "maker_fee", - "taker_fee", - "liquidation_fee", - "trade_count", - "liquidation_count", - "liquidation_volume", - "inflow", - "outflow", - "transfer_fee", - "withdraw_fee", - "open_interest", - "account_count", - "active_account_count", - "tps" - ] + "schema": { + "type": "string" + } }, { - "name": "filter", + "name": "cursor", "in": "query", "required": false, - "type": "string", - "enum": [ - "byMarket" - ] + "schema": { + "type": "string" + } }, { - "name": "value", + "name": "filter", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get exchange metrics" - } - }, - "/api/v1/exchangeStats": { - "get": { - "summary": "exchangeStats", - "operationId": "exchangeStats", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ExchangeStats" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/DepositHistory" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "order" - ], - "description": "Get exchange stats" + } } }, - "/api/v1/executeStats": { + "/api/v1/exchangeStats": { "get": { - "summary": "executeStats", - "operationId": "executeStats", + "summary": "exchangeStats", + "operationId": "exchangeStats", + "tags": [ + "order" + ], + "description": "Get exchange stats", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetExecuteStats" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExchangeStats" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "parameters": [ - { - "name": "period", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "d", - "w", - "m", - "q", - "y", - "all" - ] - } - ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get execute stats" + } } }, "/api/v1/export": { "get": { "summary": "export", "operationId": "export", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ExportData" - } - }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, + "tags": [ + "order" + ], + "description": "Export trades and funding payments, limited to 12 months or 1M trades. END_TS_IN_MS - START_TS_IN_MS should not be larger than 12 months in milliseconds, both timestamps should be greater than or equal to 17 January 2025 00:00:00 UTC (lighter's mainnet genesis)", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" + "in": "header", + "required": true, + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": false, - "type": "integer", - "format": "int64", - "default": "-1" + "schema": { + "type": "integer", + "format": "int64", + "default": "-1" + } }, { "name": "market_id", "in": "query", "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { "name": "type", "in": "query", "required": true, - "type": "string", - "enum": [ - "funding", - "trade" - ] + "schema": { + "type": "string", + "enum": [ + "funding", + "trade" + ] + } }, { "name": "start_timestamp", "in": "query", "required": false, - "type": "integer", - "format": "int64", - "minimum": 1735689600000, - "maximum": 1830297600000 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1735689600000, + "maximum": 1830297600000 + } }, { "name": "end_timestamp", "in": "query", "required": false, - "type": "integer", - "format": "int64", - "minimum": 1735689600000, - "maximum": 1830297600000 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1735689600000, + "maximum": 1830297600000 + } }, { "name": "side", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "long", - "short" - ], - "default": "all" + "schema": { + "type": "string", + "enum": [ + "all", + "long", + "short" + ], + "default": "all" + } }, { "name": "role", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "maker", - "taker" - ], - "default": "all" + "schema": { + "type": "string", + "enum": [ + "all", + "maker", + "taker" + ], + "default": "all" + } }, { "name": "trade_type", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "trade", - "liquidation", - "deleverage", - "market-settlement" - ], - "default": "all" + "schema": { + "type": "string", + "enum": [ + "all", + "trade", + "liquidation", + "deleverage", + "market-settlement" + ], + "default": "all" + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Export data" - } - }, - "/api/v1/fastbridge/info": { - "get": { - "summary": "fastbridge_info", - "operationId": "fastbridge_info", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetFastBridgeInfo" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ExportData" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/fastbridge/info": { + "get": { + "summary": "fastbridge_info", + "operationId": "fastbridge_info", "tags": [ "bridge" ], - "description": "Get fast bridge info" - } - }, - "/api/v1/fastwithdraw": { - "post": { - "summary": "fastwithdraw", - "operationId": "fastwithdraw", + "description": "Get fast bridge info", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetFastBridgeInfo" + } + } } }, "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": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ReqFastwithdraw" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - ], - "tags": [ - "bridge" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Fast withdraw" + } } }, - "/api/v1/fastwithdraw/info": { + "/api/v1/funding-rates": { "get": { - "summary": "fastwithdraw_info", - "operationId": "fastwithdraw_info", + "summary": "funding-rates", + "operationId": "funding-rates", + "tags": [ + "funding" + ], + "description": "Get funding rates", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetFastwithdrawalInfo" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/FundingRates" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/fundings": { + "get": { + "summary": "fundings", + "operationId": "fundings", + "tags": [ + "candlestick" + ], + "description": "Get fundings", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "market_id", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "integer", + "format": "int16" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "resolution", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "string", + "enum": [ + "1h", + "1d" + ] + } }, { - "name": "account_index", + "name": "start_timestamp", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } + }, + { + "name": "end_timestamp", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } + }, + { + "name": "count_back", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } } ], - "tags": [ - "bridge" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get fast withdraw info" - } - }, - "/api/v1/faucet": { - "get": { - "summary": "faucet", - "operationId": "faucet", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Fundings" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/l1Metadata": { + "get": { + "summary": "l1Metadata", + "operationId": "l1Metadata", + "tags": [ + "account" + ], + "description": "Get L1 metadata", "parameters": [ { - "name": "l1_address", - "in": "query", + "name": "authorization", + "in": "header", "required": true, - "type": "string" + "schema": { + "type": "string" + } }, { - "name": "do_l1_transfer", + "name": "l1_address", "in": "query", "required": true, - "type": "boolean", - "format": "boolean", - "default": "false" + "schema": { + "type": "string" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Request funds from faucet" - } - }, - "/api/v1/funding-rates": { - "get": { - "summary": "funding-rates", - "operationId": "funding-rates", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/FundingRates" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/L1Metadata" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "funding" - ], - "description": "Get funding rates" + } } }, - "/api/v1/fundings": { + "/api/v1/liquidations": { "get": { - "summary": "fundings", - "operationId": "fundings", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Fundings" - } - }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, + "summary": "liquidations", + "operationId": "liquidations", + "tags": [ + "account" + ], + "description": "Get liquidation infos", "parameters": [ { - "name": "market_id", - "in": "query", + "name": "authorization", + "in": "header", "required": true, - "type": "integer", - "format": "int16" + "schema": { + "type": "string" + } }, { - "name": "resolution", + "name": "account_index", "in": "query", "required": true, - "type": "string", - "enum": [ - "1h", - "1d" - ] + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "start_timestamp", + "name": "market_id", "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 + "required": false, + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { - "name": "end_timestamp", + "name": "cursor", "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 + "required": false, + "schema": { + "type": "string" + } }, { - "name": "count_back", + "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } } ], - "tags": [ - "candlestick" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get fundings" - } - }, - "/api/v1/l1Metadata": { - "get": { - "summary": "l1Metadata", - "operationId": "l1Metadata", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/L1Metadata" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/LiquidationInfos" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/nextNonce": { + "get": { + "summary": "nextNonce", + "operationId": "nextNonce", + "tags": [ + "transaction" + ], + "description": "Get next nonce for a specific account and api key", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", - "in": "header", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "account_index", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "l1_address", + "name": "api_key_index", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "integer", + "format": "uint8" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get L1 metadata" - } - }, - "/api/v1/leaseOptions": { - "get": { - "summary": "leaseOptions", - "operationId": "leaseOptions", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetLeaseOptions" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/NextNonce" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "account" - ], - "description": "Get lease options" + } } }, - "/api/v1/leases": { - "get": { - "summary": "leases", - "operationId": "leases", + "/api/v1/notification/ack": { + "post": { + "summary": "notification_ack", + "operationId": "notification_ack", + "tags": [ + "notification" + ], + "description": "Ack notification", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqAckNotif" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetLeases" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/orderBookDetails": { + "get": { + "summary": "orderBookDetails", + "operationId": "orderBookDetails", + "tags": [ + "order" + ], + "description": "Get order books metadata", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "market_id", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "filter", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "all", + "spot", + "perp" + ], + "default": "all" + }, + "description": "Filter order books by type" + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderBookDetails" + } + } + } }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/orderBookOrders": { + "get": { + "summary": "orderBookOrders", + "operationId": "orderBookOrders", + "tags": [ + "order" + ], + "description": "Get order book orders", + "parameters": [ { - "name": "account_index", + "name": "market_id", "in": "query", "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "cursor", - "in": "query", - "required": false, - "type": "string" + "schema": { + "type": "integer", + "format": "int16" + } }, { "name": "limit", "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": "20" + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 250 + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get leases" - } - }, - "/api/v1/liquidations": { - "get": { - "summary": "liquidations", - "operationId": "liquidations", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/LiquidationInfos" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderBookOrders" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/orderBooks": { + "get": { + "summary": "orderBooks", + "operationId": "orderBooks", + "tags": [ + "order" + ], + "description": "Get order books metadata.
**Response Description:**

1) **Taker and maker fees** are in percentage.
2) **Min base amount:** The amount of base token that can be traded in a single order.
3) **Min quote amount:** The amount of quote token that can be traded in a single order.
4) **Supported size decimals:** The number of decimal places that can be used for the size of the order.
5) **Supported price decimals:** The number of decimal places that can be used for the price of the order.
6) **Supported quote decimals:** Size Decimals + Quote Decimals.", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "market_id", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "filter", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "all", + "spot", + "perp" + ], + "default": "all" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/OrderBooks" + } + } + } }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/pnl": { + "get": { + "summary": "pnl", + "operationId": "pnl", + "tags": [ + "account" + ], + "description": "Get account PnL chart", + "parameters": [ { - "name": "account_index", + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "by", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "string", + "enum": [ + "index" + ] + } }, { - "name": "market_id", + "name": "value", "in": "query", - "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "required": true, + "schema": { + "type": "string" + } }, { - "name": "cursor", + "name": "resolution", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "string", + "enum": [ + "1m", + "5m", + "15m", + "1h", + "4h", + "1d" + ] + } }, { - "name": "limit", + "name": "start_timestamp", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } + }, + { + "name": "end_timestamp", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 0, + "maximum": 5000000000000 + } + }, + { + "name": "count_back", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "ignore_transfers", + "in": "query", + "required": false, + "schema": { + "type": "boolean", + "format": "boolean", + "default": "false" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get liquidation infos" - } - }, - "/api/v1/litLease": { - "post": { - "summary": "litLease", - "operationId": "litLease", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/TxHash" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/AccountPnL" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/positionFunding": { + "get": { + "summary": "positionFunding", + "operationId": "positionFunding", + "tags": [ + "account" + ], + "description": "Get accounts position fundings", "parameters": [ { "name": "authorization", "in": "header", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { - "name": "body", - "in": "body", + "name": "account_index", + "in": "query", "required": true, "schema": { - "$ref": "#/definitions/ReqLITLease" + "type": "integer", + "format": "int64" } - } - ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Submit LIT lease transfer" - } - }, - "/api/v1/nextNonce": { - "get": { - "summary": "nextNonce", - "operationId": "nextNonce", - "responses": { - "200": { - "description": "A successful response.", + }, + { + "name": "market_id", + "in": "query", + "required": false, "schema": { - "$ref": "#/definitions/NextNonce" + "type": "integer", + "format": "int16", + "default": "255" } }, - "400": { - "description": "Bad request", + { + "name": "cursor", + "in": "query", + "required": false, "schema": { - "$ref": "#/definitions/ResultCode" + "type": "string" } - } - }, - "parameters": [ + }, { - "name": "account_index", + "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } }, { - "name": "api_key_index", + "name": "side", "in": "query", - "required": true, - "type": "integer", - "format": "uint8" + "required": false, + "schema": { + "type": "string", + "enum": [ + "long", + "short", + "all" + ], + "default": "all" + } } ], - "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get next nonce for a specific account and api key" - } - }, - "/api/v1/notification/ack": { - "post": { - "summary": "notification_ack", - "operationId": "notification_ack", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PositionFundings" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/publicPoolsMetadata": { + "get": { + "summary": "publicPoolsMetadata", + "operationId": "publicPoolsMetadata", + "tags": [ + "account" + ], + "description": "Get public pools metadata. `auth` is required in case you specify an account_index. You will see public pools with an index that starts an n-1 of the one you specify. To see staking pools, use `filter=stake`", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", "in": "header", "required": false, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/ReqAckNotif" + "type": "string" } - } - ], - "tags": [ - "notification" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Ack notification" - } - }, - "/api/v1/orderBookDetails": { - "get": { - "summary": "orderBookDetails", - "operationId": "orderBookDetails", - "responses": { - "200": { - "description": "A successful response.", + }, + { + "name": "filter", + "in": "query", + "required": false, "schema": { - "$ref": "#/definitions/OrderBookDetails" + "type": "string", + "enum": [ + "all", + "user", + "protocol", + "account_index", + "stake" + ] } }, - "400": { - "description": "Bad request", + { + "name": "index", + "in": "query", + "required": true, "schema": { - "$ref": "#/definitions/ResultCode" + "type": "integer", + "format": "int64" } - } - }, - "parameters": [ + }, { - "name": "market_id", + "name": "limit", "in": "query", - "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "required": true, + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } }, { - "name": "filter", + "name": "account_index", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "spot", - "perp" - ], - "default": "all" + "schema": { + "type": "integer", + "format": "int64" + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get order books metadata" - } - }, - "/api/v1/orderBookOrders": { - "get": { - "summary": "orderBookOrders", - "operationId": "orderBookOrders", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/OrderBookOrders" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespPublicPoolsMetadata" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/recentTrades": { + "get": { + "summary": "recentTrades", + "operationId": "recentTrades", + "tags": [ + "order" + ], + "description": "Get recent trades", "parameters": [ { "name": "market_id", "in": "query", "required": true, - "type": "integer", - "format": "int16" + "schema": { + "type": "integer", + "format": "int16" + } }, { "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 250 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get order book orders" - } - }, - "/api/v1/orderBooks": { - "get": { - "summary": "orderBooks", - "operationId": "orderBooks", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/OrderBooks" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Trades" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/referral/points": { + "get": { + "summary": "referral_points", + "operationId": "referral_points", + "tags": [ + "referral" + ], + "description": "Get referral points", "parameters": [ { - "name": "market_id", - "in": "query", - "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } }, { - "name": "filter", + "name": "account_index", "in": "query", - "required": false, - "type": "string", - "enum": [ - "all", - "spot", - "perp" - ], - "default": "all" + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } } ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReferralPoints" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/sendTx": { + "post": { + "summary": "sendTx", + "operationId": "sendTx", "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" + "transaction" ], - "description": "Get order books metadata.
**Response Description:**

1) **Taker and maker fees** are in percentage.
2) **Min base amount:** The amount of base token that can be traded in a single order.
3) **Min quote amount:** The amount of quote token that can be traded in a single order.
4) **Supported size decimals:** The number of decimal places that can be used for the size of the order.
5) **Supported price decimals:** The number of decimal places that can be used for the price of the order.
6) **Supported quote decimals:** Size Decimals + Quote Decimals." + "description": "You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqSendTx" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespSendTx" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/pnl": { - "get": { - "summary": "pnl", - "operationId": "pnl", + "/api/v1/sendTxBatch": { + "post": { + "summary": "sendTxBatch", + "operationId": "sendTxBatch", + "tags": [ + "transaction" + ], + "description": "You need to sign the transaction body before sending it to the server. More details can be found here: https://apidocs.lighter.xyz/docs/get-started", + "parameters": [], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqSendTxBatch" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/AccountPnL" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespSendTxBatch" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/trades": { + "get": { + "summary": "trades", + "operationId": "trades", + "tags": [ + "order" + ], + "description": "Get trades for lighter accounts, including sub-accounts and public pools. `auth` is required for master accounts and sub accounts.", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", + "in": "header", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "market_id", "in": "query", "required": false, - "type": "string" - }, - { - "name": "by", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "index" - ] - }, - { - "name": "value", - "in": "query", - "required": true, - "type": "string" - }, - { - "name": "resolution", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "1m", - "5m", - "15m", - "1h", - "4h", - "1d" - ] + "schema": { + "type": "integer", + "format": "int16", + "default": "255" + } }, { - "name": "start_timestamp", + "name": "account_index", "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "-1" + } }, { - "name": "end_timestamp", + "name": "order_index", "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 0, - "maximum": 5000000000000 + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "count_back", + "name": "sort_by", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "string", + "enum": [ + "block_height", + "timestamp", + "trade_id" + ] + } }, { - "name": "ignore_transfers", + "name": "sort_dir", "in": "query", "required": false, - "type": "boolean", - "format": "boolean", - "default": "false" - } - ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get account PnL chart" - } - }, - "/api/v1/positionFunding": { - "get": { - "summary": "positionFunding", - "operationId": "positionFunding", - "responses": { - "200": { - "description": "A successful response.", "schema": { - "$ref": "#/definitions/PositionFundings" + "type": "string", + "enum": [ + "desc" + ], + "default": "desc" } }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, - "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "cursor", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string" + } }, { - "name": "auth", - "description": " made optional to support header auth clients", + "name": "from", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "integer", + "format": "int64", + "default": "-1" + } }, { - "name": "account_index", + "name": "ask_filter", "in": "query", - "required": true, - "type": "integer", - "format": "int64" + "required": false, + "schema": { + "type": "integer", + "format": "int8", + "default": "-1" + } }, { - "name": "market_id", + "name": "role", "in": "query", "required": false, - "type": "integer", - "format": "int16", - "default": "255" + "schema": { + "type": "string", + "enum": [ + "all", + "maker", + "taker" + ], + "default": "all" + } }, { - "name": "cursor", + "name": "type", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "all", + "trade", + "liquidation", + "deleverage", + "market-settlement" + ], + "default": "all" + } }, { "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } }, { - "name": "side", + "name": "aggregate", "in": "query", "required": false, - "type": "string", - "enum": [ - "long", - "short", - "all" - ], - "default": "all" + "schema": { + "type": "boolean", + "format": "boolean", + "default": "false" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get accounts position fundings" - } - }, - "/api/v1/publicPoolsMetadata": { - "get": { - "summary": "publicPoolsMetadata", - "operationId": "publicPoolsMetadata", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespPublicPoolsMetadata" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Trades" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "parameters": [ - { - "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" - }, + } + } + }, + "/api/v1/transfer/history": { + "get": { + "summary": "transfer_history", + "operationId": "transfer_history", + "tags": [ + "transaction" + ], + "description": "Get transfer history. To fetch an account index, you will need to `auth` the request, unless it's a public pool.", + "parameters": [ { - "name": "filter", - "in": "query", + "name": "authorization", + "in": "header", "required": false, - "type": "string", - "enum": [ - "all", - "user", - "protocol", - "account_index", - "stake" - ] - }, - { - "name": "index", - "in": "query", - "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "string" + } }, { - "name": "limit", + "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "account_index", + "name": "cursor", "in": "query", "required": false, - "type": "integer", - "format": "int64" - } - ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get public pools metadata" - } - }, - "/api/v1/pushnotif/register": { - "post": { - "summary": "pushnotif_register", - "operationId": "pushnotif_register", - "responses": { - "200": { - "description": "A successful response.", "schema": { - "$ref": "#/definitions/ResultCode" + "type": "string" } }, - "400": { - "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, - "parameters": [ { - "name": "body", - "in": "body", - "required": true, + "name": "type", + "in": "query", + "required": false, "schema": { - "$ref": "#/definitions/ReqRegisterPushNotifToken" + "type": "array", + "items": { + "type": "string", + "enum": [ + "all", + "L2Transfer", + "L2MintShares", + "L2BurnShares", + "L2StakeAssets", + "L2UnstakeAssets" + ] + } } } ], - "tags": [ - "pushnotif" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Register device for push notifications" - } - }, - "/api/v1/pushnotif/settings": { - "get": { - "summary": "get_pushnotif_settings", - "operationId": "get_pushnotif_settings", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetPushNotifSettings" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferHistory" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/transferFeeInfo": { + "get": { + "summary": "transferFeeInfo", + "operationId": "transferFeeInfo", + "tags": [ + "info" + ], + "description": "Transfer fee info", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" + "in": "header", + "required": true, + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "expo_token", + "name": "to_account_index", "in": "query", - "required": true, - "type": "string" + "required": false, + "schema": { + "type": "integer", + "format": "int64", + "default": "-1" + } } ], - "tags": [ - "pushnotif" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get push notification settings" - }, - "post": { - "summary": "post_pushnotif_settings", - "operationId": "post_pushnotif_settings", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TransferFeeInfo" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/tx": { + "get": { + "summary": "tx", + "operationId": "tx", + "tags": [ + "transaction" + ], + "description": "Get transaction by hash or sequence index", "parameters": [ { - "name": "body", - "in": "body", + "name": "by", + "in": "query", + "required": true, + "schema": { + "type": "string", + "enum": [ + "hash", + "sequence_index" + ] + } + }, + { + "name": "value", + "in": "query", "required": true, "schema": { - "$ref": "#/definitions/ReqUpdatePushNotifSettings" + "type": "string" } } ], - "tags": [ - "pushnotif" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Update push notification settings" - } - }, - "/api/v1/pushnotif/unregister": { - "post": { - "summary": "pushnotif_unregister", - "operationId": "pushnotif_unregister", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnrichedTx" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/txFromL1TxHash": { + "get": { + "summary": "txFromL1TxHash", + "operationId": "txFromL1TxHash", + "tags": [ + "transaction" + ], + "description": "Get L1 transaction by L1 transaction hash", "parameters": [ { - "name": "body", - "in": "body", + "name": "hash", + "in": "query", "required": true, "schema": { - "$ref": "#/definitions/ReqUnregisterPushNotifToken" + "type": "string" } } ], - "tags": [ - "pushnotif" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Unregister device from push notifications" - } - }, - "/api/v1/recentTrades": { - "get": { - "summary": "recentTrades", - "operationId": "recentTrades", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Trades" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/EnrichedTx" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/txs": { + "get": { + "summary": "txs", + "operationId": "txs", + "tags": [ + "transaction" + ], + "description": "Get transactions which are already packed into blocks", "parameters": [ { - "name": "market_id", + "name": "index", "in": "query", - "required": true, - "type": "integer", - "format": "int16" + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } }, { "name": "limit", "in": "query", "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get recent trades" - } - }, - "/api/v1/referral/userReferrals": { - "get": { - "summary": "referral_userReferrals", - "operationId": "referral_userReferrals", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/UserReferrals" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Txs" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/withdraw/history": { + "get": { + "summary": "withdraw_history", + "operationId": "withdraw_history", + "tags": [ + "transaction" + ], + "description": "Get withdraw history. Secure withdrawals are only set to `claimable` when ready. You should only expect the `completed` status on fast withdrawals via Arbitrum.", "parameters": [ { "name": "authorization", "in": "header", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "string" + } }, { - "name": "auth", + "name": "account_index", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } }, { - "name": "l1_address", + "name": "cursor", "in": "query", - "required": true, - "type": "string" + "required": false, + "schema": { + "type": "string" + } }, { - "name": "cursor", + "name": "filter", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } } ], - "tags": [ - "referral" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get user referrals" - } - }, - "/api/v1/sendTx": { - "post": { - "summary": "sendTx", - "operationId": "sendTx", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespSendTx" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/WithdrawHistory" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" - } - } - }, - "parameters": [ - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "$ref": "#/definitions/ReqSendTx" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - ], + } + } + }, + "/api/v1/withdrawalDelay": { + "get": { + "summary": "withdrawalDelay", + "operationId": "withdrawalDelay", "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" + "info" ], - "description": "You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)" + "description": "Withdrawal delay in seconds", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespWithdrawalDelay" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/sendTxBatch": { - "post": { - "summary": "sendTxBatch", - "operationId": "sendTxBatch", + "/info": { + "get": { + "summary": "info", + "operationId": "info", + "tags": [ + "root" + ], + "description": "Get info of zklighter", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespSendTxBatch" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ZkLighterInfo" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/fastwithdraw": { + "post": { + "summary": "fastwithdraw", + "operationId": "fastwithdraw", + "tags": [ + "bridge" + ], + "description": "Fast withdraw", "parameters": [ { - "name": "body", - "in": "body", - "required": true, + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", "schema": { - "$ref": "#/definitions/ReqSendTxBatch" + "type": "string" } } ], - "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "You need to sign the transaction body before sending it to the server. More details can be found in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers)" - } - }, - "/api/v1/systemConfig": { - "get": { - "summary": "systemConfig", - "operationId": "systemConfig", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqFastwithdraw" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/SystemConfig" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "info" - ], - "description": "Get system configuration including pool indexes and lockup/cooldown periods" + } } }, - "/api/v1/tokens": { + "/api/v1/fastwithdraw/info": { "get": { - "summary": "tokens", - "operationId": "tokens", + "summary": "fastwithdraw_info", + "operationId": "fastwithdraw_info", + "tags": [ + "bridge" + ], + "description": "Get fast withdraw info", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "account_index", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespGetApiTokens" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetFastwithdrawalInfo" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/tokens": { + "get": { + "summary": "tokens", + "operationId": "tokens", + "tags": [ + "account" + ], + "description": "Get read only auth tokens for an account", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", "in": "header", "required": false, - "type": "string" + "description": " make required after integ is done", + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get api tokens of an account" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetApiTokens" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, "/api/v1/tokens/create": { "post": { "summary": "tokens_create", "operationId": "tokens_create", + "tags": [ + "account" + ], + "description": "Create an API token for read-only access", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqPostApiToken" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespPostApiToken" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespPostApiToken" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/tokens/revoke": { + "post": { + "summary": "tokens_revoke", + "operationId": "tokens_revoke", + "tags": [ + "account" + ], + "description": "Revoke read only auth token for an account", "parameters": [ { "name": "authorization", "in": "header", "required": false, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, "schema": { - "$ref": "#/definitions/ReqPostApiToken" + "type": "string" } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Create api token" + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqRevokeApiToken" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespRevokeApiToken" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/tokens/revoke": { + "/api/v1/createIntentAddress": { "post": { - "summary": "tokens_revoke", - "operationId": "tokens_revoke", + "summary": "createIntentAddress", + "operationId": "createIntentAddress", + "tags": [ + "bridge" + ], + "description": "Create a bridge intent address for CCTP bridge", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqCreateIntentAddress" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespRevokeApiToken" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateIntentAddressResp" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/deposit/latest": { + "get": { + "summary": "deposit_latest", + "operationId": "deposit_latest", + "tags": [ + "bridge" + ], + "description": "Get most recent deposit for given l1 address", "parameters": [ { - "name": "authorization", - "in": "header", - "required": false, - "type": "string" - }, - { - "name": "body", - "in": "body", + "name": "l1_address", + "in": "query", "required": true, "schema": { - "$ref": "#/definitions/ReqRevokeApiToken" + "type": "string" } } ], - "tags": [ - "account" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Revoke api token" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Deposit" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/trades": { + "/api/v1/deposit/networks": { "get": { - "summary": "trades", - "operationId": "trades", + "summary": "deposit_networks", + "operationId": "deposit_networks", + "tags": [ + "bridge" + ], + "description": "Get networks that support deposits via intent address", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/Trades" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/BridgeSupportedNetworks" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/exchangeMetrics": { + "get": { + "summary": "exchangeMetrics", + "operationId": "exchangeMetrics", + "tags": [ + "order" + ], + "description": "Get exchange metrics. When filtering by market, use the market symbol as a value.", "parameters": [ { - "name": "authorization", - "description": " make required after integ is done", + "name": "period", "in": "query", - "required": false, - "type": "string" + "required": true, + "schema": { + "type": "string", + "enum": [ + "h", + "d", + "w", + "m", + "q", + "y", + "all" + ] + } }, { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "market_id", - "in": "query", - "required": false, - "type": "integer", - "format": "int16", - "default": "255" - }, - { - "name": "account_index", - "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": "-1" - }, - { - "name": "order_index", - "in": "query", - "required": false, - "type": "integer", - "format": "int64" - }, - { - "name": "sort_by", + "name": "kind", "in": "query", "required": true, - "type": "string", - "enum": [ - "block_height", - "timestamp", - "trade_id" - ] - }, - { - "name": "sort_dir", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "desc" - ], - "default": "desc" - }, - { - "name": "cursor", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "from", - "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": "-1" - }, - { - "name": "ask_filter", - "in": "query", - "required": false, - "type": "integer", - "format": "int8", - "default": "-1" - }, - { - "name": "role", - "in": "query", - "required": false, - "type": "string", - "enum": [ - "all", - "maker", - "taker" - ], - "default": "all" + "schema": { + "type": "string", + "enum": [ + "volume", + "maker_fee", + "taker_fee", + "liquidation_fee", + "trade_count", + "liquidation_count", + "liquidation_volume", + "inflow", + "outflow", + "transfer_fee", + "withdraw_fee", + "open_interest", + "account_count", + "active_account_count", + "tps" + ] + } }, { - "name": "type", + "name": "filter", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "trade", - "liquidation", - "deleverage", - "market-settlement" - ], - "default": "all" - }, - { - "name": "limit", - "in": "query", - "required": true, - "type": "integer", - "format": "int64", - "minimum": 1, - "maximum": 100 + "schema": { + "type": "string", + "enum": [ + "byMarket" + ] + } }, { - "name": "aggregate", + "name": "value", "in": "query", "required": false, - "type": "boolean", - "format": "boolean", - "default": "false" + "schema": { + "type": "string" + } } ], - "tags": [ - "order" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get trades" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetExchangeMetrics" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/transfer/history": { + "/api/v1/layer1BasicInfo": { "get": { - "summary": "transfer_history", - "operationId": "transfer_history", + "summary": "layer1BasicInfo", + "operationId": "layer1BasicInfo", + "tags": [ + "info" + ], + "description": "Get zklighter l1 general info, including contract address and rpc info", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/TransferHistory" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/Layer1BasicInfo" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/referral/create": { + "post": { + "summary": "referral_create", + "operationId": "referral_create", + "tags": [ + "referral" + ], + "description": "Create referral code", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "account_index", - "in": "query", - "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "cursor", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "type", - "in": "query", + "in": "header", "required": false, - "type": "string", - "enum": [ - "all", - "L2Transfer", - "L2MintShares", - "L2BurnShares", - "L2StakeAssets", - "L2UnstakeAssets" - ] + "description": " make required after integ is done", + "schema": { + "type": "string" + } } ], - "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get transfer history" - } - }, - "/api/v1/transferFeeInfo": { - "get": { - "summary": "transferFeeInfo", - "operationId": "transferFeeInfo", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqCreateReferralCode" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/TransferFeeInfo" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReferralCode" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/referral/get": { + "get": { + "summary": "referral_get", + "operationId": "referral_get", + "tags": [ + "referral" + ], + "description": "Get referral code", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", "in": "query", "required": false, - "type": "string" + "description": " make required after integ is done", + "schema": { + "type": "string" + } }, { "name": "auth", - "description": " made optional to support header auth clients", "in": "query", "required": false, - "type": "string" + "description": " made optional to support header auth clients", + "schema": { + "type": "string" + } }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" - }, - { - "name": "to_account_index", - "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": "-1" + "schema": { + "type": "integer", + "format": "int64" + } } ], - "tags": [ - "info" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Transfer fee info" - } - }, - "/api/v1/tx": { - "get": { - "summary": "tx", - "operationId": "tx", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/EnrichedTx" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReferralCode" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/referral/kickback/update": { + "post": { + "summary": "referral_kickback_update", + "operationId": "referral_kickback_update", + "tags": [ + "referral" + ], + "description": "Update kickback percentage for referral rewards (allowed once per day)", "parameters": [ { - "name": "by", - "in": "query", - "required": true, - "type": "string", - "enum": [ - "hash", - "sequence_index" - ] - }, - { - "name": "value", - "in": "query", - "required": true, - "type": "string" + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", + "schema": { + "type": "string" + } } ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqUpdateKickback" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespUpdateKickback" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/referral/update": { + "post": { + "summary": "referral_update", + "operationId": "referral_update", "tags": [ - "transaction" + "referral" ], - "consumes": [ - "multipart/form-data" + "description": "Update referral code (allowed once per account)", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", + "schema": { + "type": "string" + } + } ], - "description": "Get transaction by hash or sequence index" - } - }, - "/api/v1/txFromL1TxHash": { - "get": { - "summary": "txFromL1TxHash", - "operationId": "txFromL1TxHash", + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqUpdateReferralCode" + } + } + } + }, "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/EnrichedTx" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespUpdateReferralCode" + } + } } }, "400": { "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/referral/use": { + "post": { + "summary": "referral_use", + "operationId": "referral_use", + "tags": [ + "referral" + ], + "description": "Use referral code", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "description": " make required after integ is done", "schema": { - "$ref": "#/definitions/ResultCode" + "type": "string" + } + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqUseReferralCode" + } } } }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } + } + }, + "/api/v1/executeStats": { + "get": { + "summary": "executeStats", + "operationId": "executeStats", + "tags": [ + "order" + ], + "description": "Get execute stats", "parameters": [ { - "name": "hash", + "name": "period", "in": "query", "required": true, - "type": "string" + "schema": { + "type": "string", + "enum": [ + "d", + "w", + "m", + "q", + "y", + "all" + ] + } } ], - "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get L1 transaction by L1 transaction hash" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetExecuteStats" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/api/v1/withdraw/history": { + "/api/v1/leaseOptions": { "get": { - "summary": "withdraw_history", - "operationId": "withdraw_history", + "summary": "leaseOptions", + "operationId": "leaseOptions", + "tags": [ + "account" + ], + "description": "Returns available lease duration/rate tiers, sorted by duration descending.", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/WithdrawHistory" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetLeaseOptions" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/leases": { + "get": { + "summary": "leases", + "operationId": "leases", + "tags": [ + "account" + ], + "description": "Returns paginated lease entries for an account, most recent first. Supports read-only auth via signature/account_index/timestamp query params.", "parameters": [ { "name": "authorization", - "description": " make required after integ is done", - "in": "query", - "required": false, - "type": "string" - }, - { - "name": "auth", - "description": " made optional to support header auth clients", - "in": "query", + "in": "header", "required": false, - "type": "string" + "schema": { + "type": "string" + }, + "description": "API token authorization" }, { "name": "account_index", "in": "query", "required": true, - "type": "integer", - "format": "int64" + "schema": { + "type": "integer", + "format": "int64" + }, + "description": "Account index to fetch leases for" }, { "name": "cursor", "in": "query", "required": false, - "type": "string" + "schema": { + "type": "string" + }, + "description": "Pagination cursor from a previous response" }, { - "name": "filter", + "name": "limit", "in": "query", "required": false, - "type": "string", - "enum": [ - "all", - "pending", - "claimable" - ] + "schema": { + "type": "integer", + "default": 20, + "format": "uint64", + "minimum": 1, + "maximum": 100 + }, + "description": "Number of results to return (1\u2013100, default 20)" + }, + { + "name": "auth", + "in": "query", + "required": false, + "schema": { + "type": "string" + }, + "description": "Read-only auth (alternative to header authorization)" } ], - "tags": [ - "transaction" - ], - "consumes": [ - "multipart/form-data" - ], - "description": "Get withdraw history" - } - }, - "/api/v1/withdrawalDelay": { - "get": { - "summary": "withdrawalDelay", - "operationId": "withdrawalDelay", "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/RespWithdrawalDelay" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetLeases" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, + } + } + }, + "/api/v1/litLease": { + "post": { + "summary": "litLease", + "operationId": "litLease", "tags": [ - "info" + "account" ], - "description": "Withdrawal delay in seconds" + "description": "Submit a LIT lease transfer. The server calculates the required fee based on lease_amount and duration_days, then executes the transfer. Fee formula (integer arithmetic): fee = lease_amount \u00d7 (annual_rate \u00d7 100) \u00d7 duration_days / (360 \u00d7 10000).", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "type": "string" + }, + "description": "API token authorization" + } + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqLITLease" + } + } + } + }, + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TxHash" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } + } } }, - "/info": { + "/api/v1/referral/userReferrals": { "get": { - "summary": "info", - "operationId": "info", + "summary": "userReferrals", + "operationId": "userReferrals", + "tags": [ + "account" + ], + "description": "Get user referrals", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "l1_address", + "in": "query", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "cursor", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "auth", + "in": "query", + "required": false, + "schema": { + "type": "string" + } + }, + { + "name": "stats_start_timestamp", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "stats_end_timestamp", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], "responses": { "200": { "description": "A successful response.", - "schema": { - "$ref": "#/definitions/ZkLighterInfo" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/UserReferrals" + } + } } }, "400": { "description": "Bad request", - "schema": { - "$ref": "#/definitions/ResultCode" + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } } } - }, - "tags": [ - "root" - ], - "description": "Get info of zklighter" - } - } - }, - "definitions": { - "Account": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "account_type": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "cancel_all_time": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "total_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "total_isolated_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "pending_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "available_balance": { - "type": "string", - "example": "19995" - }, - "status": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "collateral": { - "type": "string", - "example": "46342" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - }, - "account_trading_mode": { - "type": "integer", - "format": "uint8", - "example": "1" } - }, - "title": "Account", - "required": [ - "code", - "account_type", - "index", - "l1_address", - "cancel_all_time", - "total_order_count", - "total_isolated_order_count", - "pending_order_count", - "available_balance", - "status", - "collateral", - "transaction_time", - "account_trading_mode" - ] + } }, - "AccountApiKeys": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "api_keys": { - "type": "array", - "items": { - "$ref": "#/definitions/ApiKey" - } - } - }, - "title": "AccountApiKeys", - "required": [ - "code", - "api_keys" - ] - }, - "AccountAsset": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "USDC" - }, - "asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "balance": { - "type": "string", - "example": "1000" - }, - "locked_balance": { - "type": "string", - "example": "1000" - } - }, - "title": "AccountAsset", - "required": [ - "symbol", - "asset_id", - "balance", - "locked_balance" - ] - }, - "AccountLimits": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "max_llp_percentage": { - "type": "integer", - "format": "int32", - "example": "25" - }, - "max_llp_amount": { - "type": "string", - "example": "1000000" - }, - "user_tier": { - "type": "string", - "example": "std" - }, - "can_create_public_pool": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "current_maker_fee_tick": { - "type": "integer", - "format": "int32", - "example": "0" - }, - "current_taker_fee_tick": { - "type": "integer", - "format": "int32", - "example": "0" - }, - "leased_lit": { - "type": "string" - }, - "effective_lit_stakes": { - "type": "string" - } - }, - "title": "AccountLimits", - "required": [ - "code", - "max_llp_percentage", - "max_llp_amount", - "user_tier", - "can_create_public_pool", - "current_maker_fee_tick", - "current_taker_fee_tick", - "leased_lit", - "effective_lit_stakes" - ] - }, - "AccountMarginStats": { - "type": "object", - "properties": { - "collateral": { - "type": "string", - "example": "199955" - }, - "portfolio_value": { - "type": "string", - "example": "199955" - }, - "leverage": { - "type": "string", - "example": "1.0" - }, - "available_balance": { - "type": "string", - "example": "199955" - }, - "margin_usage": { - "type": "string", - "example": "0.0" - }, - "buying_power": { - "type": "string", - "example": "199955" - } - }, - "title": "AccountMarginStats", - "required": [ - "collateral", - "portfolio_value", - "leverage", - "available_balance", - "margin_usage", - "buying_power" - ] - }, - "AccountMarketStats": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "weekly_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "weekly_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "weekly_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "monthly_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "monthly_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "monthly_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "total_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "total_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "total_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - } - }, - "title": "AccountMarketStats", - "required": [ - "market_id", - "daily_trades_count", - "daily_base_token_volume", - "daily_quote_token_volume", - "weekly_trades_count", - "weekly_base_token_volume", - "weekly_quote_token_volume", - "monthly_trades_count", - "monthly_base_token_volume", - "monthly_quote_token_volume", - "total_trades_count", - "total_base_token_volume", - "total_quote_token_volume" - ] - }, - "AccountMetadata": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "can_invite": { - "type": "boolean", - "format": "boolean", - "description": " Remove After FE uses L1 meta endpoint" - }, - "referral_points_percentage": { - "type": "string", - "description": " Remove After FE uses L1 meta endpoint" - }, - "created_at": { - "type": "integer", - "format": "int64" - } - }, - "title": "AccountMetadata", - "required": [ - "account_index", - "name", - "description", - "can_invite", - "referral_points_percentage", - "created_at" - ] - }, - "AccountMetadatas": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "account_metadatas": { - "type": "array", - "items": { - "$ref": "#/definitions/AccountMetadata" - } - } - }, - "title": "AccountMetadatas", - "required": [ - "code", - "account_metadatas" - ] - }, - "AccountPnL": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "resolution": { - "type": "string", - "example": "15m" - }, - "pnl": { - "type": "array", - "items": { - "$ref": "#/definitions/PnLEntry" + "/api/v1/setAccountMetadata": { + "post": { + "summary": "setAccountMetadata", + "operationId": "setAccountMetadata", + "tags": [ + "transaction" + ], + "description": "Set account metadata", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "schema": { + "type": "string" + } } - } - }, - "title": "AccountPnL", - "required": [ - "code", - "resolution", - "pnl" - ] - }, - "AccountPosition": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "symbol": { - "type": "string", - "example": "ETH" - }, - "initial_margin_fraction": { - "type": "string", - "example": "20.00" - }, - "open_order_count": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "pending_order_count": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "position_tied_order_count": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "sign": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "position": { - "type": "string", - "example": "3.6956" - }, - "avg_entry_price": { - "type": "string", - "example": "3024.66" - }, - "position_value": { - "type": "string", - "example": "3019.92" - }, - "unrealized_pnl": { - "type": "string", - "example": "17.521309" - }, - "realized_pnl": { - "type": "string", - "example": "2.000000" - }, - "liquidation_price": { - "type": "string", - "example": "3024.66" - }, - "total_funding_paid_out": { - "type": "string", - "example": "34.2" - }, - "margin_mode": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "allocated_margin": { - "type": "string", - "example": "46342" - }, - "total_discount": { - "type": "string", - "example": "34.2" - } - }, - "title": "AccountPosition", - "required": [ - "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", - "margin_mode", - "allocated_margin", - "total_discount" - ] - }, - "AccountStats": { - "type": "object", - "properties": { - "collateral": { - "type": "string", - "example": "199955" - }, - "portfolio_value": { - "type": "string", - "example": "199955" - }, - "leverage": { - "type": "string", - "example": "1.0" - }, - "available_balance": { - "type": "string", - "example": "199955" - }, - "margin_usage": { - "type": "string", - "example": "0.0" - }, - "buying_power": { - "type": "string", - "example": "199955" - }, - "account_trading_mode": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "cross_stats": { - "$ref": "#/definitions/AccountMarginStats" - }, - "total_stats": { - "$ref": "#/definitions/AccountMarginStats" - } - }, - "title": "AccountStats", - "required": [ - "collateral", - "portfolio_value", - "leverage", - "available_balance", - "margin_usage", - "buying_power", - "account_trading_mode", - "cross_stats", - "total_stats" - ] - }, - "AccountTradeStats": { - "type": "object", - "properties": { - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "daily_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "weekly_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "weekly_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "monthly_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "monthly_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "total_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "total_volume": { - "type": "number", - "format": "double", - "example": "235.25" - } - }, - "title": "AccountTradeStats", - "required": [ - "daily_trades_count", - "daily_volume", - "weekly_trades_count", - "weekly_volume", - "monthly_trades_count", - "monthly_volume", - "total_trades_count", - "total_volume" - ] - }, - "Announcement": { - "type": "object", - "properties": { - "title": { - "type": "string" - }, - "content": { - "type": "string" - }, - "created_at": { - "type": "integer", - "format": "int64" - }, - "expired_at": { - "type": "integer", - "format": "int64" - } - }, - "title": "Announcement", - "required": [ - "title", - "content", - "created_at", - "expired_at" - ] - }, - "Announcements": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "announcements": { - "type": "array", - "items": { - "$ref": "#/definitions/Announcement" + ], + "requestBody": { + "required": true, + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ReqSetAccountMetadata" + } + } } - } - }, - "title": "Announcements", - "required": [ - "code", - "announcements" - ] - }, - "ApiKey": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "api_key_index": { - "type": "integer", - "format": "uint8", - "example": "0" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "722" - }, - "public_key": { - "type": "string" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - } - }, - "title": "ApiKey", - "required": [ - "account_index", - "api_key_index", - "nonce", - "public_key", - "transaction_time" - ] - }, - "ApiToken": { - "type": "object", - "properties": { - "token_id": { - "type": "integer", - "format": "int64" }, - "api_token": { - "type": "string" - }, - "name": { - "type": "string" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expiry": { - "type": "integer", - "format": "int64" - }, - "sub_account_access": { - "type": "boolean", - "format": "boolean" - }, - "revoked": { - "type": "boolean", - "format": "boolean" - }, - "scopes": { - "type": "string" - } - }, - "title": "ApiToken", - "required": [ - "token_id", - "api_token", - "name", - "account_index", - "expiry", - "sub_account_access", - "revoked", - "scopes" - ] - }, - "ApprovedIntegrator": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64", - "example": "54621" - }, - "name": { - "type": "string", - "example": "Integrator1" - }, - "max_perps_taker_fee": { - "type": "integer", - "format": "int32", - "example": "10" - }, - "max_perps_maker_fee": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "max_spot_taker_fee": { - "type": "integer", - "format": "int32", - "example": "10" - }, - "max_spot_maker_fee": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "approval_expiry": { - "type": "integer", - "format": "int64", - "example": "1640995200", - "description": " Timestamp in milliseconds, after which the integrator is no longer approved" - } - }, - "title": "ApprovedIntegrator", - "required": [ - "account_index", - "name", - "max_perps_taker_fee", - "max_perps_maker_fee", - "max_spot_taker_fee", - "max_spot_maker_fee", - "approval_expiry" - ] - }, - "Asset": { - "type": "object", - "properties": { - "asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "symbol": { - "type": "string", - "example": "ETH" - }, - "l1_decimals": { - "type": "integer", - "format": "uint8", - "example": "18" - }, - "decimals": { - "type": "integer", - "format": "uint8", - "example": "2" - }, - "min_transfer_amount": { - "type": "string", - "example": "0.01" - }, - "min_withdrawal_amount": { - "type": "string", - "example": "0.01" - }, - "margin_mode": { - "type": "string", - "example": "enabled", - "enum": [ - "enabled", - "disabled" - ] - }, - "index_price": { - "type": "string", - "example": "3024.66" - }, - "l1_address": { - "type": "string", - "example": "0x0000000000000000000000000000000000000000" - } - }, - "title": "Asset", - "required": [ - "asset_id", - "symbol", - "l1_decimals", - "decimals", - "min_transfer_amount", - "min_withdrawal_amount", - "margin_mode", - "index_price", - "l1_address" - ] - }, - "AssetDetails": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "asset_details": { - "type": "array", - "items": { - "$ref": "#/definitions/Asset" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } } } - }, - "title": "AssetDetails", - "required": [ - "code", - "asset_details" - ] - }, - "Auth": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - } - }, - "title": "Auth", - "required": [ - "auth" - ] - }, - "Bridge": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "version": { - "type": "integer", - "format": "int32", - "enum": [ - "1", - "2" - ] - }, - "source": { - "type": "string", - "example": "Arbitrum" - }, - "source_chain_id": { - "type": "string", - "example": "42161" - }, - "fast_bridge_tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "batch_claim_tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "cctp_burn_tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "amount": { - "type": "string" - }, - "intent_address": { - "type": "string" - }, - "status": { - "type": "string", - "enum": [ - "pending", - "bridging", - "completed" - ] - }, - "step": { - "type": "string" - }, - "description": { - "type": "string" - }, - "created_at": { - "type": "integer", - "format": "int64" - }, - "updated_at": { - "type": "integer", - "format": "int64" - }, - "is_external_deposit": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "Bridge", - "required": [ - "id", - "version", - "source", - "source_chain_id", - "fast_bridge_tx_hash", - "batch_claim_tx_hash", - "cctp_burn_tx_hash", - "amount", - "intent_address", - "status", - "step", - "description", - "created_at", - "updated_at", - "is_external_deposit" - ] - }, - "BridgeSupportedNetwork": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "Arbitrum" - }, - "chain_id": { - "type": "string", - "example": "4164" - }, - "explorer": { - "type": "string", - "example": "https://arbiscan.io/" - } - }, - "title": "BridgeSupportedNetwork", - "required": [ - "name", - "chain_id", - "explorer" - ] - }, - "Candle": { - "type": "object", - "properties": { - "t": { - "type": "integer", - "format": "int64", - "example": "1640995200", - "description": " timestamp" - }, - "o": { - "type": "number", - "format": "double", - "example": "3024.66", - "description": " open" - }, - "h": { - "type": "number", - "format": "double", - "example": "3034.66", - "description": " high" - }, - "l": { - "type": "number", - "format": "double", - "example": "3014.66", - "description": " low" - }, - "c": { - "type": "number", - "format": "double", - "example": "3024.66", - "description": " close" - }, - "O": { - "type": "number", - "format": "double", - "example": "3024.66", - "description": " open_raw" - }, - "H": { - "type": "number", - "format": "double", - "example": "3034.66", - "description": " high_raw" - }, - "L": { - "type": "number", - "format": "double", - "example": "3014.66", - "description": " low_raw" - }, - "C": { - "type": "number", - "format": "double", - "example": "3024.66", - "description": " close_raw" - }, - "v": { - "type": "number", - "format": "double", - "example": "235.25", - "description": " volume0" - }, - "V": { - "type": "number", - "format": "double", - "example": "93566.25", - "description": " volume1" - }, - "i": { - "type": "integer", - "format": "int64", - "example": "1", - "description": " last_trade_id" - } - }, - "title": "Candle", - "required": [ - "t", - "o", - "h", - "l", - "c", - "O", - "H", - "L", - "C", - "v", - "V", - "i" - ] - }, - "Candles": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "r": { - "type": "string", - "example": "15m", - "description": " resolution" - }, - "c": { - "type": "array", - "items": { - "$ref": "#/definitions/Candle" - }, - "description": " candles" - } - }, - "title": "Candles", - "required": [ - "code", - "r", - "c" - ] - }, - "ContractAddress": { - "type": "object", - "properties": { - "name": { - "type": "string", - "example": "1" - }, - "address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - } - }, - "title": "ContractAddress", - "required": [ - "name", - "address" - ] - }, - "Cursor": { - "type": "object", - "properties": { - "next_cursor": { - "type": "string" - } - }, - "title": "Cursor" - }, - "DailyReturn": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "daily_return": { - "type": "number", - "format": "double", - "example": "0.0001" - } - }, - "title": "DailyReturn", - "required": [ - "timestamp", - "daily_return" - ] + } }, - "DepositHistory": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "deposits": { - "type": "array", - "items": { - "$ref": "#/definitions/DepositHistoryItem" + "/api/v1/systemConfig": { + "get": { + "summary": "systemConfig", + "operationId": "systemConfig", + "tags": [ + "info" + ], + "description": "Get system config", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/SystemConfig" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } } - }, - "cursor": { - "type": "string" } - }, - "title": "DepositHistory", - "required": [ - "code", - "deposits", - "cursor" - ] + } }, - "DepositHistoryItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "amount": { - "type": "string", - "example": "0.1" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "status": { - "type": "string", - "enum": [ - "failed", - "pending", - "completed", - "claimable" - ] - }, - "l1_tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + "/api/v1/tokenlist": { + "get": { + "summary": "tokenlist", + "operationId": "tokenlist", + "tags": [ + "tokenlist" + ], + "description": "Get token list and their metadata", + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/TokenList" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } + } } - }, - "title": "DepositHistoryItem", - "required": [ - "id", - "asset_id", - "amount", - "timestamp", - "status", - "l1_tx_hash" - ] + } }, - "DetailedAccount": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "account_type": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "cancel_all_time": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "total_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "total_isolated_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "pending_order_count": { - "type": "integer", - "format": "int64", - "example": "100" - }, - "available_balance": { - "type": "string", - "example": "19995" - }, - "status": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "collateral": { - "type": "string", - "example": "46342" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - }, - "account_trading_mode": { - "type": "integer", - "format": "uint8", - "example": "1" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "name": { - "type": "string" - }, - "description": { - "type": "string" - }, - "can_invite": { - "type": "boolean", - "format": "boolean", - "description": " Remove After FE uses L1 meta endpoint" - }, - "referral_points_percentage": { - "type": "string", - "description": " Remove After FE uses L1 meta endpoint" - }, - "created_at": { - "type": "integer", - "format": "int64" - }, - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/AccountPosition" + "/api/v1/getMakerOnlyApiKeys": { + "get": { + "summary": "getMakerOnlyApiKeys", + "operationId": "getMakerOnlyApiKeys", + "tags": [ + "account" + ], + "description": "Get maker-only API key indexes", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "account_index", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } } - }, - "assets": { - "type": "array", - "items": { - "$ref": "#/definitions/AccountAsset" + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespGetMakerOnlyApiKeys" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } } - }, - "total_asset_value": { - "type": "string", - "example": "19995" - }, - "cross_asset_value": { - "type": "string", - "example": "19995" - }, - "pool_info": { - "$ref": "#/definitions/PublicPoolInfo" - }, - "shares": { - "type": "array", - "items": { - "$ref": "#/definitions/PublicPoolShare" + } + } + }, + "/api/v1/setMakerOnlyApiKeys": { + "post": { + "summary": "setMakerOnlyApiKeys", + "operationId": "setMakerOnlyApiKeys", + "tags": [ + "account" + ], + "description": "Set maker-only API key indexes. This replaces the current list; pass all indexes you want marked as maker-only. Pass [] to clear all maker-only restrictions.", + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": true, + "schema": { + "type": "string" + } } - }, - "pending_unlocks": { - "type": "array", - "items": { - "$ref": "#/definitions/PendingUnlock" + ], + "requestBody": { + "required": true, + "content": { + "application/x-www-form-urlencoded": { + "schema": { + "$ref": "#/components/schemas/ReqSetMakerOnlyApiKeys" + } + }, + "multipart/form-data": { + "schema": { + "$ref": "#/components/schemas/ReqSetMakerOnlyApiKeys" + } + } } }, - "approved_integrators": { - "type": "array", - "items": { - "$ref": "#/definitions/ApprovedIntegrator" + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/RespSetMakerOnlyApiKeys" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } } } - }, - "title": "DetailedAccount", - "required": [ - "code", - "account_type", - "index", - "l1_address", - "cancel_all_time", - "total_order_count", - "total_isolated_order_count", - "pending_order_count", - "available_balance", - "status", - "collateral", - "transaction_time", - "account_trading_mode", - "account_index", - "name", - "description", - "can_invite", - "referral_points_percentage", - "created_at", - "positions", - "assets", - "total_asset_value", - "cross_asset_value", - "pool_info", - "shares", - "pending_unlocks", - "approved_integrators" - ] + } }, - "DetailedAccounts": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "total": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "accounts": { - "type": "array", - "items": { - "$ref": "#/definitions/DetailedAccount" + "/api/v1/partnerStats": { + "get": { + "summary": "partnerStats", + "operationId": "partnerStats", + "description": "Get partner stats. If timestamps are not provided, all-time stats will be returned.", + "tags": [ + "account" + ], + "parameters": [ + { + "name": "account_index", + "in": "query", + "required": true, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "start_timestamp", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + }, + { + "name": "end_timestamp", + "in": "query", + "required": false, + "schema": { + "type": "integer", + "format": "int64" + } + } + ], + "responses": { + "200": { + "description": "A successful response.", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/PartnerStats" + } + } + } + }, + "400": { + "description": "Bad request", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ResultCode" + } + } + } } } - }, - "title": "DetailedAccounts", - "required": [ - "code", - "total", - "accounts" - ] + } + } + }, + "servers": [ + { + "url": "https://mainnet.zklighter.elliot.ai" + } + ], + "components": { + "securitySchemes": { + "apiKey": { + "type": "apiKey", + "description": "Enter JWT Bearer token **_only_**", + "name": "Authorization", + "in": "header" + } }, - "DetailedCandlestick": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "open": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "high": { - "type": "number", - "format": "double", - "example": "3034.66" - }, - "low": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "close": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "open_raw": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "high_raw": { - "type": "number", - "format": "double", - "example": "3034.66" - }, - "low_raw": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "close_raw": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "volume0": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "volume1": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "last_trade_id": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "trade_count": { - "type": "integer", - "format": "int64", - "example": "1503241" - } - }, - "title": "DetailedCandlestick", - "required": [ - "timestamp", - "open", - "high", - "low", - "close", - "open_raw", - "high_raw", - "low_raw", - "close_raw", - "volume0", - "volume1", - "last_trade_id", - "trade_count" - ] - }, - "EnrichedTx": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "type": { - "type": "integer", - "format": "uint8", - "example": "1", - "maximum": 64, - "minimum": 1 - }, - "info": { - "type": "string", - "example": "{}" - }, - "event_info": { - "type": "string", - "example": "{}" - }, - "status": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "transaction_index": { - "type": "integer", - "format": "int64", - "example": "8761" - }, - "l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "account_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "722" - }, - "expire_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "block_height": { - "type": "integer", - "format": "int64", - "example": "45434" - }, - "queued_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "executed_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "sequence_index": { - "type": "integer", - "format": "int64", - "example": "8761" - }, - "parent_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "api_key_index": { - "type": "integer", - "format": "uint8", - "example": "0" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - }, - "committed_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "verified_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - } - }, - "title": "EnrichedTx", - "required": [ - "code", - "hash", - "type", - "info", - "event_info", - "status", - "transaction_index", - "l1_address", - "account_index", - "nonce", - "expire_at", - "block_height", - "queued_at", - "executed_at", - "sequence_index", - "parent_hash", - "api_key_index", - "transaction_time", - "committed_at", - "verified_at" - ] - }, - "ExchangeMetric": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "data": { - "type": "number", - "format": "double", - "example": "93566.25" - } - }, - "title": "ExchangeMetric", - "required": [ - "timestamp", - "data" - ] - }, - "ExchangeStats": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "total": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "order_book_stats": { - "type": "array", - "example": "1", - "items": { - "$ref": "#/definitions/OrderBookStats" - } - }, - "daily_usd_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - } - }, - "title": "ExchangeStats", - "required": [ - "code", - "total", - "order_book_stats", - "daily_usd_volume", - "daily_trades_count" - ] - }, - "ExecuteStat": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "slippage": { - "type": "array", - "items": { - "$ref": "#/definitions/SlippageResult" - } - } - }, - "title": "ExecuteStat", - "required": [ - "timestamp", - "slippage" - ] - }, - "ExportData": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "data_url": { - "type": "string" - } - }, - "title": "ExportData", - "required": [ - "code", - "data_url" - ] - }, - "Funding": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "value": { - "type": "string", - "example": "0.0001" - }, - "rate": { - "type": "string", - "example": "0.0001" - }, - "direction": { - "type": "string", - "example": "long" - } - }, - "title": "Funding", - "required": [ - "timestamp", - "value", - "rate", - "direction" - ] - }, - "FundingRate": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "exchange": { - "type": "string", - "enum": [ - "binance", - "bybit", - "hyperliquid", - "lighter" - ] - }, - "symbol": { - "type": "string" - }, - "rate": { - "type": "number", - "format": "double" - } - }, - "title": "FundingRate", - "required": [ - "market_id", - "exchange", - "symbol", - "rate" - ] - }, - "FundingRates": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "funding_rates": { - "type": "array", - "items": { - "$ref": "#/definitions/FundingRate" - } - } - }, - "title": "FundingRates", - "required": [ - "code", - "funding_rates" - ] - }, - "Fundings": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "resolution": { - "type": "string", - "example": "1h" - }, - "fundings": { - "type": "array", - "items": { - "$ref": "#/definitions/Funding" - } - } - }, - "title": "Fundings", - "required": [ - "code", - "resolution", - "fundings" - ] - }, - "L1Metadata": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - }, - "can_invite": { - "type": "boolean", - "format": "boolean" - }, - "referral_points_percentage": { - "type": "string" - } - }, - "title": "L1Metadata", - "required": [ - "l1_address", - "can_invite", - "referral_points_percentage" - ] - }, - "L1ProviderInfo": { - "type": "object", - "properties": { - "chainId": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "networkId": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "latestBlockNumber": { - "type": "integer", - "format": "int64", - "example": "45434" - } - }, - "title": "L1ProviderInfo", - "required": [ - "chainId", - "networkId", - "latestBlockNumber" - ] - }, - "LeaseEntry": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "master_account_index": { - "type": "integer", - "format": "int64" - }, - "lease_amount": { - "type": "integer", - "format": "int64" - }, - "fee_amount": { - "type": "integer", - "format": "int64" - }, - "start": { - "type": "integer", - "format": "int64" - }, - "end": { - "type": "integer", - "format": "int64" - }, - "status": { - "type": "string", - "enum": [ - "waiting_fee", - "leased", - "expired", - "canceled" - ] - }, - "error": { - "type": "string" - } - }, - "title": "LeaseEntry", - "required": [ - "id", - "master_account_index", - "lease_amount", - "fee_amount", - "start", - "end", - "status", - "error" - ] - }, - "LeaseOptionEntry": { - "type": "object", - "properties": { - "duration_days": { - "type": "integer", - "format": "int32" - }, - "annual_rate": { - "type": "number", - "format": "double" - } - }, - "title": "LeaseOptionEntry", - "required": [ - "duration_days", - "annual_rate" - ] - }, - "LiqTrade": { - "type": "object", - "properties": { - "price": { - "type": "string" - }, - "size": { - "type": "string" - }, - "taker_fee": { - "type": "string" - }, - "maker_fee": { - "type": "string" - }, - "transaction_time": { - "type": "integer", - "format": "int64" - } - }, - "title": "LiqTrade", - "required": [ - "price", - "size", - "taker_fee", - "maker_fee", - "transaction_time" - ] - }, - "Liquidation": { - "type": "object", - "properties": { - "id": { - "type": "integer", - "format": "int64" - }, - "market_id": { - "type": "integer", - "format": "int16" - }, - "type": { - "type": "string", - "enum": [ - "partial", - "deleverage" - ] - }, - "trade": { - "$ref": "#/definitions/LiqTrade" - }, - "info": { - "$ref": "#/definitions/LiquidationInfo" - }, - "executed_at": { - "type": "integer", - "format": "int64" - } - }, - "title": "Liquidation", - "required": [ - "id", - "market_id", - "type", - "trade", - "info", - "executed_at" - ] - }, - "LiquidationInfo": { - "type": "object", - "properties": { - "positions": { - "type": "array", - "items": { - "$ref": "#/definitions/AccountPosition" + "schemas": { + "Account": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_type": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "account_trading_mode": { + "type": "integer", + "format": "uint8", + "example": "1", + "description": "Classic=0 and Unified=1" + }, + "index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "cancel_all_time": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "total_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "total_isolated_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "pending_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "available_balance": { + "type": "string", + "example": "19995" + }, + "status": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "collateral": { + "type": "string", + "example": "46342" + }, + "transaction_time": { + "type": "integer", + "format": "int64" } }, - "risk_info_before": { - "$ref": "#/definitions/RiskInfo" - }, - "risk_info_after": { - "$ref": "#/definitions/RiskInfo" - }, - "mark_prices": { - "type": "object", - "additionalProperties": { - "type": "number", - "format": "double" + "title": "Account", + "required": [ + "code", + "account_type", + "index", + "l1_address", + "cancel_all_time", + "total_order_count", + "total_isolated_order_count", + "pending_order_count", + "available_balance", + "status", + "collateral", + "account_trading_mode", + "transaction_time" + ] + }, + "AccountAsset": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "USDC" + }, + "asset_id": { + "type": "integer", + "format": "int16", + "example": 1 + }, + "balance": { + "type": "string", + "example": "1000" + }, + "locked_balance": { + "type": "string", + "example": "1000" + }, + "margin_balance": { + "type": "string", + "example": "1000" + }, + "margin_mode": { + "type": "string", + "example": "enabled", + "enum": [ + "enabled", + "disabled" + ] } - } - }, - "title": "LiquidationInfo", - "required": [ - "positions", - "risk_info_before", - "risk_info_after", - "mark_prices" - ] - }, - "LiquidationInfos": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" }, - "message": { - "type": "string" - }, - "liquidations": { - "type": "array", - "items": { - "$ref": "#/definitions/Liquidation" + "title": "AccountAsset", + "required": [ + "symbol", + "asset_id", + "balance", + "locked_balance", + "margin_balance", + "margin_mode" + ] + }, + "AccountApiKeys": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "api_keys": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApiKey" + } } }, - "next_cursor": { - "type": "string" - } - }, - "title": "LiquidationInfos", - "required": [ - "code", - "liquidations" - ] - }, - "MarketConfig": { - "type": "object", - "properties": { - "market_margin_mode": { - "type": "integer", - "format": "int32" - }, - "insurance_fund_account_index": { - "type": "integer", - "format": "int64" - }, - "liquidation_mode": { - "type": "integer", - "format": "int32" - }, - "force_reduce_only": { - "type": "boolean", - "format": "boolean" - }, - "trading_hours": { - "type": "string" - }, - "funding_fee_discounts_enabled": { - "type": "boolean", - "format": "boolean" - }, - "hidden": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "MarketConfig", - "required": [ - "market_margin_mode", - "insurance_fund_account_index", - "liquidation_mode", - "force_reduce_only", - "trading_hours", - "funding_fee_discounts_enabled", - "hidden" - ] - }, - "NextNonce": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "722" - } - }, - "title": "NextNonce", - "required": [ - "code", - "nonce" - ] - }, - "Order": { - "type": "object", - "properties": { - "order_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "client_order_index": { - "type": "integer", - "format": "int64", - "example": "234" - }, - "order_id": { - "type": "string", - "example": "1" - }, - "client_order_id": { - "type": "string", - "example": "234" - }, - "market_index": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "owner_account_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "initial_base_amount": { - "type": "string", - "example": "0.1" - }, - "price": { - "type": "string", - "example": "3024.66" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "722" - }, - "remaining_base_amount": { - "type": "string", - "example": "0.1" - }, - "is_ask": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "base_size": { - "type": "integer", - "format": "int64", - "example": "12354" - }, - "base_price": { - "type": "integer", - "format": "int32", - "example": "3024" - }, - "filled_base_amount": { - "type": "string", - "example": "0.1" - }, - "filled_quote_amount": { - "type": "string", - "example": "0.1" - }, - "side": { - "type": "string", - "example": "buy", - "default": "buy", - "description": " TODO: remove this" - }, - "type": { - "type": "string", - "example": "limit", - "enum": [ - "limit", - "market", - "stop-loss", - "stop-loss-limit", - "take-profit", - "take-profit-limit", - "twap", - "twap-sub", - "liquidation" - ] - }, - "time_in_force": { - "type": "string", - "enum": [ - "good-till-time", - "immediate-or-cancel", - "post-only", - "Unknown" - ], - "default": "good-till-time" - }, - "reduce_only": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "trigger_price": { - "type": "string", - "example": "3024.66" - }, - "order_expiry": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "status": { - "type": "string", - "example": "open", - "enum": [ - "in-progress", - "pending", - "open", - "filled", - "canceled", - "canceled-post-only", - "canceled-reduce-only", - "canceled-position-not-allowed", - "canceled-margin-not-allowed", - "canceled-too-much-slippage", - "canceled-not-enough-liquidity", - "canceled-self-trade", - "canceled-expired", - "canceled-oco", - "canceled-child", - "canceled-liquidation", - "canceled-invalid-balance" - ] - }, - "trigger_status": { - "type": "string", - "example": "twap", - "enum": [ - "na", - "ready", - "mark-price", - "twap", - "parent-order" - ] - }, - "trigger_time": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "parent_order_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "parent_order_id": { - "type": "string", - "example": "1" - }, - "to_trigger_order_id_0": { - "type": "string", - "example": "1" - }, - "to_trigger_order_id_1": { - "type": "string", - "example": "1" - }, - "to_cancel_order_id_0": { - "type": "string", - "example": "1" - }, - "integrator_fee_collector_index": { - "type": "string", - "example": "1" - }, - "integrator_taker_fee": { - "type": "string", - "example": "1" - }, - "integrator_maker_fee": { - "type": "string", - "example": "1" - }, - "block_height": { - "type": "integer", - "format": "int64", - "example": "45434" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "created_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "updated_at": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - } - }, - "title": "Order", - "required": [ - "order_index", - "client_order_index", - "order_id", - "client_order_id", - "market_index", - "owner_account_index", - "initial_base_amount", - "price", - "nonce", - "remaining_base_amount", - "is_ask", - "base_size", - "base_price", - "filled_base_amount", - "filled_quote_amount", - "side", - "type", - "time_in_force", - "reduce_only", - "trigger_price", - "order_expiry", - "status", - "trigger_status", - "trigger_time", - "parent_order_index", - "parent_order_id", - "to_trigger_order_id_0", - "to_trigger_order_id_1", - "to_cancel_order_id_0", - "integrator_fee_collector_index", - "integrator_taker_fee", - "integrator_maker_fee", - "block_height", - "timestamp", - "created_at", - "updated_at", - "transaction_time" - ] - }, - "OrderBook": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "market_type": { - "type": "string", - "example": "perp", - "enum": [ - "perp", - "spot" - ] - }, - "base_asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "quote_asset_id": { - "type": "integer", - "format": "int16", - "example": "2" - }, - "status": { - "type": "string", - "example": "active", - "enum": [ - "inactive", - "active" - ] - }, - "taker_fee": { - "type": "string", - "example": "0.0001" - }, - "maker_fee": { - "type": "string", - "example": "0.0000" - }, - "liquidation_fee": { - "type": "string", - "example": "0.01" - }, - "min_base_amount": { - "type": "string", - "example": "0.01" - }, - "min_quote_amount": { - "type": "string", - "example": "0.1" - }, - "order_quote_limit": { - "type": "string", - "example": "235.25" - }, - "supported_size_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_price_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_quote_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - } - }, - "title": "OrderBook", - "required": [ - "symbol", - "market_id", - "market_type", - "base_asset_id", - "quote_asset_id", - "status", - "taker_fee", - "maker_fee", - "liquidation_fee", - "min_base_amount", - "min_quote_amount", - "order_quote_limit", - "supported_size_decimals", - "supported_price_decimals", - "supported_quote_decimals" - ] - }, - "OrderBookDepth": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "asks": { - "type": "array", - "items": { - "$ref": "#/definitions/PriceLevel" - } - }, - "bids": { - "type": "array", - "items": { - "$ref": "#/definitions/PriceLevel" - } - }, - "offset": { - "type": "integer", - "format": "int64", - "example": "0" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "0" - } + "title": "AccountApiKeys", + "required": [ + "code", + "api_keys" + ] }, - "title": "OrderBookDepth", - "required": [ - "code", - "asks", - "bids", - "offset", - "nonce" - ] - }, - "OrderBookDepthWithBeginNonce": { - "type": "object", - "properties": { - "asks": { - "type": "array", - "items": { - "$ref": "#/definitions/PriceLevel" - } - }, - "bids": { - "type": "array", - "items": { - "$ref": "#/definitions/PriceLevel" - } - }, - "offset": { - "type": "integer", - "format": "int64", - "example": "0" - }, - "nonce": { - "type": "integer", - "format": "int64", - "example": "0" - }, - "begin_nonce": { - "type": "integer", - "format": "int64", - "example": "0" - } - }, - "title": "OrderBookDepthWithBeginNonce", - "required": [ - "asks", - "bids", - "offset", - "nonce", - "begin_nonce" - ] - }, - "OrderBookDetails": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "order_book_details": { - "type": "array", - "items": { - "$ref": "#/definitions/PerpsOrderBookDetail" + "AccountLimits": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "max_llp_percentage": { + "type": "integer", + "format": "int32", + "example": "25" + }, + "user_tier": { + "type": "string", + "example": "std" + }, + "can_create_public_pool": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "max_llp_amount": { + "type": "string", + "example": "1000000" + }, + "current_maker_fee_tick": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "current_taker_fee_tick": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "effective_lit_stakes": { + "type": "string", + "description": "Effective staked LIT shares including active leases." + }, + "leased_lit": { + "type": "string", + "description": "Total actively leased LIT." + }, + "user_tier_name": { + "type": "string", + "example": "standard" + } + }, + "title": "AccountLimits", + "required": [ + "code", + "max_llp_percentage", + "user_tier", + "can_create_public_pool", + "max_llp_amount", + "current_maker_fee_tick", + "current_taker_fee_tick", + "effective_lit_stakes", + "leased_lit", + "user_tier_name" + ] + }, + "AccountMarginStats": { + "type": "object", + "properties": { + "collateral": { + "type": "string", + "example": "199955" + }, + "portfolio_value": { + "type": "string", + "example": "199955" + }, + "leverage": { + "type": "string", + "example": "1.0" + }, + "available_balance": { + "type": "string", + "example": "199955" + }, + "margin_usage": { + "type": "string", + "example": "0.0" + }, + "buying_power": { + "type": "string", + "example": "199955" + } + }, + "title": "AccountMarginStats", + "required": [ + "collateral", + "portfolio_value", + "leverage", + "available_balance", + "margin_usage", + "buying_power" + ] + }, + "AccountMarketStats": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "weekly_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "weekly_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "weekly_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "monthly_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "monthly_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "monthly_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "total_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "total_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "total_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + } + }, + "title": "AccountMarketStats", + "required": [ + "market_id", + "daily_trades_count", + "daily_base_token_volume", + "daily_quote_token_volume", + "weekly_trades_count", + "weekly_base_token_volume", + "weekly_quote_token_volume", + "monthly_trades_count", + "monthly_base_token_volume", + "monthly_quote_token_volume", + "total_trades_count", + "total_base_token_volume", + "total_quote_token_volume" + ] + }, + "AccountMetadata": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "can_invite": { + "type": "boolean", + "format": "boolean", + "description": " Remove After FE uses L1 meta endpoint" + }, + "referral_points_percentage": { + "type": "string", + "description": " Remove After FE uses L1 meta endpoint" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "can_rfq": { + "type": "boolean", + "format": "boolean" + } + }, + "title": "AccountMetadata", + "required": [ + "account_index", + "name", + "description", + "can_invite", + "referral_points_percentage", + "created_at", + "can_rfq" + ] + }, + "AccountMetadatas": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_metadatas": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AccountMetadata" + } } }, - "spot_order_book_details": { - "type": "array", - "items": { - "$ref": "#/definitions/SpotOrderBookDetail" - } - } + "title": "AccountMetadatas", + "required": [ + "code", + "account_metadatas" + ] }, - "title": "OrderBookDetails", - "required": [ - "code", - "order_book_details", - "spot_order_book_details" - ] - }, - "OrderBookOrders": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "total_asks": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "asks": { - "type": "array", - "items": { - "$ref": "#/definitions/SimpleOrder" - } - }, - "total_bids": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "bids": { - "type": "array", - "items": { - "$ref": "#/definitions/SimpleOrder" - } - } - }, - "title": "OrderBookOrders", - "required": [ - "code", - "total_asks", - "asks", - "total_bids", - "bids" - ] - }, - "OrderBookStats": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH" - }, - "last_trade_price": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_price_change": { - "type": "number", - "format": "double", - "example": "3.66" - } - }, - "title": "OrderBookStats", - "required": [ - "symbol", - "last_trade_price", - "daily_trades_count", - "daily_base_token_volume", - "daily_quote_token_volume", - "daily_price_change" - ] - }, - "OrderBooks": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "order_books": { - "type": "array", - "items": { - "$ref": "#/definitions/OrderBook" + "AccountPnL": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "resolution": { + "type": "string", + "example": "15m" + }, + "pnl": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PnLEntry" + } } - } - }, - "title": "OrderBooks", - "required": [ - "code", - "order_books" - ] - }, - "Orders": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "next_cursor": { - "type": "string" }, - "orders": { - "type": "array", - "items": { - "$ref": "#/definitions/Order" - } - } - }, - "title": "Orders", - "required": [ - "code", - "orders" - ] - }, - "PendingUnlock": { - "type": "object", - "properties": { - "unlock_timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "asset_index": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "amount": { - "type": "string", - "example": "1" - } - }, - "title": "PendingUnlock", - "required": [ - "unlock_timestamp", - "asset_index", - "amount" - ] - }, - "PerpsMarketStats": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "index_price": { - "type": "string", - "example": "3024.66" - }, - "mark_price": { - "type": "string", - "example": "3024.66" - }, - "open_interest": { - "type": "string", - "example": "235.25" - }, - "open_interest_limit": { - "type": "string", - "example": "235.25" - }, - "funding_clamp_small": { - "type": "string", - "example": "0.005" - }, - "funding_clamp_big": { - "type": "string", - "example": "0.4" - }, - "last_trade_price": { - "type": "string", - "example": "3024.66" - }, - "current_funding_rate": { - "type": "string", - "example": "0.0001" - }, - "funding_rate": { - "type": "string", - "example": "0.0001" - }, - "funding_timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_price_low": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "daily_price_high": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_price_change": { - "type": "number", - "format": "double", - "example": "3.66" - } + "title": "AccountPnL", + "required": [ + "code", + "resolution", + "pnl" + ] }, - "title": "PerpsMarketStats", - "required": [ - "symbol", - "market_id", - "index_price", - "mark_price", - "open_interest", - "open_interest_limit", - "funding_clamp_small", - "funding_clamp_big", - "last_trade_price", - "current_funding_rate", - "funding_rate", - "funding_timestamp", - "daily_base_token_volume", - "daily_quote_token_volume", - "daily_price_low", - "daily_price_high", - "daily_price_change" - ] - }, - "PerpsOrderBookDetail": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "market_type": { - "type": "string", - "example": "perp", - "enum": [ - "perp", - "spot" - ] - }, - "base_asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "quote_asset_id": { - "type": "integer", - "format": "int16", - "example": "2" - }, - "status": { - "type": "string", - "example": "active", - "enum": [ - "inactive", - "active" - ] - }, - "taker_fee": { - "type": "string", - "example": "0.0001" - }, - "maker_fee": { - "type": "string", - "example": "0.0000" - }, - "liquidation_fee": { - "type": "string", - "example": "0.01" - }, - "min_base_amount": { - "type": "string", - "example": "0.01" - }, - "min_quote_amount": { - "type": "string", - "example": "0.1" - }, - "order_quote_limit": { - "type": "string", - "example": "235.25" - }, - "supported_size_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_price_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_quote_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "size_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "price_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "quote_multiplier": { - "type": "integer", - "format": "int64", - "example": "10000" - }, - "default_initial_margin_fraction": { - "type": "integer", - "format": "uin16", - "example": "100" - }, - "min_initial_margin_fraction": { - "type": "integer", - "format": "uin16", - "example": "100" - }, - "maintenance_margin_fraction": { - "type": "integer", - "format": "uin16", - "example": "50" - }, - "closeout_margin_fraction": { - "type": "integer", - "format": "uin16", - "example": "100" - }, - "last_trade_price": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_price_low": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "daily_price_high": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_price_change": { - "type": "number", - "format": "double", - "example": "3.66" - }, - "open_interest": { - "type": "number", - "format": "double", - "example": "93.0" - }, - "daily_chart": { - "type": "object", - "example": "{1640995200:3024.66}", - "additionalProperties": { - "type": "number", - "format": "double" - } - }, - "market_config": { - "$ref": "#/definitions/MarketConfig" - }, - "strategy_index": { - "type": "integer", - "format": "uint8" - } - }, - "title": "PerpsOrderBookDetail", - "required": [ - "symbol", - "market_id", - "market_type", - "base_asset_id", - "quote_asset_id", - "status", - "taker_fee", - "maker_fee", - "liquidation_fee", - "min_base_amount", - "min_quote_amount", - "order_quote_limit", - "supported_size_decimals", - "supported_price_decimals", - "supported_quote_decimals", - "size_decimals", - "price_decimals", - "quote_multiplier", - "default_initial_margin_fraction", - "min_initial_margin_fraction", - "maintenance_margin_fraction", - "closeout_margin_fraction", - "last_trade_price", - "daily_trades_count", - "daily_base_token_volume", - "daily_quote_token_volume", - "daily_price_low", - "daily_price_high", - "daily_price_change", - "open_interest", - "daily_chart", - "market_config", - "strategy_index" - ] - }, - "PnLEntry": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "trade_pnl": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "trade_spot_pnl": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "inflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "outflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "spot_outflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "spot_inflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "pool_pnl": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "pool_inflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "pool_outflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "staking_pnl": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "staking_inflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "staking_outflow": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "pool_total_shares": { - "type": "number", - "format": "double", - "example": "12.0" - }, - "staked_lit": { - "type": "number", - "format": "double", - "example": "12.0" - } - }, - "title": "PnLEntry", - "required": [ - "timestamp", - "trade_pnl", - "trade_spot_pnl", - "inflow", - "outflow", - "spot_outflow", - "spot_inflow", - "pool_pnl", - "pool_inflow", - "pool_outflow", - "staking_pnl", - "staking_inflow", - "staking_outflow", - "pool_total_shares", - "staked_lit" - ] - }, - "PositionFunding": { - "type": "object", - "properties": { - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "funding_id": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "change": { - "type": "string", - "example": "1" - }, - "rate": { - "type": "string", - "example": "1" - }, - "position_size": { - "type": "string", - "example": "1" - }, - "position_side": { - "type": "string", - "example": "long", - "enum": [ - "long", - "short" - ] - }, - "discount": { - "type": "string", - "example": "1" - } - }, - "title": "PositionFunding", - "required": [ - "timestamp", - "market_id", - "funding_id", - "change", - "rate", - "position_size", - "position_side", - "discount" - ] - }, - "PositionFundings": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" + "AccountPosition": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "symbol": { + "type": "string", + "example": "ETH" + }, + "initial_margin_fraction": { + "type": "string", + "example": "20.00" + }, + "open_order_count": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "pending_order_count": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "position_tied_order_count": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "sign": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "position": { + "type": "string", + "example": "3.6956" + }, + "avg_entry_price": { + "type": "string", + "example": "3024.66" + }, + "position_value": { + "type": "string", + "example": "3019.92" + }, + "unrealized_pnl": { + "type": "string", + "example": "17.521309" + }, + "realized_pnl": { + "type": "string", + "example": "2.000000" + }, + "liquidation_price": { + "type": "string", + "example": "3024.66" + }, + "total_funding_paid_out": { + "type": "string", + "example": "34.2" + }, + "margin_mode": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "allocated_margin": { + "type": "string", + "example": "46342" + }, + "total_discount": { + "type": "string" + } }, - "message": { - "type": "string" + "title": "AccountPosition", + "required": [ + "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", + "margin_mode", + "allocated_margin", + "total_discount" + ] + }, + "AccountStats": { + "type": "object", + "properties": { + "collateral": { + "type": "string", + "example": "199955" + }, + "portfolio_value": { + "type": "string", + "example": "199955" + }, + "leverage": { + "type": "string", + "example": "1.0" + }, + "available_balance": { + "type": "string", + "example": "199955" + }, + "margin_usage": { + "type": "string", + "example": "0.0" + }, + "buying_power": { + "type": "string", + "example": "199955" + }, + "cross_stats": { + "$ref": "#/components/schemas/AccountMarginStats" + }, + "total_stats": { + "$ref": "#/components/schemas/AccountMarginStats" + }, + "account_trading_mode": { + "type": "integer", + "format": "uint8" + } }, - "position_fundings": { - "type": "array", - "items": { - "$ref": "#/definitions/PositionFunding" + "title": "AccountStats", + "required": [ + "collateral", + "portfolio_value", + "leverage", + "available_balance", + "margin_usage", + "buying_power", + "cross_stats", + "total_stats", + "account_trading_mode" + ] + }, + "AccountTradeStats": { + "type": "object", + "properties": { + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "daily_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "weekly_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "weekly_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "monthly_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "monthly_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "total_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "total_volume": { + "type": "number", + "format": "double", + "example": "235.25" + } + }, + "title": "AccountTradeStats", + "required": [ + "daily_trades_count", + "daily_volume", + "weekly_trades_count", + "weekly_volume", + "monthly_trades_count", + "monthly_volume", + "total_trades_count", + "total_volume" + ] + }, + "Announcement": { + "type": "object", + "properties": { + "title": { + "type": "string" + }, + "content": { + "type": "string" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "expired_at": { + "type": "integer", + "format": "int64" } }, - "next_cursor": { - "type": "string" - } - }, - "title": "PositionFundings", - "required": [ - "code", - "position_fundings" - ] - }, - "PriceLevel": { - "type": "object", - "properties": { - "price": { - "type": "string", - "example": "3024.66" - }, - "size": { - "type": "string", - "example": "0.1" - } + "title": "Announcement", + "required": [ + "title", + "content", + "created_at", + "expired_at" + ] }, - "title": "PriceLevel", - "required": [ - "price", - "size" - ] - }, - "PublicPoolInfo": { - "type": "object", - "properties": { - "status": { - "type": "integer", - "format": "uint8", - "example": "0" - }, - "operator_fee": { - "type": "string", - "example": "100" - }, - "min_operator_share_rate": { - "type": "string", - "example": "200" - }, - "total_shares": { - "type": "integer", - "format": "int64", - "example": "100000" - }, - "operator_shares": { - "type": "integer", - "format": "int64", - "example": "20000" - }, - "annual_percentage_yield": { - "type": "number", - "format": "double", - "example": "20.5000" - }, - "sharpe_ratio": { - "type": "number", - "format": "double", - "example": "1.5" - }, - "daily_returns": { - "type": "array", - "items": { - "$ref": "#/definitions/DailyReturn" - } - }, - "share_prices": { - "type": "array", - "items": { - "$ref": "#/definitions/SharePrice" - } - }, - "strategies": { - "type": "array", - "items": { - "$ref": "#/definitions/Strategy" + "Announcements": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "announcements": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Announcement" + } } - } + }, + "title": "Announcements", + "required": [ + "code", + "announcements" + ] }, - "title": "PublicPoolInfo", - "required": [ - "status", - "operator_fee", - "min_operator_share_rate", - "total_shares", - "operator_shares", - "annual_percentage_yield", - "sharpe_ratio", - "daily_returns", - "share_prices", - "strategies" - ] - }, - "PublicPoolMetadata": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "account_index": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "created_at": { - "type": "integer", - "format": "int64" - }, - "master_account_index": { - "type": "integer", - "format": "int64", - "example": "61" - }, - "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" - }, - "sharpe_ratio": { - "type": "number", - "format": "double", - "example": "1.5" - }, - "status": { - "type": "integer", - "format": "uint8", - "example": "0" - }, - "operator_fee": { - "type": "string", - "example": "100" - }, - "total_asset_value": { - "type": "string", - "example": "19995" - }, - "total_spot_value": { - "type": "string", - "example": "19995" - }, - "total_perps_value": { - "type": "string", - "example": "19995" - }, - "total_shares": { - "type": "integer", - "format": "int64", - "example": "100000" - }, - "account_share": { - "$ref": "#/definitions/PublicPoolShare" - }, - "assets": { - "type": "array", - "items": { - "$ref": "#/definitions/AccountAsset" + "Asset": { + "type": "object", + "properties": { + "asset_id": { + "type": "integer", + "format": "int16", + "example": 1 + }, + "symbol": { + "type": "string", + "example": "ETH" + }, + "l1_decimals": { + "type": "integer", + "format": "uint8", + "example": 18 + }, + "decimals": { + "type": "integer", + "format": "uint8", + "example": 18 + }, + "min_transfer_amount": { + "type": "string", + "example": "0.01" + }, + "min_withdrawal_amount": { + "type": "string", + "example": "0.01" + }, + "margin_mode": { + "type": "string", + "example": "enabled", + "enum": [ + "enabled", + "disabled" + ] + }, + "index_price": { + "type": "string", + "example": "3024.66" + }, + "l1_address": { + "type": "string", + "example": "0x0000000000000000000000000000000000000000" + }, + "global_supply_cap": { + "type": "string", + "example": "1000000" + }, + "liquidation_fee": { + "type": "string", + "example": "0.01" + }, + "liquidation_threshold": { + "type": "string", + "example": "0.8" + }, + "loan_to_value": { + "type": "string", + "example": "0.5" + }, + "price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "total_supplied": { + "type": "string", + "example": "100" + }, + "user_supply_cap": { + "type": "string", + "example": "1000" + } + }, + "title": "Asset", + "required": [ + "asset_id", + "symbol", + "l1_decimals", + "decimals", + "min_transfer_amount", + "min_withdrawal_amount", + "margin_mode", + "index_price", + "l1_address", + "global_supply_cap", + "liquidation_fee", + "liquidation_threshold", + "loan_to_value", + "price_decimals", + "total_supplied", + "user_supply_cap" + ] + }, + "AssetDetails": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": 200 + }, + "message": { + "type": "string" + }, + "asset_details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Asset" + } } - } - }, - "title": "PublicPoolMetadata", - "required": [ - "code", - "account_index", - "created_at", - "master_account_index", - "account_type", - "name", - "l1_address", - "annual_percentage_yield", - "sharpe_ratio", - "status", - "operator_fee", - "total_asset_value", - "total_spot_value", - "total_perps_value", - "total_shares", - "assets" - ] - }, - "PublicPoolShare": { - "type": "object", - "properties": { - "public_pool_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "shares_amount": { - "type": "integer", - "format": "int64", - "example": "3000" - }, - "entry_usdc": { - "type": "string", - "example": "3000", - "description": " For public pools and insurance fund" - }, - "principal_amount": { - "type": "string", - "example": "3000" - }, - "entry_timestamp": { - "type": "integer", - "format": "int64", - "example": "3600000" - } + }, + "title": "AssetDetails", + "required": [ + "code", + "asset_details" + ] }, - "title": "PublicPoolShare", - "required": [ - "public_pool_index", - "shares_amount", - "entry_usdc", - "principal_amount", - "entry_timestamp" - ] - }, - "PushNotifDeliveryResult": { - "type": "object", - "properties": { - "expo_token": { - "type": "string" + "ApiKey": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "api_key_index": { + "type": "integer", + "format": "uint8", + "example": "0" + }, + "nonce": { + "type": "integer", + "format": "int64", + "example": "722" + }, + "public_key": { + "type": "string" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + } }, - "status": { - "type": "string" + "title": "ApiKey", + "required": [ + "account_index", + "api_key_index", + "nonce", + "public_key", + "transaction_time" + ] + }, + "Block": { + "type": "object", + "properties": { + "commitment": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "int64" + }, + "state_root": { + "type": "string" + }, + "priority_operations": { + "type": "integer", + "format": "int32" + }, + "on_chain_l2_operations": { + "type": "integer", + "format": "int32" + }, + "pending_on_chain_operations_pub_data": { + "type": "string" + }, + "committed_tx_hash": { + "type": "string" + }, + "committed_at": { + "type": "integer", + "format": "int64" + }, + "verified_tx_hash": { + "type": "string" + }, + "verified_at": { + "type": "integer", + "format": "int64" + }, + "txs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Tx" + } + }, + "status": { + "type": "integer", + "format": "int64" + }, + "size": { + "type": "integer", + "format": "uin16" + } + }, + "title": "Block", + "required": [ + "commitment", + "height", + "state_root", + "priority_operations", + "on_chain_l2_operations", + "pending_on_chain_operations_pub_data", + "committed_tx_hash", + "committed_at", + "verified_tx_hash", + "verified_at", + "txs", + "status", + "size" + ] + }, + "Blocks": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int64" + }, + "blocks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Block" + } + } }, - "error": { - "type": "string" - } + "title": "Blocks", + "required": [ + "code", + "total", + "blocks" + ] }, - "title": "PushNotifDeliveryResult", - "required": [ - "expo_token", - "status", - "error" - ] - }, - "Referral": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" + "BridgeSupportedNetwork": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "Arbitrum" + }, + "chain_id": { + "type": "string", + "example": "4164" + }, + "explorer": { + "type": "string", + "example": "https://arbiscan.io/" + } }, - "referral_code": { - "type": "string" + "title": "BridgeSupportedNetwork", + "required": [ + "name", + "chain_id", + "explorer" + ] + }, + "Candlestick": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "open": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "high": { + "type": "number", + "format": "double", + "example": "3034.66" + }, + "low": { + "type": "number", + "format": "double", + "example": "3014.66" + }, + "close": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "volume0": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "volume1": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "last_trade_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "close_raw": { + "type": "string" + }, + "high_raw": { + "type": "string" + }, + "low_raw": { + "type": "string" + }, + "open_raw": { + "type": "string" + }, + "trade_count": { + "type": "integer", + "format": "int64" + } }, - "used_at": { - "type": "integer", - "format": "int64" + "title": "Candlestick", + "required": [ + "timestamp", + "open", + "high", + "low", + "close", + "volume0", + "volume1", + "last_trade_id" + ] + }, + "Candlesticks": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "resolution": { + "type": "string", + "example": "15m" + }, + "candlesticks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Candlestick" + } + } }, - "trade_stats": { - "$ref": "#/definitions/TradeStats" - } + "title": "Candlesticks", + "required": [ + "code", + "resolution", + "candlesticks" + ] }, - "title": "Referral", - "required": [ - "l1_address", - "referral_code", - "used_at", - "trade_stats" - ] - }, - "ReqAckNotif": { - "type": "object", - "properties": { - "notif_id": { - "type": "string", - "example": "'liq:17:5898'" - }, - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - } - }, - "title": "ReqAckNotif", - "required": [ - "notif_id", - "account_index" - ] - }, - "ReqChangeAccountTier": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "new_tier": { - "type": "string" - } - }, - "title": "ReqChangeAccountTier", - "required": [ - "account_index", - "new_tier" - ] - }, - "ReqDoFaucet": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - }, - "do_l1_transfer": { - "type": "boolean", - "format": "boolean", - "default": "false" - } - }, - "title": "ReqDoFaucet", - "required": [ - "l1_address", - "do_l1_transfer" - ] - }, - "ReqExportData": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64", - "default": "-1" - }, - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "type": { - "type": "string", - "enum": [ - "funding", - "trade" - ] - }, - "start_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 1830297600000, - "minimum": 1735689600000 - }, - "end_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 1830297600000, - "minimum": 1735689600000 - }, - "side": { - "type": "string", - "enum": [ - "all", - "long", - "short" - ], - "default": "all" - }, - "role": { - "type": "string", - "enum": [ - "all", - "maker", - "taker" - ], - "default": "all" - }, - "trade_type": { - "type": "string", - "enum": [ - "all", - "trade", - "liquidation", - "deleverage", - "market-settlement" - ], - "default": "all" - } - }, - "title": "ReqExportData", - "required": [ - "type" - ] - }, - "ReqFastwithdraw": { - "type": "object", - "properties": { - "tx_info": { - "type": "string" - }, - "to_address": { - "type": "string" - }, - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - } - }, - "title": "ReqFastwithdraw", - "required": [ - "tx_info", - "to_address" - ] - }, - "ReqGetAccount": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "index", - "l1_address" - ] - }, - "value": { - "type": "string" - } - }, - "title": "ReqGetAccount", - "required": [ - "by", - "value" - ] - }, - "ReqGetAccountActiveOrders": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "market_id": { - "type": "integer", - "format": "int16" - } - }, - "title": "ReqGetAccountActiveOrders", - "required": [ - "account_index", - "market_id" - ] - }, - "ReqGetAccountApiKeys": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64" - }, - "api_key_index": { - "type": "integer", - "format": "uint8", - "default": "255" - } - }, - "title": "ReqGetAccountApiKeys", - "required": [ - "account_index" - ] - }, - "ReqGetAccountByL1Address": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - } - }, - "title": "ReqGetAccountByL1Address", - "required": [ - "l1_address" - ] - }, - "ReqGetAccountInactiveOrders": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "ask_filter": { - "type": "integer", - "format": "int8", - "default": "-1" - }, - "between_timestamps": { - "type": "string" - }, - "cursor": { - "type": "string" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - } - }, - "title": "ReqGetAccountInactiveOrders", - "required": [ - "account_index", - "limit" - ] - }, - "ReqGetAccountLimits": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64" - }, - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - } - }, - "title": "ReqGetAccountLimits", - "required": [ - "account_index" - ] - }, - "ReqGetAccountMetadata": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "index", - "l1_address" - ] - }, - "value": { - "type": "string" - }, - "auth": { - "type": "string" - } - }, - "title": "ReqGetAccountMetadata", - "required": [ - "by", - "value" - ] - }, - "ReqGetAccountPnL": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "by": { - "type": "string", - "enum": [ - "index" - ] - }, - "value": { - "type": "string" - }, - "resolution": { - "type": "string", - "enum": [ - "1m", - "5m", - "15m", - "1h", - "4h", - "1d" - ] - }, - "start_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "end_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "count_back": { - "type": "integer", - "format": "int64" - }, - "ignore_transfers": { - "type": "boolean", - "format": "boolean", - "default": "false" - } - }, - "title": "ReqGetAccountPnL", - "required": [ - "by", - "value", - "resolution", - "start_timestamp", - "end_timestamp", - "count_back" - ] - }, - "ReqGetAccountTxs": { - "type": "object", - "properties": { - "index": { - "type": "integer", - "format": "int64" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - }, - "by": { - "type": "string", - "enum": [ - "account_index" - ] - }, - "value": { - "type": "string" - }, - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "types": { - "type": "array", - "items": { + "Candle": { + "type": "object", + "properties": { + "t": { "type": "integer", - "format": "uint8" + "format": "int64", + "example": 1767700500000, + "description": "Timestamp" + }, + "o": { + "type": "number", + "format": "double", + "example": 3236.86, + "description": "Open price" + }, + "h": { + "type": "number", + "format": "double", + "example": 3237.78, + "description": "High price" + }, + "l": { + "type": "number", + "format": "double", + "example": 3235.36, + "description": "Low price" + }, + "c": { + "type": "number", + "format": "double", + "example": 3235.39, + "description": "Close price" + }, + "v": { + "type": "number", + "format": "double", + "example": 55.1632, + "description": "Base token volume (volume0)" + }, + "V": { + "type": "number", + "format": "double", + "example": 178530.793575, + "description": "Quote token volume (volume1)" + }, + "i": { + "type": "integer", + "format": "int64", + "example": 779870452, + "description": "Last trade ID" + }, + "C": { + "type": "number", + "format": "double", + "example": "3024.66", + "description": " close_raw" + }, + "H": { + "type": "number", + "format": "double", + "example": "3034.66", + "description": " high_raw" + }, + "L": { + "type": "number", + "format": "double", + "example": "3014.66", + "description": " low_raw" + }, + "O": { + "type": "number", + "format": "double", + "example": "3024.66", + "description": " open_raw" } - } - }, - "title": "ReqGetAccountTxs" - }, - "ReqGetApiTokens": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64" - } - }, - "title": "ReqGetApiTokens", - "required": [ - "account_index" - ] - }, - "ReqGetAssetDetails": { - "type": "object", - "properties": { - "asset_id": { - "type": "integer", - "format": "int16", - "default": "0" - } - }, - "title": "ReqGetAssetDetails" - }, - "ReqGetBlock": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "commitment", - "height" - ] - }, - "value": { - "type": "string" - } - }, - "title": "ReqGetBlock", - "required": [ - "by", - "value" - ] - }, - "ReqGetBlockTxs": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "block_height", - "block_commitment" - ] - }, - "value": { - "type": "string" - } - }, - "title": "ReqGetBlockTxs", - "required": [ - "by", - "value" - ] - }, - "ReqGetBridgesByL1Addr": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - } - }, - "title": "ReqGetBridgesByL1Addr", - "required": [ - "l1_address" - ] - }, - "ReqGetByAccount": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "account_index" - ] - }, - "value": { - "type": "string" - } - }, - "title": "ReqGetByAccount", - "required": [ - "by", - "value" - ] - }, - "ReqGetCandles": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "resolution": { - "type": "string", - "enum": [ - "1m", - "5m", - "15m", - "30m", - "1h", - "4h", - "12h", - "1d", - "1w" - ] - }, - "start_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "end_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "count_back": { - "type": "integer", - "format": "int64" - }, - "set_timestamp_to_end": { - "type": "boolean", - "format": "boolean", - "default": "false" - } - }, - "title": "ReqGetCandles", - "required": [ - "market_id", - "resolution", - "start_timestamp", - "end_timestamp", - "count_back" - ] - }, - "ReqGetDepositHistory": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "l1_address": { - "type": "string" - }, - "cursor": { - "type": "string" - }, - "filter": { - "type": "string", - "enum": [ - "all", - "pending", - "claimable" - ] - } - }, - "title": "ReqGetDepositHistory", - "required": [ - "account_index", - "l1_address" - ] - }, - "ReqGetExchangeMetrics": { - "type": "object", - "properties": { - "period": { - "type": "string", - "enum": [ - "h", - "d", - "w", - "m", - "q", - "y", - "all" - ] - }, - "kind": { - "type": "string", - "enum": [ - "volume", - "maker_fee", - "taker_fee", - "liquidation_fee", - "trade_count", - "liquidation_count", - "liquidation_volume", - "inflow", - "outflow", - "transfer_fee", - "withdraw_fee", - "open_interest", - "account_count", - "active_account_count", - "tps" - ] - }, - "filter": { - "type": "string", - "enum": [ - "byMarket" - ] - }, - "value": { - "type": "string" - } - }, - "title": "ReqGetExchangeMetrics", - "required": [ - "period", - "kind" - ] - }, - "ReqGetExchangeStats": { - "type": "object", - "title": "ReqGetExchangeStats" - }, - "ReqGetExecuteStats": { - "type": "object", - "properties": { - "period": { - "type": "string", - "enum": [ - "d", - "w", - "m", - "q", - "y", - "all" - ] - } + }, + "title": "Candle", + "description": "Abbreviated candle format. Zero values are omitted." }, - "title": "ReqGetExecuteStats", - "required": [ - "period" - ] - }, - "ReqGetFastWithdrawInfo": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - } + "Candles": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": 200 + }, + "r": { + "type": "string", + "example": "1m", + "description": "Resolution" + }, + "c": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Candle" + }, + "description": "Array of candles (max 500 per call)" + }, + "message": { + "type": "string" + } + }, + "title": "Candles", + "required": [ + "code", + "r", + "c" + ] }, - "title": "ReqGetFastWithdrawInfo", - "required": [ - "account_index" - ] - }, - "ReqGetFundings": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "resolution": { - "type": "string", - "enum": [ - "1h", - "1d" - ] - }, - "start_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "end_timestamp": { - "type": "integer", - "format": "int64", - "maximum": 5000000000000 - }, - "count_back": { - "type": "integer", - "format": "int64" - } + "ContractAddress": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "1" + }, + "address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + } + }, + "title": "ContractAddress", + "required": [ + "name", + "address" + ] }, - "title": "ReqGetFundings", - "required": [ - "market_id", - "resolution", - "start_timestamp", - "end_timestamp", - "count_back" - ] - }, - "ReqGetGeckoContracts": { - "type": "object", - "title": "ReqGetGeckoContracts" - }, - "ReqGetGeckoTickers": { - "type": "object", - "title": "ReqGetGeckoTickers" - }, - "ReqGetL1Metadata": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "l1_address": { - "type": "string" - } + "CurrentHeight": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "int64" + } + }, + "title": "CurrentHeight", + "required": [ + "code", + "height" + ] }, - "title": "ReqGetL1Metadata", - "required": [ - "l1_address" - ] - }, - "ReqGetL1Tx": { - "type": "object", - "properties": { - "hash": { - "type": "string" - } + "Cursor": { + "type": "object", + "properties": { + "next_cursor": { + "type": "string" + } + }, + "title": "Cursor" }, - "title": "ReqGetL1Tx", - "required": [ - "hash" - ] - }, - "ReqGetLatestDeposit": { - "type": "object", - "properties": { - "l1_address": { - "type": "string" - } + "DailyReturn": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "daily_return": { + "type": "number", + "format": "double", + "example": "0.0001" + } + }, + "title": "DailyReturn", + "required": [ + "timestamp", + "daily_return" + ] }, - "title": "ReqGetLatestDeposit", - "required": [ - "l1_address" - ] - }, - "ReqGetLeases": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "cursor": { - "type": "string" - }, - "limit": { - "type": "integer", - "format": "int64", - "default": "20" - } + "DepositHistory": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "deposits": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DepositHistoryItem" + } + }, + "cursor": { + "type": "string" + } + }, + "title": "DepositHistory", + "required": [ + "code", + "deposits", + "cursor" + ] }, - "title": "ReqGetLeases", - "required": [ - "account_index" - ] - }, - "ReqGetLiquidationInfos": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "cursor": { - "type": "string" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - } + "DepositHistoryItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "amount": { + "type": "string", + "example": "0.1" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "status": { + "type": "string", + "enum": [ + "failed", + "pending", + "completed", + "claimable" + ] + }, + "l1_tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "asset_id": { + "type": "integer", + "format": "int16" + } + }, + "title": "DepositHistoryItem", + "required": [ + "id", + "amount", + "timestamp", + "status", + "l1_tx_hash", + "asset_id" + ] + }, + "DetailedAccount": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_type": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "account_trading_mode": { + "type": "integer", + "format": "uint8", + "example": "1", + "description": "Classic=0 and Unified=1" + }, + "index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "cancel_all_time": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "total_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "total_isolated_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "pending_order_count": { + "type": "integer", + "format": "int64", + "example": "100" + }, + "available_balance": { + "type": "string", + "example": "19995" + }, + "status": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "collateral": { + "type": "string", + "example": "46342" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "can_invite": { + "type": "boolean", + "format": "boolean", + "description": " Remove After FE uses L1 meta endpoint" + }, + "referral_points_percentage": { + "type": "string", + "description": " Remove After FE uses L1 meta endpoint" + }, + "positions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AccountPosition" + } + }, + "assets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AccountAsset" + } + }, + "total_asset_value": { + "type": "string", + "example": "19995" + }, + "cross_asset_value": { + "type": "string", + "example": "19995" + }, + "pool_info": { + "$ref": "#/components/schemas/PublicPoolInfo" + }, + "shares": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicPoolShare" + } + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + }, + "pending_unlocks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PendingUnlock" + } + }, + "approved_integrators": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApprovedIntegrator" + } + }, + "can_rfq": { + "type": "boolean", + "format": "boolean" + }, + "cross_initial_margin_requirement": { + "type": "string", + "example": "5998.500000" + }, + "cross_maintenance_margin_requirement": { + "type": "string", + "example": "2999.250000" + } + }, + "title": "DetailedAccount", + "required": [ + "code", + "account_type", + "index", + "l1_address", + "cancel_all_time", + "total_order_count", + "total_isolated_order_count", + "pending_order_count", + "available_balance", + "status", + "collateral", + "account_index", + "name", + "description", + "can_invite", + "referral_points_percentage", + "positions", + "assets", + "total_asset_value", + "cross_asset_value", + "pool_info", + "shares", + "account_trading_mode", + "created_at", + "pending_unlocks", + "transaction_time", + "can_rfq" + ] + }, + "DetailedAccounts": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "accounts": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DetailedAccount" + } + }, + "next_cursor": { + "type": "string" + } + }, + "title": "DetailedAccounts", + "required": [ + "code", + "total", + "accounts" + ] }, - "title": "ReqGetLiquidationInfos", - "required": [ - "account_index", - "limit" - ] - }, - "ReqGetNextNonce": { - "type": "object", - "properties": { - "account_index": { - "type": "integer", - "format": "int64" - }, - "api_key_index": { - "type": "integer", - "format": "uint8" - } + "DetailedCandlestick": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "open": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "high": { + "type": "number", + "format": "double", + "example": "3034.66" + }, + "low": { + "type": "number", + "format": "double", + "example": "3014.66" + }, + "close": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "volume0": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "volume1": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "last_trade_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "trade_count": { + "type": "integer", + "format": "int64", + "example": "1503241" + }, + "close_raw": { + "type": "string" + }, + "high_raw": { + "type": "string" + }, + "low_raw": { + "type": "string" + }, + "open_raw": { + "type": "string" + } + }, + "title": "DetailedCandlestick", + "required": [ + "timestamp", + "open", + "high", + "low", + "close", + "volume0", + "volume1", + "last_trade_id", + "trade_count" + ] + }, + "EnrichedTx": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "type": { + "type": "integer", + "format": "uint8", + "example": "1", + "maximum": 64, + "minimum": 1 + }, + "info": { + "type": "string", + "example": "{}" + }, + "event_info": { + "type": "string", + "example": "{}" + }, + "status": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "transaction_index": { + "type": "integer", + "format": "int64", + "example": "8761" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "nonce": { + "type": "integer", + "format": "int64", + "example": "722" + }, + "expire_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "block_height": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "queued_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "executed_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "sequence_index": { + "type": "integer", + "format": "int64", + "example": "8761" + }, + "parent_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "api_key_index": { + "type": "integer", + "format": "uint8", + "example": "0" + }, + "transaction_time": { + "type": "integer", + "format": "int64", + "example": "1257894000000000" + }, + "committed_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "verified_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + } + }, + "title": "EnrichedTx", + "required": [ + "code", + "hash", + "type", + "info", + "event_info", + "status", + "transaction_index", + "l1_address", + "account_index", + "nonce", + "expire_at", + "block_height", + "queued_at", + "executed_at", + "sequence_index", + "parent_hash", + "api_key_index", + "transaction_time", + "committed_at", + "verified_at" + ] + }, + "ExchangeStats": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "order_book_stats": { + "type": "array", + "example": "1", + "items": { + "$ref": "#/components/schemas/OrderBookStats" + } + }, + "daily_usd_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + } + }, + "title": "ExchangeStats", + "required": [ + "code", + "total", + "order_book_stats", + "daily_usd_volume", + "daily_trades_count" + ] + }, + "ExportData": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "data_url": { + "type": "string" + } + }, + "title": "ExportData", + "required": [ + "code", + "data_url" + ] }, - "title": "ReqGetNextNonce", - "required": [ - "account_index", - "api_key_index" - ] - }, - "ReqGetOrderBookDetails": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "filter": { - "type": "string", - "enum": [ - "all", - "spot", - "perp" - ], - "default": "all" - } + "Funding": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "value": { + "type": "string", + "example": "0.0001" + }, + "rate": { + "type": "string", + "example": "0.0001" + }, + "direction": { + "type": "string", + "example": "long" + } + }, + "title": "Funding", + "required": [ + "timestamp", + "value", + "rate", + "direction" + ] }, - "title": "ReqGetOrderBookDetails" - }, - "ReqGetOrderBookOrders": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 250, - "minimum": 1 - } + "FundingRate": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "exchange": { + "type": "string", + "enum": [ + "binance", + "bybit", + "hyperliquid", + "lighter" + ] + }, + "symbol": { + "type": "string" + }, + "rate": { + "type": "number", + "format": "double" + } + }, + "title": "FundingRate", + "required": [ + "market_id", + "exchange", + "symbol", + "rate" + ] }, - "title": "ReqGetOrderBookOrders", - "required": [ - "market_id", - "limit" - ] - }, - "ReqGetOrderBooks": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "filter": { - "type": "string", - "enum": [ - "all", - "spot", - "perp" - ], - "default": "all" - } + "FundingRates": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "funding_rates": { + "type": "array", + "items": { + "$ref": "#/components/schemas/FundingRate" + } + } + }, + "title": "FundingRates", + "required": [ + "code", + "funding_rates" + ] }, - "title": "ReqGetOrderBooks" - }, - "ReqGetPositionFunding": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "cursor": { - "type": "string" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - }, - "side": { - "type": "string", - "enum": [ - "long", - "short", - "all" - ], - "default": "all" - } + "Fundings": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "resolution": { + "type": "string", + "example": "1h" + }, + "fundings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Funding" + } + } + }, + "title": "Fundings", + "required": [ + "code", + "resolution", + "fundings" + ] }, - "title": "ReqGetPositionFunding", - "required": [ - "account_index", - "limit" - ] - }, - "ReqGetPublicPoolsMetadata": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "filter": { - "type": "string", - "enum": [ - "all", - "user", - "protocol", - "account_index", - "stake" - ] - }, - "index": { - "type": "integer", - "format": "int64" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - }, - "account_index": { - "type": "integer", - "format": "int64" - } + "L1Metadata": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + }, + "can_invite": { + "type": "boolean", + "format": "boolean" + }, + "referral_points_percentage": { + "type": "string" + } + }, + "title": "L1Metadata", + "required": [ + "l1_address", + "can_invite", + "referral_points_percentage" + ] }, - "title": "ReqGetPublicPoolsMetadata", - "required": [ - "index", - "limit" - ] - }, - "ReqGetPushNotifSettings": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expo_token": { - "type": "string" - } + "L1ProviderInfo": { + "type": "object", + "properties": { + "chainId": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "networkId": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "latestBlockNumber": { + "type": "integer", + "format": "int64", + "example": "45434" + } + }, + "title": "L1ProviderInfo", + "required": [ + "chainId", + "networkId", + "latestBlockNumber" + ] }, - "title": "ReqGetPushNotifSettings", - "required": [ - "account_index", - "expo_token" - ] - }, - "ReqGetRangeWithCursor": { - "type": "object", - "properties": { - "cursor": { - "type": "string" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - } + "LiqTrade": { + "type": "object", + "properties": { + "price": { + "type": "string" + }, + "size": { + "type": "string" + }, + "taker_fee": { + "type": "string" + }, + "maker_fee": { + "type": "string" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + } + }, + "title": "LiqTrade", + "required": [ + "price", + "size", + "taker_fee", + "maker_fee", + "transaction_time" + ] }, - "title": "ReqGetRangeWithCursor", - "required": [ - "limit" - ] - }, - "ReqGetRangeWithIndex": { - "type": "object", - "properties": { - "index": { - "type": "integer", - "format": "int64" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - } + "Liquidation": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8" + }, + "type": { + "type": "string", + "enum": [ + "partial", + "deleverage" + ] + }, + "trade": { + "$ref": "#/components/schemas/LiqTrade" + }, + "info": { + "$ref": "#/components/schemas/LiquidationInfo" + }, + "executed_at": { + "type": "integer", + "format": "int64" + } + }, + "title": "Liquidation", + "required": [ + "id", + "market_id", + "type", + "trade", + "info", + "executed_at" + ] + }, + "LiquidationInfo": { + "type": "object", + "properties": { + "positions": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AccountPosition" + } + }, + "risk_info_before": { + "$ref": "#/components/schemas/RiskInfo" + }, + "risk_info_after": { + "$ref": "#/components/schemas/RiskInfo" + }, + "mark_prices": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + }, + "title": "LiquidationInfo", + "required": [ + "positions", + "risk_info_before", + "risk_info_after", + "mark_prices" + ] }, - "title": "ReqGetRangeWithIndex", - "required": [ - "limit" - ] - }, - "ReqGetRangeWithIndexSortable": { - "type": "object", - "properties": { - "index": { - "type": "integer", - "format": "int64" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - }, - "sort": { - "type": "string", - "enum": [ - "asc", - "desc" - ], - "default": "asc" - } + "LiquidationInfos": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "liquidations": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Liquidation" + } + }, + "next_cursor": { + "type": "string" + } + }, + "title": "LiquidationInfos", + "required": [ + "code", + "liquidations" + ] }, - "title": "ReqGetRangeWithIndexSortable" - }, - "ReqGetRecentTrades": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - } + "MarketConfig": { + "type": "object", + "properties": { + "market_margin_mode": { + "type": "integer", + "format": "uint8", + "example": 0 + }, + "insurance_fund_account_index": { + "type": "integer", + "format": "int64", + "example": 281474976710655 + }, + "liquidation_mode": { + "type": "integer", + "format": "uint8", + "example": 0 + }, + "force_reduce_only": { + "type": "boolean", + "format": "boolean", + "example": false + }, + "funding_fee_discounts_enabled": { + "type": "boolean", + "format": "boolean" + }, + "trading_hours": { + "type": "string", + "example": "" + }, + "hidden": { + "type": "boolean" + } + }, + "title": "MarketConfig", + "required": [ + "market_margin_mode", + "insurance_fund_account_index", + "liquidation_mode", + "force_reduce_only", + "trading_hours", + "hidden" + ] + }, + "PerpsMarketStats": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "index_price": { + "type": "string", + "example": "3024.66" + }, + "mark_price": { + "type": "string", + "example": "3024.66" + }, + "open_interest": { + "type": "string", + "example": "235.25" + }, + "last_trade_price": { + "type": "string", + "example": "3024.66" + }, + "current_funding_rate": { + "type": "string", + "example": "0.0001" + }, + "funding_rate": { + "type": "string", + "example": "0.0001" + }, + "funding_timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "daily_price_low": { + "type": "number", + "format": "double", + "example": "3014.66" + }, + "daily_price_high": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": "3.66" + }, + "symbol": { + "type": "string" + }, + "funding_clamp_small": { + "type": "string" + }, + "funding_clamp_big": { + "type": "string" + }, + "open_interest_limit": { + "type": "string" + } + }, + "title": "PerpsMarketStats", + "required": [ + "market_id", + "index_price", + "mark_price", + "open_interest", + "last_trade_price", + "current_funding_rate", + "funding_rate", + "funding_timestamp", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_low", + "daily_price_high", + "daily_price_change", + "open_interest_limit", + "funding_clamp_big", + "funding_clamp_small", + "symbol" + ] + }, + "NextNonce": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "nonce": { + "type": "integer", + "format": "int64", + "example": "722" + } + }, + "title": "NextNonce", + "required": [ + "code", + "nonce" + ] + }, + "Order": { + "type": "object", + "properties": { + "order_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "client_order_index": { + "type": "integer", + "format": "int64", + "example": "234" + }, + "order_id": { + "type": "string", + "example": "1" + }, + "client_order_id": { + "type": "string", + "example": "234" + }, + "market_index": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "owner_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "initial_base_amount": { + "type": "string", + "example": "0.1" + }, + "price": { + "type": "string", + "example": "3024.66" + }, + "nonce": { + "type": "integer", + "format": "int64", + "example": "722" + }, + "remaining_base_amount": { + "type": "string", + "example": "0.1" + }, + "is_ask": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "base_size": { + "type": "integer", + "format": "int64", + "example": "12354" + }, + "base_price": { + "type": "integer", + "format": "int32", + "example": "3024" + }, + "filled_base_amount": { + "type": "string", + "example": "0.1" + }, + "filled_quote_amount": { + "type": "string", + "example": "0.1" + }, + "side": { + "type": "string", + "example": "buy", + "default": "buy", + "description": " TODO: remove this" + }, + "type": { + "type": "string", + "example": "limit", + "enum": [ + "limit", + "market", + "stop-loss", + "stop-loss-limit", + "take-profit", + "take-profit-limit", + "twap", + "twap-sub", + "liquidation" + ] + }, + "time_in_force": { + "type": "string", + "enum": [ + "good-till-time", + "immediate-or-cancel", + "post-only", + "Unknown" + ], + "default": "good-till-time" + }, + "reduce_only": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "trigger_price": { + "type": "string", + "example": "3024.66" + }, + "order_expiry": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "status": { + "type": "string", + "example": "open", + "enum": [ + "in-progress", + "pending", + "open", + "filled", + "canceled", + "canceled-post-only", + "canceled-reduce-only", + "canceled-position-not-allowed", + "canceled-margin-not-allowed", + "canceled-too-much-slippage", + "canceled-not-enough-liquidity", + "canceled-self-trade", + "canceled-expired", + "canceled-oco", + "canceled-child", + "canceled-liquidation", + "canceled-invalid-balance" + ] + }, + "trigger_status": { + "type": "string", + "example": "twap", + "enum": [ + "na", + "ready", + "mark-price", + "twap", + "parent-order" + ] + }, + "trigger_time": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "parent_order_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "parent_order_id": { + "type": "string", + "example": "1" + }, + "to_trigger_order_id_0": { + "type": "string", + "example": "1" + }, + "to_trigger_order_id_1": { + "type": "string", + "example": "1" + }, + "to_cancel_order_id_0": { + "type": "string", + "example": "1" + }, + "block_height": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "created_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "updated_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + }, + "integrator_fee_collector_index": { + "type": "string" + }, + "integrator_maker_fee": { + "type": "string" + }, + "integrator_taker_fee": { + "type": "string" + } + }, + "title": "Order", + "required": [ + "order_index", + "client_order_index", + "order_id", + "client_order_id", + "market_index", + "owner_account_index", + "initial_base_amount", + "price", + "nonce", + "remaining_base_amount", + "is_ask", + "base_size", + "base_price", + "filled_base_amount", + "filled_quote_amount", + "side", + "type", + "time_in_force", + "reduce_only", + "trigger_price", + "order_expiry", + "status", + "trigger_status", + "trigger_time", + "parent_order_index", + "parent_order_id", + "to_trigger_order_id_0", + "to_trigger_order_id_1", + "to_cancel_order_id_0", + "block_height", + "timestamp", + "created_at", + "updated_at", + "integrator_fee_collector_index", + "integrator_maker_fee", + "integrator_taker_fee", + "transaction_time" + ] + }, + "OrderBook": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "market_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "market_type": { + "type": "string", + "example": "perp", + "enum": [ + "perp", + "spot" + ] + }, + "base_asset_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "quote_asset_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "status": { + "type": "string", + "example": "active", + "enum": [ + "inactive", + "active" + ] + }, + "taker_fee": { + "type": "string", + "example": "0.0001" + }, + "maker_fee": { + "type": "string", + "example": "0.0000" + }, + "liquidation_fee": { + "type": "string", + "example": "0.01" + }, + "min_base_amount": { + "type": "string", + "example": "0.01" + }, + "min_quote_amount": { + "type": "string", + "example": "0.1" + }, + "supported_size_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_quote_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "order_quote_limit": { + "type": "string", + "example": "281474976.710655" + }, + "is_maker_fee_enabled": { + "type": "boolean", + "example": true + }, + "is_taker_fee_enabled": { + "type": "boolean", + "example": true + } + }, + "title": "OrderBook", + "required": [ + "symbol", + "market_id", + "market_type", + "base_asset_id", + "quote_asset_id", + "status", + "taker_fee", + "maker_fee", + "liquidation_fee", + "min_base_amount", + "min_quote_amount", + "supported_size_decimals", + "supported_price_decimals", + "supported_quote_decimals", + "order_quote_limit" + ] + }, + "OrderBookDepth": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "asks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceLevel" + } + }, + "bids": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PriceLevel" + } + }, + "offset": { + "type": "integer", + "format": "int64", + "example": "0" + }, + "nonce": { + "type": "integer", + "format": "int64" + } + }, + "title": "OrderBookDepth", + "required": [ + "code", + "asks", + "bids", + "offset", + "nonce" + ] + }, + "PerpsOrderBookDetail": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "market_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "market_type": { + "type": "string", + "example": "perp", + "enum": [ + "perp", + "spot" + ] + }, + "base_asset_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "quote_asset_id": { + "type": "integer", + "format": "int16", + "example": 0 + }, + "status": { + "type": "string", + "example": "active", + "enum": [ + "inactive", + "active" + ] + }, + "taker_fee": { + "type": "string", + "example": "0.0001" + }, + "maker_fee": { + "type": "string", + "example": "0.0000" + }, + "liquidation_fee": { + "type": "string", + "example": "0.01" + }, + "min_base_amount": { + "type": "string", + "example": "0.01" + }, + "min_quote_amount": { + "type": "string", + "example": "0.1" + }, + "supported_size_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "supported_quote_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "order_quote_limit": { + "type": "string", + "example": "281474976.710655" + }, + "size_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "price_decimals": { + "type": "integer", + "format": "uint8", + "example": "4" + }, + "quote_multiplier": { + "type": "integer", + "format": "int64", + "example": "10000" + }, + "default_initial_margin_fraction": { + "type": "integer", + "format": "uin16", + "example": "100" + }, + "min_initial_margin_fraction": { + "type": "integer", + "format": "uin16", + "example": "100" + }, + "maintenance_margin_fraction": { + "type": "integer", + "format": "uin16", + "example": "50" + }, + "closeout_margin_fraction": { + "type": "integer", + "format": "uin16", + "example": "100" + }, + "last_trade_price": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "daily_price_low": { + "type": "number", + "format": "double", + "example": "3014.66" + }, + "daily_price_high": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": "3.66" + }, + "open_interest": { + "type": "number", + "format": "double", + "example": "93.0" + }, + "daily_chart": { + "type": "object", + "example": "{1640995200:3024.66}", + "additionalProperties": { + "type": "number", + "format": "double" + } + }, + "market_config": { + "$ref": "#/components/schemas/MarketConfig" + }, + "strategy_index": { + "type": "integer", + "format": "int32" + }, + "is_maker_fee_enabled": { + "type": "boolean", + "example": true + }, + "is_taker_fee_enabled": { + "type": "boolean", + "example": true + } + }, + "title": "PerpsOrderBookDetail", + "required": [ + "symbol", + "market_id", + "market_type", + "base_asset_id", + "quote_asset_id", + "status", + "taker_fee", + "maker_fee", + "liquidation_fee", + "min_base_amount", + "min_quote_amount", + "supported_size_decimals", + "supported_price_decimals", + "supported_quote_decimals", + "size_decimals", + "price_decimals", + "quote_multiplier", + "default_initial_margin_fraction", + "min_initial_margin_fraction", + "maintenance_margin_fraction", + "closeout_margin_fraction", + "last_trade_price", + "daily_trades_count", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_low", + "daily_price_high", + "daily_price_change", + "open_interest", + "daily_chart" + ] + }, + "OrderBookDetails": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "order_book_details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PerpsOrderBookDetail" + } + }, + "spot_order_book_details": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SpotOrderBookDetail" + } + } + }, + "title": "OrderBookDetails", + "required": [ + "code", + "order_book_details", + "spot_order_book_details" + ] + }, + "SpotOrderBookDetail": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH/USDC" + }, + "market_id": { + "type": "integer", + "format": "int16", + "example": 2048 + }, + "market_type": { + "type": "string", + "example": "spot", + "enum": [ + "perp", + "spot" + ] + }, + "base_asset_id": { + "type": "integer", + "format": "int16", + "example": 1 + }, + "quote_asset_id": { + "type": "integer", + "format": "int16", + "example": 3 + }, + "status": { + "type": "string", + "example": "active", + "enum": [ + "inactive", + "active" + ] + }, + "taker_fee": { + "type": "string", + "example": "0.0000" + }, + "maker_fee": { + "type": "string", + "example": "0.0000" + }, + "liquidation_fee": { + "type": "string", + "example": "0.0000" + }, + "min_base_amount": { + "type": "string", + "example": "0.0001" + }, + "min_quote_amount": { + "type": "string", + "example": "0.000001" + }, + "order_quote_limit": { + "type": "string", + "example": "2500000.000000" + }, + "supported_size_decimals": { + "type": "integer", + "format": "uint8", + "example": 4 + }, + "supported_price_decimals": { + "type": "integer", + "format": "uint8", + "example": 2 + }, + "supported_quote_decimals": { + "type": "integer", + "format": "uint8", + "example": 6 + }, + "size_decimals": { + "type": "integer", + "format": "uint8", + "example": 4 + }, + "price_decimals": { + "type": "integer", + "format": "uint8", + "example": 2 + }, + "last_trade_price": { + "type": "number", + "format": "double", + "example": 2731.79 + }, + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": 126993 + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": 1203.0962 + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": 3516374.947553 + }, + "daily_price_low": { + "type": "number", + "format": "double", + "example": 2717.47 + }, + "daily_price_high": { + "type": "number", + "format": "double", + "example": 3044.21 + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": -10.2389493724579 + }, + "daily_chart": { + "type": "object", + "example": "{1640995200:3024.66}", + "additionalProperties": { + "type": "number", + "format": "double" + } + }, + "is_maker_fee_enabled": { + "type": "boolean", + "example": true + }, + "is_taker_fee_enabled": { + "type": "boolean", + "example": true + } + }, + "title": "SpotOrderBookDetail", + "required": [ + "symbol", + "market_id", + "market_type", + "base_asset_id", + "quote_asset_id", + "status", + "taker_fee", + "maker_fee", + "liquidation_fee", + "min_base_amount", + "min_quote_amount", + "order_quote_limit", + "supported_size_decimals", + "supported_price_decimals", + "supported_quote_decimals", + "size_decimals", + "price_decimals", + "last_trade_price", + "daily_trades_count", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_low", + "daily_price_high", + "daily_price_change", + "daily_chart" + ] + }, + "OrderBookOrders": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total_asks": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "asks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimpleOrder" + } + }, + "total_bids": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "bids": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SimpleOrder" + } + } + }, + "title": "OrderBookOrders", + "required": [ + "code", + "total_asks", + "asks", + "total_bids", + "bids" + ] + }, + "OrderBookStats": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "last_trade_price": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "daily_trades_count": { + "type": "integer", + "format": "int64", + "example": "68" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": "3.66" + } + }, + "title": "OrderBookStats", + "required": [ + "symbol", + "last_trade_price", + "daily_trades_count", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_change" + ] + }, + "OrderBooks": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "order_books": { + "type": "array", + "items": { + "$ref": "#/components/schemas/OrderBook" + } + } + }, + "title": "OrderBooks", + "required": [ + "code", + "order_books" + ] + }, + "Orders": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "next_cursor": { + "type": "string" + }, + "orders": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Order" + } + } + }, + "title": "Orders", + "required": [ + "code", + "orders" + ] + }, + "PnLEntry": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "trade_pnl": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "inflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "outflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "pool_pnl": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "pool_inflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "pool_outflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "pool_total_shares": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "spot_inflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "spot_outflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "staked_lit": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "staking_inflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "staking_outflow": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "staking_pnl": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "trade_spot_pnl": { + "type": "number", + "format": "double", + "example": "12.0" + }, + "volume": { + "type": "number", + "format": "double", + "example": "12.0" + } + }, + "title": "PnLEntry", + "required": [ + "timestamp", + "trade_pnl", + "inflow", + "outflow", + "pool_pnl", + "pool_inflow", + "pool_outflow", + "pool_total_shares", + "spot_inflow", + "spot_outflow", + "staked_lit", + "staking_inflow", + "staking_outflow", + "staking_pnl", + "trade_spot_pnl", + "volume" + ] + }, + "PositionFunding": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "funding_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "change": { + "type": "string", + "example": "1" + }, + "discount": { + "type": "string", + "example": "1" + }, + "rate": { + "type": "string", + "example": "1" + }, + "position_size": { + "type": "string", + "example": "1" + }, + "position_side": { + "type": "string", + "example": "long", + "enum": [ + "long", + "short" + ] + } + }, + "title": "PositionFunding", + "required": [ + "timestamp", + "market_id", + "funding_id", + "change", + "rate", + "position_size", + "position_side", + "discount" + ] + }, + "PositionFundings": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "position_fundings": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PositionFunding" + } + }, + "next_cursor": { + "type": "string" + } + }, + "title": "PositionFundings", + "required": [ + "code", + "position_fundings" + ] + }, + "PriceLevel": { + "type": "object", + "properties": { + "price": { + "type": "string", + "example": "3024.66" + }, + "size": { + "type": "string", + "example": "0.1" + } + }, + "title": "PriceLevel", + "required": [ + "price", + "size" + ] + }, + "PublicPoolInfo": { + "type": "object", + "properties": { + "status": { + "type": "integer", + "format": "uint8", + "example": "0" + }, + "operator_fee": { + "type": "string", + "example": "100" + }, + "min_operator_share_rate": { + "type": "string", + "example": "200" + }, + "total_shares": { + "type": "integer", + "format": "int64", + "example": "100000" + }, + "operator_shares": { + "type": "integer", + "format": "int64", + "example": "20000" + }, + "annual_percentage_yield": { + "type": "number", + "format": "double", + "example": "20.5000" + }, + "daily_returns": { + "type": "array", + "items": { + "$ref": "#/components/schemas/DailyReturn" + } + }, + "share_prices": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SharePrice" + } + }, + "sharpe_ratio": { + "type": "number", + "format": "double" + }, + "strategies": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Strategy" + } + } + }, + "title": "PublicPoolInfo", + "required": [ + "status", + "operator_fee", + "min_operator_share_rate", + "total_shares", + "operator_shares", + "annual_percentage_yield", + "daily_returns", + "share_prices", + "sharpe_ratio", + "strategies" + ] + }, + "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": "#/components/schemas/PublicPoolShare" + }, + "assets": { + "type": "array", + "items": { + "$ref": "#/components/schemas/AccountAsset" + } + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "master_account_index": { + "type": "integer", + "format": "int64" + }, + "sharpe_ratio": { + "type": "number", + "format": "double" + }, + "total_perps_value": { + "type": "string" + }, + "total_spot_value": { + "type": "string" + } + }, + "title": "PublicPoolMetadata", + "required": [ + "code", + "account_index", + "account_type", + "name", + "l1_address", + "annual_percentage_yield", + "status", + "operator_fee", + "total_asset_value", + "total_shares", + "assets", + "created_at", + "master_account_index", + "sharpe_ratio", + "total_perps_value", + "total_spot_value" + ] + }, + "PublicPoolShare": { + "type": "object", + "properties": { + "public_pool_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "shares_amount": { + "type": "integer", + "format": "int64", + "example": "3000" + }, + "entry_usdc": { + "type": "string", + "example": "3000" + }, + "entry_timestamp": { + "type": "integer", + "format": "int64" + }, + "principal_amount": { + "type": "string" + } + }, + "title": "PublicPoolShare", + "required": [ + "public_pool_index", + "shares_amount", + "entry_usdc", + "entry_timestamp", + "principal_amount" + ] + }, + "ReferralPointEntry": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + }, + "total_points": { + "type": "number", + "format": "float", + "example": "1000.01" + }, + "week_points": { + "type": "number", + "format": "float", + "example": "1000.01" + }, + "total_reward_points": { + "type": "number", + "format": "float", + "example": "200" + }, + "week_reward_points": { + "type": "number", + "format": "float", + "example": "200" + }, + "reward_point_multiplier": { + "type": "string", + "example": "0.1" + } + }, + "title": "ReferralPointEntry", + "required": [ + "l1_address", + "total_points", + "week_points", + "total_reward_points", + "week_reward_points", + "reward_point_multiplier" + ] + }, + "ReferralPoints": { + "type": "object", + "properties": { + "referrals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ReferralPointEntry" + } + }, + "user_total_points": { + "type": "number", + "format": "float", + "example": "1000" + }, + "user_last_week_points": { + "type": "number", + "format": "float", + "example": "1000" + }, + "user_total_referral_reward_points": { + "type": "number", + "format": "float", + "example": "1000" + }, + "user_last_week_referral_reward_points": { + "type": "number", + "format": "float", + "example": "1000" + }, + "reward_point_multiplier": { + "type": "string", + "example": "0.1" + } + }, + "title": "ReferralPoints", + "required": [ + "referrals", + "user_total_points", + "user_last_week_points", + "user_total_referral_reward_points", + "user_last_week_referral_reward_points", + "reward_point_multiplier" + ] + }, + "ReqAckNotif": { + "type": "object", + "properties": { + "notif_id": { + "type": "string", + "example": "'liq:17:5898'" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqAckNotif", + "required": [ + "notif_id", + "account_index" + ] + }, + "ReqChangeAccountTier": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "new_tier": { + "type": "string" + } + }, + "title": "ReqChangeAccountTier", + "required": [ + "account_index", + "new_tier" + ] + }, + "ReqExportData": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64", + "default": "-1" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "type": { + "type": "string", + "enum": [ + "funding", + "trade" + ] + }, + "start_timestamp": { + "type": "integer", + "format": "int64", + "minimum": 1735689600000, + "maximum": 1830297600000 + }, + "end_timestamp": { + "type": "integer", + "format": "int64", + "minimum": 1735689600000, + "maximum": 1830297600000 + }, + "side": { + "type": "string", + "enum": [ + "all", + "long", + "short" + ], + "default": "all" + }, + "role": { + "type": "string", + "enum": [ + "all", + "maker", + "taker" + ], + "default": "all" + }, + "trade_type": { + "type": "string", + "enum": [ + "all", + "trade", + "liquidation", + "deleverage", + "market-settlement" + ], + "default": "all" + } + }, + "title": "ReqExportData", + "required": [ + "type" + ] + }, + "ReqGetAccount": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "index", + "l1_address" + ] + }, + "value": { + "type": "string" + }, + "active_only": { + "type": "boolean", + "format": "boolean", + "default": "false" + } + }, + "title": "ReqGetAccount", + "required": [ + "by", + "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" + ] + }, + "ReqGetAccountApiKeys": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "api_key_index": { + "type": "integer", + "format": "uint8", + "default": "255" + } + }, + "title": "ReqGetAccountApiKeys", + "required": [ + "account_index" + ] + }, + "ReqGetAccountByL1Address": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + } + }, + "title": "ReqGetAccountByL1Address", + "required": [ + "l1_address" + ] + }, + "ReqGetAccountInactiveOrders": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "ask_filter": { + "type": "integer", + "format": "int8", + "default": "-1" + }, + "between_timestamps": { + "type": "string" + }, + "cursor": { + "type": "string" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetAccountInactiveOrders", + "required": [ + "account_index", + "limit" + ] + }, + "ReqGetAccountLimits": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + } + }, + "title": "ReqGetAccountLimits", + "required": [ + "account_index" + ] + }, + "ReqGetAccountMetadata": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "index", + "l1_address" + ] + }, + "value": { + "type": "string" + }, + "auth": { + "type": "string" + } + }, + "title": "ReqGetAccountMetadata", + "required": [ + "by", + "value" + ] + }, + "ReqGetAccountPnL": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "by": { + "type": "string", + "enum": [ + "index" + ] + }, + "value": { + "type": "string" + }, + "resolution": { + "type": "string", + "enum": [ + "1m", + "5m", + "15m", + "1h", + "4h", + "1d" + ] + }, + "start_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "end_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "count_back": { + "type": "integer", + "format": "int64" + }, + "ignore_transfers": { + "type": "boolean", + "format": "boolean", + "default": "false" + } + }, + "title": "ReqGetAccountPnL", + "required": [ + "by", + "value", + "resolution", + "start_timestamp", + "end_timestamp", + "count_back" + ] + }, + "ReqGetAccountTxs": { + "type": "object", + "properties": { + "index": { + "type": "integer", + "format": "int64" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + }, + "by": { + "type": "string", + "enum": [ + "account_index" + ] + }, + "value": { + "type": "string" + }, + "types": { + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + } + }, + "auth": { + "type": "string" + } + }, + "title": "ReqGetAccountTxs" + }, + "ReqGetBlock": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "commitment", + "height" + ] + }, + "value": { + "type": "string" + } + }, + "title": "ReqGetBlock", + "required": [ + "by", + "value" + ] + }, + "ReqGetBlockTxs": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "block_height", + "block_commitment" + ] + }, + "value": { + "type": "string" + } + }, + "title": "ReqGetBlockTxs", + "required": [ + "by", + "value" + ] + }, + "ReqGetByAccount": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "account_index" + ] + }, + "value": { + "type": "string" + } + }, + "title": "ReqGetByAccount", + "required": [ + "by", + "value" + ] + }, + "ReqGetCandlesticks": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "resolution": { + "type": "string", + "enum": [ + "1m", + "5m", + "15m", + "30m", + "1h", + "4h", + "12h", + "1d", + "1w" + ] + }, + "start_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "end_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "count_back": { + "type": "integer", + "format": "int64" + }, + "set_timestamp_to_end": { + "type": "boolean", + "format": "boolean", + "default": "false" + } + }, + "title": "ReqGetCandlesticks", + "required": [ + "market_id", + "resolution", + "start_timestamp", + "end_timestamp", + "count_back" + ] + }, + "ReqGetDepositHistory": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "l1_address": { + "type": "string" + }, + "cursor": { + "type": "string" + }, + "filter": { + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } + }, + "title": "ReqGetDepositHistory", + "required": [ + "account_index", + "l1_address" + ] + }, + "ReqGetExchangeStats": { + "type": "object", + "title": "ReqGetExchangeStats" + }, + "ReqGetFastWithdrawInfo": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + } + }, + "title": "ReqGetFastWithdrawInfo", + "required": [ + "account_index" + ] + }, + "ReqGetFundings": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "resolution": { + "type": "string", + "enum": [ + "1h", + "1d" + ] + }, + "start_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "end_timestamp": { + "type": "integer", + "format": "int64", + "maximum": 5000000000000 + }, + "count_back": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqGetFundings", + "required": [ + "market_id", + "resolution", + "start_timestamp", + "end_timestamp", + "count_back" + ] + }, + "ReqGetL1Metadata": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "l1_address": { + "type": "string" + } + }, + "title": "ReqGetL1Metadata", + "required": [ + "l1_address" + ] + }, + "ReqGetL1Tx": { + "type": "object", + "properties": { + "hash": { + "type": "string" + } + }, + "title": "ReqGetL1Tx", + "required": [ + "hash" + ] + }, + "ReqGetLatestDeposit": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + } + }, + "title": "ReqGetLatestDeposit", + "required": [ + "l1_address" + ] + }, + "ReqGetLiquidationInfos": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "cursor": { + "type": "string" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetLiquidationInfos", + "required": [ + "account_index", + "limit" + ] + }, + "ReqGetNextNonce": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "api_key_index": { + "type": "integer", + "format": "uint8" + } + }, + "title": "ReqGetNextNonce", + "required": [ + "account_index", + "api_key_index" + ] + }, + "ReqGetOrderBookDetails": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "filter": { + "type": "string", + "enum": [ + "all", + "spot", + "perp" + ], + "default": "all" + } + }, + "title": "ReqGetOrderBookDetails" + }, + "ReqGetOrderBookOrders": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetOrderBookOrders", + "required": [ + "market_id", + "limit" + ] + }, + "ReqGetOrderBooks": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "filter": { + "type": "string", + "enum": [ + "all", + "spot", + "perp" + ], + "default": "all" + } + }, + "title": "ReqGetOrderBooks" + }, + "ReqGetPositionFunding": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "cursor": { + "type": "string" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + }, + "side": { + "type": "string", + "enum": [ + "long", + "short", + "all" + ], + "default": "all" + } + }, + "title": "ReqGetPositionFunding", + "required": [ + "account_index", + "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": { + "cursor": { + "type": "string" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetRangeWithCursor", + "required": [ + "limit" + ] + }, + "ReqGetRangeWithIndex": { + "type": "object", + "properties": { + "index": { + "type": "integer", + "format": "int64" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetRangeWithIndex", + "required": [ + "limit" + ] + }, + "ReqGetRangeWithIndexSortable": { + "type": "object", + "properties": { + "index": { + "type": "integer", + "format": "int64" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + }, + "sort": { + "type": "string", + "enum": [ + "asc", + "desc" + ], + "default": "asc" + } + }, + "title": "ReqGetRangeWithIndexSortable" + }, + "ReqGetRecentTrades": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + } + }, + "title": "ReqGetRecentTrades", + "required": [ + "market_id", + "limit" + ] + }, + "ReqGetMakerOnlyApiKeys": { + "type": "object", + "title": "ReqGetMakerOnlyApiKeys", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + } + }, + "required": [ + "account_index" + ] + }, + "RespGetMakerOnlyApiKeys": { + "type": "object", + "title": "RespGetMakerOnlyApiKeys", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "api_key_indexes": { + "type": "array", + "items": { + "type": "integer", + "format": "int64" + } + } + }, + "required": [ + "code", + "api_key_indexes" + ] + }, + "ReqSetMakerOnlyApiKeys": { + "type": "object", + "title": "ReqSetMakerOnlyApiKeys", + "description": "Send as form data, not JSON. The value replaces the full maker-only API key list; use [] to clear all restrictions.", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "api_key_indexes": { + "type": "string", + "description": "JSON array string of API key indexes, e.g. \"[4,5]\". Use [] to clear all maker-only restrictions." + } + }, + "required": [ + "account_index", + "api_key_indexes" + ] + }, + "RespSetMakerOnlyApiKeys": { + "type": "object", + "title": "RespSetMakerOnlyApiKeys", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + } + }, + "required": [ + "code" + ] + }, + "ReqGetReferralPoints": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqGetReferralPoints", + "required": [ + "account_index" + ] + }, + "ReqGetTrades": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "default": "255" + }, + "account_index": { + "type": "integer", + "format": "int64", + "default": "-1" + }, + "order_index": { + "type": "integer", + "format": "int64" + }, + "sort_by": { + "type": "string", + "enum": [ + "block_height", + "timestamp", + "trade_id" + ] + }, + "sort_dir": { + "type": "string", + "enum": [ + "desc" + ], + "default": "desc" + }, + "cursor": { + "type": "string" + }, + "from": { + "type": "integer", + "format": "int64", + "default": "-1" + }, + "ask_filter": { + "type": "integer", + "format": "int8", + "default": "-1" + }, + "limit": { + "type": "integer", + "format": "int64", + "maximum": 100, + "minimum": 1 + }, + "role": { + "type": "string", + "enum": [ + "all", + "maker", + "taker" + ], + "default": "all" + }, + "type": { + "type": "string", + "enum": [ + "all", + "trade", + "liquidation", + "deleverage", + "market-settlement" + ], + "default": "all" + }, + "aggregate": { + "type": "boolean", + "format": "boolean", + "default": "false" + } + }, + "title": "ReqGetTrades", + "required": [ + "sort_by", + "limit" + ] + }, + "ReqGetTransferFeeInfo": { + "type": "object", + "properties": { + "auth": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "to_account_index": { + "type": "integer", + "format": "int64", + "default": "-1" + } + }, + "title": "ReqGetTransferFeeInfo", + "required": [ + "account_index" + ] + }, + "ReqGetTransferHistory": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "cursor": { + "type": "string" + }, + "type": { + "type": "array", + "items": { + "type": "string", + "enum": [ + "all", + "L2Transfer", + "L2MintShares", + "L2BurnShares", + "L2StakeAssets", + "L2UnstakeAssets" + ] + } + } + }, + "title": "ReqGetTransferHistory", + "required": [ + "account_index" + ] + }, + "ReqGetTx": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "hash", + "sequence_index" + ] + }, + "value": { + "type": "string" + } + }, + "title": "ReqGetTx", + "required": [ + "by", + "value" + ] + }, + "ReqGetWithdrawHistory": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "cursor": { + "type": "string" + }, + "filter": { + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } + }, + "title": "ReqGetWithdrawHistory", + "required": [ + "account_index" + ] + }, + "ReqSendTx": { + "type": "object", + "properties": { + "tx_type": { + "type": "integer", + "format": "uint8" + }, + "tx_info": { + "type": "string" + }, + "price_protection": { + "type": "boolean", + "format": "boolean", + "default": "true" + } + }, + "title": "ReqSendTx", + "required": [ + "tx_type", + "tx_info" + ] + }, + "ReqSendTxBatch": { + "type": "object", + "properties": { + "tx_types": { + "type": "string" + }, + "tx_infos": { + "type": "string" + } + }, + "title": "ReqSendTxBatch", + "required": [ + "tx_types", + "tx_infos" + ] + }, + "RespChangeAccountTier": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + } + }, + "title": "RespChangeAccountTier", + "required": [ + "code" + ] + }, + "RespGetFastBridgeInfo": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "fast_bridge_limit": { + "type": "string" + } + }, + "title": "RespGetFastBridgeInfo", + "required": [ + "code", + "fast_bridge_limit" + ] + }, + "RespPublicPoolsMetadata": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "public_pools": { + "type": "array", + "items": { + "$ref": "#/components/schemas/PublicPoolMetadata" + } + } + }, + "title": "RespPublicPoolsMetadata", + "required": [ + "code", + "public_pools" + ] + }, + "RespSendTx": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "predicted_execution_time_ms": { + "type": "integer", + "format": "int64", + "example": "1751465474" + }, + "volume_quota_remaining": { + "type": "integer", + "format": "int64" + } + }, + "title": "RespSendTx", + "required": [ + "code", + "tx_hash", + "predicted_execution_time_ms", + "volume_quota_remaining" + ] + }, + "RespSendTxBatch": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "tx_hash": { + "type": "array", + "items": { + "type": "string" + } + }, + "predicted_execution_time_ms": { + "type": "integer", + "format": "int64", + "example": "1751465474" + }, + "volume_quota_remaining": { + "type": "integer", + "format": "int64" + } + }, + "title": "RespSendTxBatch", + "required": [ + "code", + "tx_hash", + "predicted_execution_time_ms", + "volume_quota_remaining" + ] + }, + "RespWithdrawalDelay": { + "type": "object", + "properties": { + "seconds": { + "type": "integer", + "format": "int64", + "example": "86400" + } + }, + "title": "RespWithdrawalDelay", + "required": [ + "seconds" + ] + }, + "ResultCode": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + } + }, + "title": "ResultCode", + "required": [ + "code" + ] + }, + "RiskInfo": { + "type": "object", + "properties": { + "cross_risk_parameters": { + "$ref": "#/components/schemas/RiskParameters" + }, + "isolated_risk_parameters": { + "type": "array", + "items": { + "$ref": "#/components/schemas/RiskParameters" + } + } + }, + "title": "RiskInfo", + "required": [ + "cross_risk_parameters", + "isolated_risk_parameters" + ] + }, + "RiskParameters": { + "type": "object", + "properties": { + "market_id": { + "type": "integer", + "format": "uint8" + }, + "collateral": { + "type": "string" + }, + "total_account_value": { + "type": "string" + }, + "initial_margin_req": { + "type": "string" + }, + "maintenance_margin_req": { + "type": "string" + }, + "close_out_margin_req": { + "type": "string" + } + }, + "title": "RiskParameters", + "required": [ + "market_id", + "collateral", + "total_account_value", + "initial_margin_req", + "maintenance_margin_req", + "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": { + "order_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "order_id": { + "type": "string", + "example": "1" + }, + "owner_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "initial_base_amount": { + "type": "string", + "example": "0.1" + }, + "remaining_base_amount": { + "type": "string", + "example": "0.1" + }, + "price": { + "type": "string", + "example": "3024.66" + }, + "order_expiry": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + } + }, + "title": "SimpleOrder", + "required": [ + "order_index", + "order_id", + "owner_account_index", + "initial_base_amount", + "remaining_base_amount", + "price", + "order_expiry", + "transaction_time" + ] + }, + "Status": { + "type": "object", + "properties": { + "status": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "network_id": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1717777777" + } + }, + "title": "Status", + "required": [ + "status", + "network_id", + "timestamp" + ] + }, + "SubAccounts": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "sub_accounts": { + "type": "array", + "example": "1", + "items": { + "$ref": "#/components/schemas/Account" + } + } + }, + "title": "SubAccounts", + "required": [ + "code", + "l1_address", + "sub_accounts" + ] + }, + "Ticker": { + "type": "object", + "properties": { + "s": { + "type": "string", + "example": "ETH" + }, + "a": { + "$ref": "#/components/schemas/PriceLevel" + }, + "b": { + "$ref": "#/components/schemas/PriceLevel" + } + }, + "title": "Ticker", + "required": [ + "s", + "a", + "b" + ] + }, + "Trade": { + "type": "object", + "properties": { + "trade_id": { + "type": "integer", + "format": "int64", + "example": "145" + }, + "tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "type": { + "type": "string", + "example": "trade", + "enum": [ + "trade", + "liquidation", + "deleverage", + "market-settlement" + ] + }, + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "size": { + "type": "string", + "example": "0.1" + }, + "price": { + "type": "string", + "example": "3024.66" + }, + "usd_amount": { + "type": "string", + "example": "3024.66" + }, + "ask_id": { + "type": "integer", + "format": "int64", + "example": "145" + }, + "bid_id": { + "type": "integer", + "format": "int64", + "example": "245" + }, + "ask_account_id": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "bid_account_id": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "is_maker_ask": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "block_height": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "taker_fee": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "taker_position_size_before": { + "type": "string", + "example": "0" + }, + "taker_entry_quote_before": { + "type": "string", + "example": "0" + }, + "taker_initial_margin_fraction_before": { + "type": "integer", + "format": "uin16", + "example": "0" + }, + "taker_position_sign_changed": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "maker_fee": { + "type": "integer", + "format": "int32", + "example": "0" + }, + "maker_position_size_before": { + "type": "string", + "example": "0" + }, + "maker_entry_quote_before": { + "type": "string", + "example": "0" + }, + "maker_initial_margin_fraction_before": { + "type": "integer", + "format": "uin16", + "example": "0" + }, + "maker_position_sign_changed": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "transaction_time": { + "type": "integer", + "format": "int64", + "example": "1771943742851429" + }, + "bid_account_pnl": { + "type": "string", + "description": "Realized PnL for the queried account index, triggered by reducing a short position", + "example": "-0.022890" + }, + "ask_account_pnl": { + "type": "string", + "description": "Realized PnL for the queried account index, triggered by reducing a long position, or a spot position", + "example": "1.989696" + }, + "ask_client_id": { + "type": "integer", + "format": "int64", + "example": "145" + }, + "bid_client_id": { + "type": "integer", + "format": "int64", + "example": "245" + }, + "ask_client_id_str": { + "type": "string", + "example": "145" + }, + "bid_client_id_str": { + "type": "string", + "example": "245" + }, + "ask_id_str": { + "type": "string", + "example": "145" + }, + "bid_id_str": { + "type": "string", + "example": "245" + }, + "trade_id_str": { + "type": "string", + "example": "145" + }, + "integrator_maker_fee": { + "type": "integer", + "format": "int32", + "example": "50" + }, + "integrator_maker_fee_collector_index": { + "type": "integer", + "format": "int64", + "example": "156" + }, + "integrator_taker_fee": { + "type": "integer", + "format": "int32", + "example": "50" + }, + "integrator_taker_fee_collector_index": { + "type": "integer", + "format": "int64", + "example": "156" + } + }, + "title": "Trade", + "required": [ + "trade_id", + "tx_hash", + "type", + "market_id", + "size", + "price", + "usd_amount", + "ask_id", + "bid_id", + "ask_account_id", + "bid_account_id", + "is_maker_ask", + "block_height", + "timestamp", + "taker_position_size_before", + "taker_entry_quote_before", + "taker_initial_margin_fraction_before", + "maker_position_size_before", + "maker_entry_quote_before", + "maker_initial_margin_fraction_before", + "transaction_time", + "ask_account_pnl", + "ask_client_id", + "bid_account_pnl", + "bid_client_id", + "maker_position_sign_changed", + "taker_position_sign_changed", + "ask_client_id_str", + "bid_client_id_str", + "trade_id_str", + "integrator_maker_fee", + "integrator_maker_fee_collector_index", + "integrator_taker_fee", + "integrator_taker_fee_collector_index" + ] + }, + "Trades": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "next_cursor": { + "type": "string" + }, + "trades": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Trade" + } + } + }, + "title": "Trades", + "required": [ + "code", + "trades" + ] + }, + "TransferFeeInfo": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "transfer_fee_usdc": { + "type": "integer", + "format": "int64" + } + }, + "title": "TransferFeeInfo", + "required": [ + "code", + "transfer_fee_usdc" + ] + }, + "TransferHistory": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "transfers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/TransferHistoryItem" + } + }, + "cursor": { + "type": "string" + } + }, + "title": "TransferHistory", + "required": [ + "code", + "transfers", + "cursor" + ] + }, + "TransferHistoryItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "amount": { + "type": "string", + "example": "0.1" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "type": { + "type": "string", + "enum": [ + "L2TransferInflow", + "L2TransferOutflow", + "L2BurnSharesInflow", + "L2BurnSharesOutflow", + "L2MintSharesInflow", + "L2MintSharesOutflow", + "L2SelfTransfer", + "L2StakeAssetInflow", + "L2StakeAssetOutflow", + "L2UnstakeAssetInflow", + "L2UnstakeAssetOutflow", + "L2ForceBurnSharesInflow", + "L2ForceBurnSharesOutflow" + ] + }, + "from_l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "to_l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "from_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "to_account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "asset_id": { + "type": "integer", + "format": "int16" + }, + "fee": { + "type": "string" + }, + "from_route": { + "type": "string", + "enum": [ + "spot", + "perps" + ] + }, + "to_route": { + "type": "string", + "enum": [ + "spot", + "perps" + ] + } + }, + "title": "TransferHistoryItem", + "required": [ + "id", + "amount", + "timestamp", + "type", + "from_l1_address", + "to_l1_address", + "from_account_index", + "to_account_index", + "tx_hash", + "asset_id", + "fee", + "from_route", + "to_route" + ] + }, + "Tx": { + "type": "object", + "properties": { + "hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "type": { + "type": "integer", + "format": "uint8", + "example": "1", + "maximum": 64, + "minimum": 1 + }, + "info": { + "type": "string", + "example": "{}" + }, + "event_info": { + "type": "string", + "example": "{}" + }, + "status": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "transaction_index": { + "type": "integer", + "format": "int64", + "example": "8761" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "account_index": { + "type": "integer", + "format": "int64", + "example": "1" + }, + "nonce": { + "type": "integer", + "format": "int64", + "example": "722" + }, + "expire_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "block_height": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "queued_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "executed_at": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "sequence_index": { + "type": "integer", + "format": "int64", + "example": "8761" + }, + "parent_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "api_key_index": { + "type": "integer", + "format": "uint8" + }, + "transaction_time": { + "type": "integer", + "format": "int64" + } + }, + "title": "Tx", + "required": [ + "hash", + "type", + "info", + "event_info", + "status", + "transaction_index", + "l1_address", + "account_index", + "nonce", + "expire_at", + "block_height", + "queued_at", + "executed_at", + "sequence_index", + "parent_hash" + ] + }, + "TxHash": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + } + }, + "title": "TxHash", + "required": [ + "code", + "tx_hash" + ] }, - "title": "ReqGetRecentTrades", - "required": [ - "market_id", - "limit" - ] - }, - "ReqGetTrades": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "market_id": { - "type": "integer", - "format": "int16", - "default": "255" - }, - "account_index": { - "type": "integer", - "format": "int64", - "default": "-1" - }, - "order_index": { - "type": "integer", - "format": "int64" - }, - "sort_by": { - "type": "string", - "enum": [ - "block_height", - "timestamp", - "trade_id" - ] - }, - "sort_dir": { - "type": "string", - "enum": [ - "desc" - ], - "default": "desc" - }, - "cursor": { - "type": "string" - }, - "from": { - "type": "integer", - "format": "int64", - "default": "-1" - }, - "ask_filter": { - "type": "integer", - "format": "int8", - "default": "-1" - }, - "role": { - "type": "string", - "enum": [ - "all", - "maker", - "taker" - ], - "default": "all" - }, - "type": { - "type": "string", - "enum": [ - "all", - "trade", - "liquidation", - "deleverage", - "market-settlement" - ], - "default": "all" - }, - "limit": { - "type": "integer", - "format": "int64", - "maximum": 100, - "minimum": 1 - }, - "aggregate": { - "type": "boolean", - "format": "boolean", - "default": "false" - } + "TxHashes": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "tx_hash": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "title": "TxHashes", + "required": [ + "code", + "tx_hash" + ] }, - "title": "ReqGetTrades", - "required": [ - "sort_by", - "limit" - ] - }, - "ReqGetTransferFeeInfo": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "to_account_index": { - "type": "integer", - "format": "int64", - "default": "-1" - } + "Txs": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "txs": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Tx" + } + } + }, + "title": "Txs", + "required": [ + "code", + "txs" + ] }, - "title": "ReqGetTransferFeeInfo", - "required": [ - "account_index" - ] - }, - "ReqGetTransferHistory": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "cursor": { - "type": "string" - }, - "type": { - "type": "array", - "items": { - "type": "string" - }, - "enum": [ - "all", - "L2Transfer", - "L2MintShares", - "L2BurnShares", - "L2StakeAssets", - "L2UnstakeAssets" - ] - } + "ValidatorInfo": { + "type": "object", + "properties": { + "address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "is_active": { + "type": "boolean", + "format": "boolean", + "example": "true" + } + }, + "title": "ValidatorInfo", + "required": [ + "address", + "is_active" + ] }, - "title": "ReqGetTransferHistory", - "required": [ - "account_index" - ] - }, - "ReqGetTx": { - "type": "object", - "properties": { - "by": { - "type": "string", - "enum": [ - "hash", - "sequence_index" - ] - }, - "value": { - "type": "string" - } + "WithdrawHistory": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "withdraws": { + "type": "array", + "items": { + "$ref": "#/components/schemas/WithdrawHistoryItem" + } + }, + "cursor": { + "type": "string" + } + }, + "title": "WithdrawHistory", + "required": [ + "code", + "withdraws", + "cursor" + ] }, - "title": "ReqGetTx", - "required": [ - "by", - "value" - ] - }, - "ReqGetUserReferrals": { - "type": "object", - "properties": { - "auth": { - "type": "string" + "WithdrawHistoryItem": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "amount": { + "type": "string", + "example": "0.1" + }, + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "status": { + "type": "string", + "enum": [ + "failed", + "pending", + "claimable", + "refunded", + "completed" + ] + }, + "type": { + "type": "string", + "enum": [ + "secure", + "fast" + ] + }, + "l1_tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "asset_id": { + "type": "integer", + "format": "int16" + } }, - "l1_address": { - "type": "string" + "title": "WithdrawHistoryItem", + "required": [ + "id", + "amount", + "timestamp", + "status", + "type", + "l1_tx_hash", + "asset_id" + ] + }, + "ZkLighterInfo": { + "type": "object", + "properties": { + "contract_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + } }, - "cursor": { - "type": "string" - } - }, - "title": "ReqGetUserReferrals", - "required": [ - "l1_address" - ] - }, - "ReqGetWithdrawHistory": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "cursor": { - "type": "string" - }, - "filter": { - "type": "string", - "enum": [ - "all", - "pending", - "claimable" - ] - } - }, - "title": "ReqGetWithdrawHistory", - "required": [ - "account_index" - ] - }, - "ReqLITLease": { - "type": "object", - "properties": { - "tx_info": { - "type": "string" - }, - "lease_amount": { - "type": "string" - }, - "duration_days": { - "type": "integer", - "format": "int32" - } + "title": "ZkLighterInfo", + "required": [ + "contract_address" + ] }, - "title": "ReqLITLease", - "required": [ - "tx_info", - "lease_amount", - "duration_days" - ] - }, - "ReqPostApiToken": { - "type": "object", - "properties": { - "name": { - "type": "string" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expiry": { - "type": "integer", - "format": "int64" - }, - "sub_account_access": { - "type": "boolean", - "format": "boolean" - }, - "scopes": { - "type": "string", - "example": "read.*", - "default": "read.*" - } + "ReqFastwithdraw": { + "type": "object", + "properties": { + "tx_info": { + "type": "string" + }, + "to_address": { + "type": "string" + }, + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + } + }, + "title": "ReqFastwithdraw", + "required": [ + "tx_info", + "to_address" + ] }, - "title": "ReqPostApiToken", - "required": [ - "name", - "account_index", - "expiry", - "sub_account_access" - ] - }, - "ReqRegisterPushNotifToken": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expo_token": { - "type": "string" - }, - "platform": { - "type": "string", - "enum": [ - "ios", - "android" - ] - }, - "app_version": { - "type": "string" - } + "ReqPostApiToken": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "expiry": { + "type": "integer", + "format": "int64" + }, + "sub_account_access": { + "type": "boolean", + "format": "boolean" + }, + "scopes": { + "type": "string", + "example": "read.*", + "default": "read.*" + } + }, + "title": "ReqPostApiToken", + "required": [ + "name", + "account_index", + "expiry", + "sub_account_access" + ] + }, + "ReqRevokeApiToken": { + "type": "object", + "properties": { + "token_id": { + "type": "integer", + "format": "int64" + }, + "account_index": { + "type": "integer", + "format": "int64" + } + }, + "title": "ReqRevokeApiToken", + "required": [ + "token_id", + "account_index" + ] }, - "title": "ReqRegisterPushNotifToken", - "required": [ - "account_index", - "expo_token", - "platform" - ] - }, - "ReqRevokeApiToken": { - "type": "object", - "properties": { - "token_id": { - "type": "integer", - "format": "int64" - }, - "account_index": { - "type": "integer", - "format": "int64" - } + "RespGetApiTokens": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "api_tokens": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ApiToken" + } + } + }, + "title": "RespGetApiTokens", + "required": [ + "code", + "api_tokens" + ] }, - "title": "ReqRevokeApiToken", - "required": [ - "token_id", - "account_index" - ] - }, - "ReqSendTx": { - "type": "object", - "properties": { - "tx_type": { - "type": "integer", - "format": "uint8" - }, - "tx_info": { - "type": "string" - }, - "price_protection": { - "type": "boolean", - "format": "boolean", - "default": "true" - } + "RespGetFastwithdrawalInfo": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "to_account_index": { + "type": "integer", + "format": "int64" + }, + "withdraw_limit": { + "type": "string" + }, + "max_withdrawal_amount": { + "type": "string" + } + }, + "title": "RespGetFastwithdrawalInfo", + "required": [ + "code", + "to_account_index", + "withdraw_limit", + "max_withdrawal_amount" + ] }, - "title": "ReqSendTx", - "required": [ - "tx_type", - "tx_info" - ] - }, - "ReqSendTxBatch": { - "type": "object", - "properties": { - "tx_types": { - "type": "string" - }, - "tx_infos": { - "type": "string" - } + "RespPostApiToken": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "token_id": { + "type": "integer", + "format": "int64" + }, + "api_token": { + "type": "string" + }, + "name": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "expiry": { + "type": "integer", + "format": "int64" + }, + "sub_account_access": { + "type": "boolean", + "format": "boolean" + }, + "revoked": { + "type": "boolean", + "format": "boolean" + }, + "scopes": { + "type": "string" + } + }, + "title": "RespPostApiToken", + "required": [ + "code", + "token_id", + "api_token", + "name", + "account_index", + "expiry", + "sub_account_access", + "revoked", + "scopes" + ] + }, + "RespRevokeApiToken": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "token_id": { + "type": "integer", + "format": "int64" + }, + "revoked": { + "type": "boolean", + "format": "boolean" + } + }, + "title": "RespRevokeApiToken", + "required": [ + "code", + "token_id", + "revoked" + ] }, - "title": "ReqSendTxBatch", - "required": [ - "tx_types", - "tx_infos" - ] - }, - "ReqUnregisterPushNotifToken": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expo_token": { - "type": "string" - } + "ApiToken": { + "type": "object", + "properties": { + "token_id": { + "type": "integer", + "format": "int64" + }, + "api_token": { + "type": "string" + }, + "name": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "expiry": { + "type": "integer", + "format": "int64" + }, + "sub_account_access": { + "type": "boolean", + "format": "boolean" + }, + "revoked": { + "type": "boolean", + "format": "boolean" + }, + "scopes": { + "type": "string" + } + }, + "title": "ApiToken", + "required": [ + "token_id", + "api_token", + "name", + "account_index", + "expiry", + "sub_account_access", + "revoked", + "scopes" + ] + }, + "ReqUpdateReferralCode": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "new_referral_code": { + "type": "string" + } + }, + "title": "ReqUpdateReferralCode", + "required": [ + "account_index", + "new_referral_code" + ] }, - "title": "ReqUnregisterPushNotifToken", - "required": [ - "account_index", - "expo_token" - ] - }, - "ReqUpdatePushNotifSettings": { - "type": "object", - "properties": { - "auth": { - "type": "string", - "description": " made optional to support header auth clients" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expo_token": { - "type": "string" - }, - "enabled": { - "type": "boolean", - "format": "boolean" - } + "RespUpdateReferralCode": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "success": { + "type": "boolean", + "format": "boolean", + "example": "true" + } + }, + "title": "RespUpdateReferralCode", + "required": [ + "code", + "success" + ] }, - "title": "ReqUpdatePushNotifSettings", - "required": [ - "account_index", - "expo_token", - "enabled" - ] - }, - "RespChangeAccountTier": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - } + "CreateIntentAddressResp": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "intent_address": { + "type": "string" + } + }, + "title": "CreateIntentAddressResp", + "required": [ + "code", + "intent_address" + ] }, - "title": "RespChangeAccountTier", - "required": [ - "code" - ] - }, - "RespGetApiTokens": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "api_tokens": { - "type": "array", - "items": { - "$ref": "#/definitions/ApiToken" + "ReqUseReferralCode": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "l1_address": { + "type": "string" + }, + "referral_code": { + "type": "string" + }, + "discord": { + "type": "string" + }, + "telegram": { + "type": "string" + }, + "x": { + "type": "string" + }, + "signature": { + "type": "string" } - } + }, + "title": "ReqUseReferralCode", + "required": [ + "l1_address", + "referral_code", + "x" + ] }, - "title": "RespGetApiTokens", - "required": [ - "code", - "api_tokens" - ] - }, - "RespGetBridgesByL1Addr": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "bridges": { - "type": "array", - "items": { - "$ref": "#/definitions/Bridge" + "ReqCreateIntentAddress": { + "type": "object", + "properties": { + "chain_id": { + "type": "string" + }, + "from_addr": { + "type": "string" + }, + "amount": { + "type": "string" + }, + "is_external_deposit": { + "type": "boolean", + "format": "boolean" } - } + }, + "title": "ReqCreateIntentAddress", + "required": [ + "chain_id", + "from_addr", + "amount" + ] }, - "title": "RespGetBridgesByL1Addr", - "required": [ - "code", - "bridges" - ] - }, - "RespGetExchangeMetrics": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "metrics": { - "type": "array", - "items": { - "$ref": "#/definitions/ExchangeMetric" + "BridgeSupportedNetworks": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "networks": { + "type": "array", + "items": { + "$ref": "#/components/schemas/BridgeSupportedNetwork" + } } - } + }, + "title": "BridgeSupportedNetworks", + "required": [ + "code", + "networks" + ] }, - "title": "RespGetExchangeMetrics", - "required": [ - "code", - "metrics" - ] - }, - "RespGetExecuteStats": { - "type": "object", - "properties": { - "period": { - "type": "string", - "enum": [ - "d", - "w", - "m", - "q", - "y", - "all" - ] - }, - "result": { - "type": "array", - "items": { - "$ref": "#/definitions/ExecuteStat" + "ReferralCode": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "referral_code": { + "type": "string", + "example": "5V24K3MJ" + }, + "remaining_usage": { + "type": "integer", + "format": "int32", + "example": "3" } - } - }, - "title": "RespGetExecuteStats", - "required": [ - "period", - "result" - ] - }, - "RespGetFastBridgeInfo": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "fast_bridge_limit": { - "type": "string" - } - }, - "title": "RespGetFastBridgeInfo", - "required": [ - "code", - "fast_bridge_limit" - ] - }, - "RespGetFastwithdrawalInfo": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "to_account_index": { - "type": "integer", - "format": "int64" - }, - "withdraw_limit": { - "type": "string" - }, - "max_withdrawal_amount": { - "type": "string" - } - }, - "title": "RespGetFastwithdrawalInfo", - "required": [ - "code", - "to_account_index", - "withdraw_limit", - "max_withdrawal_amount" - ] - }, - "RespGetIsNextBridgeFast": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "is_next_bridge_fast": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "RespGetIsNextBridgeFast", - "required": [ - "code", - "is_next_bridge_fast" - ] - }, - "RespGetLeaseOptions": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "options": { - "type": "array", - "items": { - "$ref": "#/definitions/LeaseOptionEntry" - } - }, - "lit_incentives_account_index": { - "type": "integer", - "format": "int64" - } - }, - "title": "RespGetLeaseOptions", - "required": [ - "code", - "options", - "lit_incentives_account_index" - ] - }, - "RespGetLeases": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" }, - "message": { - "type": "string" - }, - "leases": { - "type": "array", - "items": { - "$ref": "#/definitions/LeaseEntry" + "title": "ReferralCode", + "required": [ + "code", + "referral_code", + "remaining_usage" + ] + }, + "ReqCreateReferralCode": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" } }, - "next_cursor": { - "type": "string" - } - }, - "title": "RespGetLeases", - "required": [ - "code", - "leases" - ] - }, - "RespGetPushNotifSettings": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "enabled": { - "type": "boolean", - "format": "boolean" - } + "title": "ReqCreateReferralCode", + "required": [ + "account_index" + ] }, - "title": "RespGetPushNotifSettings", - "required": [ - "code", - "account_index", - "enabled" - ] - }, - "RespPostApiToken": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "token_id": { - "type": "integer", - "format": "int64" - }, - "api_token": { - "type": "string" - }, - "name": { - "type": "string" - }, - "account_index": { - "type": "integer", - "format": "int64" - }, - "expiry": { - "type": "integer", - "format": "int64" - }, - "sub_account_access": { - "type": "boolean", - "format": "boolean" - }, - "revoked": { - "type": "boolean", - "format": "boolean" + "ReqUpdateKickback": { + "type": "object", + "properties": { + "auth": { + "type": "string", + "description": " made optional to support header auth clients" + }, + "account_index": { + "type": "integer", + "format": "int64" + }, + "kickback_percentage": { + "type": "number", + "format": "double", + "maximum": 100 + } }, - "scopes": { - "type": "string" - } + "title": "ReqUpdateKickback", + "required": [ + "account_index", + "kickback_percentage" + ] }, - "title": "RespPostApiToken", - "required": [ - "code", - "token_id", - "api_token", - "name", - "account_index", - "expiry", - "sub_account_access", - "revoked", - "scopes" - ] - }, - "RespPublicPoolsMetadata": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "public_pools": { - "type": "array", - "items": { - "$ref": "#/definitions/PublicPoolMetadata" + "Deposit": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "source": { + "type": "string", + "example": "Arbitrum" + }, + "source_chain_id": { + "type": "string", + "example": "42161" + }, + "fast_bridge_tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "batch_claim_tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "cctp_burn_tx_hash": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "amount": { + "type": "string" + }, + "intent_address": { + "type": "string" + }, + "status": { + "type": "string" + }, + "step": { + "type": "string" + }, + "description": { + "type": "string" + }, + "created_at": { + "type": "integer", + "format": "int64" + }, + "updated_at": { + "type": "integer", + "format": "int64" + }, + "is_external_deposit": { + "type": "boolean", + "format": "boolean" + }, + "is_next_bridge_fast": { + "type": "boolean", + "format": "boolean" + } + }, + "title": "Deposit", + "required": [ + "code", + "source", + "source_chain_id", + "fast_bridge_tx_hash", + "batch_claim_tx_hash", + "cctp_burn_tx_hash", + "amount", + "intent_address", + "status", + "step", + "description", + "created_at", + "updated_at", + "is_external_deposit", + "is_next_bridge_fast" + ] + }, + "RespUpdateKickback": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "success": { + "type": "boolean", + "format": "boolean", + "example": "true" } - } - }, - "title": "RespPublicPoolsMetadata", - "required": [ - "code", - "public_pools" - ] - }, - "RespRevokeApiToken": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "token_id": { - "type": "integer", - "format": "int64" - }, - "revoked": { - "type": "boolean", - "format": "boolean" - } - }, - "title": "RespRevokeApiToken", - "required": [ - "code", - "token_id", - "revoked" - ] - }, - "RespSendTx": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "predicted_execution_time_ms": { - "type": "integer", - "format": "int64", - "example": "1751465474" - }, - "volume_quota_remaining": { - "type": "integer", - "format": "int64" - } - }, - "title": "RespSendTx", - "required": [ - "code", - "tx_hash", - "predicted_execution_time_ms", - "volume_quota_remaining" - ] - }, - "RespSendTxBatch": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" }, - "tx_hash": { - "type": "array", - "items": { + "title": "RespUpdateKickback", + "required": [ + "code", + "success" + ] + }, + "Layer1BasicInfo": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "l1_providers": { + "type": "array", + "items": { + "$ref": "#/components/schemas/L1ProviderInfo" + } + }, + "l1_providers_health": { + "type": "boolean", + "format": "boolean", + "example": "true" + }, + "validator_info": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ValidatorInfo" + } + }, + "contract_addresses": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ContractAddress" + } + }, + "latest_l1_generic_block": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "latest_l1_governance_block": { + "type": "integer", + "format": "int64", + "example": "45434" + }, + "latest_l1_desert_block": { + "type": "integer", + "format": "int64", + "example": "45434" + } + }, + "title": "Layer1BasicInfo", + "required": [ + "code", + "l1_providers", + "l1_providers_health", + "validator_info", + "contract_addresses", + "latest_l1_generic_block", + "latest_l1_governance_block", + "latest_l1_desert_block" + ] + }, + "RespGetExchangeMetrics": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { "type": "string" + }, + "metrics": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExchangeMetric" + } } }, - "predicted_execution_time_ms": { - "type": "integer", - "format": "int64", - "example": "1751465474" - }, - "volume_quota_remaining": { - "type": "integer", - "format": "int64" - } - }, - "title": "RespSendTxBatch", - "required": [ - "code", - "tx_hash", - "predicted_execution_time_ms", - "volume_quota_remaining" - ] - }, - "RespWithdrawalDelay": { - "type": "object", - "properties": { - "seconds": { - "type": "integer", - "format": "int64", - "example": "86400" - } - }, - "title": "RespWithdrawalDelay", - "required": [ - "seconds" - ] - }, - "ResultCode": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - } + "title": "RespGetExchangeMetrics", + "required": [ + "code", + "metrics" + ] }, - "title": "ResultCode", - "required": [ - "code" - ] - }, - "RiskInfo": { - "type": "object", - "properties": { - "cross_risk_parameters": { - "$ref": "#/definitions/RiskParameters" - }, - "isolated_risk_parameters": { - "type": "array", - "items": { - "$ref": "#/definitions/RiskParameters" + "ExchangeMetric": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64", + "example": "1640995200" + }, + "data": { + "type": "number", + "format": "double", + "example": "93566.25" } - } - }, - "title": "RiskInfo", - "required": [ - "cross_risk_parameters", - "isolated_risk_parameters" - ] - }, - "RiskParameters": { - "type": "object", - "properties": { - "market_id": { - "type": "integer", - "format": "int16" - }, - "collateral": { - "type": "string" }, - "total_account_value": { - "type": "string" - }, - "initial_margin_req": { - "type": "string" - }, - "maintenance_margin_req": { - "type": "string" - }, - "close_out_margin_req": { - "type": "string" - } + "title": "ExchangeMetric", + "required": [ + "timestamp", + "data" + ] }, - "title": "RiskParameters", - "required": [ - "market_id", - "collateral", - "total_account_value", - "initial_margin_req", - "maintenance_margin_req", - "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": { - "order_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "order_id": { - "type": "string", - "example": "1" - }, - "owner_account_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "initial_base_amount": { - "type": "string", - "example": "0.1" - }, - "remaining_base_amount": { - "type": "string", - "example": "0.1" - }, - "price": { - "type": "string", - "example": "3024.66" - }, - "order_expiry": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - } - }, - "title": "SimpleOrder", - "required": [ - "order_index", - "order_id", - "owner_account_index", - "initial_base_amount", - "remaining_base_amount", - "price", - "order_expiry", - "transaction_time" - ] - }, - "SlippageResult": { - "type": "object", - "properties": { - "exchange": { - "type": "string", - "example": "lighter" - }, - "market": { - "type": "string", - "example": "ETH" - }, - "size_usd": { - "type": "integer", - "format": "int64", - "example": "1000" - }, - "avg_slippage": { - "type": "number", - "format": "double", - "example": "0.5" - }, - "data_count": { - "type": "integer", - "format": "int64", - "example": "100" - } - }, - "title": "SlippageResult", - "required": [ - "exchange", - "market", - "size_usd", - "avg_slippage", - "data_count" - ] - }, - "SpotAvgEntryPrice": { - "type": "object", - "properties": { - "asset_id": { - "type": "integer", - "format": "int16" - }, - "avg_entry_price": { - "type": "string" - }, - "asset_size": { - "type": "string" - }, - "last_trade_id": { - "type": "integer", - "format": "int64" - } - }, - "title": "SpotAvgEntryPrice", - "required": [ - "asset_id", - "avg_entry_price", - "asset_size", - "last_trade_id" - ] - }, - "SpotMarketStats": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH/USDC" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "index_price": { - "type": "string", - "example": "3024.66" - }, - "mid_price": { - "type": "string", - "example": "3024.66" - }, - "last_trade_price": { - "type": "string", - "example": "3024.66" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_price_low": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "daily_price_high": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_price_change": { - "type": "number", - "format": "double", - "example": "3.66" + "ExecuteStat": { + "type": "object", + "properties": { + "timestamp": { + "type": "integer", + "format": "int64" + }, + "slippage": { + "type": "array", + "items": { + "$ref": "#/components/schemas/SlippageResult" + } + } } }, - "title": "SpotMarketStats", - "required": [ - "symbol", - "market_id", - "index_price", - "mid_price", - "last_trade_price", - "daily_base_token_volume", - "daily_quote_token_volume", - "daily_price_low", - "daily_price_high", - "daily_price_change" - ] - }, - "SpotOrderBookDetail": { - "type": "object", - "properties": { - "symbol": { - "type": "string", - "example": "ETH" - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "market_type": { - "type": "string", - "example": "perp", - "enum": [ - "perp", - "spot" - ] - }, - "base_asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "quote_asset_id": { - "type": "integer", - "format": "int16", - "example": "2" - }, - "status": { - "type": "string", - "example": "active", - "enum": [ - "inactive", - "active" - ] - }, - "taker_fee": { - "type": "string", - "example": "0.0001" - }, - "maker_fee": { - "type": "string", - "example": "0.0000" - }, - "liquidation_fee": { - "type": "string", - "example": "0.01" - }, - "min_base_amount": { - "type": "string", - "example": "0.01" - }, - "min_quote_amount": { - "type": "string", - "example": "0.1" - }, - "order_quote_limit": { - "type": "string", - "example": "235.25" - }, - "supported_size_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_price_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "supported_quote_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "size_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "price_decimals": { - "type": "integer", - "format": "uint8", - "example": "4" - }, - "last_trade_price": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_trades_count": { - "type": "integer", - "format": "int64", - "example": "68" - }, - "daily_base_token_volume": { - "type": "number", - "format": "double", - "example": "235.25" - }, - "daily_quote_token_volume": { - "type": "number", - "format": "double", - "example": "93566.25" - }, - "daily_price_low": { - "type": "number", - "format": "double", - "example": "3014.66" - }, - "daily_price_high": { - "type": "number", - "format": "double", - "example": "3024.66" - }, - "daily_price_change": { - "type": "number", - "format": "double", - "example": "3.66" - }, - "daily_chart": { - "type": "object", - "example": "{1640995200:3024.66}", - "additionalProperties": { + "SlippageResult": { + "type": "object", + "properties": { + "exchange": { + "type": "string", + "example": "lighter" + }, + "market": { + "type": "string", + "example": "ETH" + }, + "size_usd": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "avg_slippage": { "type": "number", - "format": "double" + "format": "double", + "example": "0.5" + }, + "data_count": { + "type": "integer", + "format": "int64", + "example": "100" + } + }, + "title": "SlippageResult", + "required": [ + "exchange", + "market", + "size_usd", + "avg_slippage", + "data_count" + ] + }, + "RespGetExecuteStats": { + "type": "object", + "properties": { + "period": { + "type": "string" + }, + "result": { + "type": "array", + "items": { + "$ref": "#/components/schemas/ExecuteStat" + } } - } - }, - "title": "SpotOrderBookDetail", - "required": [ - "symbol", - "market_id", - "market_type", - "base_asset_id", - "quote_asset_id", - "status", - "taker_fee", - "maker_fee", - "liquidation_fee", - "min_base_amount", - "min_quote_amount", - "order_quote_limit", - "supported_size_decimals", - "supported_price_decimals", - "supported_quote_decimals", - "size_decimals", - "price_decimals", - "last_trade_price", - "daily_trades_count", - "daily_base_token_volume", - "daily_quote_token_volume", - "daily_price_low", - "daily_price_high", - "daily_price_change", - "daily_chart" - ] - }, - "Status": { - "type": "object", - "properties": { - "status": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "network_id": { - "type": "integer", - "format": "int32", - "example": "1" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1717777777" - } - }, - "title": "Status", - "required": [ - "status", - "network_id", - "timestamp" - ] - }, - "Strategy": { - "type": "object", - "properties": { - "collateral": { - "type": "string", - "example": "199955" - } + }, + "required": [ + "period", + "result" + ] }, - "title": "Strategy", - "required": [ - "collateral" - ] - }, - "SubAccounts": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "sub_accounts": { - "type": "array", - "example": "1", - "items": { - "$ref": "#/definitions/Account" + "LeaseOptionEntry": { + "type": "object", + "properties": { + "duration_days": { + "type": "integer", + "description": "Lease duration in days" + }, + "annual_rate": { + "type": "number", + "format": "double", + "description": "Annual rate as a percentage (e.g. 25.0 means 25%)" } } }, - "title": "SubAccounts", - "required": [ - "code", - "l1_address", - "sub_accounts" - ] - }, - "SystemConfig": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "liquidity_pool_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "staking_pool_index": { - "type": "integer", - "format": "int64", - "example": "2" - }, - "funding_fee_rebate_account_index": { - "type": "integer", - "format": "int64", - "example": "2" - }, - "liquidity_pool_cooldown_period": { - "type": "integer", - "format": "int64", - "example": "86400" - }, - "staking_pool_lockup_period": { - "type": "integer", - "format": "int64", - "example": "604800" - }, - "max_integrator_spot_taker_fee": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "max_integrator_spot_maker_fee": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "max_integrator_perps_taker_fee": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "max_integrator_perps_maker_fee": { - "type": "integer", - "format": "int32", - "example": "200" + "RespGetLeaseOptions": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "options": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LeaseOptionEntry" + } + }, + "lit_incentives_account_index": { + "type": "integer", + "format": "int64", + "description": "Account index that receives the leasing fee" + } } }, - "title": "SystemConfig", - "required": [ - "code", - "liquidity_pool_index", - "staking_pool_index", - "funding_fee_rebate_account_index", - "liquidity_pool_cooldown_period", - "staking_pool_lockup_period", - "max_integrator_spot_taker_fee", - "max_integrator_spot_maker_fee", - "max_integrator_perps_taker_fee", - "max_integrator_perps_maker_fee" - ] - }, - "Ticker": { - "type": "object", - "properties": { - "s": { - "type": "string", - "example": "ETH" - }, - "a": { - "$ref": "#/definitions/PriceLevel" - }, - "b": { - "$ref": "#/definitions/PriceLevel" + "LeaseEntry": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64", + "description": "Lease ID" + }, + "master_account_index": { + "type": "integer", + "format": "int64", + "description": "Master account index" + }, + "lease_amount": { + "type": "integer", + "format": "int64", + "description": "Leased LIT amount in raw units (1 LIT = 1e8)" + }, + "fee_amount": { + "type": "integer", + "format": "int64", + "description": "Fee paid in raw units" + }, + "start": { + "type": "integer", + "format": "int64", + "description": "Lease start time (Unix milliseconds)" + }, + "end": { + "type": "integer", + "format": "int64", + "description": "Lease end time (Unix milliseconds)" + }, + "status": { + "type": "string", + "enum": [ + "waiting_fee", + "leased", + "expired", + "canceled" + ], + "description": "Lease status" + }, + "error": { + "type": "string", + "description": "Error message if lease was canceled" + } + }, + "required": [ + "end", + "error", + "fee_amount", + "id", + "lease_amount", + "master_account_index", + "start", + "status" + ] + }, + "RespGetLeases": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "leases": { + "type": "array", + "items": { + "$ref": "#/components/schemas/LeaseEntry" + } + }, + "next_cursor": { + "type": "string", + "description": "Cursor to pass as the cursor param to fetch the next page. Absent if no more pages." + } } }, - "title": "Ticker", - "required": [ - "s", - "a", - "b" - ] - }, - "Trade": { - "type": "object", - "properties": { - "trade_id": { - "type": "integer", - "format": "int64", - "example": "145" - }, - "tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "type": { - "type": "string", - "example": "trade", - "enum": [ - "trade", - "liquidation", - "deleverage", - "market-settlement" - ] - }, - "market_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "size": { - "type": "string", - "example": "0.1" - }, - "price": { - "type": "string", - "example": "3024.66" - }, - "usd_amount": { - "type": "string", - "example": "3024.66" - }, - "ask_id": { - "type": "integer", - "format": "int64", - "example": "145" - }, - "bid_id": { - "type": "integer", - "format": "int64", - "example": "245" - }, - "ask_client_id": { - "type": "integer", - "format": "int64", - "example": "145" - }, - "bid_client_id": { - "type": "integer", - "format": "int64", - "example": "245" - }, - "ask_account_id": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "bid_account_id": { - "type": "integer", - "format": "int64", - "example": "3" - }, - "is_maker_ask": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "block_height": { - "type": "integer", - "format": "int64", - "example": "45434" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "taker_fee": { - "type": "integer", - "format": "int32", - "example": "0" - }, - "taker_position_size_before": { - "type": "string", - "example": "0" - }, - "taker_entry_quote_before": { - "type": "string", - "example": "0" - }, - "taker_initial_margin_fraction_before": { - "type": "integer", - "format": "uin16", - "example": "0" - }, - "taker_position_sign_changed": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "maker_fee": { - "type": "integer", - "format": "int32", - "example": "0" - }, - "maker_position_size_before": { - "type": "string", - "example": "0" - }, - "maker_entry_quote_before": { - "type": "string", - "example": "0" - }, - "maker_initial_margin_fraction_before": { - "type": "integer", - "format": "uin16", - "example": "0" - }, - "maker_position_sign_changed": { - "type": "boolean", - "format": "boolean", - "example": "true" - }, - "transaction_time": { - "type": "integer", - "format": "int64", - "example": "1257894000000000" - }, - "ask_account_pnl": { - "type": "string", - "example": "1967" - }, - "bid_account_pnl": { - "type": "string", - "example": "1967" + "ReqLITLease": { + "type": "object", + "properties": { + "tx_info": { + "type": "string", + "description": "Signed transaction info (JSON with L2 signature, L1 signature, etc.)" + }, + "lease_amount": { + "type": "string", + "description": "Amount of LIT to lease in raw units (1 LIT = 100000000)" + }, + "duration_days": { + "type": "integer", + "description": "Lease duration in days. Must match one of the available lease options." + } } }, - "title": "Trade", - "required": [ - "trade_id", - "tx_hash", - "type", - "market_id", - "size", - "price", - "usd_amount", - "ask_id", - "bid_id", - "ask_client_id", - "bid_client_id", - "ask_account_id", - "bid_account_id", - "is_maker_ask", - "block_height", - "timestamp", - "taker_fee", - "taker_position_size_before", - "taker_entry_quote_before", - "taker_initial_margin_fraction_before", - "taker_position_sign_changed", - "maker_fee", - "maker_position_size_before", - "maker_entry_quote_before", - "maker_initial_margin_fraction_before", - "maker_position_sign_changed", - "transaction_time", - "ask_account_pnl", - "bid_account_pnl" - ] - }, - "TradeStats": { - "type": "object", - "properties": { - "count": { - "type": "integer", - "format": "int64" - }, - "volume": { - "type": "string" - }, - "web_count": { - "type": "integer", - "format": "int64" - }, - "web_volume": { - "type": "string" - }, - "mobile_app_count": { - "type": "integer", - "format": "int64" - }, - "mobile_app_volume": { - "type": "string" - }, - "mobile_browser_count": { - "type": "integer", - "format": "int64" + "Referral": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + }, + "referral_code": { + "type": "string" + }, + "used_at": { + "type": "integer", + "format": "int64" + }, + "trade_stats": { + "$ref": "#/components/schemas/TradeStats" + }, + "tier": { + "type": "string" + } }, - "mobile_browser_volume": { - "type": "string" - } + "required": [ + "trade_stats", + "l1_address", + "referral_code", + "tier", + "used_at" + ] }, - "title": "TradeStats", - "required": [ - "count", - "volume", - "web_count", - "web_volume", - "mobile_app_count", - "mobile_app_volume", - "mobile_browser_count", - "mobile_browser_volume" - ] - }, - "Trades": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "next_cursor": { - "type": "string" - }, - "trades": { - "type": "array", - "items": { - "$ref": "#/definitions/Trade" + "UserReferrals": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "cursor": { + "type": "string" + }, + "referrals": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Referral" + } + }, + "used_code": { + "type": "string" } - } + }, + "required": [ + "code", + "cursor", + "referrals", + "used_code" + ] }, - "title": "Trades", - "required": [ - "code", - "trades" - ] - }, - "TransferFeeInfo": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "transfer_fee_usdc": { - "type": "integer", - "format": "int64" + "ReqSetAccountMetadata": { + "type": "object", + "properties": { + "master_account_index": { + "type": "integer", + "format": "int64" + }, + "target_account_index": { + "type": "integer", + "format": "int64" + }, + "api_key_index": { + "type": "integer", + "format": "uint8" + }, + "metadata": { + "type": "object" + }, + "auth": { + "type": "string" + } } }, - "title": "TransferFeeInfo", - "required": [ - "code", - "transfer_fee_usdc" - ] - }, - "TransferHistory": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "transfers": { - "type": "array", - "items": { - "$ref": "#/definitions/TransferHistoryItem" + "SystemConfig": { + "type": "object", + "properties": { + "code": { + "type": "integer" + }, + "message": { + "type": "string" + }, + "liquidity_pool_index": { + "type": "integer", + "format": "int64" + }, + "staking_pool_index": { + "type": "integer", + "format": "int64" + }, + "funding_fee_rebate_account_index": { + "type": "integer", + "format": "int64" + }, + "liquidity_pool_cooldown_period": { + "type": "integer", + "format": "int64" + }, + "staking_pool_lockup_period": { + "type": "integer", + "format": "int64" + }, + "max_integrator_perps_maker_fee": { + "type": "integer", + "format": "int32" + }, + "max_integrator_perps_taker_fee": { + "type": "integer", + "format": "int32" + }, + "max_integrator_spot_maker_fee": { + "type": "integer", + "format": "int32" + }, + "max_integrator_spot_taker_fee": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "max_integrator_perps_maker_fee", + "max_integrator_perps_taker_fee", + "max_integrator_spot_maker_fee", + "max_integrator_spot_taker_fee", + "code", + "funding_fee_rebate_account_index", + "liquidity_pool_cooldown_period", + "liquidity_pool_index", + "staking_pool_index", + "staking_pool_lockup_period" + ] + }, + "PendingUnlock": { + "type": "object", + "properties": { + "unlock_timestamp": { + "type": "integer", + "format": "int64" + }, + "asset_index": { + "type": "integer", + "format": "int16" + }, + "amount": { + "type": "string" } }, - "cursor": { - "type": "string" - } - }, - "title": "TransferHistory", - "required": [ - "code", - "transfers", - "cursor" - ] - }, - "TransferHistoryItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "amount": { - "type": "string", - "example": "0.1" - }, - "fee": { - "type": "string", - "example": "3" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "type": { - "type": "string", - "enum": [ - "L2TransferInflow", - "L2TransferOutflow", - "L2BurnSharesInflow", - "L2BurnSharesOutflow", - "L2MintSharesInflow", - "L2MintSharesOutflow", - "L2SelfTransfer", - "L2StakeAssetInflow", - "L2StakeAssetOutflow", - "L2UnstakeAssetInflow", - "L2UnstakeAssetOutflow", - "L2ForceBurnSharesInflow", - "L2ForceBurnSharesOutflow" - ] - }, - "from_l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "to_l1_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "from_account_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "to_account_index": { - "type": "integer", - "format": "int64", - "example": "1" - }, - "from_route": { - "type": "string", - "enum": [ - "spot", - "perps" - ] - }, - "to_route": { - "type": "string", - "enum": [ - "spot", - "perps" - ] - }, - "tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - } - }, - "title": "TransferHistoryItem", - "required": [ - "id", - "asset_id", - "amount", - "fee", - "timestamp", - "type", - "from_l1_address", - "to_l1_address", - "from_account_index", - "to_account_index", - "from_route", - "to_route", - "tx_hash" - ] - }, - "TxHash": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - } + "required": [ + "unlock_timestamp", + "asset_index", + "amount" + ] }, - "title": "TxHash", - "required": [ - "code", - "tx_hash" - ] - }, - "TxHashes": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "tx_hash": { - "type": "array", - "items": { + "Strategy": { + "type": "object", + "properties": { + "collateral": { "type": "string" } - } - }, - "title": "TxHashes", - "required": [ - "code", - "tx_hash" - ] - }, - "UserReferrals": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" }, - "message": { - "type": "string" + "required": [ + "collateral" + ] + }, + "TradeStats": { + "type": "object", + "properties": { + "count": { + "type": "integer", + "format": "int64" + }, + "volume": { + "type": "string" + }, + "web_count": { + "type": "integer", + "format": "int64" + }, + "web_volume": { + "type": "string" + }, + "mobile_app_count": { + "type": "integer", + "format": "int64" + }, + "mobile_app_volume": { + "type": "string" + }, + "mobile_browser_count": { + "type": "integer", + "format": "int64" + }, + "mobile_browser_volume": { + "type": "string" + } }, - "cursor": { - "type": "string" + "title": "TradeStats", + "required": [ + "count", + "volume", + "web_count", + "web_volume", + "mobile_app_count", + "mobile_app_volume", + "mobile_browser_count", + "mobile_browser_volume" + ] + }, + "ApprovedIntegrator": { + "type": "object", + "properties": { + "account_index": { + "type": "integer", + "format": "int64", + "example": "54621" + }, + "name": { + "type": "string", + "example": "Integrator1" + }, + "max_perps_taker_fee": { + "type": "integer", + "format": "int32", + "example": "10" + }, + "max_perps_maker_fee": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "max_spot_taker_fee": { + "type": "integer", + "format": "int32", + "example": "10" + }, + "max_spot_maker_fee": { + "type": "integer", + "format": "int32", + "example": "1" + }, + "approval_expiry": { + "type": "integer", + "format": "int64", + "example": "1640995200", + "description": " Timestamp in milliseconds, after which the integrator is no longer approved" + } + }, + "title": "ApprovedIntegrator", + "required": [ + "account_index", + "name", + "max_perps_taker_fee", + "max_perps_maker_fee", + "max_spot_taker_fee", + "max_spot_maker_fee", + "approval_expiry" + ] + }, + "SpotMarketStats": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH/USDC" + }, + "market_id": { + "type": "integer", + "format": "int16", + "example": "1" + }, + "index_price": { + "type": "string", + "example": "3024.66" + }, + "mid_price": { + "type": "string", + "example": "3024.66" + }, + "last_trade_price": { + "type": "string", + "example": "3024.66" + }, + "daily_base_token_volume": { + "type": "number", + "format": "double", + "example": "235.25" + }, + "daily_quote_token_volume": { + "type": "number", + "format": "double", + "example": "93566.25" + }, + "daily_price_low": { + "type": "number", + "format": "double", + "example": "3014.66" + }, + "daily_price_high": { + "type": "number", + "format": "double", + "example": "3024.66" + }, + "daily_price_change": { + "type": "number", + "format": "double", + "example": "3.66" + } + }, + "title": "SpotMarketStats", + "required": [ + "symbol", + "market_id", + "index_price", + "mid_price", + "last_trade_price", + "daily_base_token_volume", + "daily_quote_token_volume", + "daily_price_low", + "daily_price_high", + "daily_price_change" + ] + }, + "SpotAvgEntryPrice": { + "type": "object", + "properties": { + "asset_id": { + "type": "integer", + "format": "int16" + }, + "avg_entry_price": { + "type": "string" + }, + "asset_size": { + "type": "string" + }, + "last_trade_id": { + "type": "integer", + "format": "int64" + } }, - "referrals": { - "type": "array", - "items": { - "$ref": "#/definitions/Referral" + "title": "SpotAvgEntryPrice", + "required": [ + "asset_id", + "avg_entry_price", + "asset_size", + "last_trade_id" + ] + }, + "Token": { + "type": "object", + "title": "Token", + "required": [ + "symbol", + "name", + "logo", + "logo_extension", + "description_key", + "gecko_id", + "paprika_id", + "market", + "asset_type", + "categories", + "is_allowed_mainnet", + "is_allowed_staging", + "is_allowed_testnet", + "is_asset_allowed_mainnet", + "is_asset_allowed_staging", + "is_asset_allowed_testnet" + ], + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "name": { + "type": "string", + "example": "Ethereum" + }, + "logo": { + "type": "string", + "example": "eth" + }, + "logo_extension": { + "type": "string", + "example": "svg", + "enum": [ + "svg", + "png" + ] + }, + "description_key": { + "type": "string", + "example": "token_description_eth" + }, + "gecko_id": { + "type": "string", + "example": "ethereum" + }, + "paprika_id": { + "type": "string", + "example": "eth-ethereum" + }, + "market": { + "type": "string", + "enum": [ + "SPOT", + "PERPS" + ] + }, + "asset_type": { + "type": "string", + "enum": [ + "CRYPTO", + "RWA" + ] + }, + "categories": { + "type": "array", + "items": { + "type": "string" + } + }, + "is_allowed_mainnet": { + "type": "boolean", + "format": "boolean" + }, + "is_allowed_staging": { + "type": "boolean", + "format": "boolean" + }, + "is_allowed_testnet": { + "type": "boolean", + "format": "boolean" + }, + "is_asset_allowed_mainnet": { + "type": "boolean", + "format": "boolean" + }, + "is_asset_allowed_staging": { + "type": "boolean", + "format": "boolean" + }, + "is_asset_allowed_testnet": { + "type": "boolean", + "format": "boolean" } } }, - "title": "UserReferrals", - "required": [ - "code", - "cursor", - "referrals" - ] - }, - "ValidatorInfo": { - "type": "object", - "properties": { - "address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - }, - "is_active": { - "type": "boolean", - "format": "boolean", - "example": "true" + "TokenList": { + "type": "object", + "title": "TokenList", + "required": [ + "code", + "tokens" + ], + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": 200 + }, + "message": { + "type": "string" + }, + "tokens": { + "type": "array", + "items": { + "$ref": "#/components/schemas/Token" + } + } } }, - "title": "ValidatorInfo", - "required": [ - "address", - "is_active" - ] - }, - "WithdrawHistory": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32", - "example": "200" - }, - "message": { - "type": "string" - }, - "withdraws": { - "type": "array", - "items": { - "$ref": "#/definitions/WithdrawHistoryItem" + "PartnerStats": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total_fees_earned": { + "type": "string" + }, + "total_taker_fees_earned": { + "type": "string" + }, + "total_maker_fees_earned": { + "type": "string" + }, + "total_volume": { + "type": "string" + }, + "total_taker_volume": { + "type": "string" + }, + "total_maker_volume": { + "type": "string" + }, + "total_trades": { + "type": "integer", + "format": "int64" + }, + "total_taker_trades": { + "type": "integer", + "format": "int64" + }, + "total_maker_trades": { + "type": "integer", + "format": "int64" + }, + "unique_clients": { + "type": "integer", + "format": "int64" } }, - "cursor": { - "type": "string" - } - }, - "title": "WithdrawHistory", - "required": [ - "code", - "withdraws", - "cursor" - ] - }, - "WithdrawHistoryItem": { - "type": "object", - "properties": { - "id": { - "type": "string" - }, - "asset_id": { - "type": "integer", - "format": "int16", - "example": "1" - }, - "amount": { - "type": "string", - "example": "0.1" - }, - "timestamp": { - "type": "integer", - "format": "int64", - "example": "1640995200" - }, - "status": { - "type": "string", - "enum": [ - "failed", - "pending", - "claimable", - "refunded", - "completed" - ] - }, - "type": { - "type": "string", - "enum": [ - "secure", - "fast" - ] - }, - "l1_tx_hash": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - } - }, - "title": "WithdrawHistoryItem", - "required": [ - "id", - "asset_id", - "amount", - "timestamp", - "status", - "type", - "l1_tx_hash" - ] - }, - "ZkLighterInfo": { - "type": "object", - "properties": { - "contract_address": { - "type": "string", - "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" - } - }, - "title": "ZkLighterInfo", - "required": [ - "contract_address" - ] - } - }, - "securityDefinitions": { - "apiKey": { - "type": "apiKey", - "description": "Enter JWT Bearer token **_only_**", - "name": "Authorization", - "in": "header" + "title": "PartnerStats", + "required": [ + "code", + "total_fees_earned", + "total_taker_fees_earned", + "total_maker_fees_earned", + "total_volume", + "total_taker_volume", + "total_maker_volume", + "total_trades", + "total_taker_trades", + "total_maker_trades", + "unique_clients" + ] + } } } } \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index edbf665..76502cd 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,36 +1,35 @@ -[tool.poetry] -name = "lighter-sdk" -version = "1.0.8" -description = "Python client for Lighter" -authors = ["elliot"] -license = "NoLicense" +[project] +name = "lighter" +version = "1.0.0" +description = "" +authors = [ + {name = "OpenAPI Generator Community",email = "team@openapitools.org"}, +] readme = "README.md" -repository = "https://github.com/elliottech/lighter-python" -keywords = ["OpenAPI", "OpenAPI-Generator"] -include = ["lighter/py.typed"] +keywords = ["OpenAPI", "OpenAPI-Generator", ""] +requires-python = ">=3.9" -[tool.poetry.packages] -python = ["lighter"] +dependencies = [ + "python-dateutil (>=2.8.2)", + "aiohttp (>=3.8.4)", + "aiohttp-retry (>=2.8.3)", + "pydantic (>=2.11)", + "typing-extensions (>=4.7.1)", +] -[tool.poetry.dependencies] -python = "^3.8" +[project.urls] +Repository = "https://github.com/GIT_USER_ID/GIT_REPO_ID" -urllib3 = ">= 1.25.3" -python-dateutil = ">=2.8.2" -aiohttp = ">= 3.8.4" -aiohttp-retry = ">= 2.8.3" -pydantic = ">=2" -typing-extensions = ">=4.7.1" -websockets = ">= 12.0.0" -eth-account = ">=0.13.4" -requests = ">=2.31.0" +[tool.poetry] +requires-poetry = ">=2.0" -[tool.poetry.dev-dependencies] -pytest = ">=7.2.1" -tox = ">=3.9.0" -flake8 = ">=4.0.0" -types-python-dateutil = ">=2.8.19.14" -mypy = "1.4.1" +[tool.poetry.group.dev.dependencies] +pytest = ">= 7.2.1" +pytest-cov = ">= 2.8.1" +tox = ">= 3.9.0" +flake8 = ">= 4.0.0" +types-python-dateutil = ">= 2.8.19.14" +mypy = ">= 1.5" [build-system] @@ -56,7 +55,7 @@ warn_unused_ignores = true ## Getting these passing should be easy strict_equality = true -strict_concatenate = true +extra_checks = true ## Strongly recommend enabling this one as soon as you can check_untyped_defs = true @@ -77,3 +76,20 @@ disallow_any_generics = true # ### This one can be tricky to get passing if you use a lot of untyped libraries #warn_return_any = true + +[[tool.mypy.overrides]] +module = [ + "lighter.configuration", +] +warn_unused_ignores = true +strict_equality = true +extra_checks = true +check_untyped_defs = true +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true +disallow_untyped_calls = true +disallow_incomplete_defs = true +disallow_untyped_defs = true +no_implicit_reexport = true +warn_return_any = true diff --git a/requirements.txt b/requirements.txt index a21c5cd..10da70b 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,10 +1,5 @@ -python_dateutil >= 2.5.3 -setuptools >= 21.0.0 -urllib3 >= 1.25.3, < 2.1.0 -pydantic >= 2 -typing-extensions >= 4.7.1 -aiohttp >= 3.0.0 +python_dateutil >= 2.8.2 +aiohttp >= 3.8.4 aiohttp-retry >= 2.8.3 -websockets >= 12.0.0 -eth-account >= 0.13.4 -requests >= 2.31.0 \ No newline at end of file +pydantic >= 2.11 +typing-extensions >= 4.7.1 diff --git a/setup.py b/setup.py index d5708eb..9c8f67a 100644 --- a/setup.py +++ b/setup.py @@ -1,5 +1,3 @@ -# coding: utf-8 - """ @@ -21,24 +19,20 @@ # prerequisite: setuptools # http://pypi.python.org/pypi/setuptools NAME = "lighter-sdk" -VERSION = "1.0.8" -PYTHON_REQUIRES = ">=3.7" +VERSION = "1.0.0" +PYTHON_REQUIRES = ">= 3.9" REQUIRES = [ - "urllib3 >= 1.25.3, < 2.1.0", - "python-dateutil", - "aiohttp >= 3.0.0", + "python-dateutil >= 2.8.2", + "aiohttp >= 3.8.4", "aiohttp-retry >= 2.8.3", - "pydantic >= 2", + "pydantic >= 2.11", "typing-extensions >= 4.7.1", - "websockets >= 12.0.0", - "eth-account >= 0.13.4", - "requests >= 2.31.0", ] setup( name=NAME, version=VERSION, - description="Python SDK for lighter.xyz", + description="", author="OpenAPI Generator community", author_email="team@openapitools.org", url="", @@ -46,9 +40,9 @@ install_requires=REQUIRES, packages=find_packages(exclude=["test", "tests"]), include_package_data=True, - long_description_content_type="text/markdown", + long_description_content_type='text/markdown', long_description="""\ - Python SDK for Lighter trading. Includes api clients and signer. + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) """, # noqa: E501 - package_data={"lighter": ["py.typed", "signers/*"]}, + package_data={"lighter": ["py.typed"]}, ) diff --git a/test-requirements.txt b/test-requirements.txt index 057e6ec..e98555c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -1,7 +1,6 @@ -pytest~=7.1.3 -pytest-cov>=2.8.1 -pytest-randomly>=3.12.0 -mypy>=1.4.1 -types-python-dateutil>=2.8.19 -eth-account>=0.13.4 - +pytest >= 7.2.1 +pytest-cov >= 2.8.1 +tox >= 3.9.0 +flake8 >= 4.0.0 +types-python-dateutil >= 2.8.19.14 +mypy >= 1.5 diff --git a/tox.ini b/tox.ini index 8941ca0..aca8c10 100644 --- a/tox.ini +++ b/tox.ini @@ -6,4 +6,4 @@ deps=-r{toxinidir}/requirements.txt -r{toxinidir}/test-requirements.txt commands= - pytest --cov=lighter --ignore-glob *api.py + pytest --cov=lighter