Skip to content

Latest commit

 

History

History
602 lines (406 loc) · 17.7 KB

File metadata and controls

602 lines (406 loc) · 17.7 KB

lighter.TransactionApi

All URIs are relative to https://mainnet.zklighter.elliot.ai

Method HTTP request Description
deposit_history GET /api/v1/deposit/history deposit_history
next_nonce GET /api/v1/nextNonce nextNonce
send_tx POST /api/v1/sendTx sendTx
send_tx_batch POST /api/v1/sendTxBatch sendTxBatch
transfer_history GET /api/v1/transfer/history transfer_history
tx GET /api/v1/tx tx
tx_from_l1_tx_hash GET /api/v1/txFromL1TxHash txFromL1TxHash
withdraw_history GET /api/v1/withdraw/history withdraw_history

deposit_history

DepositHistory deposit_history(account_index, l1_address, authorization=authorization, auth=auth, cursor=cursor, filter=filter)

deposit_history

Get deposit history

Example

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

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] [Back to Model list] [Back to README]

next_nonce

NextNonce next_nonce(account_index, api_key_index)

nextNonce

Get next nonce for a specific account and api key

Example

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

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] [Back to Model list] [Back to README]

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

Example

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

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] [Back to Model list] [Back to README]

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

Example

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

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] [Back to Model list] [Back to README]

transfer_history

TransferHistory transfer_history(account_index, authorization=authorization, auth=auth, cursor=cursor)

transfer_history

Get transfer history

Example

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

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] [Back to Model list] [Back to README]

tx

EnrichedTx tx(by, value)

tx

Get transaction by hash or sequence index

Example

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

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] [Back to Model list] [Back to README]

tx_from_l1_tx_hash

EnrichedTx tx_from_l1_tx_hash(hash)

txFromL1TxHash

Get L1 transaction by L1 transaction hash

Example

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

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] [Back to Model list] [Back to README]

withdraw_history

WithdrawHistory withdraw_history(account_index, authorization=authorization, auth=auth, cursor=cursor, filter=filter)

withdraw_history

Get withdraw history

Example

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

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] [Back to Model list] [Back to README]