diff --git a/docs/lighter/get-start.md b/docs/lighter/get-start.md new file mode 100644 index 0000000..131551e --- /dev/null +++ b/docs/lighter/get-start.md @@ -0,0 +1,78 @@ +Welcome to the Lighter SDK and API Introduction. Here, we will go through everything from the system setup, to creating and cancelling all types of orders, to fetching exchange data. + +Setting up an API KEY +In order to get started using the Lighter API, you must first set up an API_KEY_PRIVATE_KEY, as you will need it to sign any transaction you want to make. You can find how to do it in the following example. The BASE_URL will reflect if your key is generated on testnet or mainnet (for mainnet, just change the BASE_URL in the example to https://mainnet.zklighter.elliot.ai). Note that you also need to provide your ETH_PRIVATE_KEY. + +You can setup up to 253 API keys (2 <= API_KEY_INDEX <= 254). The 0 index is the one reserved for the desktop, while 1 is the one reserved for the mobile. Finally, the 255 index can be used as a value for the api_key_index parameter of the apikeys method of the AccountApi for getting the data about all the API keys. + +In case you do not know your ACCOUNT_INDEX, you can find it by querying the AccountApi for the data about your account, as shown in this example. + +Account types +Lighter API users can operate under a Standard or Premium account. The Standard account is suitable for latency insensitive traders, providing 0 fees, while the premium one provides a latency suitable for HFTs at 0.2 bps maker and 2 bps taker fees. You can find more information about it in the Account Types section. + +The Signer +In order to create a transaction (create/cancel/modify order), you need to use the SignerClient. For initializing it, use the following lines of code: + +Initialize SignerClient + + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX + ) +The code for the signer can be found in the same repo, in the signer_client.py file. You may notice that it uses a binary for the signer: the code for it can be found in the lighter-go public repo, and you can compile it yourself using the justfile. + +Nonces +When signing a transaction, you may need to provide a nonce (number used once). A nonce needs to be incremented each time you sign something. You can get the next nonce that you need to use using the TransactionApi’s next_nonce method or take care of incrementing it yourself. Note that each nonce is handled per API_KEY. + +Signing a transaction +One can sign a transaction using the SignerClient’s sign_create_order, sign_modify_order, sign_cancel_order and its other similar methods. For actually pushing the transaction, you need to call send_tx or send_tx_batch using the TransactionApi. Here’s an example that includes such an operation. + +Note that base_amount, price are to be passed as integers, and client_order_index is an unique (across all markets) identifier you provide for you to be able to reference this order later (e.g. if you want to cancel it). + +The following values can be provided for the order_type parameter: + +ORDER_TYPE_LIMIT +ORDER_TYPE_MARKET +ORDER_TYPE_STOP_LOSS +ORDER_TYPE_STOP_LOSS_LIMIT +ORDER_TYPE_TAKE_PROFIT +ORDER_TYPE_TAKE_PROFIT_LIMIT +ORDER_TYPE_TWAP +The following values can be provided for the time_in_force parameter: + +ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL +ORDER_TIME_IN_FORCE_GOOD_TILL_TIME +ORDER_TIME_IN_FORCE_POST_ONLY +Signer Client Useful Wrapper Functions +The SignerClient provides several functions that sign and push a type of transaction. Here’s a list of some of them: + +create_order - signs and pushes a create order transaction; +create_market_order - signs and pushes a create order transaction for a market order; +create_cancel_order - signs and pushes a cancel transaction for a certain order. Note that the order_index needs to equal the client_order_index of the order to cancel; +cancel_all_orders - signs and pushes a cancel all transactions. Note that, depending on the time_in_force provided, the transaction has different consequences: +ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL - ImmediateCancelAll; +ORDER_TIME_IN_FORCE_GOOD_TILL_TIME - ScheduledCancelAll; +ORDER_TIME_IN_FORCE_POST_ONLY - AbortScheduledCancelAll. +create_auth_token_with_expiry - creates an auth token (useful for getting data using the Api and Ws methods) +API +The SDK provides API classes that make calling the Lighter API easier. Here are some of them and the most important of their methods: + +AccountApi - provides account data +account - get account data either by l1_address or index +accounts_by_l1_address - get data about all the accounts (master account and subaccounts) +apikeys - get data about the api keys of an account (use api_key_index = 255 for getting data about all the api keys) +TransactionApi - provides transaction related data +next_nonce - get next nonce to be used for signing a transaction using a certain api key +send_tx - push a transaction +send_tx_batch - push several transactions at once +OrderApi - provides data about orders, trades and the orderbook +order_book_details - get data about a specific market’s orderbook +order_books - get data about all markets’ orderbooks +You can find the rest here. We also provide an example showing how to use some of these. For the methods that require an auth token, you can generate one using the create_auth_token_with_expiry method of the SignerClient (the same applies to the websockets auth). + +WebSockets +Lighter also provides access to essential info using websockets. A simple version of an WsClient for subscribing to account and orderbook updates is implemented here. You can also take it as an example implementation of such a client. + +To get access to more data, you will need to connect to the websockets without the provided WsClient. You can find the streams you can connect to, how to connect, and the data they provide in the websockets section. \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/.github/workflows/python.yml b/docs/lighter/lighter-python-main/.github/workflows/python.yml new file mode 100644 index 0000000..7915efb --- /dev/null +++ b/docs/lighter/lighter-python-main/.github/workflows/python.yml @@ -0,0 +1,38 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python + +name: lighter Python package + +on: [push, pull_request] + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + matrix: + python-version: ["3.8", "3.9", "3.10", "3.11"] + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} + - 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 + - name: Test with pytest + run: | + pytest --ignore-glob="*api.py" diff --git a/docs/lighter/lighter-python-main/.gitignore b/docs/lighter/lighter-python-main/.gitignore new file mode 100644 index 0000000..f77f5a6 --- /dev/null +++ b/docs/lighter/lighter-python-main/.gitignore @@ -0,0 +1,71 @@ +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + + +# Distribution / packaging +.Python +env/ +build/ +develop-eggs/ +dist/ +downloads/ +eggs/ +.eggs/ +lib/ +lib64/ +parts/ +sdist/ +var/ +*.egg-info/ +.installed.cfg +*.egg +dev/ + +# PyInstaller +# Usually these files are written by a python script from a template +# before PyInstaller builds the exe, so as to inject date/other infos into it. +*.manifest +*.spec + +# Installer logs +pip-log.txt +pip-delete-this-directory.txt + +# Unit test / coverage reports +htmlcov/ +.tox/ +.coverage +.coverage.* +.cache +nosetests.xml +coverage.xml +*,cover +.hypothesis/ +venv/ +.venv/ +.python-version +.pytest_cache + +# Translations +*.mo +*.pot + +# Django stuff: +*.log + +# Sphinx documentation +docs/_build/ + +# PyBuilder +target/ + +#Ipython Notebook +.ipynb_checkpoints +openapi-generator-cli.jar + + +.idea + +examples/secrets.py \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/.gitlab-ci.yml b/docs/lighter/lighter-python-main/.gitlab-ci.yml new file mode 100644 index 0000000..dd3ae62 --- /dev/null +++ b/docs/lighter/lighter-python-main/.gitlab-ci.yml @@ -0,0 +1,28 @@ +# NOTE: This file is auto generated by OpenAPI Generator. +# URL: https://openapi-generator.tech +# +# ref: https://docs.gitlab.com/ee/ci/README.html +# ref: https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Python.gitlab-ci.yml + +stages: + - test + +.pytest: + stage: test + script: + - pip install -r requirements.txt + - pip install -r test-requirements.txt + - pytest --cov=lighter --ignore-glob *api.py + +pytest-3.8: + extends: .pytest + image: python:3.8-alpine +pytest-3.9: + extends: .pytest + image: python:3.9-alpine +pytest-3.10: + extends: .pytest + image: python:3.10-alpine +pytest-3.11: + extends: .pytest + image: python:3.11-alpine diff --git a/docs/lighter/lighter-python-main/.openapi-generator-ignore b/docs/lighter/lighter-python-main/.openapi-generator-ignore new file mode 100644 index 0000000..7484ee5 --- /dev/null +++ b/docs/lighter/lighter-python-main/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/docs/lighter/lighter-python-main/.openapi-generator/FILES b/docs/lighter/lighter-python-main/.openapi-generator/FILES new file mode 100644 index 0000000..2f225cd --- /dev/null +++ b/docs/lighter/lighter-python-main/.openapi-generator/FILES @@ -0,0 +1,294 @@ +docs/Account.md +docs/AccountApi.md +docs/AccountApiKeys.md +docs/AccountLimits.md +docs/AccountMarginStats.md +docs/AccountMarketStats.md +docs/AccountMetadata.md +docs/AccountMetadatas.md +docs/AccountPnL.md +docs/AccountPosition.md +docs/AccountStats.md +docs/AccountTradeStats.md +docs/Announcement.md +docs/AnnouncementApi.md +docs/Announcements.md +docs/ApiKey.md +docs/Block.md +docs/BlockApi.md +docs/Blocks.md +docs/BridgeApi.md +docs/BridgeSupportedNetwork.md +docs/Candlestick.md +docs/CandlestickApi.md +docs/Candlesticks.md +docs/ContractAddress.md +docs/CurrentHeight.md +docs/Cursor.md +docs/DailyReturn.md +docs/DepositHistory.md +docs/DepositHistoryItem.md +docs/DetailedAccount.md +docs/DetailedAccounts.md +docs/DetailedCandlestick.md +docs/EnrichedTx.md +docs/ExchangeStats.md +docs/ExportData.md +docs/Funding.md +docs/FundingApi.md +docs/FundingRate.md +docs/FundingRates.md +docs/Fundings.md +docs/InfoApi.md +docs/L1Metadata.md +docs/L1ProviderInfo.md +docs/LiqTrade.md +docs/Liquidation.md +docs/LiquidationInfo.md +docs/LiquidationInfos.md +docs/MarketInfo.md +docs/NextNonce.md +docs/NotificationApi.md +docs/Order.md +docs/OrderApi.md +docs/OrderBook.md +docs/OrderBookDepth.md +docs/OrderBookDetail.md +docs/OrderBookDetails.md +docs/OrderBookOrders.md +docs/OrderBookStats.md +docs/OrderBooks.md +docs/Orders.md +docs/PnLEntry.md +docs/PositionFunding.md +docs/PositionFundings.md +docs/PriceLevel.md +docs/PublicPool.md +docs/PublicPoolInfo.md +docs/PublicPoolMetadata.md +docs/PublicPoolShare.md +docs/PublicPools.md +docs/ReferralApi.md +docs/ReferralPointEntry.md +docs/ReferralPoints.md +docs/ReqExportData.md +docs/ReqGetAccount.md +docs/ReqGetAccountActiveOrders.md +docs/ReqGetAccountApiKeys.md +docs/ReqGetAccountByL1Address.md +docs/ReqGetAccountInactiveOrders.md +docs/ReqGetAccountLimits.md +docs/ReqGetAccountMetadata.md +docs/ReqGetAccountPnL.md +docs/ReqGetAccountTxs.md +docs/ReqGetBlock.md +docs/ReqGetBlockTxs.md +docs/ReqGetByAccount.md +docs/ReqGetCandlesticks.md +docs/ReqGetDepositHistory.md +docs/ReqGetFastWithdrawInfo.md +docs/ReqGetFundings.md +docs/ReqGetL1Metadata.md +docs/ReqGetL1Tx.md +docs/ReqGetLatestDeposit.md +docs/ReqGetLiquidationInfos.md +docs/ReqGetNextNonce.md +docs/ReqGetOrderBookDetails.md +docs/ReqGetOrderBookOrders.md +docs/ReqGetOrderBooks.md +docs/ReqGetPositionFunding.md +docs/ReqGetPublicPools.md +docs/ReqGetPublicPoolsMetadata.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/ReqGetWithdrawHistory.md +docs/RespChangeAccountTier.md +docs/RespGetFastBridgeInfo.md +docs/RespPublicPoolsMetadata.md +docs/RespSendTx.md +docs/RespSendTxBatch.md +docs/RespWithdrawalDelay.md +docs/ResultCode.md +docs/RiskInfo.md +docs/RiskParameters.md +docs/RootApi.md +docs/SharePrice.md +docs/SimpleOrder.md +docs/Status.md +docs/SubAccounts.md +docs/Ticker.md +docs/Trade.md +docs/Trades.md +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/ValidatorInfo.md +docs/WithdrawHistory.md +docs/WithdrawHistoryItem.md +docs/ZkLighterInfo.md +git_push.sh +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/referral_api.py +lighter/api/root_api.py +lighter/api/transaction_api.py +lighter/api_client.py +lighter/api_response.py +lighter/configuration.py +lighter/exceptions.py +lighter/models/__init__.py +lighter/models/account.py +lighter/models/account_api_keys.py +lighter/models/account_limits.py +lighter/models/account_margin_stats.py +lighter/models/account_market_stats.py +lighter/models/account_metadata.py +lighter/models/account_metadatas.py +lighter/models/account_pn_l.py +lighter/models/account_position.py +lighter/models/account_stats.py +lighter/models/account_trade_stats.py +lighter/models/announcement.py +lighter/models/announcements.py +lighter/models/api_key.py +lighter/models/block.py +lighter/models/blocks.py +lighter/models/bridge_supported_network.py +lighter/models/candlestick.py +lighter/models/candlesticks.py +lighter/models/contract_address.py +lighter/models/current_height.py +lighter/models/cursor.py +lighter/models/daily_return.py +lighter/models/deposit_history.py +lighter/models/deposit_history_item.py +lighter/models/detailed_account.py +lighter/models/detailed_accounts.py +lighter/models/detailed_candlestick.py +lighter/models/enriched_tx.py +lighter/models/exchange_stats.py +lighter/models/export_data.py +lighter/models/funding.py +lighter/models/funding_rate.py +lighter/models/funding_rates.py +lighter/models/fundings.py +lighter/models/l1_metadata.py +lighter/models/l1_provider_info.py +lighter/models/liq_trade.py +lighter/models/liquidation.py +lighter/models/liquidation_info.py +lighter/models/liquidation_infos.py +lighter/models/market_info.py +lighter/models/next_nonce.py +lighter/models/order.py +lighter/models/order_book.py +lighter/models/order_book_depth.py +lighter/models/order_book_detail.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/pn_l_entry.py +lighter/models/position_funding.py +lighter/models/position_fundings.py +lighter/models/price_level.py +lighter/models/public_pool.py +lighter/models/public_pool_info.py +lighter/models/public_pool_metadata.py +lighter/models/public_pool_share.py +lighter/models/public_pools.py +lighter/models/referral_point_entry.py +lighter/models/referral_points.py +lighter/models/req_export_data.py +lighter/models/req_get_account.py +lighter/models/req_get_account_active_orders.py +lighter/models/req_get_account_api_keys.py +lighter/models/req_get_account_by_l1_address.py +lighter/models/req_get_account_inactive_orders.py +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_block.py +lighter/models/req_get_block_txs.py +lighter/models/req_get_by_account.py +lighter/models/req_get_candlesticks.py +lighter/models/req_get_deposit_history.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_liquidation_infos.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.py +lighter/models/req_get_public_pools_metadata.py +lighter/models/req_get_range_with_cursor.py +lighter/models/req_get_range_with_index.py +lighter/models/req_get_range_with_index_sortable.py +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_withdraw_history.py +lighter/models/resp_change_account_tier.py +lighter/models/resp_get_fast_bridge_info.py +lighter/models/resp_public_pools_metadata.py +lighter/models/resp_send_tx.py +lighter/models/resp_send_tx_batch.py +lighter/models/resp_withdrawal_delay.py +lighter/models/result_code.py +lighter/models/risk_info.py +lighter/models/risk_parameters.py +lighter/models/share_price.py +lighter/models/simple_order.py +lighter/models/status.py +lighter/models/sub_accounts.py +lighter/models/ticker.py +lighter/models/trade.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/validator_info.py +lighter/models/withdraw_history.py +lighter/models/withdraw_history_item.py +lighter/models/zk_lighter_info.py +lighter/py.typed +lighter/rest.py +setup.cfg +test-requirements.txt +test/__init__.py +tox.ini diff --git a/docs/lighter/lighter-python-main/.openapi-generator/VERSION b/docs/lighter/lighter-python-main/.openapi-generator/VERSION new file mode 100644 index 0000000..1985849 --- /dev/null +++ b/docs/lighter/lighter-python-main/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.7.0 diff --git a/docs/lighter/lighter-python-main/.travis.yml b/docs/lighter/lighter-python-main/.travis.yml new file mode 100644 index 0000000..35830c5 --- /dev/null +++ b/docs/lighter/lighter-python-main/.travis.yml @@ -0,0 +1,16 @@ +# ref: https://docs.travis-ci.com/user/languages/python +language: python +python: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + # uncomment the following if needed + #- "3.11-dev" # 3.11 development branch + #- "nightly" # nightly build +# command to install dependencies +install: + - "pip install -r requirements.txt" + - "pip install -r test-requirements.txt" +# command to run tests +script: pytest --cov=lighter diff --git a/docs/lighter/lighter-python-main/LICENSE b/docs/lighter/lighter-python-main/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/docs/lighter/lighter-python-main/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/docs/lighter/lighter-python-main/README.md b/docs/lighter/lighter-python-main/README.md new file mode 100644 index 0000000..607ade1 --- /dev/null +++ b/docs/lighter/lighter-python-main/README.md @@ -0,0 +1,198 @@ +# Lighter Python + +Python SDK for Lighter + +## Requirements. + +Python 3.8+ + +## Installation & Usage +### pip install + +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 +``` + + +Then import the package: +```python +import lighter +``` + +### Tests + +Execute `pytest` to run the tests. + +## Getting Started + +Please follow the [installation procedure](#installation--usage) and then run the following: + +```python + +import lighter +import asyncio + +async def main(): + client = lighter.ApiClient() + account_api = lighter.AccountApi(client) + account = await account_api.get_account(by="index", value="1") + print(account) + +if __name__ == "__main__": + asyncio.run(main()) + +``` + +# Examples +## [Read API Functions](examples/get_info.py) +```sh +python examples/get_info.py +``` + +## [Websocket Sync Order Books & Accounts](examples/ws.py) +```sh +python examples/ws.py +``` + +## [Create & Cancel Orders](examples/create_cancel_order.py) +```sh +python examples/create_cancel_order.py +``` + +## Documentation for API Endpoints + +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* | [**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* | [**pnl**](docs/AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl +*AccountApi* | [**public_pools**](docs/AccountApi.md#public_pools) | **GET** /api/v1/publicPools | publicPools +*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 +*CandlestickApi* | [**candlesticks**](docs/CandlestickApi.md#candlesticks) | **GET** /api/v1/candlesticks | candlesticks +*CandlestickApi* | [**fundings**](docs/CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings +*OrderApi* | [**account_inactive_orders**](docs/OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders +*OrderApi* | [**exchange_stats**](docs/OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats +*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 +*RootApi* | [**info**](docs/RootApi.md#info) | **GET** /info | info +*RootApi* | [**status**](docs/RootApi.md#status) | **GET** / | status +*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* | [**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 + + +## Documentation For Models + + - [Account](docs/Account.md) + - [AccountApiKeys](docs/AccountApiKeys.md) + - [AccountMarketStats](docs/AccountMarketStats.md) + - [AccountMetadata](docs/AccountMetadata.md) + - [AccountPnL](docs/AccountPnL.md) + - [AccountPosition](docs/AccountPosition.md) + - [AccountStats](docs/AccountStats.md) + - [ApiKey](docs/ApiKey.md) + - [Block](docs/Block.md) + - [Blocks](docs/Blocks.md) + - [BridgeSupportedNetwork](docs/BridgeSupportedNetwork.md) + - [Candlestick](docs/Candlestick.md) + - [Candlesticks](docs/Candlesticks.md) + - [ContractAddress](docs/ContractAddress.md) + - [CurrentHeight](docs/CurrentHeight.md) + - [Cursor](docs/Cursor.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) + - [ExchangeStats](docs/ExchangeStats.md) + - [Funding](docs/Funding.md) + - [Fundings](docs/Fundings.md) + - [L1ProviderInfo](docs/L1ProviderInfo.md) + - [Liquidation](docs/Liquidation.md) + - [MarketInfo](docs/MarketInfo.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) + - [PnLEntry](docs/PnLEntry.md) + - [PositionFunding](docs/PositionFunding.md) + - [PriceLevel](docs/PriceLevel.md) + - [PublicPool](docs/PublicPool.md) + - [PublicPoolInfo](docs/PublicPoolInfo.md) + - [PublicPoolShare](docs/PublicPoolShare.md) + - [PublicPools](docs/PublicPools.md) + - [ReqGetAccount](docs/ReqGetAccount.md) + - [ReqGetAccountApiKeys](docs/ReqGetAccountApiKeys.md) + - [ReqGetAccountByL1Address](docs/ReqGetAccountByL1Address.md) + - [ReqGetAccountInactiveOrders](docs/ReqGetAccountInactiveOrders.md) + - [ReqGetAccountPnL](docs/ReqGetAccountPnL.md) + - [ReqGetAccountTxs](docs/ReqGetAccountTxs.md) + - [ReqGetBlock](docs/ReqGetBlock.md) + - [ReqGetBlockTxs](docs/ReqGetBlockTxs.md) + - [ReqGetByAccount](docs/ReqGetByAccount.md) + - [ReqGetCandlesticks](docs/ReqGetCandlesticks.md) + - [ReqGetDepositHistory](docs/ReqGetDepositHistory.md) + - [ReqGetFundings](docs/ReqGetFundings.md) + - [ReqGetL1Tx](docs/ReqGetL1Tx.md) + - [ReqGetLatestDeposit](docs/ReqGetLatestDeposit.md) + - [ReqGetNextNonce](docs/ReqGetNextNonce.md) + - [ReqGetOrderBookDetails](docs/ReqGetOrderBookDetails.md) + - [ReqGetOrderBookOrders](docs/ReqGetOrderBookOrders.md) + - [ReqGetOrderBooks](docs/ReqGetOrderBooks.md) + - [ReqGetPublicPools](docs/ReqGetPublicPools.md) + - [ReqGetRangeWithCursor](docs/ReqGetRangeWithCursor.md) + - [ReqGetRangeWithIndex](docs/ReqGetRangeWithIndex.md) + - [ReqGetRangeWithIndexSortable](docs/ReqGetRangeWithIndexSortable.md) + - [ReqGetRecentTrades](docs/ReqGetRecentTrades.md) + - [ReqGetTrades](docs/ReqGetTrades.md) + - [ReqGetTx](docs/ReqGetTx.md) + - [ReqGetWithdrawHistory](docs/ReqGetWithdrawHistory.md) + - [ResultCode](docs/ResultCode.md) + - [SimpleOrder](docs/SimpleOrder.md) + - [Status](docs/Status.md) + - [SubAccounts](docs/SubAccounts.md) + - [Ticker](docs/Ticker.md) + - [Trade](docs/Trade.md) + - [Trades](docs/Trades.md) + - [Tx](docs/Tx.md) + - [TxHash](docs/TxHash.md) + - [TxHashes](docs/TxHashes.md) + - [Txs](docs/Txs.md) + - [ValidatorInfo](docs/ValidatorInfo.md) + - [WithdrawHistory](docs/WithdrawHistory.md) + - [WithdrawHistoryItem](docs/WithdrawHistoryItem.md) + - [ZkLighterInfo](docs/ZkLighterInfo.md) + + +[//]: # () + +[//]: # (## Documentation For Authorization) + +[//]: # () +[//]: # (Endpoints do not require authorization.) + + diff --git a/docs/lighter/lighter-python-main/config.yaml b/docs/lighter/lighter-python-main/config.yaml new file mode 100644 index 0000000..9581407 --- /dev/null +++ b/docs/lighter/lighter-python-main/config.yaml @@ -0,0 +1,4 @@ +disallowAdditionalPropertiesIfNotPresent: false +library: asyncio +packageName: lighter-sdk +projectName: lighter-sdk diff --git a/docs/lighter/lighter-python-main/docs/Account.md b/docs/lighter/lighter-python-main/docs/Account.md new file mode 100644 index 0000000..173acf4 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Account.md @@ -0,0 +1,40 @@ +# Account + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_type** | **int** | | +**index** | **int** | | +**l1_address** | **str** | | +**cancel_all_time** | **int** | | +**total_order_count** | **int** | | +**total_isolated_order_count** | **int** | | +**pending_order_count** | **int** | | +**available_balance** | **str** | | +**status** | **int** | | +**collateral** | **str** | | + +## Example + +```python +from lighter.models.account import Account + +# TODO update the JSON string below +json = "{}" +# create an instance of Account from a JSON string +account_instance = Account.from_json(json) +# print the JSON string representation of the object +print(Account.to_json()) + +# convert the object into a dict +account_dict = account_instance.to_dict() +# create an instance of Account from a dict +account_from_dict = Account.from_dict(account_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountApi.md b/docs/lighter/lighter-python-main/docs/AccountApi.md new file mode 100644 index 0000000..9e90478 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountApi.md @@ -0,0 +1,930 @@ +# lighter.AccountApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**account**](AccountApi.md#account) | **GET** /api/v1/account | account +[**account_limits**](AccountApi.md#account_limits) | **GET** /api/v1/accountLimits | accountLimits +[**account_metadata**](AccountApi.md#account_metadata) | **GET** /api/v1/accountMetadata | accountMetadata +[**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 +[**l1_metadata**](AccountApi.md#l1_metadata) | **GET** /api/v1/l1Metadata | l1Metadata +[**liquidations**](AccountApi.md#liquidations) | **GET** /api/v1/liquidations | liquidations +[**pnl**](AccountApi.md#pnl) | **GET** /api/v1/pnl | pnl +[**position_funding**](AccountApi.md#position_funding) | **GET** /api/v1/positionFunding | positionFunding +[**public_pools**](AccountApi.md#public_pools) | **GET** /api/v1/publicPools | publicPools +[**public_pools_metadata**](AccountApi.md#public_pools_metadata) | **GET** /api/v1/publicPoolsMetadata | publicPoolsMetadata + + +# **account** +> DetailedAccounts account(by, value) + +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. + +### Example + + +```python +import lighter +from lighter.models.detailed_accounts import DetailedAccounts +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) + by = 'by_example' # str | + value = 'value_example' # str | + + try: + # account + api_response = await api_instance.account(by, value) + print("The response of AccountApi->account:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->account: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + +### Return type + +[**DetailedAccounts**](DetailedAccounts.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **account_limits** +> AccountLimits account_limits(account_index, authorization=authorization, auth=auth) + +accountLimits + +Get account limits + +### Example + + +```python +import lighter +from lighter.models.account_limits import AccountLimits +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) + 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: + # accountLimits + api_response = await api_instance.account_limits(account_index, authorization=authorization, auth=auth) + print("The response of AccountApi->account_limits:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->account_limits: %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 + +[**AccountLimits**](AccountLimits.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **account_metadata** +> AccountMetadatas account_metadata(by, value, authorization=authorization, auth=auth) + +accountMetadata + +Get account metadatas + +### Example + + +```python +import lighter +from lighter.models.account_metadatas import AccountMetadatas +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) + by = 'by_example' # str | + value = 'value_example' # str | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + + try: + # accountMetadata + api_response = await api_instance.account_metadata(by, value, authorization=authorization, auth=auth) + print("The response of AccountApi->account_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->account_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + +### Return type + +[**AccountMetadatas**](AccountMetadatas.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) + +# **accounts_by_l1_address** +> SubAccounts accounts_by_l1_address(l1_address) + +accountsByL1Address + +Get accounts by l1_address returns all accounts associated with the given L1 address + +### Example + + +```python +import lighter +from lighter.models.sub_accounts import SubAccounts +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 | + + try: + # accountsByL1Address + api_response = await api_instance.accounts_by_l1_address(l1_address) + print("The response of AccountApi->accounts_by_l1_address:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->accounts_by_l1_address: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **l1_address** | **str**| | + +### Return type + +[**SubAccounts**](SubAccounts.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) + +# **apikeys** +> AccountApiKeys apikeys(account_index, api_key_index=api_key_index) + +apikeys + +Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + +### Example + + +```python +import lighter +from lighter.models.account_api_keys import AccountApiKeys +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) + account_index = 56 # int | + api_key_index = 255 # int | (optional) (default to 255) + + try: + # apikeys + api_response = await api_instance.apikeys(account_index, api_key_index=api_key_index) + print("The response of AccountApi->apikeys:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->apikeys: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **api_key_index** | **int**| | [optional] [default to 255] + +### Return type + +[**AccountApiKeys**](AccountApiKeys.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) + +# **change_account_tier** +> RespChangeAccountTier change_account_tier(account_index, new_tier, authorization=authorization, auth=auth) + +changeAccountTier + +Change account tier + +### Example + + +```python +import lighter +from lighter.models.resp_change_account_tier import RespChangeAccountTier +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) + account_index = 56 # int | + new_tier = 'new_tier_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: + # changeAccountTier + api_response = await api_instance.change_account_tier(account_index, new_tier, authorization=authorization, auth=auth) + print("The response of AccountApi->change_account_tier:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->change_account_tier: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **new_tier** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**RespChangeAccountTier**](RespChangeAccountTier.md) + +### Authorization + +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) + +# **l1_metadata** +> L1Metadata l1_metadata(l1_address, authorization=authorization, auth=auth) + +l1Metadata + +Get L1 metadata + +### Example + + +```python +import lighter +from lighter.models.l1_metadata import L1Metadata +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 | 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) + print("The response of AccountApi->l1_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->l1_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **l1_address** | **str**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**L1Metadata**](L1Metadata.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) + +# **liquidations** +> LiquidationInfos liquidations(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor) + +liquidations + +Get liquidation infos + +### Example + + +```python +import lighter +from lighter.models.liquidation_infos import LiquidationInfos +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) + 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) + 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) + print("The response of AccountApi->liquidations:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->liquidations: %s\n" % e) +``` + + + +### Parameters + + +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] + **cursor** | **str**| | [optional] + +### Return type + +[**LiquidationInfos**](LiquidationInfos.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) + +# **pnl** +> AccountPnL pnl(by, value, resolution, start_timestamp, end_timestamp, count_back, authorization=authorization, auth=auth, ignore_transfers=ignore_transfers) + +pnl + +Get account PnL chart + +### Example + + +```python +import lighter +from lighter.models.account_pn_l import AccountPnL +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) + by = 'by_example' # str | + value = 'value_example' # str | + resolution = 'resolution_example' # str | + start_timestamp = 56 # int | + end_timestamp = 56 # int | + count_back = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_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) + print("The response of AccountApi->pnl:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->pnl: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + **resolution** | **str**| | + **start_timestamp** | **int**| | + **end_timestamp** | **int**| | + **count_back** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **ignore_transfers** | **bool**| | [optional] [default to False] + +### Return type + +[**AccountPnL**](AccountPnL.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) + +# **position_funding** +> PositionFundings position_funding(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, cursor=cursor, side=side) + +positionFunding + +Get accounts position fundings + +### Example + + +```python +import lighter +from lighter.models.position_fundings import PositionFundings +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) + account_index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + market_id = 255 # int | (optional) (default to 255) + 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) + print("The response of AccountApi->position_funding:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->position_funding: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **market_id** | **int**| | [optional] [default to 255] + **cursor** | **str**| | [optional] + **side** | **str**| | [optional] [default to all] + +### Return type + +[**PositionFundings**](PositionFundings.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) + +# **public_pools** +> PublicPools public_pools(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + +publicPools + +Get public pools + +### Example + + +```python +import lighter +from lighter.models.public_pools import PublicPools +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.AccountApi(api_client) + index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + filter = 'filter_example' # str | (optional) + account_index = 56 # int | (optional) + + try: + # publicPools + api_response = await api_instance.public_pools(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + print("The response of AccountApi->public_pools:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->public_pools: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **filter** | **str**| | [optional] + **account_index** | **int**| | [optional] + +### Return type + +[**PublicPools**](PublicPools.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) + +# **public_pools_metadata** +> RespPublicPoolsMetadata public_pools_metadata(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + +publicPoolsMetadata + +Get public pools metadata + +### Example + + +```python +import lighter +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.AccountApi(api_client) + index = 56 # int | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + filter = 'filter_example' # str | (optional) + account_index = 56 # int | (optional) + + try: + # publicPoolsMetadata + api_response = await api_instance.public_pools_metadata(index, limit, authorization=authorization, auth=auth, filter=filter, account_index=account_index) + print("The response of AccountApi->public_pools_metadata:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AccountApi->public_pools_metadata: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **index** | **int**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **filter** | **str**| | [optional] + **account_index** | **int**| | [optional] + +### Return type + +[**RespPublicPoolsMetadata**](RespPublicPoolsMetadata.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/AccountApiKeys.md b/docs/lighter/lighter-python-main/docs/AccountApiKeys.md new file mode 100644 index 0000000..264ef30 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountApiKeys.md @@ -0,0 +1,31 @@ +# AccountApiKeys + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**api_keys** | [**List[ApiKey]**](ApiKey.md) | | + +## Example + +```python +from lighter.models.account_api_keys import AccountApiKeys + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountApiKeys from a JSON string +account_api_keys_instance = AccountApiKeys.from_json(json) +# print the JSON string representation of the object +print(AccountApiKeys.to_json()) + +# convert the object into a dict +account_api_keys_dict = account_api_keys_instance.to_dict() +# create an instance of AccountApiKeys from a dict +account_api_keys_from_dict = AccountApiKeys.from_dict(account_api_keys_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountLimits.md b/docs/lighter/lighter-python-main/docs/AccountLimits.md new file mode 100644 index 0000000..0ca7ba2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountLimits.md @@ -0,0 +1,32 @@ +# AccountLimits + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**max_llp_percentage** | **int** | | +**user_tier** | **str** | | + +## Example + +```python +from lighter.models.account_limits import AccountLimits + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountLimits from a JSON string +account_limits_instance = AccountLimits.from_json(json) +# print the JSON string representation of the object +print(AccountLimits.to_json()) + +# convert the object into a dict +account_limits_dict = account_limits_instance.to_dict() +# create an instance of AccountLimits from a dict +account_limits_from_dict = AccountLimits.from_dict(account_limits_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountMarginStats.md b/docs/lighter/lighter-python-main/docs/AccountMarginStats.md new file mode 100644 index 0000000..2fedfac --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountMarginStats.md @@ -0,0 +1,34 @@ +# AccountMarginStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collateral** | **str** | | +**portfolio_value** | **str** | | +**leverage** | **str** | | +**available_balance** | **str** | | +**margin_usage** | **str** | | +**buying_power** | **str** | | + +## Example + +```python +from lighter.models.account_margin_stats import AccountMarginStats + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountMarginStats from a JSON string +account_margin_stats_instance = AccountMarginStats.from_json(json) +# print the JSON string representation of the object +print(AccountMarginStats.to_json()) + +# convert the object into a dict +account_margin_stats_dict = account_margin_stats_instance.to_dict() +# create an instance of AccountMarginStats from a dict +account_margin_stats_from_dict = AccountMarginStats.from_dict(account_margin_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountMarketStats.md b/docs/lighter/lighter-python-main/docs/AccountMarketStats.md new file mode 100644 index 0000000..c365818 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountMarketStats.md @@ -0,0 +1,41 @@ +# AccountMarketStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**daily_trades_count** | **int** | | +**daily_base_token_volume** | **float** | | +**daily_quote_token_volume** | **float** | | +**weekly_trades_count** | **int** | | +**weekly_base_token_volume** | **float** | | +**weekly_quote_token_volume** | **float** | | +**monthly_trades_count** | **int** | | +**monthly_base_token_volume** | **float** | | +**monthly_quote_token_volume** | **float** | | +**total_trades_count** | **int** | | +**total_base_token_volume** | **float** | | +**total_quote_token_volume** | **float** | | + +## Example + +```python +from lighter.models.account_market_stats import AccountMarketStats + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountMarketStats from a JSON string +account_market_stats_instance = AccountMarketStats.from_json(json) +# print the JSON string representation of the object +print(AccountMarketStats.to_json()) + +# convert the object into a dict +account_market_stats_dict = account_market_stats_instance.to_dict() +# create an instance of AccountMarketStats from a dict +account_market_stats_from_dict = AccountMarketStats.from_dict(account_market_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountMetadata.md b/docs/lighter/lighter-python-main/docs/AccountMetadata.md new file mode 100644 index 0000000..35089cf --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountMetadata.md @@ -0,0 +1,33 @@ +# AccountMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**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 | + +## Example + +```python +from lighter.models.account_metadata import AccountMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountMetadata from a JSON string +account_metadata_instance = AccountMetadata.from_json(json) +# print the JSON string representation of the object +print(AccountMetadata.to_json()) + +# convert the object into a dict +account_metadata_dict = account_metadata_instance.to_dict() +# create an instance of AccountMetadata from a dict +account_metadata_from_dict = AccountMetadata.from_dict(account_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountMetadatas.md b/docs/lighter/lighter-python-main/docs/AccountMetadatas.md new file mode 100644 index 0000000..2eaa6c2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountMetadatas.md @@ -0,0 +1,31 @@ +# AccountMetadatas + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_metadatas** | [**List[AccountMetadata]**](AccountMetadata.md) | | + +## Example + +```python +from lighter.models.account_metadatas import AccountMetadatas + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountMetadatas from a JSON string +account_metadatas_instance = AccountMetadatas.from_json(json) +# print the JSON string representation of the object +print(AccountMetadatas.to_json()) + +# convert the object into a dict +account_metadatas_dict = account_metadatas_instance.to_dict() +# create an instance of AccountMetadatas from a dict +account_metadatas_from_dict = AccountMetadatas.from_dict(account_metadatas_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountPnL.md b/docs/lighter/lighter-python-main/docs/AccountPnL.md new file mode 100644 index 0000000..4792a60 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountPnL.md @@ -0,0 +1,32 @@ +# AccountPnL + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**resolution** | **str** | | +**pnl** | [**List[PnLEntry]**](PnLEntry.md) | | + +## Example + +```python +from lighter.models.account_pn_l import AccountPnL + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountPnL from a JSON string +account_pn_l_instance = AccountPnL.from_json(json) +# print the JSON string representation of the object +print(AccountPnL.to_json()) + +# convert the object into a dict +account_pn_l_dict = account_pn_l_instance.to_dict() +# create an instance of AccountPnL from a dict +account_pn_l_from_dict = AccountPnL.from_dict(account_pn_l_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountPosition.md b/docs/lighter/lighter-python-main/docs/AccountPosition.md new file mode 100644 index 0000000..93f2825 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountPosition.md @@ -0,0 +1,44 @@ +# AccountPosition + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**symbol** | **str** | | +**initial_margin_fraction** | **str** | | +**open_order_count** | **int** | | +**pending_order_count** | **int** | | +**position_tied_order_count** | **int** | | +**sign** | **int** | | +**position** | **str** | | +**avg_entry_price** | **str** | | +**position_value** | **str** | | +**unrealized_pnl** | **str** | | +**realized_pnl** | **str** | | +**liquidation_price** | **str** | | +**total_funding_paid_out** | **str** | | [optional] +**margin_mode** | **int** | | +**allocated_margin** | **str** | | + +## Example + +```python +from lighter.models.account_position import AccountPosition + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountPosition from a JSON string +account_position_instance = AccountPosition.from_json(json) +# print the JSON string representation of the object +print(AccountPosition.to_json()) + +# convert the object into a dict +account_position_dict = account_position_instance.to_dict() +# create an instance of AccountPosition from a dict +account_position_from_dict = AccountPosition.from_dict(account_position_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountStats.md b/docs/lighter/lighter-python-main/docs/AccountStats.md new file mode 100644 index 0000000..89aaab6 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountStats.md @@ -0,0 +1,36 @@ +# AccountStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**collateral** | **str** | | +**portfolio_value** | **str** | | +**leverage** | **str** | | +**available_balance** | **str** | | +**margin_usage** | **str** | | +**buying_power** | **str** | | +**cross_stats** | [**AccountMarginStats**](AccountMarginStats.md) | | +**total_stats** | [**AccountMarginStats**](AccountMarginStats.md) | | + +## Example + +```python +from lighter.models.account_stats import AccountStats + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountStats from a JSON string +account_stats_instance = AccountStats.from_json(json) +# print the JSON string representation of the object +print(AccountStats.to_json()) + +# convert the object into a dict +account_stats_dict = account_stats_instance.to_dict() +# create an instance of AccountStats from a dict +account_stats_from_dict = AccountStats.from_dict(account_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AccountTradeStats.md b/docs/lighter/lighter-python-main/docs/AccountTradeStats.md new file mode 100644 index 0000000..e42f167 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AccountTradeStats.md @@ -0,0 +1,36 @@ +# AccountTradeStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**daily_trades_count** | **int** | | +**daily_volume** | **float** | | +**weekly_trades_count** | **int** | | +**weekly_volume** | **float** | | +**monthly_trades_count** | **int** | | +**monthly_volume** | **float** | | +**total_trades_count** | **int** | | +**total_volume** | **float** | | + +## Example + +```python +from lighter.models.account_trade_stats import AccountTradeStats + +# TODO update the JSON string below +json = "{}" +# create an instance of AccountTradeStats from a JSON string +account_trade_stats_instance = AccountTradeStats.from_json(json) +# print the JSON string representation of the object +print(AccountTradeStats.to_json()) + +# convert the object into a dict +account_trade_stats_dict = account_trade_stats_instance.to_dict() +# create an instance of AccountTradeStats from a dict +account_trade_stats_from_dict = AccountTradeStats.from_dict(account_trade_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Announcement.md b/docs/lighter/lighter-python-main/docs/Announcement.md new file mode 100644 index 0000000..271e6d9 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Announcement.md @@ -0,0 +1,31 @@ +# Announcement + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**title** | **str** | | +**content** | **str** | | +**created_at** | **int** | | + +## Example + +```python +from lighter.models.announcement import Announcement + +# TODO update the JSON string below +json = "{}" +# create an instance of Announcement from a JSON string +announcement_instance = Announcement.from_json(json) +# print the JSON string representation of the object +print(Announcement.to_json()) + +# convert the object into a dict +announcement_dict = announcement_instance.to_dict() +# create an instance of Announcement from a dict +announcement_from_dict = Announcement.from_dict(announcement_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/AnnouncementApi.md b/docs/lighter/lighter-python-main/docs/AnnouncementApi.md new file mode 100644 index 0000000..11d1f03 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/AnnouncementApi.md @@ -0,0 +1,74 @@ +# lighter.AnnouncementApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**announcement**](AnnouncementApi.md#announcement) | **GET** /api/v1/announcement | announcement + + +# **announcement** +> Announcements announcement() + +announcement + +Get announcement + +### Example + + +```python +import lighter +from lighter.models.announcements import Announcements +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.AnnouncementApi(api_client) + + try: + # announcement + api_response = await api_instance.announcement() + print("The response of AnnouncementApi->announcement:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling AnnouncementApi->announcement: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Announcements**](Announcements.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/Announcements.md b/docs/lighter/lighter-python-main/docs/Announcements.md new file mode 100644 index 0000000..5b77c2e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Announcements.md @@ -0,0 +1,31 @@ +# Announcements + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**announcements** | [**List[Announcement]**](Announcement.md) | | + +## Example + +```python +from lighter.models.announcements import Announcements + +# TODO update the JSON string below +json = "{}" +# create an instance of Announcements from a JSON string +announcements_instance = Announcements.from_json(json) +# print the JSON string representation of the object +print(Announcements.to_json()) + +# convert the object into a dict +announcements_dict = announcements_instance.to_dict() +# create an instance of Announcements from a dict +announcements_from_dict = Announcements.from_dict(announcements_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ApiKey.md b/docs/lighter/lighter-python-main/docs/ApiKey.md new file mode 100644 index 0000000..76850fa --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ApiKey.md @@ -0,0 +1,32 @@ +# ApiKey + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**api_key_index** | **int** | | +**nonce** | **int** | | +**public_key** | **str** | | + +## Example + +```python +from lighter.models.api_key import ApiKey + +# TODO update the JSON string below +json = "{}" +# create an instance of ApiKey from a JSON string +api_key_instance = ApiKey.from_json(json) +# print the JSON string representation of the object +print(ApiKey.to_json()) + +# convert the object into a dict +api_key_dict = api_key_instance.to_dict() +# create an instance of ApiKey from a dict +api_key_from_dict = ApiKey.from_dict(api_key_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Block.md b/docs/lighter/lighter-python-main/docs/Block.md new file mode 100644 index 0000000..78ad751 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Block.md @@ -0,0 +1,41 @@ +# Block + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**commitment** | **str** | | +**height** | **int** | | +**state_root** | **str** | | +**priority_operations** | **int** | | +**on_chain_l2_operations** | **int** | | +**pending_on_chain_operations_pub_data** | **str** | | +**committed_tx_hash** | **str** | | +**committed_at** | **int** | | +**verified_tx_hash** | **str** | | +**verified_at** | **int** | | +**txs** | [**List[Tx]**](Tx.md) | | +**status** | **int** | | +**size** | **int** | | + +## Example + +```python +from lighter.models.block import Block + +# TODO update the JSON string below +json = "{}" +# create an instance of Block from a JSON string +block_instance = Block.from_json(json) +# print the JSON string representation of the object +print(Block.to_json()) + +# convert the object into a dict +block_dict = block_instance.to_dict() +# create an instance of Block from a dict +block_from_dict = Block.from_dict(block_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/BlockApi.md b/docs/lighter/lighter-python-main/docs/BlockApi.md new file mode 100644 index 0000000..6d02f71 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/BlockApi.md @@ -0,0 +1,220 @@ +# lighter.BlockApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**block**](BlockApi.md#block) | **GET** /api/v1/block | block +[**blocks**](BlockApi.md#blocks) | **GET** /api/v1/blocks | blocks +[**current_height**](BlockApi.md#current_height) | **GET** /api/v1/currentHeight | currentHeight + + +# **block** +> Blocks block(by, value) + +block + +Get block by its height or commitment + +### Example + + +```python +import lighter +from lighter.models.blocks import Blocks +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.BlockApi(api_client) + by = 'by_example' # str | + value = 'value_example' # str | + + try: + # block + api_response = await api_instance.block(by, value) + print("The response of BlockApi->block:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->block: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + +### Return type + +[**Blocks**](Blocks.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) + +# **blocks** +> Blocks blocks(limit, index=index, sort=sort) + +blocks + +Get blocks + +### Example + + +```python +import lighter +from lighter.models.blocks import Blocks +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.BlockApi(api_client) + limit = 56 # int | + index = 56 # int | (optional) + sort = asc # str | (optional) (default to asc) + + try: + # blocks + api_response = await api_instance.blocks(limit, index=index, sort=sort) + print("The response of BlockApi->blocks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->blocks: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **limit** | **int**| | + **index** | **int**| | [optional] + **sort** | **str**| | [optional] [default to asc] + +### Return type + +[**Blocks**](Blocks.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) + +# **current_height** +> CurrentHeight current_height() + +currentHeight + +Get current height + +### Example + + +```python +import lighter +from lighter.models.current_height import CurrentHeight +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.BlockApi(api_client) + + try: + # currentHeight + api_response = await api_instance.current_height() + print("The response of BlockApi->current_height:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BlockApi->current_height: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**CurrentHeight**](CurrentHeight.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/Blocks.md b/docs/lighter/lighter-python-main/docs/Blocks.md new file mode 100644 index 0000000..09ea46c --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Blocks.md @@ -0,0 +1,32 @@ +# Blocks + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**total** | **int** | | +**blocks** | [**List[Block]**](Block.md) | | + +## Example + +```python +from lighter.models.blocks import Blocks + +# TODO update the JSON string below +json = "{}" +# create an instance of Blocks from a JSON string +blocks_instance = Blocks.from_json(json) +# print the JSON string representation of the object +print(Blocks.to_json()) + +# convert the object into a dict +blocks_dict = blocks_instance.to_dict() +# create an instance of Blocks from a dict +blocks_from_dict = Blocks.from_dict(blocks_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/BridgeApi.md b/docs/lighter/lighter-python-main/docs/BridgeApi.md new file mode 100644 index 0000000..4180a8f --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/BridgeApi.md @@ -0,0 +1,74 @@ +# lighter.BridgeApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**fastbridge_info**](BridgeApi.md#fastbridge_info) | **GET** /api/v1/fastbridge/info | fastbridge_info + + +# **fastbridge_info** +> RespGetFastBridgeInfo fastbridge_info() + +fastbridge_info + +Get fast bridge info + +### Example + + +```python +import lighter +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +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: + # fastbridge_info + api_response = await api_instance.fastbridge_info() + print("The response of BridgeApi->fastbridge_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling BridgeApi->fastbridge_info: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**RespGetFastBridgeInfo**](RespGetFastBridgeInfo.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/BridgeSupportedNetwork.md b/docs/lighter/lighter-python-main/docs/BridgeSupportedNetwork.md new file mode 100644 index 0000000..89a7ad2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/BridgeSupportedNetwork.md @@ -0,0 +1,31 @@ +# BridgeSupportedNetwork + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**chain_id** | **str** | | +**explorer** | **str** | | + +## Example + +```python +from lighter.models.bridge_supported_network import BridgeSupportedNetwork + +# TODO update the JSON string below +json = "{}" +# create an instance of BridgeSupportedNetwork from a JSON string +bridge_supported_network_instance = BridgeSupportedNetwork.from_json(json) +# print the JSON string representation of the object +print(BridgeSupportedNetwork.to_json()) + +# convert the object into a dict +bridge_supported_network_dict = bridge_supported_network_instance.to_dict() +# create an instance of BridgeSupportedNetwork from a dict +bridge_supported_network_from_dict = BridgeSupportedNetwork.from_dict(bridge_supported_network_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Candlestick.md b/docs/lighter/lighter-python-main/docs/Candlestick.md new file mode 100644 index 0000000..6071dfc --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Candlestick.md @@ -0,0 +1,36 @@ +# Candlestick + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**open** | **float** | | +**high** | **float** | | +**low** | **float** | | +**close** | **float** | | +**volume0** | **float** | | +**volume1** | **float** | | +**last_trade_id** | **int** | | + +## Example + +```python +from lighter.models.candlestick import Candlestick + +# TODO update the JSON string below +json = "{}" +# create an instance of Candlestick from a JSON string +candlestick_instance = Candlestick.from_json(json) +# print the JSON string representation of the object +print(Candlestick.to_json()) + +# convert the object into a dict +candlestick_dict = candlestick_instance.to_dict() +# create an instance of Candlestick from a dict +candlestick_from_dict = Candlestick.from_dict(candlestick_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/CandlestickApi.md b/docs/lighter/lighter-python-main/docs/CandlestickApi.md new file mode 100644 index 0000000..1515e24 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/CandlestickApi.md @@ -0,0 +1,166 @@ +# lighter.CandlestickApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**candlesticks**](CandlestickApi.md#candlesticks) | **GET** /api/v1/candlesticks | candlesticks +[**fundings**](CandlestickApi.md#fundings) | **GET** /api/v1/fundings | fundings + + +# **candlesticks** +> Candlesticks candlesticks(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end) + +candlesticks + +Get candlesticks + +### Example + + +```python +import lighter +from lighter.models.candlesticks import Candlesticks +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.CandlestickApi(api_client) + market_id = 56 # int | + resolution = 'resolution_example' # str | + start_timestamp = 56 # int | + end_timestamp = 56 # int | + count_back = 56 # int | + set_timestamp_to_end = False # bool | (optional) (default to False) + + try: + # candlesticks + api_response = await api_instance.candlesticks(market_id, resolution, start_timestamp, end_timestamp, count_back, set_timestamp_to_end=set_timestamp_to_end) + print("The response of CandlestickApi->candlesticks:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CandlestickApi->candlesticks: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | + **resolution** | **str**| | + **start_timestamp** | **int**| | + **end_timestamp** | **int**| | + **count_back** | **int**| | + **set_timestamp_to_end** | **bool**| | [optional] [default to False] + +### Return type + +[**Candlesticks**](Candlesticks.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) + +# **fundings** +> Fundings fundings(market_id, resolution, start_timestamp, end_timestamp, count_back) + +fundings + +Get fundings + +### Example + + +```python +import lighter +from lighter.models.fundings import Fundings +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.CandlestickApi(api_client) + market_id = 56 # int | + resolution = 'resolution_example' # str | + start_timestamp = 56 # int | + end_timestamp = 56 # int | + count_back = 56 # int | + + try: + # fundings + api_response = await api_instance.fundings(market_id, resolution, start_timestamp, end_timestamp, count_back) + print("The response of CandlestickApi->fundings:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling CandlestickApi->fundings: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | + **resolution** | **str**| | + **start_timestamp** | **int**| | + **end_timestamp** | **int**| | + **count_back** | **int**| | + +### Return type + +[**Fundings**](Fundings.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/Candlesticks.md b/docs/lighter/lighter-python-main/docs/Candlesticks.md new file mode 100644 index 0000000..8c24630 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Candlesticks.md @@ -0,0 +1,32 @@ +# Candlesticks + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**resolution** | **str** | | +**candlesticks** | [**List[Candlestick]**](Candlestick.md) | | + +## Example + +```python +from lighter.models.candlesticks import Candlesticks + +# TODO update the JSON string below +json = "{}" +# create an instance of Candlesticks from a JSON string +candlesticks_instance = Candlesticks.from_json(json) +# print the JSON string representation of the object +print(Candlesticks.to_json()) + +# convert the object into a dict +candlesticks_dict = candlesticks_instance.to_dict() +# create an instance of Candlesticks from a dict +candlesticks_from_dict = Candlesticks.from_dict(candlesticks_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ContractAddress.md b/docs/lighter/lighter-python-main/docs/ContractAddress.md new file mode 100644 index 0000000..1434634 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ContractAddress.md @@ -0,0 +1,30 @@ +# ContractAddress + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**name** | **str** | | +**address** | **str** | | + +## Example + +```python +from lighter.models.contract_address import ContractAddress + +# TODO update the JSON string below +json = "{}" +# create an instance of ContractAddress from a JSON string +contract_address_instance = ContractAddress.from_json(json) +# print the JSON string representation of the object +print(ContractAddress.to_json()) + +# convert the object into a dict +contract_address_dict = contract_address_instance.to_dict() +# create an instance of ContractAddress from a dict +contract_address_from_dict = ContractAddress.from_dict(contract_address_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/CurrentHeight.md b/docs/lighter/lighter-python-main/docs/CurrentHeight.md new file mode 100644 index 0000000..f790bae --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/CurrentHeight.md @@ -0,0 +1,31 @@ +# CurrentHeight + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**height** | **int** | | + +## Example + +```python +from lighter.models.current_height import CurrentHeight + +# TODO update the JSON string below +json = "{}" +# create an instance of CurrentHeight from a JSON string +current_height_instance = CurrentHeight.from_json(json) +# print the JSON string representation of the object +print(CurrentHeight.to_json()) + +# convert the object into a dict +current_height_dict = current_height_instance.to_dict() +# create an instance of CurrentHeight from a dict +current_height_from_dict = CurrentHeight.from_dict(current_height_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Cursor.md b/docs/lighter/lighter-python-main/docs/Cursor.md new file mode 100644 index 0000000..76b077a --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Cursor.md @@ -0,0 +1,29 @@ +# Cursor + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**next_cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.cursor import Cursor + +# TODO update the JSON string below +json = "{}" +# create an instance of Cursor from a JSON string +cursor_instance = Cursor.from_json(json) +# print the JSON string representation of the object +print(Cursor.to_json()) + +# convert the object into a dict +cursor_dict = cursor_instance.to_dict() +# create an instance of Cursor from a dict +cursor_from_dict = Cursor.from_dict(cursor_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DailyReturn.md b/docs/lighter/lighter-python-main/docs/DailyReturn.md new file mode 100644 index 0000000..225d246 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DailyReturn.md @@ -0,0 +1,30 @@ +# DailyReturn + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**daily_return** | **float** | | + +## Example + +```python +from lighter.models.daily_return import DailyReturn + +# TODO update the JSON string below +json = "{}" +# create an instance of DailyReturn from a JSON string +daily_return_instance = DailyReturn.from_json(json) +# print the JSON string representation of the object +print(DailyReturn.to_json()) + +# convert the object into a dict +daily_return_dict = daily_return_instance.to_dict() +# create an instance of DailyReturn from a dict +daily_return_from_dict = DailyReturn.from_dict(daily_return_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DepositHistory.md b/docs/lighter/lighter-python-main/docs/DepositHistory.md new file mode 100644 index 0000000..6425ad0 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DepositHistory.md @@ -0,0 +1,32 @@ +# DepositHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**deposits** | [**List[DepositHistoryItem]**](DepositHistoryItem.md) | | +**cursor** | **str** | | + +## Example + +```python +from lighter.models.deposit_history import DepositHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of DepositHistory from a JSON string +deposit_history_instance = DepositHistory.from_json(json) +# print the JSON string representation of the object +print(DepositHistory.to_json()) + +# convert the object into a dict +deposit_history_dict = deposit_history_instance.to_dict() +# create an instance of DepositHistory from a dict +deposit_history_from_dict = DepositHistory.from_dict(deposit_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DepositHistoryItem.md b/docs/lighter/lighter-python-main/docs/DepositHistoryItem.md new file mode 100644 index 0000000..3e850fe --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DepositHistoryItem.md @@ -0,0 +1,33 @@ +# DepositHistoryItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**amount** | **str** | | +**timestamp** | **int** | | +**status** | **str** | | +**l1_tx_hash** | **str** | | + +## Example + +```python +from lighter.models.deposit_history_item import DepositHistoryItem + +# TODO update the JSON string below +json = "{}" +# create an instance of DepositHistoryItem from a JSON string +deposit_history_item_instance = DepositHistoryItem.from_json(json) +# print the JSON string representation of the object +print(DepositHistoryItem.to_json()) + +# convert the object into a dict +deposit_history_item_dict = deposit_history_item_instance.to_dict() +# create an instance of DepositHistoryItem from a dict +deposit_history_item_from_dict = DepositHistoryItem.from_dict(deposit_history_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DetailedAccount.md b/docs/lighter/lighter-python-main/docs/DetailedAccount.md new file mode 100644 index 0000000..768c3e2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DetailedAccount.md @@ -0,0 +1,50 @@ +# DetailedAccount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_type** | **int** | | +**index** | **int** | | +**l1_address** | **str** | | +**cancel_all_time** | **int** | | +**total_order_count** | **int** | | +**total_isolated_order_count** | **int** | | +**pending_order_count** | **int** | | +**available_balance** | **str** | | +**status** | **int** | | +**collateral** | **str** | | +**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 | +**positions** | [**List[AccountPosition]**](AccountPosition.md) | | +**total_asset_value** | **str** | | +**cross_asset_value** | **str** | | +**pool_info** | [**PublicPoolInfo**](PublicPoolInfo.md) | | +**shares** | [**List[PublicPoolShare]**](PublicPoolShare.md) | | + +## Example + +```python +from lighter.models.detailed_account import DetailedAccount + +# TODO update the JSON string below +json = "{}" +# create an instance of DetailedAccount from a JSON string +detailed_account_instance = DetailedAccount.from_json(json) +# print the JSON string representation of the object +print(DetailedAccount.to_json()) + +# convert the object into a dict +detailed_account_dict = detailed_account_instance.to_dict() +# create an instance of DetailedAccount from a dict +detailed_account_from_dict = DetailedAccount.from_dict(detailed_account_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DetailedAccounts.md b/docs/lighter/lighter-python-main/docs/DetailedAccounts.md new file mode 100644 index 0000000..aa35700 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DetailedAccounts.md @@ -0,0 +1,32 @@ +# DetailedAccounts + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**total** | **int** | | +**accounts** | [**List[DetailedAccount]**](DetailedAccount.md) | | + +## Example + +```python +from lighter.models.detailed_accounts import DetailedAccounts + +# TODO update the JSON string below +json = "{}" +# create an instance of DetailedAccounts from a JSON string +detailed_accounts_instance = DetailedAccounts.from_json(json) +# print the JSON string representation of the object +print(DetailedAccounts.to_json()) + +# convert the object into a dict +detailed_accounts_dict = detailed_accounts_instance.to_dict() +# create an instance of DetailedAccounts from a dict +detailed_accounts_from_dict = DetailedAccounts.from_dict(detailed_accounts_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/DetailedCandlestick.md b/docs/lighter/lighter-python-main/docs/DetailedCandlestick.md new file mode 100644 index 0000000..4bba057 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/DetailedCandlestick.md @@ -0,0 +1,37 @@ +# DetailedCandlestick + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**open** | **float** | | +**high** | **float** | | +**low** | **float** | | +**close** | **float** | | +**volume0** | **float** | | +**volume1** | **float** | | +**last_trade_id** | **int** | | +**trade_count** | **int** | | + +## Example + +```python +from lighter.models.detailed_candlestick import DetailedCandlestick + +# TODO update the JSON string below +json = "{}" +# create an instance of DetailedCandlestick from a JSON string +detailed_candlestick_instance = DetailedCandlestick.from_json(json) +# print the JSON string representation of the object +print(DetailedCandlestick.to_json()) + +# convert the object into a dict +detailed_candlestick_dict = detailed_candlestick_instance.to_dict() +# create an instance of DetailedCandlestick from a dict +detailed_candlestick_from_dict = DetailedCandlestick.from_dict(detailed_candlestick_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/EnrichedTx.md b/docs/lighter/lighter-python-main/docs/EnrichedTx.md new file mode 100644 index 0000000..27d2156 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/EnrichedTx.md @@ -0,0 +1,47 @@ +# EnrichedTx + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**hash** | **str** | | +**type** | **int** | | +**info** | **str** | | +**event_info** | **str** | | +**status** | **int** | | +**transaction_index** | **int** | | +**l1_address** | **str** | | +**account_index** | **int** | | +**nonce** | **int** | | +**expire_at** | **int** | | +**block_height** | **int** | | +**queued_at** | **int** | | +**executed_at** | **int** | | +**sequence_index** | **int** | | +**parent_hash** | **str** | | +**committed_at** | **int** | | +**verified_at** | **int** | | + +## Example + +```python +from lighter.models.enriched_tx import EnrichedTx + +# TODO update the JSON string below +json = "{}" +# create an instance of EnrichedTx from a JSON string +enriched_tx_instance = EnrichedTx.from_json(json) +# print the JSON string representation of the object +print(EnrichedTx.to_json()) + +# convert the object into a dict +enriched_tx_dict = enriched_tx_instance.to_dict() +# create an instance of EnrichedTx from a dict +enriched_tx_from_dict = EnrichedTx.from_dict(enriched_tx_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ExchangeStats.md b/docs/lighter/lighter-python-main/docs/ExchangeStats.md new file mode 100644 index 0000000..b0363fa --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ExchangeStats.md @@ -0,0 +1,34 @@ +# ExchangeStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**total** | **int** | | +**order_book_stats** | [**List[OrderBookStats]**](OrderBookStats.md) | | +**daily_usd_volume** | **float** | | +**daily_trades_count** | **int** | | + +## Example + +```python +from lighter.models.exchange_stats import ExchangeStats + +# TODO update the JSON string below +json = "{}" +# create an instance of ExchangeStats from a JSON string +exchange_stats_instance = ExchangeStats.from_json(json) +# print the JSON string representation of the object +print(ExchangeStats.to_json()) + +# convert the object into a dict +exchange_stats_dict = exchange_stats_instance.to_dict() +# create an instance of ExchangeStats from a dict +exchange_stats_from_dict = ExchangeStats.from_dict(exchange_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ExportData.md b/docs/lighter/lighter-python-main/docs/ExportData.md new file mode 100644 index 0000000..2770b68 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ExportData.md @@ -0,0 +1,31 @@ +# ExportData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**data_url** | **str** | | + +## Example + +```python +from lighter.models.export_data import ExportData + +# TODO update the JSON string below +json = "{}" +# create an instance of ExportData from a JSON string +export_data_instance = ExportData.from_json(json) +# print the JSON string representation of the object +print(ExportData.to_json()) + +# convert the object into a dict +export_data_dict = export_data_instance.to_dict() +# create an instance of ExportData from a dict +export_data_from_dict = ExportData.from_dict(export_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Funding.md b/docs/lighter/lighter-python-main/docs/Funding.md new file mode 100644 index 0000000..0c70d7c --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Funding.md @@ -0,0 +1,32 @@ +# Funding + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**value** | **str** | | +**rate** | **str** | | +**direction** | **str** | | + +## Example + +```python +from lighter.models.funding import Funding + +# TODO update the JSON string below +json = "{}" +# create an instance of Funding from a JSON string +funding_instance = Funding.from_json(json) +# print the JSON string representation of the object +print(Funding.to_json()) + +# convert the object into a dict +funding_dict = funding_instance.to_dict() +# create an instance of Funding from a dict +funding_from_dict = Funding.from_dict(funding_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/FundingApi.md b/docs/lighter/lighter-python-main/docs/FundingApi.md new file mode 100644 index 0000000..7f1ab04 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/FundingApi.md @@ -0,0 +1,74 @@ +# lighter.FundingApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**funding_rates**](FundingApi.md#funding_rates) | **GET** /api/v1/funding-rates | funding-rates + + +# **funding_rates** +> FundingRates funding_rates() + +funding-rates + +Get funding rates + +### Example + + +```python +import lighter +from lighter.models.funding_rates import FundingRates +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.FundingApi(api_client) + + try: + # funding-rates + api_response = await api_instance.funding_rates() + print("The response of FundingApi->funding_rates:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling FundingApi->funding_rates: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**FundingRates**](FundingRates.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/FundingRate.md b/docs/lighter/lighter-python-main/docs/FundingRate.md new file mode 100644 index 0000000..dc3886f --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/FundingRate.md @@ -0,0 +1,32 @@ +# FundingRate + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**exchange** | **str** | | +**symbol** | **str** | | +**rate** | **float** | | + +## Example + +```python +from lighter.models.funding_rate import FundingRate + +# TODO update the JSON string below +json = "{}" +# create an instance of FundingRate from a JSON string +funding_rate_instance = FundingRate.from_json(json) +# print the JSON string representation of the object +print(FundingRate.to_json()) + +# convert the object into a dict +funding_rate_dict = funding_rate_instance.to_dict() +# create an instance of FundingRate from a dict +funding_rate_from_dict = FundingRate.from_dict(funding_rate_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/FundingRates.md b/docs/lighter/lighter-python-main/docs/FundingRates.md new file mode 100644 index 0000000..27f6fe1 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/FundingRates.md @@ -0,0 +1,31 @@ +# FundingRates + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**funding_rates** | [**List[FundingRate]**](FundingRate.md) | | + +## Example + +```python +from lighter.models.funding_rates import FundingRates + +# TODO update the JSON string below +json = "{}" +# create an instance of FundingRates from a JSON string +funding_rates_instance = FundingRates.from_json(json) +# print the JSON string representation of the object +print(FundingRates.to_json()) + +# convert the object into a dict +funding_rates_dict = funding_rates_instance.to_dict() +# create an instance of FundingRates from a dict +funding_rates_from_dict = FundingRates.from_dict(funding_rates_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Fundings.md b/docs/lighter/lighter-python-main/docs/Fundings.md new file mode 100644 index 0000000..bbd1470 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Fundings.md @@ -0,0 +1,32 @@ +# Fundings + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**resolution** | **str** | | +**fundings** | [**List[Funding]**](Funding.md) | | + +## Example + +```python +from lighter.models.fundings import Fundings + +# TODO update the JSON string below +json = "{}" +# create an instance of Fundings from a JSON string +fundings_instance = Fundings.from_json(json) +# print the JSON string representation of the object +print(Fundings.to_json()) + +# convert the object into a dict +fundings_dict = fundings_instance.to_dict() +# create an instance of Fundings from a dict +fundings_from_dict = Fundings.from_dict(fundings_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/InfoApi.md b/docs/lighter/lighter-python-main/docs/InfoApi.md new file mode 100644 index 0000000..1078327 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/InfoApi.md @@ -0,0 +1,150 @@ +# lighter.InfoApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**transfer_fee_info**](InfoApi.md#transfer_fee_info) | **GET** /api/v1/transferFeeInfo | transferFeeInfo +[**withdrawal_delay**](InfoApi.md#withdrawal_delay) | **GET** /api/v1/withdrawalDelay | withdrawalDelay + + +# **transfer_fee_info** +> TransferFeeInfo transfer_fee_info(account_index, authorization=authorization, auth=auth, to_account_index=to_account_index) + +transferFeeInfo + +Transfer fee info + +### Example + + +```python +import lighter +from lighter.models.transfer_fee_info import TransferFeeInfo +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) + account_index = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + to_account_index = -1 # int | (optional) (default to -1) + + try: + # transferFeeInfo + api_response = await api_instance.transfer_fee_info(account_index, authorization=authorization, auth=auth, to_account_index=to_account_index) + print("The response of InfoApi->transfer_fee_info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->transfer_fee_info: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **to_account_index** | **int**| | [optional] [default to -1] + +### Return type + +[**TransferFeeInfo**](TransferFeeInfo.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) + +# **withdrawal_delay** +> RespWithdrawalDelay withdrawal_delay() + +withdrawalDelay + +Withdrawal delay in seconds + +### Example + + +```python +import lighter +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay +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: + # withdrawalDelay + api_response = await api_instance.withdrawal_delay() + print("The response of InfoApi->withdrawal_delay:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling InfoApi->withdrawal_delay: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**RespWithdrawalDelay**](RespWithdrawalDelay.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/L1Metadata.md b/docs/lighter/lighter-python-main/docs/L1Metadata.md new file mode 100644 index 0000000..2d277c4 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/L1Metadata.md @@ -0,0 +1,31 @@ +# L1Metadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | +**can_invite** | **bool** | | +**referral_points_percentage** | **str** | | + +## Example + +```python +from lighter.models.l1_metadata import L1Metadata + +# TODO update the JSON string below +json = "{}" +# create an instance of L1Metadata from a JSON string +l1_metadata_instance = L1Metadata.from_json(json) +# print the JSON string representation of the object +print(L1Metadata.to_json()) + +# convert the object into a dict +l1_metadata_dict = l1_metadata_instance.to_dict() +# create an instance of L1Metadata from a dict +l1_metadata_from_dict = L1Metadata.from_dict(l1_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/L1ProviderInfo.md b/docs/lighter/lighter-python-main/docs/L1ProviderInfo.md new file mode 100644 index 0000000..1ba41f0 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/L1ProviderInfo.md @@ -0,0 +1,31 @@ +# L1ProviderInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**chain_id** | **int** | | +**network_id** | **int** | | +**latest_block_number** | **int** | | + +## Example + +```python +from lighter.models.l1_provider_info import L1ProviderInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of L1ProviderInfo from a JSON string +l1_provider_info_instance = L1ProviderInfo.from_json(json) +# print the JSON string representation of the object +print(L1ProviderInfo.to_json()) + +# convert the object into a dict +l1_provider_info_dict = l1_provider_info_instance.to_dict() +# create an instance of L1ProviderInfo from a dict +l1_provider_info_from_dict = L1ProviderInfo.from_dict(l1_provider_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/LiqTrade.md b/docs/lighter/lighter-python-main/docs/LiqTrade.md new file mode 100644 index 0000000..d9761c4 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/LiqTrade.md @@ -0,0 +1,32 @@ +# LiqTrade + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**price** | **str** | | +**size** | **str** | | +**taker_fee** | **str** | | +**maker_fee** | **str** | | + +## Example + +```python +from lighter.models.liq_trade import LiqTrade + +# TODO update the JSON string below +json = "{}" +# create an instance of LiqTrade from a JSON string +liq_trade_instance = LiqTrade.from_json(json) +# print the JSON string representation of the object +print(LiqTrade.to_json()) + +# convert the object into a dict +liq_trade_dict = liq_trade_instance.to_dict() +# create an instance of LiqTrade from a dict +liq_trade_from_dict = LiqTrade.from_dict(liq_trade_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Liquidation.md b/docs/lighter/lighter-python-main/docs/Liquidation.md new file mode 100644 index 0000000..6b6ad54 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Liquidation.md @@ -0,0 +1,34 @@ +# Liquidation + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | | +**market_id** | **int** | | +**type** | **str** | | +**trade** | [**LiqTrade**](LiqTrade.md) | | +**info** | [**LiquidationInfo**](LiquidationInfo.md) | | +**executed_at** | **int** | | + +## Example + +```python +from lighter.models.liquidation import Liquidation + +# TODO update the JSON string below +json = "{}" +# create an instance of Liquidation from a JSON string +liquidation_instance = Liquidation.from_json(json) +# print the JSON string representation of the object +print(Liquidation.to_json()) + +# convert the object into a dict +liquidation_dict = liquidation_instance.to_dict() +# create an instance of Liquidation from a dict +liquidation_from_dict = Liquidation.from_dict(liquidation_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/LiquidationInfo.md b/docs/lighter/lighter-python-main/docs/LiquidationInfo.md new file mode 100644 index 0000000..6f388dc --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/LiquidationInfo.md @@ -0,0 +1,32 @@ +# LiquidationInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**positions** | [**List[AccountPosition]**](AccountPosition.md) | | +**risk_info_before** | [**RiskInfo**](RiskInfo.md) | | +**risk_info_after** | [**RiskInfo**](RiskInfo.md) | | +**mark_prices** | **Dict[str, float]** | | + +## Example + +```python +from lighter.models.liquidation_info import LiquidationInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of LiquidationInfo from a JSON string +liquidation_info_instance = LiquidationInfo.from_json(json) +# print the JSON string representation of the object +print(LiquidationInfo.to_json()) + +# convert the object into a dict +liquidation_info_dict = liquidation_info_instance.to_dict() +# create an instance of LiquidationInfo from a dict +liquidation_info_from_dict = LiquidationInfo.from_dict(liquidation_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/LiquidationInfos.md b/docs/lighter/lighter-python-main/docs/LiquidationInfos.md new file mode 100644 index 0000000..e9b6c0b --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/LiquidationInfos.md @@ -0,0 +1,32 @@ +# LiquidationInfos + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**liquidations** | [**List[Liquidation]**](Liquidation.md) | | +**next_cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.liquidation_infos import LiquidationInfos + +# TODO update the JSON string below +json = "{}" +# create an instance of LiquidationInfos from a JSON string +liquidation_infos_instance = LiquidationInfos.from_json(json) +# print the JSON string representation of the object +print(LiquidationInfos.to_json()) + +# convert the object into a dict +liquidation_infos_dict = liquidation_infos_instance.to_dict() +# create an instance of LiquidationInfos from a dict +liquidation_infos_from_dict = LiquidationInfos.from_dict(liquidation_infos_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/MarketInfo.md b/docs/lighter/lighter-python-main/docs/MarketInfo.md new file mode 100644 index 0000000..7b495c7 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/MarketInfo.md @@ -0,0 +1,41 @@ +# MarketInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**index_price** | **str** | | +**mark_price** | **str** | | +**open_interest** | **str** | | +**last_trade_price** | **str** | | +**current_funding_rate** | **str** | | +**funding_rate** | **str** | | +**funding_timestamp** | **int** | | +**daily_base_token_volume** | **float** | | +**daily_quote_token_volume** | **float** | | +**daily_price_low** | **float** | | +**daily_price_high** | **float** | | +**daily_price_change** | **float** | | + +## Example + +```python +from lighter.models.market_info import MarketInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of MarketInfo from a JSON string +market_info_instance = MarketInfo.from_json(json) +# print the JSON string representation of the object +print(MarketInfo.to_json()) + +# convert the object into a dict +market_info_dict = market_info_instance.to_dict() +# create an instance of MarketInfo from a dict +market_info_from_dict = MarketInfo.from_dict(market_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/NextNonce.md b/docs/lighter/lighter-python-main/docs/NextNonce.md new file mode 100644 index 0000000..68ec8dc --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/NextNonce.md @@ -0,0 +1,31 @@ +# NextNonce + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**nonce** | **int** | | + +## Example + +```python +from lighter.models.next_nonce import NextNonce + +# TODO update the JSON string below +json = "{}" +# create an instance of NextNonce from a JSON string +next_nonce_instance = NextNonce.from_json(json) +# print the JSON string representation of the object +print(NextNonce.to_json()) + +# convert the object into a dict +next_nonce_dict = next_nonce_instance.to_dict() +# create an instance of NextNonce from a dict +next_nonce_from_dict = NextNonce.from_dict(next_nonce_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/NotificationApi.md b/docs/lighter/lighter-python-main/docs/NotificationApi.md new file mode 100644 index 0000000..4bdc22d --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/NotificationApi.md @@ -0,0 +1,84 @@ +# lighter.NotificationApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**notification_ack**](NotificationApi.md#notification_ack) | **POST** /api/v1/notification/ack | notification_ack + + +# **notification_ack** +> ResultCode notification_ack(notif_id, account_index, authorization=authorization, auth=auth) + +notification_ack + +Ack notification + +### 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.NotificationApi(api_client) + notif_id = 'notif_id_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: + # notification_ack + api_response = await api_instance.notification_ack(notif_id, account_index, authorization=authorization, auth=auth) + print("The response of NotificationApi->notification_ack:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling NotificationApi->notification_ack: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **notif_id** | **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 + +[**ResultCode**](ResultCode.md) + +### Authorization + +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) + diff --git a/docs/lighter/lighter-python-main/docs/Order.md b/docs/lighter/lighter-python-main/docs/Order.md new file mode 100644 index 0000000..a3415f4 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Order.md @@ -0,0 +1,59 @@ +# Order + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_index** | **int** | | +**client_order_index** | **int** | | +**order_id** | **str** | | +**client_order_id** | **str** | | +**market_index** | **int** | | +**owner_account_index** | **int** | | +**initial_base_amount** | **str** | | +**price** | **str** | | +**nonce** | **int** | | +**remaining_base_amount** | **str** | | +**is_ask** | **bool** | | +**base_size** | **int** | | +**base_price** | **int** | | +**filled_base_amount** | **str** | | +**filled_quote_amount** | **str** | | +**side** | **str** | TODO: remove this | [default to 'buy'] +**type** | **str** | | +**time_in_force** | **str** | | [default to 'good-till-time'] +**reduce_only** | **bool** | | +**trigger_price** | **str** | | +**order_expiry** | **int** | | +**status** | **str** | | +**trigger_status** | **str** | | +**trigger_time** | **int** | | +**parent_order_index** | **int** | | +**parent_order_id** | **str** | | +**to_trigger_order_id_0** | **str** | | +**to_trigger_order_id_1** | **str** | | +**to_cancel_order_id_0** | **str** | | +**block_height** | **int** | | +**timestamp** | **int** | | + +## Example + +```python +from lighter.models.order import Order + +# TODO update the JSON string below +json = "{}" +# create an instance of Order from a JSON string +order_instance = Order.from_json(json) +# print the JSON string representation of the object +print(Order.to_json()) + +# convert the object into a dict +order_dict = order_instance.to_dict() +# create an instance of Order from a dict +order_from_dict = Order.from_dict(order_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderApi.md b/docs/lighter/lighter-python-main/docs/OrderApi.md new file mode 100644 index 0000000..2b59510 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderApi.md @@ -0,0 +1,686 @@ +# lighter.OrderApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**account_active_orders**](OrderApi.md#account_active_orders) | **GET** /api/v1/accountActiveOrders | accountActiveOrders +[**account_inactive_orders**](OrderApi.md#account_inactive_orders) | **GET** /api/v1/accountInactiveOrders | accountInactiveOrders +[**exchange_stats**](OrderApi.md#exchange_stats) | **GET** /api/v1/exchangeStats | exchangeStats +[**export**](OrderApi.md#export) | **GET** /api/v1/export | export +[**order_book_details**](OrderApi.md#order_book_details) | **GET** /api/v1/orderBookDetails | orderBookDetails +[**order_book_orders**](OrderApi.md#order_book_orders) | **GET** /api/v1/orderBookOrders | orderBookOrders +[**order_books**](OrderApi.md#order_books) | **GET** /api/v1/orderBooks | orderBooks +[**recent_trades**](OrderApi.md#recent_trades) | **GET** /api/v1/recentTrades | recentTrades +[**trades**](OrderApi.md#trades) | **GET** /api/v1/trades | trades + + +# **account_active_orders** +> Orders account_active_orders(account_index, market_id, authorization=authorization, auth=auth) + +accountActiveOrders + +Get account active orders. `auth` can be generated using the SDK. + +### Example + + +```python +import lighter +from lighter.models.orders import Orders +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + account_index = 56 # int | + market_id = 56 # int | + authorization = 'authorization_example' # str | make required after integ is done (optional) + auth = 'auth_example' # str | made optional to support header auth clients (optional) + + try: + # accountActiveOrders + api_response = await api_instance.account_active_orders(account_index, market_id, authorization=authorization, auth=auth) + print("The response of OrderApi->account_active_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->account_active_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **market_id** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### Return type + +[**Orders**](Orders.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **account_inactive_orders** +> Orders account_inactive_orders(account_index, limit, authorization=authorization, auth=auth, market_id=market_id, ask_filter=ask_filter, between_timestamps=between_timestamps, cursor=cursor) + +accountInactiveOrders + +Get account inactive orders + +### Example + + +```python +import lighter +from lighter.models.orders import Orders +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + account_index = 56 # int | + 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) + between_timestamps = 'between_timestamps_example' # str | (optional) + cursor = 'cursor_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) + print("The response of OrderApi->account_inactive_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->account_inactive_orders: %s\n" % e) +``` + + + +### Parameters + + +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] + **ask_filter** | **int**| | [optional] [default to -1] + **between_timestamps** | **str**| | [optional] + **cursor** | **str**| | [optional] + +### Return type + +[**Orders**](Orders.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + +# **exchange_stats** +> ExchangeStats exchange_stats() + +exchangeStats + +Get exchange stats + +### Example + + +```python +import lighter +from lighter.models.exchange_stats import ExchangeStats +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + + try: + # exchangeStats + api_response = await api_instance.exchange_stats() + print("The response of OrderApi->exchange_stats:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->exchange_stats: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**ExchangeStats**](ExchangeStats.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) + +# **export** +> ExportData export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id) + +export + +Export data + +### Example + + +```python +import lighter +from lighter.models.export_data import ExportData +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + type = 'type_example' # str | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + account_index = -1 # int | (optional) (default to -1) + market_id = 255 # int | (optional) (default to 255) + + try: + # export + api_response = await api_instance.export(type, authorization=authorization, auth=auth, account_index=account_index, market_id=market_id) + print("The response of OrderApi->export:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->export: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **type** | **str**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **account_index** | **int**| | [optional] [default to -1] + **market_id** | **int**| | [optional] [default to 255] + +### Return type + +[**ExportData**](ExportData.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) + +# **order_book_details** +> OrderBookDetails order_book_details(market_id=market_id) + +orderBookDetails + +Get order books metadata + +### Example + + +```python +import lighter +from lighter.models.order_book_details import OrderBookDetails +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + market_id = 255 # int | (optional) (default to 255) + + try: + # orderBookDetails + api_response = await api_instance.order_book_details(market_id=market_id) + print("The response of OrderApi->order_book_details:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->order_book_details: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | [optional] [default to 255] + +### Return type + +[**OrderBookDetails**](OrderBookDetails.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) + +# **order_book_orders** +> OrderBookOrders order_book_orders(market_id, limit) + +orderBookOrders + +Get order book orders + +### Example + + +```python +import lighter +from lighter.models.order_book_orders import OrderBookOrders +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + market_id = 56 # int | + limit = 56 # int | + + try: + # orderBookOrders + api_response = await api_instance.order_book_orders(market_id, limit) + print("The response of OrderApi->order_book_orders:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->order_book_orders: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | + **limit** | **int**| | + +### Return type + +[**OrderBookOrders**](OrderBookOrders.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) + +# **order_books** +> OrderBooks order_books(market_id=market_id) + +orderBooks + +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. + +### Example + + +```python +import lighter +from lighter.models.order_books import OrderBooks +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + market_id = 255 # int | (optional) (default to 255) + + try: + # orderBooks + api_response = await api_instance.order_books(market_id=market_id) + print("The response of OrderApi->order_books:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->order_books: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | [optional] [default to 255] + +### Return type + +[**OrderBooks**](OrderBooks.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) + +# **recent_trades** +> Trades recent_trades(market_id, limit) + +recentTrades + +Get recent trades + +### Example + + +```python +import lighter +from lighter.models.trades import Trades +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + market_id = 56 # int | + limit = 56 # int | + + try: + # recentTrades + api_response = await api_instance.recent_trades(market_id, limit) + print("The response of OrderApi->recent_trades:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->recent_trades: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **market_id** | **int**| | + **limit** | **int**| | + +### Return type + +[**Trades**](Trades.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) + +# **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) + +trades + +Get trades + +### Example + + +```python +import lighter +from lighter.models.trades import Trades +from lighter.rest import ApiException +from pprint import pprint + +# Defining the host is optional and defaults to https://mainnet.zklighter.elliot.ai +# See configuration.py for a list of all supported configuration parameters. +configuration = lighter.Configuration( + host = "https://mainnet.zklighter.elliot.ai" +) + + +# Enter a context with an instance of the API client +async with lighter.ApiClient(configuration) as api_client: + # Create an instance of the API class + api_instance = lighter.OrderApi(api_client) + sort_by = 'sort_by_example' # str | + limit = 56 # int | + authorization = 'authorization_example' # str | (optional) + auth = 'auth_example' # str | (optional) + market_id = 255 # int | (optional) (default to 255) + account_index = -1 # int | (optional) (default to -1) + 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) + + 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) + print("The response of OrderApi->trades:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling OrderApi->trades: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **sort_by** | **str**| | + **limit** | **int**| | + **authorization** | **str**| | [optional] + **auth** | **str**| | [optional] + **market_id** | **int**| | [optional] [default to 255] + **account_index** | **int**| | [optional] [default to -1] + **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] + +### Return type + +[**Trades**](Trades.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/OrderBook.md b/docs/lighter/lighter-python-main/docs/OrderBook.md new file mode 100644 index 0000000..054b931 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBook.md @@ -0,0 +1,39 @@ +# OrderBook + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**market_id** | **int** | | +**status** | **str** | | +**taker_fee** | **str** | | +**maker_fee** | **str** | | +**liquidation_fee** | **str** | | +**min_base_amount** | **str** | | +**min_quote_amount** | **str** | | +**supported_size_decimals** | **int** | | +**supported_price_decimals** | **int** | | +**supported_quote_decimals** | **int** | | + +## Example + +```python +from lighter.models.order_book import OrderBook + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBook from a JSON string +order_book_instance = OrderBook.from_json(json) +# print the JSON string representation of the object +print(OrderBook.to_json()) + +# convert the object into a dict +order_book_dict = order_book_instance.to_dict() +# create an instance of OrderBook from a dict +order_book_from_dict = OrderBook.from_dict(order_book_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBookDepth.md b/docs/lighter/lighter-python-main/docs/OrderBookDepth.md new file mode 100644 index 0000000..d2cafe9 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBookDepth.md @@ -0,0 +1,33 @@ +# OrderBookDepth + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**asks** | [**List[PriceLevel]**](PriceLevel.md) | | +**bids** | [**List[PriceLevel]**](PriceLevel.md) | | +**offset** | **int** | | + +## Example + +```python +from lighter.models.order_book_depth import OrderBookDepth + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBookDepth from a JSON string +order_book_depth_instance = OrderBookDepth.from_json(json) +# print the JSON string representation of the object +print(OrderBookDepth.to_json()) + +# convert the object into a dict +order_book_depth_dict = order_book_depth_instance.to_dict() +# create an instance of OrderBookDepth from a dict +order_book_depth_from_dict = OrderBookDepth.from_dict(order_book_depth_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBookDetail.md b/docs/lighter/lighter-python-main/docs/OrderBookDetail.md new file mode 100644 index 0000000..69de4ba --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBookDetail.md @@ -0,0 +1,55 @@ +# OrderBookDetail + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**market_id** | **int** | | +**status** | **str** | | +**taker_fee** | **str** | | +**maker_fee** | **str** | | +**liquidation_fee** | **str** | | +**min_base_amount** | **str** | | +**min_quote_amount** | **str** | | +**supported_size_decimals** | **int** | | +**supported_price_decimals** | **int** | | +**supported_quote_decimals** | **int** | | +**size_decimals** | **int** | | +**price_decimals** | **int** | | +**quote_multiplier** | **int** | | +**default_initial_margin_fraction** | **int** | | +**min_initial_margin_fraction** | **int** | | +**maintenance_margin_fraction** | **int** | | +**closeout_margin_fraction** | **int** | | +**last_trade_price** | **float** | | +**daily_trades_count** | **int** | | +**daily_base_token_volume** | **float** | | +**daily_quote_token_volume** | **float** | | +**daily_price_low** | **float** | | +**daily_price_high** | **float** | | +**daily_price_change** | **float** | | +**open_interest** | **float** | | +**daily_chart** | **Dict[str, float]** | | + +## Example + +```python +from lighter.models.order_book_detail import OrderBookDetail + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBookDetail from a JSON string +order_book_detail_instance = OrderBookDetail.from_json(json) +# print the JSON string representation of the object +print(OrderBookDetail.to_json()) + +# convert the object into a dict +order_book_detail_dict = order_book_detail_instance.to_dict() +# create an instance of OrderBookDetail from a dict +order_book_detail_from_dict = OrderBookDetail.from_dict(order_book_detail_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBookDetails.md b/docs/lighter/lighter-python-main/docs/OrderBookDetails.md new file mode 100644 index 0000000..8480c35 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBookDetails.md @@ -0,0 +1,31 @@ +# OrderBookDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**order_book_details** | [**List[OrderBookDetail]**](OrderBookDetail.md) | | + +## Example + +```python +from lighter.models.order_book_details import OrderBookDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBookDetails from a JSON string +order_book_details_instance = OrderBookDetails.from_json(json) +# print the JSON string representation of the object +print(OrderBookDetails.to_json()) + +# convert the object into a dict +order_book_details_dict = order_book_details_instance.to_dict() +# create an instance of OrderBookDetails from a dict +order_book_details_from_dict = OrderBookDetails.from_dict(order_book_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBookOrders.md b/docs/lighter/lighter-python-main/docs/OrderBookOrders.md new file mode 100644 index 0000000..960e274 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBookOrders.md @@ -0,0 +1,34 @@ +# OrderBookOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**total_asks** | **int** | | +**asks** | [**List[SimpleOrder]**](SimpleOrder.md) | | +**total_bids** | **int** | | +**bids** | [**List[SimpleOrder]**](SimpleOrder.md) | | + +## Example + +```python +from lighter.models.order_book_orders import OrderBookOrders + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBookOrders from a JSON string +order_book_orders_instance = OrderBookOrders.from_json(json) +# print the JSON string representation of the object +print(OrderBookOrders.to_json()) + +# convert the object into a dict +order_book_orders_dict = order_book_orders_instance.to_dict() +# create an instance of OrderBookOrders from a dict +order_book_orders_from_dict = OrderBookOrders.from_dict(order_book_orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBookStats.md b/docs/lighter/lighter-python-main/docs/OrderBookStats.md new file mode 100644 index 0000000..5484380 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBookStats.md @@ -0,0 +1,34 @@ +# OrderBookStats + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**symbol** | **str** | | +**last_trade_price** | **float** | | +**daily_trades_count** | **int** | | +**daily_base_token_volume** | **float** | | +**daily_quote_token_volume** | **float** | | +**daily_price_change** | **float** | | + +## Example + +```python +from lighter.models.order_book_stats import OrderBookStats + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBookStats from a JSON string +order_book_stats_instance = OrderBookStats.from_json(json) +# print the JSON string representation of the object +print(OrderBookStats.to_json()) + +# convert the object into a dict +order_book_stats_dict = order_book_stats_instance.to_dict() +# create an instance of OrderBookStats from a dict +order_book_stats_from_dict = OrderBookStats.from_dict(order_book_stats_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/OrderBooks.md b/docs/lighter/lighter-python-main/docs/OrderBooks.md new file mode 100644 index 0000000..325cc65 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/OrderBooks.md @@ -0,0 +1,31 @@ +# OrderBooks + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**order_books** | [**List[OrderBook]**](OrderBook.md) | | + +## Example + +```python +from lighter.models.order_books import OrderBooks + +# TODO update the JSON string below +json = "{}" +# create an instance of OrderBooks from a JSON string +order_books_instance = OrderBooks.from_json(json) +# print the JSON string representation of the object +print(OrderBooks.to_json()) + +# convert the object into a dict +order_books_dict = order_books_instance.to_dict() +# create an instance of OrderBooks from a dict +order_books_from_dict = OrderBooks.from_dict(order_books_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Orders.md b/docs/lighter/lighter-python-main/docs/Orders.md new file mode 100644 index 0000000..80bfc10 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Orders.md @@ -0,0 +1,32 @@ +# Orders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**next_cursor** | **str** | | [optional] +**orders** | [**List[Order]**](Order.md) | | + +## Example + +```python +from lighter.models.orders import Orders + +# TODO update the JSON string below +json = "{}" +# create an instance of Orders from a JSON string +orders_instance = Orders.from_json(json) +# print the JSON string representation of the object +print(Orders.to_json()) + +# convert the object into a dict +orders_dict = orders_instance.to_dict() +# create an instance of Orders from a dict +orders_from_dict = Orders.from_dict(orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PnLEntry.md b/docs/lighter/lighter-python-main/docs/PnLEntry.md new file mode 100644 index 0000000..6f80183 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PnLEntry.md @@ -0,0 +1,36 @@ +# PnLEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**trade_pnl** | **float** | | +**inflow** | **float** | | +**outflow** | **float** | | +**pool_pnl** | **float** | | +**pool_inflow** | **float** | | +**pool_outflow** | **float** | | +**pool_total_shares** | **float** | | + +## Example + +```python +from lighter.models.pn_l_entry import PnLEntry + +# TODO update the JSON string below +json = "{}" +# create an instance of PnLEntry from a JSON string +pn_l_entry_instance = PnLEntry.from_json(json) +# print the JSON string representation of the object +print(PnLEntry.to_json()) + +# convert the object into a dict +pn_l_entry_dict = pn_l_entry_instance.to_dict() +# create an instance of PnLEntry from a dict +pn_l_entry_from_dict = PnLEntry.from_dict(pn_l_entry_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PositionFunding.md b/docs/lighter/lighter-python-main/docs/PositionFunding.md new file mode 100644 index 0000000..3911db4 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PositionFunding.md @@ -0,0 +1,35 @@ +# PositionFunding + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**market_id** | **int** | | +**funding_id** | **int** | | +**change** | **str** | | +**rate** | **str** | | +**position_size** | **str** | | +**position_side** | **str** | | + +## Example + +```python +from lighter.models.position_funding import PositionFunding + +# TODO update the JSON string below +json = "{}" +# create an instance of PositionFunding from a JSON string +position_funding_instance = PositionFunding.from_json(json) +# print the JSON string representation of the object +print(PositionFunding.to_json()) + +# convert the object into a dict +position_funding_dict = position_funding_instance.to_dict() +# create an instance of PositionFunding from a dict +position_funding_from_dict = PositionFunding.from_dict(position_funding_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PositionFundings.md b/docs/lighter/lighter-python-main/docs/PositionFundings.md new file mode 100644 index 0000000..ea40d9e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PositionFundings.md @@ -0,0 +1,32 @@ +# PositionFundings + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**position_fundings** | [**List[PositionFunding]**](PositionFunding.md) | | +**next_cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.position_fundings import PositionFundings + +# TODO update the JSON string below +json = "{}" +# create an instance of PositionFundings from a JSON string +position_fundings_instance = PositionFundings.from_json(json) +# print the JSON string representation of the object +print(PositionFundings.to_json()) + +# convert the object into a dict +position_fundings_dict = position_fundings_instance.to_dict() +# create an instance of PositionFundings from a dict +position_fundings_from_dict = PositionFundings.from_dict(position_fundings_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PriceLevel.md b/docs/lighter/lighter-python-main/docs/PriceLevel.md new file mode 100644 index 0000000..dd1cc9c --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PriceLevel.md @@ -0,0 +1,30 @@ +# PriceLevel + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**price** | **str** | | +**size** | **str** | | + +## Example + +```python +from lighter.models.price_level import PriceLevel + +# TODO update the JSON string below +json = "{}" +# create an instance of PriceLevel from a JSON string +price_level_instance = PriceLevel.from_json(json) +# print the JSON string representation of the object +print(PriceLevel.to_json()) + +# convert the object into a dict +price_level_dict = price_level_instance.to_dict() +# create an instance of PriceLevel from a dict +price_level_from_dict = PriceLevel.from_dict(price_level_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PublicPool.md b/docs/lighter/lighter-python-main/docs/PublicPool.md new file mode 100644 index 0000000..527e94e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PublicPool.md @@ -0,0 +1,49 @@ +# PublicPool + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_type** | **int** | | +**index** | **int** | | +**l1_address** | **str** | | +**cancel_all_time** | **int** | | +**total_order_count** | **int** | | +**total_isolated_order_count** | **int** | | +**pending_order_count** | **int** | | +**available_balance** | **str** | | +**status** | **int** | | +**collateral** | **str** | | +**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 | +**total_asset_value** | **str** | | +**cross_asset_value** | **str** | | +**pool_info** | [**PublicPoolInfo**](PublicPoolInfo.md) | | +**account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | [optional] + +## Example + +```python +from lighter.models.public_pool import PublicPool + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPool from a JSON string +public_pool_instance = PublicPool.from_json(json) +# print the JSON string representation of the object +print(PublicPool.to_json()) + +# convert the object into a dict +public_pool_dict = public_pool_instance.to_dict() +# create an instance of PublicPool from a dict +public_pool_from_dict = PublicPool.from_dict(public_pool_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PublicPoolInfo.md b/docs/lighter/lighter-python-main/docs/PublicPoolInfo.md new file mode 100644 index 0000000..d3aac46 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PublicPoolInfo.md @@ -0,0 +1,36 @@ +# PublicPoolInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **int** | | +**operator_fee** | **str** | | +**min_operator_share_rate** | **str** | | +**total_shares** | **int** | | +**operator_shares** | **int** | | +**annual_percentage_yield** | **float** | | +**daily_returns** | [**List[DailyReturn]**](DailyReturn.md) | | +**share_prices** | [**List[SharePrice]**](SharePrice.md) | | + +## Example + +```python +from lighter.models.public_pool_info import PublicPoolInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPoolInfo from a JSON string +public_pool_info_instance = PublicPoolInfo.from_json(json) +# print the JSON string representation of the object +print(PublicPoolInfo.to_json()) + +# convert the object into a dict +public_pool_info_dict = public_pool_info_instance.to_dict() +# create an instance of PublicPoolInfo from a dict +public_pool_info_from_dict = PublicPoolInfo.from_dict(public_pool_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PublicPoolMetadata.md b/docs/lighter/lighter-python-main/docs/PublicPoolMetadata.md new file mode 100644 index 0000000..f3769c2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PublicPoolMetadata.md @@ -0,0 +1,40 @@ +# PublicPoolMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**account_index** | **int** | | +**account_type** | **int** | | +**name** | **str** | | +**l1_address** | **str** | | +**annual_percentage_yield** | **float** | | +**status** | **int** | | +**operator_fee** | **str** | | +**total_asset_value** | **str** | | +**total_shares** | **int** | | +**account_share** | [**PublicPoolShare**](PublicPoolShare.md) | | [optional] + +## Example + +```python +from lighter.models.public_pool_metadata import PublicPoolMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPoolMetadata from a JSON string +public_pool_metadata_instance = PublicPoolMetadata.from_json(json) +# print the JSON string representation of the object +print(PublicPoolMetadata.to_json()) + +# convert the object into a dict +public_pool_metadata_dict = public_pool_metadata_instance.to_dict() +# create an instance of PublicPoolMetadata from a dict +public_pool_metadata_from_dict = PublicPoolMetadata.from_dict(public_pool_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PublicPoolShare.md b/docs/lighter/lighter-python-main/docs/PublicPoolShare.md new file mode 100644 index 0000000..64a3f0f --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PublicPoolShare.md @@ -0,0 +1,31 @@ +# PublicPoolShare + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**public_pool_index** | **int** | | +**shares_amount** | **int** | | +**entry_usdc** | **str** | | + +## Example + +```python +from lighter.models.public_pool_share import PublicPoolShare + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPoolShare from a JSON string +public_pool_share_instance = PublicPoolShare.from_json(json) +# print the JSON string representation of the object +print(PublicPoolShare.to_json()) + +# convert the object into a dict +public_pool_share_dict = public_pool_share_instance.to_dict() +# create an instance of PublicPoolShare from a dict +public_pool_share_from_dict = PublicPoolShare.from_dict(public_pool_share_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/PublicPools.md b/docs/lighter/lighter-python-main/docs/PublicPools.md new file mode 100644 index 0000000..5ebeb86 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/PublicPools.md @@ -0,0 +1,32 @@ +# PublicPools + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**total** | **int** | | +**public_pools** | [**List[PublicPool]**](PublicPool.md) | | + +## Example + +```python +from lighter.models.public_pools import PublicPools + +# TODO update the JSON string below +json = "{}" +# create an instance of PublicPools from a JSON string +public_pools_instance = PublicPools.from_json(json) +# print the JSON string representation of the object +print(PublicPools.to_json()) + +# convert the object into a dict +public_pools_dict = public_pools_instance.to_dict() +# create an instance of PublicPools from a dict +public_pools_from_dict = PublicPools.from_dict(public_pools_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReferralApi.md b/docs/lighter/lighter-python-main/docs/ReferralApi.md new file mode 100644 index 0000000..0ee3c8b --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReferralApi.md @@ -0,0 +1,82 @@ +# lighter.ReferralApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**referral_points**](ReferralApi.md#referral_points) | **GET** /api/v1/referral/points | referral_points + + +# **referral_points** +> ReferralPoints referral_points(account_index, authorization=authorization, auth=auth) + +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) + 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_points + api_response = await api_instance.referral_points(account_index, authorization=authorization, auth=auth) + 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 +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **authorization** | **str**| make required after integ is done | [optional] + **auth** | **str**| made optional to support header auth clients | [optional] + +### 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) + diff --git a/docs/lighter/lighter-python-main/docs/ReferralPointEntry.md b/docs/lighter/lighter-python-main/docs/ReferralPointEntry.md new file mode 100644 index 0000000..2bb70bb --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReferralPointEntry.md @@ -0,0 +1,34 @@ +# ReferralPointEntry + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | +**total_points** | **int** | | +**week_points** | **int** | | +**total_reward_points** | **int** | | +**week_reward_points** | **int** | | +**reward_point_multiplier** | **str** | | + +## Example + +```python +from lighter.models.referral_point_entry import ReferralPointEntry + +# TODO update the JSON string below +json = "{}" +# create an instance of ReferralPointEntry from a JSON string +referral_point_entry_instance = ReferralPointEntry.from_json(json) +# print the JSON string representation of the object +print(ReferralPointEntry.to_json()) + +# convert the object into a dict +referral_point_entry_dict = referral_point_entry_instance.to_dict() +# create an instance of ReferralPointEntry from a dict +referral_point_entry_from_dict = ReferralPointEntry.from_dict(referral_point_entry_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReferralPoints.md b/docs/lighter/lighter-python-main/docs/ReferralPoints.md new file mode 100644 index 0000000..3ed5f35 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReferralPoints.md @@ -0,0 +1,34 @@ +# ReferralPoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**referrals** | [**List[ReferralPointEntry]**](ReferralPointEntry.md) | | +**user_total_points** | **int** | | +**user_last_week_points** | **int** | | +**user_total_referral_reward_points** | **int** | | +**user_last_week_referral_reward_points** | **int** | | +**reward_point_multiplier** | **str** | | + +## Example + +```python +from lighter.models.referral_points import ReferralPoints + +# TODO update the JSON string below +json = "{}" +# create an instance of ReferralPoints from a JSON string +referral_points_instance = ReferralPoints.from_json(json) +# print the JSON string representation of the object +print(ReferralPoints.to_json()) + +# convert the object into a dict +referral_points_dict = referral_points_instance.to_dict() +# create an instance of ReferralPoints from a dict +referral_points_from_dict = ReferralPoints.from_dict(referral_points_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqExportData.md b/docs/lighter/lighter-python-main/docs/ReqExportData.md new file mode 100644 index 0000000..0222e94 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqExportData.md @@ -0,0 +1,32 @@ +# ReqExportData + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**account_index** | **int** | | [optional] [default to -1] +**market_id** | **int** | | [optional] +**type** | **str** | | + +## Example + +```python +from lighter.models.req_export_data import ReqExportData + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqExportData from a JSON string +req_export_data_instance = ReqExportData.from_json(json) +# print the JSON string representation of the object +print(ReqExportData.to_json()) + +# convert the object into a dict +req_export_data_dict = req_export_data_instance.to_dict() +# create an instance of ReqExportData from a dict +req_export_data_from_dict = ReqExportData.from_dict(req_export_data_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccount.md b/docs/lighter/lighter-python-main/docs/ReqGetAccount.md new file mode 100644 index 0000000..77e4fe2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccount.md @@ -0,0 +1,30 @@ +# ReqGetAccount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | + +## Example + +```python +from lighter.models.req_get_account import ReqGetAccount + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccount from a JSON string +req_get_account_instance = ReqGetAccount.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccount.to_json()) + +# convert the object into a dict +req_get_account_dict = req_get_account_instance.to_dict() +# create an instance of ReqGetAccount from a dict +req_get_account_from_dict = ReqGetAccount.from_dict(req_get_account_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountActiveOrders.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountActiveOrders.md new file mode 100644 index 0000000..d596417 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountActiveOrders.md @@ -0,0 +1,31 @@ +# ReqGetAccountActiveOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**market_id** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountActiveOrders from a JSON string +req_get_account_active_orders_instance = ReqGetAccountActiveOrders.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountActiveOrders.to_json()) + +# convert the object into a dict +req_get_account_active_orders_dict = req_get_account_active_orders_instance.to_dict() +# create an instance of ReqGetAccountActiveOrders from a dict +req_get_account_active_orders_from_dict = ReqGetAccountActiveOrders.from_dict(req_get_account_active_orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountApiKeys.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountApiKeys.md new file mode 100644 index 0000000..6f3ceaa --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountApiKeys.md @@ -0,0 +1,30 @@ +# ReqGetAccountApiKeys + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**api_key_index** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountApiKeys from a JSON string +req_get_account_api_keys_instance = ReqGetAccountApiKeys.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountApiKeys.to_json()) + +# convert the object into a dict +req_get_account_api_keys_dict = req_get_account_api_keys_instance.to_dict() +# create an instance of ReqGetAccountApiKeys from a dict +req_get_account_api_keys_from_dict = ReqGetAccountApiKeys.from_dict(req_get_account_api_keys_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountByL1Address.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountByL1Address.md new file mode 100644 index 0000000..66e85b8 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountByL1Address.md @@ -0,0 +1,29 @@ +# ReqGetAccountByL1Address + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | + +## Example + +```python +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountByL1Address from a JSON string +req_get_account_by_l1_address_instance = ReqGetAccountByL1Address.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountByL1Address.to_json()) + +# convert the object into a dict +req_get_account_by_l1_address_dict = req_get_account_by_l1_address_instance.to_dict() +# create an instance of ReqGetAccountByL1Address from a dict +req_get_account_by_l1_address_from_dict = ReqGetAccountByL1Address.from_dict(req_get_account_by_l1_address_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountInactiveOrders.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountInactiveOrders.md new file mode 100644 index 0000000..d23b114 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountInactiveOrders.md @@ -0,0 +1,35 @@ +# ReqGetAccountInactiveOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**account_index** | **int** | | +**market_id** | **int** | | [optional] +**ask_filter** | **int** | | [optional] +**between_timestamps** | **str** | | [optional] +**cursor** | **str** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountInactiveOrders from a JSON string +req_get_account_inactive_orders_instance = ReqGetAccountInactiveOrders.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountInactiveOrders.to_json()) + +# convert the object into a dict +req_get_account_inactive_orders_dict = req_get_account_inactive_orders_instance.to_dict() +# create an instance of ReqGetAccountInactiveOrders from a dict +req_get_account_inactive_orders_from_dict = ReqGetAccountInactiveOrders.from_dict(req_get_account_inactive_orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountLimits.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountLimits.md new file mode 100644 index 0000000..9459c9e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountLimits.md @@ -0,0 +1,30 @@ +# ReqGetAccountLimits + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_account_limits import ReqGetAccountLimits + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountLimits from a JSON string +req_get_account_limits_instance = ReqGetAccountLimits.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountLimits.to_json()) + +# convert the object into a dict +req_get_account_limits_dict = req_get_account_limits_instance.to_dict() +# create an instance of ReqGetAccountLimits from a dict +req_get_account_limits_from_dict = ReqGetAccountLimits.from_dict(req_get_account_limits_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountMetadata.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountMetadata.md new file mode 100644 index 0000000..1674b09 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountMetadata.md @@ -0,0 +1,31 @@ +# ReqGetAccountMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | +**auth** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_account_metadata import ReqGetAccountMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountMetadata from a JSON string +req_get_account_metadata_instance = ReqGetAccountMetadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountMetadata.to_json()) + +# convert the object into a dict +req_get_account_metadata_dict = req_get_account_metadata_instance.to_dict() +# create an instance of ReqGetAccountMetadata from a dict +req_get_account_metadata_from_dict = ReqGetAccountMetadata.from_dict(req_get_account_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountPnL.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountPnL.md new file mode 100644 index 0000000..4f5f48d --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountPnL.md @@ -0,0 +1,36 @@ +# ReqGetAccountPnL + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**by** | **str** | | +**value** | **str** | | +**resolution** | **str** | | +**start_timestamp** | **int** | | +**end_timestamp** | **int** | | +**count_back** | **int** | | +**ignore_transfers** | **bool** | | [optional] [default to False] + +## Example + +```python +from lighter.models.req_get_account_pn_l import ReqGetAccountPnL + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountPnL from a JSON string +req_get_account_pn_l_instance = ReqGetAccountPnL.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountPnL.to_json()) + +# convert the object into a dict +req_get_account_pn_l_dict = req_get_account_pn_l_instance.to_dict() +# create an instance of ReqGetAccountPnL from a dict +req_get_account_pn_l_from_dict = ReqGetAccountPnL.from_dict(req_get_account_pn_l_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetAccountTxs.md b/docs/lighter/lighter-python-main/docs/ReqGetAccountTxs.md new file mode 100644 index 0000000..dbf8ffb --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetAccountTxs.md @@ -0,0 +1,34 @@ +# ReqGetAccountTxs + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | | [optional] +**limit** | **int** | | [optional] +**by** | **str** | | [optional] +**value** | **str** | | [optional] +**types** | **List[int]** | | [optional] +**auth** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_account_txs import ReqGetAccountTxs + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetAccountTxs from a JSON string +req_get_account_txs_instance = ReqGetAccountTxs.from_json(json) +# print the JSON string representation of the object +print(ReqGetAccountTxs.to_json()) + +# convert the object into a dict +req_get_account_txs_dict = req_get_account_txs_instance.to_dict() +# create an instance of ReqGetAccountTxs from a dict +req_get_account_txs_from_dict = ReqGetAccountTxs.from_dict(req_get_account_txs_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetBlock.md b/docs/lighter/lighter-python-main/docs/ReqGetBlock.md new file mode 100644 index 0000000..3fdd4d2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetBlock.md @@ -0,0 +1,30 @@ +# ReqGetBlock + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | + +## Example + +```python +from lighter.models.req_get_block import ReqGetBlock + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetBlock from a JSON string +req_get_block_instance = ReqGetBlock.from_json(json) +# print the JSON string representation of the object +print(ReqGetBlock.to_json()) + +# convert the object into a dict +req_get_block_dict = req_get_block_instance.to_dict() +# create an instance of ReqGetBlock from a dict +req_get_block_from_dict = ReqGetBlock.from_dict(req_get_block_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetBlockTxs.md b/docs/lighter/lighter-python-main/docs/ReqGetBlockTxs.md new file mode 100644 index 0000000..0a8af03 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetBlockTxs.md @@ -0,0 +1,30 @@ +# ReqGetBlockTxs + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | + +## Example + +```python +from lighter.models.req_get_block_txs import ReqGetBlockTxs + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetBlockTxs from a JSON string +req_get_block_txs_instance = ReqGetBlockTxs.from_json(json) +# print the JSON string representation of the object +print(ReqGetBlockTxs.to_json()) + +# convert the object into a dict +req_get_block_txs_dict = req_get_block_txs_instance.to_dict() +# create an instance of ReqGetBlockTxs from a dict +req_get_block_txs_from_dict = ReqGetBlockTxs.from_dict(req_get_block_txs_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetByAccount.md b/docs/lighter/lighter-python-main/docs/ReqGetByAccount.md new file mode 100644 index 0000000..701b6cc --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetByAccount.md @@ -0,0 +1,30 @@ +# ReqGetByAccount + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | + +## Example + +```python +from lighter.models.req_get_by_account import ReqGetByAccount + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetByAccount from a JSON string +req_get_by_account_instance = ReqGetByAccount.from_json(json) +# print the JSON string representation of the object +print(ReqGetByAccount.to_json()) + +# convert the object into a dict +req_get_by_account_dict = req_get_by_account_instance.to_dict() +# create an instance of ReqGetByAccount from a dict +req_get_by_account_from_dict = ReqGetByAccount.from_dict(req_get_by_account_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetCandlesticks.md b/docs/lighter/lighter-python-main/docs/ReqGetCandlesticks.md new file mode 100644 index 0000000..f6a322f --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetCandlesticks.md @@ -0,0 +1,34 @@ +# ReqGetCandlesticks + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**resolution** | **str** | | +**start_timestamp** | **int** | | +**end_timestamp** | **int** | | +**count_back** | **int** | | +**set_timestamp_to_end** | **bool** | | [optional] [default to False] + +## Example + +```python +from lighter.models.req_get_candlesticks import ReqGetCandlesticks + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetCandlesticks from a JSON string +req_get_candlesticks_instance = ReqGetCandlesticks.from_json(json) +# print the JSON string representation of the object +print(ReqGetCandlesticks.to_json()) + +# convert the object into a dict +req_get_candlesticks_dict = req_get_candlesticks_instance.to_dict() +# create an instance of ReqGetCandlesticks from a dict +req_get_candlesticks_from_dict = ReqGetCandlesticks.from_dict(req_get_candlesticks_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetDepositHistory.md b/docs/lighter/lighter-python-main/docs/ReqGetDepositHistory.md new file mode 100644 index 0000000..d0f0cc1 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetDepositHistory.md @@ -0,0 +1,33 @@ +# ReqGetDepositHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] +**l1_address** | **str** | | +**cursor** | **str** | | [optional] +**filter** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_deposit_history import ReqGetDepositHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetDepositHistory from a JSON string +req_get_deposit_history_instance = ReqGetDepositHistory.from_json(json) +# print the JSON string representation of the object +print(ReqGetDepositHistory.to_json()) + +# convert the object into a dict +req_get_deposit_history_dict = req_get_deposit_history_instance.to_dict() +# create an instance of ReqGetDepositHistory from a dict +req_get_deposit_history_from_dict = ReqGetDepositHistory.from_dict(req_get_deposit_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetFastWithdrawInfo.md b/docs/lighter/lighter-python-main/docs/ReqGetFastWithdrawInfo.md new file mode 100644 index 0000000..99a79ec --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetFastWithdrawInfo.md @@ -0,0 +1,30 @@ +# ReqGetFastWithdrawInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] + +## Example + +```python +from lighter.models.req_get_fast_withdraw_info import ReqGetFastWithdrawInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetFastWithdrawInfo from a JSON string +req_get_fast_withdraw_info_instance = ReqGetFastWithdrawInfo.from_json(json) +# print the JSON string representation of the object +print(ReqGetFastWithdrawInfo.to_json()) + +# convert the object into a dict +req_get_fast_withdraw_info_dict = req_get_fast_withdraw_info_instance.to_dict() +# create an instance of ReqGetFastWithdrawInfo from a dict +req_get_fast_withdraw_info_from_dict = ReqGetFastWithdrawInfo.from_dict(req_get_fast_withdraw_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetFundings.md b/docs/lighter/lighter-python-main/docs/ReqGetFundings.md new file mode 100644 index 0000000..32f6baa --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetFundings.md @@ -0,0 +1,33 @@ +# ReqGetFundings + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**resolution** | **str** | | +**start_timestamp** | **int** | | +**end_timestamp** | **int** | | +**count_back** | **int** | | + +## Example + +```python +from lighter.models.req_get_fundings import ReqGetFundings + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetFundings from a JSON string +req_get_fundings_instance = ReqGetFundings.from_json(json) +# print the JSON string representation of the object +print(ReqGetFundings.to_json()) + +# convert the object into a dict +req_get_fundings_dict = req_get_fundings_instance.to_dict() +# create an instance of ReqGetFundings from a dict +req_get_fundings_from_dict = ReqGetFundings.from_dict(req_get_fundings_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetL1Metadata.md b/docs/lighter/lighter-python-main/docs/ReqGetL1Metadata.md new file mode 100644 index 0000000..e66cc76 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetL1Metadata.md @@ -0,0 +1,30 @@ +# ReqGetL1Metadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**l1_address** | **str** | | + +## Example + +```python +from lighter.models.req_get_l1_metadata import ReqGetL1Metadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetL1Metadata from a JSON string +req_get_l1_metadata_instance = ReqGetL1Metadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetL1Metadata.to_json()) + +# convert the object into a dict +req_get_l1_metadata_dict = req_get_l1_metadata_instance.to_dict() +# create an instance of ReqGetL1Metadata from a dict +req_get_l1_metadata_from_dict = ReqGetL1Metadata.from_dict(req_get_l1_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetL1Tx.md b/docs/lighter/lighter-python-main/docs/ReqGetL1Tx.md new file mode 100644 index 0000000..3b722c7 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetL1Tx.md @@ -0,0 +1,29 @@ +# ReqGetL1Tx + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hash** | **str** | | + +## Example + +```python +from lighter.models.req_get_l1_tx import ReqGetL1Tx + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetL1Tx from a JSON string +req_get_l1_tx_instance = ReqGetL1Tx.from_json(json) +# print the JSON string representation of the object +print(ReqGetL1Tx.to_json()) + +# convert the object into a dict +req_get_l1_tx_dict = req_get_l1_tx_instance.to_dict() +# create an instance of ReqGetL1Tx from a dict +req_get_l1_tx_from_dict = ReqGetL1Tx.from_dict(req_get_l1_tx_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetLatestDeposit.md b/docs/lighter/lighter-python-main/docs/ReqGetLatestDeposit.md new file mode 100644 index 0000000..1d84f65 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetLatestDeposit.md @@ -0,0 +1,29 @@ +# ReqGetLatestDeposit + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**l1_address** | **str** | | + +## Example + +```python +from lighter.models.req_get_latest_deposit import ReqGetLatestDeposit + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetLatestDeposit from a JSON string +req_get_latest_deposit_instance = ReqGetLatestDeposit.from_json(json) +# print the JSON string representation of the object +print(ReqGetLatestDeposit.to_json()) + +# convert the object into a dict +req_get_latest_deposit_dict = req_get_latest_deposit_instance.to_dict() +# create an instance of ReqGetLatestDeposit from a dict +req_get_latest_deposit_from_dict = ReqGetLatestDeposit.from_dict(req_get_latest_deposit_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetLiquidationInfos.md b/docs/lighter/lighter-python-main/docs/ReqGetLiquidationInfos.md new file mode 100644 index 0000000..20e45af --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetLiquidationInfos.md @@ -0,0 +1,33 @@ +# ReqGetLiquidationInfos + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**account_index** | **int** | | +**market_id** | **int** | | [optional] +**cursor** | **str** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_liquidation_infos import ReqGetLiquidationInfos + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetLiquidationInfos from a JSON string +req_get_liquidation_infos_instance = ReqGetLiquidationInfos.from_json(json) +# print the JSON string representation of the object +print(ReqGetLiquidationInfos.to_json()) + +# convert the object into a dict +req_get_liquidation_infos_dict = req_get_liquidation_infos_instance.to_dict() +# create an instance of ReqGetLiquidationInfos from a dict +req_get_liquidation_infos_from_dict = ReqGetLiquidationInfos.from_dict(req_get_liquidation_infos_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetNextNonce.md b/docs/lighter/lighter-python-main/docs/ReqGetNextNonce.md new file mode 100644 index 0000000..b421d91 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetNextNonce.md @@ -0,0 +1,30 @@ +# ReqGetNextNonce + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**api_key_index** | **int** | | + +## Example + +```python +from lighter.models.req_get_next_nonce import ReqGetNextNonce + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetNextNonce from a JSON string +req_get_next_nonce_instance = ReqGetNextNonce.from_json(json) +# print the JSON string representation of the object +print(ReqGetNextNonce.to_json()) + +# convert the object into a dict +req_get_next_nonce_dict = req_get_next_nonce_instance.to_dict() +# create an instance of ReqGetNextNonce from a dict +req_get_next_nonce_from_dict = ReqGetNextNonce.from_dict(req_get_next_nonce_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetOrderBookDetails.md b/docs/lighter/lighter-python-main/docs/ReqGetOrderBookDetails.md new file mode 100644 index 0000000..333f27a --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetOrderBookDetails.md @@ -0,0 +1,29 @@ +# ReqGetOrderBookDetails + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_order_book_details import ReqGetOrderBookDetails + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetOrderBookDetails from a JSON string +req_get_order_book_details_instance = ReqGetOrderBookDetails.from_json(json) +# print the JSON string representation of the object +print(ReqGetOrderBookDetails.to_json()) + +# convert the object into a dict +req_get_order_book_details_dict = req_get_order_book_details_instance.to_dict() +# create an instance of ReqGetOrderBookDetails from a dict +req_get_order_book_details_from_dict = ReqGetOrderBookDetails.from_dict(req_get_order_book_details_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetOrderBookOrders.md b/docs/lighter/lighter-python-main/docs/ReqGetOrderBookOrders.md new file mode 100644 index 0000000..7f543eb --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetOrderBookOrders.md @@ -0,0 +1,30 @@ +# ReqGetOrderBookOrders + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_order_book_orders import ReqGetOrderBookOrders + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetOrderBookOrders from a JSON string +req_get_order_book_orders_instance = ReqGetOrderBookOrders.from_json(json) +# print the JSON string representation of the object +print(ReqGetOrderBookOrders.to_json()) + +# convert the object into a dict +req_get_order_book_orders_dict = req_get_order_book_orders_instance.to_dict() +# create an instance of ReqGetOrderBookOrders from a dict +req_get_order_book_orders_from_dict = ReqGetOrderBookOrders.from_dict(req_get_order_book_orders_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetOrderBooks.md b/docs/lighter/lighter-python-main/docs/ReqGetOrderBooks.md new file mode 100644 index 0000000..4cb4b5d --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetOrderBooks.md @@ -0,0 +1,29 @@ +# ReqGetOrderBooks + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_order_books import ReqGetOrderBooks + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetOrderBooks from a JSON string +req_get_order_books_instance = ReqGetOrderBooks.from_json(json) +# print the JSON string representation of the object +print(ReqGetOrderBooks.to_json()) + +# convert the object into a dict +req_get_order_books_dict = req_get_order_books_instance.to_dict() +# create an instance of ReqGetOrderBooks from a dict +req_get_order_books_from_dict = ReqGetOrderBooks.from_dict(req_get_order_books_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetPositionFunding.md b/docs/lighter/lighter-python-main/docs/ReqGetPositionFunding.md new file mode 100644 index 0000000..83399b2 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetPositionFunding.md @@ -0,0 +1,34 @@ +# ReqGetPositionFunding + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**account_index** | **int** | | +**market_id** | **int** | | [optional] +**cursor** | **str** | | [optional] +**limit** | **int** | | +**side** | **str** | | [optional] [default to 'all'] + +## Example + +```python +from lighter.models.req_get_position_funding import ReqGetPositionFunding + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetPositionFunding from a JSON string +req_get_position_funding_instance = ReqGetPositionFunding.from_json(json) +# print the JSON string representation of the object +print(ReqGetPositionFunding.to_json()) + +# convert the object into a dict +req_get_position_funding_dict = req_get_position_funding_instance.to_dict() +# create an instance of ReqGetPositionFunding from a dict +req_get_position_funding_from_dict = ReqGetPositionFunding.from_dict(req_get_position_funding_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetPublicPools.md b/docs/lighter/lighter-python-main/docs/ReqGetPublicPools.md new file mode 100644 index 0000000..367eef0 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetPublicPools.md @@ -0,0 +1,33 @@ +# ReqGetPublicPools + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**filter** | **str** | | [optional] +**index** | **int** | | +**limit** | **int** | | +**account_index** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_public_pools import ReqGetPublicPools + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetPublicPools from a JSON string +req_get_public_pools_instance = ReqGetPublicPools.from_json(json) +# print the JSON string representation of the object +print(ReqGetPublicPools.to_json()) + +# convert the object into a dict +req_get_public_pools_dict = req_get_public_pools_instance.to_dict() +# create an instance of ReqGetPublicPools from a dict +req_get_public_pools_from_dict = ReqGetPublicPools.from_dict(req_get_public_pools_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetPublicPoolsMetadata.md b/docs/lighter/lighter-python-main/docs/ReqGetPublicPoolsMetadata.md new file mode 100644 index 0000000..e62dbf5 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetPublicPoolsMetadata.md @@ -0,0 +1,33 @@ +# ReqGetPublicPoolsMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**filter** | **str** | | [optional] +**index** | **int** | | +**limit** | **int** | | +**account_index** | **int** | | [optional] + +## Example + +```python +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetPublicPoolsMetadata from a JSON string +req_get_public_pools_metadata_instance = ReqGetPublicPoolsMetadata.from_json(json) +# print the JSON string representation of the object +print(ReqGetPublicPoolsMetadata.to_json()) + +# convert the object into a dict +req_get_public_pools_metadata_dict = req_get_public_pools_metadata_instance.to_dict() +# create an instance of ReqGetPublicPoolsMetadata from a dict +req_get_public_pools_metadata_from_dict = ReqGetPublicPoolsMetadata.from_dict(req_get_public_pools_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetRangeWithCursor.md b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithCursor.md new file mode 100644 index 0000000..9fd0055 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithCursor.md @@ -0,0 +1,30 @@ +# ReqGetRangeWithCursor + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cursor** | **str** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetRangeWithCursor from a JSON string +req_get_range_with_cursor_instance = ReqGetRangeWithCursor.from_json(json) +# print the JSON string representation of the object +print(ReqGetRangeWithCursor.to_json()) + +# convert the object into a dict +req_get_range_with_cursor_dict = req_get_range_with_cursor_instance.to_dict() +# create an instance of ReqGetRangeWithCursor from a dict +req_get_range_with_cursor_from_dict = ReqGetRangeWithCursor.from_dict(req_get_range_with_cursor_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndex.md b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndex.md new file mode 100644 index 0000000..b195dd5 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndex.md @@ -0,0 +1,30 @@ +# ReqGetRangeWithIndex + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetRangeWithIndex from a JSON string +req_get_range_with_index_instance = ReqGetRangeWithIndex.from_json(json) +# print the JSON string representation of the object +print(ReqGetRangeWithIndex.to_json()) + +# convert the object into a dict +req_get_range_with_index_dict = req_get_range_with_index_instance.to_dict() +# create an instance of ReqGetRangeWithIndex from a dict +req_get_range_with_index_from_dict = ReqGetRangeWithIndex.from_dict(req_get_range_with_index_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndexSortable.md b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndexSortable.md new file mode 100644 index 0000000..e4f2c72 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetRangeWithIndexSortable.md @@ -0,0 +1,31 @@ +# ReqGetRangeWithIndexSortable + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**index** | **int** | | [optional] +**limit** | **int** | | [optional] +**sort** | **str** | | [optional] [default to 'asc'] + +## Example + +```python +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetRangeWithIndexSortable from a JSON string +req_get_range_with_index_sortable_instance = ReqGetRangeWithIndexSortable.from_json(json) +# print the JSON string representation of the object +print(ReqGetRangeWithIndexSortable.to_json()) + +# convert the object into a dict +req_get_range_with_index_sortable_dict = req_get_range_with_index_sortable_instance.to_dict() +# create an instance of ReqGetRangeWithIndexSortable from a dict +req_get_range_with_index_sortable_from_dict = ReqGetRangeWithIndexSortable.from_dict(req_get_range_with_index_sortable_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetRecentTrades.md b/docs/lighter/lighter-python-main/docs/ReqGetRecentTrades.md new file mode 100644 index 0000000..e96aac5 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetRecentTrades.md @@ -0,0 +1,30 @@ +# ReqGetRecentTrades + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_recent_trades import ReqGetRecentTrades + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetRecentTrades from a JSON string +req_get_recent_trades_instance = ReqGetRecentTrades.from_json(json) +# print the JSON string representation of the object +print(ReqGetRecentTrades.to_json()) + +# convert the object into a dict +req_get_recent_trades_dict = req_get_recent_trades_instance.to_dict() +# create an instance of ReqGetRecentTrades from a dict +req_get_recent_trades_from_dict = ReqGetRecentTrades.from_dict(req_get_recent_trades_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetReferralPoints.md b/docs/lighter/lighter-python-main/docs/ReqGetReferralPoints.md new file mode 100644 index 0000000..609ae7b --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetReferralPoints.md @@ -0,0 +1,30 @@ +# ReqGetReferralPoints + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | made optional to support header auth clients | [optional] +**account_index** | **int** | | + +## Example + +```python +from lighter.models.req_get_referral_points import ReqGetReferralPoints + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetReferralPoints from a JSON string +req_get_referral_points_instance = ReqGetReferralPoints.from_json(json) +# print the JSON string representation of the object +print(ReqGetReferralPoints.to_json()) + +# convert the object into a dict +req_get_referral_points_dict = req_get_referral_points_instance.to_dict() +# create an instance of ReqGetReferralPoints from a dict +req_get_referral_points_from_dict = ReqGetReferralPoints.from_dict(req_get_referral_points_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetTrades.md b/docs/lighter/lighter-python-main/docs/ReqGetTrades.md new file mode 100644 index 0000000..947005c --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetTrades.md @@ -0,0 +1,38 @@ +# ReqGetTrades + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**market_id** | **int** | | [optional] +**account_index** | **int** | | [optional] [default to -1] +**order_index** | **int** | | [optional] +**sort_by** | **str** | | +**sort_dir** | **str** | | [optional] [default to 'desc'] +**cursor** | **str** | | [optional] +**var_from** | **int** | | [optional] [default to -1] +**ask_filter** | **int** | | [optional] +**limit** | **int** | | + +## Example + +```python +from lighter.models.req_get_trades import ReqGetTrades + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetTrades from a JSON string +req_get_trades_instance = ReqGetTrades.from_json(json) +# print the JSON string representation of the object +print(ReqGetTrades.to_json()) + +# convert the object into a dict +req_get_trades_dict = req_get_trades_instance.to_dict() +# create an instance of ReqGetTrades from a dict +req_get_trades_from_dict = ReqGetTrades.from_dict(req_get_trades_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetTransferFeeInfo.md b/docs/lighter/lighter-python-main/docs/ReqGetTransferFeeInfo.md new file mode 100644 index 0000000..84824f7 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetTransferFeeInfo.md @@ -0,0 +1,31 @@ +# ReqGetTransferFeeInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**auth** | **str** | | [optional] +**account_index** | **int** | | +**to_account_index** | **int** | | [optional] [default to -1] + +## Example + +```python +from lighter.models.req_get_transfer_fee_info import ReqGetTransferFeeInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetTransferFeeInfo from a JSON string +req_get_transfer_fee_info_instance = ReqGetTransferFeeInfo.from_json(json) +# print the JSON string representation of the object +print(ReqGetTransferFeeInfo.to_json()) + +# convert the object into a dict +req_get_transfer_fee_info_dict = req_get_transfer_fee_info_instance.to_dict() +# create an instance of ReqGetTransferFeeInfo from a dict +req_get_transfer_fee_info_from_dict = ReqGetTransferFeeInfo.from_dict(req_get_transfer_fee_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetTransferHistory.md b/docs/lighter/lighter-python-main/docs/ReqGetTransferHistory.md new file mode 100644 index 0000000..cb548fa --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetTransferHistory.md @@ -0,0 +1,31 @@ +# ReqGetTransferHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] +**cursor** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_transfer_history import ReqGetTransferHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetTransferHistory from a JSON string +req_get_transfer_history_instance = ReqGetTransferHistory.from_json(json) +# print the JSON string representation of the object +print(ReqGetTransferHistory.to_json()) + +# convert the object into a dict +req_get_transfer_history_dict = req_get_transfer_history_instance.to_dict() +# create an instance of ReqGetTransferHistory from a dict +req_get_transfer_history_from_dict = ReqGetTransferHistory.from_dict(req_get_transfer_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetTx.md b/docs/lighter/lighter-python-main/docs/ReqGetTx.md new file mode 100644 index 0000000..52a83e1 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetTx.md @@ -0,0 +1,30 @@ +# ReqGetTx + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**by** | **str** | | +**value** | **str** | | + +## Example + +```python +from lighter.models.req_get_tx import ReqGetTx + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetTx from a JSON string +req_get_tx_instance = ReqGetTx.from_json(json) +# print the JSON string representation of the object +print(ReqGetTx.to_json()) + +# convert the object into a dict +req_get_tx_dict = req_get_tx_instance.to_dict() +# create an instance of ReqGetTx from a dict +req_get_tx_from_dict = ReqGetTx.from_dict(req_get_tx_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ReqGetWithdrawHistory.md b/docs/lighter/lighter-python-main/docs/ReqGetWithdrawHistory.md new file mode 100644 index 0000000..a8297ba --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ReqGetWithdrawHistory.md @@ -0,0 +1,32 @@ +# ReqGetWithdrawHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**account_index** | **int** | | +**auth** | **str** | made optional to support header auth clients | [optional] +**cursor** | **str** | | [optional] +**filter** | **str** | | [optional] + +## Example + +```python +from lighter.models.req_get_withdraw_history import ReqGetWithdrawHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of ReqGetWithdrawHistory from a JSON string +req_get_withdraw_history_instance = ReqGetWithdrawHistory.from_json(json) +# print the JSON string representation of the object +print(ReqGetWithdrawHistory.to_json()) + +# convert the object into a dict +req_get_withdraw_history_dict = req_get_withdraw_history_instance.to_dict() +# create an instance of ReqGetWithdrawHistory from a dict +req_get_withdraw_history_from_dict = ReqGetWithdrawHistory.from_dict(req_get_withdraw_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespChangeAccountTier.md b/docs/lighter/lighter-python-main/docs/RespChangeAccountTier.md new file mode 100644 index 0000000..62cd493 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespChangeAccountTier.md @@ -0,0 +1,30 @@ +# RespChangeAccountTier + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] + +## Example + +```python +from lighter.models.resp_change_account_tier import RespChangeAccountTier + +# TODO update the JSON string below +json = "{}" +# create an instance of RespChangeAccountTier from a JSON string +resp_change_account_tier_instance = RespChangeAccountTier.from_json(json) +# print the JSON string representation of the object +print(RespChangeAccountTier.to_json()) + +# convert the object into a dict +resp_change_account_tier_dict = resp_change_account_tier_instance.to_dict() +# create an instance of RespChangeAccountTier from a dict +resp_change_account_tier_from_dict = RespChangeAccountTier.from_dict(resp_change_account_tier_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespGetFastBridgeInfo.md b/docs/lighter/lighter-python-main/docs/RespGetFastBridgeInfo.md new file mode 100644 index 0000000..f0dfc09 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespGetFastBridgeInfo.md @@ -0,0 +1,31 @@ +# RespGetFastBridgeInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**fast_bridge_limit** | **str** | | + +## Example + +```python +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of RespGetFastBridgeInfo from a JSON string +resp_get_fast_bridge_info_instance = RespGetFastBridgeInfo.from_json(json) +# print the JSON string representation of the object +print(RespGetFastBridgeInfo.to_json()) + +# convert the object into a dict +resp_get_fast_bridge_info_dict = resp_get_fast_bridge_info_instance.to_dict() +# create an instance of RespGetFastBridgeInfo from a dict +resp_get_fast_bridge_info_from_dict = RespGetFastBridgeInfo.from_dict(resp_get_fast_bridge_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespPublicPoolsMetadata.md b/docs/lighter/lighter-python-main/docs/RespPublicPoolsMetadata.md new file mode 100644 index 0000000..63b6d07 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespPublicPoolsMetadata.md @@ -0,0 +1,31 @@ +# RespPublicPoolsMetadata + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**public_pools** | [**List[PublicPoolMetadata]**](PublicPoolMetadata.md) | | + +## Example + +```python +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata + +# TODO update the JSON string below +json = "{}" +# create an instance of RespPublicPoolsMetadata from a JSON string +resp_public_pools_metadata_instance = RespPublicPoolsMetadata.from_json(json) +# print the JSON string representation of the object +print(RespPublicPoolsMetadata.to_json()) + +# convert the object into a dict +resp_public_pools_metadata_dict = resp_public_pools_metadata_instance.to_dict() +# create an instance of RespPublicPoolsMetadata from a dict +resp_public_pools_metadata_from_dict = RespPublicPoolsMetadata.from_dict(resp_public_pools_metadata_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespSendTx.md b/docs/lighter/lighter-python-main/docs/RespSendTx.md new file mode 100644 index 0000000..5d58479 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespSendTx.md @@ -0,0 +1,32 @@ +# RespSendTx + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**tx_hash** | **str** | | +**predicted_execution_time_ms** | **int** | | + +## Example + +```python +from lighter.models.resp_send_tx import RespSendTx + +# TODO update the JSON string below +json = "{}" +# create an instance of RespSendTx from a JSON string +resp_send_tx_instance = RespSendTx.from_json(json) +# print the JSON string representation of the object +print(RespSendTx.to_json()) + +# convert the object into a dict +resp_send_tx_dict = resp_send_tx_instance.to_dict() +# create an instance of RespSendTx from a dict +resp_send_tx_from_dict = RespSendTx.from_dict(resp_send_tx_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespSendTxBatch.md b/docs/lighter/lighter-python-main/docs/RespSendTxBatch.md new file mode 100644 index 0000000..1b02a5b --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespSendTxBatch.md @@ -0,0 +1,32 @@ +# RespSendTxBatch + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**tx_hash** | **List[str]** | | +**predicted_execution_time_ms** | **int** | | + +## Example + +```python +from lighter.models.resp_send_tx_batch import RespSendTxBatch + +# TODO update the JSON string below +json = "{}" +# create an instance of RespSendTxBatch from a JSON string +resp_send_tx_batch_instance = RespSendTxBatch.from_json(json) +# print the JSON string representation of the object +print(RespSendTxBatch.to_json()) + +# convert the object into a dict +resp_send_tx_batch_dict = resp_send_tx_batch_instance.to_dict() +# create an instance of RespSendTxBatch from a dict +resp_send_tx_batch_from_dict = RespSendTxBatch.from_dict(resp_send_tx_batch_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RespWithdrawalDelay.md b/docs/lighter/lighter-python-main/docs/RespWithdrawalDelay.md new file mode 100644 index 0000000..5178729 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RespWithdrawalDelay.md @@ -0,0 +1,29 @@ +# RespWithdrawalDelay + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**seconds** | **int** | | + +## Example + +```python +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay + +# TODO update the JSON string below +json = "{}" +# create an instance of RespWithdrawalDelay from a JSON string +resp_withdrawal_delay_instance = RespWithdrawalDelay.from_json(json) +# print the JSON string representation of the object +print(RespWithdrawalDelay.to_json()) + +# convert the object into a dict +resp_withdrawal_delay_dict = resp_withdrawal_delay_instance.to_dict() +# create an instance of RespWithdrawalDelay from a dict +resp_withdrawal_delay_from_dict = RespWithdrawalDelay.from_dict(resp_withdrawal_delay_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ResultCode.md b/docs/lighter/lighter-python-main/docs/ResultCode.md new file mode 100644 index 0000000..3ba8b3e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ResultCode.md @@ -0,0 +1,30 @@ +# ResultCode + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] + +## Example + +```python +from lighter.models.result_code import ResultCode + +# TODO update the JSON string below +json = "{}" +# create an instance of ResultCode from a JSON string +result_code_instance = ResultCode.from_json(json) +# print the JSON string representation of the object +print(ResultCode.to_json()) + +# convert the object into a dict +result_code_dict = result_code_instance.to_dict() +# create an instance of ResultCode from a dict +result_code_from_dict = ResultCode.from_dict(result_code_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RiskInfo.md b/docs/lighter/lighter-python-main/docs/RiskInfo.md new file mode 100644 index 0000000..2984f0a --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RiskInfo.md @@ -0,0 +1,30 @@ +# RiskInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**cross_risk_parameters** | [**RiskParameters**](RiskParameters.md) | | +**isolated_risk_parameters** | [**List[RiskParameters]**](RiskParameters.md) | | + +## Example + +```python +from lighter.models.risk_info import RiskInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of RiskInfo from a JSON string +risk_info_instance = RiskInfo.from_json(json) +# print the JSON string representation of the object +print(RiskInfo.to_json()) + +# convert the object into a dict +risk_info_dict = risk_info_instance.to_dict() +# create an instance of RiskInfo from a dict +risk_info_from_dict = RiskInfo.from_dict(risk_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RiskParameters.md b/docs/lighter/lighter-python-main/docs/RiskParameters.md new file mode 100644 index 0000000..26f9e61 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RiskParameters.md @@ -0,0 +1,34 @@ +# RiskParameters + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**market_id** | **int** | | +**collateral** | **str** | | +**total_account_value** | **str** | | +**initial_margin_req** | **str** | | +**maintenance_margin_req** | **str** | | +**close_out_margin_req** | **str** | | + +## Example + +```python +from lighter.models.risk_parameters import RiskParameters + +# TODO update the JSON string below +json = "{}" +# create an instance of RiskParameters from a JSON string +risk_parameters_instance = RiskParameters.from_json(json) +# print the JSON string representation of the object +print(RiskParameters.to_json()) + +# convert the object into a dict +risk_parameters_dict = risk_parameters_instance.to_dict() +# create an instance of RiskParameters from a dict +risk_parameters_from_dict = RiskParameters.from_dict(risk_parameters_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/RootApi.md b/docs/lighter/lighter-python-main/docs/RootApi.md new file mode 100644 index 0000000..036e0a7 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/RootApi.md @@ -0,0 +1,140 @@ +# lighter.RootApi + +All URIs are relative to *https://mainnet.zklighter.elliot.ai* + +Method | HTTP request | Description +------------- | ------------- | ------------- +[**info**](RootApi.md#info) | **GET** /info | info +[**status**](RootApi.md#status) | **GET** / | status + + +# **info** +> ZkLighterInfo info() + +info + +Get info of zklighter + +### Example + + +```python +import lighter +from lighter.models.zk_lighter_info import ZkLighterInfo +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.RootApi(api_client) + + try: + # info + api_response = await api_instance.info() + print("The response of RootApi->info:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RootApi->info: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**ZkLighterInfo**](ZkLighterInfo.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) + +# **status** +> Status status() + +status + +Get status of zklighter + +### Example + + +```python +import lighter +from lighter.models.status import Status +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.RootApi(api_client) + + try: + # status + api_response = await api_instance.status() + print("The response of RootApi->status:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling RootApi->status: %s\n" % e) +``` + + + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**Status**](Status.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/SharePrice.md b/docs/lighter/lighter-python-main/docs/SharePrice.md new file mode 100644 index 0000000..a23c65c --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/SharePrice.md @@ -0,0 +1,30 @@ +# SharePrice + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**timestamp** | **int** | | +**share_price** | **float** | | + +## Example + +```python +from lighter.models.share_price import SharePrice + +# TODO update the JSON string below +json = "{}" +# create an instance of SharePrice from a JSON string +share_price_instance = SharePrice.from_json(json) +# print the JSON string representation of the object +print(SharePrice.to_json()) + +# convert the object into a dict +share_price_dict = share_price_instance.to_dict() +# create an instance of SharePrice from a dict +share_price_from_dict = SharePrice.from_dict(share_price_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/SimpleOrder.md b/docs/lighter/lighter-python-main/docs/SimpleOrder.md new file mode 100644 index 0000000..c32315e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/SimpleOrder.md @@ -0,0 +1,35 @@ +# SimpleOrder + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**order_index** | **int** | | +**order_id** | **str** | | +**owner_account_index** | **int** | | +**initial_base_amount** | **str** | | +**remaining_base_amount** | **str** | | +**price** | **str** | | +**order_expiry** | **int** | | + +## Example + +```python +from lighter.models.simple_order import SimpleOrder + +# TODO update the JSON string below +json = "{}" +# create an instance of SimpleOrder from a JSON string +simple_order_instance = SimpleOrder.from_json(json) +# print the JSON string representation of the object +print(SimpleOrder.to_json()) + +# convert the object into a dict +simple_order_dict = simple_order_instance.to_dict() +# create an instance of SimpleOrder from a dict +simple_order_from_dict = SimpleOrder.from_dict(simple_order_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Status.md b/docs/lighter/lighter-python-main/docs/Status.md new file mode 100644 index 0000000..2b1027e --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Status.md @@ -0,0 +1,31 @@ +# Status + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**status** | **int** | | +**network_id** | **int** | | +**timestamp** | **int** | | + +## Example + +```python +from lighter.models.status import Status + +# TODO update the JSON string below +json = "{}" +# create an instance of Status from a JSON string +status_instance = Status.from_json(json) +# print the JSON string representation of the object +print(Status.to_json()) + +# convert the object into a dict +status_dict = status_instance.to_dict() +# create an instance of Status from a dict +status_from_dict = Status.from_dict(status_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/SubAccounts.md b/docs/lighter/lighter-python-main/docs/SubAccounts.md new file mode 100644 index 0000000..d61d833 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/SubAccounts.md @@ -0,0 +1,32 @@ +# SubAccounts + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**l1_address** | **str** | | +**sub_accounts** | [**List[Account]**](Account.md) | | + +## Example + +```python +from lighter.models.sub_accounts import SubAccounts + +# TODO update the JSON string below +json = "{}" +# create an instance of SubAccounts from a JSON string +sub_accounts_instance = SubAccounts.from_json(json) +# print the JSON string representation of the object +print(SubAccounts.to_json()) + +# convert the object into a dict +sub_accounts_dict = sub_accounts_instance.to_dict() +# create an instance of SubAccounts from a dict +sub_accounts_from_dict = SubAccounts.from_dict(sub_accounts_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Ticker.md b/docs/lighter/lighter-python-main/docs/Ticker.md new file mode 100644 index 0000000..593d4ed --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Ticker.md @@ -0,0 +1,31 @@ +# Ticker + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**s** | **str** | | +**a** | [**PriceLevel**](PriceLevel.md) | | +**b** | [**PriceLevel**](PriceLevel.md) | | + +## Example + +```python +from lighter.models.ticker import Ticker + +# TODO update the JSON string below +json = "{}" +# create an instance of Ticker from a JSON string +ticker_instance = Ticker.from_json(json) +# print the JSON string representation of the object +print(Ticker.to_json()) + +# convert the object into a dict +ticker_dict = ticker_instance.to_dict() +# create an instance of Ticker from a dict +ticker_from_dict = Ticker.from_dict(ticker_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Trade.md b/docs/lighter/lighter-python-main/docs/Trade.md new file mode 100644 index 0000000..ac611a0 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Trade.md @@ -0,0 +1,52 @@ +# Trade + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**trade_id** | **int** | | +**tx_hash** | **str** | | +**type** | **str** | | +**market_id** | **int** | | +**size** | **str** | | +**price** | **str** | | +**usd_amount** | **str** | | +**ask_id** | **int** | | +**bid_id** | **int** | | +**ask_account_id** | **int** | | +**bid_account_id** | **int** | | +**is_maker_ask** | **bool** | | +**block_height** | **int** | | +**timestamp** | **int** | | +**taker_fee** | **int** | | +**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_position_size_before** | **str** | | +**maker_entry_quote_before** | **str** | | +**maker_initial_margin_fraction_before** | **int** | | +**maker_position_sign_changed** | **bool** | | + +## Example + +```python +from lighter.models.trade import Trade + +# TODO update the JSON string below +json = "{}" +# create an instance of Trade from a JSON string +trade_instance = Trade.from_json(json) +# print the JSON string representation of the object +print(Trade.to_json()) + +# convert the object into a dict +trade_dict = trade_instance.to_dict() +# create an instance of Trade from a dict +trade_from_dict = Trade.from_dict(trade_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Trades.md b/docs/lighter/lighter-python-main/docs/Trades.md new file mode 100644 index 0000000..541df2a --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Trades.md @@ -0,0 +1,32 @@ +# Trades + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**next_cursor** | **str** | | [optional] +**trades** | [**List[Trade]**](Trade.md) | | + +## Example + +```python +from lighter.models.trades import Trades + +# TODO update the JSON string below +json = "{}" +# create an instance of Trades from a JSON string +trades_instance = Trades.from_json(json) +# print the JSON string representation of the object +print(Trades.to_json()) + +# convert the object into a dict +trades_dict = trades_instance.to_dict() +# create an instance of Trades from a dict +trades_from_dict = Trades.from_dict(trades_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/TransactionApi.md b/docs/lighter/lighter-python-main/docs/TransactionApi.md new file mode 100644 index 0000000..01b0ec1 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TransactionApi.md @@ -0,0 +1,828 @@ +# lighter.TransactionApi + +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 +[**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, authorization=authorization, index=index, types=types, auth=auth) + +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 | + authorization = 'authorization_example' # str | (optional) + index = 56 # int | (optional) + types = [56] # List[int] | (optional) + auth = 'auth_example' # str | (optional) + + try: + # accountTxs + api_response = await api_instance.account_txs(limit, by, value, authorization=authorization, index=index, types=types, auth=auth) + 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**| | + **authorization** | **str**| | [optional] + **index** | **int**| | [optional] + **types** | [**List[int]**](int.md)| | [optional] + **auth** | **str**| | [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) + +deposit_history + +Get deposit history + +### Example + + +```python +import lighter +from lighter.models.deposit_history import DepositHistory +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) + 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) + print("The response of TransactionApi->deposit_history:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->deposit_history: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **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] + +### Return type + +[**DepositHistory**](DepositHistory.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) + +# **next_nonce** +> NextNonce next_nonce(account_index, api_key_index) + +nextNonce + +Get next nonce for a specific account and api key + +### Example + + +```python +import lighter +from lighter.models.next_nonce import NextNonce +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) + account_index = 56 # int | + api_key_index = 56 # int | + + try: + # nextNonce + api_response = await api_instance.next_nonce(account_index, api_key_index) + print("The response of TransactionApi->next_nonce:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->next_nonce: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **account_index** | **int**| | + **api_key_index** | **int**| | + +### Return type + +[**NextNonce**](NextNonce.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) + +# **send_tx** +> RespSendTx send_tx(tx_type, tx_info, price_protection=price_protection) + +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) + +### Example + + +```python +import lighter +from lighter.models.resp_send_tx import RespSendTx +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) + tx_type = 56 # int | + tx_info = 'tx_info_example' # str | + price_protection = True # bool | (optional) (default to True) + + try: + # sendTx + api_response = await api_instance.send_tx(tx_type, tx_info, price_protection=price_protection) + print("The response of TransactionApi->send_tx:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->send_tx: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tx_type** | **int**| | + **tx_info** | **str**| | + **price_protection** | **bool**| | [optional] [default to True] + +### Return type + +[**RespSendTx**](RespSendTx.md) + +### Authorization + +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) + +# **send_tx_batch** +> RespSendTxBatch send_tx_batch(tx_types, tx_infos) + +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) + +### Example + + +```python +import lighter +from lighter.models.resp_send_tx_batch import RespSendTxBatch +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) + tx_types = 'tx_types_example' # str | + tx_infos = 'tx_infos_example' # str | + + try: + # sendTxBatch + api_response = await api_instance.send_tx_batch(tx_types, tx_infos) + print("The response of TransactionApi->send_tx_batch:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->send_tx_batch: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **tx_types** | **str**| | + **tx_infos** | **str**| | + +### Return type + +[**RespSendTxBatch**](RespSendTxBatch.md) + +### Authorization + +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) + +# **transfer_history** +> TransferHistory transfer_history(account_index, authorization=authorization, auth=auth, cursor=cursor) + +transfer_history + +Get transfer history + +### Example + + +```python +import lighter +from lighter.models.transfer_history import TransferHistory +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) + 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) + + try: + # transfer_history + api_response = await api_instance.transfer_history(account_index, authorization=authorization, auth=auth, cursor=cursor) + print("The response of TransactionApi->transfer_history:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->transfer_history: %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] + **cursor** | **str**| | [optional] + +### Return type + +[**TransferHistory**](TransferHistory.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) + +# **tx** +> EnrichedTx tx(by, value) + +tx + +Get transaction by hash or sequence index + +### Example + + +```python +import lighter +from lighter.models.enriched_tx import EnrichedTx +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: + # tx + api_response = await api_instance.tx(by, value) + print("The response of TransactionApi->tx:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->tx: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **by** | **str**| | + **value** | **str**| | + +### Return type + +[**EnrichedTx**](EnrichedTx.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) + +# **tx_from_l1_tx_hash** +> EnrichedTx tx_from_l1_tx_hash(hash) + +txFromL1TxHash + +Get L1 transaction by L1 transaction hash + +### Example + + +```python +import lighter +from lighter.models.enriched_tx import EnrichedTx +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) + hash = 'hash_example' # str | + + try: + # txFromL1TxHash + api_response = await api_instance.tx_from_l1_tx_hash(hash) + print("The response of TransactionApi->tx_from_l1_tx_hash:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->tx_from_l1_tx_hash: %s\n" % e) +``` + + + +### Parameters + + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **hash** | **str**| | + +### Return type + +[**EnrichedTx**](EnrichedTx.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) + +# **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) + +withdraw_history + +Get withdraw history + +### Example + + +```python +import lighter +from lighter.models.withdraw_history import WithdrawHistory +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) + 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) + print("The response of TransactionApi->withdraw_history:\n") + pprint(api_response) + except Exception as e: + print("Exception when calling TransactionApi->withdraw_history: %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] + **cursor** | **str**| | [optional] + **filter** | **str**| | [optional] + +### Return type + +[**WithdrawHistory**](WithdrawHistory.md) + +### Authorization + +No authorization required + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: application/json + +### HTTP response details + +| Status code | Description | Response headers | +|-------------|-------------|------------------| +**200** | A successful response. | - | +**400** | Bad request | - | + +[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md) + diff --git a/docs/lighter/lighter-python-main/docs/TransferFeeInfo.md b/docs/lighter/lighter-python-main/docs/TransferFeeInfo.md new file mode 100644 index 0000000..52c9c27 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TransferFeeInfo.md @@ -0,0 +1,31 @@ +# TransferFeeInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**transfer_fee_usdc** | **int** | | + +## Example + +```python +from lighter.models.transfer_fee_info import TransferFeeInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of TransferFeeInfo from a JSON string +transfer_fee_info_instance = TransferFeeInfo.from_json(json) +# print the JSON string representation of the object +print(TransferFeeInfo.to_json()) + +# convert the object into a dict +transfer_fee_info_dict = transfer_fee_info_instance.to_dict() +# create an instance of TransferFeeInfo from a dict +transfer_fee_info_from_dict = TransferFeeInfo.from_dict(transfer_fee_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/TransferHistory.md b/docs/lighter/lighter-python-main/docs/TransferHistory.md new file mode 100644 index 0000000..f005cc3 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TransferHistory.md @@ -0,0 +1,32 @@ +# TransferHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**transfers** | [**List[TransferHistoryItem]**](TransferHistoryItem.md) | | +**cursor** | **str** | | + +## Example + +```python +from lighter.models.transfer_history import TransferHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of TransferHistory from a JSON string +transfer_history_instance = TransferHistory.from_json(json) +# print the JSON string representation of the object +print(TransferHistory.to_json()) + +# convert the object into a dict +transfer_history_dict = transfer_history_instance.to_dict() +# create an instance of TransferHistory from a dict +transfer_history_from_dict = TransferHistory.from_dict(transfer_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/TransferHistoryItem.md b/docs/lighter/lighter-python-main/docs/TransferHistoryItem.md new file mode 100644 index 0000000..4d7f5df --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TransferHistoryItem.md @@ -0,0 +1,37 @@ +# TransferHistoryItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**amount** | **str** | | +**timestamp** | **int** | | +**type** | **str** | | +**from_l1_address** | **str** | | +**to_l1_address** | **str** | | +**from_account_index** | **int** | | +**to_account_index** | **int** | | +**tx_hash** | **str** | | + +## Example + +```python +from lighter.models.transfer_history_item import TransferHistoryItem + +# TODO update the JSON string below +json = "{}" +# create an instance of TransferHistoryItem from a JSON string +transfer_history_item_instance = TransferHistoryItem.from_json(json) +# print the JSON string representation of the object +print(TransferHistoryItem.to_json()) + +# convert the object into a dict +transfer_history_item_dict = transfer_history_item_instance.to_dict() +# create an instance of TransferHistoryItem from a dict +transfer_history_item_from_dict = TransferHistoryItem.from_dict(transfer_history_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Tx.md b/docs/lighter/lighter-python-main/docs/Tx.md new file mode 100644 index 0000000..76f8f11 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Tx.md @@ -0,0 +1,43 @@ +# Tx + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**hash** | **str** | | +**type** | **int** | | +**info** | **str** | | +**event_info** | **str** | | +**status** | **int** | | +**transaction_index** | **int** | | +**l1_address** | **str** | | +**account_index** | **int** | | +**nonce** | **int** | | +**expire_at** | **int** | | +**block_height** | **int** | | +**queued_at** | **int** | | +**executed_at** | **int** | | +**sequence_index** | **int** | | +**parent_hash** | **str** | | + +## Example + +```python +from lighter.models.tx import Tx + +# TODO update the JSON string below +json = "{}" +# create an instance of Tx from a JSON string +tx_instance = Tx.from_json(json) +# print the JSON string representation of the object +print(Tx.to_json()) + +# convert the object into a dict +tx_dict = tx_instance.to_dict() +# create an instance of Tx from a dict +tx_from_dict = Tx.from_dict(tx_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/TxHash.md b/docs/lighter/lighter-python-main/docs/TxHash.md new file mode 100644 index 0000000..e605bea --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TxHash.md @@ -0,0 +1,31 @@ +# TxHash + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**tx_hash** | **str** | | + +## Example + +```python +from lighter.models.tx_hash import TxHash + +# TODO update the JSON string below +json = "{}" +# create an instance of TxHash from a JSON string +tx_hash_instance = TxHash.from_json(json) +# print the JSON string representation of the object +print(TxHash.to_json()) + +# convert the object into a dict +tx_hash_dict = tx_hash_instance.to_dict() +# create an instance of TxHash from a dict +tx_hash_from_dict = TxHash.from_dict(tx_hash_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/TxHashes.md b/docs/lighter/lighter-python-main/docs/TxHashes.md new file mode 100644 index 0000000..18194ca --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/TxHashes.md @@ -0,0 +1,31 @@ +# TxHashes + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**tx_hash** | **List[str]** | | + +## Example + +```python +from lighter.models.tx_hashes import TxHashes + +# TODO update the JSON string below +json = "{}" +# create an instance of TxHashes from a JSON string +tx_hashes_instance = TxHashes.from_json(json) +# print the JSON string representation of the object +print(TxHashes.to_json()) + +# convert the object into a dict +tx_hashes_dict = tx_hashes_instance.to_dict() +# create an instance of TxHashes from a dict +tx_hashes_from_dict = TxHashes.from_dict(tx_hashes_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/Txs.md b/docs/lighter/lighter-python-main/docs/Txs.md new file mode 100644 index 0000000..634d6c6 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/Txs.md @@ -0,0 +1,31 @@ +# Txs + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**txs** | [**List[Tx]**](Tx.md) | | + +## Example + +```python +from lighter.models.txs import Txs + +# TODO update the JSON string below +json = "{}" +# create an instance of Txs from a JSON string +txs_instance = Txs.from_json(json) +# print the JSON string representation of the object +print(Txs.to_json()) + +# convert the object into a dict +txs_dict = txs_instance.to_dict() +# create an instance of Txs from a dict +txs_from_dict = Txs.from_dict(txs_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ValidatorInfo.md b/docs/lighter/lighter-python-main/docs/ValidatorInfo.md new file mode 100644 index 0000000..d23c6f3 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ValidatorInfo.md @@ -0,0 +1,30 @@ +# ValidatorInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **str** | | +**is_active** | **bool** | | + +## Example + +```python +from lighter.models.validator_info import ValidatorInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of ValidatorInfo from a JSON string +validator_info_instance = ValidatorInfo.from_json(json) +# print the JSON string representation of the object +print(ValidatorInfo.to_json()) + +# convert the object into a dict +validator_info_dict = validator_info_instance.to_dict() +# create an instance of ValidatorInfo from a dict +validator_info_from_dict = ValidatorInfo.from_dict(validator_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/WithdrawHistory.md b/docs/lighter/lighter-python-main/docs/WithdrawHistory.md new file mode 100644 index 0000000..f0d34c5 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/WithdrawHistory.md @@ -0,0 +1,32 @@ +# WithdrawHistory + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**code** | **int** | | +**message** | **str** | | [optional] +**withdraws** | [**List[WithdrawHistoryItem]**](WithdrawHistoryItem.md) | | +**cursor** | **str** | | + +## Example + +```python +from lighter.models.withdraw_history import WithdrawHistory + +# TODO update the JSON string below +json = "{}" +# create an instance of WithdrawHistory from a JSON string +withdraw_history_instance = WithdrawHistory.from_json(json) +# print the JSON string representation of the object +print(WithdrawHistory.to_json()) + +# convert the object into a dict +withdraw_history_dict = withdraw_history_instance.to_dict() +# create an instance of WithdrawHistory from a dict +withdraw_history_from_dict = WithdrawHistory.from_dict(withdraw_history_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/WithdrawHistoryItem.md b/docs/lighter/lighter-python-main/docs/WithdrawHistoryItem.md new file mode 100644 index 0000000..1ae6002 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/WithdrawHistoryItem.md @@ -0,0 +1,34 @@ +# WithdrawHistoryItem + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **str** | | +**amount** | **str** | | +**timestamp** | **int** | | +**status** | **str** | | +**type** | **str** | | +**l1_tx_hash** | **str** | | + +## Example + +```python +from lighter.models.withdraw_history_item import WithdrawHistoryItem + +# TODO update the JSON string below +json = "{}" +# create an instance of WithdrawHistoryItem from a JSON string +withdraw_history_item_instance = WithdrawHistoryItem.from_json(json) +# print the JSON string representation of the object +print(WithdrawHistoryItem.to_json()) + +# convert the object into a dict +withdraw_history_item_dict = withdraw_history_item_instance.to_dict() +# create an instance of WithdrawHistoryItem from a dict +withdraw_history_item_from_dict = WithdrawHistoryItem.from_dict(withdraw_history_item_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/docs/ZkLighterInfo.md b/docs/lighter/lighter-python-main/docs/ZkLighterInfo.md new file mode 100644 index 0000000..3265473 --- /dev/null +++ b/docs/lighter/lighter-python-main/docs/ZkLighterInfo.md @@ -0,0 +1,29 @@ +# ZkLighterInfo + + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contract_address** | **str** | | + +## Example + +```python +from lighter.models.zk_lighter_info import ZkLighterInfo + +# TODO update the JSON string below +json = "{}" +# create an instance of ZkLighterInfo from a JSON string +zk_lighter_info_instance = ZkLighterInfo.from_json(json) +# print the JSON string representation of the object +print(ZkLighterInfo.to_json()) + +# convert the object into a dict +zk_lighter_info_dict = zk_lighter_info_instance.to_dict() +# create an instance of ZkLighterInfo from a dict +zk_lighter_info_from_dict = ZkLighterInfo.from_dict(zk_lighter_info_dict) +``` +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/docs/lighter/lighter-python-main/examples/README.md b/docs/lighter/lighter-python-main/examples/README.md new file mode 100644 index 0000000..b506b7c --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/README.md @@ -0,0 +1,24 @@ +## Setup steps for testnet +- Go to https://testnet.app.lighter.xyz/ and connect a wallet to receive $500 +- run `system_setup.py` with the correct ETH Private key configured + - set an API key index which is not 0, so you won't override the one used by [app.lighter.xyz](https://app.lighter.xyz/) + - this will require you to enter your Ethereum private key + - the eth private key will only be used in the Py SDK to sign a message + - the eth private key is not required in order to trade on the platform + - the eth private key is not passed to the binary + - copy the output of the script and post it into `create_cancel_order.py` + - the output should look like +``` +BASE_URL = 'https://testnet.zklighter.elliot.ai' +API_KEY_PRIVATE_KEY = '0xea5d2eca5be67eca056752eaf27b173518b8a5550117c09d2b58c7ea7d306cc4426f913ccf27ab19' +ACCOUNT_INDEX = 595 +API_KEY_INDEX = 1 +``` +- start trading using + - `create_cancel_order.py` has an example which created an order on testnet & cancels it + - you'll need to set up both your account index, api key index & API Key private key + +## Setup steps for mainnet +- deposit money on Lighter to create an account first +- change the URL to `mainnet.zklighter.elliot.ai` +- repeat setup step \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/examples/create_cancel_order.py b/docs/lighter/lighter-python-main/examples/create_cancel_order.py new file mode 100644 index 0000000..4264e3c --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/create_cancel_order.py @@ -0,0 +1,70 @@ +import asyncio +import logging +import lighter + +logging.basicConfig(level=logging.DEBUG) + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and servers as an example. +# Alternatively, you can go to https://app.lighter.xyz/apikeys for mainnet api keys +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 +API_KEY_INDEX = 1 + + +def trim_exception(e: Exception) -> str: + return str(e).strip().split("\n")[-1] + + +async def main(): + api_client = lighter.ApiClient(configuration=lighter.Configuration(host=BASE_URL)) + + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + + err = client.check_client() + if err is not None: + print(f"CheckClient error: {trim_exception(err)}") + return + + # create order + tx, tx_hash, err = await client.create_order( + market_index=0, + client_order_index=123, + base_amount=100000, + price=405000, + is_ask=True, + order_type=lighter.SignerClient.ORDER_TYPE_LIMIT, + time_in_force=lighter.SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=0, + trigger_price=0, + ) + print(f"Create Order {tx=} {tx_hash=} {err=}") + if err is not None: + raise Exception(err) + + auth, err = client.create_auth_token_with_expiry(lighter.SignerClient.DEFAULT_10_MIN_AUTH_EXPIRY) + print(f"{auth=}") + if err is not None: + raise Exception(err) + + # cancel order + tx, tx_hash, err = await client.cancel_order( + market_index=0, + order_index=123, + ) + print(f"Cancel Order {tx=} {tx_hash=} {err=}") + if err is not None: + raise Exception(err) + + await client.close() + await api_client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/create_market_order.py b/docs/lighter/lighter-python-main/examples/create_market_order.py new file mode 100644 index 0000000..069d2db --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/create_market_order.py @@ -0,0 +1,39 @@ +import asyncio +import logging +import lighter + +logging.basicConfig(level=logging.DEBUG) + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and serves as an example. +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 +API_KEY_INDEX = 3 + + +def trim_exception(e: Exception) -> str: + return str(e).strip().split("\n")[-1] + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + + tx = await client.create_market_order( + market_index=0, + client_order_index=0, + base_amount=1000, # 0.1 ETH + avg_execution_price=170000, # $1700 -- worst acceptable price for the order + is_ask=True, + ) + print("Create Order Tx:", tx) + await client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/create_market_order_max_slippage.py b/docs/lighter/lighter-python-main/examples/create_market_order_max_slippage.py new file mode 100644 index 0000000..f219a22 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/create_market_order_max_slippage.py @@ -0,0 +1,36 @@ +import asyncio +import logging +import lighter + +logging.basicConfig(level=logging.DEBUG) + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and serves as an example. +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = "0xe0fa55e11d6b5575d54c0500bd2f3b240221ae90241e3b573f2307e27de20c04ea628de3f1936e56" +ACCOUNT_INDEX = 22 +API_KEY_INDEX = 3 + + +def trim_exception(e: Exception) -> str: + return str(e).strip().split("\n")[-1] + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + + # tx = await client.create_market_order_limited_slippage(market_index=0, client_order_index=0, base_amount=30000000, + # max_slippage=0.001, is_ask=True) + tx = await client.create_market_order_if_slippage(market_index=0, client_order_index=0, base_amount=30000000, + max_slippage=0.01, is_ask=True, ideal_price=300000) + print("Create Order Tx:", tx) + await client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/create_sl_tp.py b/docs/lighter/lighter-python-main/examples/create_sl_tp.py new file mode 100644 index 0000000..a6b4b6d --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/create_sl_tp.py @@ -0,0 +1,70 @@ +import asyncio +import logging +import lighter + +logging.basicConfig(level=logging.DEBUG) + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and servers as an example. +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = "0xe0fa55e11d6b5575d54c0500bd2f3b240221ae90241e3b573f2307e27de20c04ea628de3f1936e56" +ACCOUNT_INDEX = 22 +API_KEY_INDEX = 3 + + +def trim_exception(e: Exception) -> str: + return str(e).strip().split("\n")[-1] + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + + tx = await client.create_tp_order( + market_index=0, + client_order_index=0, + base_amount=1000, # 0.1 ETH + trigger_price=500000, + price=500000, + is_ask=False + ) + print("Create Order Tx:", tx) + + + tx = await client.create_sl_order( + market_index=0, + client_order_index=0, + base_amount=1000, # 0.1 ETH + trigger_price=500000, + price=500000, + is_ask=False + ) + print("Create Order Tx:", tx) + + tx = await client.create_tp_limit_order( + market_index=0, + client_order_index=0, + base_amount=1000, # 0.1 ETH + trigger_price=500000, + price=500000, + is_ask=False + ) + + tx = await client.create_sl_limit_order( + market_index=0, + client_order_index=0, + base_amount=1000, # 0.1 ETH + trigger_price=500000, + price=500000, + is_ask=False + ) + print("Create Order Tx:", tx) + await client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/create_with_multiple_keys.py b/docs/lighter/lighter-python-main/examples/create_with_multiple_keys.py new file mode 100644 index 0000000..45c874c --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/create_with_multiple_keys.py @@ -0,0 +1,48 @@ +import asyncio +import lighter + + +BASE_URL = "https://testnet.zklighter.elliot.ai" +# use examples/system_setup.py or the apikeys page (for mainnet) to generate new api keys +KEYS = { + 5: "API_PRIVATE_KEY_5", + 6: "API_PRIVATE_KEY_6", + 7: "API_PRIVATE_KEY_7", +} +ACCOUNT_INDEX = 100 # replace with your account_index + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=KEYS[5], + account_index=ACCOUNT_INDEX, + api_key_index=5, + max_api_key_index=7, + private_keys=KEYS, + ) + + err = client.check_client() + if err is not None: + print(f"CheckClient error: {err}") + return + + for i in range(20): + res_tuple = await client.create_order( + market_index=0, + client_order_index=123 + i, + base_amount=100000 + i, + price=385000 + i, + is_ask=True, + order_type=lighter.SignerClient.ORDER_TYPE_LIMIT, + time_in_force=lighter.SignerClient.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=0, + trigger_price=0, + ) + print(res_tuple) + + await client.cancel_all_orders(time_in_force=client.CANCEL_ALL_TIF_IMMEDIATE, time=0) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/get_info.py b/docs/lighter/lighter-python-main/examples/get_info.py new file mode 100644 index 0000000..30187b0 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/get_info.py @@ -0,0 +1,91 @@ +import asyncio +import datetime +import lighter +import logging + +logging.basicConfig(level=logging.INFO) + + +# The address provided belongs to a dummy account registered on Testnet. +L1_ADDRESS = "0x8D7f03FdE1A626223364E592740a233b72395235" +ACCOUNT_INDEX = 65 + + +async def print_api(method, *args, **kwargs): + logging.info(f"{method.__name__}: {await method(*args, **kwargs)}") + + +async def account_apis(client: lighter.ApiClient): + logging.info("ACCOUNT APIS") + account_instance = lighter.AccountApi(client) + await print_api(account_instance.account, by="l1_address", value=L1_ADDRESS) + await print_api(account_instance.account, by="index", value=str(ACCOUNT_INDEX)) + await print_api(account_instance.accounts_by_l1_address, l1_address=L1_ADDRESS) + await print_api(account_instance.apikeys, account_index=ACCOUNT_INDEX, api_key_index=1) + await print_api(account_instance.public_pools, filter="all", limit=1, index=0) + + +async def block_apis(client: lighter.ApiClient): + logging.info("BLOCK APIS") + block_instance = lighter.BlockApi(client) + await print_api(block_instance.block, by="height", value="1") + await print_api(block_instance.blocks, index=0, limit=2, sort="asc") + await print_api(block_instance.current_height) + + +async def candlestick_apis(client: lighter.ApiClient): + logging.info("CANDLESTICK APIS") + candlestick_instance = lighter.CandlestickApi(client) + await print_api( + candlestick_instance.candlesticks, + market_id=0, + resolution="1h", + start_timestamp=int(datetime.datetime.now().timestamp() - 60 * 60 * 24), + end_timestamp=int(datetime.datetime.now().timestamp()), + count_back=2, + ) + await print_api( + candlestick_instance.fundings, + market_id=0, + resolution="1h", + start_timestamp=int(datetime.datetime.now().timestamp() - 60 * 60 * 24), + end_timestamp=int(datetime.datetime.now().timestamp()), + count_back=2, + ) + + +async def order_apis(client: lighter.ApiClient): + logging.info("ORDER APIS") + order_instance = lighter.OrderApi(client) + await print_api(order_instance.exchange_stats) + await print_api(order_instance.order_book_details, market_id=0) + await print_api(order_instance.order_books) + await print_api(order_instance.recent_trades, market_id=0, limit=2) + + +async def transaction_apis(client: lighter.ApiClient): + logging.info("TRANSACTION APIS") + transaction_instance = lighter.TransactionApi(client) + await print_api(transaction_instance.block_txs, by="block_height", value="1") + await print_api( + transaction_instance.next_nonce, + account_index=int(ACCOUNT_INDEX), + api_key_index=0, + ) + # use with a valid sequence index + # await print_api(transaction_instance.tx, by="sequence_index", value="5") + await print_api(transaction_instance.txs, index=0, limit=2) + + +async def main(): + client = lighter.ApiClient(configuration=lighter.Configuration(host="https://testnet.zklighter.elliot.ai")) + await account_apis(client) + await block_apis(client) + await candlestick_apis(client) + await order_apis(client) + await transaction_apis(client) + await client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/send_tx_batch.py b/docs/lighter/lighter-python-main/examples/send_tx_batch.py new file mode 100644 index 0000000..b6bc3e7 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/send_tx_batch.py @@ -0,0 +1,138 @@ +import asyncio +import logging +import lighter +import json + +logging.basicConfig(level=logging.DEBUG) + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and servers as an example. +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +ACCOUNT_INDEX = 65 +API_KEY_INDEX = 1 + +def trim_exception(e: Exception) -> str: + return str(e).strip().split("\n")[-1] + + +async def main(): + # Initialize configuration and clients + configuration = lighter.Configuration(BASE_URL) + api_client = lighter.ApiClient(configuration) + transaction_api = lighter.TransactionApi(api_client) + + # Initialize signer client + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX + ) + + # Check client connection + err = client.check_client() + if err is not None: + print(f"CheckClient error: {trim_exception(err)}") + return + + # use next nonce for getting nonces + next_nonce = await transaction_api.next_nonce(account_index=ACCOUNT_INDEX, api_key_index=API_KEY_INDEX) + nonce_value = next_nonce.nonce + + ask_tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1001, # Unique identifier for this order + base_amount=100000, + price=280000, + is_ask=True, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value + ) + nonce_value += 1 + + if error is not None: + print(f"Error signing first order (first batch): {trim_exception(error)}") + return + + # Sign second order + bid_tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1002, # Different unique identifier + base_amount=200000, + price=200000, + is_ask=False, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value + ) + nonce_value += 1 + + if error is not None: + print(f"Error signing second order (first batch): {trim_exception(error)}") + return + + tx_types = json.dumps([client.TX_TYPE_CREATE_ORDER, client.TX_TYPE_CREATE_ORDER]) + tx_infos = json.dumps([ask_tx_info, bid_tx_info]) + + try: + tx_hashes = await transaction_api.send_tx_batch(tx_types=tx_types, tx_infos=tx_infos) + print(f"Batch transaction successful: {tx_hashes}") + except Exception as e: + print(f"Error sending batch transaction: {trim_exception(e)}") + + # In case we want to see the changes in the UI, sleep a bit + import time + time.sleep(5) + + cancel_tx_info, error = client.sign_cancel_order( + market_index=0, + order_index=1001, # the index of the order we want cancelled + nonce=nonce_value + ) + nonce_value += 1 + + if error is not None: + print(f"Error signing first order (second batch): {trim_exception(error)}") + return + + # Sign second order + new_ask_tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1003, # Different unique identifier + base_amount=300000, + price=310000, + is_ask=True, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value + ) + nonce_value += 1 + + if error is not None: + print(f"Error signing second order (second batch): {trim_exception(error)}") + return + + tx_types = json.dumps([client.TX_TYPE_CANCEL_ORDER, client.TX_TYPE_CREATE_ORDER]) + tx_infos = json.dumps([cancel_tx_info, new_ask_tx_info]) + + try: + tx_hashes = await transaction_api.send_tx_batch(tx_types=tx_types, tx_infos=tx_infos) + print(f"Batch 2 transaction successful: {tx_hashes}") + except Exception as e: + print(f"Error sending batch transaction 2: {trim_exception(e)}") + + # Clean up + await client.close() + await api_client.close() + +# Run the async main function +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/examples/system_setup.py b/docs/lighter/lighter-python-main/examples/system_setup.py new file mode 100644 index 0000000..0896d7d --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/system_setup.py @@ -0,0 +1,86 @@ +import asyncio +import logging +import time +import eth_account +import lighter + +logging.basicConfig(level=logging.DEBUG) + +# this is a dummy private key which is registered on Testnet. +# It serves as a good example +BASE_URL = "https://testnet.zklighter.elliot.ai" +ETH_PRIVATE_KEY = "1234567812345678123456781234567812345678123456781234567812345678" +API_KEY_INDEX = 3 + + +async def main(): + # verify that the account exists & fetch account index + api_client = lighter.ApiClient(configuration=lighter.Configuration(host=BASE_URL)) + eth_acc = eth_account.Account.from_key(ETH_PRIVATE_KEY) + eth_address = eth_acc.address + + try: + response = await lighter.AccountApi(api_client).accounts_by_l1_address( + l1_address=eth_address + ) + except lighter.ApiException as e: + if e.data.message == "account not found": + print(f"error: account not found for {eth_address}") + return + else: + raise e + + if len(response.sub_accounts) > 1: + for sub_account in response.sub_accounts: + print(f"found accountIndex: {sub_account.index}") + + print("multiple accounts found, using the first one") + account_index = response.sub_accounts[0].index + else: + account_index = response.sub_accounts[0].index + + # create a private/public key pair for the new API key + # pass any string to be used as seed for create_api_key like + # create_api_key("Hello world random seed to make things more secure") + private_key, public_key, err = lighter.create_api_key() + if err is not None: + raise Exception(err) + + tx_client = lighter.SignerClient( + url=BASE_URL, + private_key=private_key, + account_index=account_index, + api_key_index=API_KEY_INDEX, + ) + + # change the API key + response, err = await tx_client.change_api_key( + eth_private_key=ETH_PRIVATE_KEY, + new_pubkey=public_key, + ) + if err is not None: + raise Exception(err) + + # wait some time so that we receive the new API key in the response + time.sleep(10) + + # check that the API key changed on the server + err = tx_client.check_client() + if err is not None: + raise Exception(err) + + print( + f""" +BASE_URL = '{BASE_URL}' +API_KEY_PRIVATE_KEY = '{private_key}' +ACCOUNT_INDEX = {account_index} +API_KEY_INDEX = {API_KEY_INDEX} + """ + ) + + await tx_client.close() + await api_client.close() + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/transfer_update_leverage.py b/docs/lighter/lighter-python-main/examples/transfer_update_leverage.py new file mode 100644 index 0000000..e5593b7 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/transfer_update_leverage.py @@ -0,0 +1,47 @@ +import asyncio +import lighter + + +from examples.secrets import BASE_URL, API_KEY_PRIVATE_KEY, ETH_PRIVATE_KEY + +API_KEY_INDEX = 10 +TO_ACCOUNT_INDEX = 9 +ACCOUNT_INDEX = 10 # replace with your account_index + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + api_client = lighter.ApiClient(configuration=lighter.Configuration(host=BASE_URL)) + info_api = lighter.InfoApi(api_client) + order_api = lighter.OrderApi(api_client) + + auth_token, _ = client.create_auth_token_with_expiry() + fee_info = await info_api.transfer_fee_info(ACCOUNT_INDEX, authorization=auth_token, auth=auth_token, to_account_index=TO_ACCOUNT_INDEX) + print(fee_info) + + err = client.check_client() + if err is not None: + print(f"CheckClient error: {err}") + return + memo = "a"*32 # memo is a user message and it has to be exactly 32 bytes long + transfer_tx, response, err = await client.transfer( + ETH_PRIVATE_KEY, + usdc_amount=100, # decimals are added by sdk + to_account_index=TO_ACCOUNT_INDEX, + fee=fee_info.transfer_fee_usdc, + memo=memo, + ) + if err != None: + raise Exception(f"error transferring {err}") + print(transfer_tx, response) + + lev_tx, response, err = await client.update_leverage(4, client.CROSS_MARGIN_MODE, 3) + print(lev_tx, response, err) + +if __name__ == "__main__": + asyncio.run(main()) \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/examples/ws.py b/docs/lighter/lighter-python-main/examples/ws.py new file mode 100644 index 0000000..8fc6445 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/ws.py @@ -0,0 +1,23 @@ +import json +import logging +import lighter + +logging.basicConfig(level=logging.INFO) + + +def on_order_book_update(market_id, order_book): + logging.info(f"Order book {market_id}:\n{json.dumps(order_book, indent=2)}") + + +def on_account_update(account_id, account): + logging.info(f"Account {account_id}:\n{json.dumps(account, indent=2)}") + + +client = lighter.WsClient( + order_book_ids=[0, 1], + account_ids=[1, 2], + on_order_book_update=on_order_book_update, + on_account_update=on_account_update, +) + +client.run() diff --git a/docs/lighter/lighter-python-main/examples/ws_async.py b/docs/lighter/lighter-python-main/examples/ws_async.py new file mode 100644 index 0000000..3262192 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/ws_async.py @@ -0,0 +1,24 @@ +import json +import logging +import asyncio +import lighter + +logging.basicConfig(level=logging.INFO) + + +def on_order_book_update(market_id, order_book): + logging.info(f"Order book {market_id}:\n{json.dumps(order_book, indent=2)}") + + +def on_account_update(account_id, account): + logging.info(f"Account {account_id}:\n{json.dumps(account, indent=2)}") + + +client = lighter.WsClient( + order_book_ids=[0, 1], + account_ids=[1, 2], + on_order_book_update=on_order_book_update, + on_account_update=on_account_update, +) + +asyncio.run(client.run_async()) diff --git a/docs/lighter/lighter-python-main/examples/ws_send_batch_tx.py b/docs/lighter/lighter-python-main/examples/ws_send_batch_tx.py new file mode 100644 index 0000000..375d8fb --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/ws_send_batch_tx.py @@ -0,0 +1,101 @@ +import lighter +import json +import websockets +import asyncio + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and servers as an example. +# Alternatively, you can go to https://app.lighter.xyz/apikeys for mainnet api keys +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = ( + "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +) +ACCOUNT_INDEX = 65 +API_KEY_INDEX = 1 + + +async def ws_flow(tx_types, tx_infos): + async with websockets.connect(f"{BASE_URL.replace('https', 'wss')}/stream") as ws: + msg = await ws.recv() + print("Received:", msg) + + await ws.send( + json.dumps( + { + "type": "jsonapi/sendtxbatch", + "data": { + "id": f"my_random_batch_id_{12345678}", # optional, helps id the response + "tx_types": json.dumps(tx_types), + "tx_infos": json.dumps(tx_infos), + }, + } + ) + ) + + print("Response:", await ws.recv()) + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + configuration = lighter.Configuration(BASE_URL) + api_client = lighter.ApiClient(configuration) + transaction_api = lighter.TransactionApi(api_client) + + # use next nonce for getting nonces + next_nonce = await transaction_api.next_nonce( + account_index=ACCOUNT_INDEX, api_key_index=API_KEY_INDEX + ) + nonce_value = next_nonce.nonce + + ask_tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1001, # Unique identifier for this order + base_amount=100000, + price=280000, + is_ask=True, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value, + ) + nonce_value += 1 + + if error is not None: + print(f"Error signing first order (first batch): {error}") + return + + # Sign second order + bid_tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1002, # Different unique identifier + base_amount=200000, + price=200000, + is_ask=False, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value, + ) + + if error is not None: + print(f"Error signing second order (first batch): {error}") + return + + tx_types = [ + lighter.SignerClient.TX_TYPE_CREATE_ORDER, + lighter.SignerClient.TX_TYPE_CREATE_ORDER, + ] + tx_infos = [ask_tx_info, bid_tx_info] + + await ws_flow(tx_types, tx_infos) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/examples/ws_send_tx.py b/docs/lighter/lighter-python-main/examples/ws_send_tx.py new file mode 100644 index 0000000..c120b83 --- /dev/null +++ b/docs/lighter/lighter-python-main/examples/ws_send_tx.py @@ -0,0 +1,74 @@ +import lighter +import json +import websockets +import asyncio + +# The API_KEY_PRIVATE_KEY provided belongs to a dummy account registered on Testnet. +# It was generated using the setup_system.py script, and servers as an example. +# Alternatively, you can go to https://app.lighter.xyz/apikeys for mainnet api keys +BASE_URL = "https://testnet.zklighter.elliot.ai" +API_KEY_PRIVATE_KEY = ( + "0xed636277f3753b6c0275f7a28c2678a7f3a95655e09deaebec15179b50c5da7f903152e50f594f7b" +) +ACCOUNT_INDEX = 65 +API_KEY_INDEX = 3 + + +async def ws_flow(tx_type, tx_info): + async with websockets.connect(f"{BASE_URL.replace('https', 'wss')}/stream") as ws: + msg = await ws.recv() + print("Received:", msg) + + await ws.send( + json.dumps( + { + "type": "jsonapi/sendtx", + "data": { + "id": f"my_random_id_{12345678}", # optional, helps id the response + "tx_type": tx_type, + "tx_info": json.loads(tx_info), + }, + } + ) + ) + + print("Response:", await ws.recv()) + + +async def main(): + client = lighter.SignerClient( + url=BASE_URL, + private_key=API_KEY_PRIVATE_KEY, + account_index=ACCOUNT_INDEX, + api_key_index=API_KEY_INDEX, + ) + configuration = lighter.Configuration(BASE_URL) + api_client = lighter.ApiClient(configuration) + transaction_api = lighter.TransactionApi(api_client) + + next_nonce = await transaction_api.next_nonce( + account_index=ACCOUNT_INDEX, api_key_index=API_KEY_INDEX + ) + nonce_value = next_nonce.nonce + + tx_info, error = client.sign_create_order( + market_index=0, + client_order_index=1002, # Different unique identifier + base_amount=200000, + price=200000, + is_ask=False, + order_type=client.ORDER_TYPE_LIMIT, + time_in_force=client.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only=False, + trigger_price=0, + nonce=nonce_value, + ) + if error is not None: + print(f"Error signing order: {error}") + return + + await ws_flow(lighter.SignerClient.TX_TYPE_CREATE_ORDER, tx_info) + + +if __name__ == "__main__": + asyncio.run(main()) diff --git a/docs/lighter/lighter-python-main/git_push.sh b/docs/lighter/lighter-python-main/git_push.sh new file mode 100644 index 0000000..f53a75d --- /dev/null +++ b/docs/lighter/lighter-python-main/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/docs/lighter/lighter-python-main/lighter/__init__.py b/docs/lighter/lighter-python-main/lighter/__init__.py new file mode 100644 index 0000000..a0af3c2 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/__init__.py @@ -0,0 +1,174 @@ +# coding: utf-8 + +# flake8: noqa + +""" + zkLighter API + + Public APIs for Lighter + + The version of the OpenAPI document: 1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +__version__ = "1.0.0" + +# import apis into sdk 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 +from lighter.api.info_api import InfoApi +from lighter.api.notification_api import NotificationApi +from lighter.api.order_api import OrderApi +from lighter.api.referral_api import ReferralApi +from lighter.api.root_api import RootApi +from lighter.api.transaction_api import 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 + +# import models into sdk package +from lighter.models.account import Account +from lighter.models.account_api_keys import AccountApiKeys +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.block import Block +from lighter.models.blocks import Blocks +from lighter.models.bridge_supported_network import BridgeSupportedNetwork +from lighter.models.candlestick import Candlestick +from lighter.models.candlesticks import Candlesticks +from lighter.models.contract_address import ContractAddress +from lighter.models.current_height import CurrentHeight +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_stats import ExchangeStats +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.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_info import MarketInfo +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_detail import OrderBookDetail +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.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 import PublicPool +from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_metadata import PublicPoolMetadata +from lighter.models.public_pool_share import PublicPoolShare +from lighter.models.public_pools import PublicPools +from lighter.models.referral_point_entry import ReferralPointEntry +from lighter.models.referral_points import ReferralPoints +from lighter.models.req_export_data import ReqExportData +from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders +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_block import ReqGetBlock +from lighter.models.req_get_block_txs import ReqGetBlockTxs +from lighter.models.req_get_by_account import ReqGetByAccount +from lighter.models.req_get_candlesticks import ReqGetCandlesticks +from lighter.models.req_get_deposit_history import ReqGetDepositHistory +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_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 import ReqGetPublicPools +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable +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_withdraw_history import ReqGetWithdrawHistory +from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.models.resp_send_tx import RespSendTx +from lighter.models.resp_send_tx_batch import RespSendTxBatch +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay +from lighter.models.result_code import ResultCode +from lighter.models.risk_info import RiskInfo +from lighter.models.risk_parameters import RiskParameters +from lighter.models.share_price import SharePrice +from lighter.models.simple_order import SimpleOrder +from lighter.models.status import Status +from lighter.models.sub_accounts import SubAccounts +from lighter.models.ticker import Ticker +from lighter.models.trade import Trade +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.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.ws_client import WsClient +from lighter.signer_client import SignerClient, create_api_key \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/lighter/api/__init__.py b/docs/lighter/lighter-python-main/lighter/api/__init__.py new file mode 100644 index 0000000..a238373 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/__init__.py @@ -0,0 +1,16 @@ +# flake8: noqa + +# 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 +from lighter.api.info_api import InfoApi +from lighter.api.notification_api import NotificationApi +from lighter.api.order_api import OrderApi +from lighter.api.referral_api import ReferralApi +from lighter.api.root_api import RootApi +from lighter.api.transaction_api import TransactionApi + diff --git a/docs/lighter/lighter-python-main/lighter/api/account_api.py b/docs/lighter/lighter-python-main/lighter/api/account_api.py new file mode 100644 index 0000000..c92f6dc --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/account_api.py @@ -0,0 +1,3892 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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_extensions import Annotated +from lighter.models.account_api_keys import AccountApiKeys +from lighter.models.account_limits import AccountLimits +from lighter.models.account_metadatas import AccountMetadatas +from lighter.models.account_pn_l import AccountPnL +from lighter.models.detailed_accounts import DetailedAccounts +from lighter.models.l1_metadata import L1Metadata +from lighter.models.liquidation_infos import LiquidationInfos +from lighter.models.position_fundings import PositionFundings +from lighter.models.public_pools import PublicPools +from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.models.sub_accounts import SubAccounts + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class AccountApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def account( + self, + by: StrictStr, + value: 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, + ) -> 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. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DetailedAccounts", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_with_http_info( + self, + by: StrictStr, + value: 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[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. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DetailedAccounts", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_without_preload_content( + self, + by: StrictStr, + value: 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: + """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. + + :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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "DetailedAccounts", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_serialize( + self, + by, + value, + _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 by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + # 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/account', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def account_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, + _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, + ) -> AccountLimits: + """accountLimits + + Get account limits + + :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._account_limits_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': "AccountLimits", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_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, + _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[AccountLimits]: + """accountLimits + + Get account limits + + :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._account_limits_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': "AccountLimits", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_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, + _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: + """accountLimits + + Get account limits + + :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._account_limits_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': "AccountLimits", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_limits_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]] = {} + _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 auth is not None: + + _query_params.append(('auth', auth)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountLimits', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def account_metadata( + self, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: 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, + ) -> AccountMetadatas: + """accountMetadata + + Get account metadatas + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_metadata_serialize( + by=by, + value=value, + 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': "AccountMetadatas", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_metadata_with_http_info( + self, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: 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[AccountMetadatas]: + """accountMetadata + + Get account metadatas + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_metadata_serialize( + by=by, + value=value, + 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': "AccountMetadatas", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_metadata_without_preload_content( + self, + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + auth: 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: + """accountMetadata + + Get account metadatas + + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_metadata_serialize( + by=by, + value=value, + 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': "AccountMetadatas", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_metadata_serialize( + self, + by, + value, + authorization, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountMetadata', + 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 accounts_by_l1_address( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> SubAccounts: + """accountsByL1Address + + Get accounts by l1_address returns all accounts associated with the given L1 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 + (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._accounts_by_l1_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SubAccounts", + '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 accounts_by_l1_address_with_http_info( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[SubAccounts]: + """accountsByL1Address + + Get accounts by l1_address returns all accounts associated with the given L1 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 + (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._accounts_by_l1_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SubAccounts", + '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 accounts_by_l1_address_without_preload_content( + self, + l1_address: StrictStr, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """accountsByL1Address + + Get accounts by l1_address returns all accounts associated with the given L1 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 + (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._accounts_by_l1_address_serialize( + l1_address=l1_address, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "SubAccounts", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _accounts_by_l1_address_serialize( + self, + l1_address, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if l1_address is not None: + + _query_params.append(('l1_address', l1_address)) + + # process the header parameters + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountsByL1Address', + 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 apikeys( + self, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> AccountApiKeys: + """apikeys + + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + + :param account_index: (required) + :type account_index: int + :param api_key_index: + :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._apikeys_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': "AccountApiKeys", + '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 apikeys_with_http_info( + self, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[AccountApiKeys]: + """apikeys + + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + + :param account_index: (required) + :type account_index: int + :param api_key_index: + :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._apikeys_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': "AccountApiKeys", + '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 apikeys_without_preload_content( + self, + account_index: StrictInt, + api_key_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """apikeys + + Get account api key. Set `api_key_index` to 255 to retrieve all api keys associated with the account. + + :param account_index: (required) + :type account_index: int + :param api_key_index: + :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._apikeys_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': "AccountApiKeys", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _apikeys_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]] = {} + _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/apikeys', + 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 change_account_tier( + self, + account_index: StrictInt, + new_tier: 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, + ) -> RespChangeAccountTier: + """changeAccountTier + + Change account tier + + :param account_index: (required) + :type account_index: int + :param new_tier: (required) + :type new_tier: 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._change_account_tier_serialize( + account_index=account_index, + new_tier=new_tier, + 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': "RespChangeAccountTier", + '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 change_account_tier_with_http_info( + self, + account_index: StrictInt, + new_tier: 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[RespChangeAccountTier]: + """changeAccountTier + + Change account tier + + :param account_index: (required) + :type account_index: int + :param new_tier: (required) + :type new_tier: 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._change_account_tier_serialize( + account_index=account_index, + new_tier=new_tier, + 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': "RespChangeAccountTier", + '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 change_account_tier_without_preload_content( + self, + account_index: StrictInt, + new_tier: 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: + """changeAccountTier + + Change account tier + + :param account_index: (required) + :type account_index: int + :param new_tier: (required) + :type new_tier: 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._change_account_tier_serialize( + account_index=account_index, + new_tier=new_tier, + 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': "RespChangeAccountTier", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _change_account_tier_serialize( + self, + account_index, + new_tier, + authorization, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + # 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_tier is not None: + _form_params.append(('new_tier', new_tier)) + # 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( + [ + '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/changeAccountTier', + 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 l1_metadata( + 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)], + 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, + ) -> L1Metadata: + """l1Metadata + + Get L1 metadata + + :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 + (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._l1_metadata_serialize( + l1_address=l1_address, + 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': "L1Metadata", + '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 l1_metadata_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)], + 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[L1Metadata]: + """l1Metadata + + Get L1 metadata + + :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 + (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._l1_metadata_serialize( + l1_address=l1_address, + 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': "L1Metadata", + '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 l1_metadata_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)], + 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: + """l1Metadata + + Get L1 metadata + + :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 + (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._l1_metadata_serialize( + l1_address=l1_address, + 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': "L1Metadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _l1_metadata_serialize( + self, + l1_address, + authorization, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if 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 + + + # 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/l1Metadata', + 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 liquidations( + 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, + _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, + ) -> LiquidationInfos: + """liquidations + + Get liquidation infos + + :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 _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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '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 liquidations_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, + _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[LiquidationInfos]: + """liquidations + + Get liquidation infos + + :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 _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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '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 liquidations_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, + _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: + """liquidations + + Get liquidation infos + + :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 _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._liquidations_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "LiquidationInfos", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _liquidations_serialize( + self, + account_index, + limit, + authorization, + auth, + market_id, + cursor, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if 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 + # 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/liquidations', + 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 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, + auth: 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, + ) -> 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 auth: + :type auth: 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, + auth=auth, + 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, + ).data + + + @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, + auth: 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 auth: + :type auth: 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, + auth=auth, + 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, + auth: 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, + ) -> 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 auth: + :type auth: 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, + auth=auth, + 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, + auth, + 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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + 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: + + _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' + ] + ) + + + # 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, + auth: 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 auth: + :type auth: 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, + auth=auth, + 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, + auth: 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 accounts position fundings + + :param account_index: (required) + :type account_index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: 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, + auth=auth, + 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, + ) + + + @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, + auth: 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, + ) -> RESTResponseType: + """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 auth: + :type auth: 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, + auth=auth, + 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 + ) + return response_data.response + + + def _position_funding_serialize( + self, + account_index, + limit, + authorization, + auth, + market_id, + cursor, + side, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if 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)) + + # 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/positionFunding', + 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 public_pools( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> PublicPools: + """publicPools + + Get public pools + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PublicPools", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def public_pools_with_http_info( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[PublicPools]: + """publicPools + + Get public pools + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PublicPools", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def public_pools_without_preload_content( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """publicPools + + Get public pools + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "PublicPools", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _public_pools_serialize( + self, + index, + limit, + authorization, + auth, + filter, + account_index, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if filter is not None: + + _query_params.append(('filter', filter)) + + if index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/publicPools', + 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 public_pools_metadata( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RespPublicPoolsMetadata: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def public_pools_metadata_with_http_info( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[RespPublicPoolsMetadata]: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def public_pools_metadata_without_preload_content( + self, + index: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + filter: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """publicPoolsMetadata + + Get public pools metadata + + :param index: (required) + :type index: int + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param filter: + :type filter: str + :param account_index: + :type account_index: int + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._public_pools_metadata_serialize( + index=index, + limit=limit, + authorization=authorization, + auth=auth, + filter=filter, + account_index=account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespPublicPoolsMetadata", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _public_pools_metadata_serialize( + self, + index, + limit, + authorization, + auth, + filter, + account_index, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if filter is not None: + + _query_params.append(('filter', filter)) + + if index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/publicPoolsMetadata', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/announcement_api.py b/docs/lighter/lighter-python-main/lighter/api/announcement_api.py new file mode 100644 index 0000000..7eaa982 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/announcement_api.py @@ -0,0 +1,282 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 lighter.models.announcements import Announcements + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class AnnouncementApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def announcement( + 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, + ) -> Announcements: + """announcement + + Get announcement + + :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._announcement_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Announcements", + '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 announcement_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[Announcements]: + """announcement + + Get announcement + + :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._announcement_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Announcements", + '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 announcement_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: + """announcement + + Get announcement + + :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._announcement_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Announcements", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _announcement_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]] = {} + _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/announcement', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/block_api.py b/docs/lighter/lighter-python-main/lighter/api/block_api.py new file mode 100644 index 0000000..e09888a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/block_api.py @@ -0,0 +1,863 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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, field_validator +from typing import Optional +from typing_extensions import Annotated +from lighter.models.blocks import Blocks +from lighter.models.current_height import CurrentHeight + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class BlockApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def block( + self, + by: StrictStr, + value: 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, + ) -> Blocks: + """block + + Get block by its height or commitment + + :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 + (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._block_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '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 block_with_http_info( + self, + by: StrictStr, + value: 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[Blocks]: + """block + + Get block by its height or commitment + + :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 + (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._block_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '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 block_without_preload_content( + self, + by: StrictStr, + value: 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: + """block + + Get block by its height or commitment + + :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 + (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._block_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _block_serialize( + self, + by, + value, + _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 by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + # 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/block', + 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 blocks( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + sort: 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, + ) -> Blocks: + """blocks + + Get blocks + + :param limit: (required) + :type limit: int + :param index: + :type index: int + :param sort: + :type sort: 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._blocks_serialize( + limit=limit, + index=index, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '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 blocks_with_http_info( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + sort: 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[Blocks]: + """blocks + + Get blocks + + :param limit: (required) + :type limit: int + :param index: + :type index: int + :param sort: + :type sort: 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._blocks_serialize( + limit=limit, + index=index, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '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 blocks_without_preload_content( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + sort: 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: + """blocks + + Get blocks + + :param limit: (required) + :type limit: int + :param index: + :type index: int + :param sort: + :type sort: 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._blocks_serialize( + limit=limit, + index=index, + sort=sort, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Blocks", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _blocks_serialize( + self, + limit, + index, + sort, + _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 index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if sort is not None: + + _query_params.append(('sort', sort)) + + # 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/blocks', + 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 current_height( + 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, + ) -> CurrentHeight: + """currentHeight + + Get current height + + :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._current_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CurrentHeight", + '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 current_height_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[CurrentHeight]: + """currentHeight + + Get current height + + :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._current_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CurrentHeight", + '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 current_height_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: + """currentHeight + + Get current height + + :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._current_height_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "CurrentHeight", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _current_height_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]] = {} + _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/currentHeight', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/bridge_api.py b/docs/lighter/lighter-python-main/lighter/api/bridge_api.py new file mode 100644 index 0000000..f9d7851 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/bridge_api.py @@ -0,0 +1,282 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class BridgeApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def fastbridge_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, + ) -> RespGetFastBridgeInfo: + """fastbridge_info + + Get fast bridge 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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '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 fastbridge_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[RespGetFastBridgeInfo]: + """fastbridge_info + + Get fast bridge 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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '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 fastbridge_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: + """fastbridge_info + + Get fast bridge 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._fastbridge_info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespGetFastBridgeInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fastbridge_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]] = {} + _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/fastbridge/info', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/candlestick_api.py b/docs/lighter/lighter-python-main/lighter/api/candlestick_api.py new file mode 100644 index 0000000..c964c30 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/candlestick_api.py @@ -0,0 +1,719 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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_extensions import Annotated +from lighter.models.candlesticks import Candlesticks +from lighter.models.fundings import Fundings + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class CandlestickApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def candlesticks( + self, + market_id: StrictInt, + 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, + set_timestamp_to_end: 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, + ) -> Candlesticks: + """candlesticks + + Get candlesticks + + :param market_id: (required) + :type market_id: int + :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 set_timestamp_to_end: + :type set_timestamp_to_end: 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._candlesticks_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + set_timestamp_to_end=set_timestamp_to_end, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Candlesticks", + '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 candlesticks_with_http_info( + self, + market_id: StrictInt, + 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, + set_timestamp_to_end: 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[Candlesticks]: + """candlesticks + + Get candlesticks + + :param market_id: (required) + :type market_id: int + :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 set_timestamp_to_end: + :type set_timestamp_to_end: 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._candlesticks_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + set_timestamp_to_end=set_timestamp_to_end, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Candlesticks", + '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 candlesticks_without_preload_content( + self, + market_id: StrictInt, + 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, + set_timestamp_to_end: 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: + """candlesticks + + Get candlesticks + + :param market_id: (required) + :type market_id: int + :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 set_timestamp_to_end: + :type set_timestamp_to_end: 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._candlesticks_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + set_timestamp_to_end=set_timestamp_to_end, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Candlesticks", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _candlesticks_serialize( + self, + market_id, + resolution, + start_timestamp, + end_timestamp, + count_back, + set_timestamp_to_end, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + 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 set_timestamp_to_end is not None: + + _query_params.append(('set_timestamp_to_end', set_timestamp_to_end)) + + # 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/candlesticks', + 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 fundings( + self, + market_id: StrictInt, + 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, + _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, + ) -> Fundings: + """fundings + + Get fundings + + :param market_id: (required) + :type market_id: int + :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 _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._fundings_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Fundings", + '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 fundings_with_http_info( + self, + market_id: StrictInt, + 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, + _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[Fundings]: + """fundings + + Get fundings + + :param market_id: (required) + :type market_id: int + :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 _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._fundings_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Fundings", + '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 fundings_without_preload_content( + self, + market_id: StrictInt, + 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, + _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: + """fundings + + Get fundings + + :param market_id: (required) + :type market_id: int + :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 _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._fundings_serialize( + market_id=market_id, + resolution=resolution, + start_timestamp=start_timestamp, + end_timestamp=end_timestamp, + count_back=count_back, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Fundings", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _fundings_serialize( + self, + market_id, + resolution, + start_timestamp, + end_timestamp, + count_back, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + 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)) + + # 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/fundings', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/funding_api.py b/docs/lighter/lighter-python-main/lighter/api/funding_api.py new file mode 100644 index 0000000..5bcc028 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/funding_api.py @@ -0,0 +1,282 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 lighter.models.funding_rates import FundingRates + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class FundingApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def funding_rates( + 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, + ) -> FundingRates: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '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 funding_rates_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[FundingRates]: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '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 funding_rates_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: + """funding-rates + + Get funding rates + + :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._funding_rates_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "FundingRates", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _funding_rates_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]] = {} + _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/funding-rates', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/info_api.py b/docs/lighter/lighter-python-main/lighter/api/info_api.py new file mode 100644 index 0000000..9e2591a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/info_api.py @@ -0,0 +1,597 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 StrictInt, StrictStr +from typing import Optional +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay +from lighter.models.transfer_fee_info import TransferFeeInfo + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class InfoApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def transfer_fee_info( + self, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + to_account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> TransferFeeInfo: + """transferFeeInfo + + Transfer fee info + + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param to_account_index: + :type to_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._transfer_fee_info_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + to_account_index=to_account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferFeeInfo", + '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 transfer_fee_info_with_http_info( + self, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + to_account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[TransferFeeInfo]: + """transferFeeInfo + + Transfer fee info + + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param to_account_index: + :type to_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._transfer_fee_info_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + to_account_index=to_account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferFeeInfo", + '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 transfer_fee_info_without_preload_content( + self, + account_index: StrictInt, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + to_account_index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """transferFeeInfo + + Transfer fee info + + :param account_index: (required) + :type account_index: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param to_account_index: + :type to_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._transfer_fee_info_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + to_account_index=to_account_index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferFeeInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _transfer_fee_info_serialize( + self, + account_index, + authorization, + auth, + to_account_index, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if to_account_index is not None: + + _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 + + + # 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/transferFeeInfo', + 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 withdrawal_delay( + 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, + ) -> RespWithdrawalDelay: + """withdrawalDelay + + Withdrawal delay in seconds + + :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._withdrawal_delay_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespWithdrawalDelay", + '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 withdrawal_delay_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[RespWithdrawalDelay]: + """withdrawalDelay + + Withdrawal delay in seconds + + :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._withdrawal_delay_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespWithdrawalDelay", + '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 withdrawal_delay_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: + """withdrawalDelay + + Withdrawal delay in seconds + + :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._withdrawal_delay_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "RespWithdrawalDelay", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _withdrawal_delay_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]] = {} + _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/withdrawalDelay', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/notification_api.py b/docs/lighter/lighter-python-main/lighter/api/notification_api.py new file mode 100644 index 0000000..a3c2477 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/notification_api.py @@ -0,0 +1,358 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 typing import Optional +from typing_extensions import Annotated +from lighter.models.result_code import ResultCode + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class NotificationApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def notification_ack( + self, + notif_id: 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)], + 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: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: 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 + (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._notification_ack_serialize( + notif_id=notif_id, + 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': "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 notification_ack_with_http_info( + self, + notif_id: 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)], + 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]: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: 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 + (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._notification_ack_serialize( + notif_id=notif_id, + 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': "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 notification_ack_without_preload_content( + self, + notif_id: 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)], + 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: + """notification_ack + + Ack notification + + :param notif_id: (required) + :type notif_id: 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 + (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._notification_ack_serialize( + notif_id=notif_id, + 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': "ResultCode", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _notification_ack_serialize( + self, + notif_id, + 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]] = {} + _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 notif_id is not None: + _form_params.append(('notif_id', notif_id)) + 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 + + + # 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( + [ + '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/notification/ack', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/order_api.py b/docs/lighter/lighter-python-main/lighter/api/order_api.py new file mode 100644 index 0000000..6b89d83 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/order_api.py @@ -0,0 +1,2829 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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, field_validator +from typing import Optional +from typing_extensions import Annotated +from lighter.models.exchange_stats import ExchangeStats +from lighter.models.export_data import ExportData +from lighter.models.order_book_details import OrderBookDetails +from lighter.models.order_book_orders import OrderBookOrders +from lighter.models.order_books import OrderBooks +from lighter.models.orders import Orders +from lighter.models.trades import Trades + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class OrderApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def account_active_orders( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Orders: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_active_orders_with_http_info( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Orders]: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_active_orders_without_preload_content( + self, + account_index: StrictInt, + market_id: StrictInt, + authorization: Annotated[Optional[StrictStr], Field(description=" make required after integ is done")] = None, + auth: Annotated[Optional[StrictStr], Field(description=" made optional to support header auth clients")] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """accountActiveOrders + + Get account active orders. `auth` can be generated using the SDK. + + :param account_index: (required) + :type account_index: int + :param market_id: (required) + :type market_id: int + :param authorization: make required after integ is done + :type authorization: str + :param auth: made optional to support header auth clients + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_active_orders_serialize( + account_index=account_index, + market_id=market_id, + authorization=authorization, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_active_orders_serialize( + self, + account_index, + market_id, + authorization, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if market_id is not None: + + _query_params.append(('market_id', market_id)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountActiveOrders', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + + + + @validate_call + async def account_inactive_orders( + self, + 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, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Orders: + """accountInactiveOrders + + Get account inactive orders + + :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: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_inactive_orders_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_inactive_orders_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, + ask_filter: Optional[StrictInt] = None, + between_timestamps: Optional[StrictStr] = None, + cursor: 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[Orders]: + """accountInactiveOrders + + Get account inactive orders + + :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: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_inactive_orders_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_inactive_orders_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, + ask_filter: Optional[StrictInt] = None, + between_timestamps: Optional[StrictStr] = None, + cursor: 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: + """accountInactiveOrders + + Get account inactive orders + + :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: + :type ask_filter: int + :param between_timestamps: + :type between_timestamps: 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 + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_inactive_orders_serialize( + account_index=account_index, + limit=limit, + authorization=authorization, + auth=auth, + market_id=market_id, + ask_filter=ask_filter, + between_timestamps=between_timestamps, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Orders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_inactive_orders_serialize( + self, + account_index, + limit, + authorization, + auth, + market_id, + ask_filter, + between_timestamps, + cursor, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if 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 ask_filter is not None: + + _query_params.append(('ask_filter', ask_filter)) + + if between_timestamps is not None: + + _query_params.append(('between_timestamps', between_timestamps)) + + 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 + # 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/accountInactiveOrders', + 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 exchange_stats( + 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, + ) -> ExchangeStats: + """exchangeStats + + Get exchange stats + + :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._exchange_stats_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExchangeStats", + '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 exchange_stats_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[ExchangeStats]: + """exchangeStats + + Get exchange stats + + :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._exchange_stats_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExchangeStats", + '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 exchange_stats_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: + """exchangeStats + + Get exchange stats + + :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._exchange_stats_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExchangeStats", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _exchange_stats_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]] = {} + _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/exchangeStats', + 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 export( + self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ExportData: + """export + + Export data + + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int + :param market_id: + :type market_id: 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._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExportData", + '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 export_with_http_info( + self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[ExportData]: + """export + + Export data + + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int + :param market_id: + :type market_id: 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._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExportData", + '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 export_without_preload_content( + self, + type: StrictStr, + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + account_index: Optional[StrictInt] = None, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """export + + Export data + + :param type: (required) + :type type: str + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param account_index: + :type account_index: int + :param market_id: + :type market_id: 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._export_serialize( + type=type, + authorization=authorization, + auth=auth, + account_index=account_index, + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ExportData", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _export_serialize( + self, + type, + authorization, + auth, + account_index, + market_id, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if 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 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 + # 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/export', + 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 order_book_details( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrderBookDetails: + """orderBookDetails + + Get order books metadata + + :param market_id: + :type market_id: 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._order_book_details_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookDetails", + '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 order_book_details_with_http_info( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrderBookDetails]: + """orderBookDetails + + Get order books metadata + + :param market_id: + :type market_id: 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._order_book_details_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookDetails", + '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 order_book_details_without_preload_content( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """orderBookDetails + + Get order books metadata + + :param market_id: + :type market_id: 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._order_book_details_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookDetails", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _order_book_details_serialize( + self, + market_id, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + # 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/orderBookDetails', + 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 order_book_orders( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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, + ) -> OrderBookOrders: + """orderBookOrders + + Get order book orders + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._order_book_orders_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookOrders", + '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 order_book_orders_with_http_info( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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[OrderBookOrders]: + """orderBookOrders + + Get order book orders + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._order_book_orders_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookOrders", + '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 order_book_orders_without_preload_content( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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: + """orderBookOrders + + Get order book orders + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._order_book_orders_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBookOrders", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _order_book_orders_serialize( + self, + market_id, + limit, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # 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/orderBookOrders', + 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 order_books( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> OrderBooks: + """orderBooks + + 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. + + :param market_id: + :type market_id: 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._order_books_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBooks", + '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 order_books_with_http_info( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[OrderBooks]: + """orderBooks + + 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. + + :param market_id: + :type market_id: 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._order_books_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBooks", + '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 order_books_without_preload_content( + self, + market_id: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """orderBooks + + 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. + + :param market_id: + :type market_id: 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._order_books_serialize( + market_id=market_id, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "OrderBooks", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _order_books_serialize( + self, + market_id, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + # 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/orderBooks', + 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 recent_trades( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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, + ) -> Trades: + """recentTrades + + Get recent trades + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._recent_trades_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '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 recent_trades_with_http_info( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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[Trades]: + """recentTrades + + Get recent trades + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._recent_trades_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '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 recent_trades_without_preload_content( + self, + market_id: StrictInt, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + _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: + """recentTrades + + Get recent trades + + :param market_id: (required) + :type market_id: int + :param limit: (required) + :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 + (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._recent_trades_serialize( + market_id=market_id, + limit=limit, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _recent_trades_serialize( + self, + market_id, + limit, + _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 market_id is not None: + + _query_params.append(('market_id', market_id)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # 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/recentTrades', + 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 trades( + self, + sort_by: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + account_index: Optional[StrictInt] = None, + order_index: Optional[StrictInt] = None, + sort_dir: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + var_from: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Trades: + """trades + + Get trades + + :param sort_by: (required) + :type sort_by: str + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param market_id: + :type market_id: int + :param account_index: + :type account_index: int + :param order_index: + :type order_index: int + :param sort_dir: + :type sort_dir: str + :param cursor: + :type cursor: str + :param var_from: + :type var_from: int + :param ask_filter: + :type ask_filter: 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._trades_serialize( + sort_by=sort_by, + limit=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, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '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 trades_with_http_info( + self, + sort_by: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + account_index: Optional[StrictInt] = None, + order_index: Optional[StrictInt] = None, + sort_dir: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + var_from: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Trades]: + """trades + + Get trades + + :param sort_by: (required) + :type sort_by: str + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param market_id: + :type market_id: int + :param account_index: + :type account_index: int + :param order_index: + :type order_index: int + :param sort_dir: + :type sort_dir: str + :param cursor: + :type cursor: str + :param var_from: + :type var_from: int + :param ask_filter: + :type ask_filter: 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._trades_serialize( + sort_by=sort_by, + limit=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, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '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 trades_without_preload_content( + self, + sort_by: StrictStr, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + authorization: Optional[StrictStr] = None, + auth: Optional[StrictStr] = None, + market_id: Optional[StrictInt] = None, + account_index: Optional[StrictInt] = None, + order_index: Optional[StrictInt] = None, + sort_dir: Optional[StrictStr] = None, + cursor: Optional[StrictStr] = None, + var_from: Optional[StrictInt] = None, + ask_filter: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """trades + + Get trades + + :param sort_by: (required) + :type sort_by: str + :param limit: (required) + :type limit: int + :param authorization: + :type authorization: str + :param auth: + :type auth: str + :param market_id: + :type market_id: int + :param account_index: + :type account_index: int + :param order_index: + :type order_index: int + :param sort_dir: + :type sort_dir: str + :param cursor: + :type cursor: str + :param var_from: + :type var_from: int + :param ask_filter: + :type ask_filter: 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._trades_serialize( + sort_by=sort_by, + limit=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, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Trades", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _trades_serialize( + self, + sort_by, + limit, + authorization, + auth, + market_id, + account_index, + order_index, + sort_dir, + cursor, + var_from, + ask_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]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if auth is not None: + + _query_params.append(('auth', auth)) + + if market_id is not None: + + _query_params.append(('market_id', market_id)) + + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if order_index is not None: + + _query_params.append(('order_index', order_index)) + + if sort_by is not None: + + _query_params.append(('sort_by', sort_by)) + + if sort_dir is not None: + + _query_params.append(('sort_dir', sort_dir)) + + if cursor is not None: + + _query_params.append(('cursor', cursor)) + + if var_from is not None: + + _query_params.append(('from', var_from)) + + if ask_filter is not None: + + _query_params.append(('ask_filter', ask_filter)) + + 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 + # 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/trades', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/referral_api.py b/docs/lighter/lighter-python-main/lighter/api/referral_api.py new file mode 100644 index 0000000..733ac60 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/referral_api.py @@ -0,0 +1,334 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 typing import Optional +from typing_extensions import Annotated +from lighter.models.referral_points import ReferralPoints + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class ReferralApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def referral_points( + 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, + ) -> ReferralPoints: + """referral_points + + Get referral points + + :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_points_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': "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, + 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[ReferralPoints]: + """referral_points + + Get referral points + + :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_points_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': "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, + 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_points + + Get referral points + + :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_points_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': "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, + 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]] = {} + _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: + + _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 + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/root_api.py b/docs/lighter/lighter-python-main/lighter/api/root_api.py new file mode 100644 index 0000000..f009fdc --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/root_api.py @@ -0,0 +1,529 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 lighter.models.status import Status +from lighter.models.zk_lighter_info import ZkLighterInfo + +from lighter.api_client import ApiClient, RequestSerialized +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class RootApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def 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, + ) -> ZkLighterInfo: + """info + + Get info of zklighter + + :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._info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ZkLighterInfo", + '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 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[ZkLighterInfo]: + """info + + Get info of zklighter + + :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._info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ZkLighterInfo", + '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 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: + """info + + Get info of zklighter + + :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._info_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "ZkLighterInfo", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _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]] = {} + _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='/info', + 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 status( + 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, + ) -> Status: + """status + + Get status of zklighter + + :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._status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Status", + '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 status_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[Status]: + """status + + Get status of zklighter + + :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._status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Status", + '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 status_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: + """status + + Get status of zklighter + + :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._status_serialize( + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Status", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _status_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]] = {} + _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='/', + path_params=_path_params, + query_params=_query_params, + header_params=_header_params, + body=_body_params, + post_params=_form_params, + files=_files, + auth_settings=_auth_settings, + collection_formats=_collection_formats, + _host=_host, + _request_auth=_request_auth + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api/transaction_api.py b/docs/lighter/lighter-python-main/lighter/api/transaction_api.py new file mode 100644 index 0000000..5129ab0 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api/transaction_api.py @@ -0,0 +1,3373 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +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 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.resp_send_tx import RespSendTx +from lighter.models.resp_send_tx_batch import RespSendTxBatch +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 +from lighter.api_response import ApiResponse +from lighter.rest import RESTResponseType + + +class TransactionApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech + + Do not edit the class manually. + """ + + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client + + + @validate_call + async def account_txs( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + index: Optional[StrictInt] = None, + types: Optional[List[StrictInt]] = None, + auth: 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, + ) -> Txs: + """accountTxs + + Get transactions of a specific account + + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param index: + :type index: int + :param types: + :type types: List[int] + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + authorization=authorization, + index=index, + types=types, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ).data + + + @validate_call + async def account_txs_with_http_info( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + index: Optional[StrictInt] = None, + types: Optional[List[StrictInt]] = None, + auth: 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[Txs]: + """accountTxs + + Get transactions of a specific account + + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param index: + :type index: int + :param types: + :type types: List[int] + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + authorization=authorization, + index=index, + types=types, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + await response_data.read() + return self.api_client.response_deserialize( + response_data=response_data, + response_types_map=_response_types_map, + ) + + + @validate_call + async def account_txs_without_preload_content( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + by: StrictStr, + value: StrictStr, + authorization: Optional[StrictStr] = None, + index: Optional[StrictInt] = None, + types: Optional[List[StrictInt]] = None, + auth: 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: + """accountTxs + + Get transactions of a specific account + + :param limit: (required) + :type limit: int + :param by: (required) + :type by: str + :param value: (required) + :type value: str + :param authorization: + :type authorization: str + :param index: + :type index: int + :param types: + :type types: List[int] + :param auth: + :type auth: str + :param _request_timeout: timeout setting for this request. If one + number provided, it will be total request + timeout. It can also be a pair (tuple) of + (connection, read) timeouts. + :type _request_timeout: int, tuple(int, int), optional + :param _request_auth: set to override the auth_settings for an a single + request; this effectively ignores the + authentication in the spec for a single request. + :type _request_auth: dict, optional + :param _content_type: force content-type for the request. + :type _content_type: str, Optional + :param _headers: set to override the headers for a single + request; this effectively ignores the headers + in the spec for a single request. + :type _headers: dict, optional + :param _host_index: set to override the host_index for a single + request; this effectively ignores the host_index + in the spec for a single request. + :type _host_index: int, optional + :return: Returns the result object. + """ # noqa: E501 + + _param = self._account_txs_serialize( + limit=limit, + by=by, + value=value, + authorization=authorization, + index=index, + types=types, + auth=auth, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _account_txs_serialize( + self, + limit, + by, + value, + authorization, + index, + types, + auth, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + 'types': 'csv', + } + + _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 index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + if by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + if types is not None: + + _query_params.append(('types', types)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + # process the header parameters + if authorization is not None: + _header_params['authorization'] = authorization + # process the form parameters + # process the body parameter + + + # set the HTTP header `Accept` + if 'Accept' not in _header_params: + _header_params['Accept'] = self.api_client.select_header_accept( + [ + 'application/json' + ] + ) + + + # authentication setting + _auth_settings: List[str] = [ + ] + + return self.api_client.param_serialize( + method='GET', + resource_path='/api/v1/accountTxs', + 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 block_txs( + self, + by: StrictStr, + value: 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, + ) -> Txs: + """blockTxs + + Get transactions in a block + + :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 + (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._block_txs_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '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 block_txs_with_http_info( + self, + by: StrictStr, + value: 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[Txs]: + """blockTxs + + Get transactions in a block + + :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 + (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._block_txs_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '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 block_txs_without_preload_content( + self, + by: StrictStr, + value: 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: + """blockTxs + + Get transactions in a block + + :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 + (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._block_txs_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _block_txs_serialize( + self, + by, + value, + _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 by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + # 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/blockTxs', + 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_history( + self, + account_index: StrictInt, + 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, + 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, + ) -> DepositHistory: + """deposit_history + + Get deposit history + + :param account_index: (required) + :type account_index: int + :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 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( + account_index=account_index, + l1_address=l1_address, + authorization=authorization, + auth=auth, + 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, + ).data + + + @validate_call + async def deposit_history_with_http_info( + self, + account_index: StrictInt, + 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, + 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, + ) -> ApiResponse[DepositHistory]: + """deposit_history + + Get deposit history + + :param account_index: (required) + :type account_index: int + :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 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( + account_index=account_index, + l1_address=l1_address, + authorization=authorization, + auth=auth, + 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, + account_index: StrictInt, + 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, + 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 account_index: (required) + :type account_index: int + :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 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( + account_index=account_index, + l1_address=l1_address, + authorization=authorization, + auth=auth, + 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, + account_index, + l1_address, + authorization, + auth, + 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]] = {} + _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 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)) + + 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]] = {} + _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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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 + ) + 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]] = {} + _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( + [ + '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/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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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 in the Get Started docs: [Get Started For Programmers](https://apidocs.lighter.xyz/docs/get-started-for-programmers) + + :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]] = {} + _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( + [ + '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', + 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 transfer_history( + 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, + _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, + ) -> TransferHistory: + """transfer_history + + Get transfer history + + :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 _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._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferHistory", + '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 transfer_history_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, + _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[TransferHistory]: + """transfer_history + + Get transfer history + + :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 _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._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferHistory", + '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 transfer_history_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, + _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: + """transfer_history + + Get transfer history + + :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 _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._transfer_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + cursor=cursor, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "TransferHistory", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _transfer_history_serialize( + self, + account_index, + authorization, + auth, + cursor, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if account_index is not None: + + _query_params.append(('account_index', account_index)) + + if auth is not None: + + _query_params.append(('auth', auth)) + + 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 + # 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/transfer/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 tx( + self, + by: StrictStr, + value: 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, + ) -> EnrichedTx: + """tx + + Get transaction by hash or sequence index + + :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 + (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._tx_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '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 tx_with_http_info( + self, + by: StrictStr, + value: 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[EnrichedTx]: + """tx + + Get transaction by hash or sequence index + + :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 + (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._tx_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '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 tx_without_preload_content( + self, + by: StrictStr, + value: 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: + """tx + + Get transaction by hash or sequence index + + :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 + (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._tx_serialize( + by=by, + value=value, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _tx_serialize( + self, + by, + value, + _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 by is not None: + + _query_params.append(('by', by)) + + if value is not None: + + _query_params.append(('value', value)) + + # 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/tx', + 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 tx_from_l1_tx_hash( + self, + hash: 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, + ) -> EnrichedTx: + """txFromL1TxHash + + Get L1 transaction by L1 transaction hash + + :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 + (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._tx_from_l1_tx_hash_serialize( + hash=hash, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '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 tx_from_l1_tx_hash_with_http_info( + self, + hash: 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[EnrichedTx]: + """txFromL1TxHash + + Get L1 transaction by L1 transaction hash + + :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 + (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._tx_from_l1_tx_hash_serialize( + hash=hash, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '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 tx_from_l1_tx_hash_without_preload_content( + self, + hash: 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: + """txFromL1TxHash + + Get L1 transaction by L1 transaction hash + + :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 + (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._tx_from_l1_tx_hash_serialize( + hash=hash, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "EnrichedTx", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _tx_from_l1_tx_hash_serialize( + self, + hash, + _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 hash is not None: + + _query_params.append(('hash', hash)) + + # 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/txFromL1TxHash', + 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 txs( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> Txs: + """txs + + Get transactions which are already packed into blocks + + :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 + (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._txs_serialize( + limit=limit, + index=index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '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 txs_with_http_info( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> ApiResponse[Txs]: + """txs + + Get transactions which are already packed into blocks + + :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 + (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._txs_serialize( + limit=limit, + index=index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '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 txs_without_preload_content( + self, + limit: Annotated[int, Field(le=100, strict=True, ge=1)], + index: Optional[StrictInt] = None, + _request_timeout: Union[ + None, + Annotated[StrictFloat, Field(gt=0)], + Tuple[ + Annotated[StrictFloat, Field(gt=0)], + Annotated[StrictFloat, Field(gt=0)] + ] + ] = None, + _request_auth: Optional[Dict[StrictStr, Any]] = None, + _content_type: Optional[StrictStr] = None, + _headers: Optional[Dict[StrictStr, Any]] = None, + _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0, + ) -> RESTResponseType: + """txs + + Get transactions which are already packed into blocks + + :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 + (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._txs_serialize( + limit=limit, + index=index, + _request_auth=_request_auth, + _content_type=_content_type, + _headers=_headers, + _host_index=_host_index + ) + + _response_types_map: Dict[str, Optional[str]] = { + '200': "Txs", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _txs_serialize( + self, + limit, + index, + _request_auth, + _content_type, + _headers, + _host_index, + ) -> RequestSerialized: + + _host = None + + _collection_formats: Dict[str, str] = { + } + + _path_params: Dict[str, str] = {} + _query_params: List[Tuple[str, str]] = [] + _header_params: Dict[str, Optional[str]] = _headers or {} + _form_params: List[Tuple[str, str]] = [] + _files: Dict[str, Union[str, bytes]] = {} + _body_params: Optional[bytes] = None + + # process the path parameters + # process the query parameters + if index is not None: + + _query_params.append(('index', index)) + + if limit is not None: + + _query_params.append(('limit', limit)) + + # 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/txs', + 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 withdraw_history( + 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, + 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, + ) -> WithdrawHistory: + """withdraw_history + + Get withdraw history + + :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: + :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._withdraw_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + 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': "WithdrawHistory", + '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 withdraw_history_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, + 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, + ) -> ApiResponse[WithdrawHistory]: + """withdraw_history + + Get withdraw history + + :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: + :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._withdraw_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + 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': "WithdrawHistory", + '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 withdraw_history_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, + 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: + """withdraw_history + + Get withdraw history + + :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: + :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._withdraw_history_serialize( + account_index=account_index, + authorization=authorization, + auth=auth, + 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': "WithdrawHistory", + '400': "ResultCode", + } + response_data = await self.api_client.call_api( + *_param, + _request_timeout=_request_timeout + ) + return response_data.response + + + def _withdraw_history_serialize( + self, + account_index, + authorization, + auth, + 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]] = {} + _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 auth is not None: + + _query_params.append(('auth', auth)) + + 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/withdraw/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 + ) + + diff --git a/docs/lighter/lighter-python-main/lighter/api_client.py b/docs/lighter/lighter-python-main/lighter/api_client.py new file mode 100644 index 0000000..c3c5849 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api_client.py @@ -0,0 +1,784 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import datetime +from dateutil.parser import parse +from enum import Enum +import json +import mimetypes +import os +import re +import tempfile + +from urllib.parse import quote +from typing import Tuple, Optional, List, Dict, Union +from pydantic import SecretStr + +from lighter.configuration import Configuration +from lighter.api_response import ApiResponse, T as ApiResponseT +import lighter.models +from lighter import rest +from lighter.exceptions import ( + ApiValueError, + ApiException, + BadRequestException, + UnauthorizedException, + ForbiddenException, + NotFoundException, + ServiceException +) + +RequestSerialized = Tuple[str, str, Dict[str, str], Optional[str], List[str]] + +class ApiClient: + """Generic API client for OpenAPI client library builds. + + OpenAPI generic API client. This client handles the client- + server communication, and is invariant across implementations. Specifics of + the methods and models for each application are generated from the OpenAPI + templates. + + :param configuration: .Configuration object for this client + :param header_name: a header to pass when making calls to the API. + :param header_value: a header value to pass when making calls to + the API. + :param cookie: a cookie to include in the header when making calls + to the API + """ + + PRIMITIVE_TYPES = (float, bool, bytes, str, int) + NATIVE_TYPES_MAPPING = { + 'int': int, + 'long': int, # TODO remove as only py3 is supported? + 'float': float, + 'str': str, + 'bool': bool, + 'date': datetime.date, + 'datetime': datetime.datetime, + 'object': object, + } + _pool = None + + def __init__( + self, + configuration=None, + header_name=None, + header_value=None, + cookie=None + ) -> None: + # use default configuration if none is provided + if configuration is None: + configuration = Configuration.get_default() + self.configuration = configuration + + self.rest_client = rest.RESTClientObject(configuration) + self.default_headers = {} + if header_name is not None: + self.default_headers[header_name] = header_value + self.cookie = cookie + # Set default User-Agent. + self.user_agent = 'OpenAPI-Generator/1.0.0/python' + self.client_side_validation = configuration.client_side_validation + + async def __aenter__(self): + return self + + async def __aexit__(self, exc_type, exc_value, traceback): + await self.close() + + async def close(self): + await self.rest_client.close() + + @property + def user_agent(self): + """User agent for this API client""" + return self.default_headers['User-Agent'] + + @user_agent.setter + def user_agent(self, value): + self.default_headers['User-Agent'] = value + + def set_default_header(self, header_name, header_value): + self.default_headers[header_name] = header_value + + + _default = None + + @classmethod + def get_default(cls): + """Return new instance of ApiClient. + + This method returns newly created, based on default constructor, + object of ApiClient class or returns a copy of default + ApiClient. + + :return: The ApiClient object. + """ + if cls._default is None: + cls._default = ApiClient() + return cls._default + + @classmethod + def set_default(cls, default): + """Set default instance of ApiClient. + + It stores default ApiClient. + + :param default: object of ApiClient. + """ + cls._default = default + + def param_serialize( + self, + method, + resource_path, + path_params=None, + query_params=None, + header_params=None, + body=None, + post_params=None, + files=None, auth_settings=None, + collection_formats=None, + _host=None, + _request_auth=None + ) -> RequestSerialized: + + """Builds the HTTP request params needed by the request. + :param method: Method to call. + :param resource_path: Path to method endpoint. + :param path_params: Path parameters in the url. + :param query_params: Query parameters in the url. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param auth_settings list: Auth Settings names for the request. + :param files dict: key -> filename, value -> filepath, + for `multipart/form-data`. + :param collection_formats: dict of collection formats for path, query, + header, and post parameters. + :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. + :return: tuple of form (path, http_method, query_params, header_params, + body, post_params, files) + """ + + config = self.configuration + + # header parameters + header_params = header_params or {} + header_params.update(self.default_headers) + if self.cookie: + header_params['Cookie'] = self.cookie + if header_params: + header_params = self.sanitize_for_serialization(header_params) + header_params = dict( + self.parameters_to_tuples(header_params,collection_formats) + ) + + # path parameters + if path_params: + path_params = self.sanitize_for_serialization(path_params) + path_params = self.parameters_to_tuples( + path_params, + collection_formats + ) + for k, v in path_params: + # specified safe chars, encode everything + resource_path = resource_path.replace( + '{%s}' % k, + quote(str(v), safe=config.safe_chars_for_path_param) + ) + + # post parameters + if post_params or files: + post_params = post_params if post_params else [] + post_params = self.sanitize_for_serialization(post_params) + post_params = self.parameters_to_tuples( + post_params, + collection_formats + ) + if files: + post_params.extend(self.files_parameters(files)) + + # auth setting + self.update_params_for_auth( + header_params, + query_params, + auth_settings, + resource_path, + method, + body, + request_auth=_request_auth + ) + + # body + if body: + body = self.sanitize_for_serialization(body) + + # request url + if _host is None or self.configuration.ignore_operation_servers: + url = self.configuration.host + resource_path + else: + # use server/host defined in path or operation instead + url = _host + resource_path + + # query parameters + if query_params: + query_params = self.sanitize_for_serialization(query_params) + url_query = self.parameters_to_url_query( + query_params, + collection_formats + ) + url += "?" + url_query + + return method, url, header_params, body, post_params + + + async def call_api( + self, + method, + url, + header_params=None, + body=None, + post_params=None, + _request_timeout=None + ) -> rest.RESTResponse: + """Makes the HTTP request (synchronous) + :param method: Method to call. + :param url: Path to method endpoint. + :param header_params: Header parameters to be + placed in the request header. + :param body: Request body. + :param post_params dict: Request post form parameters, + for `application/x-www-form-urlencoded`, `multipart/form-data`. + :param _request_timeout: timeout setting for this request. + :return: RESTResponse + """ + + try: + # perform request and return response + response_data = await self.rest_client.request( + method, url, + headers=header_params, + body=body, post_params=post_params, + _request_timeout=_request_timeout + ) + + except ApiException as e: + raise e + + return response_data + + def response_deserialize( + self, + response_data: rest.RESTResponse, + response_types_map: Optional[Dict[str, ApiResponseT]]=None + ) -> ApiResponse[ApiResponseT]: + """Deserializes response into an object. + :param response_data: RESTResponse object to be deserialized. + :param response_types_map: dict of response types. + :return: ApiResponse + """ + + msg = "RESTResponse.read() must be called before passing it to response_deserialize()" + assert response_data.data is not None, msg + + response_type = response_types_map.get(str(response_data.status), None) + if not response_type and isinstance(response_data.status, int) and 100 <= response_data.status <= 599: + # if not found, look for '1XX', '2XX', etc. + response_type = response_types_map.get(str(response_data.status)[0] + "XX", None) + + # deserialize response data + response_text = None + return_data = None + try: + if response_type == "bytearray": + 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') + 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" + response_text = response_data.data.decode(encoding) + return_data = self.deserialize(response_text, response_type, content_type) + finally: + if not 200 <= response_data.status <= 299: + raise ApiException.from_response( + http_resp=response_data, + body=response_text, + data=return_data, + ) + + return ApiResponse( + status_code = response_data.status, + data = return_data, + headers = response_data.getheaders(), + raw_data = response_data.data + ) + + def sanitize_for_serialization(self, obj): + """Builds a JSON POST object. + + If obj is None, return None. + If obj is SecretStr, return obj.get_secret_value() + 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 list, sanitize each element in the list. + If obj is dict, return the dict. + If obj is OpenAPI model, return the properties dict. + + :param obj: The data to serialize. + :return: The serialized form of data. + """ + if obj is None: + return None + elif isinstance(obj, Enum): + return obj.value + elif isinstance(obj, SecretStr): + return obj.get_secret_value() + elif isinstance(obj, self.PRIMITIVE_TYPES): + return obj + elif isinstance(obj, list): + return [ + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ] + elif isinstance(obj, tuple): + return tuple( + self.sanitize_for_serialization(sub_obj) for sub_obj in obj + ) + elif isinstance(obj, (datetime.datetime, datetime.date)): + return obj.isoformat() + + elif isinstance(obj, dict): + obj_dict = obj + else: + # Convert model obj to dict except + # attributes `openapi_types`, `attribute_map` + # and attributes which value is not None. + # Convert attribute name to json key in + # model definition for request. + if hasattr(obj, 'to_dict') and callable(getattr(obj, 'to_dict')): + obj_dict = obj.to_dict() + else: + obj_dict = obj.__dict__ + + return { + key: self.sanitize_for_serialization(val) + for key, val in obj_dict.items() + } + + def deserialize(self, response_text: str, response_type: str, content_type: Optional[str]): + """Deserializes response into an object. + + :param response: RESTResponse object to be deserialized. + :param response_type: class literal for + deserialized object, or string of class name. + :param content_type: content type of response. + + :return: deserialized object. + """ + + # fetch data from response object + if content_type is None: + try: + data = json.loads(response_text) + except ValueError: + data = response_text + elif content_type.startswith("application/json"): + if response_text == "": + data = "" + else: + data = json.loads(response_text) + elif content_type.startswith("text/plain"): + data = response_text + else: + raise ApiException( + status=0, + reason="Unsupported content type: {0}".format(content_type) + ) + + return self.__deserialize(data, response_type) + + def __deserialize(self, data, klass): + """Deserializes dict, list, str into an object. + + :param data: dict, list or str. + :param klass: class literal, or string of class name. + + :return: object. + """ + if data is None: + return None + + if isinstance(klass, str): + if klass.startswith('List['): + m = re.match(r'List\[(.*)]', klass) + assert m is not None, "Malformed List type definition" + sub_kls = m.group(1) + return [self.__deserialize(sub_data, sub_kls) + for sub_data in data] + + if klass.startswith('Dict['): + m = re.match(r'Dict\[([^,]*), (.*)]', klass) + assert m is not None, "Malformed Dict type definition" + sub_kls = m.group(2) + return {k: self.__deserialize(v, sub_kls) + for k, v in data.items()} + + # convert str to class + if klass in self.NATIVE_TYPES_MAPPING: + klass = self.NATIVE_TYPES_MAPPING[klass] + else: + klass = getattr(lighter.models, klass) + + if klass in self.PRIMITIVE_TYPES: + return self.__deserialize_primitive(data, klass) + elif klass == object: + return self.__deserialize_object(data) + elif klass == datetime.date: + return self.__deserialize_date(data) + elif klass == datetime.datetime: + return self.__deserialize_datetime(data) + elif issubclass(klass, Enum): + return self.__deserialize_enum(data, klass) + else: + return self.__deserialize_model(data, klass) + + def parameters_to_tuples(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: Parameters as list of tuples, collections formatted + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, value) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(str(value) for value in v))) + else: + new_params.append((k, v)) + return new_params + + def parameters_to_url_query(self, params, collection_formats): + """Get parameters as list of tuples, formatting collections. + + :param params: Parameters as dict or list of two-tuples + :param dict collection_formats: Parameter collection formats + :return: URL query string (e.g. a=Hello%20World&b=123) + """ + new_params: List[Tuple[str, str]] = [] + if collection_formats is None: + collection_formats = {} + for k, v in params.items() if isinstance(params, dict) else params: + if isinstance(v, bool): + v = str(v).lower() + if isinstance(v, (int, float)): + v = str(v) + if isinstance(v, dict): + v = json.dumps(v) + + if k in collection_formats: + collection_format = collection_formats[k] + if collection_format == 'multi': + new_params.extend((k, str(value)) for value in v) + else: + if collection_format == 'ssv': + delimiter = ' ' + elif collection_format == 'tsv': + delimiter = '\t' + elif collection_format == 'pipes': + delimiter = '|' + else: # csv is the default + delimiter = ',' + new_params.append( + (k, delimiter.join(quote(str(value)) for value in v)) + ) + else: + new_params.append((k, quote(str(v)))) + + return "&".join(["=".join(map(str, item)) for item in new_params]) + + def files_parameters(self, files: Dict[str, Union[str, bytes]]): + """Builds form parameters. + + :param files: File parameters. + :return: Form parameters with files. + """ + params = [] + for k, v in files.items(): + if isinstance(v, str): + with open(v, 'rb') as f: + filename = os.path.basename(f.name) + filedata = f.read() + elif isinstance(v, bytes): + filename = k + filedata = v + else: + raise ValueError("Unsupported file value") + mimetype = ( + mimetypes.guess_type(filename)[0] + or 'application/octet-stream' + ) + params.append( + tuple([k, tuple([filename, filedata, mimetype])]) + ) + return params + + def select_header_accept(self, accepts: List[str]) -> Optional[str]: + """Returns `Accept` based on an array of accepts provided. + + :param accepts: List of headers. + :return: Accept (e.g. application/json). + """ + if not accepts: + return None + + for accept in accepts: + if re.search('json', accept, re.IGNORECASE): + return accept + + return accepts[0] + + def select_header_content_type(self, content_types): + """Returns `Content-Type` based on an array of content_types provided. + + :param content_types: List of content-types. + :return: Content-Type (e.g. application/json). + """ + if not content_types: + return None + + for content_type in content_types: + if re.search('json', content_type, re.IGNORECASE): + return content_type + + return content_types[0] + + def update_params_for_auth( + self, + headers, + queries, + auth_settings, + resource_path, + method, + body, + request_auth=None + ) -> None: + """Updates header and query params based on authentication setting. + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :param auth_settings: Authentication setting identifiers list. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param request_auth: if set, the provided settings will + override the token in the configuration. + """ + if not auth_settings: + return + + if request_auth: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + request_auth + ) + else: + for auth in auth_settings: + auth_setting = self.configuration.auth_settings().get(auth) + if auth_setting: + self._apply_auth_params( + headers, + queries, + resource_path, + method, + body, + auth_setting + ) + + def _apply_auth_params( + self, + headers, + queries, + resource_path, + method, + body, + auth_setting + ) -> None: + """Updates the request parameters based on a single auth_setting + + :param headers: Header parameters dict to be updated. + :param queries: Query parameters tuple list to be updated. + :resource_path: A string representation of the HTTP request resource path. + :method: A string representation of the HTTP request method. + :body: A object representing the body of the HTTP request. + The object type is the return value of sanitize_for_serialization(). + :param auth_setting: auth settings for the endpoint + """ + if auth_setting['in'] == 'cookie': + headers['Cookie'] = auth_setting['value'] + elif auth_setting['in'] == 'header': + if auth_setting['type'] != 'http-signature': + headers[auth_setting['key']] = auth_setting['value'] + elif auth_setting['in'] == 'query': + queries.append((auth_setting['key'], auth_setting['value'])) + else: + raise ApiValueError( + 'Authentication token must be in `query` or `header`' + ) + + def __deserialize_file(self, response): + """Deserializes body to file + + Saves response body into a file in a temporary folder, + using the filename from the `Content-Disposition` header if provided. + + handle file downloading + save response body into a tmp file and return the instance + + :param response: RESTResponse. + :return: file path. + """ + fd, path = tempfile.mkstemp(dir=self.configuration.temp_folder_path) + os.close(fd) + os.remove(path) + + content_disposition = response.getheader("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) + path = os.path.join(os.path.dirname(path), filename) + + with open(path, "wb") as f: + f.write(response.data) + + return path + + def __deserialize_primitive(self, data, klass): + """Deserializes string to primitive type. + + :param data: str. + :param klass: class literal. + + :return: int, long, float, str, bool. + """ + try: + return klass(data) + except UnicodeEncodeError: + return str(data) + except TypeError: + return data + + def __deserialize_object(self, value): + """Return an original value. + + :return: object. + """ + return value + + def __deserialize_date(self, string): + """Deserializes string to date. + + :param string: str. + :return: date. + """ + try: + return parse(string).date() + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason="Failed to parse `{0}` as date object".format(string) + ) + + def __deserialize_datetime(self, string): + """Deserializes string to datetime. + + The string should be in iso8601 datetime format. + + :param string: str. + :return: datetime. + """ + try: + return parse(string) + except ImportError: + return string + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as datetime object" + .format(string) + ) + ) + + def __deserialize_enum(self, data, klass): + """Deserializes primitive type to enum. + + :param data: primitive type. + :param klass: class literal. + :return: enum value. + """ + try: + return klass(data) + except ValueError: + raise rest.ApiException( + status=0, + reason=( + "Failed to parse `{0}` as `{1}`" + .format(data, klass) + ) + ) + + def __deserialize_model(self, data, klass): + """Deserializes list or dict to model. + + :param data: dict, list. + :param klass: class literal. + :return: model object. + """ + + return klass.from_dict(data) diff --git a/docs/lighter/lighter-python-main/lighter/api_response.py b/docs/lighter/lighter-python-main/lighter/api_response.py new file mode 100644 index 0000000..9bc7c11 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/api_response.py @@ -0,0 +1,21 @@ +"""API response object.""" + +from __future__ import annotations +from typing import Optional, Generic, Mapping, TypeVar +from pydantic import Field, StrictInt, StrictBytes, BaseModel + +T = TypeVar("T") + +class ApiResponse(BaseModel, Generic[T]): + """ + API response object + """ + + status_code: StrictInt = Field(description="HTTP status code") + headers: Optional[Mapping[str, str]] = Field(None, description="HTTP headers") + data: T = Field(description="Deserialized data given the data type") + raw_data: StrictBytes = Field(description="Raw data (HTTP response body)") + + model_config = { + "arbitrary_types_allowed": True + } diff --git a/docs/lighter/lighter-python-main/lighter/configuration.py b/docs/lighter/lighter-python-main/lighter/configuration.py new file mode 100644 index 0000000..ff0507e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/configuration.py @@ -0,0 +1,475 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import copy +import logging +from logging import FileHandler +import sys +from typing import Optional +import urllib3 + +import http.client as httplib + +JSON_SCHEMA_VALIDATION_KEYWORDS = { + 'multipleOf', 'maximum', 'exclusiveMaximum', + 'minimum', 'exclusiveMinimum', 'maxLength', + 'minLength', 'pattern', 'maxItems', 'minItems' +} + +class Configuration: + """This class contains various settings of the API client. + + :param host: Base url. + :param ignore_operation_servers + Boolean to ignore operation servers for the API client. + Config will use `host` as the base url regardless of the operation servers. + :param api_key: Dict to store API key(s). + Each entry in the dict specifies an API key. + The dict key is the name of the security scheme in the OAS specification. + The dict value is the API key secret. + :param api_key_prefix: Dict to store API prefix (e.g. Bearer). + The dict key is the name of the security scheme in the OAS specification. + The dict value is an API key prefix when generating the auth data. + :param username: Username for HTTP basic authentication. + :param password: Password for HTTP basic authentication. + :param access_token: Access token. + :param server_index: Index to servers configuration. + :param server_variables: Mapping with string values to replace variables in + templated server configuration. The validation of enums is performed for + variables with defined enum values before. + :param server_operation_index: Mapping from operation ID to an index to server + configuration. + :param server_operation_variables: Mapping from operation ID to a mapping with + string values to replace variables in templated server configuration. + The validation of enums is performed for variables with defined enum + values before. + :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. + + :Example: + + API Key Authentication Example. + Given the following security scheme in the OpenAPI specification: + components: + securitySchemes: + cookieAuth: # name for the security scheme + type: apiKey + in: cookie + name: JSESSIONID # cookie name + + You can programmatically set the cookie: + +conf = lighter.Configuration( + api_key={'cookieAuth': 'abc123'} + api_key_prefix={'cookieAuth': 'JSESSIONID'} +) + + The following cookie will be added to the HTTP request: + 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: + """Constructor + """ + self._base_path = "https://mainnet.zklighter.elliot.ai" if host is None else host + """Default Base url + """ + self.server_index = 0 if server_index is None and host is None else server_index + self.server_operation_index = server_operation_index or {} + """Default server index + """ + self.server_variables = server_variables or {} + self.server_operation_variables = server_operation_variables or {} + """Default server variables + """ + self.ignore_operation_servers = ignore_operation_servers + """Ignore operation servers + """ + self.temp_folder_path = None + """Temp file folder for downloading files + """ + # Authentication Settings + self.api_key = {} + if api_key: + self.api_key = api_key + """dict to store API key(s) + """ + self.api_key_prefix = {} + if api_key_prefix: + self.api_key_prefix = api_key_prefix + """dict to store API prefix (e.g. Bearer) + """ + self.refresh_api_key_hook = None + """function hook to refresh API key if expired + """ + self.username = username + """Username for HTTP basic authentication + """ + self.password = password + """Password for HTTP basic authentication + """ + self.access_token = access_token + """Access token + """ + self.logger = {} + """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 + """ + self.logger_stream_handler = None + """Log stream handler + """ + self.logger_file_handler: Optional[FileHandler] = None + """Log file handler + """ + self.logger_file = None + """Debug file location + """ + if debug is not None: + self.debug = debug + else: + self.__debug = False + """Debug switch + """ + + self.verify_ssl = True + """SSL/TLS verification + Set this to false to skip verifying SSL certificate when calling API + from https server. + """ + self.ssl_ca_cert = ssl_ca_cert + """Set this to customize the certificate file to verify the peer. + """ + self.cert_file = None + """client certificate file + """ + self.key_file = None + """client key file + """ + self.assert_hostname = None + """Set this to True/False to enable/disable SSL hostname verification. + """ + self.tls_server_name = None + """SSL/TLS Server Name Indication (SNI) + Set this to the SNI value expected by the server. + """ + + self.connection_pool_maxsize = 100 + """This value is passed to the aiohttp to limit simultaneous connections. + Default values is 100, None means no-limit. + """ + + self.proxy: Optional[str] = None + """Proxy URL + """ + self.proxy_headers = None + """Proxy headers + """ + self.safe_chars_for_path_param = '' + """Safe chars for path_param + """ + self.retries = retries + """Adding retries to override urllib3 default value 3 + """ + # Enable client side validation + self.client_side_validation = True + + self.socket_options = None + """Options to pass down to the underlying urllib3 socket + """ + + self.datetime_format = "%Y-%m-%dT%H:%M:%S.%f%z" + """datetime format + """ + + self.date_format = "%Y-%m-%d" + """date format + """ + + def __deepcopy__(self, memo): + cls = self.__class__ + result = cls.__new__(cls) + memo[id(self)] = result + for k, v in self.__dict__.items(): + if k not in ('logger', 'logger_file_handler'): + setattr(result, k, copy.deepcopy(v, memo)) + # shallow copy of loggers + result.logger = copy.copy(self.logger) + # use setters to configure loggers + result.logger_file = self.logger_file + result.debug = self.debug + return result + + def __setattr__(self, name, value): + object.__setattr__(self, name, value) + + @classmethod + def set_default(cls, default): + """Set default instance of configuration. + + It stores default configuration, which can be + returned by get_default_copy method. + + :param default: object of Configuration + """ + cls._default = default + + @classmethod + def get_default_copy(cls): + """Deprecated. Please use `get_default` instead. + + Deprecated. Please use `get_default` instead. + + :return: The configuration object. + """ + return cls.get_default() + + @classmethod + def get_default(cls): + """Return the default configuration. + + This method returns newly created, based on default constructor, + object of Configuration class or returns a copy of default + configuration. + + :return: The configuration object. + """ + if cls._default is None: + cls._default = Configuration() + return cls._default + + @property + def logger_file(self): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + return self.__logger_file + + @logger_file.setter + def logger_file(self, value): + """The logger file. + + If the logger_file is None, then add stream handler and remove file + handler. Otherwise, add file handler and remove stream handler. + + :param value: The logger_file path. + :type: str + """ + self.__logger_file = value + if self.__logger_file: + # If set logging file, + # then add file handler and remove stream handler. + self.logger_file_handler = logging.FileHandler(self.__logger_file) + self.logger_file_handler.setFormatter(self.logger_formatter) + for _, logger in self.logger.items(): + logger.addHandler(self.logger_file_handler) + + @property + def debug(self): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + return self.__debug + + @debug.setter + def debug(self, value): + """Debug status + + :param value: The debug status, True or False. + :type: bool + """ + self.__debug = value + if self.__debug: + # if debug status is True, turn on debug logging + for _, logger in self.logger.items(): + logger.setLevel(logging.DEBUG) + # turn on httplib debug + httplib.HTTPConnection.debuglevel = 1 + else: + # if debug status is False, turn off debug logging, + # setting log level to default `logging.WARNING` + for _, logger in self.logger.items(): + logger.setLevel(logging.WARNING) + # turn off httplib debug + httplib.HTTPConnection.debuglevel = 0 + + @property + def logger_format(self): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + return self.__logger_format + + @logger_format.setter + def logger_format(self, value): + """The logger format. + + The logger_formatter will be updated when sets logger_format. + + :param value: The format string. + :type: str + """ + self.__logger_format = value + self.logger_formatter = logging.Formatter(self.__logger_format) + + def get_api_key_with_prefix(self, identifier, alias=None): + """Gets API key (with prefix if set). + + :param identifier: The identifier of apiKey. + :param alias: The alternative identifier of apiKey. + :return: The token for api key authentication. + """ + if self.refresh_api_key_hook is not None: + self.refresh_api_key_hook(self) + key = self.api_key.get(identifier, self.api_key.get(alias) if alias is not None else None) + if key: + prefix = self.api_key_prefix.get(identifier) + if prefix: + return "%s %s" % (prefix, key) + else: + return key + + def get_basic_auth_token(self): + """Gets HTTP basic authentication header (string). + + :return: The token for basic HTTP authentication. + """ + username = "" + if self.username is not None: + username = self.username + 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): + """Gets Auth Settings dict for api client. + + :return: The Auth Settings information dict. + """ + auth = {} + if 'apiKey' in self.api_key: + auth['apiKey'] = { + 'type': 'api_key', + 'in': 'header', + 'key': 'Authorization', + 'value': self.get_api_key_with_prefix( + 'apiKey', + ), + } + return auth + + def to_debug_report(self): + """Gets the essential information for debugging. + + :return: The report for debugging. + """ + return "Python SDK Debug Report:\n"\ + "OS: {env}\n"\ + "Python Version: {pyversion}\n"\ + "Version of the API: \n"\ + "SDK Package Version: 1.0.0".\ + format(env=sys.platform, pyversion=sys.version) + + def get_host_settings(self): + """Gets an array of host settings + + :return: An array of host settings + """ + return [ + { + 'url': "https://mainnet.zklighter.elliot.ai", + 'description': "No description provided", + } + ] + + def get_host_from_settings(self, index, variables=None, servers=None): + """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 + :param servers: an array of host settings or None + :return: URL based on host settings + """ + if index is None: + return self._base_path + + variables = {} if variables is None else variables + servers = self.get_host_settings() if servers is None else servers + + try: + server = servers[index] + except IndexError: + raise ValueError( + "Invalid index {0} when selecting the host settings. " + "Must be less than {1}".format(index, len(servers))) + + url = server['url'] + + # go through variables and replace placeholders + for variable_name, variable in server.get('variables', {}).items(): + used_value = variables.get( + variable_name, variable['default_value']) + + if 'enum_values' in variable \ + and used_value not in variable['enum_values']: + raise ValueError( + "The variable `{0}` in the host URL has invalid value " + "{1}. Must be {2}.".format( + variable_name, variables[variable_name], + variable['enum_values'])) + + url = url.replace("{" + variable_name + "}", used_value) + + return url + + @property + def host(self): + """Return generated host.""" + return self.get_host_from_settings(self.server_index, variables=self.server_variables) + + @host.setter + def host(self, value): + """Fix base path.""" + self._base_path = value + self.server_index = None diff --git a/docs/lighter/lighter-python-main/lighter/errors.py b/docs/lighter/lighter-python-main/lighter/errors.py new file mode 100644 index 0000000..2851fa7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/errors.py @@ -0,0 +1,2 @@ +class ValidationError(ValueError): + pass diff --git a/docs/lighter/lighter-python-main/lighter/exceptions.py b/docs/lighter/lighter-python-main/lighter/exceptions.py new file mode 100644 index 0000000..a2fd39d --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/exceptions.py @@ -0,0 +1,199 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + +from typing import Any, Optional +from typing_extensions import Self + +class OpenApiException(Exception): + """The base exception class for all OpenAPIExceptions""" + + +class ApiTypeError(OpenApiException, TypeError): + def __init__(self, msg, path_to_item=None, valid_classes=None, + key_type=None) -> None: + """ Raises an exception for TypeErrors + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list): a list of keys an indices to get to the + current_item + None if unset + valid_classes (tuple): the primitive classes that current item + should be an instance of + None if unset + key_type (bool): False if our value is a value in a dict + True if it is a key in a dict + False if our item is an item in a list + None if unset + """ + self.path_to_item = path_to_item + self.valid_classes = valid_classes + self.key_type = key_type + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiTypeError, self).__init__(full_msg) + + +class ApiValueError(OpenApiException, ValueError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (list) the path to the exception in the + received_data dict. None if unset + """ + + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiValueError, self).__init__(full_msg) + + +class ApiAttributeError(OpenApiException, AttributeError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Raised when an attribute reference or assignment fails. + + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiAttributeError, self).__init__(full_msg) + + +class ApiKeyError(OpenApiException, KeyError): + def __init__(self, msg, path_to_item=None) -> None: + """ + Args: + msg (str): the exception message + + Keyword Args: + path_to_item (None/list) the path to the exception in the + received_data dict + """ + self.path_to_item = path_to_item + full_msg = msg + if path_to_item: + full_msg = "{0} at {1}".format(msg, render_path(path_to_item)) + super(ApiKeyError, self).__init__(full_msg) + + +class ApiException(OpenApiException): + + def __init__( + self, + status=None, + reason=None, + http_resp=None, + *, + body: Optional[str] = None, + data: Optional[Any] = None, + ) -> None: + self.status = status + self.reason = reason + self.body = body + self.data = data + self.headers = None + + if http_resp: + if self.status is None: + self.status = http_resp.status + if self.reason is None: + self.reason = http_resp.reason + if self.body is None: + try: + self.body = http_resp.data.decode('utf-8') + except Exception: + pass + self.headers = http_resp.getheaders() + + @classmethod + def from_response( + cls, + *, + http_resp, + body: Optional[str], + data: Optional[Any], + ) -> Self: + if http_resp.status == 400: + raise BadRequestException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 401: + raise UnauthorizedException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 403: + raise ForbiddenException(http_resp=http_resp, body=body, data=data) + + if http_resp.status == 404: + raise NotFoundException(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) + + def __str__(self): + """Custom error messages for exception""" + error_message = "({0})\n"\ + "Reason: {1}\n".format(self.status, self.reason) + if self.headers: + 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) + + return error_message + + +class BadRequestException(ApiException): + pass + + +class NotFoundException(ApiException): + pass + + +class UnauthorizedException(ApiException): + pass + + +class ForbiddenException(ApiException): + pass + + +class ServiceException(ApiException): + pass + + +def render_path(path_to_item): + """Returns a string representation of a path""" + result = "" + for pth in path_to_item: + if isinstance(pth, int): + result += "[{0}]".format(pth) + else: + result += "['{0}']".format(pth) + return result diff --git a/docs/lighter/lighter-python-main/lighter/models/__init__.py b/docs/lighter/lighter-python-main/lighter/models/__init__.py new file mode 100644 index 0000000..f5abd92 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/__init__.py @@ -0,0 +1,144 @@ +# coding: utf-8 + +# flake8: noqa +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +# import models into model package +from lighter.models.account import Account +from lighter.models.account_api_keys import AccountApiKeys +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.block import Block +from lighter.models.blocks import Blocks +from lighter.models.bridge_supported_network import BridgeSupportedNetwork +from lighter.models.candlestick import Candlestick +from lighter.models.candlesticks import Candlesticks +from lighter.models.contract_address import ContractAddress +from lighter.models.current_height import CurrentHeight +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_stats import ExchangeStats +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.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_info import MarketInfo +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_detail import OrderBookDetail +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.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 import PublicPool +from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_metadata import PublicPoolMetadata +from lighter.models.public_pool_share import PublicPoolShare +from lighter.models.public_pools import PublicPools +from lighter.models.referral_point_entry import ReferralPointEntry +from lighter.models.referral_points import ReferralPoints +from lighter.models.req_export_data import ReqExportData +from lighter.models.req_get_account import ReqGetAccount +from lighter.models.req_get_account_active_orders import ReqGetAccountActiveOrders +from lighter.models.req_get_account_api_keys import ReqGetAccountApiKeys +from lighter.models.req_get_account_by_l1_address import ReqGetAccountByL1Address +from lighter.models.req_get_account_inactive_orders import ReqGetAccountInactiveOrders +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_block import ReqGetBlock +from lighter.models.req_get_block_txs import ReqGetBlockTxs +from lighter.models.req_get_by_account import ReqGetByAccount +from lighter.models.req_get_candlesticks import ReqGetCandlesticks +from lighter.models.req_get_deposit_history import ReqGetDepositHistory +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_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 import ReqGetPublicPools +from lighter.models.req_get_public_pools_metadata import ReqGetPublicPoolsMetadata +from lighter.models.req_get_range_with_cursor import ReqGetRangeWithCursor +from lighter.models.req_get_range_with_index import ReqGetRangeWithIndex +from lighter.models.req_get_range_with_index_sortable import ReqGetRangeWithIndexSortable +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_withdraw_history import ReqGetWithdrawHistory +from lighter.models.resp_change_account_tier import RespChangeAccountTier +from lighter.models.resp_get_fast_bridge_info import RespGetFastBridgeInfo +from lighter.models.resp_public_pools_metadata import RespPublicPoolsMetadata +from lighter.models.resp_send_tx import RespSendTx +from lighter.models.resp_send_tx_batch import RespSendTxBatch +from lighter.models.resp_withdrawal_delay import RespWithdrawalDelay +from lighter.models.result_code import ResultCode +from lighter.models.risk_info import RiskInfo +from lighter.models.risk_parameters import RiskParameters +from lighter.models.share_price import SharePrice +from lighter.models.simple_order import SimpleOrder +from lighter.models.status import Status +from lighter.models.sub_accounts import SubAccounts +from lighter.models.ticker import Ticker +from lighter.models.trade import Trade +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.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 diff --git a/docs/lighter/lighter-python-main/lighter/models/account.py b/docs/lighter/lighter-python-main/lighter/models/account.py new file mode 100644 index 0000000..c14398c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account.py @@ -0,0 +1,122 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Account(BaseModel): + """ + Account + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_type: StrictInt + index: StrictInt + l1_address: StrictStr + cancel_all_time: StrictInt + total_order_count: StrictInt + total_isolated_order_count: StrictInt + pending_order_count: StrictInt + available_balance: Optional[StrictStr] + status: StrictInt + collateral: StrictStr + 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"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Account from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Account from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_type": obj.get("account_type"), + "index": obj.get("index"), + "l1_address": obj.get("l1_address"), + "cancel_all_time": obj.get("cancel_all_time"), + "total_order_count": obj.get("total_order_count"), + "total_isolated_order_count": obj.get("total_isolated_order_count"), + "pending_order_count": obj.get("pending_order_count"), + "available_balance": obj.get("available_balance"), + "status": obj.get("status"), + "collateral": obj.get("collateral") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_api_keys.py b/docs/lighter/lighter-python-main/lighter/models/account_api_keys.py new file mode 100644 index 0000000..da1e42c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_api_keys.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.api_key import ApiKey +from typing import Optional, Set +from typing_extensions import Self + +class AccountApiKeys(BaseModel): + """ + AccountApiKeys + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + api_keys: List[ApiKey] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "api_keys"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountApiKeys from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in api_keys (list) + _items = [] + if self.api_keys: + for _item in self.api_keys: + if _item: + _items.append(_item.to_dict()) + _dict['api_keys'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountApiKeys from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "api_keys": [ApiKey.from_dict(_item) for _item in obj["api_keys"]] if obj.get("api_keys") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_limits.py b/docs/lighter/lighter-python-main/lighter/models/account_limits.py new file mode 100644 index 0000000..81eff07 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_limits.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AccountLimits(BaseModel): + """ + AccountLimits + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + max_llp_percentage: StrictInt + user_tier: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "max_llp_percentage", "user_tier"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountLimits from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountLimits from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "max_llp_percentage": obj.get("max_llp_percentage"), + "user_tier": obj.get("user_tier") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_margin_stats.py b/docs/lighter/lighter-python-main/lighter/models/account_margin_stats.py new file mode 100644 index 0000000..bad64a8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_margin_stats.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AccountMarginStats(BaseModel): + """ + AccountMarginStats + """ # noqa: E501 + collateral: StrictStr + portfolio_value: StrictStr + leverage: StrictStr + available_balance: StrictStr + margin_usage: StrictStr + buying_power: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountMarginStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountMarginStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_market_stats.py b/docs/lighter/lighter-python-main/lighter/models/account_market_stats.py new file mode 100644 index 0000000..efa1731 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_market_stats.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class AccountMarketStats(BaseModel): + """ + AccountMarketStats + """ # noqa: E501 + market_id: StrictInt + daily_trades_count: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + weekly_trades_count: StrictInt + weekly_base_token_volume: Union[StrictFloat, StrictInt] + weekly_quote_token_volume: Union[StrictFloat, StrictInt] + monthly_trades_count: StrictInt + monthly_base_token_volume: Union[StrictFloat, StrictInt] + monthly_quote_token_volume: Union[StrictFloat, StrictInt] + total_trades_count: StrictInt + total_base_token_volume: Union[StrictFloat, StrictInt] + total_quote_token_volume: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountMarketStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountMarketStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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"), + "daily_quote_token_volume": obj.get("daily_quote_token_volume"), + "weekly_trades_count": obj.get("weekly_trades_count"), + "weekly_base_token_volume": obj.get("weekly_base_token_volume"), + "weekly_quote_token_volume": obj.get("weekly_quote_token_volume"), + "monthly_trades_count": obj.get("monthly_trades_count"), + "monthly_base_token_volume": obj.get("monthly_base_token_volume"), + "monthly_quote_token_volume": obj.get("monthly_quote_token_volume"), + "total_trades_count": obj.get("total_trades_count"), + "total_base_token_volume": obj.get("total_base_token_volume"), + "total_quote_token_volume": obj.get("total_quote_token_volume") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_metadata.py b/docs/lighter/lighter-python-main/lighter/models/account_metadata.py new file mode 100644 index 0000000..ddd09e6 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_metadata.py @@ -0,0 +1,108 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class AccountMetadata(BaseModel): + """ + AccountMetadata + """ # noqa: E501 + 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") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "name", "description", "can_invite", "referral_points_percentage"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "name": obj.get("name"), + "description": obj.get("description"), + "can_invite": obj.get("can_invite"), + "referral_points_percentage": obj.get("referral_points_percentage") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_metadatas.py b/docs/lighter/lighter-python-main/lighter/models/account_metadatas.py new file mode 100644 index 0000000..3d41085 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_metadatas.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.account_metadata import AccountMetadata +from typing import Optional, Set +from typing_extensions import Self + +class AccountMetadatas(BaseModel): + """ + AccountMetadatas + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_metadatas: List[AccountMetadata] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "account_metadatas"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountMetadatas from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in account_metadatas (list) + _items = [] + if self.account_metadatas: + for _item in self.account_metadatas: + if _item: + _items.append(_item.to_dict()) + _dict['account_metadatas'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountMetadatas from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_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(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_pn_l.py b/docs/lighter/lighter-python-main/lighter/models/account_pn_l.py new file mode 100644 index 0000000..9196cf0 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_pn_l.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.pn_l_entry import PnLEntry +from typing import Optional, Set +from typing_extensions import Self + +class AccountPnL(BaseModel): + """ + AccountPnL + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + resolution: StrictStr + pnl: List[PnLEntry] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "resolution", "pnl"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountPnL from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in pnl (list) + _items = [] + if self.pnl: + for _item in self.pnl: + if _item: + _items.append(_item.to_dict()) + _dict['pnl'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountPnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "resolution": obj.get("resolution"), + "pnl": [PnLEntry.from_dict(_item) for _item in obj["pnl"]] if obj.get("pnl") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_position.py b/docs/lighter/lighter-python-main/lighter/models/account_position.py new file mode 100644 index 0000000..9942715 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_position.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class AccountPosition(BaseModel): + """ + AccountPosition + """ # noqa: E501 + market_id: StrictInt + symbol: StrictStr + initial_margin_fraction: StrictStr + open_order_count: StrictInt + pending_order_count: StrictInt + position_tied_order_count: StrictInt + sign: StrictInt + position: StrictStr + avg_entry_price: StrictStr + position_value: StrictStr + unrealized_pnl: StrictStr + realized_pnl: StrictStr + liquidation_price: StrictStr + total_funding_paid_out: Optional[StrictStr] = None + margin_mode: StrictInt + allocated_margin: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "symbol", "initial_margin_fraction", "open_order_count", "pending_order_count", "position_tied_order_count", "sign", "position", "avg_entry_price", "position_value", "unrealized_pnl", "realized_pnl", "liquidation_price", "total_funding_paid_out", "margin_mode", "allocated_margin"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountPosition from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountPosition from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "symbol": obj.get("symbol"), + "initial_margin_fraction": obj.get("initial_margin_fraction"), + "open_order_count": obj.get("open_order_count"), + "pending_order_count": obj.get("pending_order_count"), + "position_tied_order_count": obj.get("position_tied_order_count"), + "sign": obj.get("sign"), + "position": obj.get("position"), + "avg_entry_price": obj.get("avg_entry_price"), + "position_value": obj.get("position_value"), + "unrealized_pnl": obj.get("unrealized_pnl"), + "realized_pnl": obj.get("realized_pnl"), + "liquidation_price": obj.get("liquidation_price"), + "total_funding_paid_out": obj.get("total_funding_paid_out"), + "margin_mode": obj.get("margin_mode"), + "allocated_margin": obj.get("allocated_margin") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_stats.py b/docs/lighter/lighter-python-main/lighter/models/account_stats.py new file mode 100644 index 0000000..9fac368 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_stats.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.account_margin_stats import AccountMarginStats +from typing import Optional, Set +from typing_extensions import Self + +class AccountStats(BaseModel): + """ + AccountStats + """ # noqa: E501 + collateral: StrictStr + portfolio_value: StrictStr + leverage: StrictStr + available_balance: Optional[StrictStr] + margin_usage: StrictStr + buying_power: StrictStr + cross_stats: AccountMarginStats + total_stats: AccountMarginStats + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["collateral", "portfolio_value", "leverage", "available_balance", "margin_usage", "buying_power", "cross_stats", "total_stats"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cross_stats + if self.cross_stats: + _dict['cross_stats'] = self.cross_stats.to_dict() + # override the default output from pydantic by calling `to_dict()` of total_stats + if self.total_stats: + _dict['total_stats'] = self.total_stats.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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"), + "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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/account_trade_stats.py b/docs/lighter/lighter-python-main/lighter/models/account_trade_stats.py new file mode 100644 index 0000000..a266610 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/account_trade_stats.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class AccountTradeStats(BaseModel): + """ + AccountTradeStats + """ # noqa: E501 + daily_trades_count: StrictInt + daily_volume: Union[StrictFloat, StrictInt] + weekly_trades_count: StrictInt + weekly_volume: Union[StrictFloat, StrictInt] + monthly_trades_count: StrictInt + monthly_volume: Union[StrictFloat, StrictInt] + total_trades_count: StrictInt + total_volume: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of AccountTradeStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of AccountTradeStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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"), + "weekly_volume": obj.get("weekly_volume"), + "monthly_trades_count": obj.get("monthly_trades_count"), + "monthly_volume": obj.get("monthly_volume"), + "total_trades_count": obj.get("total_trades_count"), + "total_volume": obj.get("total_volume") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/announcement.py b/docs/lighter/lighter-python-main/lighter/models/announcement.py new file mode 100644 index 0000000..cbccae5 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/announcement.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Announcement(BaseModel): + """ + Announcement + """ # noqa: E501 + title: StrictStr + content: StrictStr + created_at: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["title", "content", "created_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Announcement from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Announcement from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "title": obj.get("title"), + "content": obj.get("content"), + "created_at": obj.get("created_at") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/announcements.py b/docs/lighter/lighter-python-main/lighter/models/announcements.py new file mode 100644 index 0000000..d89894f --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/announcements.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.announcement import Announcement +from typing import Optional, Set +from typing_extensions import Self + +class Announcements(BaseModel): + """ + Announcements + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + announcements: List[Announcement] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "announcements"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Announcements from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in announcements (list) + _items = [] + if self.announcements: + for _item in self.announcements: + if _item: + _items.append(_item.to_dict()) + _dict['announcements'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Announcements from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "announcements": [Announcement.from_dict(_item) for _item in obj["announcements"]] if obj.get("announcements") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/api_key.py b/docs/lighter/lighter-python-main/lighter/models/api_key.py new file mode 100644 index 0000000..f02af99 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/api_key.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ApiKey(BaseModel): + """ + ApiKey + """ # noqa: E501 + account_index: StrictInt + api_key_index: StrictInt + nonce: StrictInt + public_key: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "api_key_index", "nonce", "public_key"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ApiKey from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ApiKey from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "api_key_index": obj.get("api_key_index"), + "nonce": obj.get("nonce"), + "public_key": obj.get("public_key") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/block.py b/docs/lighter/lighter-python-main/lighter/models/block.py new file mode 100644 index 0000000..7e550d7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/block.py @@ -0,0 +1,132 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.tx import Tx +from typing import Optional, Set +from typing_extensions import Self + +class Block(BaseModel): + """ + Block + """ # noqa: E501 + commitment: StrictStr + height: StrictInt + state_root: StrictStr + priority_operations: StrictInt + on_chain_l2_operations: StrictInt + pending_on_chain_operations_pub_data: StrictStr + committed_tx_hash: StrictStr + committed_at: StrictInt + verified_tx_hash: StrictStr + verified_at: StrictInt + txs: List[Tx] + status: StrictInt + size: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["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"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Block from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in txs (list) + _items = [] + if self.txs: + for _item in self.txs: + if _item: + _items.append(_item.to_dict()) + _dict['txs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Block from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "commitment": obj.get("commitment"), + "height": obj.get("height"), + "state_root": obj.get("state_root"), + "priority_operations": obj.get("priority_operations"), + "on_chain_l2_operations": obj.get("on_chain_l2_operations"), + "pending_on_chain_operations_pub_data": obj.get("pending_on_chain_operations_pub_data"), + "committed_tx_hash": obj.get("committed_tx_hash"), + "committed_at": obj.get("committed_at"), + "verified_tx_hash": obj.get("verified_tx_hash"), + "verified_at": obj.get("verified_at"), + "txs": [Tx.from_dict(_item) for _item in obj["txs"]] if obj.get("txs") is not None else None, + "status": obj.get("status"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/blocks.py b/docs/lighter/lighter-python-main/lighter/models/blocks.py new file mode 100644 index 0000000..2591f16 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/blocks.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.block import Block +from typing import Optional, Set +from typing_extensions import Self + +class Blocks(BaseModel): + """ + Blocks + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + total: StrictInt + blocks: List[Block] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "total", "blocks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Blocks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in blocks (list) + _items = [] + if self.blocks: + for _item in self.blocks: + if _item: + _items.append(_item.to_dict()) + _dict['blocks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Blocks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "total": obj.get("total"), + "blocks": [Block.from_dict(_item) for _item in obj["blocks"]] if obj.get("blocks") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/bridge_supported_network.py b/docs/lighter/lighter-python-main/lighter/models/bridge_supported_network.py new file mode 100644 index 0000000..4e3533a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/bridge_supported_network.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class BridgeSupportedNetwork(BaseModel): + """ + BridgeSupportedNetwork + """ # noqa: E501 + name: StrictStr + chain_id: StrictStr + explorer: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "chain_id", "explorer"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of BridgeSupportedNetwork from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of BridgeSupportedNetwork from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "chain_id": obj.get("chain_id"), + "explorer": obj.get("explorer") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/candlestick.py b/docs/lighter/lighter-python-main/lighter/models/candlestick.py new file mode 100644 index 0000000..ea9d42e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/candlestick.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class Candlestick(BaseModel): + """ + Candlestick + """ # noqa: E501 + timestamp: StrictInt + open: Union[StrictFloat, StrictInt] + high: Union[StrictFloat, StrictInt] + low: Union[StrictFloat, StrictInt] + close: Union[StrictFloat, StrictInt] + volume0: Union[StrictFloat, StrictInt] + volume1: Union[StrictFloat, StrictInt] + last_trade_id: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "open", "high", "low", "close", "volume0", "volume1", "last_trade_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Candlestick from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Candlestick from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "open": obj.get("open"), + "high": obj.get("high"), + "low": obj.get("low"), + "close": obj.get("close"), + "volume0": obj.get("volume0"), + "volume1": obj.get("volume1"), + "last_trade_id": obj.get("last_trade_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/candlesticks.py b/docs/lighter/lighter-python-main/lighter/models/candlesticks.py new file mode 100644 index 0000000..a8184f9 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/candlesticks.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.candlestick import Candlestick +from typing import Optional, Set +from typing_extensions import Self + +class Candlesticks(BaseModel): + """ + Candlesticks + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + resolution: StrictStr + candlesticks: List[Candlestick] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "resolution", "candlesticks"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Candlesticks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in candlesticks (list) + _items = [] + if self.candlesticks: + for _item in self.candlesticks: + if _item: + _items.append(_item.to_dict()) + _dict['candlesticks'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Candlesticks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "resolution": obj.get("resolution"), + "candlesticks": [Candlestick.from_dict(_item) for _item in obj["candlesticks"]] if obj.get("candlesticks") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/contract_address.py b/docs/lighter/lighter-python-main/lighter/models/contract_address.py new file mode 100644 index 0000000..768652e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/contract_address.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ContractAddress(BaseModel): + """ + ContractAddress + """ # noqa: E501 + name: StrictStr + address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["name", "address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ContractAddress from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ContractAddress from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "name": obj.get("name"), + "address": obj.get("address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/current_height.py b/docs/lighter/lighter-python-main/lighter/models/current_height.py new file mode 100644 index 0000000..5aa2b8f --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/current_height.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class CurrentHeight(BaseModel): + """ + CurrentHeight + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + height: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "height"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of CurrentHeight from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of CurrentHeight from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "height": obj.get("height") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/cursor.py b/docs/lighter/lighter-python-main/lighter/models/cursor.py new file mode 100644 index 0000000..a1ca1ef --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/cursor.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class Cursor(BaseModel): + """ + Cursor + """ # noqa: E501 + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["next_cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Cursor from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Cursor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "next_cursor": obj.get("next_cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/daily_return.py b/docs/lighter/lighter-python-main/lighter/models/daily_return.py new file mode 100644 index 0000000..0453381 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/daily_return.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class DailyReturn(BaseModel): + """ + DailyReturn + """ # noqa: E501 + timestamp: StrictInt + daily_return: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "daily_return"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DailyReturn from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DailyReturn from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "daily_return": obj.get("daily_return") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/deposit_history.py b/docs/lighter/lighter-python-main/lighter/models/deposit_history.py new file mode 100644 index 0000000..2b2e238 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/deposit_history.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.deposit_history_item import DepositHistoryItem +from typing import Optional, Set +from typing_extensions import Self + +class DepositHistory(BaseModel): + """ + DepositHistory + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + deposits: List[DepositHistoryItem] + cursor: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "deposits", "cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DepositHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in deposits (list) + _items = [] + if self.deposits: + for _item in self.deposits: + if _item: + _items.append(_item.to_dict()) + _dict['deposits'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DepositHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "deposits": [DepositHistoryItem.from_dict(_item) for _item in obj["deposits"]] if obj.get("deposits") is not None else None, + "cursor": obj.get("cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/deposit_history_item.py b/docs/lighter/lighter-python-main/lighter/models/deposit_history_item.py new file mode 100644 index 0000000..c7a1894 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/deposit_history_item.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class DepositHistoryItem(BaseModel): + """ + DepositHistoryItem + """ # noqa: E501 + id: StrictStr + amount: StrictStr + timestamp: StrictInt + status: StrictStr + l1_tx_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "status", "l1_tx_hash"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['failed', 'pending', 'completed', 'claimable']): + raise ValueError("must be one of enum values ('failed', 'pending', 'completed', 'claimable')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DepositHistoryItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DepositHistoryItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "amount": obj.get("amount"), + "timestamp": obj.get("timestamp"), + "status": obj.get("status"), + "l1_tx_hash": obj.get("l1_tx_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/detailed_account.py b/docs/lighter/lighter-python-main/lighter/models/detailed_account.py new file mode 100644 index 0000000..eb8a0b0 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/detailed_account.py @@ -0,0 +1,162 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.account_position import AccountPosition +from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_share import PublicPoolShare +from typing import Optional, Set +from typing_extensions import Self + +class DetailedAccount(BaseModel): + """ + DetailedAccount + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_type: StrictInt + index: StrictInt + l1_address: StrictStr + cancel_all_time: StrictInt + total_order_count: StrictInt + total_isolated_order_count: StrictInt + pending_order_count: StrictInt + available_balance: Optional[StrictStr] + status: StrictInt + collateral: StrictStr + 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") + positions: List[AccountPosition] + total_asset_value: StrictStr + cross_asset_value: StrictStr + pool_info: Optional[PublicPoolInfo] + shares: List[PublicPoolShare] + 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", "account_index", "name", "description", "can_invite", "referral_points_percentage", "positions", "total_asset_value", "cross_asset_value", "pool_info", "shares"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetailedAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in positions (list) + _items = [] + if self.positions: + for _item in self.positions: + if _item: + _items.append(_item.to_dict()) + _dict['positions'] = _items + # override the default output from pydantic by calling `to_dict()` of pool_info + if self.pool_info: + _dict['pool_info'] = self.pool_info.to_dict() + # 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()) + _dict['shares'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetailedAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_type": obj.get("account_type"), + "index": obj.get("index"), + "l1_address": obj.get("l1_address"), + "cancel_all_time": obj.get("cancel_all_time"), + "total_order_count": obj.get("total_order_count"), + "total_isolated_order_count": obj.get("total_isolated_order_count"), + "pending_order_count": obj.get("pending_order_count"), + "available_balance": obj.get("available_balance"), + "status": obj.get("status"), + "collateral": obj.get("collateral"), + "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"), + "positions": [AccountPosition.from_dict(_item) for _item in obj["positions"]] if obj.get("positions") 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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/detailed_accounts.py b/docs/lighter/lighter-python-main/lighter/models/detailed_accounts.py new file mode 100644 index 0000000..50f61e1 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/detailed_accounts.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.detailed_account import DetailedAccount +from typing import Optional, Set +from typing_extensions import Self + +class DetailedAccounts(BaseModel): + """ + DetailedAccounts + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + total: StrictInt + accounts: List[DetailedAccount] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "total", "accounts"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetailedAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in accounts (list) + _items = [] + if self.accounts: + for _item in self.accounts: + if _item: + _items.append(_item.to_dict()) + _dict['accounts'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetailedAccounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "total": obj.get("total"), + "accounts": [DetailedAccount.from_dict(_item) for _item in obj["accounts"]] if obj.get("accounts") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/detailed_candlestick.py b/docs/lighter/lighter-python-main/lighter/models/detailed_candlestick.py new file mode 100644 index 0000000..36a84ca --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/detailed_candlestick.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class DetailedCandlestick(BaseModel): + """ + DetailedCandlestick + """ # noqa: E501 + timestamp: StrictInt + open: Union[StrictFloat, StrictInt] + high: Union[StrictFloat, StrictInt] + low: Union[StrictFloat, StrictInt] + close: Union[StrictFloat, StrictInt] + volume0: Union[StrictFloat, StrictInt] + volume1: Union[StrictFloat, StrictInt] + last_trade_id: StrictInt + trade_count: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "open", "high", "low", "close", "volume0", "volume1", "last_trade_id", "trade_count"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of DetailedCandlestick from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of DetailedCandlestick from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "open": obj.get("open"), + "high": obj.get("high"), + "low": obj.get("low"), + "close": obj.get("close"), + "volume0": obj.get("volume0"), + "volume1": obj.get("volume1"), + "last_trade_id": obj.get("last_trade_id"), + "trade_count": obj.get("trade_count") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/enriched_tx.py b/docs/lighter/lighter-python-main/lighter/models/enriched_tx.py new file mode 100644 index 0000000..08567b2 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/enriched_tx.py @@ -0,0 +1,137 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class EnrichedTx(BaseModel): + """ + EnrichedTx + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + hash: StrictStr + type: Annotated[int, Field(le=64, strict=True, ge=1)] + info: StrictStr + event_info: StrictStr + status: StrictInt + transaction_index: StrictInt + l1_address: StrictStr + account_index: StrictInt + nonce: StrictInt + expire_at: StrictInt + block_height: StrictInt + queued_at: StrictInt + executed_at: StrictInt + sequence_index: StrictInt + parent_hash: StrictStr + committed_at: StrictInt + verified_at: StrictInt + additional_properties: Dict[str, Any] = {} + __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", "committed_at", "verified_at"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of EnrichedTx from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of EnrichedTx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "hash": obj.get("hash"), + "type": obj.get("type"), + "info": obj.get("info"), + "event_info": obj.get("event_info"), + "status": obj.get("status"), + "transaction_index": obj.get("transaction_index"), + "l1_address": obj.get("l1_address"), + "account_index": obj.get("account_index"), + "nonce": obj.get("nonce"), + "expire_at": obj.get("expire_at"), + "block_height": obj.get("block_height"), + "queued_at": obj.get("queued_at"), + "executed_at": obj.get("executed_at"), + "sequence_index": obj.get("sequence_index"), + "parent_hash": obj.get("parent_hash"), + "committed_at": obj.get("committed_at"), + "verified_at": obj.get("verified_at") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/exchange_stats.py b/docs/lighter/lighter-python-main/lighter/models/exchange_stats.py new file mode 100644 index 0000000..fa276ce --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/exchange_stats.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from lighter.models.order_book_stats import OrderBookStats +from typing import Optional, Set +from typing_extensions import Self + +class ExchangeStats(BaseModel): + """ + ExchangeStats + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + total: StrictInt + order_book_stats: List[OrderBookStats] + daily_usd_volume: Union[StrictFloat, StrictInt] + daily_trades_count: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "total", "order_book_stats", "daily_usd_volume", "daily_trades_count"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExchangeStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in order_book_stats (list) + _items = [] + if self.order_book_stats: + for _item in self.order_book_stats: + if _item: + _items.append(_item.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: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExchangeStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "total": obj.get("total"), + "order_book_stats": [OrderBookStats.from_dict(_item) for _item in obj["order_book_stats"]] if obj.get("order_book_stats") is not None else None, + "daily_usd_volume": obj.get("daily_usd_volume"), + "daily_trades_count": obj.get("daily_trades_count") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/export_data.py b/docs/lighter/lighter-python-main/lighter/models/export_data.py new file mode 100644 index 0000000..4e712d8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/export_data.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ExportData(BaseModel): + """ + ExportData + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + data_url: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "data_url"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ExportData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ExportData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "data_url": obj.get("data_url") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/funding.py b/docs/lighter/lighter-python-main/lighter/models/funding.py new file mode 100644 index 0000000..727be7d --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/funding.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Funding(BaseModel): + """ + Funding + """ # noqa: E501 + timestamp: StrictInt + value: StrictStr + rate: StrictStr + direction: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "value", "rate", "direction"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Funding from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Funding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "value": obj.get("value"), + "rate": obj.get("rate"), + "direction": obj.get("direction") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/funding_rate.py b/docs/lighter/lighter-python-main/lighter/models/funding_rate.py new file mode 100644 index 0000000..ff591b1 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/funding_rate.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class FundingRate(BaseModel): + """ + FundingRate + """ # noqa: E501 + market_id: StrictInt + exchange: StrictStr + symbol: StrictStr + rate: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "exchange", "symbol", "rate"] + + @field_validator('exchange') + def exchange_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['binance', 'bybit', 'hyperliquid', 'lighter']): + raise ValueError("must be one of enum values ('binance', 'bybit', 'hyperliquid', 'lighter')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FundingRate from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FundingRate from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "exchange": obj.get("exchange"), + "symbol": obj.get("symbol"), + "rate": obj.get("rate") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/funding_rates.py b/docs/lighter/lighter-python-main/lighter/models/funding_rates.py new file mode 100644 index 0000000..90e062b --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/funding_rates.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.funding_rate import FundingRate +from typing import Optional, Set +from typing_extensions import Self + +class FundingRates(BaseModel): + """ + FundingRates + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + funding_rates: List[FundingRate] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "funding_rates"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of FundingRates from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in funding_rates (list) + _items = [] + if self.funding_rates: + for _item in self.funding_rates: + if _item: + _items.append(_item.to_dict()) + _dict['funding_rates'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of FundingRates from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "funding_rates": [FundingRate.from_dict(_item) for _item in obj["funding_rates"]] if obj.get("funding_rates") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/fundings.py b/docs/lighter/lighter-python-main/lighter/models/fundings.py new file mode 100644 index 0000000..0ace19a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/fundings.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.funding import Funding +from typing import Optional, Set +from typing_extensions import Self + +class Fundings(BaseModel): + """ + Fundings + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + resolution: StrictStr + fundings: List[Funding] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "resolution", "fundings"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Fundings from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in fundings (list) + _items = [] + if self.fundings: + for _item in self.fundings: + if _item: + _items.append(_item.to_dict()) + _dict['fundings'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Fundings from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "resolution": obj.get("resolution"), + "fundings": [Funding.from_dict(_item) for _item in obj["fundings"]] if obj.get("fundings") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/l1_metadata.py b/docs/lighter/lighter-python-main/lighter/models/l1_metadata.py new file mode 100644 index 0000000..19f653b --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/l1_metadata.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class L1Metadata(BaseModel): + """ + L1Metadata + """ # noqa: E501 + l1_address: StrictStr + can_invite: StrictBool + referral_points_percentage: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address", "can_invite", "referral_points_percentage"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of L1Metadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of L1Metadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address"), + "can_invite": obj.get("can_invite"), + "referral_points_percentage": obj.get("referral_points_percentage") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/l1_provider_info.py b/docs/lighter/lighter-python-main/lighter/models/l1_provider_info.py new file mode 100644 index 0000000..41e5a3b --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/l1_provider_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class L1ProviderInfo(BaseModel): + """ + L1ProviderInfo + """ # noqa: E501 + chain_id: StrictInt = Field(alias="chainId") + network_id: StrictInt = Field(alias="networkId") + latest_block_number: StrictInt = Field(alias="latestBlockNumber") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["chainId", "networkId", "latestBlockNumber"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of L1ProviderInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of L1ProviderInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "chainId": obj.get("chainId"), + "networkId": obj.get("networkId"), + "latestBlockNumber": obj.get("latestBlockNumber") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/liq_trade.py b/docs/lighter/lighter-python-main/lighter/models/liq_trade.py new file mode 100644 index 0000000..276042e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/liq_trade.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class LiqTrade(BaseModel): + """ + LiqTrade + """ # noqa: E501 + price: StrictStr + size: StrictStr + taker_fee: StrictStr + maker_fee: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["price", "size", "taker_fee", "maker_fee"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LiqTrade from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LiqTrade from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "price": obj.get("price"), + "size": obj.get("size"), + "taker_fee": obj.get("taker_fee"), + "maker_fee": obj.get("maker_fee") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/liquidation.py b/docs/lighter/lighter-python-main/lighter/models/liquidation.py new file mode 100644 index 0000000..aa012a4 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/liquidation.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from lighter.models.liq_trade import LiqTrade +from lighter.models.liquidation_info import LiquidationInfo +from typing import Optional, Set +from typing_extensions import Self + +class Liquidation(BaseModel): + """ + Liquidation + """ # noqa: E501 + id: StrictInt + market_id: StrictInt + type: StrictStr + trade: LiqTrade + info: LiquidationInfo + executed_at: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "market_id", "type", "trade", "info", "executed_at"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['partial', 'deleverage']): + raise ValueError("must be one of enum values ('partial', 'deleverage')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Liquidation from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of trade + if self.trade: + _dict['trade'] = self.trade.to_dict() + # override the default output from pydantic by calling `to_dict()` of info + if self.info: + _dict['info'] = self.info.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Liquidation from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "market_id": obj.get("market_id"), + "type": obj.get("type"), + "trade": LiqTrade.from_dict(obj["trade"]) if obj.get("trade") is not None else None, + "info": LiquidationInfo.from_dict(obj["info"]) if obj.get("info") is not None else None, + "executed_at": obj.get("executed_at") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/liquidation_info.py b/docs/lighter/lighter-python-main/lighter/models/liquidation_info.py new file mode 100644 index 0000000..91519d1 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/liquidation_info.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from lighter.models.account_position import AccountPosition +from lighter.models.risk_info import RiskInfo +from typing import Optional, Set +from typing_extensions import Self + +class LiquidationInfo(BaseModel): + """ + LiquidationInfo + """ # noqa: E501 + positions: List[AccountPosition] + risk_info_before: RiskInfo + risk_info_after: RiskInfo + mark_prices: Dict[str, Union[StrictFloat, StrictInt]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["positions", "risk_info_before", "risk_info_after", "mark_prices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LiquidationInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in positions (list) + _items = [] + if self.positions: + for _item in self.positions: + if _item: + _items.append(_item.to_dict()) + _dict['positions'] = _items + # override the default output from pydantic by calling `to_dict()` of risk_info_before + if self.risk_info_before: + _dict['risk_info_before'] = self.risk_info_before.to_dict() + # override the default output from pydantic by calling `to_dict()` of risk_info_after + if self.risk_info_after: + _dict['risk_info_after'] = self.risk_info_after.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LiquidationInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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, + "mark_prices": obj.get("mark_prices") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/liquidation_infos.py b/docs/lighter/lighter-python-main/lighter/models/liquidation_infos.py new file mode 100644 index 0000000..9d633d7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/liquidation_infos.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.liquidation import Liquidation +from typing import Optional, Set +from typing_extensions import Self + +class LiquidationInfos(BaseModel): + """ + LiquidationInfos + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + liquidations: List[Liquidation] + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "liquidations", "next_cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of LiquidationInfos from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in liquidations (list) + _items = [] + if self.liquidations: + for _item in self.liquidations: + if _item: + _items.append(_item.to_dict()) + _dict['liquidations'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of LiquidationInfos from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "liquidations": [Liquidation.from_dict(_item) for _item in obj["liquidations"]] if obj.get("liquidations") is not None else None, + "next_cursor": obj.get("next_cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/market_info.py b/docs/lighter/lighter-python-main/lighter/models/market_info.py new file mode 100644 index 0000000..c836971 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/market_info.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class MarketInfo(BaseModel): + """ + MarketInfo + """ # noqa: E501 + market_id: StrictInt + index_price: StrictStr + mark_price: StrictStr + open_interest: StrictStr + last_trade_price: StrictStr + current_funding_rate: StrictStr + funding_rate: StrictStr + funding_timestamp: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + daily_price_low: Union[StrictFloat, StrictInt] + daily_price_high: Union[StrictFloat, StrictInt] + daily_price_change: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __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"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of MarketInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of MarketInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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"), + "last_trade_price": obj.get("last_trade_price"), + "current_funding_rate": obj.get("current_funding_rate"), + "funding_rate": obj.get("funding_rate"), + "funding_timestamp": obj.get("funding_timestamp"), + "daily_base_token_volume": obj.get("daily_base_token_volume"), + "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") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/next_nonce.py b/docs/lighter/lighter-python-main/lighter/models/next_nonce.py new file mode 100644 index 0000000..94ab734 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/next_nonce.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class NextNonce(BaseModel): + """ + NextNonce + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + nonce: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "nonce"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of NextNonce from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of NextNonce from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "nonce": obj.get("nonce") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order.py b/docs/lighter/lighter-python-main/lighter/models/order.py new file mode 100644 index 0000000..47d6543 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order.py @@ -0,0 +1,188 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Order(BaseModel): + """ + Order + """ # noqa: E501 + order_index: StrictInt + client_order_index: StrictInt + order_id: StrictStr + client_order_id: StrictStr + market_index: StrictInt + owner_account_index: StrictInt + initial_base_amount: StrictStr + price: StrictStr + nonce: StrictInt + remaining_base_amount: StrictStr + is_ask: StrictBool + base_size: StrictInt + base_price: StrictInt + filled_base_amount: StrictStr + filled_quote_amount: StrictStr + side: StrictStr = Field(description=" TODO: remove this") + type: StrictStr + time_in_force: StrictStr + reduce_only: StrictBool + trigger_price: StrictStr + order_expiry: StrictInt + status: StrictStr + trigger_status: StrictStr + trigger_time: StrictInt + parent_order_index: StrictInt + parent_order_id: StrictStr + to_trigger_order_id_0: StrictStr + to_trigger_order_id_1: StrictStr + to_cancel_order_id_0: StrictStr + block_height: StrictInt + timestamp: StrictInt + 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", "block_height", "timestamp"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['limit', 'market', 'stop-loss', 'stop-loss-limit', 'take-profit', 'take-profit-limit', 'twap', 'twap-sub', 'liquidation']): + raise ValueError("must be one of enum values ('limit', 'market', 'stop-loss', 'stop-loss-limit', 'take-profit', 'take-profit-limit', 'twap', 'twap-sub', 'liquidation')") + return value + + @field_validator('time_in_force') + def time_in_force_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['good-till-time', 'immediate-or-cancel', 'post-only', 'Unknown']): + raise ValueError("must be one of enum values ('good-till-time', 'immediate-or-cancel', 'post-only', 'Unknown')") + return value + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['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']): + raise ValueError("must be one of enum values ('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')") + return value + + @field_validator('trigger_status') + def trigger_status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['na', 'ready', 'mark-price', 'twap', 'parent-order']): + raise ValueError("must be one of enum values ('na', 'ready', 'mark-price', 'twap', 'parent-order')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Order from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Order from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order_index": obj.get("order_index"), + "client_order_index": obj.get("client_order_index"), + "order_id": obj.get("order_id"), + "client_order_id": obj.get("client_order_id"), + "market_index": obj.get("market_index"), + "owner_account_index": obj.get("owner_account_index"), + "initial_base_amount": obj.get("initial_base_amount"), + "price": obj.get("price"), + "nonce": obj.get("nonce"), + "remaining_base_amount": obj.get("remaining_base_amount"), + "is_ask": obj.get("is_ask"), + "base_size": obj.get("base_size"), + "base_price": obj.get("base_price"), + "filled_base_amount": obj.get("filled_base_amount"), + "filled_quote_amount": obj.get("filled_quote_amount"), + "side": obj.get("side") if obj.get("side") is not None else 'buy', + "type": obj.get("type"), + "time_in_force": obj.get("time_in_force") if obj.get("time_in_force") is not None else 'good-till-time', + "reduce_only": obj.get("reduce_only"), + "trigger_price": obj.get("trigger_price"), + "order_expiry": obj.get("order_expiry"), + "status": obj.get("status"), + "trigger_status": obj.get("trigger_status"), + "trigger_time": obj.get("trigger_time"), + "parent_order_index": obj.get("parent_order_index"), + "parent_order_id": obj.get("parent_order_id"), + "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"), + "block_height": obj.get("block_height"), + "timestamp": obj.get("timestamp") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book.py b/docs/lighter/lighter-python-main/lighter/models/order_book.py new file mode 100644 index 0000000..4cbdb56 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book.py @@ -0,0 +1,127 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class OrderBook(BaseModel): + """ + OrderBook + """ # noqa: E501 + symbol: StrictStr + market_id: StrictInt + status: StrictStr + taker_fee: StrictStr + maker_fee: StrictStr + liquidation_fee: StrictStr + min_base_amount: StrictStr + min_quote_amount: StrictStr + supported_size_decimals: StrictInt + supported_price_decimals: StrictInt + supported_quote_decimals: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "market_id", "status", "taker_fee", "maker_fee", "liquidation_fee", "min_base_amount", "min_quote_amount", "supported_size_decimals", "supported_price_decimals", "supported_quote_decimals"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['inactive', 'frozen', 'active']): + raise ValueError("must be one of enum values ('inactive', 'frozen', 'active')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBook from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBook from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "symbol": obj.get("symbol"), + "market_id": obj.get("market_id"), + "status": obj.get("status"), + "taker_fee": obj.get("taker_fee"), + "maker_fee": obj.get("maker_fee"), + "liquidation_fee": obj.get("liquidation_fee"), + "min_base_amount": obj.get("min_base_amount"), + "min_quote_amount": obj.get("min_quote_amount"), + "supported_size_decimals": obj.get("supported_size_decimals"), + "supported_price_decimals": obj.get("supported_price_decimals"), + "supported_quote_decimals": obj.get("supported_quote_decimals") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book_depth.py b/docs/lighter/lighter-python-main/lighter/models/order_book_depth.py new file mode 100644 index 0000000..214d798 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book_depth.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.price_level import PriceLevel +from typing import Optional, Set +from typing_extensions import Self + +class OrderBookDepth(BaseModel): + """ + OrderBookDepth + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + asks: List[PriceLevel] + bids: List[PriceLevel] + offset: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "asks", "bids", "offset"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBookDepth from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in asks (list) + _items = [] + if self.asks: + for _item in self.asks: + if _item: + _items.append(_item.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()) + _dict['bids'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBookDepth from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "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") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book_detail.py b/docs/lighter/lighter-python-main/lighter/models/order_book_detail.py new file mode 100644 index 0000000..012a8a5 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book_detail.py @@ -0,0 +1,159 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderBookDetail(BaseModel): + """ + OrderBookDetail + """ # noqa: E501 + symbol: StrictStr + market_id: StrictInt + status: StrictStr + taker_fee: StrictStr + maker_fee: StrictStr + liquidation_fee: StrictStr + min_base_amount: StrictStr + min_quote_amount: StrictStr + supported_size_decimals: StrictInt + supported_price_decimals: StrictInt + supported_quote_decimals: StrictInt + size_decimals: StrictInt + price_decimals: StrictInt + quote_multiplier: StrictInt + default_initial_margin_fraction: StrictInt + min_initial_margin_fraction: StrictInt + maintenance_margin_fraction: StrictInt + closeout_margin_fraction: StrictInt + last_trade_price: Union[StrictFloat, StrictInt] + daily_trades_count: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + daily_price_low: Union[StrictFloat, StrictInt] + daily_price_high: Union[StrictFloat, StrictInt] + daily_price_change: Union[StrictFloat, StrictInt] + open_interest: Union[StrictFloat, StrictInt] + daily_chart: Dict[str, Union[StrictFloat, StrictInt]] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["symbol", "market_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"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['inactive', 'frozen', 'active']): + raise ValueError("must be one of enum values ('inactive', 'frozen', 'active')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBookDetail from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBookDetail from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "symbol": obj.get("symbol"), + "market_id": obj.get("market_id"), + "status": obj.get("status"), + "taker_fee": obj.get("taker_fee"), + "maker_fee": obj.get("maker_fee"), + "liquidation_fee": obj.get("liquidation_fee"), + "min_base_amount": obj.get("min_base_amount"), + "min_quote_amount": obj.get("min_quote_amount"), + "supported_size_decimals": obj.get("supported_size_decimals"), + "supported_price_decimals": obj.get("supported_price_decimals"), + "supported_quote_decimals": obj.get("supported_quote_decimals"), + "size_decimals": obj.get("size_decimals"), + "price_decimals": obj.get("price_decimals"), + "quote_multiplier": obj.get("quote_multiplier"), + "default_initial_margin_fraction": obj.get("default_initial_margin_fraction"), + "min_initial_margin_fraction": obj.get("min_initial_margin_fraction"), + "maintenance_margin_fraction": obj.get("maintenance_margin_fraction"), + "closeout_margin_fraction": obj.get("closeout_margin_fraction"), + "last_trade_price": obj.get("last_trade_price"), + "daily_trades_count": obj.get("daily_trades_count"), + "daily_base_token_volume": obj.get("daily_base_token_volume"), + "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"), + "open_interest": obj.get("open_interest"), + "daily_chart": obj.get("daily_chart") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book_details.py b/docs/lighter/lighter-python-main/lighter/models/order_book_details.py new file mode 100644 index 0000000..a67276f --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book_details.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.order_book_detail import OrderBookDetail +from typing import Optional, Set +from typing_extensions import Self + +class OrderBookDetails(BaseModel): + """ + OrderBookDetails + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + order_book_details: List[OrderBookDetail] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "order_book_details"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBookDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in order_book_details (list) + _items = [] + if self.order_book_details: + for _item in self.order_book_details: + if _item: + _items.append(_item.to_dict()) + _dict['order_book_details'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBookDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "order_book_details": [OrderBookDetail.from_dict(_item) for _item in obj["order_book_details"]] if obj.get("order_book_details") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book_orders.py b/docs/lighter/lighter-python-main/lighter/models/order_book_orders.py new file mode 100644 index 0000000..549d79c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book_orders.py @@ -0,0 +1,125 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.simple_order import SimpleOrder +from typing import Optional, Set +from typing_extensions import Self + +class OrderBookOrders(BaseModel): + """ + OrderBookOrders + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + total_asks: StrictInt + asks: List[SimpleOrder] + total_bids: StrictInt + bids: List[SimpleOrder] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "total_asks", "asks", "total_bids", "bids"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBookOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in asks (list) + _items = [] + if self.asks: + for _item in self.asks: + if _item: + _items.append(_item.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()) + _dict['bids'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBookOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "total_asks": obj.get("total_asks"), + "asks": [SimpleOrder.from_dict(_item) for _item in obj["asks"]] if obj.get("asks") is not None else None, + "total_bids": obj.get("total_bids"), + "bids": [SimpleOrder.from_dict(_item) for _item in obj["bids"]] if obj.get("bids") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_book_stats.py b/docs/lighter/lighter-python-main/lighter/models/order_book_stats.py new file mode 100644 index 0000000..5f09676 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_book_stats.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class OrderBookStats(BaseModel): + """ + OrderBookStats + """ # noqa: E501 + symbol: StrictStr + last_trade_price: Union[StrictFloat, StrictInt] + daily_trades_count: StrictInt + daily_base_token_volume: Union[StrictFloat, StrictInt] + daily_quote_token_volume: Union[StrictFloat, StrictInt] + daily_price_change: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBookStats from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBookStats from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "symbol": obj.get("symbol"), + "last_trade_price": obj.get("last_trade_price"), + "daily_trades_count": obj.get("daily_trades_count"), + "daily_base_token_volume": obj.get("daily_base_token_volume"), + "daily_quote_token_volume": obj.get("daily_quote_token_volume"), + "daily_price_change": obj.get("daily_price_change") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/order_books.py b/docs/lighter/lighter-python-main/lighter/models/order_books.py new file mode 100644 index 0000000..f7cc8e8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/order_books.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.order_book import OrderBook +from typing import Optional, Set +from typing_extensions import Self + +class OrderBooks(BaseModel): + """ + OrderBooks + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + order_books: List[OrderBook] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "order_books"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of OrderBooks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in order_books (list) + _items = [] + if self.order_books: + for _item in self.order_books: + if _item: + _items.append(_item.to_dict()) + _dict['order_books'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of OrderBooks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "order_books": [OrderBook.from_dict(_item) for _item in obj["order_books"]] if obj.get("order_books") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/orders.py b/docs/lighter/lighter-python-main/lighter/models/orders.py new file mode 100644 index 0000000..b494259 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/orders.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.order import Order +from typing import Optional, Set +from typing_extensions import Self + +class Orders(BaseModel): + """ + Orders + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + next_cursor: Optional[StrictStr] = None + orders: List[Order] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "orders"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Orders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in orders (list) + _items = [] + if self.orders: + for _item in self.orders: + if _item: + _items.append(_item.to_dict()) + _dict['orders'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Orders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "next_cursor": obj.get("next_cursor"), + "orders": [Order.from_dict(_item) for _item in obj["orders"]] if obj.get("orders") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/pn_l_entry.py b/docs/lighter/lighter-python-main/lighter/models/pn_l_entry.py new file mode 100644 index 0000000..5bedea7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/pn_l_entry.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class PnLEntry(BaseModel): + """ + PnLEntry + """ # noqa: E501 + timestamp: StrictInt + trade_pnl: Union[StrictFloat, StrictInt] + inflow: Union[StrictFloat, StrictInt] + outflow: Union[StrictFloat, StrictInt] + pool_pnl: Union[StrictFloat, StrictInt] + pool_inflow: Union[StrictFloat, StrictInt] + pool_outflow: Union[StrictFloat, StrictInt] + pool_total_shares: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "trade_pnl", "inflow", "outflow", "pool_pnl", "pool_inflow", "pool_outflow", "pool_total_shares"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PnLEntry from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PnLEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "trade_pnl": obj.get("trade_pnl"), + "inflow": obj.get("inflow"), + "outflow": obj.get("outflow"), + "pool_pnl": obj.get("pool_pnl"), + "pool_inflow": obj.get("pool_inflow"), + "pool_outflow": obj.get("pool_outflow"), + "pool_total_shares": obj.get("pool_total_shares") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/position_funding.py b/docs/lighter/lighter-python-main/lighter/models/position_funding.py new file mode 100644 index 0000000..1fee27f --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/position_funding.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PositionFunding(BaseModel): + """ + PositionFunding + """ # noqa: E501 + timestamp: StrictInt + market_id: StrictInt + funding_id: StrictInt + change: StrictStr + rate: StrictStr + position_size: StrictStr + position_side: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "market_id", "funding_id", "change", "rate", "position_size", "position_side"] + + @field_validator('position_side') + def position_side_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['long', 'short']): + raise ValueError("must be one of enum values ('long', 'short')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PositionFunding from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PositionFunding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "market_id": obj.get("market_id"), + "funding_id": obj.get("funding_id"), + "change": obj.get("change"), + "rate": obj.get("rate"), + "position_size": obj.get("position_size"), + "position_side": obj.get("position_side") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/position_fundings.py b/docs/lighter/lighter-python-main/lighter/models/position_fundings.py new file mode 100644 index 0000000..fcd8677 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/position_fundings.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.position_funding import PositionFunding +from typing import Optional, Set +from typing_extensions import Self + +class PositionFundings(BaseModel): + """ + PositionFundings + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + position_fundings: List[PositionFunding] + next_cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "position_fundings", "next_cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PositionFundings from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in position_fundings (list) + _items = [] + if self.position_fundings: + for _item in self.position_fundings: + if _item: + _items.append(_item.to_dict()) + _dict['position_fundings'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PositionFundings from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "position_fundings": [PositionFunding.from_dict(_item) for _item in obj["position_fundings"]] if obj.get("position_fundings") is not None else None, + "next_cursor": obj.get("next_cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/price_level.py b/docs/lighter/lighter-python-main/lighter/models/price_level.py new file mode 100644 index 0000000..dc5b081 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/price_level.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PriceLevel(BaseModel): + """ + PriceLevel + """ # noqa: E501 + price: StrictStr + size: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["price", "size"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PriceLevel from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PriceLevel from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "price": obj.get("price"), + "size": obj.get("size") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/public_pool.py b/docs/lighter/lighter-python-main/lighter/models/public_pool.py new file mode 100644 index 0000000..5d9b61a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/public_pool.py @@ -0,0 +1,148 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.public_pool_info import PublicPoolInfo +from lighter.models.public_pool_share import PublicPoolShare +from typing import Optional, Set +from typing_extensions import Self + +class PublicPool(BaseModel): + """ + PublicPool + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_type: StrictInt + index: StrictInt + l1_address: StrictStr + cancel_all_time: StrictInt + total_order_count: StrictInt + total_isolated_order_count: StrictInt + pending_order_count: StrictInt + available_balance: StrictStr + status: StrictInt + collateral: StrictStr + 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") + total_asset_value: StrictStr + cross_asset_value: StrictStr + pool_info: PublicPoolInfo + account_share: Optional[PublicPoolShare] = 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", "account_index", "name", "description", "can_invite", "referral_points_percentage", "total_asset_value", "cross_asset_value", "pool_info", "account_share"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPool from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of pool_info + if self.pool_info: + _dict['pool_info'] = self.pool_info.to_dict() + # override the default output from pydantic by calling `to_dict()` of account_share + if self.account_share: + _dict['account_share'] = self.account_share.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPool from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_type": obj.get("account_type"), + "index": obj.get("index"), + "l1_address": obj.get("l1_address"), + "cancel_all_time": obj.get("cancel_all_time"), + "total_order_count": obj.get("total_order_count"), + "total_isolated_order_count": obj.get("total_isolated_order_count"), + "pending_order_count": obj.get("pending_order_count"), + "available_balance": obj.get("available_balance"), + "status": obj.get("status"), + "collateral": obj.get("collateral"), + "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"), + "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, + "account_share": PublicPoolShare.from_dict(obj["account_share"]) if obj.get("account_share") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/public_pool_info.py b/docs/lighter/lighter-python-main/lighter/models/public_pool_info.py new file mode 100644 index 0000000..7ee99d5 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/public_pool_info.py @@ -0,0 +1,130 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Union +from lighter.models.daily_return import DailyReturn +from lighter.models.share_price import SharePrice +from typing import Optional, Set +from typing_extensions import Self + +class PublicPoolInfo(BaseModel): + """ + PublicPoolInfo + """ # noqa: E501 + status: StrictInt + operator_fee: StrictStr + min_operator_share_rate: StrictStr + total_shares: StrictInt + operator_shares: StrictInt + annual_percentage_yield: Union[StrictFloat, StrictInt] + daily_returns: List[DailyReturn] + share_prices: List[SharePrice] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["status", "operator_fee", "min_operator_share_rate", "total_shares", "operator_shares", "annual_percentage_yield", "daily_returns", "share_prices"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPoolInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in daily_returns (list) + _items = [] + if self.daily_returns: + for _item in self.daily_returns: + if _item: + _items.append(_item.to_dict()) + _dict['daily_returns'] = _items + # override the default output from pydantic by calling `to_dict()` of each item in share_prices (list) + _items = [] + if self.share_prices: + for _item in self.share_prices: + if _item: + _items.append(_item.to_dict()) + _dict['share_prices'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPoolInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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"), + "daily_returns": [DailyReturn.from_dict(_item) for _item in obj["daily_returns"]] if obj.get("daily_returns") is not None else None, + "share_prices": [SharePrice.from_dict(_item) for _item in obj["share_prices"]] if obj.get("share_prices") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/public_pool_metadata.py b/docs/lighter/lighter-python-main/lighter/models/public_pool_metadata.py new file mode 100644 index 0000000..a0c5359 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/public_pool_metadata.py @@ -0,0 +1,126 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional, Union +from lighter.models.public_pool_share import PublicPoolShare +from typing import Optional, Set +from typing_extensions import Self + +class PublicPoolMetadata(BaseModel): + """ + PublicPoolMetadata + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + account_index: StrictInt + account_type: StrictInt + name: StrictStr + l1_address: StrictStr + annual_percentage_yield: Union[StrictFloat, StrictInt] + status: StrictInt + operator_fee: StrictStr + total_asset_value: StrictStr + total_shares: StrictInt + account_share: Optional[PublicPoolShare] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "account_index", "account_type", "name", "l1_address", "annual_percentage_yield", "status", "operator_fee", "total_asset_value", "total_shares", "account_share"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPoolMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of account_share + if self.account_share: + _dict['account_share'] = self.account_share.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPoolMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "account_index": obj.get("account_index"), + "account_type": obj.get("account_type"), + "name": obj.get("name"), + "l1_address": obj.get("l1_address"), + "annual_percentage_yield": obj.get("annual_percentage_yield"), + "status": obj.get("status"), + "operator_fee": obj.get("operator_fee"), + "total_asset_value": obj.get("total_asset_value"), + "total_shares": obj.get("total_shares"), + "account_share": PublicPoolShare.from_dict(obj["account_share"]) if obj.get("account_share") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/public_pool_share.py b/docs/lighter/lighter-python-main/lighter/models/public_pool_share.py new file mode 100644 index 0000000..0261075 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/public_pool_share.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class PublicPoolShare(BaseModel): + """ + PublicPoolShare + """ # noqa: E501 + public_pool_index: StrictInt + shares_amount: StrictInt + entry_usdc: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["public_pool_index", "shares_amount", "entry_usdc"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPoolShare from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPoolShare from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "public_pool_index": obj.get("public_pool_index"), + "shares_amount": obj.get("shares_amount"), + "entry_usdc": obj.get("entry_usdc") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/public_pools.py b/docs/lighter/lighter-python-main/lighter/models/public_pools.py new file mode 100644 index 0000000..1ad4092 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/public_pools.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.public_pool import PublicPool +from typing import Optional, Set +from typing_extensions import Self + +class PublicPools(BaseModel): + """ + PublicPools + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + total: StrictInt + public_pools: List[PublicPool] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "total", "public_pools"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of PublicPools from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in public_pools (list) + _items = [] + if self.public_pools: + for _item in self.public_pools: + if _item: + _items.append(_item.to_dict()) + _dict['public_pools'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of PublicPools from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "total": obj.get("total"), + "public_pools": [PublicPool.from_dict(_item) for _item in obj["public_pools"]] if obj.get("public_pools") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/referral_point_entry.py b/docs/lighter/lighter-python-main/lighter/models/referral_point_entry.py new file mode 100644 index 0000000..fdce287 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/referral_point_entry.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReferralPointEntry(BaseModel): + """ + ReferralPointEntry + """ # noqa: E501 + l1_address: StrictStr + total_points: StrictInt + week_points: StrictInt + total_reward_points: StrictInt + week_reward_points: StrictInt + reward_point_multiplier: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address", "total_points", "week_points", "total_reward_points", "week_reward_points", "reward_point_multiplier"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralPointEntry from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralPointEntry from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address"), + "total_points": obj.get("total_points"), + "week_points": obj.get("week_points"), + "total_reward_points": obj.get("total_reward_points"), + "week_reward_points": obj.get("week_reward_points"), + "reward_point_multiplier": obj.get("reward_point_multiplier") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/referral_points.py b/docs/lighter/lighter-python-main/lighter/models/referral_points.py new file mode 100644 index 0000000..5a162dc --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/referral_points.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.referral_point_entry import ReferralPointEntry +from typing import Optional, Set +from typing_extensions import Self + +class ReferralPoints(BaseModel): + """ + ReferralPoints + """ # noqa: E501 + referrals: List[ReferralPointEntry] + user_total_points: StrictInt + user_last_week_points: StrictInt + user_total_referral_reward_points: StrictInt + user_last_week_referral_reward_points: StrictInt + reward_point_multiplier: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["referrals", "user_total_points", "user_last_week_points", "user_total_referral_reward_points", "user_last_week_referral_reward_points", "reward_point_multiplier"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReferralPoints from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in referrals (list) + _items = [] + if self.referrals: + for _item in self.referrals: + if _item: + _items.append(_item.to_dict()) + _dict['referrals'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReferralPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "referrals": [ReferralPointEntry.from_dict(_item) for _item in obj["referrals"]] if obj.get("referrals") is not None else None, + "user_total_points": obj.get("user_total_points"), + "user_last_week_points": obj.get("user_last_week_points"), + "user_total_referral_reward_points": obj.get("user_total_referral_reward_points"), + "user_last_week_referral_reward_points": obj.get("user_last_week_referral_reward_points"), + "reward_point_multiplier": obj.get("reward_point_multiplier") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_export_data.py b/docs/lighter/lighter-python-main/lighter/models/req_export_data.py new file mode 100644 index 0000000..d82b64e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_export_data.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqExportData(BaseModel): + """ + ReqExportData + """ # noqa: E501 + auth: Optional[StrictStr] = None + account_index: Optional[StrictInt] = -1 + market_id: Optional[StrictInt] = None + type: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "type"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['funding', 'trade']): + raise ValueError("must be one of enum values ('funding', 'trade')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqExportData from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqExportData from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "market_id": obj.get("market_id"), + "type": obj.get("type") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account.py new file mode 100644 index 0000000..c6108e6 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccount(BaseModel): + """ + ReqGetAccount + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index', 'l1_address']): + raise ValueError("must be one of enum values ('index', 'l1_address')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_active_orders.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_active_orders.py new file mode 100644 index 0000000..bf3daff --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_active_orders.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountActiveOrders(BaseModel): + """ + ReqGetAccountActiveOrders + """ # noqa: E501 + account_index: StrictInt + market_id: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "market_id", "auth"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountActiveOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountActiveOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_api_keys.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_api_keys.py new file mode 100644 index 0000000..2a395ad --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_api_keys.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountApiKeys(BaseModel): + """ + ReqGetAccountApiKeys + """ # noqa: E501 + account_index: StrictInt + api_key_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountApiKeys from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountApiKeys from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "api_key_index": obj.get("api_key_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_by_l1_address.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_by_l1_address.py new file mode 100644 index 0000000..a0b86eb --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_by_l1_address.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountByL1Address(BaseModel): + """ + ReqGetAccountByL1Address + """ # noqa: E501 + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountByL1Address from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountByL1Address from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_inactive_orders.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_inactive_orders.py new file mode 100644 index 0000000..9ea9b18 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_inactive_orders.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountInactiveOrders(BaseModel): + """ + ReqGetAccountInactiveOrders + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + market_id: Optional[StrictInt] = None + ask_filter: Optional[StrictInt] = None + between_timestamps: Optional[StrictStr] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "ask_filter", "between_timestamps", "cursor", "limit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountInactiveOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountInactiveOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "ask_filter": obj.get("ask_filter"), + "between_timestamps": obj.get("between_timestamps"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_limits.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_limits.py new file mode 100644 index 0000000..206f876 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_limits.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountLimits(BaseModel): + """ + ReqGetAccountLimits + """ # noqa: E501 + 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]] = ["account_index", "auth"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountLimits from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountLimits from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_metadata.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_metadata.py new file mode 100644 index 0000000..4403e9d --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_metadata.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountMetadata(BaseModel): + """ + ReqGetAccountMetadata + """ # noqa: E501 + by: StrictStr + value: StrictStr + auth: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value", "auth"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index', 'l1_address']): + raise ValueError("must be one of enum values ('index', 'l1_address')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_pn_l.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_pn_l.py new file mode 100644 index 0000000..034022c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_pn_l.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountPnL(BaseModel): + """ + ReqGetAccountPnL + """ # noqa: E501 + auth: Optional[StrictStr] = None + by: StrictStr + value: StrictStr + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + ignore_transfers: Optional[StrictBool] = False + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "by", "value", "resolution", "start_timestamp", "end_timestamp", "count_back", "ignore_transfers"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['index']): + raise ValueError("must be one of enum values ('index')") + return value + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1m', '5m', '15m', '1h', '4h', '1d']): + raise ValueError("must be one of enum values ('1m', '5m', '15m', '1h', '4h', '1d')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountPnL from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountPnL from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "by": obj.get("by"), + "value": obj.get("value"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back"), + "ignore_transfers": obj.get("ignore_transfers") if obj.get("ignore_transfers") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_account_txs.py b/docs/lighter/lighter-python-main/lighter/models/req_get_account_txs.py new file mode 100644 index 0000000..6c785f6 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_account_txs.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetAccountTxs(BaseModel): + """ + ReqGetAccountTxs + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None + by: Optional[StrictStr] = None + value: Optional[StrictStr] = None + types: Optional[List[StrictInt]] = None + auth: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit", "by", "value", "types", "auth"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['account_index']): + raise ValueError("must be one of enum values ('account_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetAccountTxs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetAccountTxs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "limit": obj.get("limit"), + "by": obj.get("by"), + "value": obj.get("value"), + "types": obj.get("types"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_block.py b/docs/lighter/lighter-python-main/lighter/models/req_get_block.py new file mode 100644 index 0000000..574e2c7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_block.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetBlock(BaseModel): + """ + ReqGetBlock + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['commitment', 'height']): + raise ValueError("must be one of enum values ('commitment', 'height')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetBlock from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetBlock from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_block_txs.py b/docs/lighter/lighter-python-main/lighter/models/req_get_block_txs.py new file mode 100644 index 0000000..b040c5e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_block_txs.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetBlockTxs(BaseModel): + """ + ReqGetBlockTxs + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['block_height', 'block_commitment']): + raise ValueError("must be one of enum values ('block_height', 'block_commitment')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetBlockTxs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetBlockTxs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_by_account.py b/docs/lighter/lighter-python-main/lighter/models/req_get_by_account.py new file mode 100644 index 0000000..9e52c14 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_by_account.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetByAccount(BaseModel): + """ + ReqGetByAccount + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['account_index']): + raise ValueError("must be one of enum values ('account_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetByAccount from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetByAccount from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_candlesticks.py b/docs/lighter/lighter-python-main/lighter/models/req_get_candlesticks.py new file mode 100644 index 0000000..0fc9642 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_candlesticks.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetCandlesticks(BaseModel): + """ + ReqGetCandlesticks + """ # noqa: E501 + market_id: StrictInt + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + set_timestamp_to_end: Optional[StrictBool] = False + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "resolution", "start_timestamp", "end_timestamp", "count_back", "set_timestamp_to_end"] + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1m', '5m', '15m', '1h', '4h', '1d']): + raise ValueError("must be one of enum values ('1m', '5m', '15m', '1h', '4h', '1d')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetCandlesticks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetCandlesticks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back"), + "set_timestamp_to_end": obj.get("set_timestamp_to_end") if obj.get("set_timestamp_to_end") is not None else False + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_deposit_history.py b/docs/lighter/lighter-python-main/lighter/models/req_get_deposit_history.py new file mode 100644 index 0000000..b51846c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_deposit_history.py @@ -0,0 +1,118 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetDepositHistory(BaseModel): + """ + ReqGetDepositHistory + """ # noqa: E501 + 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]] = ["account_index", "auth", "l1_address", "cursor", "filter"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'pending', 'claimable']): + raise ValueError("must be one of enum values ('all', 'pending', 'claimable')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetDepositHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetDepositHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth"), + "l1_address": obj.get("l1_address"), + "cursor": obj.get("cursor"), + "filter": obj.get("filter") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_fast_withdraw_info.py b/docs/lighter/lighter-python-main/lighter/models/req_get_fast_withdraw_info.py new file mode 100644 index 0000000..bced0a8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_fast_withdraw_info.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetFastWithdrawInfo(BaseModel): + """ + ReqGetFastWithdrawInfo + """ # noqa: E501 + 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]] = ["account_index", "auth"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetFastWithdrawInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetFastWithdrawInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_fundings.py b/docs/lighter/lighter-python-main/lighter/models/req_get_fundings.py new file mode 100644 index 0000000..d2fe9a5 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_fundings.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetFundings(BaseModel): + """ + ReqGetFundings + """ # noqa: E501 + market_id: StrictInt + resolution: StrictStr + start_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + end_timestamp: Annotated[int, Field(le=5000000000000, strict=True)] + count_back: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id", "resolution", "start_timestamp", "end_timestamp", "count_back"] + + @field_validator('resolution') + def resolution_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['1h', '1d']): + raise ValueError("must be one of enum values ('1h', '1d')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetFundings from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetFundings from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "resolution": obj.get("resolution"), + "start_timestamp": obj.get("start_timestamp"), + "end_timestamp": obj.get("end_timestamp"), + "count_back": obj.get("count_back") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_l1_metadata.py b/docs/lighter/lighter-python-main/lighter/models/req_get_l1_metadata.py new file mode 100644 index 0000000..0ce494a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_l1_metadata.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetL1Metadata(BaseModel): + """ + ReqGetL1Metadata + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "l1_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetL1Metadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetL1Metadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "l1_address": obj.get("l1_address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_l1_tx.py b/docs/lighter/lighter-python-main/lighter/models/req_get_l1_tx.py new file mode 100644 index 0000000..dda8501 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_l1_tx.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetL1Tx(BaseModel): + """ + ReqGetL1Tx + """ # noqa: E501 + hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["hash"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetL1Tx from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetL1Tx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "hash": obj.get("hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_latest_deposit.py b/docs/lighter/lighter-python-main/lighter/models/req_get_latest_deposit.py new file mode 100644 index 0000000..6ce2506 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_latest_deposit.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetLatestDeposit(BaseModel): + """ + ReqGetLatestDeposit + """ # noqa: E501 + l1_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["l1_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetLatestDeposit from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetLatestDeposit from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "l1_address": obj.get("l1_address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_liquidation_infos.py b/docs/lighter/lighter-python-main/lighter/models/req_get_liquidation_infos.py new file mode 100644 index 0000000..16701b7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_liquidation_infos.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetLiquidationInfos(BaseModel): + """ + ReqGetLiquidationInfos + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + market_id: Optional[StrictInt] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "cursor", "limit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetLiquidationInfos from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetLiquidationInfos from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_next_nonce.py b/docs/lighter/lighter-python-main/lighter/models/req_get_next_nonce.py new file mode 100644 index 0000000..90920a0 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_next_nonce.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetNextNonce(BaseModel): + """ + ReqGetNextNonce + """ # noqa: E501 + account_index: StrictInt + api_key_index: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "api_key_index"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetNextNonce from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetNextNonce from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "api_key_index": obj.get("api_key_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_details.py b/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_details.py new file mode 100644 index 0000000..e38a012 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_details.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetOrderBookDetails(BaseModel): + """ + ReqGetOrderBookDetails + """ # noqa: E501 + market_id: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetOrderBookDetails from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetOrderBookDetails from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_orders.py b/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_orders.py new file mode 100644 index 0000000..52c008f --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_order_book_orders.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetOrderBookOrders(BaseModel): + """ + ReqGetOrderBookOrders + """ # noqa: E501 + market_id: StrictInt + 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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetOrderBookOrders from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetOrderBookOrders from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_order_books.py b/docs/lighter/lighter-python-main/lighter/models/req_get_order_books.py new file mode 100644 index 0000000..9608c4b --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_order_books.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetOrderBooks(BaseModel): + """ + ReqGetOrderBooks + """ # noqa: E501 + market_id: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["market_id"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetOrderBooks from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetOrderBooks from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_position_funding.py b/docs/lighter/lighter-python-main/lighter/models/req_get_position_funding.py new file mode 100644 index 0000000..04d07f8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_position_funding.py @@ -0,0 +1,121 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPositionFunding(BaseModel): + """ + ReqGetPositionFunding + """ # noqa: E501 + auth: Optional[StrictStr] = None + account_index: StrictInt + market_id: Optional[StrictInt] = None + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + side: Optional[StrictStr] = 'all' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "market_id", "cursor", "limit", "side"] + + @field_validator('side') + def side_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['long', 'short', 'all']): + raise ValueError("must be one of enum values ('long', 'short', 'all')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetPositionFunding from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetPositionFunding from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index"), + "market_id": obj.get("market_id"), + "cursor": obj.get("cursor"), + "limit": obj.get("limit"), + "side": obj.get("side") if obj.get("side") is not None else 'all' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools.py b/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools.py new file mode 100644 index 0000000..94786e4 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPublicPools(BaseModel): + """ + ReqGetPublicPools + """ # noqa: E501 + auth: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + index: StrictInt + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + account_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "filter", "index", "limit", "account_index"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'user', 'protocol', 'account_index']): + raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetPublicPools from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetPublicPools from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "filter": obj.get("filter"), + "index": obj.get("index"), + "limit": obj.get("limit"), + "account_index": obj.get("account_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools_metadata.py b/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools_metadata.py new file mode 100644 index 0000000..ccb7397 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_public_pools_metadata.py @@ -0,0 +1,119 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetPublicPoolsMetadata(BaseModel): + """ + ReqGetPublicPoolsMetadata + """ # noqa: E501 + auth: Optional[StrictStr] = None + filter: Optional[StrictStr] = None + index: StrictInt + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + account_index: Optional[StrictInt] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "filter", "index", "limit", "account_index"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'user', 'protocol', 'account_index']): + raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetPublicPoolsMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetPublicPoolsMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "filter": obj.get("filter"), + "index": obj.get("index"), + "limit": obj.get("limit"), + "account_index": obj.get("account_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_cursor.py b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_cursor.py new file mode 100644 index 0000000..dc7821e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_cursor.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithCursor(BaseModel): + """ + ReqGetRangeWithCursor + """ # noqa: E501 + cursor: Optional[StrictStr] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cursor", "limit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetRangeWithCursor from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetRangeWithCursor from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "cursor": obj.get("cursor"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index.py b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index.py new file mode 100644 index 0000000..e589449 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithIndex(BaseModel): + """ + ReqGetRangeWithIndex + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetRangeWithIndex from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetRangeWithIndex from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "index": obj.get("index"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index_sortable.py b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index_sortable.py new file mode 100644 index 0000000..d22bbb2 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_range_with_index_sortable.py @@ -0,0 +1,115 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRangeWithIndexSortable(BaseModel): + """ + ReqGetRangeWithIndexSortable + """ # noqa: E501 + index: Optional[StrictInt] = None + limit: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None + sort: Optional[StrictStr] = 'asc' + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["index", "limit", "sort"] + + @field_validator('sort') + def sort_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['asc', 'desc']): + raise ValueError("must be one of enum values ('asc', 'desc')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetRangeWithIndexSortable from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetRangeWithIndexSortable from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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' + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_recent_trades.py b/docs/lighter/lighter-python-main/lighter/models/req_get_recent_trades.py new file mode 100644 index 0000000..96dba79 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_recent_trades.py @@ -0,0 +1,103 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetRecentTrades(BaseModel): + """ + ReqGetRecentTrades + """ # noqa: E501 + market_id: StrictInt + 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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetRecentTrades from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetRecentTrades from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_referral_points.py b/docs/lighter/lighter-python-main/lighter/models/req_get_referral_points.py new file mode 100644 index 0000000..19192ec --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_referral_points.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetReferralPoints(BaseModel): + """ + ReqGetReferralPoints + """ # noqa: E501 + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + account_index: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetReferralPoints from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetReferralPoints from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "account_index": obj.get("account_index") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_trades.py b/docs/lighter/lighter-python-main/lighter/models/req_get_trades.py new file mode 100644 index 0000000..c760bce --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_trades.py @@ -0,0 +1,136 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTrades(BaseModel): + """ + ReqGetTrades + """ # noqa: E501 + auth: Optional[StrictStr] = None + market_id: Optional[StrictInt] = None + account_index: Optional[StrictInt] = -1 + 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") + ask_filter: Optional[StrictInt] = None + limit: Annotated[int, Field(le=100, strict=True, ge=1)] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "market_id", "account_index", "order_index", "sort_by", "sort_dir", "cursor", "from", "ask_filter", "limit"] + + @field_validator('sort_by') + def sort_by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['block_height', 'timestamp', 'trade_id']): + raise ValueError("must be one of enum values ('block_height', 'timestamp', 'trade_id')") + return value + + @field_validator('sort_dir') + def sort_dir_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['desc']): + raise ValueError("must be one of enum values ('desc')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetTrades from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetTrades from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "market_id": obj.get("market_id"), + "account_index": obj.get("account_index") if obj.get("account_index") is not None else -1, + "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, + "ask_filter": obj.get("ask_filter"), + "limit": obj.get("limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_fee_info.py b/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_fee_info.py new file mode 100644 index 0000000..1d053be --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_fee_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTransferFeeInfo(BaseModel): + """ + ReqGetTransferFeeInfo + """ # noqa: E501 + auth: Optional[StrictStr] = None + account_index: StrictInt + to_account_index: Optional[StrictInt] = -1 + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["auth", "account_index", "to_account_index"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetTransferFeeInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetTransferFeeInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "auth": obj.get("auth"), + "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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_history.py b/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_history.py new file mode 100644 index 0000000..b6b75ba --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_transfer_history.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTransferHistory(BaseModel): + """ + ReqGetTransferHistory + """ # noqa: E501 + account_index: StrictInt + auth: Optional[StrictStr] = Field(default=None, description=" made optional to support header auth clients") + cursor: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["account_index", "auth", "cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetTransferHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetTransferHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth"), + "cursor": obj.get("cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_tx.py b/docs/lighter/lighter-python-main/lighter/models/req_get_tx.py new file mode 100644 index 0000000..275c4ff --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_tx.py @@ -0,0 +1,109 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetTx(BaseModel): + """ + ReqGetTx + """ # noqa: E501 + by: StrictStr + value: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["by", "value"] + + @field_validator('by') + def by_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['hash', 'sequence_index']): + raise ValueError("must be one of enum values ('hash', 'sequence_index')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetTx from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetTx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "by": obj.get("by"), + "value": obj.get("value") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/req_get_withdraw_history.py b/docs/lighter/lighter-python-main/lighter/models/req_get_withdraw_history.py new file mode 100644 index 0000000..ecd05c7 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/req_get_withdraw_history.py @@ -0,0 +1,116 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ReqGetWithdrawHistory(BaseModel): + """ + ReqGetWithdrawHistory + """ # noqa: E501 + 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]] = ["account_index", "auth", "cursor", "filter"] + + @field_validator('filter') + def filter_validate_enum(cls, value): + """Validates the enum""" + if value is None: + return value + + if value not in set(['all', 'pending', 'claimable']): + raise ValueError("must be one of enum values ('all', 'pending', 'claimable')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ReqGetWithdrawHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ReqGetWithdrawHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "account_index": obj.get("account_index"), + "auth": obj.get("auth"), + "cursor": obj.get("cursor"), + "filter": obj.get("filter") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_change_account_tier.py b/docs/lighter/lighter-python-main/lighter/models/resp_change_account_tier.py new file mode 100644 index 0000000..35b6c15 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_change_account_tier.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespChangeAccountTier(BaseModel): + """ + RespChangeAccountTier + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespChangeAccountTier from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespChangeAccountTier from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_get_fast_bridge_info.py b/docs/lighter/lighter-python-main/lighter/models/resp_get_fast_bridge_info.py new file mode 100644 index 0000000..baf3922 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_get_fast_bridge_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespGetFastBridgeInfo(BaseModel): + """ + RespGetFastBridgeInfo + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + fast_bridge_limit: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "fast_bridge_limit"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespGetFastBridgeInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespGetFastBridgeInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "fast_bridge_limit": obj.get("fast_bridge_limit") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_public_pools_metadata.py b/docs/lighter/lighter-python-main/lighter/models/resp_public_pools_metadata.py new file mode 100644 index 0000000..0719da8 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_public_pools_metadata.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.public_pool_metadata import PublicPoolMetadata +from typing import Optional, Set +from typing_extensions import Self + +class RespPublicPoolsMetadata(BaseModel): + """ + RespPublicPoolsMetadata + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + public_pools: List[PublicPoolMetadata] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "public_pools"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespPublicPoolsMetadata from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in public_pools (list) + _items = [] + if self.public_pools: + for _item in self.public_pools: + if _item: + _items.append(_item.to_dict()) + _dict['public_pools'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespPublicPoolsMetadata from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "public_pools": [PublicPoolMetadata.from_dict(_item) for _item in obj["public_pools"]] if obj.get("public_pools") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_send_tx.py b/docs/lighter/lighter-python-main/lighter/models/resp_send_tx.py new file mode 100644 index 0000000..cc6adcc --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_send_tx.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespSendTx(BaseModel): + """ + RespSendTx + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + tx_hash: StrictStr + predicted_execution_time_ms: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "tx_hash", "predicted_execution_time_ms"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespSendTx from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespSendTx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "tx_hash": obj.get("tx_hash"), + "predicted_execution_time_ms": obj.get("predicted_execution_time_ms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_send_tx_batch.py b/docs/lighter/lighter-python-main/lighter/models/resp_send_tx_batch.py new file mode 100644 index 0000000..2b16358 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_send_tx_batch.py @@ -0,0 +1,106 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class RespSendTxBatch(BaseModel): + """ + RespSendTxBatch + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + tx_hash: List[StrictStr] + predicted_execution_time_ms: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "tx_hash", "predicted_execution_time_ms"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespSendTxBatch from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespSendTxBatch from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "tx_hash": obj.get("tx_hash"), + "predicted_execution_time_ms": obj.get("predicted_execution_time_ms") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/resp_withdrawal_delay.py b/docs/lighter/lighter-python-main/lighter/models/resp_withdrawal_delay.py new file mode 100644 index 0000000..3add899 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/resp_withdrawal_delay.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class RespWithdrawalDelay(BaseModel): + """ + RespWithdrawalDelay + """ # noqa: E501 + seconds: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["seconds"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RespWithdrawalDelay from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RespWithdrawalDelay from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "seconds": obj.get("seconds") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/result_code.py b/docs/lighter/lighter-python-main/lighter/models/result_code.py new file mode 100644 index 0000000..a29a276 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/result_code.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class ResultCode(BaseModel): + """ + ResultCode + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ResultCode from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ResultCode from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/risk_info.py b/docs/lighter/lighter-python-main/lighter/models/risk_info.py new file mode 100644 index 0000000..93d571e --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/risk_info.py @@ -0,0 +1,113 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict +from typing import Any, ClassVar, Dict, List +from lighter.models.risk_parameters import RiskParameters +from typing import Optional, Set +from typing_extensions import Self + +class RiskInfo(BaseModel): + """ + RiskInfo + """ # noqa: E501 + cross_risk_parameters: RiskParameters + isolated_risk_parameters: List[RiskParameters] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["cross_risk_parameters", "isolated_risk_parameters"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RiskInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of cross_risk_parameters + if self.cross_risk_parameters: + _dict['cross_risk_parameters'] = self.cross_risk_parameters.to_dict() + # 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()) + _dict['isolated_risk_parameters'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RiskInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/risk_parameters.py b/docs/lighter/lighter-python-main/lighter/models/risk_parameters.py new file mode 100644 index 0000000..2084032 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/risk_parameters.py @@ -0,0 +1,110 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class RiskParameters(BaseModel): + """ + RiskParameters + """ # noqa: E501 + market_id: StrictInt + collateral: StrictStr + total_account_value: StrictStr + initial_margin_req: StrictStr + maintenance_margin_req: StrictStr + close_out_margin_req: StrictStr + additional_properties: Dict[str, Any] = {} + __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_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of RiskParameters from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of RiskParameters from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "market_id": obj.get("market_id"), + "collateral": obj.get("collateral"), + "total_account_value": obj.get("total_account_value"), + "initial_margin_req": obj.get("initial_margin_req"), + "maintenance_margin_req": obj.get("maintenance_margin_req"), + "close_out_margin_req": obj.get("close_out_margin_req") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/share_price.py b/docs/lighter/lighter-python-main/lighter/models/share_price.py new file mode 100644 index 0000000..6f347b4 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/share_price.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictFloat, StrictInt +from typing import Any, ClassVar, Dict, List, Union +from typing import Optional, Set +from typing_extensions import Self + +class SharePrice(BaseModel): + """ + SharePrice + """ # noqa: E501 + timestamp: StrictInt + share_price: Union[StrictFloat, StrictInt] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["timestamp", "share_price"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SharePrice from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SharePrice from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "timestamp": obj.get("timestamp"), + "share_price": obj.get("share_price") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/simple_order.py b/docs/lighter/lighter-python-main/lighter/models/simple_order.py new file mode 100644 index 0000000..a10be5d --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/simple_order.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class SimpleOrder(BaseModel): + """ + SimpleOrder + """ # noqa: E501 + order_index: StrictInt + order_id: StrictStr + owner_account_index: StrictInt + initial_base_amount: StrictStr + remaining_base_amount: StrictStr + price: StrictStr + order_expiry: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["order_index", "order_id", "owner_account_index", "initial_base_amount", "remaining_base_amount", "price", "order_expiry"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SimpleOrder from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SimpleOrder from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "order_index": obj.get("order_index"), + "order_id": obj.get("order_id"), + "owner_account_index": obj.get("owner_account_index"), + "initial_base_amount": obj.get("initial_base_amount"), + "remaining_base_amount": obj.get("remaining_base_amount"), + "price": obj.get("price"), + "order_expiry": obj.get("order_expiry") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/status.py b/docs/lighter/lighter-python-main/lighter/models/status.py new file mode 100644 index 0000000..d2026f0 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/status.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Status(BaseModel): + """ + Status + """ # noqa: E501 + status: StrictInt + network_id: StrictInt + timestamp: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["status", "network_id", "timestamp"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Status from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Status from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "status": obj.get("status"), + "network_id": obj.get("network_id"), + "timestamp": obj.get("timestamp") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/sub_accounts.py b/docs/lighter/lighter-python-main/lighter/models/sub_accounts.py new file mode 100644 index 0000000..76f4c0c --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/sub_accounts.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.account import Account +from typing import Optional, Set +from typing_extensions import Self + +class SubAccounts(BaseModel): + """ + SubAccounts + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + l1_address: StrictStr + sub_accounts: List[Account] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "l1_address", "sub_accounts"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of SubAccounts from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in sub_accounts (list) + _items = [] + if self.sub_accounts: + for _item in self.sub_accounts: + if _item: + _items.append(_item.to_dict()) + _dict['sub_accounts'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of SubAccounts from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/ticker.py b/docs/lighter/lighter-python-main/lighter/models/ticker.py new file mode 100644 index 0000000..96a5cd4 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/ticker.py @@ -0,0 +1,111 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from lighter.models.price_level import PriceLevel +from typing import Optional, Set +from typing_extensions import Self + +class Ticker(BaseModel): + """ + Ticker + """ # noqa: E501 + s: StrictStr + a: PriceLevel + b: PriceLevel + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["s", "a", "b"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Ticker from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of a + if self.a: + _dict['a'] = self.a.to_dict() + # override the default output from pydantic by calling `to_dict()` of b + if self.b: + _dict['b'] = self.b.to_dict() + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Ticker from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _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 + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/trade.py b/docs/lighter/lighter-python-main/lighter/models/trade.py new file mode 100644 index 0000000..9156a47 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/trade.py @@ -0,0 +1,153 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class Trade(BaseModel): + """ + Trade + """ # noqa: E501 + trade_id: StrictInt + tx_hash: StrictStr + type: StrictStr + market_id: StrictInt + size: StrictStr + price: StrictStr + usd_amount: StrictStr + ask_id: StrictInt + bid_id: StrictInt + ask_account_id: StrictInt + bid_account_id: StrictInt + is_maker_ask: StrictBool + block_height: StrictInt + timestamp: StrictInt + taker_fee: Optional[StrictInt] + taker_position_size_before: StrictStr + taker_entry_quote_before: StrictStr + taker_initial_margin_fraction_before: Optional[StrictInt] + taker_position_sign_changed: Optional[StrictBool] + maker_fee: Optional[StrictInt] + maker_position_size_before: StrictStr + maker_entry_quote_before: StrictStr + maker_initial_margin_fraction_before: Optional[StrictInt] + maker_position_sign_changed: Optional[StrictBool] + 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_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"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['trade', 'liquidation', 'deleverage']): + raise ValueError("must be one of enum values ('trade', 'liquidation', 'deleverage')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Trade from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Trade from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "trade_id": obj.get("trade_id"), + "tx_hash": obj.get("tx_hash"), + "type": obj.get("type"), + "market_id": obj.get("market_id"), + "size": obj.get("size"), + "price": obj.get("price"), + "usd_amount": obj.get("usd_amount"), + "ask_id": obj.get("ask_id"), + "bid_id": obj.get("bid_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"), + "block_height": obj.get("block_height"), + "timestamp": obj.get("timestamp"), + "taker_fee": obj.get("taker_fee"), + "taker_position_size_before": obj.get("taker_position_size_before"), + "taker_entry_quote_before": obj.get("taker_entry_quote_before"), + "taker_initial_margin_fraction_before": obj.get("taker_initial_margin_fraction_before"), + "taker_position_sign_changed": obj.get("taker_position_sign_changed"), + "maker_fee": obj.get("maker_fee"), + "maker_position_size_before": obj.get("maker_position_size_before"), + "maker_entry_quote_before": obj.get("maker_entry_quote_before"), + "maker_initial_margin_fraction_before": obj.get("maker_initial_margin_fraction_before"), + "maker_position_sign_changed": obj.get("maker_position_sign_changed") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/trades.py b/docs/lighter/lighter-python-main/lighter/models/trades.py new file mode 100644 index 0000000..ea2097a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/trades.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.trade import Trade +from typing import Optional, Set +from typing_extensions import Self + +class Trades(BaseModel): + """ + Trades + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + next_cursor: Optional[StrictStr] = None + trades: List[Trade] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "next_cursor", "trades"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Trades from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in trades (list) + _items = [] + if self.trades: + for _item in self.trades: + if _item: + _items.append(_item.to_dict()) + _dict['trades'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Trades from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "next_cursor": obj.get("next_cursor"), + "trades": [Trade.from_dict(_item) for _item in obj["trades"]] if obj.get("trades") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/transfer_fee_info.py b/docs/lighter/lighter-python-main/lighter/models/transfer_fee_info.py new file mode 100644 index 0000000..b4ee332 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/transfer_fee_info.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TransferFeeInfo(BaseModel): + """ + TransferFeeInfo + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + transfer_fee_usdc: StrictInt + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "transfer_fee_usdc"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransferFeeInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransferFeeInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "transfer_fee_usdc": obj.get("transfer_fee_usdc") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/transfer_history.py b/docs/lighter/lighter-python-main/lighter/models/transfer_history.py new file mode 100644 index 0000000..9c415e6 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/transfer_history.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.transfer_history_item import TransferHistoryItem +from typing import Optional, Set +from typing_extensions import Self + +class TransferHistory(BaseModel): + """ + TransferHistory + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + transfers: List[TransferHistoryItem] + cursor: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "transfers", "cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransferHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in transfers (list) + _items = [] + if self.transfers: + for _item in self.transfers: + if _item: + _items.append(_item.to_dict()) + _dict['transfers'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransferHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "transfers": [TransferHistoryItem.from_dict(_item) for _item in obj["transfers"]] if obj.get("transfers") is not None else None, + "cursor": obj.get("cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/transfer_history_item.py b/docs/lighter/lighter-python-main/lighter/models/transfer_history_item.py new file mode 100644 index 0000000..dcebc4a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/transfer_history_item.py @@ -0,0 +1,123 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class TransferHistoryItem(BaseModel): + """ + TransferHistoryItem + """ # noqa: E501 + id: StrictStr + amount: StrictStr + timestamp: StrictInt + type: StrictStr + from_l1_address: StrictStr + to_l1_address: StrictStr + from_account_index: StrictInt + to_account_index: StrictInt + tx_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "type", "from_l1_address", "to_l1_address", "from_account_index", "to_account_index", "tx_hash"] + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['L2TransferInflow', 'L2TransferOutflow']): + raise ValueError("must be one of enum values ('L2TransferInflow', 'L2TransferOutflow')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TransferHistoryItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TransferHistoryItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("id"), + "amount": obj.get("amount"), + "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") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/tx.py b/docs/lighter/lighter-python-main/lighter/models/tx.py new file mode 100644 index 0000000..1b78ad1 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/tx.py @@ -0,0 +1,129 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, Field, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List +from typing_extensions import Annotated +from typing import Optional, Set +from typing_extensions import Self + +class Tx(BaseModel): + """ + Tx + """ # noqa: E501 + hash: StrictStr + type: Annotated[int, Field(le=64, strict=True, ge=1)] + info: StrictStr + event_info: StrictStr + status: StrictInt + transaction_index: StrictInt + l1_address: StrictStr + account_index: StrictInt + nonce: StrictInt + expire_at: StrictInt + block_height: StrictInt + queued_at: StrictInt + executed_at: StrictInt + sequence_index: StrictInt + parent_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["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"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Tx from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Tx from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "hash": obj.get("hash"), + "type": obj.get("type"), + "info": obj.get("info"), + "event_info": obj.get("event_info"), + "status": obj.get("status"), + "transaction_index": obj.get("transaction_index"), + "l1_address": obj.get("l1_address"), + "account_index": obj.get("account_index"), + "nonce": obj.get("nonce"), + "expire_at": obj.get("expire_at"), + "block_height": obj.get("block_height"), + "queued_at": obj.get("queued_at"), + "executed_at": obj.get("executed_at"), + "sequence_index": obj.get("sequence_index"), + "parent_hash": obj.get("parent_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/tx_hash.py b/docs/lighter/lighter-python-main/lighter/models/tx_hash.py new file mode 100644 index 0000000..86cb1ed --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/tx_hash.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TxHash(BaseModel): + """ + TxHash + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + tx_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "tx_hash"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TxHash from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TxHash from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "tx_hash": obj.get("tx_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/tx_hashes.py b/docs/lighter/lighter-python-main/lighter/models/tx_hashes.py new file mode 100644 index 0000000..807aa59 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/tx_hashes.py @@ -0,0 +1,104 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from typing import Optional, Set +from typing_extensions import Self + +class TxHashes(BaseModel): + """ + TxHashes + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + tx_hash: List[StrictStr] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "tx_hash"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of TxHashes from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of TxHashes from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "tx_hash": obj.get("tx_hash") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/txs.py b/docs/lighter/lighter-python-main/lighter/models/txs.py new file mode 100644 index 0000000..8beafb5 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/txs.py @@ -0,0 +1,112 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.tx import Tx +from typing import Optional, Set +from typing_extensions import Self + +class Txs(BaseModel): + """ + Txs + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + txs: List[Tx] + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "txs"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of Txs from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in txs (list) + _items = [] + if self.txs: + for _item in self.txs: + if _item: + _items.append(_item.to_dict()) + _dict['txs'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of Txs from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "txs": [Tx.from_dict(_item) for _item in obj["txs"]] if obj.get("txs") is not None else None + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/validator_info.py b/docs/lighter/lighter-python-main/lighter/models/validator_info.py new file mode 100644 index 0000000..ca08bdf --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/validator_info.py @@ -0,0 +1,102 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictBool, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ValidatorInfo(BaseModel): + """ + ValidatorInfo + """ # noqa: E501 + address: StrictStr + is_active: StrictBool + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["address", "is_active"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ValidatorInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ValidatorInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "address": obj.get("address"), + "is_active": obj.get("is_active") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/withdraw_history.py b/docs/lighter/lighter-python-main/lighter/models/withdraw_history.py new file mode 100644 index 0000000..cdcb8c1 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/withdraw_history.py @@ -0,0 +1,114 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr +from typing import Any, ClassVar, Dict, List, Optional +from lighter.models.withdraw_history_item import WithdrawHistoryItem +from typing import Optional, Set +from typing_extensions import Self + +class WithdrawHistory(BaseModel): + """ + WithdrawHistory + """ # noqa: E501 + code: StrictInt + message: Optional[StrictStr] = None + withdraws: List[WithdrawHistoryItem] + cursor: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["code", "message", "withdraws", "cursor"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WithdrawHistory from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # override the default output from pydantic by calling `to_dict()` of each item in withdraws (list) + _items = [] + if self.withdraws: + for _item in self.withdraws: + if _item: + _items.append(_item.to_dict()) + _dict['withdraws'] = _items + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WithdrawHistory from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "code": obj.get("code"), + "message": obj.get("message"), + "withdraws": [WithdrawHistoryItem.from_dict(_item) for _item in obj["withdraws"]] if obj.get("withdraws") is not None else None, + "cursor": obj.get("cursor") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/withdraw_history_item.py b/docs/lighter/lighter-python-main/lighter/models/withdraw_history_item.py new file mode 100644 index 0000000..fdc9a82 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/withdraw_history_item.py @@ -0,0 +1,124 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictInt, StrictStr, field_validator +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class WithdrawHistoryItem(BaseModel): + """ + WithdrawHistoryItem + """ # noqa: E501 + id: StrictStr + amount: StrictStr + timestamp: StrictInt + status: StrictStr + type: StrictStr + l1_tx_hash: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["id", "amount", "timestamp", "status", "type", "l1_tx_hash"] + + @field_validator('status') + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['failed', 'pending', 'claimable', 'refunded', 'completed']): + raise ValueError("must be one of enum values ('failed', 'pending', 'claimable', 'refunded', 'completed')") + return value + + @field_validator('type') + def type_validate_enum(cls, value): + """Validates the enum""" + if value not in set(['secure', 'fast']): + raise ValueError("must be one of enum values ('secure', 'fast')") + return value + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of WithdrawHistoryItem from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of WithdrawHistoryItem from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "id": obj.get("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") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/models/zk_lighter_info.py b/docs/lighter/lighter-python-main/lighter/models/zk_lighter_info.py new file mode 100644 index 0000000..81fcb14 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/models/zk_lighter_info.py @@ -0,0 +1,100 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from __future__ import annotations +import pprint +import re # noqa: F401 +import json + +from pydantic import BaseModel, ConfigDict, StrictStr +from typing import Any, ClassVar, Dict, List +from typing import Optional, Set +from typing_extensions import Self + +class ZkLighterInfo(BaseModel): + """ + ZkLighterInfo + """ # noqa: E501 + contract_address: StrictStr + additional_properties: Dict[str, Any] = {} + __properties: ClassVar[List[str]] = ["contract_address"] + + model_config = ConfigDict( + populate_by_name=True, + validate_assignment=True, + protected_namespaces=(), + ) + + + def to_str(self) -> str: + """Returns the string representation of the model using alias""" + return pprint.pformat(self.model_dump(by_alias=True)) + + def to_json(self) -> str: + """Returns the JSON representation of the model using alias""" + # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead + return json.dumps(self.to_dict()) + + @classmethod + def from_json(cls, json_str: str) -> Optional[Self]: + """Create an instance of ZkLighterInfo from a JSON string""" + return cls.from_dict(json.loads(json_str)) + + def to_dict(self) -> Dict[str, Any]: + """Return the dictionary representation of the model using alias. + + This has the following differences from calling pydantic's + `self.model_dump(by_alias=True)`: + + * `None` is only added to the output dict for nullable fields that + were set at model initialization. Other fields with value `None` + are ignored. + * Fields in `self.additional_properties` are added to the output dict. + """ + excluded_fields: Set[str] = set([ + "additional_properties", + ]) + + _dict = self.model_dump( + by_alias=True, + exclude=excluded_fields, + exclude_none=True, + ) + # puts key-value pairs in additional_properties in the top level + if self.additional_properties is not None: + for _key, _value in self.additional_properties.items(): + _dict[_key] = _value + + return _dict + + @classmethod + def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]: + """Create an instance of ZkLighterInfo from a dict""" + if obj is None: + return None + + if not isinstance(obj, dict): + return cls.model_validate(obj) + + _obj = cls.model_validate({ + "contract_address": obj.get("contract_address") + }) + # store additional fields in additional_properties + for _key in obj.keys(): + if _key not in cls.__properties: + _obj.additional_properties[_key] = obj.get(_key) + + return _obj + + diff --git a/docs/lighter/lighter-python-main/lighter/nonce_manager.py b/docs/lighter/lighter-python-main/lighter/nonce_manager.py new file mode 100644 index 0000000..cf4c730 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/nonce_manager.py @@ -0,0 +1,132 @@ +import abc +import enum +from typing import Optional, Tuple + +import requests + +from lighter import api_client +from lighter.api import transaction_api +from lighter.errors import ValidationError + + +def get_nonce_from_api(client: api_client.ApiClient, account_index: int, api_key_index: int) -> int: + # uses request to avoid async initialization + req = requests.get( + client.configuration.host + "/api/v1/nextNonce", + params={"account_index": account_index, "api_key_index": api_key_index}, + ) + if req.status_code != 200: + raise Exception(f"couldn't get nonce {req.content}") + return req.json()["nonce"] + + +class NonceManager(abc.ABC): + def __init__( + self, + account_index: int, + api_client: api_client.ApiClient, + start_api_key: int, + end_api_key: Optional[int] = None, + ): + if end_api_key is None: + end_api_key = start_api_key + if start_api_key > end_api_key or start_api_key >= 255 or end_api_key >= 255: + raise ValidationError(f"invalid range {start_api_key=} {end_api_key=}") + self.start_api_key = start_api_key + self.end_api_key = end_api_key + self.current_api_key = end_api_key # start will be used for the first tx + self.account_index = account_index + self.api_client = api_client + self.nonce = { + api_key_index: get_nonce_from_api(api_client, account_index, api_key_index) - 1 + for api_key_index in range(start_api_key, end_api_key + 1) + } + + def hard_refresh_nonce(self, api_key: int): + self.nonce[api_key] = get_nonce_from_api(self.api_client, self.account_index, api_key) - 1 + + @abc.abstractmethod + def next_nonce(self) -> Tuple[int, int]: + pass + + def acknowledge_failure(self, api_key_index: int) -> None: + pass + + +def increment_circular(idx: int, start_idx: int, end_idx: int) -> int: + idx += 1 + if idx > end_idx: + return start_idx + return idx + + +class OptimisticNonceManager(NonceManager): + def __init__( + self, + account_index: int, + api_client: api_client.ApiClient, + start_api_key: int, + end_api_key: Optional[int] = None, + ) -> None: + super().__init__(account_index, api_client, start_api_key, end_api_key) + + def next_nonce(self) -> Tuple[int, int]: + self.current_api_key = increment_circular(self.current_api_key, self.start_api_key, self.end_api_key) + self.nonce[self.current_api_key] += 1 + return (self.current_api_key, self.nonce[self.current_api_key]) + + def acknowledge_failure(self, api_key_index: int) -> None: + self.nonce[api_key_index] -= 1 + + +class ApiNonceManager(NonceManager): + def __init__( + self, + account_index: int, + api_client: api_client.ApiClient, + start_api_key: int, + end_api_key: Optional[int] = None, + ) -> None: + super().__init__(account_index, api_client, start_api_key, end_api_key) + + def next_nonce(self) -> Tuple[int, int]: + """ + It is recommended to wait at least 350ms before using the same api key. + Please be mindful of your transaction frequency when using this nonce manager. + predicted_execution_time_ms from the response could give you a tighter bound. + """ + self.current_api_key = increment_circular(self.current_api_key, self.start_api_key, self.end_api_key) + self.nonce[self.current_api_key] = get_nonce_from_api(self.api_client, self.account_index, self.current_api_key) + return (self.current_api_key, self.nonce[self.current_api_key]) + + def refresh_nonce(self, api_key_index: int) -> int: + self.nonce[api_key_index] = get_nonce_from_api(self.api_client, self.start_api_key, self.end_api_key) + + +class NonceManagerType(enum.Enum): + OPTIMISTIC = 1 + API = 2 + + +def nonce_manager_factory( + nonce_manager_type: NonceManagerType, + account_index: int, + api_client: api_client.ApiClient, + start_api_key: int, + end_api_key: Optional[int] = None, +) -> NonceManager: + if nonce_manager_type == NonceManagerType.OPTIMISTIC: + return OptimisticNonceManager( + account_index=account_index, + api_client=api_client, + start_api_key=start_api_key, + end_api_key=end_api_key, + ) + elif nonce_manager_type == NonceManagerType.API: + return ApiNonceManager( + account_index=account_index, + api_client=api_client, + start_api_key=start_api_key, + end_api_key=end_api_key, + ) + raise ValidationError("invalid nonce manager type") diff --git a/docs/lighter/lighter-python-main/lighter/py.typed b/docs/lighter/lighter-python-main/lighter/py.typed new file mode 100644 index 0000000..e69de29 diff --git a/docs/lighter/lighter-python-main/lighter/rest.py b/docs/lighter/lighter-python-main/lighter/rest.py new file mode 100644 index 0000000..e996812 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/rest.py @@ -0,0 +1,215 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import io +import json +import re +import ssl +from typing import Optional, Union + +import aiohttp +import aiohttp_retry + +from lighter.exceptions import ApiException, ApiValueError + +RESTResponseType = aiohttp.ClientResponse + +ALLOW_RETRY_METHODS = frozenset({'DELETE', 'GET', 'HEAD', 'OPTIONS', 'PUT', 'TRACE'}) + +class RESTResponse(io.IOBase): + + def __init__(self, resp) -> None: + self.response = resp + self.status = resp.status + self.reason = resp.reason + self.data = None + + async def read(self): + if self.data is None: + self.data = await self.response.read() + return self.data + + def getheaders(self): + """Returns a CIMultiDictProxy of the response headers.""" + return self.response.headers + + def getheader(self, name, default=None): + """Returns a given response header.""" + return self.response.headers.get(name, default) + + +class RESTClientObject: + + def __init__(self, configuration) -> None: + + # maxsize is number of requests to host that are allowed in parallel + maxsize = configuration.connection_pool_maxsize + + ssl_context = ssl.create_default_context( + cafile=configuration.ssl_ca_cert + ) + if configuration.cert_file: + 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.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 + ) + ) + else: + self.retry_client = None + + async def close(self): + await self.pool_manager.close() + if self.retry_client is not None: + await self.retry_client.close() + + async def request( + self, + method, + url, + headers=None, + body=None, + post_params=None, + _request_timeout=None + ): + """Execute request + + :param method: http request method + :param url: http request url + :param headers: http request headers + :param body: request json body, for `application/json` + :param post_params: request post parameters, + `application/x-www-form-urlencoded` + and `multipart/form-data` + :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. + """ + method = method.upper() + assert method in [ + 'GET', + 'HEAD', + 'DELETE', + 'POST', + 'PUT', + 'PATCH', + 'OPTIONS' + ] + + if post_params and body: + raise ApiValueError( + "body parameter cannot be used with post_params parameter." + ) + + post_params = post_params or {} + headers = headers or {} + # url already contains the URL query string + timeout = _request_timeout or 5 * 60 + + if 'Content-Type' not in headers: + headers['Content-Type'] = 'application/json' + + args = { + "method": method, + "url": url, + "timeout": timeout, + "headers": headers + } + + if self.proxy: + args["proxy"] = self.proxy + if self.proxy_headers: + args["proxy_headers"] = self.proxy_headers + + # For `POST`, `PUT`, `PATCH`, `OPTIONS`, `DELETE` + if method in ['POST', 'PUT', 'PATCH', 'OPTIONS', 'DELETE']: + if re.search('json', headers['Content-Type'], re.IGNORECASE): + if body is not None: + body = json.dumps(body) + args["data"] = body + elif headers['Content-Type'] == 'application/x-www-form-urlencoded': + args["data"] = aiohttp.FormData(post_params) + elif headers['Content-Type'] == 'multipart/form-data': + # must del headers['Content-Type'], or the correct + # Content-Type which generated by aiohttp + del headers['Content-Type'] + data = aiohttp.FormData() + for param in post_params: + k, v = param + if isinstance(v, tuple) and len(v) == 3: + data.add_field( + k, + value=v[1], + filename=v[0], + content_type=v[2] + ) + else: + data.add_field(k, v) + args["data"] = data + + # Pass a `bytes` or `str` parameter directly in the body to support + # other content types than Json when `body` argument is provided + # in serialized form + elif isinstance(body, str) or isinstance(body, bytes): + args["data"] = body + else: + # Cannot generate the request from given parameters + msg = """Cannot prepare a request message for provided + arguments. Please check that your arguments match + declared content type.""" + 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: + pool_manager = self.retry_client + else: + pool_manager = self.pool_manager + + r = await pool_manager.request(**args) + + return RESTResponse(r) + + + + + diff --git a/docs/lighter/lighter-python-main/lighter/signer_client.py b/docs/lighter/lighter-python-main/lighter/signer_client.py new file mode 100644 index 0000000..662ad0a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/signer_client.py @@ -0,0 +1,917 @@ +import ctypes +from functools import wraps +import inspect +import json +import platform +import logging +import os +import time +from typing import Dict, Optional, Tuple + +from eth_account import Account +from eth_account.messages import encode_defunct +from pydantic import StrictInt +import lighter +from lighter.configuration import Configuration +from lighter.errors import ValidationError +from lighter.models import TxHash +from lighter import nonce_manager +from lighter.models.resp_send_tx import RespSendTx +from lighter.transactions import CreateOrder, CancelOrder, Withdraw + +logging.basicConfig(level=logging.DEBUG) + +CODE_OK = 200 + + +class ApiKeyResponse(ctypes.Structure): + _fields_ = [("privateKey", ctypes.c_char_p), ("publicKey", ctypes.c_char_p), ("err", ctypes.c_char_p)] + + +class StrOrErr(ctypes.Structure): + _fields_ = [("str", ctypes.c_char_p), ("err", ctypes.c_char_p)] + + +def _initialize_signer(): + is_linux = platform.system() == "Linux" + is_mac = platform.system() == "Darwin" + is_x64 = platform.machine().lower() in ("amd64", "x86_64") + is_arm = platform.machine().lower() == "arm64" + + current_file_directory = os.path.dirname(os.path.abspath(__file__)) + path_to_signer_folders = os.path.join(current_file_directory, "signers") + + if is_arm and is_mac: + logging.debug("Detected ARM architecture on macOS.") + return ctypes.CDLL(os.path.join(path_to_signer_folders, "signer-arm64.dylib")) + elif is_linux and is_x64: + logging.debug("Detected x64/amd architecture on Linux.") + return ctypes.CDLL(os.path.join(path_to_signer_folders, "signer-amd64.so")) + else: + raise Exception( + f"Unsupported platform/architecture: {platform.system()}/{platform.machine()} only supports Linux(x86) and Darwin(arm64)" + ) + + +def create_api_key(seed=""): + signer = _initialize_signer() + signer.GenerateAPIKey.argtypes = [ + ctypes.c_char_p, + ] + signer.GenerateAPIKey.restype = ApiKeyResponse + result = signer.GenerateAPIKey(ctypes.c_char_p(seed.encode("utf-8"))) + + private_key_str = result.privateKey.decode("utf-8") if result.privateKey else None + public_key_str = result.publicKey.decode("utf-8") if result.publicKey else None + error = result.err.decode("utf-8") if result.err else None + + return private_key_str, public_key_str, error + + +def trim_exc(exception_body: str): + return exception_body.strip().split("\n")[-1] + + +def process_api_key_and_nonce(func): + @wraps(func) + async def wrapper(self, *args, **kwargs): + # Get the signature + sig = inspect.signature(func) + + # Bind args and kwargs to the function's signature + bound_args = sig.bind(self, *args, **kwargs) + bound_args.apply_defaults() + # Extract api_key_index and nonce from kwargs or use defaults + api_key_index = bound_args.arguments.get("api_key_index", -1) + nonce = bound_args.arguments.get("nonce", -1) + if api_key_index == -1 and nonce == -1: + api_key_index, nonce = self.nonce_manager.next_nonce() + err = self.switch_api_key(api_key_index) + if err != None: + raise Exception(f"error switching api key: {err}") + + # Call the original function with modified kwargs + ret: TxHash + try: + partial_arguments = {k: v for k, v in bound_args.arguments.items() if k not in ("self", "nonce", "api_key_index")} + created_tx, ret, err = await func(self, **partial_arguments, nonce=nonce, api_key_index=api_key_index) + if ret.code != CODE_OK: + self.nonce_manager.acknowledge_failure(api_key_index) + except lighter.exceptions.BadRequestException as e: + if "invalid nonce" in str(e): + self.nonce_manager.hard_refresh_nonce(api_key_index) + return None, None, trim_exc(str(e)) + else: + self.nonce_manager.acknowledge_failure(api_key_index) + return None, None, trim_exc(str(e)) + + return created_tx, ret, err + + return wrapper + + +class SignerClient: + USDC_TICKER_SCALE = 1e6 + + TX_TYPE_CHANGE_PUB_KEY = 8 + TX_TYPE_CREATE_SUB_ACCOUNT = 9 + TX_TYPE_CREATE_PUBLIC_POOL = 10 + TX_TYPE_UPDATE_PUBLIC_POOL = 11 + TX_TYPE_TRANSFER = 12 + TX_TYPE_WITHDRAW = 13 + TX_TYPE_CREATE_ORDER = 14 + TX_TYPE_CANCEL_ORDER = 15 + TX_TYPE_CANCEL_ALL_ORDERS = 16 + TX_TYPE_MODIFY_ORDER = 17 + TX_TYPE_MINT_SHARES = 18 + TX_TYPE_BURN_SHARES = 19 + TX_TYPE_UPDATE_LEVERAGE = 20 + + ORDER_TYPE_LIMIT = 0 + ORDER_TYPE_MARKET = 1 + ORDER_TYPE_STOP_LOSS = 2 + ORDER_TYPE_STOP_LOSS_LIMIT = 3 + ORDER_TYPE_TAKE_PROFIT = 4 + ORDER_TYPE_TAKE_PROFIT_LIMIT = 5 + ORDER_TYPE_TWAP = 6 + + ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL = 0 + ORDER_TIME_IN_FORCE_GOOD_TILL_TIME = 1 + ORDER_TIME_IN_FORCE_POST_ONLY = 2 + + CANCEL_ALL_TIF_IMMEDIATE = 0 + CANCEL_ALL_TIF_SCHEDULED = 1 + CANCEL_ALL_TIF_ABORT = 2 + + NIL_TRIGGER_PRICE = 0 + DEFAULT_28_DAY_ORDER_EXPIRY = -1 + DEFAULT_IOC_EXPIRY = 0 + DEFAULT_10_MIN_AUTH_EXPIRY = -1 + MINUTE = 60 + + CROSS_MARGIN_MODE = 0 + ISOLATED_MARGIN_MODE = 1 + + def __init__( + self, + url, + private_key, + api_key_index, + account_index, + max_api_key_index=-1, + private_keys: Optional[Dict[int, str]] = None, + nonce_management_type=nonce_manager.NonceManagerType.OPTIMISTIC, + ): + """ + First private key needs to be passed separately for backwards compatibility. + This may get deprecated in a future version. + """ + chain_id = 304 if "mainnet" in url else 300 + + # api_key_index=0 is generally used by frontend + if private_key.startswith("0x"): + private_key = private_key[2:] + self.url = url + self.private_key = private_key + self.chain_id = chain_id + self.api_key_index = api_key_index + if max_api_key_index == -1: + self.end_api_key_index = api_key_index + else: + self.end_api_key_index = max_api_key_index + + private_keys = private_keys or {} + self.validate_api_private_keys(private_key, private_keys) + self.api_key_dict = self.build_api_key_dict(private_key, private_keys) + self.account_index = account_index + self.signer = _initialize_signer() + self.api_client = lighter.ApiClient(configuration=Configuration(host=url)) + self.tx_api = lighter.TransactionApi(self.api_client) + self.order_api = lighter.OrderApi(self.api_client) + self.nonce_manager = nonce_manager.nonce_manager_factory( + nonce_manager_type=nonce_management_type, + account_index=account_index, + api_client=self.api_client, + start_api_key=self.api_key_index, + end_api_key=self.end_api_key_index, + ) + for api_key in range(self.api_key_index, self.end_api_key_index + 1): + self.create_client(api_key) + + def validate_api_private_keys(self, initial_private_key: str, private_keys: Dict[int, str]): + if len(private_keys) == self.end_api_key_index - self.api_key_index + 1: + if not self.are_keys_equal(private_keys[self.api_key_index], initial_private_key): + raise ValidationError("inconsistent private keys") + return # this is all we need to check in this case + if len(private_keys) != self.end_api_key_index - self.api_key_index: + raise ValidationError("unexpected number of private keys") + for api_key in range(self.api_key_index + 1, self.end_api_key_index): + if api_key not in private_keys: + raise Exception(f"missing {api_key=} private key!") + + def build_api_key_dict(self, private_key, private_keys): + if len(private_keys) == self.end_api_key_index - self.api_key_index: + private_keys[self.api_key_index] = private_key + return private_keys + + def create_client(self, api_key_index=None): + self.signer.CreateClient.argtypes = [ + ctypes.c_char_p, + ctypes.c_char_p, + ctypes.c_int, + ctypes.c_int, + ctypes.c_longlong, + ] + api_key_index = api_key_index or self.api_key_index + self.signer.CreateClient.restype = ctypes.c_char_p + err = self.signer.CreateClient( + self.url.encode("utf-8"), + self.api_key_dict[api_key_index].encode("utf-8"), + self.chain_id, + api_key_index, + self.account_index, + ) + + if err is None: + return + + err_str = err.decode("utf-8") + raise Exception(err_str) + + # check_client verifies that the given API key associated with (api_key_index, account_index) matches the one on Lighter + def check_client(self): + self.signer.CheckClient.argtypes = [ + ctypes.c_int, + ctypes.c_longlong, + ] + self.signer.CheckClient.restype = ctypes.c_char_p + + for api_key in range(self.api_key_index, self.end_api_key_index + 1): + result = self.signer.CheckClient(api_key, self.account_index) + if result: + return result.decode("utf-8") + f" on api key {self.api_key_index}" + return result.decode("utf-8") if result else None + + def switch_api_key(self, api_key: int): + self.signer.SwitchAPIKey.argtypes = [ctypes.c_int] + self.signer.CheckClient.restype = ctypes.c_char_p + result = self.signer.SwitchAPIKey(api_key) + return result.decode("utf-8") if result else None + + def create_api_key(self, seed=""): + self.signer.GenerateAPIKey.argtypes = [ + ctypes.c_char_p, + ] + self.signer.GenerateAPIKey.restype = ApiKeyResponse + result = self.signer.GenerateAPIKey(ctypes.c_char_p(seed.encode("utf-8"))) + + private_key_str = result.str.decode("utf-8") if result.privateKey else None + public_key_str = result.str.decode("utf-8") if result.publicKey else None + error = result.err.decode("utf-8") if result.err else None + + return private_key_str, public_key_str, error + + def sign_change_api_key(self, eth_private_key, new_pubkey: str, nonce: int): + self.signer.SignChangePubKey.argtypes = [ + ctypes.c_char_p, + ctypes.c_longlong, + ] + self.signer.SignChangePubKey.restype = StrOrErr + result = self.signer.SignChangePubKey(ctypes.c_char_p(new_pubkey.encode("utf-8")), nonce) + + tx_info_str = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + if error is not None: + return None, error + + # fetch message to sign + tx_info = json.loads(tx_info_str) + msg_to_sign = tx_info["MessageToSign"] + del tx_info["MessageToSign"] + + # sign the message + acct = Account.from_key(eth_private_key) + message = encode_defunct(text=msg_to_sign) + signature = acct.sign_message(message) + tx_info["L1Sig"] = signature.signature.to_0x_hex() + return json.dumps(tx_info), None + + def get_api_key_nonce(self, api_key_index: int, nonce: int) -> Tuple[int, int]: + if api_key_index != -1 and nonce != -1: + return api_key_index, nonce + if nonce != -1: + if self.api_key_index == self.end_api_key_index: + return self.nonce_manager.next_nonce() + else: + raise Exception("ambiguous api key") + return self.nonce_manager.next_nonce() + + def sign_create_order( + self, + market_index, + client_order_index, + base_amount, + price, + is_ask, + order_type, + time_in_force, + reduce_only, + trigger_price, + order_expiry=DEFAULT_28_DAY_ORDER_EXPIRY, + nonce=-1, + ): + self.signer.SignCreateOrder.argtypes = [ + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_int, + ctypes.c_int, + ctypes.c_int, + ctypes.c_int, + ctypes.c_int, + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignCreateOrder.restype = StrOrErr + + result = self.signer.SignCreateOrder( + market_index, + client_order_index, + base_amount, + price, + int(is_ask), + order_type, + time_in_force, + reduce_only, + trigger_price, + order_expiry, + nonce, + ) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_cancel_order(self, market_index, order_index, nonce=-1): + self.signer.SignCancelOrder.argtypes = [ + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignCancelOrder.restype = StrOrErr + + result = self.signer.SignCancelOrder(market_index, order_index, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_withdraw(self, usdc_amount, nonce=-1): + self.signer.SignWithdraw.argtypes = [ctypes.c_longlong, ctypes.c_longlong] + self.signer.SignWithdraw.restype = StrOrErr + + result = self.signer.SignWithdraw(usdc_amount, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_create_sub_account(self, nonce=-1): + self.signer.SignCreateSubAccount.argtypes = [ctypes.c_longlong] + self.signer.SignCreateSubAccount.restype = StrOrErr + + result = self.signer.SignCreateSubAccount(nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_cancel_all_orders(self, time_in_force, time, nonce=-1): + self.signer.SignCancelAllOrders.argtypes = [ + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignCancelAllOrders.restype = StrOrErr + + result = self.signer.SignCancelAllOrders(time_in_force, time, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_modify_order(self, market_index, order_index, base_amount, price, trigger_price, nonce=-1): + self.signer.SignModifyOrder.argtypes = [ + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignModifyOrder.restype = StrOrErr + + result = self.signer.SignModifyOrder(market_index, order_index, base_amount, price, trigger_price, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_transfer(self, eth_private_key, to_account_index, usdc_amount, fee, memo, nonce=-1): + self.signer.SignTransfer.argtypes = [ + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_char_p, + ctypes.c_longlong, + ] + self.signer.SignTransfer.restype = StrOrErr + result = self.signer.SignTransfer(to_account_index, usdc_amount, fee, ctypes.c_char_p(memo.encode("utf-8")), nonce) + + tx_info_str = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + if error: + return tx_info_str, error + + # fetch message to sign + tx_info = json.loads(tx_info_str) + msg_to_sign = tx_info["MessageToSign"] + del tx_info["MessageToSign"] + + # sign the message + acct = Account.from_key(eth_private_key) + message = encode_defunct(text=msg_to_sign) + signature = acct.sign_message(message) + tx_info["L1Sig"] = signature.signature.to_0x_hex() + return json.dumps(tx_info), None + + def sign_create_public_pool(self, operator_fee, initial_total_shares, min_operator_share_rate, nonce=-1): + self.signer.SignCreatePublicPool.argtypes = [ + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignCreatePublicPool.restype = StrOrErr + + result = self.signer.SignCreatePublicPool(operator_fee, initial_total_shares, min_operator_share_rate, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_update_public_pool(self, public_pool_index, status, operator_fee, min_operator_share_rate, nonce=-1): + self.signer.SignUpdatePublicPool.argtypes = [ + ctypes.c_longlong, + ctypes.c_int, + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignUpdatePublicPool.restype = StrOrErr + + result = self.signer.SignUpdatePublicPool( + public_pool_index, status, operator_fee, min_operator_share_rate, nonce + ) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_mint_shares(self, public_pool_index, share_amount, nonce=-1): + self.signer.SignMintShares.argtypes = [ + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignMintShares.restype = StrOrErr + + result = self.signer.SignMintShares(public_pool_index, share_amount, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_burn_shares(self, public_pool_index, share_amount, nonce=-1): + self.signer.SignBurnShares.argtypes = [ + ctypes.c_longlong, + ctypes.c_longlong, + ctypes.c_longlong, + ] + self.signer.SignBurnShares.restype = StrOrErr + + result = self.signer.SignBurnShares(public_pool_index, share_amount, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + + return tx_info, error + + def sign_update_leverage(self, market_index, fraction, margin_mode, nonce=-1): + self.signer.SignUpdateLeverage.argtypes = [ + ctypes.c_int, + ctypes.c_int, + ctypes.c_int, + ctypes.c_longlong, + ] + self.signer.SignUpdateLeverage.restype = StrOrErr + result = self.signer.SignUpdateLeverage(market_index, fraction, margin_mode, nonce) + + tx_info = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + return tx_info, error + + def create_auth_token_with_expiry(self, deadline: int = DEFAULT_10_MIN_AUTH_EXPIRY): + if deadline == SignerClient.DEFAULT_10_MIN_AUTH_EXPIRY: + deadline = int(time.time() + 10 * SignerClient.MINUTE) + self.signer.CreateAuthToken.argtypes = [ctypes.c_longlong] + self.signer.CreateAuthToken.restype = StrOrErr + result = self.signer.CreateAuthToken(deadline) + + auth = result.str.decode("utf-8") if result.str else None + error = result.err.decode("utf-8") if result.err else None + return auth, error + + async def change_api_key(self, eth_private_key: str, new_pubkey: str, nonce=-1): + tx_info, error = self.sign_change_api_key(eth_private_key, new_pubkey, nonce) + if error is not None: + return None, error + + logging.debug(f"Change Pub Key Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CHANGE_PUB_KEY, tx_info=tx_info) + logging.debug(f"Change Pub Key Send Tx Response: {api_response}") + return api_response, None + + @process_api_key_and_nonce + async def create_order( + self, + market_index, + client_order_index, + base_amount, + price, + is_ask, + order_type, + time_in_force, + reduce_only=False, + trigger_price=NIL_TRIGGER_PRICE, + order_expiry=-1, + nonce=-1, + api_key_index=-1, + ) -> (CreateOrder, TxHash, str): + tx_info, error = self.sign_create_order( + market_index, + client_order_index, + base_amount, + price, + int(is_ask), + order_type, + time_in_force, + int(reduce_only), + trigger_price, + order_expiry, + nonce, + ) + if error is not None: + return None, None, error + logging.debug(f"Create Order Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CREATE_ORDER, tx_info=tx_info) + logging.debug(f"Create Order Send Tx Response: {api_response}") + return CreateOrder.from_json(tx_info), api_response, None + + async def create_market_order( + self, + market_index, + client_order_index, + base_amount, + avg_execution_price, + is_ask, + reduce_only: bool = False, + nonce=-1, + api_key_index=-1, + ) -> (CreateOrder, TxHash, str): + return await self.create_order( + market_index, + client_order_index, + base_amount, + avg_execution_price, + is_ask, + order_type=self.ORDER_TYPE_MARKET, + time_in_force=self.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL, + order_expiry=self.DEFAULT_IOC_EXPIRY, + reduce_only=reduce_only, + nonce=nonce, + api_key_index=api_key_index, + ) + + # will only do the amount such that the slippage is limited to the value provided + async def create_market_order_limited_slippage( + self, + market_index, + client_order_index, + base_amount, + max_slippage, + is_ask, + reduce_only: bool = False, + nonce=-1, + api_key_index=-1, + ideal_price=None + ) -> (CreateOrder, TxHash, str): + if ideal_price is None: + order_book_orders = await self.order_api.order_book_orders(market_index, 1) + logging.debug("Create market order limited slippage is doing an API call to get the current ideal price. You can also provide it yourself to avoid this.") + ideal_price = int((order_book_orders.bids[0].price if is_ask else order_book_orders.asks[0].price).replace(".", "")) + + acceptable_execution_price = round(ideal_price * (1 + max_slippage * (-1 if is_ask else 1))) + return await self.create_order( + market_index, + client_order_index, + base_amount, + price=acceptable_execution_price, + is_ask=is_ask, + order_type=self.ORDER_TYPE_MARKET, + time_in_force=self.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL, + order_expiry=self.DEFAULT_IOC_EXPIRY, + reduce_only=reduce_only, + nonce=nonce, + api_key_index=api_key_index, + ) + + # will only execute the order if it executes with slippage <= max_slippage + async def create_market_order_if_slippage( + self, + market_index, + client_order_index, + base_amount, + max_slippage, + is_ask, + reduce_only: bool = False, + nonce=-1, + api_key_index=-1, + ideal_price=None + ) -> (CreateOrder, TxHash, str): + order_book_orders = await self.order_api.order_book_orders(market_index, 100) + if ideal_price is None: + ideal_price = int((order_book_orders.bids[0].price if is_ask else order_book_orders.asks[0].price).replace(".", "")) + + matched_usd_amount, matched_size = 0, 0 + for order_book_order in (order_book_orders.bids if is_ask else order_book_orders.asks): + if matched_size == base_amount: + break + curr_order_price = int(order_book_order.price.replace(".", "")) + curr_order_size = int(order_book_order.remaining_base_amount.replace(".", "")) + to_be_used_order_size = min(base_amount - matched_size, curr_order_size) + matched_usd_amount += curr_order_price * to_be_used_order_size + matched_size += to_be_used_order_size + + potential_execution_price = matched_usd_amount / matched_size + acceptable_execution_price = ideal_price * (1 + max_slippage * (-1 if is_ask else 1)) + if (is_ask and potential_execution_price < acceptable_execution_price) or (not is_ask and potential_execution_price > acceptable_execution_price): + return None, None, "Excessive slippage" + + if matched_size < base_amount: + return None, None, "Cannot be sure slippage will be acceptable due to the high size" + + return await self.create_order( + market_index, + client_order_index, + base_amount, + price=round(acceptable_execution_price), + is_ask=is_ask, + order_type=self.ORDER_TYPE_MARKET, + time_in_force=self.ORDER_TIME_IN_FORCE_IMMEDIATE_OR_CANCEL, + order_expiry=self.DEFAULT_IOC_EXPIRY, + reduce_only=reduce_only, + nonce=nonce, + api_key_index=api_key_index, + ) + + @process_api_key_and_nonce + async def cancel_order(self, market_index, order_index, nonce=-1, api_key_index=-1) -> (CancelOrder, TxHash, str): + tx_info, error = self.sign_cancel_order(market_index, order_index, nonce) + if error is not None: + return None, None, error + logging.debug(f"Cancel Order Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CANCEL_ORDER, tx_info=tx_info) + logging.debug(f"Cancel Order Send Tx Response: {api_response}") + return CancelOrder.from_json(tx_info), api_response, None + + async def create_tp_order(self, market_index, client_order_index, base_amount, trigger_price, price, is_ask, reduce_only=False, nonce=-1, api_key_index=-1) -> (CreateOrder, TxHash, str): + return await self.create_order( + market_index, + client_order_index, + base_amount, + price, + is_ask, + self.ORDER_TYPE_TAKE_PROFIT, + self.DEFAULT_IOC_EXPIRY, + reduce_only, + trigger_price, + self.DEFAULT_28_DAY_ORDER_EXPIRY, + nonce, + api_key_index=api_key_index, + ) + + async def create_tp_limit_order(self, market_index, client_order_index, base_amount, trigger_price, price, is_ask, reduce_only=False, nonce=-1, api_key_index=-1) -> (CreateOrder, TxHash, str): + return await self.create_order( + market_index, + client_order_index, + base_amount, + price, + is_ask, + self.ORDER_TYPE_TAKE_PROFIT_LIMIT, + self.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only, + trigger_price, + self.DEFAULT_28_DAY_ORDER_EXPIRY, + nonce, + api_key_index, + ) + + async def create_sl_order(self, market_index, client_order_index, base_amount, trigger_price, price, is_ask, reduce_only=False, nonce=-1, api_key_index=-1) -> (CreateOrder, TxHash, str): + return await self.create_order( + market_index, + client_order_index, + base_amount, + price, + is_ask, + self.ORDER_TYPE_STOP_LOSS, + self.DEFAULT_IOC_EXPIRY, + reduce_only, + trigger_price, + self.DEFAULT_28_DAY_ORDER_EXPIRY, + nonce, + api_key_index=api_key_index, + ) + + async def create_sl_limit_order(self, market_index, client_order_index, base_amount, trigger_price, price, is_ask, reduce_only=False, nonce=-1, api_key_index=-1) -> (CreateOrder, TxHash, str): + return await self.create_order( + market_index, + client_order_index, + base_amount, + price, + is_ask, + self.ORDER_TYPE_STOP_LOSS_LIMIT, + self.ORDER_TIME_IN_FORCE_GOOD_TILL_TIME, + reduce_only, + trigger_price, + self.DEFAULT_28_DAY_ORDER_EXPIRY, + nonce, + api_key_index, + ) + + @process_api_key_and_nonce + async def withdraw(self, usdc_amount, nonce=-1, api_key_index=-1) -> (Withdraw, TxHash): + usdc_amount = int(usdc_amount * self.USDC_TICKER_SCALE) + + tx_info, error = self.sign_withdraw(usdc_amount, nonce) + if error is not None: + return None, None, error + logging.debug(f"Withdraw Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_WITHDRAW, tx_info=tx_info) + logging.debug(f"Withdraw Send Tx Response: {api_response}") + return Withdraw.from_json(tx_info), api_response, None + + async def create_sub_account(self, nonce=-1): + tx_info, error = self.sign_create_sub_account(nonce) + if error is not None: + return None, None, error + logging.debug(f"Create Sub Account Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CREATE_SUB_ACCOUNT, tx_info=tx_info) + logging.debug(f"Create Sub Account Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def cancel_all_orders(self, time_in_force, time, nonce=-1, api_key_index=-1): + tx_info, error = self.sign_cancel_all_orders(time_in_force, time, nonce) + if error is not None: + return None, None, error + logging.debug(f"Cancel All Orders Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CANCEL_ALL_ORDERS, tx_info=tx_info) + logging.debug(f"Cancel All Orders Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def modify_order( + self, market_index, order_index, base_amount, price, trigger_price, nonce=-1, api_key_index=-1 + ): + tx_info, error = self.sign_modify_order(market_index, order_index, base_amount, price, trigger_price, nonce) + if error is not None: + return None, None, error + logging.debug(f"Modify Order Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_MODIFY_ORDER, tx_info=tx_info) + logging.debug(f"Modify Order Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def transfer(self, eth_private_key: str, to_account_index, usdc_amount, fee, memo, nonce=-1, api_key_index=-1): + usdc_amount = int(usdc_amount * self.USDC_TICKER_SCALE) + + tx_info, error = self.sign_transfer(eth_private_key, to_account_index, usdc_amount, fee, memo, nonce) + if error is not None: + return None, None, error + logging.debug(f"Transfer Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_TRANSFER, tx_info=tx_info) + logging.debug(f"Transfer Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def create_public_pool( + self, operator_fee, initial_total_shares, min_operator_share_rate, nonce=-1, api_key_index=-1 + ): + tx_info, error = self.sign_create_public_pool( + operator_fee, initial_total_shares, min_operator_share_rate, nonce + ) + if error is not None: + return None, None, error + logging.debug(f"Create Public Pool Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_CREATE_PUBLIC_POOL, tx_info=tx_info) + logging.debug(f"Create Public Pool Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def update_public_pool( + self, public_pool_index, status, operator_fee, min_operator_share_rate, nonce=-1, api_key_index=-1 + ): + tx_info, error = self.sign_update_public_pool( + public_pool_index, status, operator_fee, min_operator_share_rate, nonce + ) + if error is not None: + return None, None, error + logging.debug(f"Update Public Pool Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_UPDATE_PUBLIC_POOL, tx_info=tx_info) + logging.debug(f"Update Public Pool Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def mint_shares(self, public_pool_index, share_amount, nonce=-1, api_key_index=-1): + tx_info, error = self.sign_mint_shares(public_pool_index, share_amount, nonce) + if error is not None: + return None, None, error + logging.debug(f"Mint Shares Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_MINT_SHARES, tx_info=tx_info) + logging.debug(f"Mint Shares Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def burn_shares(self, public_pool_index, share_amount, nonce=-1, api_key_index=-1): + tx_info, error = self.sign_burn_shares(public_pool_index, share_amount, nonce) + if error is not None: + return None, None, error + logging.debug(f"Burn Shares Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_BURN_SHARES, tx_info=tx_info) + logging.debug(f"Burn Shares Send Tx Response: {api_response}") + return tx_info, api_response, None + + @process_api_key_and_nonce + async def update_leverage(self, market_index, margin_mode, leverage, nonce=-1, api_key_index=-1): + imf = int(10_000 / leverage) + tx_info, error = self.sign_update_leverage(market_index, imf, margin_mode, nonce) + + if error is not None: + return None, None, error + logging.debug(f"Update Leverage Tx Info: {tx_info}") + + api_response = await self.send_tx(tx_type=self.TX_TYPE_UPDATE_LEVERAGE, tx_info=tx_info) + logging.debug(f"Update Leverage Tx Response: {api_response}") + return tx_info, api_response, None + + + async def send_tx(self, tx_type: StrictInt, tx_info: str) -> RespSendTx: + if tx_info[0] != "{": + raise Exception(tx_info) + return await self.tx_api.send_tx(tx_type=tx_type, tx_info=tx_info) + + async def close(self): + await self.api_client.close() + + @staticmethod + def are_keys_equal(key1, key2) -> bool: + start_index1, start_index2 = 0, 0 + if key1.startswith("0x"): + start_index1 = 2 + if key2.startswith("0x"): + start_index2 = 2 + return key1[start_index1:] == key2[start_index2:] diff --git a/docs/lighter/lighter-python-main/lighter/signers/.keep b/docs/lighter/lighter-python-main/lighter/signers/.keep new file mode 100644 index 0000000..e69de29 diff --git a/docs/lighter/lighter-python-main/lighter/signers/README.md b/docs/lighter/lighter-python-main/lighter/signers/README.md new file mode 100644 index 0000000..c1e3962 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/signers/README.md @@ -0,0 +1 @@ +Check the [go-sdk](https://github.com/elliottech/lighter-go) to see the source code for the binaries or to generate them youself. \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/lighter/signers/signer-amd64.so b/docs/lighter/lighter-python-main/lighter/signers/signer-amd64.so new file mode 100644 index 0000000..8cba2cd Binary files /dev/null and b/docs/lighter/lighter-python-main/lighter/signers/signer-amd64.so differ diff --git a/docs/lighter/lighter-python-main/lighter/signers/signer-arm64.dylib b/docs/lighter/lighter-python-main/lighter/signers/signer-arm64.dylib new file mode 100644 index 0000000..d05dd5b Binary files /dev/null and b/docs/lighter/lighter-python-main/lighter/signers/signer-arm64.dylib differ diff --git a/docs/lighter/lighter-python-main/lighter/transactions/__init__.py b/docs/lighter/lighter-python-main/lighter/transactions/__init__.py new file mode 100644 index 0000000..1650255 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/transactions/__init__.py @@ -0,0 +1,3 @@ +from lighter.transactions.cancel_order import CancelOrder +from lighter.transactions.create_order import CreateOrder +from lighter.transactions.withdraw import Withdraw diff --git a/docs/lighter/lighter-python-main/lighter/transactions/cancel_order.py b/docs/lighter/lighter-python-main/lighter/transactions/cancel_order.py new file mode 100644 index 0000000..ab00572 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/transactions/cancel_order.py @@ -0,0 +1,27 @@ +import json +from typing import Optional + + +class CancelOrder: + def __init__(self): + self.account_index: Optional[int] = None + self.order_book_index: Optional[int] = None + self.order_nonce: Optional[int] = None + self.expired_at: Optional[int] = None + self.nonce: Optional[int] = None + self.sig: Optional[str] = None + + @classmethod + def from_json(cls, json_str: str) -> 'CancelOrder': + params = json.loads(json_str) + self = cls() + self.account_index = params.get('AccountIndex') + self.order_book_index = params.get('OrderBookIndex') + self.order_nonce = params.get('OrderNonce') + self.expired_at = params.get('ExpiredAt') + self.nonce = params.get('Nonce') + self.sig = params.get('Sig') + return self + + def to_json(self) -> str: + return json.dumps(self.__dict__, default=str) diff --git a/docs/lighter/lighter-python-main/lighter/transactions/create_order.py b/docs/lighter/lighter-python-main/lighter/transactions/create_order.py new file mode 100644 index 0000000..f74363a --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/transactions/create_order.py @@ -0,0 +1,33 @@ +import json +from typing import Optional + + +class CreateOrder: + def __init__(self): + self.account_index: Optional[int] = None + self.order_book_index: Optional[int] = None + self.base_amount: Optional[int] = None + self.price: Optional[int] = None + self.is_ask: Optional[int] = None + self.order_type: Optional[int] = None + self.expired_at: Optional[int] = None + self.nonce: Optional[int] = None + self.sig: Optional[str] = None + + @classmethod + def from_json(cls, json_str: str) -> 'CreateOrder': + params = json.loads(json_str) + self = cls() + self.account_index = params.get('AccountIndex') + self.order_book_index = params.get('OrderBookIndex') + self.base_amount = params.get('BaseAmount') + self.price = params.get('Price') + self.is_ask = params.get('IsAsk') + self.order_type = params.get('OrderType') + self.expired_at = params.get('ExpiredAt') + self.nonce = params.get('Nonce') + self.sig = params.get('Sig') + return self + + def to_json(self) -> str: + return json.dumps(self.__dict__, default=str) diff --git a/docs/lighter/lighter-python-main/lighter/transactions/withdraw.py b/docs/lighter/lighter-python-main/lighter/transactions/withdraw.py new file mode 100644 index 0000000..aa49f46 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/transactions/withdraw.py @@ -0,0 +1,25 @@ +import json +from typing import Optional + + +class Withdraw: + def __init__(self): + self.from_account_index: Optional[int] = None + self.collateral_amount: Optional[int] = None + self.expired_at: Optional[int] = None + self.nonce: Optional[int] = None + self.sig: Optional[str] = None + + @classmethod + def from_json(cls, json_str: str) -> 'Withdraw': + params = json.loads(json_str) + instance = cls() + instance.from_account_index = params.get('FromAccountIndex') + instance.collateral_amount = params.get('CollateralAmount') + instance.expired_at = params.get('ExpiredAt') + instance.nonce = params.get('Nonce') + instance.sig = params.get('Sig') + return instance + + def to_json(self) -> str: + return json.dumps(self.__dict__, default=str) diff --git a/docs/lighter/lighter-python-main/lighter/ws_client.py b/docs/lighter/lighter-python-main/lighter/ws_client.py new file mode 100644 index 0000000..63f4fb6 --- /dev/null +++ b/docs/lighter/lighter-python-main/lighter/ws_client.py @@ -0,0 +1,160 @@ +import json +from websockets.sync.client import connect +from websockets.client import connect as connect_async +from lighter.configuration import Configuration + + +class WsClient: + def __init__( + self, + host=None, + path="/stream", + order_book_ids=[], + account_ids=[], + on_order_book_update=print, + on_account_update=print, + ): + if host is None: + host = Configuration.get_default().host.replace("https://", "") + + self.base_url = f"wss://{host}{path}" + + self.subscriptions = { + "order_books": order_book_ids, + "accounts": account_ids, + } + + if len(order_book_ids) == 0 and len(account_ids) == 0: + raise Exception("No subscriptions provided.") + + self.order_book_states = {} + self.account_states = {} + + self.on_order_book_update = on_order_book_update + self.on_account_update = on_account_update + + self.ws = None + + def on_message(self, ws, message): + if isinstance(message, str): + message = json.loads(message) + + message_type = message.get("type") + + if message_type == "connected": + self.handle_connected(ws) + elif message_type == "subscribed/order_book": + self.handle_subscribed_order_book(message) + elif message_type == "update/order_book": + self.handle_update_order_book(message) + elif message_type == "subscribed/account_all": + self.handle_subscribed_account(message) + elif message_type == "update/account_all": + self.handle_update_account(message) + else: + self.handle_unhandled_message(message) + + async def on_message_async(self, ws, message): + message = json.loads(message) + message_type = message.get("type") + + if message_type == "connected": + await self.handle_connected_async(ws) + else: + self.on_message(ws, message) + + def handle_connected(self, ws): + for market_id in self.subscriptions["order_books"]: + ws.send( + json.dumps({"type": "subscribe", "channel": f"order_book/{market_id}"}) + ) + for account_id in self.subscriptions["accounts"]: + ws.send( + json.dumps( + {"type": "subscribe", "channel": f"account_all/{account_id}"} + ) + ) + + async def handle_connected_async(self, ws): + for market_id in self.subscriptions["order_books"]: + await ws.send( + json.dumps({"type": "subscribe", "channel": f"order_book/{market_id}"}) + ) + for account_id in self.subscriptions["accounts"]: + await ws.send( + json.dumps( + {"type": "subscribe", "channel": f"account_all/{account_id}"} + ) + ) + + def handle_subscribed_order_book(self, message): + market_id = message["channel"].split(":")[1] + self.order_book_states[market_id] = message["order_book"] + if self.on_order_book_update: + self.on_order_book_update(market_id, self.order_book_states[market_id]) + + def handle_update_order_book(self, message): + market_id = message["channel"].split(":")[1] + self.update_order_book_state(market_id, message["order_book"]) + if self.on_order_book_update: + self.on_order_book_update(market_id, self.order_book_states[market_id]) + + def update_order_book_state(self, market_id, order_book): + self.update_orders( + order_book["asks"], self.order_book_states[market_id]["asks"] + ) + self.update_orders( + order_book["bids"], self.order_book_states[market_id]["bids"] + ) + + def update_orders(self, new_orders, existing_orders): + for new_order in new_orders: + is_new_order = True + for existing_order in existing_orders: + if new_order["price"] == existing_order["price"]: + is_new_order = False + existing_order["size"] = new_order["size"] + if float(new_order["size"]) == 0: + existing_orders.remove(existing_order) + break + if is_new_order: + existing_orders.append(new_order) + + existing_orders = [ + order for order in existing_orders if float(order["size"]) > 0 + ] + + def handle_subscribed_account(self, message): + account_id = message["channel"].split(":")[1] + self.account_states[account_id] = message + if self.on_account_update: + self.on_account_update(account_id, self.account_states[account_id]) + + def handle_update_account(self, message): + account_id = message["channel"].split(":")[1] + self.account_states[account_id] = message + if self.on_account_update: + self.on_account_update(account_id, self.account_states[account_id]) + + def handle_unhandled_message(self, message): + raise Exception(f"Unhandled message: {message}") + + def on_error(self, ws, error): + raise Exception(f"Error: {error}") + + def on_close(self, ws, close_status_code, close_msg): + raise Exception(f"Closed: {close_status_code} {close_msg}") + + def run(self): + ws = connect(self.base_url) + self.ws = ws + + for message in ws: + self.on_message(ws, message) + + async def run_async(self): + ws = await connect_async(self.base_url) + self.ws = ws + + async for message in ws: + await self.on_message_async(ws, message) diff --git a/docs/lighter/lighter-python-main/openapi.json b/docs/lighter/lighter-python-main/openapi.json new file mode 100644 index 0000000..ae3865c --- /dev/null +++ b/docs/lighter/lighter-python-main/openapi.json @@ -0,0 +1,7282 @@ +{ + "swagger": "2.0", + "info": { + "title": "", + "version": "" + }, + "host": "mainnet.zklighter.elliot.ai", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/": { + "get": { + "summary": "status", + "operationId": "status", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Status" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/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" + } + } + }, + "parameters": [ + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "index", + "l1_address" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "order" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get account active orders. `auth` can be generated using the SDK." + } + }, + "/api/v1/accountInactiveOrders": { + "get": { + "summary": "accountInactiveOrders", + "operationId": "accountInactiveOrders", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Orders" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "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": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + }, + { + "name": "ask_filter", + "in": "query", + "required": false, + "type": "integer", + "format": "int8", + "default": "-1" + }, + { + "name": "between_timestamps", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "index", + "l1_address" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get account metadatas" + } + }, + "/api/v1/accountTxs": { + "get": { + "summary": "accountTxs", + "operationId": "accountTxs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Txs" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "account_index" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "types", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "integer", + "format": "uint8" + } + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get transactions of a specific account" + } + }, + "/api/v1/accountsByL1Address": { + "get": { + "summary": "accountsByL1Address", + "operationId": "accountsByL1Address", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/SubAccounts" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "l1_address", + "in": "query", + "required": true, + "type": "string" + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "announcement" + ], + "description": "Get announcement" + } + }, + "/api/v1/apikeys": { + "get": { + "summary": "apikeys", + "operationId": "apikeys", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/AccountApiKeys" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "api_key_index", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + } + ], + "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/block": { + "get": { + "summary": "block", + "operationId": "block", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Blocks" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "commitment", + "height" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "block" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get block by its height or commitment" + } + }, + "/api/v1/blockTxs": { + "get": { + "summary": "blockTxs", + "operationId": "blockTxs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Txs" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "block_height", + "block_commitment" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get transactions in a block" + } + }, + "/api/v1/blocks": { + "get": { + "summary": "blocks", + "operationId": "blocks", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Blocks" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "sort", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "asc", + "desc" + ], + "default": "asc" + } + ], + "tags": [ + "block" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get blocks" + } + }, + "/api/v1/candlesticks": { + "get": { + "summary": "candlesticks", + "operationId": "candlesticks", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Candlesticks" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "resolution", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "1m", + "5m", + "15m", + "1h", + "4h", + "1d" + ] + }, + { + "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" + } + ], + "tags": [ + "candlestick" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get candlesticks" + } + }, + "/api/v1/changeAccountTier": { + "post": { + "summary": "changeAccountTier", + "operationId": "changeAccountTier", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RespChangeAccountTier" + } + }, + "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/ReqChangeAccountTier" + } + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Change account tier" + } + }, + "/api/v1/currentHeight": { + "get": { + "summary": "currentHeight", + "operationId": "currentHeight", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/CurrentHeight" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "block" + ], + "description": "Get current height" + } + }, + "/api/v1/deposit/history": { + "get": { + "summary": "deposit_history", + "operationId": "deposit_history", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/DepositHistory" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "l1_address", + "in": "query", + "required": true, + "type": "string" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get deposit history" + } + }, + "/api/v1/exchangeStats": { + "get": { + "summary": "exchangeStats", + "operationId": "exchangeStats", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ExchangeStats" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "order" + ], + "description": "Get exchange 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" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64", + "default": "-1" + }, + { + "name": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + }, + { + "name": "type", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "funding", + "trade" + ] + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "bridge" + ], + "description": "Get fast bridge info" + } + }, + "/api/v1/funding-rates": { + "get": { + "summary": "funding-rates", + "operationId": "funding-rates", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/FundingRates" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "funding" + ], + "description": "Get funding rates" + } + }, + "/api/v1/fundings": { + "get": { + "summary": "fundings", + "operationId": "fundings", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Fundings" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "resolution", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "1h", + "1d" + ] + }, + { + "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" + } + ], + "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" + } + }, + "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": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "l1_address", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get L1 metadata" + } + }, + "/api/v1/liquidations": { + "get": { + "summary": "liquidations", + "operationId": "liquidations", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/LiquidationInfos" + } + }, + "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": "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": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get liquidation infos" + } + }, + "/api/v1/nextNonce": { + "get": { + "summary": "nextNonce", + "operationId": "nextNonce", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/NextNonce" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "api_key_index", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + } + ], + "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" + } + }, + "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/ReqAckNotif" + } + } + ], + "tags": [ + "notification" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Ack notification" + } + }, + "/api/v1/orderBookDetails": { + "get": { + "summary": "orderBookDetails", + "operationId": "orderBookDetails", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/OrderBookDetails" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "limit", + "in": "query", + "required": true, + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + } + ], + "tags": [ + "order" + ], + "consumes": [ + "multipart/form-data" + ], + "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." + } + }, + "/api/v1/pnl": { + "get": { + "summary": "pnl", + "operationId": "pnl", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/AccountPnL" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "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" + ] + }, + { + "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": "ignore_transfers", + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "default": "255" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "side", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "long", + "short", + "all" + ], + "default": "all" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get accounts position fundings" + } + }, + "/api/v1/publicPools": { + "get": { + "summary": "publicPools", + "operationId": "publicPools", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/PublicPools" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "all", + "user", + "protocol", + "account_index" + ] + }, + { + "name": "index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "account_index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get public pools" + } + }, + "/api/v1/publicPoolsMetadata": { + "get": { + "summary": "publicPoolsMetadata", + "operationId": "publicPoolsMetadata", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RespPublicPoolsMetadata" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "all", + "user", + "protocol", + "account_index" + ] + }, + { + "name": "index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + }, + { + "name": "account_index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + } + ], + "tags": [ + "account" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get public pools metadata" + } + }, + "/api/v1/recentTrades": { + "get": { + "summary": "recentTrades", + "operationId": "recentTrades", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Trades" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "market_id", + "in": "query", + "required": true, + "type": "integer", + "format": "uint8" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + ], + "tags": [ + "order" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get recent trades" + } + }, + "/api/v1/referral/points": { + "get": { + "summary": "referral_points", + "operationId": "referral_points", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ReferralPoints" + } + }, + "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": "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" + } + ], + "tags": [ + "referral" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get referral points" + } + }, + "/api/v1/sendTx": { + "post": { + "summary": "sendTx", + "operationId": "sendTx", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RespSendTx" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReqSendTx" + } + } + ], + "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/sendTxBatch": { + "post": { + "summary": "sendTxBatch", + "operationId": "sendTxBatch", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/RespSendTxBatch" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ReqSendTxBatch" + } + } + ], + "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/trades": { + "get": { + "summary": "trades", + "operationId": "trades", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Trades" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "market_id", + "in": "query", + "required": false, + "type": "integer", + "format": "uint8", + "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", + "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": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + ], + "tags": [ + "order" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get trades" + } + }, + "/api/v1/transfer/history": { + "get": { + "summary": "transfer_history", + "operationId": "transfer_history", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/TransferHistory" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get transfer history" + } + }, + "/api/v1/transferFeeInfo": { + "get": { + "summary": "transferFeeInfo", + "operationId": "transferFeeInfo", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/TransferFeeInfo" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "auth", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "to_account_index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64", + "default": "-1" + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "by", + "in": "query", + "required": true, + "type": "string", + "enum": [ + "hash", + "sequence_index" + ] + }, + { + "name": "value", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get transaction by hash or sequence index" + } + }, + "/api/v1/txFromL1TxHash": { + "get": { + "summary": "txFromL1TxHash", + "operationId": "txFromL1TxHash", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/EnrichedTx" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "hash", + "in": "query", + "required": true, + "type": "string" + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get L1 transaction by L1 transaction hash" + } + }, + "/api/v1/txs": { + "get": { + "summary": "txs", + "operationId": "txs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/Txs" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "index", + "in": "query", + "required": false, + "type": "integer", + "format": "int64" + }, + { + "name": "limit", + "in": "query", + "required": true, + "type": "integer", + "format": "int64", + "minimum": 1, + "maximum": 100 + } + ], + "tags": [ + "transaction" + ], + "consumes": [ + "multipart/form-data" + ], + "description": "Get transactions which are already packed into blocks" + } + }, + "/api/v1/withdraw/history": { + "get": { + "summary": "withdraw_history", + "operationId": "withdraw_history", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/WithdrawHistory" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "parameters": [ + { + "name": "authorization", + "description": " make required after integ is done", + "in": "header", + "required": false, + "type": "string" + }, + { + "name": "account_index", + "in": "query", + "required": true, + "type": "integer", + "format": "int64" + }, + { + "name": "auth", + "description": " made optional to support header auth clients", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cursor", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "filter", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "all", + "pending", + "claimable" + ] + } + ], + "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" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/ResultCode" + } + } + }, + "tags": [ + "info" + ], + "description": "Withdrawal delay in seconds" + } + }, + "/info": { + "get": { + "summary": "info", + "operationId": "info", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/ZkLighterInfo" + } + }, + "400": { + "description": "Bad request", + "schema": { + "$ref": "#/definitions/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" + } + }, + "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" + ] + }, + "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" + ] + }, + "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" + } + }, + "title": "AccountLimits", + "required": [ + "code", + "max_llp_percentage", + "user_tier" + ] + }, + "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" + } + }, + "title": "AccountMetadata", + "required": [ + "account_index", + "name", + "description", + "can_invite", + "referral_points_percentage" + ] + }, + "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" + } + } + }, + "title": "AccountPnL", + "required": [ + "code", + "resolution", + "pnl" + ] + }, + "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" + } + }, + "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" + ] + }, + "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": "#/definitions/AccountMarginStats" + }, + "total_stats": { + "$ref": "#/definitions/AccountMarginStats" + } + }, + "title": "AccountStats", + "required": [ + "collateral", + "portfolio_value", + "leverage", + "available_balance", + "margin_usage", + "buying_power", + "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" + } + }, + "title": "Announcement", + "required": [ + "title", + "content", + "created_at" + ] + }, + "Announcements": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "announcements": { + "type": "array", + "items": { + "$ref": "#/definitions/Announcement" + } + } + }, + "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" + } + }, + "title": "ApiKey", + "required": [ + "account_index", + "api_key_index", + "nonce", + "public_key" + ] + }, + "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": "#/definitions/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": "#/definitions/Block" + } + } + }, + "title": "Blocks", + "required": [ + "code", + "total", + "blocks" + ] + }, + "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" + ] + }, + "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" + } + }, + "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": "#/definitions/Candlestick" + } + } + }, + "title": "Candlesticks", + "required": [ + "code", + "resolution", + "candlesticks" + ] + }, + "ContractAddress": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "1" + }, + "address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + } + }, + "title": "ContractAddress", + "required": [ + "name", + "address" + ] + }, + "CurrentHeight": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "height": { + "type": "integer", + "format": "int64" + } + }, + "title": "CurrentHeight", + "required": [ + "code", + "height" + ] + }, + "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" + } + }, + "cursor": { + "type": "string" + } + }, + "title": "DepositHistory", + "required": [ + "code", + "deposits", + "cursor" + ] + }, + "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" + } + }, + "title": "DepositHistoryItem", + "required": [ + "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" + }, + "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": "#/definitions/AccountPosition" + } + }, + "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" + } + } + }, + "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", + "total_asset_value", + "cross_asset_value", + "pool_info", + "shares" + ] + }, + "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" + } + } + }, + "title": "DetailedAccounts", + "required": [ + "code", + "total", + "accounts" + ] + }, + "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" + } + }, + "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" + }, + "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", + "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": "#/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" + ] + }, + "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": "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" + ] + }, + "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" + ] + }, + "LiqTrade": { + "type": "object", + "properties": { + "price": { + "type": "string" + }, + "size": { + "type": "string" + }, + "taker_fee": { + "type": "string" + }, + "maker_fee": { + "type": "string" + } + }, + "title": "LiqTrade", + "required": [ + "price", + "size", + "taker_fee", + "maker_fee" + ] + }, + "Liquidation": { + "type": "object", + "properties": { + "id": { + "type": "integer", + "format": "int64" + }, + "market_id": { + "type": "integer", + "format": "uint8" + }, + "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" + } + }, + "risk_info_before": { + "$ref": "#/definitions/RiskInfo" + }, + "risk_info_after": { + "$ref": "#/definitions/RiskInfo" + }, + "mark_prices": { + "type": "object", + "additionalProperties": { + "type": "number", + "format": "double" + } + } + }, + "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" + } + }, + "next_cursor": { + "type": "string" + } + }, + "title": "LiquidationInfos", + "required": [ + "code", + "liquidations" + ] + }, + "MarketInfo": { + "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" + } + }, + "title": "MarketInfo", + "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" + ] + }, + "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" + ] + }, + "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" + } + }, + "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" + ] + }, + "OrderBook": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "status": { + "type": "string", + "example": "active", + "enum": [ + "inactive", + "frozen", + "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" + } + }, + "title": "OrderBook", + "required": [ + "symbol", + "market_id", + "status", + "taker_fee", + "maker_fee", + "liquidation_fee", + "min_base_amount", + "min_quote_amount", + "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" + } + }, + "title": "OrderBookDepth", + "required": [ + "code", + "asks", + "bids", + "offset" + ] + }, + "OrderBookDetail": { + "type": "object", + "properties": { + "symbol": { + "type": "string", + "example": "ETH" + }, + "market_id": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "status": { + "type": "string", + "example": "active", + "enum": [ + "inactive", + "frozen", + "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" + }, + "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" + } + } + }, + "title": "OrderBookDetail", + "required": [ + "symbol", + "market_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": "#/definitions/OrderBookDetail" + } + } + }, + "title": "OrderBookDetails", + "required": [ + "code", + "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" + } + } + }, + "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" + ] + }, + "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" + } + }, + "title": "PnLEntry", + "required": [ + "timestamp", + "trade_pnl", + "inflow", + "outflow", + "pool_pnl", + "pool_inflow", + "pool_outflow", + "pool_total_shares" + ] + }, + "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" + }, + "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" + ] + }, + "PositionFundings": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "position_fundings": { + "type": "array", + "items": { + "$ref": "#/definitions/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" + ] + }, + "PublicPool": { + "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" + }, + "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" + }, + "total_asset_value": { + "type": "string", + "example": "19995" + }, + "cross_asset_value": { + "type": "string", + "example": "19995" + }, + "pool_info": { + "$ref": "#/definitions/PublicPoolInfo" + }, + "account_share": { + "$ref": "#/definitions/PublicPoolShare" + } + }, + "title": "PublicPool", + "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", + "total_asset_value", + "cross_asset_value", + "pool_info" + ] + }, + "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": "#/definitions/DailyReturn" + } + }, + "share_prices": { + "type": "array", + "items": { + "$ref": "#/definitions/SharePrice" + } + } + }, + "title": "PublicPoolInfo", + "required": [ + "status", + "operator_fee", + "min_operator_share_rate", + "total_shares", + "operator_shares", + "annual_percentage_yield", + "daily_returns", + "share_prices" + ] + }, + "PublicPoolMetadata": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "account_index": { + "type": "integer", + "format": "int64", + "example": "3" + }, + "account_type": { + "type": "integer", + "format": "uint8", + "example": "1" + }, + "name": { + "type": "string" + }, + "l1_address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "annual_percentage_yield": { + "type": "number", + "format": "double", + "example": "20.5000" + }, + "status": { + "type": "integer", + "format": "uint8", + "example": "0" + }, + "operator_fee": { + "type": "string", + "example": "100" + }, + "total_asset_value": { + "type": "string", + "example": "19995" + }, + "total_shares": { + "type": "integer", + "format": "int64", + "example": "100000" + }, + "account_share": { + "$ref": "#/definitions/PublicPoolShare" + } + }, + "title": "PublicPoolMetadata", + "required": [ + "code", + "account_index", + "account_type", + "name", + "l1_address", + "annual_percentage_yield", + "status", + "operator_fee", + "total_asset_value", + "total_shares" + ] + }, + "PublicPoolShare": { + "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" + } + }, + "title": "PublicPoolShare", + "required": [ + "public_pool_index", + "shares_amount", + "entry_usdc" + ] + }, + "PublicPools": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "total": { + "type": "integer", + "format": "int64" + }, + "public_pools": { + "type": "array", + "items": { + "$ref": "#/definitions/PublicPool" + } + } + }, + "title": "PublicPools", + "required": [ + "code", + "total", + "public_pools" + ] + }, + "ReferralPointEntry": { + "type": "object", + "properties": { + "l1_address": { + "type": "string" + }, + "total_points": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "week_points": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "total_reward_points": { + "type": "integer", + "format": "int64", + "example": "200" + }, + "week_reward_points": { + "type": "integer", + "format": "int64", + "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": "#/definitions/ReferralPointEntry" + } + }, + "user_total_points": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "user_last_week_points": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "user_total_referral_reward_points": { + "type": "integer", + "format": "int64", + "example": "1000" + }, + "user_last_week_referral_reward_points": { + "type": "integer", + "format": "int64", + "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" + ] + } + }, + "title": "ReqExportData", + "required": [ + "type" + ] + }, + "ReqGetAccount": { + "type": "object", + "properties": { + "by": { + "type": "string", + "enum": [ + "index", + "l1_address" + ] + }, + "value": { + "type": "string" + } + }, + "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", + "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": "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", + "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" + }, + "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" + } + }, + "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" + } + }, + "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" + ] + }, + "ReqGetPublicPools": { + "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": "ReqGetPublicPools", + "required": [ + "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" + ] + }, + "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 + } + }, + "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" + } + }, + "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": "#/definitions/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" + } + }, + "title": "RespSendTx", + "required": [ + "code", + "tx_hash", + "predicted_execution_time_ms" + ] + }, + "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" + } + }, + "title": "RespSendTxBatch", + "required": [ + "code", + "tx_hash", + "predicted_execution_time_ms" + ] + }, + "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": "#/definitions/RiskParameters" + }, + "isolated_risk_parameters": { + "type": "array", + "items": { + "$ref": "#/definitions/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" + } + }, + "title": "SimpleOrder", + "required": [ + "order_index", + "order_id", + "owner_account_index", + "initial_base_amount", + "remaining_base_amount", + "price", + "order_expiry" + ] + }, + "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": "#/definitions/Account" + } + } + }, + "title": "SubAccounts", + "required": [ + "code", + "l1_address", + "sub_accounts" + ] + }, + "Ticker": { + "type": "object", + "properties": { + "s": { + "type": "string", + "example": "ETH" + }, + "a": { + "$ref": "#/definitions/PriceLevel" + }, + "b": { + "$ref": "#/definitions/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_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" + } + }, + "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_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" + ] + }, + "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" + } + } + }, + "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": "#/definitions/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" + ] + }, + "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" + } + }, + "title": "TransferHistoryItem", + "required": [ + "id", + "amount", + "timestamp", + "type", + "from_l1_address", + "to_l1_address", + "from_account_index", + "to_account_index", + "tx_hash" + ] + }, + "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" + } + }, + "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" + ] + }, + "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" + ] + }, + "Txs": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "example": "200" + }, + "message": { + "type": "string" + }, + "txs": { + "type": "array", + "items": { + "$ref": "#/definitions/Tx" + } + } + }, + "title": "Txs", + "required": [ + "code", + "txs" + ] + }, + "ValidatorInfo": { + "type": "object", + "properties": { + "address": { + "type": "string", + "example": "0x70997970C51812dc3A010C7d01b50e0d17dc79C8" + }, + "is_active": { + "type": "boolean", + "format": "boolean", + "example": "true" + } + }, + "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" + } + }, + "cursor": { + "type": "string" + } + }, + "title": "WithdrawHistory", + "required": [ + "code", + "withdraws", + "cursor" + ] + }, + "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" + } + }, + "title": "WithdrawHistoryItem", + "required": [ + "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" + } + } +} diff --git a/docs/lighter/lighter-python-main/pyproject.toml b/docs/lighter/lighter-python-main/pyproject.toml new file mode 100644 index 0000000..352334a --- /dev/null +++ b/docs/lighter/lighter-python-main/pyproject.toml @@ -0,0 +1,79 @@ +[tool.poetry] +name = "lighter-sdk" +version = "0.1.4" +description = "Python client for Lighter" +authors = ["elliot"] +license = "NoLicense" +readme = "README.md" +repository = "https://github.com/elliottech/lighter-python" +keywords = ["OpenAPI", "OpenAPI-Generator"] +include = ["lighter/py.typed"] + +[tool.poetry.packages] +python = ["lighter"] + +[tool.poetry.dependencies] +python = "^3.8" + +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.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" + + +[build-system] +requires = ["setuptools"] +build-backend = "setuptools.build_meta" + +[tool.pylint.'MESSAGES CONTROL'] +extension-pkg-whitelist = "pydantic" + +[tool.mypy] +files = [ + "lighter", + #"test", # auto-generated tests + "tests", # hand-written tests +] +# TODO: enable "strict" once all these individual checks are passing +# strict = true + +# List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options +warn_unused_configs = true +warn_redundant_casts = true +warn_unused_ignores = true + +## Getting these passing should be easy +strict_equality = true +strict_concatenate = true + +## Strongly recommend enabling this one as soon as you can +check_untyped_defs = true + +## These shouldn't be too much additional work, but may be tricky to +## get passing if you use a lot of untyped libraries +disallow_subclassing_any = true +disallow_untyped_decorators = true +disallow_any_generics = true + +### These next few are various gradations of forcing use of type annotations +#disallow_untyped_calls = true +#disallow_incomplete_defs = true +#disallow_untyped_defs = true +# +### This one isn't too hard to get passing, but return on investment is lower +#no_implicit_reexport = true +# +### This one can be tricky to get passing if you use a lot of untyped libraries +#warn_return_any = true diff --git a/docs/lighter/lighter-python-main/requirements.txt b/docs/lighter/lighter-python-main/requirements.txt new file mode 100644 index 0000000..a21c5cd --- /dev/null +++ b/docs/lighter/lighter-python-main/requirements.txt @@ -0,0 +1,10 @@ +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 +aiohttp-retry >= 2.8.3 +websockets >= 12.0.0 +eth-account >= 0.13.4 +requests >= 2.31.0 \ No newline at end of file diff --git a/docs/lighter/lighter-python-main/setup.cfg b/docs/lighter/lighter-python-main/setup.cfg new file mode 100644 index 0000000..11433ee --- /dev/null +++ b/docs/lighter/lighter-python-main/setup.cfg @@ -0,0 +1,2 @@ +[flake8] +max-line-length=99 diff --git a/docs/lighter/lighter-python-main/setup.py b/docs/lighter/lighter-python-main/setup.py new file mode 100644 index 0000000..26548d7 --- /dev/null +++ b/docs/lighter/lighter-python-main/setup.py @@ -0,0 +1,54 @@ +# coding: utf-8 + +""" + + + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) + + The version of the OpenAPI document: + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +from setuptools import setup, find_packages # noqa: H301 + +# To install the library, run the following +# +# python setup.py install +# +# prerequisite: setuptools +# http://pypi.python.org/pypi/setuptools +NAME = "lighter-sdk" +VERSION = "0.1.4" +PYTHON_REQUIRES = ">=3.7" +REQUIRES = [ + "urllib3 >= 1.25.3, < 2.1.0", + "python-dateutil", + "aiohttp >= 3.0.0", + "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", +] + +setup( + name=NAME, + version=VERSION, + description="Python SDK for lighter.xyz", + author="OpenAPI Generator community", + author_email="team@openapitools.org", + url="", + keywords=["OpenAPI", "OpenAPI-Generator", ""], + install_requires=REQUIRES, + packages=find_packages(exclude=["test", "tests"]), + include_package_data=True, + long_description_content_type="text/markdown", + long_description="""\ + Python SDK for Lighter trading. Includes api clients and signer. + """, # noqa: E501 + package_data={"lighter": ["py.typed", "signers/*"]}, +) diff --git a/docs/lighter/lighter-python-main/test-requirements.txt b/docs/lighter/lighter-python-main/test-requirements.txt new file mode 100644 index 0000000..057e6ec --- /dev/null +++ b/docs/lighter/lighter-python-main/test-requirements.txt @@ -0,0 +1,7 @@ +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 + diff --git a/docs/lighter/lighter-python-main/test/__init__.py b/docs/lighter/lighter-python-main/test/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/docs/lighter/lighter-python-main/test/test_account.py b/docs/lighter/lighter-python-main/test/test_account.py new file mode 100644 index 0000000..5c9f3d6 --- /dev/null +++ b/docs/lighter/lighter-python-main/test/test_account.py @@ -0,0 +1,86 @@ +# coding: utf-8 + +""" + Lighter API + + Public APIs for Lighter + + The version of the OpenAPI document: 1.0 + Generated by OpenAPI Generator (https://openapi-generator.tech) + + Do not edit the class manually. +""" # noqa: E501 + + +import unittest + +from lighter.models.account import Account + +class TestAccount(unittest.TestCase): + """Account unit test stubs""" + + def setUp(self): + pass + + def tearDown(self): + pass + + def make_instance(self, include_optional) -> Account: + """Test Account + include_option is a boolean, when False only required + params are included, when True both required and + optional params are included """ + # uncomment below to create an instance of `Account` + """ + model = Account() + if include_optional: + return Account( + code = 100, + total = 1, + accounts = [ + lighter.models.single_account.SingleAccount( + code = 56, + index = 56, + l1_address = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8', + pk = '3ad126b9f0a2cc8cb367ef67a6c77389a85e18e20ce8da2edf34d022e9bf1aa8', + status = 1, + nonce = 722, + collateral = '', + positions = [ + lighter.models.account_position.AccountPosition( + market_id = 0, + name = 'Ethereum', + symbol = 'ETH', + sign = -1, + position = '3.6955', + ask_order_size = '58933.9753', + bid_order_size = '59010.2588', + avg_entry_price = '3024.66', + market_value = '3019.92', + unrealized_pnl = '17.521309', + realized_pnl = '0.000000', ) + ], + total_asset_value = '199955234976240000000000000', + market_stats = [ + lighter.models.account_market_stats.AccountMarketStats( + market_id = 1, + daily_trades_count = 68, + daily_base_token_volume = 235.25, + daily_quote_token_volume = 93566.25, + open_position_base = 93.0, + open_position_quote = 1276.0, ) + ], ) + ] + ) + else: + return Account( + ) + """ + + def testAccount(self): + """Test Account""" + # inst_req_only = self.make_instance(include_optional=False) + # inst_req_and_optional = self.make_instance(include_optional=True) + +if __name__ == '__main__': + unittest.main() diff --git a/docs/lighter/lighter-python-main/tox.ini b/docs/lighter/lighter-python-main/tox.ini new file mode 100644 index 0000000..8941ca0 --- /dev/null +++ b/docs/lighter/lighter-python-main/tox.ini @@ -0,0 +1,9 @@ +[tox] +envlist = py3 + +[testenv] +deps=-r{toxinidir}/requirements.txt + -r{toxinidir}/test-requirements.txt + +commands= + pytest --cov=lighter --ignore-glob *api.py diff --git a/docs/lighter/websocket.md b/docs/lighter/websocket.md new file mode 100644 index 0000000..40846d2 --- /dev/null +++ b/docs/lighter/websocket.md @@ -0,0 +1,1025 @@ +WebSocket +This page will help you get started with zkLighter WebSocket server. + +Connection +URL: wss://mainnet.zklighter.elliot.ai/stream + +You can directly connect to the WebSocket server using wscat: + + +wscat -c 'wss://mainnet.zklighter.elliot.ai/stream' +Send Tx +You can send transactions using the websocket as follows: + +JSON + +{ + "type": "jsonapi/sendtx", + "data": { + "tx_type": INTEGER, + "tx_info": ... + } +} +The tx_type options can be found in the SignerClient file, while tx_info can be generated using the sign methods in the SignerClient. + +Example: ws_send_tx.py + +Send Batch Tx +You can send batch transactions to execute up to 50 transactions in a single message. + +JSON + +{ + "type": "jsonapi/sendtxbatch", + "data": { + "tx_types": [INTEGER], + "tx_infos": [tx_info] + } +} +The tx_type options can be found in the SignerClient file, while tx_info can be generated using the sign methods in the SignerClient. + +Example: ws_send_batch_tx.py + +Types +We first need to define some types that appear often in the JSONs. + +Transaction JSON +JSON + +Transaction = { + "hash": STRING, + "type": INTEGER, + "info": STRING, // json object as string, attributes depending on the tx type + "event_info": STRING, // json object as string, attributes depending on the tx type + "status": INTEGER, + "transaction_index": INTEGER, + "l1_address": STRING, + "account_index": INTEGER, + "nonce": INTEGER, + "expire_at": INTEGER, + "block_height": INTEGER, + "queued_at": INTEGER, + "executed_at": INTEGER, + "sequence_index": INTEGER, + "parent_hash": STRING +} +Example: + +JSON + +{ + "hash": "0xabc123456789def", + "type": 15, + "info": "{\"AccountIndex\":1,\"ApiKeyIndex\":2,\"MarketIndex\":3,\"Index\":404,\"ExpiredAt\":1700000000000,\"Nonce\":1234,\"Sig\":\"0xsigexample\"}", + "event_info": "{\"a\":1,\"i\":404,\"u\":123,\"ae\":\"\"}", + "status": 2, + "transaction_index": 10, + "l1_address": "0x123abc456def789", + "account_index": 101, + "nonce": 12345, + "expire_at": 1700000000000, + "block_height": 1500000, + "queued_at": 1699999990000, + "executed_at": 1700000000005, + "sequence_index": 5678, + "parent_hash": "0xparenthash123456" +} +Used in: Transaction, Executed Transaction, Account Tx. + +Order JSON +JSON + +Order = { + "order_index": INTEGER, + "client_order_index": INTEGER, + "order_id": STRING, // same as order_index but string + "client_order_id": STRING, // same as client_order_index but string + "market_index": INTEGER, + "owner_account_index": INTEGER, + "initial_base_amount": STRING, + "price": STRING, + "nonce": INTEGER, + "remaining_base_amount": STRING, + "is_ask": BOOL, + "base_size": INTEGER, + "base_price": INTEGER, + "filled_base_amount": STRING, + "filled_quote_amount": STRING, + "side": STRING, + "type": STRING, + "time_in_force": STRING, + "reduce_only": BOOL, + "trigger_price": STRING, + "order_expiry": INTEGER, + "status": STRING, + "trigger_status": STRING, + "trigger_time": INTEGER, + "parent_order_index": INTEGER, + "parent_order_id": STRING, + "to_trigger_order_id_0": STRING, + "to_trigger_order_id_1": STRING, + "to_cancel_order_id_0": STRING, + "block_height": INTEGER, + "timestamp": INTEGER, +} +Used in: Account Market, Account All Orders, Account Orders. + +Trade JSON +JSON + +Trade = { + "trade_id": INTEGER, + "tx_hash": STRING, + "type": STRING, + "market_id": INTEGER, + "size": STRING, + "price": STRING, + "usd_amount": STRING, + "ask_id": INTEGER, + "bid_id": INTEGER, + "ask_account_id": INTEGER, + "bid_account_id": INTEGER, + "is_maker_ask": BOOLEAN, + "block_height": INTEGER, + "timestamp": INTEGER, + "taker_fee": INTEGER (omitted when zero), + "taker_position_size_before": STRING (omitted when empty), + "taker_entry_quote_before": STRING (omitted when empty), + "taker_initial_margin_fraction_before": INTEGER (omitted when zero), + "taker_position_sign_changed": BOOL (omitted when false), + "maker_fee": INTEGER (omitted when zero), + "maker_position_size_before": STRING (omitted when empty), + "maker_entry_quote_before": STRING (omitted when empty), + "maker_initial_margin_fraction_before": INTEGER (omitted when zero), + "maker_position_sign_changed": BOOL (omitted when false), +} +Example: + +JSON + +{ + "trade_id": 401, + "tx_hash": "0xabc123456789", + "type": "buy", + "market_id": 101, + "size": "0.5", + "price": "20000.00", + "usd_amount": "10000.00", + "ask_id": 501, + "bid_id": 502, + "ask_account_id": 123456, + "bid_account_id": 654321, + "is_maker_ask": true, + "block_height": 1500000, + "timestamp": 1700000000, + "taker_position_size_before":"1.14880", + "taker_entry_quote_before":"136130.046511", + "taker_initial_margin_fraction_before":500, + "maker_position_size_before":"-0.02594", + "maker_entry_quote_before":"3075.396750", + "maker_initial_margin_fraction_before":400 +} +Used in: Trade, Account All, Account Market, Account All Trades. + +Position JSON +JSON + +Position = { + "market_id": INTEGER, + "symbol": STRING, + "initial_margin_fraction": STRING, + "open_order_count": INTEGER, + "pending_order_count": INTEGER, + "position_tied_order_count": INTEGER, + "sign": INTEGER, + "position": STRING, + "avg_entry_price": STRING, + "position_value": STRING, + "unrealized_pnl": STRING, + "realized_pnl": STRING, + "liquidation_price": STRING, + "total_funding_paid_out": STRING (omitted when empty), + "margin_mode": INT, + "allocated_margin": STRING, +} +Example: + +JSON + +{ + "market_id": 101, + "symbol": "BTC-USD", + "initial_margin_fraction": "0.1", + "open_order_count": 2, + "pending_order_count": 1, + "position_tied_order_count": 3, + "sign": 1, + "position": "0.5", + "avg_entry_price": "20000.00", + "position_value": "10000.00", + "unrealized_pnl": "500.00", + "realized_pnl": "100.00", + "liquidation_price": "3024.66", + "total_funding_paid_out": "34.2", + "margin_mode": 1, + "allocated_margin": "46342", +} +Used in: Account All, Account Market, Account All Positions. + +PoolShares JSON +JSON + +PoolShares = { + "public_pool_index": INTEGER, + "shares_amount": INTEGER, + "entry_usdc": STRING +} +Example: + +JSON + +{ + "public_pool_index": 1, + "shares_amount": 100, + "entry_usdc": "1000.00" +} +Used in: Account All, Account All Positions. + +Channels +Order Book +The order book channel sends the new ask and bid orders for the given market. + +JSON + +{ + "type": "subscribe", + "channel": "order_book/{MARKET_INDEX}" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "order_book/0" +} +Response Structure + +JSON + +{ + "channel": "order_book:{MARKET_INDEX}", + "offset": INTEGER, + "order_book": { + "code": INTEGER, + "asks": [ + { + "price": STRING, + "size": STRING + } + ], + "bids": [ + { + "price": STRING, + "size": STRING + } + ], + "offset": INTEGER + }, + "type": "update/order_book" +} +Example Response + +JSON + +{ + "channel": "order_book:0", + "offset": 41692864, + "order_book": { + "code": 0, + "asks": [ + { + "price": "3327.46", + "size": "29.0915" + } + ], + "bids": [ + { + "price": "3338.80", + "size": "10.2898" + } + ], + "offset": 41692864 + }, + "type": "update/order_book" +} +Market Stats +The market stats channel sends the market stat data for the given market. + +JSON + +{ + "type": "subscribe", + "channel": "market_stats/{MARKET_INDEX}" +} +or + +JSON + +{ + "type": "subscribe", + "channel": "market_stats/all" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "market_stats/0" +} +Response Structure + +JSON + +{ + "channel": "market_stats:{MARKET_INDEX}", + "market_stats": { + "market_id": INTEGER, + "index_price": STRING, + "mark_price": STRING, + "open_interest": STRING, + "last_trade_price": STRING, + "current_funding_rate": STRING, + "funding_rate": STRING, + "funding_timestamp": INTEGER, + "daily_base_token_volume": FLOAT, + "daily_quote_token_volume": FLOAT, + "daily_price_low": FLOAT, + "daily_price_high": FLOAT, + "daily_price_change": FLOAT + }, + "type": "update/market_stats" +} +Example Response + +JSON + +{ + "channel": "market_stats:0", + "market_stats": { + "market_id": 0, + "index_price": "3335.04", + "mark_price": "3335.09", + "open_interest": "235.25", + "last_trade_price": "3335.65", + "current_funding_rate": "0.0057", + "funding_rate": "0.0005", + "funding_timestamp": 1722337200000, + "daily_base_token_volume": 230206.48999999944, + "daily_quote_token_volume": 765295250.9804002, + "daily_price_low": 3265.13, + "daily_price_high": 3386.01, + "daily_price_change": -1.1562612047992835 + }, + "type": "update/market_stats" +} +Trade +The trade channel sends the new trade data for the given market. + +JSON + +{ + "type": "subscribe", + "channel": "trade/{MARKET_INDEX}" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "trade/0" +} +Response Structure + +JSON + +{ + "channel": "trade:{MARKET_INDEX}", + "trades": [Trade] + ], + "type": "update/trade" +} +Example Response + +JSON + +{ + "channel": "trade:0", + "trades": [ + { + "trade_id": 14035051, + "tx_hash": "189068ebc6b5c7e5efda96f92842a2fafd280990692e56899a98de8c4a12a38c", + "type": "trade", + "market_id": 0, + "size": "0.1187", + "price": "3335.65", + "usd_amount": "13.67", + "ask_id": 41720126, + "bid_id": 41720037, + "ask_account_id": 2304, + "bid_account_id": 21504, + "is_maker_ask": false, + "block_height": 2204468, + "timestamp": 1722339648 + } + ], + "type": "update/trade" +} +Account All +The account all channel sends specific account market data for all markets. + +JSON + +{ + "type": "subscribe", + "channel": "account_all/{ACCOUNT_ID}" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "account_all/1" +} +Response Structure + +JSON + +{ + "account": INTEGER, + "channel": "account_all:{ACCOUNT_ID}", + "daily_trades_count": INTEGER, + "daily_volume": INTEGER, + "weekly_trades_count": INTEGER, + "weekly_volume": INTEGER, + "monthly_trades_count": INTEGER, + "monthly_volume": INTEGER, + "total_trades_count": INTEGER, + "total_volume": INTEGER, + "funding_histories": { + "{MARKET_INDEX}": [ + { + "timestamp": INTEGER, + "market_id": INTEGER, + "funding_id": INTEGER, + "change": STRING, + "rate": STRING, + "position_size": STRING, + "position_side": STRING + } + ] + }, + "positions": { + "{MARKET_INDEX}": Position + }, + "shares": [PoolShares], + "trades": { + "{MARKET_INDEX}": [Trade] + }, + "type": "update/account_all" +} +Example Response + +JSON + +{ + "account": 10, + "channel": "account_all:10", + "daily_trades_count": 123, + "daily_volume": 234, + "weekly_trades_count": 345, + "weekly_volume": 456, + "monthly_trades_count": 567, + "monthly_volume": 678, + "total_trades_count": 891, + "total_volume": 912, + "funding_histories": { + "1": [ + { + "timestamp": 1700000000, + "market_id": 101, + "funding_id": 2001, + "change": "0.001", + "rate": "0.0001", + "position_size": "0.5", + "position_side": "long" + } + ] + }, + "positions": { + "1": { + "market_id": 101, + "symbol": "BTC-USD", + "initial_margin_fraction": "0.1", + "open_order_count": 2, + "pending_order_count": 1, + "position_tied_order_count": 3, + "sign": 1, + "position": "0.5", + "avg_entry_price": "20000.00", + "position_value": "10000.00", + "unrealized_pnl": "500.00", + "realized_pnl": "100.00", + "liquidation_price": "3024.66", + "total_funding_paid_out": "34.2", + "margin_mode": 1, + "allocated_margin": "46342", + } + }, + "shares": [ + { + "public_pool_index": 1, + "shares_amount": 100, + "entry_usdc": "1000.00" + } + ], + "trades": { + "1": [ + { + "trade_id": 401, + "tx_hash": "0xabc123456789", + "type": "buy", + "market_id": 101, + "size": "0.5", + "price": "20000.00", + "usd_amount": "10000.00", + "ask_id": 501, + "bid_id": 502, + "ask_account_id": 123456, + "bid_account_id": 654321, + "is_maker_ask": true, + "block_height": 1500000, + "timestamp": 1700000000, + "taker_position_size_before":"1.14880", + "taker_entry_quote_before":"136130.046511", + "taker_initial_margin_fraction_before":500, + "maker_position_size_before":"-0.02594", + "maker_entry_quote_before":"3075.396750", + "maker_initial_margin_fraction_before":400 + } + ] + }, + "type": "update/account" +} +Account Market +The account market channel sends specific account market data for a market. + +JSON + +{ + "type": "subscribe", + "channel": "account_market/{MARKET_ID}/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "account_market/0/40", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "account": INTEGER, + "channel": "account_all/{MARKET_ID}/{ACCOUNT_ID}", + "funding_history": { + "timestamp": INTEGER, + "market_id": INTEGER, + "funding_id": INTEGER, + "change": STRING, + "rate": STRING, + "position_size": STRING, + "position_side": STRING + }, + "orders": [Order], + "position": Position, + "trades": [Trade], + "type": "update/account_market" +} +Account Stats +The account stats channel sends account stats data for the specific account. + +JSON + +{ + "type": "subscribe", + "channel": "user_stats/{ACCOUNT_ID}" +} +Example Subscription + +JSON + +{ + "type": "subscribe", + "channel": "user_stats/0" +} +Response Structure + +JSON + +{ + "channel": "user_stats:{ACCOUNT_ID}", + "stats": { + "collateral": STRING, + "portfolio_value": STRING, + "leverage": STRING, + "available_balance": STRING, + "margin_usage": STRING, + "buying_power": STRING, + "cross_stats":{ + "collateral": STRING, + "portfolio_value": STRING, + "leverage": STRING, + "available_balance": STRING, + "margin_usage": STRING, + "buying_power": STRING + }, + "total_stats":{ + "collateral": STRING, + "portfolio_value": STRING, + "leverage": STRING, + "available_balance": STRING, + "margin_usage": STRING, + "buying_power": STRING + } + + }, + "type": "update/user_stats" +} +Example Response + +JSON + +{ + "channel": "user_stats:10", + "stats": { + "collateral": "5000.00", + "portfolio_value": "15000.00", + "leverage": "3.0", + "available_balance": "2000.00", + "margin_usage": "0.80", + "buying_power": "4000.00", + "cross_stats":{ + "collateral":"0.000000", + "portfolio_value":"0.000000", + "leverage":"0.00", + "available_balance":"0.000000", + "margin_usage":"0.00", + "buying_power":"0" + }, + "total_stats":{ + "collateral":"0.000000", + "portfolio_value":"0.000000", + "leverage":"0.00", + "available_balance":"0.000000", + "margin_usage":"0.00", + "buying_power":"0" + } + }, + "type": "update/user_stats" +} +Transaction +The transaction channel sends all new transactions. + +JSON + +{ + "type": "subscribe", + "channel": "transaction" +} +Response Structure + +JSON + +{ + "channel": "transaction", + "txs": [Transaction], + "type": "update/transaction" +} +Executed Transaction +The structure is the same as with Transaction channel. But this channel sends only executed transactions. + +JSON + +{ + "type": "subscribe", + "channel": "executed_transaction" +} +Account Tx +The structure is the same as with Transaction channel. But this channel sends only transactions related to a specific account. + +JSON + +{ + "type": "subscribe", + "channel": "account_tx/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Account All Orders +The account all orders channel sends data about all the orders of an account. + +JSON + +{ + "type": "subscribe", + "channel": "account_all_orders/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "account_all_orders:{ACCOUNT_ID}", + "orders": { + "{MARKET_INDEX}": [Order] + }, + "type": "update/account_all_orders" +} +Height +Blockchain height updates + +JSON + +{ + "type": "subscribe", + "channel": "height", +} +Response Structure + +JSON + +{ + "channel": "height", + "height": INTEGER, + "type": "update/height" +} +Pool data +Provides data about pool activities: trades, orders, positions, shares and funding histories. + +JSON + +{ + "type": "subscribe", + "channel": "pool_data/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "pool_data:{ACCOUNT_ID}", + "account": INTEGER, + "trades": { + "{MARKET_INDEX}": [Trade] + }, + "orders": { + "{MARKET_INDEX}": [Order] + }, + "positions": { + "{MARKET_INDEX}": Position + }, + "shares": [PoolShares], + "funding_histories": { + "{MARKET_INDEX}": [PositionFunding] + }, + "type": "subscribed/pool_data" +} +Pool info +Provides information about pools. + +JSON + +{ + "type": "subscribe", + "channel": "pool_info/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "pool_info:{ACCOUNT_ID}", + "pool_info": { + "status": INTEGER, + "operator_fee": STRING, + "min_operator_share_rate": STRING, + "total_shares": INTEGER, + "operator_shares": INTEGER, + "annual_percentage_yield": FLOAT, + "daily_returns": [ + { + "timestamp": INTEGER, + "daily_return": FLOAT + } + ], + "share_prices": [ + { + "timestamp": INTEGER, + "share_price": FLOAT + } + ] + }, + "type": "subscribed/pool_info" +} +Notification +Provides notifications received by an account. Notifications can be of three kinds: liquidation, deleverage, or announcement. Each kind has a different content structure. + +JSON + +{ + "type": "subscribe", + "channel": "notification/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "notification:{ACCOUNT_ID}", + "notifs": [ + { + "id": STRING, + "created_at": STRING, + "updated_at": STRING, + "kind": STRING, + "account_index": INTEGER, + "content": NotificationContent, + "ack": BOOLEAN, + "acked_at": STRING + } + ], + "type": "subscribed/notification" +} +Liquidation Notification Content + +JSON + +{ + "id": STRING, + "is_ask": BOOL, + "usdc_amount": STRING, + "size": STRING, + "market_index": INTEGER, + "price": STRING, + "timestamp": INTEGER, + "avg_price": STRING +} +Deleverage Notification Content + +JSON + +{ + "id": STRING, + "usdc_amount": STRING, + "size": STRING, + "market_index": INTEGER, + "settlement_price": STRING, + "timestamp": INTEGER +} +Announcement Notification Content + +JSON + +{ + "title": STRING, + "content": STRING, + "created_at": INTEGER +} +Example response + +JSON + +{ + "channel": "notification:12345", + "notifs": [ + { + "id": "notif_123", + "created_at": "2024-01-15T10:30:00Z", + "updated_at": "2024-01-15T10:30:00Z", + "kind": "liquidation", + "account_index": 12345, + "content": { + "id": "notif_123", + "is_ask": false, + "usdc_amount": "1500.50", + "size": "0.500000", + "market_index": 1, + "price": "3000.00", + "timestamp": 1705312200, + "avg_price": "3000.00" + }, + "ack": false, + "acked_at": null + }, + { + "id": "notif_124", + "created_at": "2024-01-15T11:00:00Z", + "updated_at": "2024-01-15T11:00:00Z", + "kind": "deleverage", + "account_index": 12345, + "content": { + "id": "notif_124", + "usdc_amount": "500.25", + "size": "0.200000", + "market_index": 1, + "settlement_price": "2501.25", + "timestamp": 1705314000 + }, + "ack": false, + "acked_at": null + } + ], + "type": "update/notification" +} +Account Orders +The account all orders channel sends data about the orders of an account on a certain market. + +JSON + +{ + "type": "subscribe", + "channel": "account_orders/{MARKET_INDEX}/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "account": {ACCOUNT_INDEX}, + "channel": "account_orders:{MARKET_INDEX}", + "nonce": INTEGER, + "orders": { + "{MARKET_INDEX}": [Order] // the only present market index will be the one provided + }, + "type": "update/account_orders" +} +Account All Trades +The account all trades channel sends data about all the trades of an account. + +JSON + +{ + "type": "subscribe", + "channel": "account_all_trades/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "account_all_trades:{ACCOUNT_ID}", + "trades": { + "{MARKET_INDEX}": [Trade] + }, + "total_volume": FLOAT, + "monthly_volume": FLOAT, + "weekly_volume": FLOAT, + "daily_volume": FLOAT, + "type": "update/account_all_trades" +} +Account All Positions +The account all orders channel sends data about all the order of an account. + +JSON + +{ + "type": "subscribe", + "channel": "account_all_positions/{ACCOUNT_ID}", + "auth": "{AUTH_TOKEN}" +} +Response Structure + +JSON + +{ + "channel": "account_all_positions:{ACCOUNT_ID}", + "positions": { + "{MARKET_INDEX}": Position + }, + "shares": [PoolShares], + "type": "update/account_all_positions" +} \ No newline at end of file