rango-basic-sdk 0.0.1__tar.gz

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.
@@ -0,0 +1,39 @@
1
+ # Shell scripts (local helpers; not for git or PyPI sdist — see [tool.hatch.build.targets.sdist] exclude)
2
+ *.sh
3
+
4
+ # AI assistant metadata (local only)
5
+ .claude/
6
+ CLAUDE.md
7
+ CLAUDE_*.md
8
+
9
+ # Byte-compiled / cache
10
+ __pycache__/
11
+ *.py[cod]
12
+ *$py.class
13
+ *.so
14
+
15
+ # Virtual environments
16
+ .venv/
17
+ venv/
18
+ ENV/
19
+ env/
20
+
21
+ # Packaging / build outputs
22
+ dist/
23
+ build/
24
+ *.egg-info/
25
+ .eggs/
26
+ *.egg
27
+
28
+ # Test & type tooling
29
+ .pytest_cache/
30
+ .mypy_cache/
31
+ .ruff_cache/
32
+ .coverage
33
+ htmlcov/
34
+
35
+ # Editors / OS
36
+ .idea/
37
+ .vscode/
38
+ *.swp
39
+ .DS_Store
@@ -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.
@@ -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,158 @@
1
+ # Python SDK for Rango Exchange Basic API
2
+
3
+ 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.
4
+
5
+ ## Requirements
6
+
7
+ This package supports **Python 3.8** and newer.
8
+
9
+ ## Installation
10
+
11
+ Install it with:
12
+
13
+ ```bash
14
+ python -m pip install rango-basic-sdk
15
+ ```
16
+
17
+ Alternatively, install from the source code with this command from the project root:
18
+
19
+ ```bash
20
+ python -m pip install .
21
+ ```
22
+
23
+ For an editable installation while developing:
24
+
25
+ ```bash
26
+ python -m pip install -e .
27
+ ```
28
+
29
+ ## Usage
30
+
31
+ ### Synchronous client
32
+
33
+ `Client` is the synchronous API. Close it when finished, or use a `with` block.
34
+
35
+ ```python
36
+ from rango_basic_sdk import Client
37
+
38
+ with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
39
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
40
+ ```
41
+
42
+ Endpoints are nested under attributes (see `client.py`):
43
+
44
+ - `client.balance` → `BalanceOperations`
45
+ - `client.metadata` → `MetadataOperations`
46
+ - `client.routing` → `RoutingOperations`
47
+ - `client.transaction` → `TransactionOperations`
48
+
49
+ ### Asynchronous client
50
+
51
+ `AsyncClient` is the asynchronous API. Use `async with` and `await` each call.
52
+
53
+ ```python
54
+ import asyncio
55
+ from rango_basic_sdk import AsyncClient
56
+
57
+ async def main() -> None:
58
+ async with AsyncClient(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
59
+ result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
60
+
61
+ asyncio.run(main())
62
+ ```
63
+
64
+ ## Authentication
65
+
66
+ 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).
67
+
68
+ #### `apiKey` — API key (query parameter)
69
+
70
+ - This sdk uses **apiKey** auth: the credential is sent as the query parameter `apiKey`.
71
+ - Use constructor option `api_key`.
72
+ - Pass these as keyword arguments to `Client(...)` / `AsyncClient(...)`.
73
+ - Alternatively set environment variable `RANGO_BASIC_API_KEY`. Explicit constructor options override env when both are set.
74
+
75
+
76
+ 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/).
77
+
78
+ ## API Endpoints Reference
79
+
80
+ For a complete list of all available SDK methods, including detailed parameter descriptions, return values, and code examples, see the **API Reference**:
81
+
82
+ [📖 View Full API Reference](docs/API_REFERENCE.md)
83
+
84
+
85
+ ## Example Codes
86
+
87
+ The examples below show only the most commonly used endpoints to help you get started quickly.
88
+
89
+ For advanced usage and less common operations, consult the API Reference.
90
+
91
+
92
+ ### Get Balance of a Token
93
+
94
+ Fetches the balance of a specific token address for the user's wallet
95
+
96
+
97
+ **Runnable source:** [`get_token_balance.py`](examples/quickstart/balance/get_token_balance.py)
98
+
99
+ ```python
100
+ from rango_basic_sdk import Client, models
101
+
102
+ with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
103
+ result = client.balance.get_token_balance(wallet_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", blockchain=models.Blockchain.BSC, symbol="USDT", address="0x55d398326f99059ff775485246999027b3197955")
104
+ print(result)
105
+ ```
106
+
107
+ ### Get the Best Quote for swapping
108
+
109
+ Get the best route to perform a cross-chain or same-chain swap
110
+
111
+
112
+ **Runnable source:** [`quote.py`](examples/quickstart/routing/quote.py)
113
+
114
+ ```python
115
+ from rango_basic_sdk import Client
116
+
117
+ with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
118
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
119
+ print(result)
120
+ ```
121
+
122
+ ### Create the Transaction (Swap)
123
+
124
+ Creates a transaction to be signed by user's wallet and broadcasted to the network
125
+
126
+
127
+ **Runnable source:** [`swap.py`](examples/quickstart/transaction/swap.py)
128
+
129
+ ```python
130
+ from rango_basic_sdk import Client
131
+
132
+ with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
133
+ 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")
134
+ print(result)
135
+ ```
136
+
137
+ ### Check the Transaction Status
138
+
139
+ Checks the status of the transaction using the requestId from the swap endpoint and the broadcasted transaction hash (txId)
140
+
141
+
142
+ **Runnable source:** [`status.py`](examples/quickstart/transaction/status.py)
143
+
144
+ ```python
145
+ from rango_basic_sdk import Client
146
+
147
+ with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
148
+ result = client.transaction.status(request_id="b3a12c6d-86b8-4c21-97e4-809151dd4036", tx_id="0xfa88b705a5b4049adac7caff50c887d9600ef023ef1a937f8f8b6f44e90042b5")
149
+ print(result)
150
+ ```
151
+
152
+
153
+
154
+ Additional samples for all endpoints live under the **[`examples/`](examples/)** folder.
155
+
156
+ ## Advanced Examples
157
+
158
+ For more advanced walkthroughs, step-by-step guides and custom samples, check the **[Advanced Examples](examples/advanced/)** folder.
@@ -0,0 +1,58 @@
1
+ [build-system]
2
+ requires = ["hatchling>=1.24.0"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "rango-basic-sdk"
7
+ version = "0.0.1"
8
+ description = "Python bindings for Rango Exchange Basic API"
9
+ readme = "README.md"
10
+ license-files = ["LICENSE"]
11
+ authors = [
12
+ { name = "Rango", email = "hi@rango.exchange" },
13
+ ]
14
+ requires-python = ">=3.8"
15
+ classifiers = [
16
+ "Intended Audience :: Developers",
17
+ "License :: OSI Approved :: MIT License",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3 :: Only",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ "Topic :: Software Development :: Libraries :: Python Modules",
27
+ ]
28
+ dependencies = [
29
+ "httpx>=0.27.0",
30
+ "pydantic>=2.6.0",
31
+ ]
32
+
33
+ [project.optional-dependencies]
34
+ dev = [
35
+ "build>=1.2.0",
36
+ "twine>=5.0.0",
37
+ ]
38
+
39
+ [project.urls]
40
+ Home = "https://github.com/rango-exchange/rango-python-basic"
41
+ Contact = "https://t.me/rangoexchange"
42
+ Documentation = "https://docs.rango.exchange/"
43
+
44
+ # Wheels: only the importable package. Sdists: omit samples, docs, and local helpers.
45
+ [tool.hatch.build.targets.wheel]
46
+ packages = ["rango_basic_sdk"]
47
+
48
+ [tool.hatch.build.targets.sdist]
49
+ exclude = [
50
+ "/examples",
51
+ "/docs",
52
+ "/.claude",
53
+ "*.sh",
54
+ "publish.sh",
55
+ "examples.sh",
56
+ "CLAUDE.md",
57
+ "CLAUDE_*.md",
58
+ ]
@@ -0,0 +1,8 @@
1
+ """Python SDK for Rango Exchange Basic API."""
2
+
3
+ __version__ = "0.0.1"
4
+
5
+ from .client import AsyncClient, Client
6
+ from .models import *
7
+
8
+ __all__ = ["AsyncClient", "Client"]