compass_api_sdk 0.9.36__py3-none-any.whl → 0.9.38__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.

@@ -99,33 +99,22 @@ class UniswapV3(BaseSDK):
99
99
 
100
100
  response_data: Any = None
101
101
  if utils.match_response(http_res, "200", "application/json"):
102
- return utils.unmarshal_json(
103
- http_res.text, models.UniswapBuyQuoteInfoResponse
102
+ return utils.unmarshal_json_response(
103
+ models.UniswapBuyQuoteInfoResponse, http_res
104
104
  )
105
105
  if utils.match_response(http_res, "422", "application/json"):
106
- response_data = utils.unmarshal_json(
107
- http_res.text, errors.HTTPValidationErrorData
106
+ response_data = utils.unmarshal_json_response(
107
+ errors.HTTPValidationErrorData, http_res
108
108
  )
109
- raise errors.HTTPValidationError(data=response_data)
109
+ raise errors.HTTPValidationError(response_data, http_res)
110
110
  if utils.match_response(http_res, "4XX", "*"):
111
111
  http_res_text = utils.stream_to_text(http_res)
112
- raise errors.APIError(
113
- "API error occurred", http_res.status_code, http_res_text, http_res
114
- )
112
+ raise errors.APIError("API error occurred", http_res, http_res_text)
115
113
  if utils.match_response(http_res, "5XX", "*"):
116
114
  http_res_text = utils.stream_to_text(http_res)
117
- raise errors.APIError(
118
- "API error occurred", http_res.status_code, http_res_text, http_res
119
- )
115
+ raise errors.APIError("API error occurred", http_res, http_res_text)
120
116
 
121
- content_type = http_res.headers.get("Content-Type")
122
- http_res_text = utils.stream_to_text(http_res)
123
- raise errors.APIError(
124
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
125
- http_res.status_code,
126
- http_res_text,
127
- http_res,
128
- )
117
+ raise errors.APIError("Unexpected response received", http_res)
129
118
 
130
119
  async def quote_buy_exactly_async(
131
120
  self,
@@ -218,33 +207,22 @@ class UniswapV3(BaseSDK):
218
207
 
219
208
  response_data: Any = None
220
209
  if utils.match_response(http_res, "200", "application/json"):
221
- return utils.unmarshal_json(
222
- http_res.text, models.UniswapBuyQuoteInfoResponse
210
+ return utils.unmarshal_json_response(
211
+ models.UniswapBuyQuoteInfoResponse, http_res
223
212
  )
224
213
  if utils.match_response(http_res, "422", "application/json"):
225
- response_data = utils.unmarshal_json(
226
- http_res.text, errors.HTTPValidationErrorData
214
+ response_data = utils.unmarshal_json_response(
215
+ errors.HTTPValidationErrorData, http_res
227
216
  )
228
- raise errors.HTTPValidationError(data=response_data)
217
+ raise errors.HTTPValidationError(response_data, http_res)
229
218
  if utils.match_response(http_res, "4XX", "*"):
230
219
  http_res_text = await utils.stream_to_text_async(http_res)
231
- raise errors.APIError(
232
- "API error occurred", http_res.status_code, http_res_text, http_res
233
- )
220
+ raise errors.APIError("API error occurred", http_res, http_res_text)
234
221
  if utils.match_response(http_res, "5XX", "*"):
235
222
  http_res_text = await utils.stream_to_text_async(http_res)
236
- raise errors.APIError(
237
- "API error occurred", http_res.status_code, http_res_text, http_res
238
- )
223
+ raise errors.APIError("API error occurred", http_res, http_res_text)
239
224
 
240
- content_type = http_res.headers.get("Content-Type")
241
- http_res_text = await utils.stream_to_text_async(http_res)
242
- raise errors.APIError(
243
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
244
- http_res.status_code,
245
- http_res_text,
246
- http_res,
247
- )
225
+ raise errors.APIError("Unexpected response received", http_res)
248
226
 
249
227
  def quote_sell_exactly(
250
228
  self,
@@ -337,33 +315,22 @@ class UniswapV3(BaseSDK):
337
315
 
338
316
  response_data: Any = None
339
317
  if utils.match_response(http_res, "200", "application/json"):
340
- return utils.unmarshal_json(
341
- http_res.text, models.UniswapSellQuoteInfoResponse
318
+ return utils.unmarshal_json_response(
319
+ models.UniswapSellQuoteInfoResponse, http_res
342
320
  )
343
321
  if utils.match_response(http_res, "422", "application/json"):
344
- response_data = utils.unmarshal_json(
345
- http_res.text, errors.HTTPValidationErrorData
322
+ response_data = utils.unmarshal_json_response(
323
+ errors.HTTPValidationErrorData, http_res
346
324
  )
347
- raise errors.HTTPValidationError(data=response_data)
325
+ raise errors.HTTPValidationError(response_data, http_res)
348
326
  if utils.match_response(http_res, "4XX", "*"):
349
327
  http_res_text = utils.stream_to_text(http_res)
350
- raise errors.APIError(
351
- "API error occurred", http_res.status_code, http_res_text, http_res
352
- )
328
+ raise errors.APIError("API error occurred", http_res, http_res_text)
353
329
  if utils.match_response(http_res, "5XX", "*"):
354
330
  http_res_text = utils.stream_to_text(http_res)
355
- raise errors.APIError(
356
- "API error occurred", http_res.status_code, http_res_text, http_res
357
- )
331
+ raise errors.APIError("API error occurred", http_res, http_res_text)
358
332
 
359
- content_type = http_res.headers.get("Content-Type")
360
- http_res_text = utils.stream_to_text(http_res)
361
- raise errors.APIError(
362
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
363
- http_res.status_code,
364
- http_res_text,
365
- http_res,
366
- )
333
+ raise errors.APIError("Unexpected response received", http_res)
367
334
 
368
335
  async def quote_sell_exactly_async(
369
336
  self,
@@ -456,33 +423,22 @@ class UniswapV3(BaseSDK):
456
423
 
457
424
  response_data: Any = None
458
425
  if utils.match_response(http_res, "200", "application/json"):
459
- return utils.unmarshal_json(
460
- http_res.text, models.UniswapSellQuoteInfoResponse
426
+ return utils.unmarshal_json_response(
427
+ models.UniswapSellQuoteInfoResponse, http_res
461
428
  )
462
429
  if utils.match_response(http_res, "422", "application/json"):
463
- response_data = utils.unmarshal_json(
464
- http_res.text, errors.HTTPValidationErrorData
430
+ response_data = utils.unmarshal_json_response(
431
+ errors.HTTPValidationErrorData, http_res
465
432
  )
466
- raise errors.HTTPValidationError(data=response_data)
433
+ raise errors.HTTPValidationError(response_data, http_res)
467
434
  if utils.match_response(http_res, "4XX", "*"):
468
435
  http_res_text = await utils.stream_to_text_async(http_res)
469
- raise errors.APIError(
470
- "API error occurred", http_res.status_code, http_res_text, http_res
471
- )
436
+ raise errors.APIError("API error occurred", http_res, http_res_text)
472
437
  if utils.match_response(http_res, "5XX", "*"):
473
438
  http_res_text = await utils.stream_to_text_async(http_res)
474
- raise errors.APIError(
475
- "API error occurred", http_res.status_code, http_res_text, http_res
476
- )
439
+ raise errors.APIError("API error occurred", http_res, http_res_text)
477
440
 
478
- content_type = http_res.headers.get("Content-Type")
479
- http_res_text = await utils.stream_to_text_async(http_res)
480
- raise errors.APIError(
481
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
482
- http_res.status_code,
483
- http_res_text,
484
- http_res,
485
- )
441
+ raise errors.APIError("Unexpected response received", http_res)
486
442
 
487
443
  def pool_price(
488
444
  self,
@@ -567,31 +523,22 @@ class UniswapV3(BaseSDK):
567
523
 
568
524
  response_data: Any = None
569
525
  if utils.match_response(http_res, "200", "application/json"):
570
- return utils.unmarshal_json(http_res.text, models.UniswapPoolPriceResponse)
526
+ return utils.unmarshal_json_response(
527
+ models.UniswapPoolPriceResponse, http_res
528
+ )
571
529
  if utils.match_response(http_res, "422", "application/json"):
572
- response_data = utils.unmarshal_json(
573
- http_res.text, errors.HTTPValidationErrorData
530
+ response_data = utils.unmarshal_json_response(
531
+ errors.HTTPValidationErrorData, http_res
574
532
  )
575
- raise errors.HTTPValidationError(data=response_data)
533
+ raise errors.HTTPValidationError(response_data, http_res)
576
534
  if utils.match_response(http_res, "4XX", "*"):
577
535
  http_res_text = utils.stream_to_text(http_res)
578
- raise errors.APIError(
579
- "API error occurred", http_res.status_code, http_res_text, http_res
580
- )
536
+ raise errors.APIError("API error occurred", http_res, http_res_text)
581
537
  if utils.match_response(http_res, "5XX", "*"):
582
538
  http_res_text = utils.stream_to_text(http_res)
583
- raise errors.APIError(
584
- "API error occurred", http_res.status_code, http_res_text, http_res
585
- )
539
+ raise errors.APIError("API error occurred", http_res, http_res_text)
586
540
 
587
- content_type = http_res.headers.get("Content-Type")
588
- http_res_text = utils.stream_to_text(http_res)
589
- raise errors.APIError(
590
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
591
- http_res.status_code,
592
- http_res_text,
593
- http_res,
594
- )
541
+ raise errors.APIError("Unexpected response received", http_res)
595
542
 
596
543
  async def pool_price_async(
597
544
  self,
@@ -676,31 +623,22 @@ class UniswapV3(BaseSDK):
676
623
 
677
624
  response_data: Any = None
678
625
  if utils.match_response(http_res, "200", "application/json"):
679
- return utils.unmarshal_json(http_res.text, models.UniswapPoolPriceResponse)
626
+ return utils.unmarshal_json_response(
627
+ models.UniswapPoolPriceResponse, http_res
628
+ )
680
629
  if utils.match_response(http_res, "422", "application/json"):
681
- response_data = utils.unmarshal_json(
682
- http_res.text, errors.HTTPValidationErrorData
630
+ response_data = utils.unmarshal_json_response(
631
+ errors.HTTPValidationErrorData, http_res
683
632
  )
684
- raise errors.HTTPValidationError(data=response_data)
633
+ raise errors.HTTPValidationError(response_data, http_res)
685
634
  if utils.match_response(http_res, "4XX", "*"):
686
635
  http_res_text = await utils.stream_to_text_async(http_res)
687
- raise errors.APIError(
688
- "API error occurred", http_res.status_code, http_res_text, http_res
689
- )
636
+ raise errors.APIError("API error occurred", http_res, http_res_text)
690
637
  if utils.match_response(http_res, "5XX", "*"):
691
638
  http_res_text = await utils.stream_to_text_async(http_res)
692
- raise errors.APIError(
693
- "API error occurred", http_res.status_code, http_res_text, http_res
694
- )
639
+ raise errors.APIError("API error occurred", http_res, http_res_text)
695
640
 
696
- content_type = http_res.headers.get("Content-Type")
697
- http_res_text = await utils.stream_to_text_async(http_res)
698
- raise errors.APIError(
699
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
700
- http_res.status_code,
701
- http_res_text,
702
- http_res,
703
- )
641
+ raise errors.APIError("Unexpected response received", http_res)
704
642
 
705
643
  def liquidity_provision_in_range(
706
644
  self,
@@ -784,33 +722,22 @@ class UniswapV3(BaseSDK):
784
722
 
785
723
  response_data: Any = None
786
724
  if utils.match_response(http_res, "200", "application/json"):
787
- return utils.unmarshal_json(
788
- http_res.text, models.UniswapCheckInRangeResponse
725
+ return utils.unmarshal_json_response(
726
+ models.UniswapCheckInRangeResponse, http_res
789
727
  )
790
728
  if utils.match_response(http_res, "422", "application/json"):
791
- response_data = utils.unmarshal_json(
792
- http_res.text, errors.HTTPValidationErrorData
729
+ response_data = utils.unmarshal_json_response(
730
+ errors.HTTPValidationErrorData, http_res
793
731
  )
794
- raise errors.HTTPValidationError(data=response_data)
732
+ raise errors.HTTPValidationError(response_data, http_res)
795
733
  if utils.match_response(http_res, "4XX", "*"):
796
734
  http_res_text = utils.stream_to_text(http_res)
797
- raise errors.APIError(
798
- "API error occurred", http_res.status_code, http_res_text, http_res
799
- )
735
+ raise errors.APIError("API error occurred", http_res, http_res_text)
800
736
  if utils.match_response(http_res, "5XX", "*"):
801
737
  http_res_text = utils.stream_to_text(http_res)
802
- raise errors.APIError(
803
- "API error occurred", http_res.status_code, http_res_text, http_res
804
- )
738
+ raise errors.APIError("API error occurred", http_res, http_res_text)
805
739
 
806
- content_type = http_res.headers.get("Content-Type")
807
- http_res_text = utils.stream_to_text(http_res)
808
- raise errors.APIError(
809
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
810
- http_res.status_code,
811
- http_res_text,
812
- http_res,
813
- )
740
+ raise errors.APIError("Unexpected response received", http_res)
814
741
 
815
742
  async def liquidity_provision_in_range_async(
816
743
  self,
@@ -894,33 +821,22 @@ class UniswapV3(BaseSDK):
894
821
 
895
822
  response_data: Any = None
896
823
  if utils.match_response(http_res, "200", "application/json"):
897
- return utils.unmarshal_json(
898
- http_res.text, models.UniswapCheckInRangeResponse
824
+ return utils.unmarshal_json_response(
825
+ models.UniswapCheckInRangeResponse, http_res
899
826
  )
900
827
  if utils.match_response(http_res, "422", "application/json"):
901
- response_data = utils.unmarshal_json(
902
- http_res.text, errors.HTTPValidationErrorData
828
+ response_data = utils.unmarshal_json_response(
829
+ errors.HTTPValidationErrorData, http_res
903
830
  )
904
- raise errors.HTTPValidationError(data=response_data)
831
+ raise errors.HTTPValidationError(response_data, http_res)
905
832
  if utils.match_response(http_res, "4XX", "*"):
906
833
  http_res_text = await utils.stream_to_text_async(http_res)
907
- raise errors.APIError(
908
- "API error occurred", http_res.status_code, http_res_text, http_res
909
- )
834
+ raise errors.APIError("API error occurred", http_res, http_res_text)
910
835
  if utils.match_response(http_res, "5XX", "*"):
911
836
  http_res_text = await utils.stream_to_text_async(http_res)
912
- raise errors.APIError(
913
- "API error occurred", http_res.status_code, http_res_text, http_res
914
- )
837
+ raise errors.APIError("API error occurred", http_res, http_res_text)
915
838
 
916
- content_type = http_res.headers.get("Content-Type")
917
- http_res_text = await utils.stream_to_text_async(http_res)
918
- raise errors.APIError(
919
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
920
- http_res.status_code,
921
- http_res_text,
922
- http_res,
923
- )
839
+ raise errors.APIError("Unexpected response received", http_res)
924
840
 
925
841
  def liquidity_provision_positions(
926
842
  self,
@@ -1003,33 +919,22 @@ class UniswapV3(BaseSDK):
1003
919
 
1004
920
  response_data: Any = None
1005
921
  if utils.match_response(http_res, "200", "application/json"):
1006
- return utils.unmarshal_json(
1007
- http_res.text, models.UniswapLPPositionsInfoResponse
922
+ return utils.unmarshal_json_response(
923
+ models.UniswapLPPositionsInfoResponse, http_res
1008
924
  )
1009
925
  if utils.match_response(http_res, "422", "application/json"):
1010
- response_data = utils.unmarshal_json(
1011
- http_res.text, errors.HTTPValidationErrorData
926
+ response_data = utils.unmarshal_json_response(
927
+ errors.HTTPValidationErrorData, http_res
1012
928
  )
1013
- raise errors.HTTPValidationError(data=response_data)
929
+ raise errors.HTTPValidationError(response_data, http_res)
1014
930
  if utils.match_response(http_res, "4XX", "*"):
1015
931
  http_res_text = utils.stream_to_text(http_res)
1016
- raise errors.APIError(
1017
- "API error occurred", http_res.status_code, http_res_text, http_res
1018
- )
932
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1019
933
  if utils.match_response(http_res, "5XX", "*"):
1020
934
  http_res_text = utils.stream_to_text(http_res)
1021
- raise errors.APIError(
1022
- "API error occurred", http_res.status_code, http_res_text, http_res
1023
- )
935
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1024
936
 
1025
- content_type = http_res.headers.get("Content-Type")
1026
- http_res_text = utils.stream_to_text(http_res)
1027
- raise errors.APIError(
1028
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1029
- http_res.status_code,
1030
- http_res_text,
1031
- http_res,
1032
- )
937
+ raise errors.APIError("Unexpected response received", http_res)
1033
938
 
1034
939
  async def liquidity_provision_positions_async(
1035
940
  self,
@@ -1112,33 +1017,22 @@ class UniswapV3(BaseSDK):
1112
1017
 
1113
1018
  response_data: Any = None
1114
1019
  if utils.match_response(http_res, "200", "application/json"):
1115
- return utils.unmarshal_json(
1116
- http_res.text, models.UniswapLPPositionsInfoResponse
1020
+ return utils.unmarshal_json_response(
1021
+ models.UniswapLPPositionsInfoResponse, http_res
1117
1022
  )
1118
1023
  if utils.match_response(http_res, "422", "application/json"):
1119
- response_data = utils.unmarshal_json(
1120
- http_res.text, errors.HTTPValidationErrorData
1024
+ response_data = utils.unmarshal_json_response(
1025
+ errors.HTTPValidationErrorData, http_res
1121
1026
  )
1122
- raise errors.HTTPValidationError(data=response_data)
1027
+ raise errors.HTTPValidationError(response_data, http_res)
1123
1028
  if utils.match_response(http_res, "4XX", "*"):
1124
1029
  http_res_text = await utils.stream_to_text_async(http_res)
1125
- raise errors.APIError(
1126
- "API error occurred", http_res.status_code, http_res_text, http_res
1127
- )
1030
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1128
1031
  if utils.match_response(http_res, "5XX", "*"):
1129
1032
  http_res_text = await utils.stream_to_text_async(http_res)
1130
- raise errors.APIError(
1131
- "API error occurred", http_res.status_code, http_res_text, http_res
1132
- )
1033
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1133
1034
 
1134
- content_type = http_res.headers.get("Content-Type")
1135
- http_res_text = await utils.stream_to_text_async(http_res)
1136
- raise errors.APIError(
1137
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1138
- http_res.status_code,
1139
- http_res_text,
1140
- http_res,
1141
- )
1035
+ raise errors.APIError("Unexpected response received", http_res)
1142
1036
 
1143
1037
  def swap_buy_exactly(
1144
1038
  self,
@@ -1245,31 +1139,20 @@ class UniswapV3(BaseSDK):
1245
1139
 
1246
1140
  response_data: Any = None
1247
1141
  if utils.match_response(http_res, "200", "application/json"):
1248
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1142
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1249
1143
  if utils.match_response(http_res, "422", "application/json"):
1250
- response_data = utils.unmarshal_json(
1251
- http_res.text, errors.HTTPValidationErrorData
1144
+ response_data = utils.unmarshal_json_response(
1145
+ errors.HTTPValidationErrorData, http_res
1252
1146
  )
1253
- raise errors.HTTPValidationError(data=response_data)
1147
+ raise errors.HTTPValidationError(response_data, http_res)
1254
1148
  if utils.match_response(http_res, "4XX", "*"):
1255
1149
  http_res_text = utils.stream_to_text(http_res)
1256
- raise errors.APIError(
1257
- "API error occurred", http_res.status_code, http_res_text, http_res
1258
- )
1150
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1259
1151
  if utils.match_response(http_res, "5XX", "*"):
1260
1152
  http_res_text = utils.stream_to_text(http_res)
1261
- raise errors.APIError(
1262
- "API error occurred", http_res.status_code, http_res_text, http_res
1263
- )
1153
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1264
1154
 
1265
- content_type = http_res.headers.get("Content-Type")
1266
- http_res_text = utils.stream_to_text(http_res)
1267
- raise errors.APIError(
1268
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1269
- http_res.status_code,
1270
- http_res_text,
1271
- http_res,
1272
- )
1155
+ raise errors.APIError("Unexpected response received", http_res)
1273
1156
 
1274
1157
  async def swap_buy_exactly_async(
1275
1158
  self,
@@ -1376,31 +1259,20 @@ class UniswapV3(BaseSDK):
1376
1259
 
1377
1260
  response_data: Any = None
1378
1261
  if utils.match_response(http_res, "200", "application/json"):
1379
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1262
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1380
1263
  if utils.match_response(http_res, "422", "application/json"):
1381
- response_data = utils.unmarshal_json(
1382
- http_res.text, errors.HTTPValidationErrorData
1264
+ response_data = utils.unmarshal_json_response(
1265
+ errors.HTTPValidationErrorData, http_res
1383
1266
  )
1384
- raise errors.HTTPValidationError(data=response_data)
1267
+ raise errors.HTTPValidationError(response_data, http_res)
1385
1268
  if utils.match_response(http_res, "4XX", "*"):
1386
1269
  http_res_text = await utils.stream_to_text_async(http_res)
1387
- raise errors.APIError(
1388
- "API error occurred", http_res.status_code, http_res_text, http_res
1389
- )
1270
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1390
1271
  if utils.match_response(http_res, "5XX", "*"):
1391
1272
  http_res_text = await utils.stream_to_text_async(http_res)
1392
- raise errors.APIError(
1393
- "API error occurred", http_res.status_code, http_res_text, http_res
1394
- )
1273
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1395
1274
 
1396
- content_type = http_res.headers.get("Content-Type")
1397
- http_res_text = await utils.stream_to_text_async(http_res)
1398
- raise errors.APIError(
1399
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1400
- http_res.status_code,
1401
- http_res_text,
1402
- http_res,
1403
- )
1275
+ raise errors.APIError("Unexpected response received", http_res)
1404
1276
 
1405
1277
  def swap_sell_exactly(
1406
1278
  self,
@@ -1507,31 +1379,20 @@ class UniswapV3(BaseSDK):
1507
1379
 
1508
1380
  response_data: Any = None
1509
1381
  if utils.match_response(http_res, "200", "application/json"):
1510
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1382
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1511
1383
  if utils.match_response(http_res, "422", "application/json"):
1512
- response_data = utils.unmarshal_json(
1513
- http_res.text, errors.HTTPValidationErrorData
1384
+ response_data = utils.unmarshal_json_response(
1385
+ errors.HTTPValidationErrorData, http_res
1514
1386
  )
1515
- raise errors.HTTPValidationError(data=response_data)
1387
+ raise errors.HTTPValidationError(response_data, http_res)
1516
1388
  if utils.match_response(http_res, "4XX", "*"):
1517
1389
  http_res_text = utils.stream_to_text(http_res)
1518
- raise errors.APIError(
1519
- "API error occurred", http_res.status_code, http_res_text, http_res
1520
- )
1390
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1521
1391
  if utils.match_response(http_res, "5XX", "*"):
1522
1392
  http_res_text = utils.stream_to_text(http_res)
1523
- raise errors.APIError(
1524
- "API error occurred", http_res.status_code, http_res_text, http_res
1525
- )
1393
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1526
1394
 
1527
- content_type = http_res.headers.get("Content-Type")
1528
- http_res_text = utils.stream_to_text(http_res)
1529
- raise errors.APIError(
1530
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1531
- http_res.status_code,
1532
- http_res_text,
1533
- http_res,
1534
- )
1395
+ raise errors.APIError("Unexpected response received", http_res)
1535
1396
 
1536
1397
  async def swap_sell_exactly_async(
1537
1398
  self,
@@ -1638,31 +1499,20 @@ class UniswapV3(BaseSDK):
1638
1499
 
1639
1500
  response_data: Any = None
1640
1501
  if utils.match_response(http_res, "200", "application/json"):
1641
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1502
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1642
1503
  if utils.match_response(http_res, "422", "application/json"):
1643
- response_data = utils.unmarshal_json(
1644
- http_res.text, errors.HTTPValidationErrorData
1504
+ response_data = utils.unmarshal_json_response(
1505
+ errors.HTTPValidationErrorData, http_res
1645
1506
  )
1646
- raise errors.HTTPValidationError(data=response_data)
1507
+ raise errors.HTTPValidationError(response_data, http_res)
1647
1508
  if utils.match_response(http_res, "4XX", "*"):
1648
1509
  http_res_text = await utils.stream_to_text_async(http_res)
1649
- raise errors.APIError(
1650
- "API error occurred", http_res.status_code, http_res_text, http_res
1651
- )
1510
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1652
1511
  if utils.match_response(http_res, "5XX", "*"):
1653
1512
  http_res_text = await utils.stream_to_text_async(http_res)
1654
- raise errors.APIError(
1655
- "API error occurred", http_res.status_code, http_res_text, http_res
1656
- )
1513
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1657
1514
 
1658
- content_type = http_res.headers.get("Content-Type")
1659
- http_res_text = await utils.stream_to_text_async(http_res)
1660
- raise errors.APIError(
1661
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1662
- http_res.status_code,
1663
- http_res_text,
1664
- http_res,
1665
- )
1515
+ raise errors.APIError("Unexpected response received", http_res)
1666
1516
 
1667
1517
  def liquidity_provision_mint(
1668
1518
  self,
@@ -1796,31 +1646,20 @@ class UniswapV3(BaseSDK):
1796
1646
 
1797
1647
  response_data: Any = None
1798
1648
  if utils.match_response(http_res, "200", "application/json"):
1799
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1649
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1800
1650
  if utils.match_response(http_res, "422", "application/json"):
1801
- response_data = utils.unmarshal_json(
1802
- http_res.text, errors.HTTPValidationErrorData
1651
+ response_data = utils.unmarshal_json_response(
1652
+ errors.HTTPValidationErrorData, http_res
1803
1653
  )
1804
- raise errors.HTTPValidationError(data=response_data)
1654
+ raise errors.HTTPValidationError(response_data, http_res)
1805
1655
  if utils.match_response(http_res, "4XX", "*"):
1806
1656
  http_res_text = utils.stream_to_text(http_res)
1807
- raise errors.APIError(
1808
- "API error occurred", http_res.status_code, http_res_text, http_res
1809
- )
1657
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1810
1658
  if utils.match_response(http_res, "5XX", "*"):
1811
1659
  http_res_text = utils.stream_to_text(http_res)
1812
- raise errors.APIError(
1813
- "API error occurred", http_res.status_code, http_res_text, http_res
1814
- )
1660
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1815
1661
 
1816
- content_type = http_res.headers.get("Content-Type")
1817
- http_res_text = utils.stream_to_text(http_res)
1818
- raise errors.APIError(
1819
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1820
- http_res.status_code,
1821
- http_res_text,
1822
- http_res,
1823
- )
1662
+ raise errors.APIError("Unexpected response received", http_res)
1824
1663
 
1825
1664
  async def liquidity_provision_mint_async(
1826
1665
  self,
@@ -1954,31 +1793,20 @@ class UniswapV3(BaseSDK):
1954
1793
 
1955
1794
  response_data: Any = None
1956
1795
  if utils.match_response(http_res, "200", "application/json"):
1957
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1796
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
1958
1797
  if utils.match_response(http_res, "422", "application/json"):
1959
- response_data = utils.unmarshal_json(
1960
- http_res.text, errors.HTTPValidationErrorData
1798
+ response_data = utils.unmarshal_json_response(
1799
+ errors.HTTPValidationErrorData, http_res
1961
1800
  )
1962
- raise errors.HTTPValidationError(data=response_data)
1801
+ raise errors.HTTPValidationError(response_data, http_res)
1963
1802
  if utils.match_response(http_res, "4XX", "*"):
1964
1803
  http_res_text = await utils.stream_to_text_async(http_res)
1965
- raise errors.APIError(
1966
- "API error occurred", http_res.status_code, http_res_text, http_res
1967
- )
1804
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1968
1805
  if utils.match_response(http_res, "5XX", "*"):
1969
1806
  http_res_text = await utils.stream_to_text_async(http_res)
1970
- raise errors.APIError(
1971
- "API error occurred", http_res.status_code, http_res_text, http_res
1972
- )
1807
+ raise errors.APIError("API error occurred", http_res, http_res_text)
1973
1808
 
1974
- content_type = http_res.headers.get("Content-Type")
1975
- http_res_text = await utils.stream_to_text_async(http_res)
1976
- raise errors.APIError(
1977
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
1978
- http_res.status_code,
1979
- http_res_text,
1980
- http_res,
1981
- )
1809
+ raise errors.APIError("Unexpected response received", http_res)
1982
1810
 
1983
1811
  def liquidity_provision_increase(
1984
1812
  self,
@@ -2097,31 +1925,20 @@ class UniswapV3(BaseSDK):
2097
1925
 
2098
1926
  response_data: Any = None
2099
1927
  if utils.match_response(http_res, "200", "application/json"):
2100
- return utils.unmarshal_json(http_res.text, models.TxResponse)
1928
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2101
1929
  if utils.match_response(http_res, "422", "application/json"):
2102
- response_data = utils.unmarshal_json(
2103
- http_res.text, errors.HTTPValidationErrorData
1930
+ response_data = utils.unmarshal_json_response(
1931
+ errors.HTTPValidationErrorData, http_res
2104
1932
  )
2105
- raise errors.HTTPValidationError(data=response_data)
1933
+ raise errors.HTTPValidationError(response_data, http_res)
2106
1934
  if utils.match_response(http_res, "4XX", "*"):
2107
1935
  http_res_text = utils.stream_to_text(http_res)
2108
- raise errors.APIError(
2109
- "API error occurred", http_res.status_code, http_res_text, http_res
2110
- )
1936
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2111
1937
  if utils.match_response(http_res, "5XX", "*"):
2112
1938
  http_res_text = utils.stream_to_text(http_res)
2113
- raise errors.APIError(
2114
- "API error occurred", http_res.status_code, http_res_text, http_res
2115
- )
1939
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2116
1940
 
2117
- content_type = http_res.headers.get("Content-Type")
2118
- http_res_text = utils.stream_to_text(http_res)
2119
- raise errors.APIError(
2120
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2121
- http_res.status_code,
2122
- http_res_text,
2123
- http_res,
2124
- )
1941
+ raise errors.APIError("Unexpected response received", http_res)
2125
1942
 
2126
1943
  async def liquidity_provision_increase_async(
2127
1944
  self,
@@ -2240,31 +2057,20 @@ class UniswapV3(BaseSDK):
2240
2057
 
2241
2058
  response_data: Any = None
2242
2059
  if utils.match_response(http_res, "200", "application/json"):
2243
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2060
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2244
2061
  if utils.match_response(http_res, "422", "application/json"):
2245
- response_data = utils.unmarshal_json(
2246
- http_res.text, errors.HTTPValidationErrorData
2062
+ response_data = utils.unmarshal_json_response(
2063
+ errors.HTTPValidationErrorData, http_res
2247
2064
  )
2248
- raise errors.HTTPValidationError(data=response_data)
2065
+ raise errors.HTTPValidationError(response_data, http_res)
2249
2066
  if utils.match_response(http_res, "4XX", "*"):
2250
2067
  http_res_text = await utils.stream_to_text_async(http_res)
2251
- raise errors.APIError(
2252
- "API error occurred", http_res.status_code, http_res_text, http_res
2253
- )
2068
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2254
2069
  if utils.match_response(http_res, "5XX", "*"):
2255
2070
  http_res_text = await utils.stream_to_text_async(http_res)
2256
- raise errors.APIError(
2257
- "API error occurred", http_res.status_code, http_res_text, http_res
2258
- )
2071
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2259
2072
 
2260
- content_type = http_res.headers.get("Content-Type")
2261
- http_res_text = await utils.stream_to_text_async(http_res)
2262
- raise errors.APIError(
2263
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2264
- http_res.status_code,
2265
- http_res_text,
2266
- http_res,
2267
- )
2073
+ raise errors.APIError("Unexpected response received", http_res)
2268
2074
 
2269
2075
  def liquidity_provision_withdraw(
2270
2076
  self,
@@ -2366,31 +2172,20 @@ class UniswapV3(BaseSDK):
2366
2172
 
2367
2173
  response_data: Any = None
2368
2174
  if utils.match_response(http_res, "200", "application/json"):
2369
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2175
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2370
2176
  if utils.match_response(http_res, "422", "application/json"):
2371
- response_data = utils.unmarshal_json(
2372
- http_res.text, errors.HTTPValidationErrorData
2177
+ response_data = utils.unmarshal_json_response(
2178
+ errors.HTTPValidationErrorData, http_res
2373
2179
  )
2374
- raise errors.HTTPValidationError(data=response_data)
2180
+ raise errors.HTTPValidationError(response_data, http_res)
2375
2181
  if utils.match_response(http_res, "4XX", "*"):
2376
2182
  http_res_text = utils.stream_to_text(http_res)
2377
- raise errors.APIError(
2378
- "API error occurred", http_res.status_code, http_res_text, http_res
2379
- )
2183
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2380
2184
  if utils.match_response(http_res, "5XX", "*"):
2381
2185
  http_res_text = utils.stream_to_text(http_res)
2382
- raise errors.APIError(
2383
- "API error occurred", http_res.status_code, http_res_text, http_res
2384
- )
2186
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2385
2187
 
2386
- content_type = http_res.headers.get("Content-Type")
2387
- http_res_text = utils.stream_to_text(http_res)
2388
- raise errors.APIError(
2389
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2390
- http_res.status_code,
2391
- http_res_text,
2392
- http_res,
2393
- )
2188
+ raise errors.APIError("Unexpected response received", http_res)
2394
2189
 
2395
2190
  async def liquidity_provision_withdraw_async(
2396
2191
  self,
@@ -2492,28 +2287,17 @@ class UniswapV3(BaseSDK):
2492
2287
 
2493
2288
  response_data: Any = None
2494
2289
  if utils.match_response(http_res, "200", "application/json"):
2495
- return utils.unmarshal_json(http_res.text, models.TxResponse)
2290
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
2496
2291
  if utils.match_response(http_res, "422", "application/json"):
2497
- response_data = utils.unmarshal_json(
2498
- http_res.text, errors.HTTPValidationErrorData
2292
+ response_data = utils.unmarshal_json_response(
2293
+ errors.HTTPValidationErrorData, http_res
2499
2294
  )
2500
- raise errors.HTTPValidationError(data=response_data)
2295
+ raise errors.HTTPValidationError(response_data, http_res)
2501
2296
  if utils.match_response(http_res, "4XX", "*"):
2502
2297
  http_res_text = await utils.stream_to_text_async(http_res)
2503
- raise errors.APIError(
2504
- "API error occurred", http_res.status_code, http_res_text, http_res
2505
- )
2298
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2506
2299
  if utils.match_response(http_res, "5XX", "*"):
2507
2300
  http_res_text = await utils.stream_to_text_async(http_res)
2508
- raise errors.APIError(
2509
- "API error occurred", http_res.status_code, http_res_text, http_res
2510
- )
2301
+ raise errors.APIError("API error occurred", http_res, http_res_text)
2511
2302
 
2512
- content_type = http_res.headers.get("Content-Type")
2513
- http_res_text = await utils.stream_to_text_async(http_res)
2514
- raise errors.APIError(
2515
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
2516
- http_res.status_code,
2517
- http_res_text,
2518
- http_res,
2519
- )
2303
+ raise errors.APIError("Unexpected response received", http_res)