Lighter ACCOUNT_INDEX の調べ方まとめ(完全版)
Lighter ACCOUNT_INDEX の調べ方まとめ(完全版)
🔰 はじめに
Lighter の API や bot を使う際に設定する
API_KEY_INDEX = ...
ACCOUNT_INDEX = ...のうち、`ACCOUNT_INDEX` を正しく取得する方法を
公式ドキュメント・SDK 仕様に基づいて説明します。
1. ACCOUNT_INDEX とは?
Lighter 公式より:
Account Index は、Lighter がウォレットを整数で識別するための内部 ID。
`accountsByL1Address` エンドポイントの `sub_accounts` 配列の 最初の要素の `index` が、メインアカウントの Account Index となる。
📌 公式
2. API エンドポイント
Base URL(SDK仕様)
https://mainnet.zklighter.elliot.aiAccount 取得エンドポイント(GET)
/api/v1/accountsByL1Address?l1_address=0xあなたのEOA3. curl で取得する
curl -s "https://mainnet.zklighter.elliot.ai/api/v1/accountsByL1Address?l1_address=0xあなたのEOAアドレス" | jq .4. レスポンス例と読み取り方
{
"code": 200,
"l1_address": "0x123456789",
"sub_accounts": [
{
"account_type": 0,
"index": 123
},
{
"account_type": 1,
"index": 456
}
]
}5. 参考リンク
6. まとめ
取得方法は accountsByL1Address の sub_accounts[n].index
curl / Python どちらでも簡単に確認可能
