Non-custodial Python SDK for LENDS lending, leUSD, and sleUSD.
Project description
LENDS Python SDK
Typed, non-custodial access to LENDS lending/borrowing, the leUSD PSM, and sleUSD staking.
Install
python -m pip install lends-sdk
Usage
import os
from lends_sdk import LendsClient
lends = LendsClient(os.environ["RPC_URL"])
lends.assert_chain()
protocol = lends.get_protocol_state()
markets = lends.get_markets()
position = lends.get_position(
"0x1111111111111111111111111111111111111111",
markets[0].address,
)
amount = 10 ** markets[0].collateral_decimals
approval = lends.transactions.approve_collateral(markets[0].address, amount)
deposit = lends.transactions.deposit(markets[0].address, amount)
PreparedTransaction.as_dict() returns to, data, value, and chainId for a wallet or signing system. The SDK does not accept private keys, sign, or broadcast.
All amounts are raw integer token units. leUSD and sleUSD use 6 decimals; collateral and USDG decimals are read on-chain; oracle prices are normalized to 8 decimals. Quotes and projected position values are point-in-time previews. Contract execution is authoritative.
Scope
Included: approvals, collateral deposit/withdrawal, borrow/repay, fee accrual, PSM conversion, sleUSD stake/unstake lifecycle, and relevant state/statistics.
Excluded: every privileged write, liquidation execution, reserves, harvests, losses, minters, risk settings, pauses, ownership, upgrades, LENDS purchases, locks, liquidity, and vesting.
Development
python -m pip install -e ".[dev]"
python -m unittest discover -s tests
ruff check .
mypy
python -m build
twine check dist/*
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file lends_sdk-0.1.0.tar.gz.
File metadata
- Download URL: lends_sdk-0.1.0.tar.gz
- Upload date:
- Size: 10.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
044a46a029ad2ea4432f20cfcacfa49077c35b22c32bcb673c0c8c15455d1230
|
|
| MD5 |
5b48cf96b015a9b900d9fa31605564de
|
|
| BLAKE2b-256 |
e094e6ebe52386732d736f297e3bbcceb117f720c484e2dca6b326949bef48ad
|
File details
Details for the file lends_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: lends_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 13.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1185cdcb6d3da5f8d93e35f1abe77c2791284ee49a718618650e87aeb66057b
|
|
| MD5 |
0ba97433c2ad88ec4c3bb764167877a5
|
|
| BLAKE2b-256 |
759e6b0677c274ad36354f530b1932480098ae54275c798fcc387f7162ad2052
|