Skip to content

Urgent: Lighter Python SDK Withdrawal Issue - "invalid asset index" on Latest Codebase #94

@lly835

Description

@lly835

Dear Lighter Team,

We are experiencing a critical issue with the withdrawal functionality (Mode 11) in the Lighter Python SDK, resulting in
transactions being rejected by your API with an invalid asset index error. This occurs even when using the latest available
codebase from your official GitHub repository.

Details of the Issue:

  1. Error Encountered: When attempting a withdrawal via create_market_order.py (which utilizes the lighter.SignerClient.withdraw
    method), the Lighter server API consistently returns: code=21801 message='invalid asset index'.
  2. Investigation into Cause:
    • We performed a thorough investigation, including updating the local lighter-sdk Python code (lighter/signer_client.py,
      lighter/nonce_manager.py) and the underlying binary signer files (lighter/signers/.dylib/.so/*.dll) to the absolute
      latest versions from your elliottech/lighter-python GitHub repository.
    • Debugging revealed that the SignWithdraw function within these latest binary signer files (e.g.,
      lighter-signer-darwin-arm64.dylib) still generates a transaction payload (JSON tx_info) that contains "USDCAmount" but
      does not include an explicit "AssetId" field.
    • The latest Python signer_client.py calls this binary function with the signature SignWithdraw(usdc_amount, nonce,
      api_key_index, account_index), confirming that no explicit asset_id parameter is passed from the Python layer.
  3. Conclusion: The invalid asset index error strongly indicates that your current Lighter API server for withdrawals now
    requires an explicit AssetId field in the transaction payload. However, the latest publicly available Lighter Python SDK
    (both the Python wrapper and the underlying binary signer) is generating an outdated transaction format that lacks this
    required field, leading to rejection.

Action Required by the Lighter Team:

To resolve this critical incompatibility, please address the following:

  1. Update Binary Signer: The SignWithdraw function within the lighter/signers binary files must be updated to generate
    transaction payloads that include the explicit AssetId field (e.g., "AssetId": 0 for USDC, or as per your latest API
    specification).
  2. Synchronize Python SDK: Ensure the Python wrapper code (lighter/signer_client.py) correctly reflects any changes in the
    underlying binary's SignWithdraw function interface, including new parameters for asset_id if applicable.
  3. Ensure Compatibility: Verify that the published Lighter Python SDK (both code and binaries) is fully compatible and
    synchronized with the currently deployed Lighter API server specifications for all transaction types, especially
    withdrawals.

This issue prevents users from performing withdrawals, which is a fundamental operation. Your prompt attention to this matter
would be greatly appreciated.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions