rango-basic-sdk 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- rango_basic_sdk/__init__.py +8 -0
- rango_basic_sdk/client.py +2008 -0
- rango_basic_sdk/models.py +1853 -0
- rango_basic_sdk/py.typed +0 -0
- rango_basic_sdk-0.0.1.dist-info/METADATA +186 -0
- rango_basic_sdk-0.0.1.dist-info/RECORD +8 -0
- rango_basic_sdk-0.0.1.dist-info/WHEEL +4 -0
- rango_basic_sdk-0.0.1.dist-info/licenses/LICENSE +21 -0
rango_basic_sdk/py.typed
ADDED
|
File without changes
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: rango-basic-sdk
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: Python bindings for Rango Exchange Basic API
|
|
5
|
+
Project-URL: Home, https://github.com/rango-exchange/rango-python-basic
|
|
6
|
+
Project-URL: Contact, https://t.me/rangoexchange
|
|
7
|
+
Project-URL: Documentation, https://docs.rango.exchange/
|
|
8
|
+
Author-email: Rango <hi@rango.exchange>
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
12
|
+
Classifier: Operating System :: OS Independent
|
|
13
|
+
Classifier: Programming Language :: Python :: 3
|
|
14
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
21
|
+
Requires-Python: >=3.8
|
|
22
|
+
Requires-Dist: httpx>=0.27.0
|
|
23
|
+
Requires-Dist: pydantic>=2.6.0
|
|
24
|
+
Provides-Extra: dev
|
|
25
|
+
Requires-Dist: build>=1.2.0; extra == 'dev'
|
|
26
|
+
Requires-Dist: twine>=5.0.0; extra == 'dev'
|
|
27
|
+
Description-Content-Type: text/markdown
|
|
28
|
+
|
|
29
|
+
# Python SDK for Rango Exchange Basic API
|
|
30
|
+
|
|
31
|
+
Simple and Easy to use APIs for Rango Aggregation protocols for dApps and Wallets for single step cross-chain and on-chain swaps using the best route and all the available on-chain liquidity across all blockchain networks.
|
|
32
|
+
|
|
33
|
+
## Requirements
|
|
34
|
+
|
|
35
|
+
This package supports **Python 3.8** and newer.
|
|
36
|
+
|
|
37
|
+
## Installation
|
|
38
|
+
|
|
39
|
+
Install it with:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
python -m pip install rango-basic-sdk
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Alternatively, install from the source code with this command from the project root:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
python -m pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
For an editable installation while developing:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
python -m pip install -e .
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Usage
|
|
58
|
+
|
|
59
|
+
### Synchronous client
|
|
60
|
+
|
|
61
|
+
`Client` is the synchronous API. Close it when finished, or use a `with` block.
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from rango_basic_sdk import Client
|
|
65
|
+
|
|
66
|
+
with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
67
|
+
result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Endpoints are nested under attributes (see `client.py`):
|
|
71
|
+
|
|
72
|
+
- `client.balance` → `BalanceOperations`
|
|
73
|
+
- `client.metadata` → `MetadataOperations`
|
|
74
|
+
- `client.routing` → `RoutingOperations`
|
|
75
|
+
- `client.transaction` → `TransactionOperations`
|
|
76
|
+
|
|
77
|
+
### Asynchronous client
|
|
78
|
+
|
|
79
|
+
`AsyncClient` is the asynchronous API. Use `async with` and `await` each call.
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
import asyncio
|
|
83
|
+
from rango_basic_sdk import AsyncClient
|
|
84
|
+
|
|
85
|
+
async def main() -> None:
|
|
86
|
+
async with AsyncClient(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
87
|
+
result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
|
|
88
|
+
|
|
89
|
+
asyncio.run(main())
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
## Authentication
|
|
93
|
+
|
|
94
|
+
The **Usage** section above and the **`examples/`** / **`docs/`** trees show authentication via **constructor keyword arguments**; This package also supports **environment-variable** credentials (using **`RANGO_BASIC`** prefix for env vars).
|
|
95
|
+
|
|
96
|
+
#### `apiKey` — API key (query parameter)
|
|
97
|
+
|
|
98
|
+
- This sdk uses **apiKey** auth: the credential is sent as the query parameter `apiKey`.
|
|
99
|
+
- Use constructor option `api_key`.
|
|
100
|
+
- Pass these as keyword arguments to `Client(...)` / `AsyncClient(...)`.
|
|
101
|
+
- Alternatively set environment variable `RANGO_BASIC_API_KEY`. Explicit constructor options override env when both are set.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
For private or production authentication parameters, contact **Rango** via [hi@rango.exchange](mailto:hi@rango.exchange) or [https://t.me/rangoexchange](https://t.me/rangoexchange). See the [official API documentation](https://docs.rango.exchange/).
|
|
105
|
+
|
|
106
|
+
## API Endpoints Reference
|
|
107
|
+
|
|
108
|
+
For a complete list of all available SDK methods, including detailed parameter descriptions, return values, and code examples, see the **API Reference**:
|
|
109
|
+
|
|
110
|
+
[📖 View Full API Reference](docs/API_REFERENCE.md)
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
## Example Codes
|
|
114
|
+
|
|
115
|
+
The examples below show only the most commonly used endpoints to help you get started quickly.
|
|
116
|
+
|
|
117
|
+
For advanced usage and less common operations, consult the API Reference.
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
### Get Balance of a Token
|
|
121
|
+
|
|
122
|
+
Fetches the balance of a specific token address for the user's wallet
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
**Runnable source:** [`get_token_balance.py`](examples/quickstart/balance/get_token_balance.py)
|
|
126
|
+
|
|
127
|
+
```python
|
|
128
|
+
from rango_basic_sdk import Client, models
|
|
129
|
+
|
|
130
|
+
with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
131
|
+
result = client.balance.get_token_balance(wallet_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", blockchain=models.Blockchain.BSC, symbol="USDT", address="0x55d398326f99059ff775485246999027b3197955")
|
|
132
|
+
print(result)
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Get the Best Quote for swapping
|
|
136
|
+
|
|
137
|
+
Get the best route to perform a cross-chain or same-chain swap
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
**Runnable source:** [`quote.py`](examples/quickstart/routing/quote.py)
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
from rango_basic_sdk import Client
|
|
144
|
+
|
|
145
|
+
with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
146
|
+
result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
|
|
147
|
+
print(result)
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Create the Transaction (Swap)
|
|
151
|
+
|
|
152
|
+
Creates a transaction to be signed by user's wallet and broadcasted to the network
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
**Runnable source:** [`swap.py`](examples/quickstart/transaction/swap.py)
|
|
156
|
+
|
|
157
|
+
```python
|
|
158
|
+
from rango_basic_sdk import Client
|
|
159
|
+
|
|
160
|
+
with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
161
|
+
result = client.transaction.swap(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5, from_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", to_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3", disable_estimate=False, infinite_approve=False, referrer_fee=0.3, referrer_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3")
|
|
162
|
+
print(result)
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Check the Transaction Status
|
|
166
|
+
|
|
167
|
+
Checks the status of the transaction using the requestId from the swap endpoint and the broadcasted transaction hash (txId)
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
**Runnable source:** [`status.py`](examples/quickstart/transaction/status.py)
|
|
171
|
+
|
|
172
|
+
```python
|
|
173
|
+
from rango_basic_sdk import Client
|
|
174
|
+
|
|
175
|
+
with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
|
|
176
|
+
result = client.transaction.status(request_id="b3a12c6d-86b8-4c21-97e4-809151dd4036", tx_id="0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5")
|
|
177
|
+
print(result)
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
Additional samples for all endpoints live under the **[`examples/`](examples/)** folder.
|
|
183
|
+
|
|
184
|
+
## Advanced Examples
|
|
185
|
+
|
|
186
|
+
For more advanced walkthroughs, step-by-step guides and custom samples, check the **[Advanced Examples](examples/advanced/)** folder.
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
rango_basic_sdk/__init__.py,sha256=c5tIln8wciNWojMyi4NBoMeq3iMip-z9tog_BCkamrg,170
|
|
2
|
+
rango_basic_sdk/client.py,sha256=LY5HNPD_TVAM1Jtw4Nsc2B9R0z1Vly0W1355UOi5_KU,94330
|
|
3
|
+
rango_basic_sdk/models.py,sha256=D2lvcmN7gDILDrNWN8ikTnAx1yYHL8gMO-FvIOX70Io,66749
|
|
4
|
+
rango_basic_sdk/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
5
|
+
rango_basic_sdk-0.0.1.dist-info/METADATA,sha256=WuAenmjzra4zgcVtX1TPHbUEtAlgiJHsPMgBuSwhyY4,6786
|
|
6
|
+
rango_basic_sdk-0.0.1.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
7
|
+
rango_basic_sdk-0.0.1.dist-info/licenses/LICENSE,sha256=0uMo5cD6NMblWuiAiH9qYOGFcM1LEYOLbEjm3RKM9Gw,1062
|
|
8
|
+
rango_basic_sdk-0.0.1.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Rango
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|