rango-basic-sdk 0.0.6__tar.gz → 0.0.8__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
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: rango-basic-sdk
3
- Version: 0.0.6
3
+ Version: 0.0.8
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "rango-basic-sdk"
7
- version = "0.0.6"
7
+ version = "0.0.8"
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.6"
3
+ __version__ = "0.0.8"
4
4
 
5
5
  from .client import AsyncClient, Client
6
6
  from .models import *
@@ -515,6 +515,7 @@ class RoutingOperations:
515
515
  referrer_fee: Optional[float] = None,
516
516
  avoid_native_fee: Optional[bool] = None,
517
517
  enable_centralized_swappers: Optional[bool] = None,
518
+ deposit_transaction: Optional[bool] = None,
518
519
  header_x_rango_id: Optional[str] = None,
519
520
  ) -> Optional[models.BasicApiQuoteResponse]:
520
521
  """
@@ -579,6 +580,13 @@ class RoutingOperations:
579
580
  false (exclude) Wire name
580
581
  ``enableCentralizedSwappers``
581
582
  (query).
583
+ deposit_transaction (Optional[bool]): The transaction execution type the
584
+ client supports. Sending DEPOSIT
585
+ limits routing to routes that are
586
+ executable with a single plain
587
+ transfer to a deposit address. Default
588
+ is REGULAR Wire name
589
+ ``depositTransaction`` (query).
582
590
  header_x_rango_id (Optional[str]): A unique client generated Id, better use
583
591
  UUID Wire name ``X-Rango-Id`` (header).
584
592
 
@@ -625,6 +633,8 @@ class RoutingOperations:
625
633
  params["avoidNativeFee"] = avoid_native_fee
626
634
  if enable_centralized_swappers is not None:
627
635
  params["enableCentralizedSwappers"] = enable_centralized_swappers
636
+ if deposit_transaction is not None:
637
+ params["depositTransaction"] = deposit_transaction
628
638
  req_headers: Dict[str, str] = {}
629
639
  if header_x_rango_id is not None:
630
640
  req_headers["X-Rango-Id"] = str(header_x_rango_id)
@@ -746,7 +756,7 @@ class TransactionOperations:
746
756
  """
747
757
  Check TX Status
748
758
 
749
- Check if the user swapp has succeeded or not. When a user signs the swap
759
+ Check if the user swap has succeeded or not. When a user signs the swap
750
760
  transaction on his/her wallet, you should call this endpoint periodically to see
751
761
  the swap status.
752
762
 
@@ -808,6 +818,7 @@ class TransactionOperations:
808
818
  avoid_native_fee: Optional[bool] = None,
809
819
  enable_centralized_swappers: Optional[bool] = None,
810
820
  use_max_native_token_balance: Optional[bool] = None,
821
+ deposit_transaction: Optional[bool] = None,
811
822
  header_x_rango_id: Optional[str] = None,
812
823
  ) -> Optional[models.BasicApiSwapResponse]:
813
824
  """
@@ -896,6 +907,13 @@ class TransactionOperations:
896
907
  insufficient. Wire name
897
908
  ``useMaxNativeTokenBalance``
898
909
  (query).
910
+ deposit_transaction (Optional[bool]): The transaction execution type the
911
+ client supports. Sending DEPOSIT
912
+ limits routing to routes that are
913
+ executable with a single plain
914
+ transfer to a deposit address. Default
915
+ is REGULAR Wire name
916
+ ``depositTransaction`` (query).
899
917
  header_x_rango_id (Optional[str]): A unique client generated Id, better use
900
918
  UUID Wire name ``X-Rango-Id`` (header).
901
919
 
@@ -951,6 +969,8 @@ class TransactionOperations:
951
969
  params["enableCentralizedSwappers"] = enable_centralized_swappers
952
970
  if use_max_native_token_balance is not None:
953
971
  params["useMaxNativeTokenBalance"] = use_max_native_token_balance
972
+ if deposit_transaction is not None:
973
+ params["depositTransaction"] = deposit_transaction
954
974
  req_headers: Dict[str, str] = {}
955
975
  if header_x_rango_id is not None:
956
976
  req_headers["X-Rango-Id"] = str(header_x_rango_id)
@@ -1470,6 +1490,7 @@ class AsyncRoutingOperations:
1470
1490
  referrer_fee: Optional[float] = None,
1471
1491
  avoid_native_fee: Optional[bool] = None,
1472
1492
  enable_centralized_swappers: Optional[bool] = None,
1493
+ deposit_transaction: Optional[bool] = None,
1473
1494
  header_x_rango_id: Optional[str] = None,
1474
1495
  ) -> Optional[models.BasicApiQuoteResponse]:
1475
1496
  """
@@ -1534,6 +1555,13 @@ class AsyncRoutingOperations:
1534
1555
  false (exclude) Wire name
1535
1556
  ``enableCentralizedSwappers``
1536
1557
  (query).
1558
+ deposit_transaction (Optional[bool]): The transaction execution type the
1559
+ client supports. Sending DEPOSIT
1560
+ limits routing to routes that are
1561
+ executable with a single plain
1562
+ transfer to a deposit address. Default
1563
+ is REGULAR Wire name
1564
+ ``depositTransaction`` (query).
1537
1565
  header_x_rango_id (Optional[str]): A unique client generated Id, better use
1538
1566
  UUID Wire name ``X-Rango-Id`` (header).
1539
1567
 
@@ -1580,6 +1608,8 @@ class AsyncRoutingOperations:
1580
1608
  params["avoidNativeFee"] = avoid_native_fee
1581
1609
  if enable_centralized_swappers is not None:
1582
1610
  params["enableCentralizedSwappers"] = enable_centralized_swappers
1611
+ if deposit_transaction is not None:
1612
+ params["depositTransaction"] = deposit_transaction
1583
1613
  req_headers: Dict[str, str] = {}
1584
1614
  if header_x_rango_id is not None:
1585
1615
  req_headers["X-Rango-Id"] = str(header_x_rango_id)
@@ -1701,7 +1731,7 @@ class AsyncTransactionOperations:
1701
1731
  """
1702
1732
  Check TX Status
1703
1733
 
1704
- Check if the user swapp has succeeded or not. When a user signs the swap
1734
+ Check if the user swap has succeeded or not. When a user signs the swap
1705
1735
  transaction on his/her wallet, you should call this endpoint periodically to see
1706
1736
  the swap status.
1707
1737
 
@@ -1763,6 +1793,7 @@ class AsyncTransactionOperations:
1763
1793
  avoid_native_fee: Optional[bool] = None,
1764
1794
  enable_centralized_swappers: Optional[bool] = None,
1765
1795
  use_max_native_token_balance: Optional[bool] = None,
1796
+ deposit_transaction: Optional[bool] = None,
1766
1797
  header_x_rango_id: Optional[str] = None,
1767
1798
  ) -> Optional[models.BasicApiSwapResponse]:
1768
1799
  """
@@ -1851,6 +1882,13 @@ class AsyncTransactionOperations:
1851
1882
  insufficient. Wire name
1852
1883
  ``useMaxNativeTokenBalance``
1853
1884
  (query).
1885
+ deposit_transaction (Optional[bool]): The transaction execution type the
1886
+ client supports. Sending DEPOSIT
1887
+ limits routing to routes that are
1888
+ executable with a single plain
1889
+ transfer to a deposit address. Default
1890
+ is REGULAR Wire name
1891
+ ``depositTransaction`` (query).
1854
1892
  header_x_rango_id (Optional[str]): A unique client generated Id, better use
1855
1893
  UUID Wire name ``X-Rango-Id`` (header).
1856
1894
 
@@ -1906,6 +1944,8 @@ class AsyncTransactionOperations:
1906
1944
  params["enableCentralizedSwappers"] = enable_centralized_swappers
1907
1945
  if use_max_native_token_balance is not None:
1908
1946
  params["useMaxNativeTokenBalance"] = use_max_native_token_balance
1947
+ if deposit_transaction is not None:
1948
+ params["depositTransaction"] = deposit_transaction
1909
1949
  req_headers: Dict[str, str] = {}
1910
1950
  if header_x_rango_id is not None:
1911
1951
  req_headers["X-Rango-Id"] = str(header_x_rango_id)
@@ -0,0 +1,14 @@
1
+ from rango_basic_sdk.models import BasicApiEvmTransaction
2
+
3
+ from web3 import Web3
4
+ from web3.types import TxParams
5
+
6
+
7
+ def evm_transaction_to_tx_params(evm_transaction: BasicApiEvmTransaction) -> TxParams:
8
+ return {
9
+ 'chainId': evm_transaction.block_chain.chain_id,
10
+ 'data': evm_transaction.tx_data,
11
+ 'from': evm_transaction.from_,
12
+ 'to': evm_transaction.tx_to,
13
+ 'value': evm_transaction.value,
14
+ }
@@ -175,6 +175,8 @@ class Blockchain(_WireStrEnum):
175
175
  SEPOLIA_ARBITRUM = "SEPOLIA_ARBITRUM"
176
176
  SEPOLIA_OPTIMISM = "SEPOLIA_OPTIMISM"
177
177
  HYPERLIQUID = "HYPERLIQUID"
178
+ ROBINHOOD = "ROBINHOOD"
179
+ ARC = "ARC"
178
180
 
179
181
 
180
182
  class CheckApprovalResponseTxStatus(_WireStrEnum):
@@ -199,6 +201,7 @@ class GenericTransactionPrerequisiteType(_WireStrEnum):
199
201
  """Transaction Prerequisite type. e.g. StellarTrustLine"""
200
202
 
201
203
  EVM_APPROVE = "EVM_APPROVE"
204
+ TRON_APPROVE = "TRON_APPROVE"
202
205
  STELLAR_CHANGE_TRUSTLINE = "STELLAR_CHANGE_TRUSTLINE"
203
206
  XRPL_CHANGE_TRUSTLINE = "XRPL_CHANGE_TRUSTLINE"
204
207
 
@@ -219,6 +222,7 @@ class GenericTransactionType(_WireStrEnum):
219
222
  STELLAR = "STELLAR"
220
223
  XRPL = "XRPL"
221
224
  HYPERLIQUID = "HYPERLIQUID"
225
+ DEPOSIT = "DEPOSIT"
222
226
 
223
227
 
224
228
  class ParamMessagingProtocolsItem(_WireStrEnum):
@@ -264,6 +268,7 @@ class AbstractBlockchainMetaInfo(BaseClientModel):
264
268
  address_url: str = Field(alias="addressUrl")
265
269
  block_explorer_urls: List[str] = Field(alias="blockExplorerUrls")
266
270
  info_type: str = Field(alias="infoType")
271
+ token_url: Optional[str] = Field(default=None, alias="tokenUrl")
267
272
  transaction_url: str = Field(alias="transactionUrl")
268
273
 
269
274
 
@@ -444,7 +449,7 @@ class CheckApprovalResponse(BaseClientModel):
444
449
  default=None,
445
450
  alias="currentApprovedAmount",
446
451
  description="current approved amount",
447
- examples=[Decimal("8.0")],
452
+ examples=[Decimal("8")],
448
453
  )
449
454
  is_approved: bool = Field(
450
455
  alias="isApproved",
@@ -455,7 +460,7 @@ class CheckApprovalResponse(BaseClientModel):
455
460
  default=None,
456
461
  alias="requiredApprovedAmount",
457
462
  description="required approve amount",
458
- examples=[Decimal("10.0")],
463
+ examples=[Decimal("10")],
459
464
  )
460
465
  tx_status: Optional[CheckApprovalResponseTxStatus] = Field(
461
466
  default=None,
@@ -636,7 +641,7 @@ class StellarTransactionPreconditionsTimeBounds(BaseClientModel):
636
641
 
637
642
  max_time: int = Field(
638
643
  alias="maxTime",
639
- description="Unix timestamped constraint for minimum time of transaction validity",
644
+ description="Unix timestamped constraint for maximum time of transaction validity",
640
645
  )
641
646
  min_time: int = Field(
642
647
  alias="minTime",
@@ -1059,11 +1064,26 @@ class TonMetaInfo(AbstractBlockchainMetaInfo):
1059
1064
  pass
1060
1065
 
1061
1066
 
1067
+ class TransferContract(TrxContractWrapperParameterValue):
1068
+ amount: Optional[int] = Field(default=None, alias="amount")
1069
+ owner_address: str = Field(alias="owner_address")
1070
+ to_address: str = Field(alias="to_address")
1071
+
1072
+
1062
1073
  class TransferMetaInfo(AbstractBlockchainMetaInfo):
1063
1074
  pass
1064
1075
 
1065
1076
 
1077
+ class TriggerSmartContract(TrxContractWrapperParameterValue):
1078
+ call_value: Optional[int] = Field(default=None, alias="call_value")
1079
+ contract_address: str = Field(alias="contract_address")
1080
+ data: str = Field(alias="data")
1081
+ owner_address: str = Field(alias="owner_address")
1082
+
1083
+
1066
1084
  class TrxContractWrapperParameter(BaseClientModel):
1085
+ """Wrapper parameter of contract of Trx transaction's raw data"""
1086
+
1067
1087
  type_url: Optional[str] = Field(default=None, alias="type_url")
1068
1088
  value: Optional[TrxContractWrapperParameterValue] = Field(
1069
1089
  default=None, alias="value"
@@ -1083,10 +1103,10 @@ class XrplChangeTrustLinePrerequisite(GenericTransactionPrerequisite):
1083
1103
  description="Xrpl Asset Issuer",
1084
1104
  examples=["rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De"],
1085
1105
  )
1086
- value: str = Field(
1106
+ value: Decimal = Field(
1087
1107
  alias="value",
1088
1108
  description="Minimum expected limit value of trust",
1089
- examples=["1000000000"],
1109
+ examples=[Decimal("1000000000")],
1090
1110
  )
1091
1111
  wallet: str = Field(
1092
1112
  alias="wallet", description="User's wallet address", examples=["r....."]
@@ -1245,7 +1265,10 @@ class StellarTransactionData(BaseClientModel):
1245
1265
 
1246
1266
 
1247
1267
  class TrxContractWrapper(BaseClientModel):
1248
- parameter: TrxContractWrapperParameter = Field(alias="parameter")
1268
+ parameter: TrxContractWrapperParameter = Field(
1269
+ alias="parameter",
1270
+ description="Wrapper parameter of contract of Trx transaction's raw data",
1271
+ )
1249
1272
  type_: str = Field(alias="type")
1250
1273
 
1251
1274
 
@@ -1336,14 +1359,6 @@ class BasicApiEvmTransaction(GenericTransaction):
1336
1359
  validator
1337
1360
  """),
1338
1361
  )
1339
- priority_gas_price: Optional[int] = Field(
1340
- default=None,
1341
- alias="priorityGasPrice",
1342
- description=("""
1343
- The maximum price of the consumed gas to be included as a tip to the
1344
- validator
1345
- """),
1346
- )
1347
1362
  tx_data: Optional[str] = Field(
1348
1363
  default=None,
1349
1364
  alias="txData",
@@ -1493,6 +1508,38 @@ class CosmosTransaction(GenericTransaction):
1493
1508
  )
1494
1509
 
1495
1510
 
1511
+ class DepositTransaction(GenericTransaction):
1512
+ amount: int = Field(
1513
+ alias="amount",
1514
+ description="The machine-readable amount to deposit",
1515
+ examples=[1000000000000000000],
1516
+ )
1517
+ block_chain: Blockchain = Field(
1518
+ alias="blockChain",
1519
+ description="The blockchain that this deposit must be executed on",
1520
+ )
1521
+ deposit_address: str = Field(
1522
+ alias="depositAddress",
1523
+ description="The deposit address that the funds must be transferred to",
1524
+ )
1525
+ from_: str = Field(
1526
+ alias="from", description="User's wallet address that must send the deposit"
1527
+ )
1528
+ memo: Optional[str] = Field(
1529
+ default=None,
1530
+ alias="memo",
1531
+ description="The memo that must be attached to the deposit if non-null",
1532
+ )
1533
+ token_address: Optional[str] = Field(
1534
+ default=None,
1535
+ alias="tokenAddress",
1536
+ description=("""
1537
+ Contract address of the asset to deposit, null means the blockchain's
1538
+ native asset
1539
+ """),
1540
+ )
1541
+
1542
+
1496
1543
  class HyperliquidTransaction(GenericTransaction):
1497
1544
  action: HyperliquidTransactionActionMessage = Field(
1498
1545
  alias="action", description="hyperliquid action to send"
@@ -1603,6 +1650,9 @@ class TransferTransaction(GenericTransaction):
1603
1650
  asset: AssetWithTicker = Field(
1604
1651
  alias="asset", description="An asset with its ticker"
1605
1652
  )
1653
+ block_chain: Blockchain = Field(
1654
+ alias="blockChain", description="Blockchain of asset"
1655
+ )
1606
1656
  decimals: int = Field(alias="decimals", description="The decimals of the asset")
1607
1657
  from_wallet_address: str = Field(
1608
1658
  alias="fromWalletAddress",
@@ -1637,7 +1687,7 @@ class TrxRawData(BaseClientModel):
1637
1687
  """Raw data of TrxTransaction"""
1638
1688
 
1639
1689
  contract: List[TrxContractWrapper] = Field(alias="contract")
1640
- data: str = Field(alias="data")
1690
+ data: Optional[str] = Field(default=None, alias="data")
1641
1691
  expiration: int = Field(alias="expiration")
1642
1692
  fee_limit: Optional[int] = Field(default=None, alias="fee_limit")
1643
1693
  ref_block_bytes: str = Field(alias="ref_block_bytes")
@@ -1762,6 +1812,7 @@ class BasicApiSwapResponse(BaseClientModel):
1762
1812
  BasicApiStarkNetTransaction,
1763
1813
  BasicApiTrxTransaction,
1764
1814
  CosmosTransaction,
1815
+ DepositTransaction,
1765
1816
  HyperliquidTransaction,
1766
1817
  SolanaTransaction,
1767
1818
  StellarTransaction,
@@ -7,20 +7,21 @@ from rango_basic_sdk.models import Blockchain, XrplChangeTrustLinePrerequisite
7
7
  if __name__ == '__main__':
8
8
  async def _main():
9
9
  _rango = RangoClient(
10
- base_url='http://localhost:8080',
11
- api_key='4a624ab5-16ff-4f96-90b7-ab00ddfc342c',
12
- log_http_debug=True,
10
+ # base_url='http://localhost:8080',
11
+ api_key='c6381a79-2817-4602-83bf-6a641a409e32',
12
+ # log_http_debug=True,
13
13
  )
14
14
 
15
- from_ = 'XRPL.XRP'
16
- to_ = 'XRPL.RLUSD--RLUSD-rMxCKbEDwqr76QuheSUMdEGf4B9xJ8m5De'
17
- amount_mr = 1500000
15
+ from_ = 'LTC.LTC'
16
+ to_ = 'ETH.ETH'
17
+ amount_mr = 100000000
18
18
 
19
19
  quote = await _rango.routing.quote(
20
20
  from_=from_,
21
21
  to=to_,
22
22
  amount=amount_mr,
23
23
  slippage=3.0,
24
+ enable_centralized_swappers=True
24
25
  )
25
26
  print('quote')
26
27
  print(quote)
@@ -32,8 +33,9 @@ if __name__ == '__main__':
32
33
  to=to_,
33
34
  amount=amount_mr,
34
35
  slippage=3.0,
35
- from_address='rPWrVmZQ3kBhxiBMdk9zqnkpF2MUhobi8x',
36
- to_address='rPWrVmZQ3kBhxiBMdk9zqnkpF2MUhobi8x',
36
+ enable_centralized_swappers=True,
37
+ from_address='MQd1fJwqBJvwLuyhr17PhEFx1swiqDbPQS',
38
+ to_address='0x84e37f0A37f4c1dEd6A13fbC4f16537F2479Bf67',
37
39
  disable_estimate=True,
38
40
  # swappers=['NearIntent'],
39
41
  # swappers_exclude=True,
@@ -45,7 +47,9 @@ if __name__ == '__main__':
45
47
  print(swap.tx)
46
48
  print('type of swap.tx')
47
49
  print(type(swap.tx))
50
+ print(swap.tx.psbt)
48
51
 
52
+ return
49
53
 
50
54
  import asyncio
51
55
 
File without changes