⚠️ Deprecated: This package has been renamed to oasis-privana. Please update your dependencies.
flexvaults-sdk
Python SDK for Flexvaults - manage deposits, withdrawals, locks, and transfers on the accounting module.
Installation
pip install flexvaults-sdk
Quick Start
import asyncio
from flexvaults import FlexvaultsClient, DepositCheckRequest
async def main():
async with FlexvaultsClient(base_url="https://api.example.com") as client:
# Get per-user deposit address
addr = await client.get_deposit_address()
print(f"Deposit to: {addr.deposit_address}")
# After sending tokens to the deposit address, verify the deposit
result = await client.check_deposit(
DepositCheckRequest(
chain_id=84532,
tx_hash="0xYourTxHash",
amount=1000000,
)
)
print(f"Deposit status: {result.status}")
asyncio.run(main())
Direct SIWE Private Reads
Private read endpoints such as balances, history, and locked funds use the backend's direct SIWE flow.
The Python SDK exposes the raw helpers and token setters rather than a hosted auth-code wrapper.
get_history(offset=-1, limit=50) returns one page; non-negative offsets count pages from the
oldest entries, negative offsets count from the end, each page is oldest-to-newest, and limit
must be between 0 and 100.
import asyncio
from flexvaults import FlexvaultsClient
async def main():
async with FlexvaultsClient(base_url="https://api.example.com") as client:
domain = await client.get_siwe_domain()
nonce = await client.get_siwe_nonce("0xYourAddress")
# Build and sign the SIWE message in your app, then submit it here.
login = await client.authenticate_private_reads(
siwe_message="your signed-in message",
signature="0xYourSignature",
)
balance = await client.get_balance("0xTokenId")
history = await client.get_history()
print(domain.domain, nonce.nonce, login.address, balance.balance, history.total)
asyncio.run(main())
EIP-712 Signing
from eth_account import Account
from flexvaults import (
sign_lock_message,
LockNonceResponse,
SignLockParams,
LockMessage,
get_accounting_contract,
create_lock_expiry,
)
account = Account.from_key("0xYourPrivateKey")
signature = sign_lock_message(
SignLockParams(
account=account,
network="testnet",
verifying_contract=get_accounting_contract("testnet"),
message=LockMessage(
service_address="0xServiceAddress",
token_id="0xTokenId",
amount=1000000,
expiry=create_lock_expiry(60),
nonce=0,
),
)
)
API Reference
Client
FlexvaultsClient(base_url, timeout=30.0, headers=None)- Main API clientget_deposit_address(request=None)- Get per-user deposit addresscheck_deposit(request)- Verify a deposit and trigger creditget_balance(token_id)- Get token balance for the authenticated userget_batch_balances(request)- Get multiple token balancesget_history(offset=-1, limit=50)- Get one authenticated history pageget_token_info(token_id)- Get token informationlock_funds(request)- Lock funds for a serviceget_lock_nonce(user_address)- Get next create-lock nonceget_modify_lock_nonce(user_address)- Get next modify-lock noncemodify_lock(request)- Modify an existing lock (add funds and/or extend expiry)unlock_funds(request)- Unlock specific lockunlock_all_expired(request)- Unlock all expired locksget_locked_funds(service_address=None)- Get locked funds for the authenticated userget_total_locked_balance(token_id)- Get total locked balance for the authenticated userget_expired_locks()- Get expired locks for the authenticated usertransfer_funds(request)- Transfer tokens (requires nonce)get_transfer_nonce(user_address)- Get next transfer noncetransfer_locked_funds(request)- Transfer locked tokensget_transfer_locked_nonce(service_address)- Get next transfer-from-lock noncerequest_withdrawal(request)- Request withdrawalget_withdrawal_nonce(user_address)- Get next withdrawal nonceget_pending_withdrawals(user_address)- Get pending withdrawalsget_withdrawal_info(index)- Get withdrawal infoget_siwe_domain()- Get the direct SIWE auth domainget_siwe_nonce(user_address)- Get a SIWE login noncelogin_with_siwe(siwe_message, signature)- Exchange a signed SIWE message for tokensauthenticate_private_reads(siwe_message, signature)- Login and storeX-SIWE-Tokenset_private_read_token(token)/clear_private_read_token()- ManageX-SIWE-Tokenset_bearer_token(token)/clear_bearer_token()- Manage bearer auth headers
Signing
sign_lock_message(params)- Sign lock messagesign_modify_lock_message(params)- Sign modify lock messagesign_transfer_message(params)- Sign transfer messagesign_transfer_locked_message(params)- Sign transfer locked messagesign_withdraw_message(params)- Sign withdrawal messagecreate_lock_expiry(minutes_from_now=60)- Create expiry timestamp
Utilities
format_token_amount(amount, decimals=18)- Format wei to human-readableparse_token_amount(amount, decimals=18)- Parse human-readable to weishorten_address(address, chars=4)- Shorten Ethereum addressformat_timestamp(timestamp)- Format Unix timestamp to readable stringis_expired(expiry)- Check if timestamp is expiredformat_time_remaining(expiry_timestamp)- Format time remainingformat_relative_time(timestamp)- Format relative time (e.g., "5m ago")
License
Apache-2.0
Release files for flexvaults-sdk 0.1.17
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| flexvaults_sdk-0.1.17.tar.gz | 108.5 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| flexvaults_sdk-0.1.17-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 136.2 kB
Release files / flexvaults_sdk-0.1.17.tar.gz
| Download URL | flexvaults_sdk-0.1.17.tar.gz |
|---|---|
| Size | 108.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
aca6693fa41920baf9d72ae6699b1169fd5111aa2e5b815303652e1ced7419c7
|
|
BLAKE2b-256 checksum How to use checksums |
c5d285519773b9a888b146e4fa48d4c266775d68ec9695a31a72c351a30b9c4f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / flexvaults_sdk-0.1.17-py3-none-any.whl
| Download URL | flexvaults_sdk-0.1.17-py3-none-any.whl |
|---|---|
| Size | 27.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
d0293001ab16adcb9c44aa3eba6a5610a8371454a4be21743c8ab20fb97ad654
|
|
BLAKE2b-256 checksum How to use checksums |
8cc9090678425ee39037c0dbcc248eb71906579bdc3bebfd5104a9435f55b7b5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.13 {"installer":{"name":"uv","version":"0.11.13","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|