Skip to content

elliottech/lighter-python

Repository files navigation

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:

pip install git+https://github.com/elliottech/lighter-python.git

Then import the package:

import lighter

Tests

Execute pytest to run the tests.

Getting Started

Please follow the installation procedure and then run the following:

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

python examples/get_info.py
python examples/ws.py
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 GET /api/v1/account account
AccountApi accounts GET /api/v1/accounts accounts
AccountApi accounts_by_l1_address GET /api/v1/accountsByL1Address accountsByL1Address
AccountApi apikeys GET /api/v1/apikeys apikeys
AccountApi fee_bucket GET /api/v1/feeBucket feeBucket
AccountApi is_whitelisted GET /api/v1/isWhitelisted isWhitelisted
AccountApi pnl GET /api/v1/pnl pnl
AccountApi public_pools GET /api/v1/publicPools publicPools
BlockApi block GET /api/v1/block block
BlockApi blocks GET /api/v1/blocks blocks
BlockApi current_height GET /api/v1/currentHeight currentHeight
CandlestickApi candlesticks GET /api/v1/candlesticks candlesticks
CandlestickApi fundings GET /api/v1/fundings fundings
InfoApi layer2_basic_info GET /api/v1/layer2BasicInfo layer2BasicInfo
OrderApi account_active_orders GET /api/v1/accountActiveOrders accountActiveOrders
OrderApi account_inactive_orders GET /api/v1/accountInactiveOrders accountInactiveOrders
OrderApi account_orders GET /api/v1/accountOrders accountOrders
OrderApi exchange_stats GET /api/v1/exchangeStats exchangeStats
OrderApi order_book_details GET /api/v1/orderBookDetails orderBookDetails
OrderApi order_book_orders GET /api/v1/orderBookOrders orderBookOrders
OrderApi order_books GET /api/v1/orderBooks orderBooks
OrderApi recent_trades GET /api/v1/recentTrades recentTrades
OrderApi trades GET /api/v1/trades trades
RootApi info GET /info info
RootApi status GET / status
TransactionApi account_pending_txs GET /api/v1/accountPendingTxs accountPendingTxs
TransactionApi account_txs GET /api/v1/accountTxs accountTxs
TransactionApi block_txs GET /api/v1/blockTxs blockTxs
TransactionApi deposit_history GET /api/v1/deposit/history deposit_history
TransactionApi next_nonce GET /api/v1/nextNonce nextNonce
TransactionApi pending_txs GET /api/v1/pendingTxs pendingTxs
TransactionApi send_tx POST /api/v1/sendTx sendTx
TransactionApi send_tx_batch POST /api/v1/sendTxBatch sendTxBatch
TransactionApi tx GET /api/v1/tx tx
TransactionApi tx_from_l1_tx_hash GET /api/v1/txFromL1TxHash txFromL1TxHash
TransactionApi txs GET /api/v1/txs txs
TransactionApi withdraw_history GET /api/v1/withdraw/history withdraw_history

Documentation For Models

Documentation For Authorization

Endpoints do not require authorization.