rango-basic-sdk 0.0.2__tar.gz → 0.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rango-basic-sdk
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Python bindings for Rango Exchange Basic API
5
5
  Project-URL: Home, https://github.com/rango-exchange/rango-python-basic
6
6
  Project-URL: Contact, https://t.me/rangoexchange
@@ -64,7 +64,7 @@ python -m pip install -e .
64
64
  from rango_basic_sdk import Client
65
65
 
66
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)
67
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
68
68
  ```
69
69
 
70
70
  Endpoints are nested under attributes (see `client.py`):
@@ -84,7 +84,7 @@ from rango_basic_sdk import AsyncClient
84
84
 
85
85
  async def main() -> None:
86
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)
87
+ result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
88
88
 
89
89
  asyncio.run(main())
90
90
  ```
@@ -143,7 +143,7 @@ Get the best route to perform a cross-chain or same-chain swap
143
143
  from rango_basic_sdk import Client
144
144
 
145
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)
146
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
147
147
  print(result)
148
148
  ```
149
149
 
@@ -158,7 +158,7 @@ Creates a transaction to be signed by user's wallet and broadcasted to the netwo
158
158
  from rango_basic_sdk import Client
159
159
 
160
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")
161
+ result = client.transaction.swap(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5, from_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", to_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3", disable_estimate=False, infinite_approve=False)
162
162
  print(result)
163
163
  ```
164
164
 
@@ -184,3 +184,25 @@ Additional samples for all endpoints live under the **[`examples/`](examples/)**
184
184
  ## Advanced Examples
185
185
 
186
186
  For more advanced walkthroughs, step-by-step guides and custom samples, check the **[Advanced Examples](examples/advanced/)** folder.
187
+
188
+ ## HTTP debug logging
189
+
190
+ To print each HTTP request and response (method, URL, status, headers, and bodies) after the response is received, pass **`log_http_debug=True`** to `Client` or `AsyncClient`, and set the **`rango_basic_sdk.client`** logger to **DEBUG** so those messages are emitted.
191
+
192
+ Bodies are truncated after 16 KiB per direction. **Do not use this in production or with real secrets:** debug output can include credentials (e.g. `Authorization`, API keys, cookies).
193
+
194
+ ```python
195
+ import logging
196
+
197
+ from rango_basic_sdk import Client
198
+
199
+ logging.getLogger("rango_basic_sdk.client").setLevel(logging.DEBUG)
200
+ if not logging.root.handlers:
201
+ logging.basicConfig(level=logging.DEBUG)
202
+
203
+ with Client(log_http_debug=True) as client:
204
+ # …
205
+ pass
206
+ ```
207
+
208
+ For `AsyncClient`, use the same logging setup and `AsyncClient(log_http_debug=True, ...)`.
@@ -36,7 +36,7 @@ python -m pip install -e .
36
36
  from rango_basic_sdk import Client
37
37
 
38
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)
39
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
40
40
  ```
41
41
 
42
42
  Endpoints are nested under attributes (see `client.py`):
@@ -56,7 +56,7 @@ from rango_basic_sdk import AsyncClient
56
56
 
57
57
  async def main() -> None:
58
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)
59
+ result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
60
60
 
61
61
  asyncio.run(main())
62
62
  ```
@@ -115,7 +115,7 @@ Get the best route to perform a cross-chain or same-chain swap
115
115
  from rango_basic_sdk import Client
116
116
 
117
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)
118
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
119
119
  print(result)
120
120
  ```
121
121
 
@@ -130,7 +130,7 @@ Creates a transaction to be signed by user's wallet and broadcasted to the netwo
130
130
  from rango_basic_sdk import Client
131
131
 
132
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")
133
+ result = client.transaction.swap(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5, from_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", to_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3", disable_estimate=False, infinite_approve=False)
134
134
  print(result)
135
135
  ```
136
136
 
@@ -156,3 +156,25 @@ Additional samples for all endpoints live under the **[`examples/`](examples/)**
156
156
  ## Advanced Examples
157
157
 
158
158
  For more advanced walkthroughs, step-by-step guides and custom samples, check the **[Advanced Examples](examples/advanced/)** folder.
159
+
160
+ ## HTTP debug logging
161
+
162
+ To print each HTTP request and response (method, URL, status, headers, and bodies) after the response is received, pass **`log_http_debug=True`** to `Client` or `AsyncClient`, and set the **`rango_basic_sdk.client`** logger to **DEBUG** so those messages are emitted.
163
+
164
+ Bodies are truncated after 16 KiB per direction. **Do not use this in production or with real secrets:** debug output can include credentials (e.g. `Authorization`, API keys, cookies).
165
+
166
+ ```python
167
+ import logging
168
+
169
+ from rango_basic_sdk import Client
170
+
171
+ logging.getLogger("rango_basic_sdk.client").setLevel(logging.DEBUG)
172
+ if not logging.root.handlers:
173
+ logging.basicConfig(level=logging.DEBUG)
174
+
175
+ with Client(log_http_debug=True) as client:
176
+ # …
177
+ pass
178
+ ```
179
+
180
+ For `AsyncClient`, use the same logging setup and `AsyncClient(log_http_debug=True, ...)`.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rango-basic-sdk"
7
- version = "0.0.2"
7
+ version = "0.0.4"
8
8
  description = "Python bindings for Rango Exchange Basic API"
9
9
  readme = "README.md"
10
10
  license-files = ["LICENSE"]
@@ -1,6 +1,6 @@
1
1
  """Python SDK for Rango Exchange Basic API."""
2
2
 
3
- __version__ = "0.0.2"
3
+ __version__ = "0.0.4"
4
4
 
5
5
  from .client import AsyncClient, Client
6
6
  from .models import *
@@ -12,7 +12,7 @@ import logging
12
12
  from . import models
13
13
 
14
14
  # First ``servers`` URL from the OpenAPI document (``None`` if the spec defines none).
15
- DEFAULT_SERVER_URL: Optional[str] = "https://api.rango.exchange"
15
+ DEFAULT_SERVER_URL: Optional[str] = "https://public-api.rango.exchange"
16
16
 
17
17
  _log = logging.getLogger(__name__)
18
18
  _MAX_HTTP_DEBUG_BODY = 16_384
@@ -589,7 +589,7 @@ class RoutingOperations:
589
589
 
590
590
  Examples:
591
591
  with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
592
- result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
592
+ result = client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
593
593
  print(result)
594
594
  """
595
595
  url = f"/basic/quote"
@@ -713,7 +713,7 @@ class TransactionOperations:
713
713
 
714
714
  Examples:
715
715
  with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
716
- result = client.transaction.report_tx(body=models.BasicApiReportTransactionRequest(request_id="688b308e-a06b-4a4e-a837-220d458b8642", event_type=models.BasicApiReportTransactionRequestEventType.USER_REJECT))
716
+ result = client.transaction.report_tx(body=models.BasicApiReportTransactionRequest(event_type=models.BasicApiReportTransactionRequestEventType.USER_REJECT, request_id="688b308e-a06b-4a4e-a837-220d458b8642"))
717
717
  print(result)
718
718
  """
719
719
  url = f"/basic/report-tx"
@@ -872,9 +872,10 @@ class TransactionOperations:
872
872
  contract_call (Optional[bool]): set this parameter to `true` if you wants to
873
873
  send transactions through a contract Wire
874
874
  name ``contractCall`` (query).
875
- referrer_fee (Optional[float]): Referrer fee in percent Wire name
875
+ referrer_fee (Optional[float]): Referrer fee in percent, e.g. 0.3 Wire name
876
876
  ``referrerFee`` (query).
877
- referrer_address (Optional[str]): Referrer wallet address Wire name
877
+ referrer_address (Optional[str]): Referrer wallet address on source asset
878
+ (from) blockchain Wire name
878
879
  ``referrerAddress`` (query).
879
880
  referrer_code (Optional[str]): Referrer code Wire name ``referrerCode``
880
881
  (query).
@@ -905,7 +906,7 @@ class TransactionOperations:
905
906
 
906
907
  Examples:
907
908
  with Client(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
908
- 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")
909
+ result = client.transaction.swap(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5, from_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", to_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3", disable_estimate=False, infinite_approve=False)
909
910
  print(result)
910
911
  """
911
912
  url = f"/basic/swap"
@@ -1543,7 +1544,7 @@ class AsyncRoutingOperations:
1543
1544
 
1544
1545
  Examples:
1545
1546
  async with AsyncClient(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
1546
- result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=100000000000000000, slippage=8.5)
1547
+ result = await client.routing.quote(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5)
1547
1548
  print(result)
1548
1549
  """
1549
1550
  url = f"/basic/quote"
@@ -1667,7 +1668,7 @@ class AsyncTransactionOperations:
1667
1668
 
1668
1669
  Examples:
1669
1670
  async with AsyncClient(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
1670
- result = await client.transaction.report_tx(body=models.BasicApiReportTransactionRequest(request_id="688b308e-a06b-4a4e-a837-220d458b8642", event_type=models.BasicApiReportTransactionRequestEventType.USER_REJECT))
1671
+ result = await client.transaction.report_tx(body=models.BasicApiReportTransactionRequest(event_type=models.BasicApiReportTransactionRequestEventType.USER_REJECT, request_id="688b308e-a06b-4a4e-a837-220d458b8642"))
1671
1672
  print(result)
1672
1673
  """
1673
1674
  url = f"/basic/report-tx"
@@ -1826,9 +1827,10 @@ class AsyncTransactionOperations:
1826
1827
  contract_call (Optional[bool]): set this parameter to `true` if you wants to
1827
1828
  send transactions through a contract Wire
1828
1829
  name ``contractCall`` (query).
1829
- referrer_fee (Optional[float]): Referrer fee in percent Wire name
1830
+ referrer_fee (Optional[float]): Referrer fee in percent, e.g. 0.3 Wire name
1830
1831
  ``referrerFee`` (query).
1831
- referrer_address (Optional[str]): Referrer wallet address Wire name
1832
+ referrer_address (Optional[str]): Referrer wallet address on source asset
1833
+ (from) blockchain Wire name
1832
1834
  ``referrerAddress`` (query).
1833
1835
  referrer_code (Optional[str]): Referrer code Wire name ``referrerCode``
1834
1836
  (query).
@@ -1859,7 +1861,7 @@ class AsyncTransactionOperations:
1859
1861
 
1860
1862
  Examples:
1861
1863
  async with AsyncClient(api_key='c6381a79-2817-4602-83bf-6a641a409e32') as client:
1862
- result = await 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")
1864
+ result = await client.transaction.swap(from_="BSC.BNB", to="AVAX_CCHAIN.USDT.E--0xc7198437980c041c805a1edcba50c1ce5db95118", amount=10000000000000000, slippage=3.5, from_address="0x9F8cCdaFCc39F3c7D6EBf637c9151673CBc36b88", to_address="0x6f33bb1763eebead07cf8815a62fcd7b30311fa3", disable_estimate=False, infinite_approve=False)
1863
1865
  print(result)
1864
1866
  """
1865
1867
  url = f"/basic/swap"