compass_api_sdk 0.3.11__py3-none-any.whl → 0.4.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.

Potentially problematic release.


This version of compass_api_sdk might be problematic. Click here for more details.

compass_api_sdk/morpho.py CHANGED
@@ -1470,7 +1470,7 @@ class Morpho(BaseSDK):
1470
1470
  server_url: Optional[str] = None,
1471
1471
  timeout_ms: Optional[int] = None,
1472
1472
  http_headers: Optional[Mapping[str, str]] = None,
1473
- ) -> models.UnsignedTransaction:
1473
+ ) -> models.TxResponse:
1474
1474
  r"""Set Allowance for Vault
1475
1475
 
1476
1476
  Set an allowance for a Morpho vault. You must set this for at least the amount you wish to deposit - before depositing.
@@ -1546,7 +1546,7 @@ class Morpho(BaseSDK):
1546
1546
 
1547
1547
  response_data: Any = None
1548
1548
  if utils.match_response(http_res, "200", "application/json"):
1549
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1549
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
1550
1550
  if utils.match_response(http_res, "422", "application/json"):
1551
1551
  response_data = utils.unmarshal_json(
1552
1552
  http_res.text, errors.HTTPValidationErrorData
@@ -1586,7 +1586,7 @@ class Morpho(BaseSDK):
1586
1586
  server_url: Optional[str] = None,
1587
1587
  timeout_ms: Optional[int] = None,
1588
1588
  http_headers: Optional[Mapping[str, str]] = None,
1589
- ) -> models.UnsignedTransaction:
1589
+ ) -> models.TxResponse:
1590
1590
  r"""Set Allowance for Vault
1591
1591
 
1592
1592
  Set an allowance for a Morpho vault. You must set this for at least the amount you wish to deposit - before depositing.
@@ -1662,7 +1662,7 @@ class Morpho(BaseSDK):
1662
1662
 
1663
1663
  response_data: Any = None
1664
1664
  if utils.match_response(http_res, "200", "application/json"):
1665
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1665
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
1666
1666
  if utils.match_response(http_res, "422", "application/json"):
1667
1667
  response_data = utils.unmarshal_json(
1668
1668
  http_res.text, errors.HTTPValidationErrorData
@@ -1703,7 +1703,7 @@ class Morpho(BaseSDK):
1703
1703
  server_url: Optional[str] = None,
1704
1704
  timeout_ms: Optional[int] = None,
1705
1705
  http_headers: Optional[Mapping[str, str]] = None,
1706
- ) -> models.UnsignedTransaction:
1706
+ ) -> models.TxResponse:
1707
1707
  r"""Deposit to Vault
1708
1708
 
1709
1709
  Deposit tokens into a Morpho Vault to earn passive yield from interest paid by
@@ -1787,7 +1787,7 @@ class Morpho(BaseSDK):
1787
1787
 
1788
1788
  response_data: Any = None
1789
1789
  if utils.match_response(http_res, "200", "application/json"):
1790
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1790
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
1791
1791
  if utils.match_response(http_res, "422", "application/json"):
1792
1792
  response_data = utils.unmarshal_json(
1793
1793
  http_res.text, errors.HTTPValidationErrorData
@@ -1828,7 +1828,7 @@ class Morpho(BaseSDK):
1828
1828
  server_url: Optional[str] = None,
1829
1829
  timeout_ms: Optional[int] = None,
1830
1830
  http_headers: Optional[Mapping[str, str]] = None,
1831
- ) -> models.UnsignedTransaction:
1831
+ ) -> models.TxResponse:
1832
1832
  r"""Deposit to Vault
1833
1833
 
1834
1834
  Deposit tokens into a Morpho Vault to earn passive yield from interest paid by
@@ -1912,7 +1912,7 @@ class Morpho(BaseSDK):
1912
1912
 
1913
1913
  response_data: Any = None
1914
1914
  if utils.match_response(http_res, "200", "application/json"):
1915
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1915
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
1916
1916
  if utils.match_response(http_res, "422", "application/json"):
1917
1917
  response_data = utils.unmarshal_json(
1918
1918
  http_res.text, errors.HTTPValidationErrorData
@@ -1950,7 +1950,7 @@ class Morpho(BaseSDK):
1950
1950
  server_url: Optional[str] = None,
1951
1951
  timeout_ms: Optional[int] = None,
1952
1952
  http_headers: Optional[Mapping[str, str]] = None,
1953
- ) -> models.UnsignedTransaction:
1953
+ ) -> models.TxResponse:
1954
1954
  r"""Withdraw from Vault
1955
1955
 
1956
1956
  Withdraw deposited tokens from a Morpho Vault.
@@ -2034,7 +2034,7 @@ class Morpho(BaseSDK):
2034
2034
 
2035
2035
  response_data: Any = None
2036
2036
  if utils.match_response(http_res, "200", "application/json"):
2037
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2037
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2038
2038
  if utils.match_response(http_res, "422", "application/json"):
2039
2039
  response_data = utils.unmarshal_json(
2040
2040
  http_res.text, errors.HTTPValidationErrorData
@@ -2072,7 +2072,7 @@ class Morpho(BaseSDK):
2072
2072
  server_url: Optional[str] = None,
2073
2073
  timeout_ms: Optional[int] = None,
2074
2074
  http_headers: Optional[Mapping[str, str]] = None,
2075
- ) -> models.UnsignedTransaction:
2075
+ ) -> models.TxResponse:
2076
2076
  r"""Withdraw from Vault
2077
2077
 
2078
2078
  Withdraw deposited tokens from a Morpho Vault.
@@ -2156,7 +2156,7 @@ class Morpho(BaseSDK):
2156
2156
 
2157
2157
  response_data: Any = None
2158
2158
  if utils.match_response(http_res, "200", "application/json"):
2159
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2159
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2160
2160
  if utils.match_response(http_res, "422", "application/json"):
2161
2161
  response_data = utils.unmarshal_json(
2162
2162
  http_res.text, errors.HTTPValidationErrorData
@@ -2198,7 +2198,7 @@ class Morpho(BaseSDK):
2198
2198
  server_url: Optional[str] = None,
2199
2199
  timeout_ms: Optional[int] = None,
2200
2200
  http_headers: Optional[Mapping[str, str]] = None,
2201
- ) -> models.UnsignedTransaction:
2201
+ ) -> models.TxResponse:
2202
2202
  r"""Supply Collateral to Market
2203
2203
 
2204
2204
  Supply collateral to a Morpho Market in order to borrow against it.
@@ -2279,7 +2279,7 @@ class Morpho(BaseSDK):
2279
2279
 
2280
2280
  response_data: Any = None
2281
2281
  if utils.match_response(http_res, "200", "application/json"):
2282
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2282
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2283
2283
  if utils.match_response(http_res, "422", "application/json"):
2284
2284
  response_data = utils.unmarshal_json(
2285
2285
  http_res.text, errors.HTTPValidationErrorData
@@ -2321,7 +2321,7 @@ class Morpho(BaseSDK):
2321
2321
  server_url: Optional[str] = None,
2322
2322
  timeout_ms: Optional[int] = None,
2323
2323
  http_headers: Optional[Mapping[str, str]] = None,
2324
- ) -> models.UnsignedTransaction:
2324
+ ) -> models.TxResponse:
2325
2325
  r"""Supply Collateral to Market
2326
2326
 
2327
2327
  Supply collateral to a Morpho Market in order to borrow against it.
@@ -2402,7 +2402,7 @@ class Morpho(BaseSDK):
2402
2402
 
2403
2403
  response_data: Any = None
2404
2404
  if utils.match_response(http_res, "200", "application/json"):
2405
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2405
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2406
2406
  if utils.match_response(http_res, "422", "application/json"):
2407
2407
  response_data = utils.unmarshal_json(
2408
2408
  http_res.text, errors.HTTPValidationErrorData
@@ -2444,7 +2444,7 @@ class Morpho(BaseSDK):
2444
2444
  server_url: Optional[str] = None,
2445
2445
  timeout_ms: Optional[int] = None,
2446
2446
  http_headers: Optional[Mapping[str, str]] = None,
2447
- ) -> models.UnsignedTransaction:
2447
+ ) -> models.TxResponse:
2448
2448
  r"""Withdraw Collateral from Market
2449
2449
 
2450
2450
  Withdraw collateral that has been supplied to a Morpho Market.
@@ -2525,7 +2525,7 @@ class Morpho(BaseSDK):
2525
2525
 
2526
2526
  response_data: Any = None
2527
2527
  if utils.match_response(http_res, "200", "application/json"):
2528
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2528
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2529
2529
  if utils.match_response(http_res, "422", "application/json"):
2530
2530
  response_data = utils.unmarshal_json(
2531
2531
  http_res.text, errors.HTTPValidationErrorData
@@ -2567,7 +2567,7 @@ class Morpho(BaseSDK):
2567
2567
  server_url: Optional[str] = None,
2568
2568
  timeout_ms: Optional[int] = None,
2569
2569
  http_headers: Optional[Mapping[str, str]] = None,
2570
- ) -> models.UnsignedTransaction:
2570
+ ) -> models.TxResponse:
2571
2571
  r"""Withdraw Collateral from Market
2572
2572
 
2573
2573
  Withdraw collateral that has been supplied to a Morpho Market.
@@ -2648,7 +2648,7 @@ class Morpho(BaseSDK):
2648
2648
 
2649
2649
  response_data: Any = None
2650
2650
  if utils.match_response(http_res, "200", "application/json"):
2651
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2651
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2652
2652
  if utils.match_response(http_res, "422", "application/json"):
2653
2653
  response_data = utils.unmarshal_json(
2654
2654
  http_res.text, errors.HTTPValidationErrorData
@@ -2689,7 +2689,7 @@ class Morpho(BaseSDK):
2689
2689
  server_url: Optional[str] = None,
2690
2690
  timeout_ms: Optional[int] = None,
2691
2691
  http_headers: Optional[Mapping[str, str]] = None,
2692
- ) -> models.UnsignedTransaction:
2692
+ ) -> models.TxResponse:
2693
2693
  r"""Borrow from Market
2694
2694
 
2695
2695
  Borrow tokens from a Morpho Market against supplied collateral.
@@ -2773,7 +2773,7 @@ class Morpho(BaseSDK):
2773
2773
 
2774
2774
  response_data: Any = None
2775
2775
  if utils.match_response(http_res, "200", "application/json"):
2776
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2776
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2777
2777
  if utils.match_response(http_res, "422", "application/json"):
2778
2778
  response_data = utils.unmarshal_json(
2779
2779
  http_res.text, errors.HTTPValidationErrorData
@@ -2814,7 +2814,7 @@ class Morpho(BaseSDK):
2814
2814
  server_url: Optional[str] = None,
2815
2815
  timeout_ms: Optional[int] = None,
2816
2816
  http_headers: Optional[Mapping[str, str]] = None,
2817
- ) -> models.UnsignedTransaction:
2817
+ ) -> models.TxResponse:
2818
2818
  r"""Borrow from Market
2819
2819
 
2820
2820
  Borrow tokens from a Morpho Market against supplied collateral.
@@ -2898,7 +2898,7 @@ class Morpho(BaseSDK):
2898
2898
 
2899
2899
  response_data: Any = None
2900
2900
  if utils.match_response(http_res, "200", "application/json"):
2901
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
2901
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
2902
2902
  if utils.match_response(http_res, "422", "application/json"):
2903
2903
  response_data = utils.unmarshal_json(
2904
2904
  http_res.text, errors.HTTPValidationErrorData
@@ -2937,7 +2937,7 @@ class Morpho(BaseSDK):
2937
2937
  server_url: Optional[str] = None,
2938
2938
  timeout_ms: Optional[int] = None,
2939
2939
  http_headers: Optional[Mapping[str, str]] = None,
2940
- ) -> models.UnsignedTransaction:
2940
+ ) -> models.TxResponse:
2941
2941
  r"""Repay to Market
2942
2942
 
2943
2943
  Repay borrowed tokens to a market in order to reduce or eliminate debt.
@@ -3018,7 +3018,7 @@ class Morpho(BaseSDK):
3018
3018
 
3019
3019
  response_data: Any = None
3020
3020
  if utils.match_response(http_res, "200", "application/json"):
3021
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
3021
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
3022
3022
  if utils.match_response(http_res, "422", "application/json"):
3023
3023
  response_data = utils.unmarshal_json(
3024
3024
  http_res.text, errors.HTTPValidationErrorData
@@ -3057,7 +3057,7 @@ class Morpho(BaseSDK):
3057
3057
  server_url: Optional[str] = None,
3058
3058
  timeout_ms: Optional[int] = None,
3059
3059
  http_headers: Optional[Mapping[str, str]] = None,
3060
- ) -> models.UnsignedTransaction:
3060
+ ) -> models.TxResponse:
3061
3061
  r"""Repay to Market
3062
3062
 
3063
3063
  Repay borrowed tokens to a market in order to reduce or eliminate debt.
@@ -3138,7 +3138,7 @@ class Morpho(BaseSDK):
3138
3138
 
3139
3139
  response_data: Any = None
3140
3140
  if utils.match_response(http_res, "200", "application/json"):
3141
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
3141
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
3142
3142
  if utils.match_response(http_res, "422", "application/json"):
3143
3143
  response_data = utils.unmarshal_json(
3144
3144
  http_res.text, errors.HTTPValidationErrorData
compass_api_sdk/sdk.py CHANGED
@@ -11,6 +11,7 @@ from compass_api_sdk.aave_v3 import AaveV3
11
11
  from compass_api_sdk.aerodrome_slipstream import AerodromeSlipstream
12
12
  from compass_api_sdk.morpho import Morpho
13
13
  from compass_api_sdk.sky import Sky
14
+ from compass_api_sdk.smart_account import SmartAccount
14
15
  from compass_api_sdk.token_sdk import TokenSDK
15
16
  from compass_api_sdk.transaction_batching import TransactionBatching
16
17
  from compass_api_sdk.types import OptionalNullable, UNSET
@@ -32,6 +33,7 @@ class CompassAPI(BaseSDK):
32
33
  uniswap_v3: UniswapV3
33
34
  universal: Universal
34
35
  transaction_batching: TransactionBatching
36
+ smart_account: SmartAccount
35
37
 
36
38
  def __init__(
37
39
  self,
@@ -137,6 +139,7 @@ class CompassAPI(BaseSDK):
137
139
  self.uniswap_v3 = UniswapV3(self.sdk_configuration)
138
140
  self.universal = Universal(self.sdk_configuration)
139
141
  self.transaction_batching = TransactionBatching(self.sdk_configuration)
142
+ self.smart_account = SmartAccount(self.sdk_configuration)
140
143
 
141
144
  def __enter__(self):
142
145
  return self
compass_api_sdk/sky.py CHANGED
@@ -212,7 +212,7 @@ class Sky(BaseSDK):
212
212
  server_url: Optional[str] = None,
213
213
  timeout_ms: Optional[int] = None,
214
214
  http_headers: Optional[Mapping[str, str]] = None,
215
- ) -> models.UnsignedTransaction:
215
+ ) -> models.TxResponse:
216
216
  r"""Buy USDS
217
217
 
218
218
  Buy USDS with DAI or USDC on a 1:1 basis. There are no fees.
@@ -288,7 +288,7 @@ class Sky(BaseSDK):
288
288
 
289
289
  response_data: Any = None
290
290
  if utils.match_response(http_res, "200", "application/json"):
291
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
291
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
292
292
  if utils.match_response(http_res, "422", "application/json"):
293
293
  response_data = utils.unmarshal_json(
294
294
  http_res.text, errors.HTTPValidationErrorData
@@ -324,7 +324,7 @@ class Sky(BaseSDK):
324
324
  server_url: Optional[str] = None,
325
325
  timeout_ms: Optional[int] = None,
326
326
  http_headers: Optional[Mapping[str, str]] = None,
327
- ) -> models.UnsignedTransaction:
327
+ ) -> models.TxResponse:
328
328
  r"""Buy USDS
329
329
 
330
330
  Buy USDS with DAI or USDC on a 1:1 basis. There are no fees.
@@ -400,7 +400,7 @@ class Sky(BaseSDK):
400
400
 
401
401
  response_data: Any = None
402
402
  if utils.match_response(http_res, "200", "application/json"):
403
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
403
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
404
404
  if utils.match_response(http_res, "422", "application/json"):
405
405
  response_data = utils.unmarshal_json(
406
406
  http_res.text, errors.HTTPValidationErrorData
@@ -438,7 +438,7 @@ class Sky(BaseSDK):
438
438
  server_url: Optional[str] = None,
439
439
  timeout_ms: Optional[int] = None,
440
440
  http_headers: Optional[Mapping[str, str]] = None,
441
- ) -> models.UnsignedTransaction:
441
+ ) -> models.TxResponse:
442
442
  r"""Sell USDS
443
443
 
444
444
  Sell USDS for DAI or USDC on a 1:1 basis. There are no fees.
@@ -514,7 +514,7 @@ class Sky(BaseSDK):
514
514
 
515
515
  response_data: Any = None
516
516
  if utils.match_response(http_res, "200", "application/json"):
517
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
517
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
518
518
  if utils.match_response(http_res, "422", "application/json"):
519
519
  response_data = utils.unmarshal_json(
520
520
  http_res.text, errors.HTTPValidationErrorData
@@ -552,7 +552,7 @@ class Sky(BaseSDK):
552
552
  server_url: Optional[str] = None,
553
553
  timeout_ms: Optional[int] = None,
554
554
  http_headers: Optional[Mapping[str, str]] = None,
555
- ) -> models.UnsignedTransaction:
555
+ ) -> models.TxResponse:
556
556
  r"""Sell USDS
557
557
 
558
558
  Sell USDS for DAI or USDC on a 1:1 basis. There are no fees.
@@ -628,7 +628,7 @@ class Sky(BaseSDK):
628
628
 
629
629
  response_data: Any = None
630
630
  if utils.match_response(http_res, "200", "application/json"):
631
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
631
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
632
632
  if utils.match_response(http_res, "422", "application/json"):
633
633
  response_data = utils.unmarshal_json(
634
634
  http_res.text, errors.HTTPValidationErrorData
@@ -666,7 +666,7 @@ class Sky(BaseSDK):
666
666
  server_url: Optional[str] = None,
667
667
  timeout_ms: Optional[int] = None,
668
668
  http_headers: Optional[Mapping[str, str]] = None,
669
- ) -> models.UnsignedTransaction:
669
+ ) -> models.TxResponse:
670
670
  r"""Deposit USDS
671
671
 
672
672
  Deposit USDS for sUSDS to earn yield.
@@ -738,7 +738,7 @@ class Sky(BaseSDK):
738
738
 
739
739
  response_data: Any = None
740
740
  if utils.match_response(http_res, "200", "application/json"):
741
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
741
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
742
742
  if utils.match_response(http_res, "422", "application/json"):
743
743
  response_data = utils.unmarshal_json(
744
744
  http_res.text, errors.HTTPValidationErrorData
@@ -776,7 +776,7 @@ class Sky(BaseSDK):
776
776
  server_url: Optional[str] = None,
777
777
  timeout_ms: Optional[int] = None,
778
778
  http_headers: Optional[Mapping[str, str]] = None,
779
- ) -> models.UnsignedTransaction:
779
+ ) -> models.TxResponse:
780
780
  r"""Deposit USDS
781
781
 
782
782
  Deposit USDS for sUSDS to earn yield.
@@ -848,7 +848,7 @@ class Sky(BaseSDK):
848
848
 
849
849
  response_data: Any = None
850
850
  if utils.match_response(http_res, "200", "application/json"):
851
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
851
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
852
852
  if utils.match_response(http_res, "422", "application/json"):
853
853
  response_data = utils.unmarshal_json(
854
854
  http_res.text, errors.HTTPValidationErrorData
@@ -884,7 +884,7 @@ class Sky(BaseSDK):
884
884
  server_url: Optional[str] = None,
885
885
  timeout_ms: Optional[int] = None,
886
886
  http_headers: Optional[Mapping[str, str]] = None,
887
- ) -> models.UnsignedTransaction:
887
+ ) -> models.TxResponse:
888
888
  r"""Withdraw USDS
889
889
 
890
890
  Withdraw USDS for sUSDS to stop earning yield.
@@ -954,7 +954,7 @@ class Sky(BaseSDK):
954
954
 
955
955
  response_data: Any = None
956
956
  if utils.match_response(http_res, "200", "application/json"):
957
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
957
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
958
958
  if utils.match_response(http_res, "422", "application/json"):
959
959
  response_data = utils.unmarshal_json(
960
960
  http_res.text, errors.HTTPValidationErrorData
@@ -990,7 +990,7 @@ class Sky(BaseSDK):
990
990
  server_url: Optional[str] = None,
991
991
  timeout_ms: Optional[int] = None,
992
992
  http_headers: Optional[Mapping[str, str]] = None,
993
- ) -> models.UnsignedTransaction:
993
+ ) -> models.TxResponse:
994
994
  r"""Withdraw USDS
995
995
 
996
996
  Withdraw USDS for sUSDS to stop earning yield.
@@ -1060,7 +1060,7 @@ class Sky(BaseSDK):
1060
1060
 
1061
1061
  response_data: Any = None
1062
1062
  if utils.match_response(http_res, "200", "application/json"):
1063
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
1063
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
1064
1064
  if utils.match_response(http_res, "422", "application/json"):
1065
1065
  response_data = utils.unmarshal_json(
1066
1066
  http_res.text, errors.HTTPValidationErrorData
@@ -0,0 +1,229 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from .basesdk import BaseSDK
4
+ from compass_api_sdk import errors, models, utils
5
+ from compass_api_sdk._hooks import HookContext
6
+ from compass_api_sdk.types import OptionalNullable, UNSET
7
+ from typing import Any, Dict, List, Mapping, Optional, Union
8
+
9
+
10
+ class SmartAccount(BaseSDK):
11
+ def account_batched_user_operations(
12
+ self,
13
+ *,
14
+ chain: models.Chain,
15
+ operations: Union[
16
+ List[models.UserOperation], List[models.UserOperationTypedDict]
17
+ ],
18
+ additional_properties: Optional[Dict[str, Any]] = None,
19
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
20
+ server_url: Optional[str] = None,
21
+ timeout_ms: Optional[int] = None,
22
+ http_headers: Optional[Mapping[str, str]] = None,
23
+ ) -> models.BatchedUserOperationsResponse:
24
+ r"""Get Smart Account Batched User Operations
25
+
26
+ Generate a list of user operations for smart account batching.
27
+
28
+ :param chain: The chain to use.
29
+ :param operations: List of possible user operations
30
+ :param additional_properties:
31
+ :param retries: Override the default retry configuration for this method
32
+ :param server_url: Override the default server URL for this method
33
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
34
+ :param http_headers: Additional headers to set or replace on requests.
35
+ """
36
+ base_url = None
37
+ url_variables = None
38
+ if timeout_ms is None:
39
+ timeout_ms = self.sdk_configuration.timeout_ms
40
+
41
+ if server_url is not None:
42
+ base_url = server_url
43
+ else:
44
+ base_url = self._get_url(base_url, url_variables)
45
+
46
+ request = models.BatchedUserOperationsRequest(
47
+ chain=chain,
48
+ operations=utils.get_pydantic_model(operations, List[models.UserOperation]),
49
+ **(additional_properties or {}),
50
+ )
51
+
52
+ req = self._build_request(
53
+ method="POST",
54
+ path="/v0/smart_account/batched_user_operations",
55
+ base_url=base_url,
56
+ url_variables=url_variables,
57
+ request=request,
58
+ request_body_required=True,
59
+ request_has_path_params=False,
60
+ request_has_query_params=True,
61
+ user_agent_header="user-agent",
62
+ accept_header_value="application/json",
63
+ http_headers=http_headers,
64
+ security=self.sdk_configuration.security,
65
+ get_serialized_body=lambda: utils.serialize_request_body(
66
+ request, False, False, "json", models.BatchedUserOperationsRequest
67
+ ),
68
+ timeout_ms=timeout_ms,
69
+ )
70
+
71
+ if retries == UNSET:
72
+ if self.sdk_configuration.retry_config is not UNSET:
73
+ retries = self.sdk_configuration.retry_config
74
+
75
+ retry_config = None
76
+ if isinstance(retries, utils.RetryConfig):
77
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
78
+
79
+ http_res = self.do_request(
80
+ hook_ctx=HookContext(
81
+ base_url=base_url or "",
82
+ operation_id="smart_account_batched_user_operations",
83
+ oauth2_scopes=[],
84
+ security_source=self.sdk_configuration.security,
85
+ ),
86
+ request=req,
87
+ error_status_codes=["422", "4XX", "5XX"],
88
+ retry_config=retry_config,
89
+ )
90
+
91
+ response_data: Any = None
92
+ if utils.match_response(http_res, "200", "application/json"):
93
+ return utils.unmarshal_json(
94
+ http_res.text, models.BatchedUserOperationsResponse
95
+ )
96
+ if utils.match_response(http_res, "422", "application/json"):
97
+ response_data = utils.unmarshal_json(
98
+ http_res.text, errors.HTTPValidationErrorData
99
+ )
100
+ raise errors.HTTPValidationError(data=response_data)
101
+ if utils.match_response(http_res, "4XX", "*"):
102
+ http_res_text = utils.stream_to_text(http_res)
103
+ raise errors.APIError(
104
+ "API error occurred", http_res.status_code, http_res_text, http_res
105
+ )
106
+ if utils.match_response(http_res, "5XX", "*"):
107
+ http_res_text = utils.stream_to_text(http_res)
108
+ raise errors.APIError(
109
+ "API error occurred", http_res.status_code, http_res_text, http_res
110
+ )
111
+
112
+ content_type = http_res.headers.get("Content-Type")
113
+ http_res_text = utils.stream_to_text(http_res)
114
+ raise errors.APIError(
115
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
116
+ http_res.status_code,
117
+ http_res_text,
118
+ http_res,
119
+ )
120
+
121
+ async def account_batched_user_operations_async(
122
+ self,
123
+ *,
124
+ chain: models.Chain,
125
+ operations: Union[
126
+ List[models.UserOperation], List[models.UserOperationTypedDict]
127
+ ],
128
+ additional_properties: Optional[Dict[str, Any]] = None,
129
+ retries: OptionalNullable[utils.RetryConfig] = UNSET,
130
+ server_url: Optional[str] = None,
131
+ timeout_ms: Optional[int] = None,
132
+ http_headers: Optional[Mapping[str, str]] = None,
133
+ ) -> models.BatchedUserOperationsResponse:
134
+ r"""Get Smart Account Batched User Operations
135
+
136
+ Generate a list of user operations for smart account batching.
137
+
138
+ :param chain: The chain to use.
139
+ :param operations: List of possible user operations
140
+ :param additional_properties:
141
+ :param retries: Override the default retry configuration for this method
142
+ :param server_url: Override the default server URL for this method
143
+ :param timeout_ms: Override the default request timeout configuration for this method in milliseconds
144
+ :param http_headers: Additional headers to set or replace on requests.
145
+ """
146
+ base_url = None
147
+ url_variables = None
148
+ if timeout_ms is None:
149
+ timeout_ms = self.sdk_configuration.timeout_ms
150
+
151
+ if server_url is not None:
152
+ base_url = server_url
153
+ else:
154
+ base_url = self._get_url(base_url, url_variables)
155
+
156
+ request = models.BatchedUserOperationsRequest(
157
+ chain=chain,
158
+ operations=utils.get_pydantic_model(operations, List[models.UserOperation]),
159
+ **(additional_properties or {}),
160
+ )
161
+
162
+ req = self._build_request_async(
163
+ method="POST",
164
+ path="/v0/smart_account/batched_user_operations",
165
+ base_url=base_url,
166
+ url_variables=url_variables,
167
+ request=request,
168
+ request_body_required=True,
169
+ request_has_path_params=False,
170
+ request_has_query_params=True,
171
+ user_agent_header="user-agent",
172
+ accept_header_value="application/json",
173
+ http_headers=http_headers,
174
+ security=self.sdk_configuration.security,
175
+ get_serialized_body=lambda: utils.serialize_request_body(
176
+ request, False, False, "json", models.BatchedUserOperationsRequest
177
+ ),
178
+ timeout_ms=timeout_ms,
179
+ )
180
+
181
+ if retries == UNSET:
182
+ if self.sdk_configuration.retry_config is not UNSET:
183
+ retries = self.sdk_configuration.retry_config
184
+
185
+ retry_config = None
186
+ if isinstance(retries, utils.RetryConfig):
187
+ retry_config = (retries, ["429", "500", "502", "503", "504"])
188
+
189
+ http_res = await self.do_request_async(
190
+ hook_ctx=HookContext(
191
+ base_url=base_url or "",
192
+ operation_id="smart_account_batched_user_operations",
193
+ oauth2_scopes=[],
194
+ security_source=self.sdk_configuration.security,
195
+ ),
196
+ request=req,
197
+ error_status_codes=["422", "4XX", "5XX"],
198
+ retry_config=retry_config,
199
+ )
200
+
201
+ response_data: Any = None
202
+ if utils.match_response(http_res, "200", "application/json"):
203
+ return utils.unmarshal_json(
204
+ http_res.text, models.BatchedUserOperationsResponse
205
+ )
206
+ if utils.match_response(http_res, "422", "application/json"):
207
+ response_data = utils.unmarshal_json(
208
+ http_res.text, errors.HTTPValidationErrorData
209
+ )
210
+ raise errors.HTTPValidationError(data=response_data)
211
+ if utils.match_response(http_res, "4XX", "*"):
212
+ http_res_text = await utils.stream_to_text_async(http_res)
213
+ raise errors.APIError(
214
+ "API error occurred", http_res.status_code, http_res_text, http_res
215
+ )
216
+ if utils.match_response(http_res, "5XX", "*"):
217
+ http_res_text = await utils.stream_to_text_async(http_res)
218
+ raise errors.APIError(
219
+ "API error occurred", http_res.status_code, http_res_text, http_res
220
+ )
221
+
222
+ content_type = http_res.headers.get("Content-Type")
223
+ http_res_text = await utils.stream_to_text_async(http_res)
224
+ raise errors.APIError(
225
+ f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
226
+ http_res.status_code,
227
+ http_res_text,
228
+ http_res,
229
+ )
@@ -639,7 +639,7 @@ class TokenSDK(BaseSDK):
639
639
  server_url: Optional[str] = None,
640
640
  timeout_ms: Optional[int] = None,
641
641
  http_headers: Optional[Mapping[str, str]] = None,
642
- ) -> models.UnsignedTransaction:
642
+ ) -> models.TxResponse:
643
643
  r"""Transfer ETH or ERC20 Tokens.
644
644
 
645
645
  Sends native ETH or ERC20 tokens from the sender's address to another address.
@@ -713,7 +713,7 @@ class TokenSDK(BaseSDK):
713
713
 
714
714
  response_data: Any = None
715
715
  if utils.match_response(http_res, "200", "application/json"):
716
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
716
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
717
717
  if utils.match_response(http_res, "422", "application/json"):
718
718
  response_data = utils.unmarshal_json(
719
719
  http_res.text, errors.HTTPValidationErrorData
@@ -756,7 +756,7 @@ class TokenSDK(BaseSDK):
756
756
  server_url: Optional[str] = None,
757
757
  timeout_ms: Optional[int] = None,
758
758
  http_headers: Optional[Mapping[str, str]] = None,
759
- ) -> models.UnsignedTransaction:
759
+ ) -> models.TxResponse:
760
760
  r"""Transfer ETH or ERC20 Tokens.
761
761
 
762
762
  Sends native ETH or ERC20 tokens from the sender's address to another address.
@@ -830,7 +830,7 @@ class TokenSDK(BaseSDK):
830
830
 
831
831
  response_data: Any = None
832
832
  if utils.match_response(http_res, "200", "application/json"):
833
- return utils.unmarshal_json(http_res.text, models.UnsignedTransaction)
833
+ return utils.unmarshal_json(http_res.text, models.TxResponse)
834
834
  if utils.match_response(http_res, "422", "application/json"):
835
835
  response_data = utils.unmarshal_json(
836
836
  http_res.text, errors.HTTPValidationErrorData