Skip to content

feat: add permissionless functionality to public python API client#27

Merged
jessebraun merged 5 commits intomainfrom
jesse/permissionless-python-client
Apr 29, 2025
Merged

feat: add permissionless functionality to public python API client#27
jessebraun merged 5 commits intomainfrom
jesse/permissionless-python-client

Conversation

@jessebraun
Copy link
Contributor

Description

We have recently added several new perpetuals-only environments and need to update the python client for them.

Problem: Missing endpoints in models, no support for direct-to and direct-from margin deposits and withdrawals.

Solution: Add it.

Testing/Examples:

import os

import enclave.models
from enclave.client import Client

API_KEY = str(os.getenv("enclave_key"))
API_SECRET = str(os.getenv("enclave_secret"))

client = Client("<key>", "<secret>", enclave.models.DEV_PERMISSIONLESS)

print("Provisioning address")
res = client.provision_address("USDC", wallet="margin")
print(res.json())

print("Withdrawing")
res = client.withdraw("0x1816fc7A0142ee126e980F3F2DD1479a20e04682", "1", "test-withdraw", "USDC", wallet="margin")
print(res.json())
~/enclave-python-1 (jesse/permissionless-python-client*) » PYTHONPATH=. python examples/permissionless_test.py                                                                       jesse.braun@AVL-9MHGFG
Provisioning address
{'success': True, 'result': {'accountId': '4243739687171838759', 'symbol': 'USDC', 'address': '0xd513a2d5b9857b8caa5bf0129b70e7a751b8ff47'}}
Withdrawing
{'success': True, 'result': {'withdrawal_status': 'WITHDRAWAL_PENDING', 'withdrawal_id': '884e928c00995afe02d5316a820cdfca8a8cdb9d4d3336352d414998de77ea61omni25', 'customer_withdrawal_id': 'test-withdraw', 'hash': '0x008ce905b89da2101fdffd1d63c2db1179269ec04fdb89d54dac5ecd62b028fd'}}

Deposited to the provisioned address and it showed up.
image

Withdrawal went through.
image

@jessebraun jessebraun requested a review from a team as a code owner April 28, 2025 19:25
@wwestgarth-enclave
Copy link
Contributor

Can you bump the version in pyproject.toml?

@jessebraun
Copy link
Contributor Author

Can you bump the version in pyproject.toml?

Done. I also bumped in _init_.py and made it match the pyproject version since it was behind.

@jessebraun jessebraun merged commit 60a09eb into main Apr 29, 2025
1 check passed
@jessebraun jessebraun deleted the jesse/permissionless-python-client branch April 29, 2025 18:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants