typed-lighter 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- typed_lighter-0.1.0/LICENSE +21 -0
- typed_lighter-0.1.0/PKG-INFO +143 -0
- typed_lighter-0.1.0/README.md +119 -0
- typed_lighter-0.1.0/pyproject.toml +33 -0
- typed_lighter-0.1.0/setup.cfg +4 -0
- typed_lighter-0.1.0/src/typed_lighter/__init__.py +15 -0
- typed_lighter-0.1.0/src/typed_lighter/__init__.pyi +35 -0
- typed_lighter-0.1.0/src/typed_lighter/api/__init__.py +111 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/__init__.py +75 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/by_l1_address.py +92 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/change_tier.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/export.py +91 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/get.py +184 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/keys/__init__.py +13 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/keys/list.py +71 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/keys/maker_only.py +48 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/keys/next_nonce.py +52 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/keys/set_maker_only.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/l1_metadata.py +66 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/limits.py +68 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/liquidations.py +155 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/metadata.py +92 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/orders/__init__.py +13 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/orders/active.py +51 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/orders/by_client_index.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/orders/inactive.py +120 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/orders/trades.py +200 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/partner_stats.py +87 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/pnl.py +122 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/position_funding.py +134 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/set_metadata.py +68 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/tokens/__init__.py +12 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/tokens/create.py +87 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/tokens/list.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/tokens/revoke.py +54 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/__init__.py +14 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/deposits.py +124 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/fast_withdraw_info.py +53 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/fee_info.py +55 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/history.py +196 -0
- typed_lighter-0.1.0/src/typed_lighter/api/account/transfers/withdrawals.py +116 -0
- typed_lighter-0.1.0/src/typed_lighter/api/bridge/__init__.py +15 -0
- typed_lighter-0.1.0/src/typed_lighter/api/bridge/create_intent_address.py +63 -0
- typed_lighter-0.1.0/src/typed_lighter/api/bridge/deposit_networks.py +55 -0
- typed_lighter-0.1.0/src/typed_lighter/api/bridge/fast_bridge_info.py +41 -0
- typed_lighter-0.1.0/src/typed_lighter/api/bridge/latest_deposit.py +73 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/__init__.py +26 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/account_txs.py +121 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/block.py +44 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/block_txs.py +47 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/blocks.py +107 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/current_height.py +37 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/tx.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/tx_from_l1.py +33 -0
- typed_lighter-0.1.0/src/typed_lighter/api/chain/txs.py +99 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/__init__.py +38 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/asset_details.py +93 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/candles.py +180 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/exchange_metrics.py +110 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/exchange_stats.py +63 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/execute_stats.py +71 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/funding_rates.py +53 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/fundings.py +183 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/historical_trades_export.py +55 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/mark_price_candles.py +174 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/order_book_details.py +275 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/order_book_orders.py +59 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/order_books.py +122 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/price_charts.py +63 -0
- typed_lighter-0.1.0/src/typed_lighter/api/markets/recent_trades.py +53 -0
- typed_lighter-0.1.0/src/typed_lighter/api/notifications/__init__.py +10 -0
- typed_lighter-0.1.0/src/typed_lighter/api/notifications/ack.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/points/__init__.py +12 -0
- typed_lighter-0.1.0/src/typed_lighter/api/points/leaderboard.py +69 -0
- typed_lighter-0.1.0/src/typed_lighter/api/points/live_total.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/api/points/pnl_leaderboard.py +150 -0
- typed_lighter-0.1.0/src/typed_lighter/api/pools/__init__.py +12 -0
- typed_lighter-0.1.0/src/typed_lighter/api/pools/lease_options.py +51 -0
- typed_lighter-0.1.0/src/typed_lighter/api/pools/leases.py +120 -0
- typed_lighter-0.1.0/src/typed_lighter/api/pools/list.py +177 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/__init__.py +19 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/create.py +35 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/get.py +35 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/points.py +69 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/stats.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/update.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/update_kickback.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/use.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/api/referral/user_referrals.py +171 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/__init__.py +14 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/create.py +61 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/get.py +33 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/list.py +110 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/respond.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/rfq/update.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/__init__.py +28 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/announcements.py +54 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/faucet.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/info.py +36 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/layer1_basic_info.py +81 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/status.py +41 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/synthetic_spot_info.py +57 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/system_config.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/token_list.py +73 -0
- typed_lighter-0.1.0/src/typed_lighter/api/system/withdrawal_delay.py +36 -0
- typed_lighter-0.1.0/src/typed_lighter/core/__init__.py +5 -0
- typed_lighter-0.1.0/src/typed_lighter/core/__init__.pyi +50 -0
- typed_lighter-0.1.0/src/typed_lighter/core/auth.py +168 -0
- typed_lighter-0.1.0/src/typed_lighter/core/client.py +299 -0
- typed_lighter-0.1.0/src/typed_lighter/core/endpoint/__init__.py +1 -0
- typed_lighter-0.1.0/src/typed_lighter/core/endpoint/rpc.py +129 -0
- typed_lighter-0.1.0/src/typed_lighter/core/endpoint/stream.py +93 -0
- typed_lighter-0.1.0/src/typed_lighter/core/endpoint/wire.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/core/envelope.py +175 -0
- typed_lighter-0.1.0/src/typed_lighter/core/exc.py +27 -0
- typed_lighter-0.1.0/src/typed_lighter/core/networks.py +66 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/__init__.py +24 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/__init__.pyi +42 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/account.py +1510 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/curve.py +292 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/field.py +201 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/key.py +126 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/l1.py +50 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/poseidon2.py +121 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/poseidon2_constants.py +154 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/schnorr.py +132 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/token.py +80 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/__init__.py +35 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/account.py +415 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/assets.py +313 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/base.py +509 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/orders.py +601 -0
- typed_lighter-0.1.0/src/typed_lighter/core/signer/txs/pools.py +241 -0
- typed_lighter-0.1.0/src/typed_lighter/core/transport/__init__.py +1 -0
- typed_lighter-0.1.0/src/typed_lighter/core/transport/http.py +108 -0
- typed_lighter-0.1.0/src/typed_lighter/core/transport/ws.py +426 -0
- typed_lighter-0.1.0/src/typed_lighter/core/types.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/deposit_bridge/__init__.py +12 -0
- typed_lighter-0.1.0/src/typed_lighter/deposit_bridge/core.py +161 -0
- typed_lighter-0.1.0/src/typed_lighter/deposit_bridge/create_address.py +82 -0
- typed_lighter-0.1.0/src/typed_lighter/deposit_bridge/quote.py +108 -0
- typed_lighter-0.1.0/src/typed_lighter/deposit_bridge/status.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/__init__.py +36 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/account_assets.py +37 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/account_logs.py +224 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/account_positions.py +37 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/batch.py +34 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/batches.py +46 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/block.py +34 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/blocks.py +46 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/core.py +143 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/log.py +34 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/market_logs.py +140 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/markets.py +36 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/search.py +84 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/total.py +37 -0
- typed_lighter-0.1.0/src/typed_lighter/explorer/tx_stats.py +58 -0
- typed_lighter-0.1.0/src/typed_lighter/main.py +63 -0
- typed_lighter-0.1.0/src/typed_lighter/py.typed +0 -0
- typed_lighter-0.1.0/src/typed_lighter/scaling.py +195 -0
- typed_lighter-0.1.0/src/typed_lighter/schemas.py +1821 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/__init__.py +54 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_all.py +102 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_all_assets.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_all_orders.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_all_positions.py +50 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_all_trades.py +64 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_market.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_orders.py +48 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_spot_avg_entry_prices.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/account_tx.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/candles.py +47 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/height.py +43 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/mark_price_candles.py +47 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/market_stats.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/notifications.py +113 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/order_book.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/pool_data.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/pool_info.py +42 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/rfq.py +37 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/spot_market_stats.py +45 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/ticker.py +61 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/trades.py +46 -0
- typed_lighter-0.1.0/src/typed_lighter/streams/user_stats.py +99 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/__init__.py +58 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/approve_integrator.py +85 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/batch.py +81 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/burn_shares.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/cancel_all_orders.py +80 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/cancel_order.py +58 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/change_api_key.py +54 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/core.py +517 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/create_grouped_orders.py +138 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/create_order.py +266 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/create_public_pool.py +66 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/create_sub_account.py +50 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/fast_withdraw.py +67 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/lit_lease.py +74 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/mint_shares.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/modify_order.py +100 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/nonce.py +151 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/send.py +62 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/signing.py +296 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/stake.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/transfer.py +88 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/unstake.py +60 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/update_account_asset_config.py +58 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/update_account_config.py +54 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/update_leverage.py +66 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/update_margin.py +64 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/update_public_pool.py +71 -0
- typed_lighter-0.1.0/src/typed_lighter/tx/withdraw.py +66 -0
- typed_lighter-0.1.0/src/typed_lighter.egg-info/PKG-INFO +143 -0
- typed_lighter-0.1.0/src/typed_lighter.egg-info/SOURCES.txt +215 -0
- typed_lighter-0.1.0/src/typed_lighter.egg-info/dependency_links.txt +1 -0
- typed_lighter-0.1.0/src/typed_lighter.egg-info/requires.txt +6 -0
- typed_lighter-0.1.0/src/typed_lighter.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Tribulnation Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: typed-lighter
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: A fully typed, validated async client for the Lighter API.
|
|
5
|
+
Author-email: Marcel Claramunt <marcel@tribulnation.com>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Repository, https://github.com/tribulnation/typed
|
|
8
|
+
Project-URL: Documentation, https://tribulnation.com/typed/lighter
|
|
9
|
+
Project-URL: Website, https://tribulnation.com/typed
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Typing :: Typed
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: typed-core>=0.9.2
|
|
18
|
+
Requires-Dist: lazy-loader
|
|
19
|
+
Requires-Dist: httpx
|
|
20
|
+
Requires-Dist: pydantic
|
|
21
|
+
Requires-Dist: websockets
|
|
22
|
+
Requires-Dist: eth-account>=0.13
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
<p align="center">
|
|
26
|
+
<a href="https://tribulnation.com/typed/lighter">
|
|
27
|
+
<picture>
|
|
28
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://tribulnation.com/media/lockups/lighter-dark.svg">
|
|
29
|
+
<source media="(prefers-color-scheme: light)" srcset="https://tribulnation.com/media/lockups/lighter-light.svg">
|
|
30
|
+
<img alt="Typed Lighter" src="https://tribulnation.com/media/lockups/lighter-light.svg" width="520">
|
|
31
|
+
</picture>
|
|
32
|
+
</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<em>A fully typed, validated async client for the Lighter API.</em>
|
|
37
|
+
</p>
|
|
38
|
+
|
|
39
|
+
<p align="center">
|
|
40
|
+
<a href="https://pypi.org/project/typed-lighter/">
|
|
41
|
+
<img src="https://img.shields.io/pypi/v/typed-lighter.svg" alt="PyPI version">
|
|
42
|
+
</a>
|
|
43
|
+
<a href="https://pypi.org/project/typed-lighter/">
|
|
44
|
+
<img src="https://img.shields.io/pypi/pyversions/typed-lighter.svg" alt="Python versions">
|
|
45
|
+
</a>
|
|
46
|
+
<a href="https://tribulnation.com/typed/lighter">
|
|
47
|
+
<img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
|
|
48
|
+
</a>
|
|
49
|
+
<a href="LICENSE">
|
|
50
|
+
<img src="https://img.shields.io/pypi/l/typed-lighter.svg" alt="License">
|
|
51
|
+
</a>
|
|
52
|
+
</p>
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
- **Documentation**: [https://tribulnation.com/typed/lighter](https://tribulnation.com/typed/lighter)
|
|
57
|
+
- **Source Code**: [https://github.com/tribulnation/typed/tree/main/packages/lighter](https://github.com/tribulnation/typed/tree/main/packages/lighter)
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
```python
|
|
62
|
+
from typed_lighter import Lighter
|
|
63
|
+
|
|
64
|
+
async with Lighter.new(public=True) as client:
|
|
65
|
+
books = await client.api.markets.order_books(filter='perp')
|
|
66
|
+
for book in books['order_books'][:5]:
|
|
67
|
+
print(book['market_id'], book['symbol'], book['supported_price_decimals'])
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
[Lighter](https://apidocs.lighter.xyz/) is a perpetuals and spot order book running on its own
|
|
71
|
+
ZK rollup. Every state change (orders, transfers, leverage, API keys) is a signed L2
|
|
72
|
+
transaction; everything else is a REST read, a WebSocket stream, or an auth-token-gated
|
|
73
|
+
account write. The client mirrors that split:
|
|
74
|
+
|
|
75
|
+
| Surface | What it covers | Credentials |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| `client.api` | REST: markets, candles, accounts, orders and trades, transfers, blocks, pools, referrals, RFQ | public, or an auth token for private reads |
|
|
78
|
+
| `client.tx` | Signed transactions: orders, cancels, leverage, margin, transfers, sub-accounts, API keys, pools, staking | API key |
|
|
79
|
+
| `client.streams` | WebSocket channels: order books, trades, candles, market stats, account orders, positions, notifications | public, or an auth token for private channels |
|
|
80
|
+
| `client.signer` | Local signing with no network: every transaction type, auth tokens, key generation | API key |
|
|
81
|
+
| `client.explorer` | The public block explorer (mainnet and testnet): blocks, batches, logs, account history | none |
|
|
82
|
+
| `client.deposit_bridge` | Universal deposit addresses from other chains | bridge API key |
|
|
83
|
+
|
|
84
|
+
Signing happens in pure Python, inside the package: no compiled library, no external
|
|
85
|
+
process. Transactions go over HTTP or over the shared WebSocket connection, chosen per call.
|
|
86
|
+
|
|
87
|
+
## Authenticated Quick Start
|
|
88
|
+
|
|
89
|
+
```python
|
|
90
|
+
from typed_lighter import Lighter
|
|
91
|
+
|
|
92
|
+
async with Lighter.new() as client: # reads LIGHTER_ACCOUNT_INDEX, LIGHTER_API_KEY_INDEX, LIGHTER_API_PRIVATE_KEY
|
|
93
|
+
account = client.signer.account_index
|
|
94
|
+
orders = await client.api.account.orders.active(account_index=account)
|
|
95
|
+
for order in orders['orders']:
|
|
96
|
+
print(order['market_index'], order['order_index'], order['price'], order['status'])
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
See [Authenticated Setup](https://tribulnation.com/typed/lighter/authenticated-setup) for how
|
|
100
|
+
accounts, API keys and auth tokens work on Lighter.
|
|
101
|
+
|
|
102
|
+
## Why Typed Lighter?
|
|
103
|
+
|
|
104
|
+
- **🎯 Precise Types**: Typed requests and responses on every surface, down to order-type unions and `Literal` statuses, not `dict`/`Any`.
|
|
105
|
+
- **✅ Runtime Validation**: REST replies, WebSocket frames and transaction receipts validated by default, not just typed on paper.
|
|
106
|
+
- **⚡ Async First**: Async HTTP and one multiplexed WebSocket connection for streams and transactions, built for concurrent workflows.
|
|
107
|
+
- **📚 Full Surface**: Every REST endpoint and stream channel, all 20 user transaction types, the explorer and the deposit bridge, not just the popular ones.
|
|
108
|
+
|
|
109
|
+
## Installation
|
|
110
|
+
|
|
111
|
+
```bash
|
|
112
|
+
pip install typed-lighter
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
## How To
|
|
116
|
+
|
|
117
|
+
- [Fetch Market Data](https://tribulnation.com/typed/lighter/how-to/fetch-market-data)
|
|
118
|
+
- [Fetch Account Data](https://tribulnation.com/typed/lighter/how-to/fetch-account-data)
|
|
119
|
+
- [Paginate Through Results](https://tribulnation.com/typed/lighter/how-to/paginate-through-results)
|
|
120
|
+
- [Place & Manage Orders](https://tribulnation.com/typed/lighter/how-to/place-and-manage-orders)
|
|
121
|
+
- [Listen To Streams](https://tribulnation.com/typed/lighter/how-to/listen-to-streams)
|
|
122
|
+
- [Batch Transactions](https://tribulnation.com/typed/lighter/how-to/batch-transactions)
|
|
123
|
+
- [Transfers & Sub-Accounts](https://tribulnation.com/typed/lighter/how-to/transfers-and-sub-accounts)
|
|
124
|
+
- [Sign Offline](https://tribulnation.com/typed/lighter/how-to/sign-offline)
|
|
125
|
+
|
|
126
|
+
## Reference
|
|
127
|
+
|
|
128
|
+
- [Authenticated Setup](https://tribulnation.com/typed/lighter/authenticated-setup)
|
|
129
|
+
- [Async Usage](https://tribulnation.com/typed/lighter/reference/async-usage)
|
|
130
|
+
- [Error Handling](https://tribulnation.com/typed/lighter/reference/error-handling)
|
|
131
|
+
- [Environment Variables](https://tribulnation.com/typed/lighter/reference/env-vars)
|
|
132
|
+
- [Timestamps](https://tribulnation.com/typed/lighter/reference/timestamps)
|
|
133
|
+
- [Numbers](https://tribulnation.com/typed/lighter/reference/numbers)
|
|
134
|
+
|
|
135
|
+
## Design Philosophy
|
|
136
|
+
|
|
137
|
+
Typed Lighter follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).
|
|
138
|
+
|
|
139
|
+
*Details matter. Developer experience matters.*
|
|
140
|
+
|
|
141
|
+
## License
|
|
142
|
+
|
|
143
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://tribulnation.com/typed/lighter">
|
|
3
|
+
<picture>
|
|
4
|
+
<source media="(prefers-color-scheme: dark)" srcset="https://tribulnation.com/media/lockups/lighter-dark.svg">
|
|
5
|
+
<source media="(prefers-color-scheme: light)" srcset="https://tribulnation.com/media/lockups/lighter-light.svg">
|
|
6
|
+
<img alt="Typed Lighter" src="https://tribulnation.com/media/lockups/lighter-light.svg" width="520">
|
|
7
|
+
</picture>
|
|
8
|
+
</a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<em>A fully typed, validated async client for the Lighter API.</em>
|
|
13
|
+
</p>
|
|
14
|
+
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="https://pypi.org/project/typed-lighter/">
|
|
17
|
+
<img src="https://img.shields.io/pypi/v/typed-lighter.svg" alt="PyPI version">
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://pypi.org/project/typed-lighter/">
|
|
20
|
+
<img src="https://img.shields.io/pypi/pyversions/typed-lighter.svg" alt="Python versions">
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://tribulnation.com/typed/lighter">
|
|
23
|
+
<img src="https://img.shields.io/badge/docs-live-black" alt="Docs">
|
|
24
|
+
</a>
|
|
25
|
+
<a href="LICENSE">
|
|
26
|
+
<img src="https://img.shields.io/pypi/l/typed-lighter.svg" alt="License">
|
|
27
|
+
</a>
|
|
28
|
+
</p>
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
- **Documentation**: [https://tribulnation.com/typed/lighter](https://tribulnation.com/typed/lighter)
|
|
33
|
+
- **Source Code**: [https://github.com/tribulnation/typed/tree/main/packages/lighter](https://github.com/tribulnation/typed/tree/main/packages/lighter)
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from typed_lighter import Lighter
|
|
39
|
+
|
|
40
|
+
async with Lighter.new(public=True) as client:
|
|
41
|
+
books = await client.api.markets.order_books(filter='perp')
|
|
42
|
+
for book in books['order_books'][:5]:
|
|
43
|
+
print(book['market_id'], book['symbol'], book['supported_price_decimals'])
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
[Lighter](https://apidocs.lighter.xyz/) is a perpetuals and spot order book running on its own
|
|
47
|
+
ZK rollup. Every state change (orders, transfers, leverage, API keys) is a signed L2
|
|
48
|
+
transaction; everything else is a REST read, a WebSocket stream, or an auth-token-gated
|
|
49
|
+
account write. The client mirrors that split:
|
|
50
|
+
|
|
51
|
+
| Surface | What it covers | Credentials |
|
|
52
|
+
|---|---|---|
|
|
53
|
+
| `client.api` | REST: markets, candles, accounts, orders and trades, transfers, blocks, pools, referrals, RFQ | public, or an auth token for private reads |
|
|
54
|
+
| `client.tx` | Signed transactions: orders, cancels, leverage, margin, transfers, sub-accounts, API keys, pools, staking | API key |
|
|
55
|
+
| `client.streams` | WebSocket channels: order books, trades, candles, market stats, account orders, positions, notifications | public, or an auth token for private channels |
|
|
56
|
+
| `client.signer` | Local signing with no network: every transaction type, auth tokens, key generation | API key |
|
|
57
|
+
| `client.explorer` | The public block explorer (mainnet and testnet): blocks, batches, logs, account history | none |
|
|
58
|
+
| `client.deposit_bridge` | Universal deposit addresses from other chains | bridge API key |
|
|
59
|
+
|
|
60
|
+
Signing happens in pure Python, inside the package: no compiled library, no external
|
|
61
|
+
process. Transactions go over HTTP or over the shared WebSocket connection, chosen per call.
|
|
62
|
+
|
|
63
|
+
## Authenticated Quick Start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from typed_lighter import Lighter
|
|
67
|
+
|
|
68
|
+
async with Lighter.new() as client: # reads LIGHTER_ACCOUNT_INDEX, LIGHTER_API_KEY_INDEX, LIGHTER_API_PRIVATE_KEY
|
|
69
|
+
account = client.signer.account_index
|
|
70
|
+
orders = await client.api.account.orders.active(account_index=account)
|
|
71
|
+
for order in orders['orders']:
|
|
72
|
+
print(order['market_index'], order['order_index'], order['price'], order['status'])
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
See [Authenticated Setup](https://tribulnation.com/typed/lighter/authenticated-setup) for how
|
|
76
|
+
accounts, API keys and auth tokens work on Lighter.
|
|
77
|
+
|
|
78
|
+
## Why Typed Lighter?
|
|
79
|
+
|
|
80
|
+
- **🎯 Precise Types**: Typed requests and responses on every surface, down to order-type unions and `Literal` statuses, not `dict`/`Any`.
|
|
81
|
+
- **✅ Runtime Validation**: REST replies, WebSocket frames and transaction receipts validated by default, not just typed on paper.
|
|
82
|
+
- **⚡ Async First**: Async HTTP and one multiplexed WebSocket connection for streams and transactions, built for concurrent workflows.
|
|
83
|
+
- **📚 Full Surface**: Every REST endpoint and stream channel, all 20 user transaction types, the explorer and the deposit bridge, not just the popular ones.
|
|
84
|
+
|
|
85
|
+
## Installation
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
pip install typed-lighter
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## How To
|
|
92
|
+
|
|
93
|
+
- [Fetch Market Data](https://tribulnation.com/typed/lighter/how-to/fetch-market-data)
|
|
94
|
+
- [Fetch Account Data](https://tribulnation.com/typed/lighter/how-to/fetch-account-data)
|
|
95
|
+
- [Paginate Through Results](https://tribulnation.com/typed/lighter/how-to/paginate-through-results)
|
|
96
|
+
- [Place & Manage Orders](https://tribulnation.com/typed/lighter/how-to/place-and-manage-orders)
|
|
97
|
+
- [Listen To Streams](https://tribulnation.com/typed/lighter/how-to/listen-to-streams)
|
|
98
|
+
- [Batch Transactions](https://tribulnation.com/typed/lighter/how-to/batch-transactions)
|
|
99
|
+
- [Transfers & Sub-Accounts](https://tribulnation.com/typed/lighter/how-to/transfers-and-sub-accounts)
|
|
100
|
+
- [Sign Offline](https://tribulnation.com/typed/lighter/how-to/sign-offline)
|
|
101
|
+
|
|
102
|
+
## Reference
|
|
103
|
+
|
|
104
|
+
- [Authenticated Setup](https://tribulnation.com/typed/lighter/authenticated-setup)
|
|
105
|
+
- [Async Usage](https://tribulnation.com/typed/lighter/reference/async-usage)
|
|
106
|
+
- [Error Handling](https://tribulnation.com/typed/lighter/reference/error-handling)
|
|
107
|
+
- [Environment Variables](https://tribulnation.com/typed/lighter/reference/env-vars)
|
|
108
|
+
- [Timestamps](https://tribulnation.com/typed/lighter/reference/timestamps)
|
|
109
|
+
- [Numbers](https://tribulnation.com/typed/lighter/reference/numbers)
|
|
110
|
+
|
|
111
|
+
## Design Philosophy
|
|
112
|
+
|
|
113
|
+
Typed Lighter follows the principles outlined in [this blog post](https://tribulnation.com/blog/clients).
|
|
114
|
+
|
|
115
|
+
*Details matter. Developer experience matters.*
|
|
116
|
+
|
|
117
|
+
## License
|
|
118
|
+
|
|
119
|
+
MIT — see [LICENSE](LICENSE).
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "typed-lighter"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
authors = [
|
|
9
|
+
{name="Marcel Claramunt", email="marcel@tribulnation.com"}
|
|
10
|
+
]
|
|
11
|
+
description = "A fully typed, validated async client for the Lighter API."
|
|
12
|
+
license = "MIT"
|
|
13
|
+
license-files = ["LICENSE"]
|
|
14
|
+
requires-python = ">=3.10"
|
|
15
|
+
readme = {file="README.md", content-type="text/markdown"}
|
|
16
|
+
classifiers = [
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Typing :: Typed",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"typed-core>=0.9.2", "lazy-loader", "httpx", "pydantic", "websockets",
|
|
24
|
+
"eth-account>=0.13",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[tool.setuptools.package-data]
|
|
28
|
+
"typed_lighter" = ["py.typed", "*.pyi", "**/*.pyi"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Repository = "https://github.com/tribulnation/typed"
|
|
32
|
+
Documentation = "https://tribulnation.com/typed/lighter"
|
|
33
|
+
Website = "https://tribulnation.com/typed"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"""A fully typed, validated async client for the Lighter API.
|
|
2
|
+
|
|
3
|
+
Examples:
|
|
4
|
+
```python
|
|
5
|
+
from typed_lighter import Lighter
|
|
6
|
+
|
|
7
|
+
async with Lighter.new(public=True) as client:
|
|
8
|
+
books = await client.api.markets.order_books()
|
|
9
|
+
print(books['order_books'][0]['symbol'])
|
|
10
|
+
```
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
import lazy_loader as lazy
|
|
14
|
+
|
|
15
|
+
__getattr__, __dir__, __all__ = lazy.attach_stub(__name__, __file__)
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from .main import Lighter
|
|
2
|
+
from .core import (
|
|
3
|
+
Error,
|
|
4
|
+
NetworkError,
|
|
5
|
+
ValidationError,
|
|
6
|
+
ApiError,
|
|
7
|
+
BadRequest,
|
|
8
|
+
AuthError,
|
|
9
|
+
RateLimited,
|
|
10
|
+
LogicError,
|
|
11
|
+
error_code,
|
|
12
|
+
Network,
|
|
13
|
+
)
|
|
14
|
+
from .core.signer import Signer, PythonSigner, SignedTx, AccountSigner
|
|
15
|
+
from .scaling import Scaler, Rounding
|
|
16
|
+
|
|
17
|
+
__all__ = [
|
|
18
|
+
'Lighter',
|
|
19
|
+
'Error',
|
|
20
|
+
'NetworkError',
|
|
21
|
+
'ValidationError',
|
|
22
|
+
'ApiError',
|
|
23
|
+
'BadRequest',
|
|
24
|
+
'AuthError',
|
|
25
|
+
'RateLimited',
|
|
26
|
+
'LogicError',
|
|
27
|
+
'error_code',
|
|
28
|
+
'Network',
|
|
29
|
+
'Signer',
|
|
30
|
+
'SignedTx',
|
|
31
|
+
'PythonSigner',
|
|
32
|
+
'AccountSigner',
|
|
33
|
+
'Scaler',
|
|
34
|
+
'Rounding',
|
|
35
|
+
]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# Generated by typed-dev — see CONTRIBUTING.md.
|
|
2
|
+
from functools import cached_property
|
|
3
|
+
from .account import Account
|
|
4
|
+
from .bridge import Bridge
|
|
5
|
+
from .chain import Chain
|
|
6
|
+
from .markets import Markets
|
|
7
|
+
from .notifications import Notifications
|
|
8
|
+
from .points import Points
|
|
9
|
+
from .pools import Pools
|
|
10
|
+
from .referral import Referral
|
|
11
|
+
from .rfq import Rfq
|
|
12
|
+
from .system import System
|
|
13
|
+
from typed_lighter.core.endpoint.rpc import RpcEndpoint
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class Api(RpcEndpoint):
|
|
17
|
+
"""The main REST API (`/api/v1/*`): public reads, auth-token reads and auth-token account writes. Signed L2 transactions are `client.tx`.
|
|
18
|
+
|
|
19
|
+
References:
|
|
20
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/get-started)
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
@cached_property
|
|
24
|
+
def account(self) -> Account:
|
|
25
|
+
"""Accounts by index or L1 address, metadata, limits, PnL, fundings, liquidations, exports and account settings.
|
|
26
|
+
|
|
27
|
+
References:
|
|
28
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/account-1)
|
|
29
|
+
"""
|
|
30
|
+
return Account(client=self.client)
|
|
31
|
+
|
|
32
|
+
@cached_property
|
|
33
|
+
def bridge(self) -> Bridge:
|
|
34
|
+
"""Deposits through bridges: latest deposit, supported networks, CCTP intent addresses and fast-bridge limits.
|
|
35
|
+
|
|
36
|
+
References:
|
|
37
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/deposits-transfers-and-withdrawals)
|
|
38
|
+
"""
|
|
39
|
+
return Bridge(client=self.client)
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def chain(self) -> Chain:
|
|
43
|
+
"""L2 chain state: transactions by hash, block or account, blocks and the current height.
|
|
44
|
+
|
|
45
|
+
References:
|
|
46
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/tx)
|
|
47
|
+
"""
|
|
48
|
+
return Chain(client=self.client)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def markets(self) -> Markets:
|
|
52
|
+
"""Market metadata, order books, trades, exchange statistics, candles, fundings and price charts.
|
|
53
|
+
|
|
54
|
+
References:
|
|
55
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/orderbooks)
|
|
56
|
+
"""
|
|
57
|
+
return Markets(client=self.client)
|
|
58
|
+
|
|
59
|
+
@cached_property
|
|
60
|
+
def notifications(self) -> Notifications:
|
|
61
|
+
"""Acknowledging account notifications (liquidations, deleverages, announcements).
|
|
62
|
+
|
|
63
|
+
References:
|
|
64
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/notification_ack)
|
|
65
|
+
"""
|
|
66
|
+
return Notifications(client=self.client)
|
|
67
|
+
|
|
68
|
+
@cached_property
|
|
69
|
+
def points(self) -> Points:
|
|
70
|
+
"""Live points, the points leaderboard and the PnL leaderboard.
|
|
71
|
+
|
|
72
|
+
References:
|
|
73
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/pnlleaderboard)
|
|
74
|
+
"""
|
|
75
|
+
return Points(client=self.client)
|
|
76
|
+
|
|
77
|
+
@cached_property
|
|
78
|
+
def pools(self) -> Pools:
|
|
79
|
+
"""Public pools and staking pools, and LIT lease options and leases.
|
|
80
|
+
|
|
81
|
+
References:
|
|
82
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/manage-public-pools-shares)
|
|
83
|
+
"""
|
|
84
|
+
return Pools(client=self.client)
|
|
85
|
+
|
|
86
|
+
@cached_property
|
|
87
|
+
def referral(self) -> Referral:
|
|
88
|
+
"""Referral codes, kickbacks, referred users, referral points and referral trade stats.
|
|
89
|
+
|
|
90
|
+
References:
|
|
91
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/referrals)
|
|
92
|
+
"""
|
|
93
|
+
return Referral(client=self.client)
|
|
94
|
+
|
|
95
|
+
@cached_property
|
|
96
|
+
def rfq(self) -> Rfq:
|
|
97
|
+
"""Requests for quote (whitelisted accounts): create, respond, update, get and list.
|
|
98
|
+
|
|
99
|
+
References:
|
|
100
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/rfq_create)
|
|
101
|
+
"""
|
|
102
|
+
return Rfq(client=self.client)
|
|
103
|
+
|
|
104
|
+
@cached_property
|
|
105
|
+
def system(self) -> System:
|
|
106
|
+
"""Exchange status, L1 contract and chain configuration, announcements, the token list and the testnet faucet.
|
|
107
|
+
|
|
108
|
+
References:
|
|
109
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/status)
|
|
110
|
+
"""
|
|
111
|
+
return System(client=self.client)
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Generated by typed-dev — see CONTRIBUTING.md.
|
|
2
|
+
from functools import cached_property
|
|
3
|
+
from .by_l1_address import ByL1Address
|
|
4
|
+
from .change_tier import ChangeTier
|
|
5
|
+
from .export import Export
|
|
6
|
+
from .get import Get
|
|
7
|
+
from .keys import Keys
|
|
8
|
+
from .l1_metadata import L1MetadataEndpoint
|
|
9
|
+
from .limits import Limits
|
|
10
|
+
from .liquidations import Liquidations
|
|
11
|
+
from .metadata import Metadata
|
|
12
|
+
from .orders import Orders
|
|
13
|
+
from .partner_stats import PartnerStatsEndpoint
|
|
14
|
+
from .pnl import Pnl
|
|
15
|
+
from .position_funding import PositionFundingEndpoint
|
|
16
|
+
from .set_metadata import SetMetadata
|
|
17
|
+
from .tokens import Tokens
|
|
18
|
+
from .transfers import Transfers
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class Account(
|
|
22
|
+
ByL1Address,
|
|
23
|
+
ChangeTier,
|
|
24
|
+
Export,
|
|
25
|
+
Get,
|
|
26
|
+
L1MetadataEndpoint,
|
|
27
|
+
Limits,
|
|
28
|
+
Liquidations,
|
|
29
|
+
Metadata,
|
|
30
|
+
PartnerStatsEndpoint,
|
|
31
|
+
Pnl,
|
|
32
|
+
PositionFundingEndpoint,
|
|
33
|
+
SetMetadata,
|
|
34
|
+
):
|
|
35
|
+
"""Accounts by index or L1 address, metadata, limits, PnL, fundings, liquidations, exports and account settings.
|
|
36
|
+
|
|
37
|
+
References:
|
|
38
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/account-1)
|
|
39
|
+
"""
|
|
40
|
+
|
|
41
|
+
@cached_property
|
|
42
|
+
def keys(self) -> Keys:
|
|
43
|
+
"""An account's registered API keys, their next nonces, and maker-only key settings.
|
|
44
|
+
|
|
45
|
+
References:
|
|
46
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/api-keys)
|
|
47
|
+
"""
|
|
48
|
+
return Keys(client=self.client)
|
|
49
|
+
|
|
50
|
+
@cached_property
|
|
51
|
+
def orders(self) -> Orders:
|
|
52
|
+
"""An account's open and closed orders, orders by client index, and its trades.
|
|
53
|
+
|
|
54
|
+
References:
|
|
55
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/accountactiveorders)
|
|
56
|
+
"""
|
|
57
|
+
return Orders(client=self.client)
|
|
58
|
+
|
|
59
|
+
@cached_property
|
|
60
|
+
def tokens(self) -> Tokens:
|
|
61
|
+
"""Server-issued read-only API tokens: list, create and revoke.
|
|
62
|
+
|
|
63
|
+
References:
|
|
64
|
+
- [Upstream docs](https://apidocs.lighter.xyz/reference/tokens)
|
|
65
|
+
"""
|
|
66
|
+
return Tokens(client=self.client)
|
|
67
|
+
|
|
68
|
+
@cached_property
|
|
69
|
+
def transfers(self) -> Transfers:
|
|
70
|
+
"""An account's deposit, withdrawal and transfer history, transfer fees and fast-withdrawal limits.
|
|
71
|
+
|
|
72
|
+
References:
|
|
73
|
+
- [Upstream docs](https://apidocs.lighter.xyz/docs/deposits-transfers-and-withdrawals)
|
|
74
|
+
"""
|
|
75
|
+
return Transfers(client=self.client)
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Generated by typed-dev — see CONTRIBUTING.md.
|
|
2
|
+
from decimal import Decimal
|
|
3
|
+
from typing_extensions import Literal, NotRequired, TypedDict
|
|
4
|
+
from typed_lighter.core import TimestampMicros, TimestampMillis
|
|
5
|
+
from typed_lighter.core.endpoint.rpc import RpcEndpoint
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Account(TypedDict):
|
|
9
|
+
"""One account in summary form."""
|
|
10
|
+
|
|
11
|
+
code: int
|
|
12
|
+
"""Per-account status code, normally `0`; only the top-level `code` signals an error."""
|
|
13
|
+
message: NotRequired[str]
|
|
14
|
+
"""Optional human-readable detail; usually absent on success."""
|
|
15
|
+
account_type: int
|
|
16
|
+
"""Account kind. Lighter documents no numeric mapping; observed values: `0` a master account, `1` a sub-account, `2` a user-operated public pool, `3` the LLP, `4` a staking pool."""
|
|
17
|
+
account_trading_mode: Literal[0, 1]
|
|
18
|
+
"""`0` classic (separate spot and perps balances), `1` unified (USDC shared by spot and perps)."""
|
|
19
|
+
index: int
|
|
20
|
+
"""Account index."""
|
|
21
|
+
l1_address: str
|
|
22
|
+
"""L1 address owning the account; the zero address for protocol pools."""
|
|
23
|
+
cancel_all_time: TimestampMillis
|
|
24
|
+
"""Time of a scheduled cancel-all (dead man's switch); `0` when none is scheduled, which parses to the Unix epoch (1970-01-01 UTC)."""
|
|
25
|
+
total_order_count: int
|
|
26
|
+
"""Open orders of the account."""
|
|
27
|
+
total_isolated_order_count: int
|
|
28
|
+
"""Open orders in isolated-margin positions."""
|
|
29
|
+
pending_order_count: int
|
|
30
|
+
"""Untriggered conditional orders."""
|
|
31
|
+
available_balance: Decimal | Literal['']
|
|
32
|
+
"""Available balance, in USDC. Always `""` in this summary form; `account` reports the value."""
|
|
33
|
+
status: int
|
|
34
|
+
"""Account status code (values undocumented; `1` active and `0` inactive observed)."""
|
|
35
|
+
collateral: Decimal
|
|
36
|
+
"""Perps collateral (USDC)."""
|
|
37
|
+
transaction_time: TimestampMicros
|
|
38
|
+
"""Time of the account's last transaction; `0` in `accountsByL1Address`."""
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
class Request(TypedDict):
|
|
42
|
+
l1_address: str
|
|
43
|
+
"""Ethereum (L1) address, `0x`-prefixed hex."""
|
|
44
|
+
cursor: NotRequired[str]
|
|
45
|
+
"""Opaque cursor; the response carries none, so it is never needed."""
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class SubAccounts(TypedDict):
|
|
49
|
+
"""Every account of one L1 address, in summary form."""
|
|
50
|
+
|
|
51
|
+
code: int
|
|
52
|
+
"""`200` on success."""
|
|
53
|
+
message: NotRequired[str]
|
|
54
|
+
"""Optional human-readable detail; usually absent on success."""
|
|
55
|
+
l1_address: str
|
|
56
|
+
"""The queried L1 address."""
|
|
57
|
+
sub_accounts: list[Account]
|
|
58
|
+
"""Accounts of the address, master first."""
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class ByL1Address(RpcEndpoint):
|
|
62
|
+
"""List every account (master, sub-accounts, pools it created) of an L1 address, in summary form."""
|
|
63
|
+
|
|
64
|
+
async def by_l1_address(
|
|
65
|
+
self,
|
|
66
|
+
*,
|
|
67
|
+
l1_address: str,
|
|
68
|
+
cursor: str | None = None,
|
|
69
|
+
validate: bool | None = None,
|
|
70
|
+
) -> SubAccounts:
|
|
71
|
+
"""List every account (master, sub-accounts, pools it created) of an L1 address, in summary form.
|
|
72
|
+
|
|
73
|
+
Args:
|
|
74
|
+
l1_address: Ethereum (L1) address, `0x`-prefixed hex.
|
|
75
|
+
cursor: Opaque cursor; the response carries none, so it is never needed.
|
|
76
|
+
validate: Override this call's response validation; falls back to the client-level default when omitted.
|
|
77
|
+
|
|
78
|
+
References:
|
|
79
|
+
- [Official docs](https://apidocs.lighter.xyz/reference/accountsbyl1address)
|
|
80
|
+
"""
|
|
81
|
+
request: Request = Request(l1_address=l1_address)
|
|
82
|
+
if cursor is not None:
|
|
83
|
+
request['cursor'] = cursor
|
|
84
|
+
return await self.request(
|
|
85
|
+
request,
|
|
86
|
+
method='GET',
|
|
87
|
+
path='/api/v1/accountsByL1Address',
|
|
88
|
+
meta={},
|
|
89
|
+
validate=validate,
|
|
90
|
+
request_type=Request,
|
|
91
|
+
response_type=SubAccounts,
|
|
92
|
+
)
|