Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions examples/change_account_tier.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import asyncio
import logging
import lighter
import requests

logging.basicConfig(level=logging.DEBUG)

BASE_URL = "https://mainnet.zklighter.elliot.ai"

# You can get the values from the system_setup.py script
# API_KEY_PRIVATE_KEY =
# ACCOUNT_INDEX =
# API_KEY_INDEX =


async def main():
client = lighter.SignerClient(
url=BASE_URL,
private_key=API_KEY_PRIVATE_KEY,
account_index=ACCOUNT_INDEX,
api_key_index=API_KEY_INDEX,
)

err = client.check_client()
if err is not None:
print(f"CheckClient error: {err}")
return

auth, err = client.create_auth_token_with_expiry(
lighter.SignerClient.DEFAULT_10_MIN_AUTH_EXPIRY
)

response = requests.post(
f"{BASE_URL}/api/v1/changeAccountTier",
data={"account_index": ACCOUNT_INDEX, "new_tier": "premium"},
headers={"Authorization": auth},
)
if response.status_code != 200:
print(f"Error: {response.text}")
return
print(response.json())


if __name__ == "__main__":
asyncio.run(main())
Loading