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

@@ -83,31 +83,20 @@ class TokenSDK(BaseSDK):
83
83
 
84
84
  response_data: Any = None
85
85
  if utils.match_response(http_res, "200", "application/json"):
86
- return utils.unmarshal_json(http_res.text, models.TokenAddressResponse)
86
+ return utils.unmarshal_json_response(models.TokenAddressResponse, http_res)
87
87
  if utils.match_response(http_res, "422", "application/json"):
88
- response_data = utils.unmarshal_json(
89
- http_res.text, errors.HTTPValidationErrorData
88
+ response_data = utils.unmarshal_json_response(
89
+ errors.HTTPValidationErrorData, http_res
90
90
  )
91
- raise errors.HTTPValidationError(data=response_data)
91
+ raise errors.HTTPValidationError(response_data, http_res)
92
92
  if utils.match_response(http_res, "4XX", "*"):
93
93
  http_res_text = utils.stream_to_text(http_res)
94
- raise errors.APIError(
95
- "API error occurred", http_res.status_code, http_res_text, http_res
96
- )
94
+ raise errors.APIError("API error occurred", http_res, http_res_text)
97
95
  if utils.match_response(http_res, "5XX", "*"):
98
96
  http_res_text = utils.stream_to_text(http_res)
99
- raise errors.APIError(
100
- "API error occurred", http_res.status_code, http_res_text, http_res
101
- )
97
+ raise errors.APIError("API error occurred", http_res, http_res_text)
102
98
 
103
- content_type = http_res.headers.get("Content-Type")
104
- http_res_text = utils.stream_to_text(http_res)
105
- raise errors.APIError(
106
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
107
- http_res.status_code,
108
- http_res_text,
109
- http_res,
110
- )
99
+ raise errors.APIError("Unexpected response received", http_res)
111
100
 
112
101
  async def address_async(
113
102
  self,
@@ -184,31 +173,20 @@ class TokenSDK(BaseSDK):
184
173
 
185
174
  response_data: Any = None
186
175
  if utils.match_response(http_res, "200", "application/json"):
187
- return utils.unmarshal_json(http_res.text, models.TokenAddressResponse)
176
+ return utils.unmarshal_json_response(models.TokenAddressResponse, http_res)
188
177
  if utils.match_response(http_res, "422", "application/json"):
189
- response_data = utils.unmarshal_json(
190
- http_res.text, errors.HTTPValidationErrorData
178
+ response_data = utils.unmarshal_json_response(
179
+ errors.HTTPValidationErrorData, http_res
191
180
  )
192
- raise errors.HTTPValidationError(data=response_data)
181
+ raise errors.HTTPValidationError(response_data, http_res)
193
182
  if utils.match_response(http_res, "4XX", "*"):
194
183
  http_res_text = await utils.stream_to_text_async(http_res)
195
- raise errors.APIError(
196
- "API error occurred", http_res.status_code, http_res_text, http_res
197
- )
184
+ raise errors.APIError("API error occurred", http_res, http_res_text)
198
185
  if utils.match_response(http_res, "5XX", "*"):
199
186
  http_res_text = await utils.stream_to_text_async(http_res)
200
- raise errors.APIError(
201
- "API error occurred", http_res.status_code, http_res_text, http_res
202
- )
187
+ raise errors.APIError("API error occurred", http_res, http_res_text)
203
188
 
204
- content_type = http_res.headers.get("Content-Type")
205
- http_res_text = await utils.stream_to_text_async(http_res)
206
- raise errors.APIError(
207
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
208
- http_res.status_code,
209
- http_res_text,
210
- http_res,
211
- )
189
+ raise errors.APIError("Unexpected response received", http_res)
212
190
 
213
191
  def price(
214
192
  self,
@@ -289,31 +267,20 @@ class TokenSDK(BaseSDK):
289
267
 
290
268
  response_data: Any = None
291
269
  if utils.match_response(http_res, "200", "application/json"):
292
- return utils.unmarshal_json(http_res.text, models.TokenPriceResponse)
270
+ return utils.unmarshal_json_response(models.TokenPriceResponse, http_res)
293
271
  if utils.match_response(http_res, "422", "application/json"):
294
- response_data = utils.unmarshal_json(
295
- http_res.text, errors.HTTPValidationErrorData
272
+ response_data = utils.unmarshal_json_response(
273
+ errors.HTTPValidationErrorData, http_res
296
274
  )
297
- raise errors.HTTPValidationError(data=response_data)
275
+ raise errors.HTTPValidationError(response_data, http_res)
298
276
  if utils.match_response(http_res, "4XX", "*"):
299
277
  http_res_text = utils.stream_to_text(http_res)
300
- raise errors.APIError(
301
- "API error occurred", http_res.status_code, http_res_text, http_res
302
- )
278
+ raise errors.APIError("API error occurred", http_res, http_res_text)
303
279
  if utils.match_response(http_res, "5XX", "*"):
304
280
  http_res_text = utils.stream_to_text(http_res)
305
- raise errors.APIError(
306
- "API error occurred", http_res.status_code, http_res_text, http_res
307
- )
281
+ raise errors.APIError("API error occurred", http_res, http_res_text)
308
282
 
309
- content_type = http_res.headers.get("Content-Type")
310
- http_res_text = utils.stream_to_text(http_res)
311
- raise errors.APIError(
312
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
313
- http_res.status_code,
314
- http_res_text,
315
- http_res,
316
- )
283
+ raise errors.APIError("Unexpected response received", http_res)
317
284
 
318
285
  async def price_async(
319
286
  self,
@@ -394,31 +361,20 @@ class TokenSDK(BaseSDK):
394
361
 
395
362
  response_data: Any = None
396
363
  if utils.match_response(http_res, "200", "application/json"):
397
- return utils.unmarshal_json(http_res.text, models.TokenPriceResponse)
364
+ return utils.unmarshal_json_response(models.TokenPriceResponse, http_res)
398
365
  if utils.match_response(http_res, "422", "application/json"):
399
- response_data = utils.unmarshal_json(
400
- http_res.text, errors.HTTPValidationErrorData
366
+ response_data = utils.unmarshal_json_response(
367
+ errors.HTTPValidationErrorData, http_res
401
368
  )
402
- raise errors.HTTPValidationError(data=response_data)
369
+ raise errors.HTTPValidationError(response_data, http_res)
403
370
  if utils.match_response(http_res, "4XX", "*"):
404
371
  http_res_text = await utils.stream_to_text_async(http_res)
405
- raise errors.APIError(
406
- "API error occurred", http_res.status_code, http_res_text, http_res
407
- )
372
+ raise errors.APIError("API error occurred", http_res, http_res_text)
408
373
  if utils.match_response(http_res, "5XX", "*"):
409
374
  http_res_text = await utils.stream_to_text_async(http_res)
410
- raise errors.APIError(
411
- "API error occurred", http_res.status_code, http_res_text, http_res
412
- )
375
+ raise errors.APIError("API error occurred", http_res, http_res_text)
413
376
 
414
- content_type = http_res.headers.get("Content-Type")
415
- http_res_text = await utils.stream_to_text_async(http_res)
416
- raise errors.APIError(
417
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
418
- http_res.status_code,
419
- http_res_text,
420
- http_res,
421
- )
377
+ raise errors.APIError("Unexpected response received", http_res)
422
378
 
423
379
  def balance(
424
380
  self,
@@ -498,31 +454,20 @@ class TokenSDK(BaseSDK):
498
454
 
499
455
  response_data: Any = None
500
456
  if utils.match_response(http_res, "200", "application/json"):
501
- return utils.unmarshal_json(http_res.text, models.TokenBalanceResponse)
457
+ return utils.unmarshal_json_response(models.TokenBalanceResponse, http_res)
502
458
  if utils.match_response(http_res, "422", "application/json"):
503
- response_data = utils.unmarshal_json(
504
- http_res.text, errors.HTTPValidationErrorData
459
+ response_data = utils.unmarshal_json_response(
460
+ errors.HTTPValidationErrorData, http_res
505
461
  )
506
- raise errors.HTTPValidationError(data=response_data)
462
+ raise errors.HTTPValidationError(response_data, http_res)
507
463
  if utils.match_response(http_res, "4XX", "*"):
508
464
  http_res_text = utils.stream_to_text(http_res)
509
- raise errors.APIError(
510
- "API error occurred", http_res.status_code, http_res_text, http_res
511
- )
465
+ raise errors.APIError("API error occurred", http_res, http_res_text)
512
466
  if utils.match_response(http_res, "5XX", "*"):
513
467
  http_res_text = utils.stream_to_text(http_res)
514
- raise errors.APIError(
515
- "API error occurred", http_res.status_code, http_res_text, http_res
516
- )
468
+ raise errors.APIError("API error occurred", http_res, http_res_text)
517
469
 
518
- content_type = http_res.headers.get("Content-Type")
519
- http_res_text = utils.stream_to_text(http_res)
520
- raise errors.APIError(
521
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
522
- http_res.status_code,
523
- http_res_text,
524
- http_res,
525
- )
470
+ raise errors.APIError("Unexpected response received", http_res)
526
471
 
527
472
  async def balance_async(
528
473
  self,
@@ -602,31 +547,20 @@ class TokenSDK(BaseSDK):
602
547
 
603
548
  response_data: Any = None
604
549
  if utils.match_response(http_res, "200", "application/json"):
605
- return utils.unmarshal_json(http_res.text, models.TokenBalanceResponse)
550
+ return utils.unmarshal_json_response(models.TokenBalanceResponse, http_res)
606
551
  if utils.match_response(http_res, "422", "application/json"):
607
- response_data = utils.unmarshal_json(
608
- http_res.text, errors.HTTPValidationErrorData
552
+ response_data = utils.unmarshal_json_response(
553
+ errors.HTTPValidationErrorData, http_res
609
554
  )
610
- raise errors.HTTPValidationError(data=response_data)
555
+ raise errors.HTTPValidationError(response_data, http_res)
611
556
  if utils.match_response(http_res, "4XX", "*"):
612
557
  http_res_text = await utils.stream_to_text_async(http_res)
613
- raise errors.APIError(
614
- "API error occurred", http_res.status_code, http_res_text, http_res
615
- )
558
+ raise errors.APIError("API error occurred", http_res, http_res_text)
616
559
  if utils.match_response(http_res, "5XX", "*"):
617
560
  http_res_text = await utils.stream_to_text_async(http_res)
618
- raise errors.APIError(
619
- "API error occurred", http_res.status_code, http_res_text, http_res
620
- )
561
+ raise errors.APIError("API error occurred", http_res, http_res_text)
621
562
 
622
- content_type = http_res.headers.get("Content-Type")
623
- http_res_text = await utils.stream_to_text_async(http_res)
624
- raise errors.APIError(
625
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
626
- http_res.status_code,
627
- http_res_text,
628
- http_res,
629
- )
563
+ raise errors.APIError("Unexpected response received", http_res)
630
564
 
631
565
  def transfer(
632
566
  self,
@@ -720,31 +654,20 @@ class TokenSDK(BaseSDK):
720
654
 
721
655
  response_data: Any = None
722
656
  if utils.match_response(http_res, "200", "application/json"):
723
- return utils.unmarshal_json(http_res.text, models.TxResponse)
657
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
724
658
  if utils.match_response(http_res, "422", "application/json"):
725
- response_data = utils.unmarshal_json(
726
- http_res.text, errors.HTTPValidationErrorData
659
+ response_data = utils.unmarshal_json_response(
660
+ errors.HTTPValidationErrorData, http_res
727
661
  )
728
- raise errors.HTTPValidationError(data=response_data)
662
+ raise errors.HTTPValidationError(response_data, http_res)
729
663
  if utils.match_response(http_res, "4XX", "*"):
730
664
  http_res_text = utils.stream_to_text(http_res)
731
- raise errors.APIError(
732
- "API error occurred", http_res.status_code, http_res_text, http_res
733
- )
665
+ raise errors.APIError("API error occurred", http_res, http_res_text)
734
666
  if utils.match_response(http_res, "5XX", "*"):
735
667
  http_res_text = utils.stream_to_text(http_res)
736
- raise errors.APIError(
737
- "API error occurred", http_res.status_code, http_res_text, http_res
738
- )
668
+ raise errors.APIError("API error occurred", http_res, http_res_text)
739
669
 
740
- content_type = http_res.headers.get("Content-Type")
741
- http_res_text = utils.stream_to_text(http_res)
742
- raise errors.APIError(
743
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
744
- http_res.status_code,
745
- http_res_text,
746
- http_res,
747
- )
670
+ raise errors.APIError("Unexpected response received", http_res)
748
671
 
749
672
  async def transfer_async(
750
673
  self,
@@ -838,28 +761,17 @@ class TokenSDK(BaseSDK):
838
761
 
839
762
  response_data: Any = None
840
763
  if utils.match_response(http_res, "200", "application/json"):
841
- return utils.unmarshal_json(http_res.text, models.TxResponse)
764
+ return utils.unmarshal_json_response(models.TxResponse, http_res)
842
765
  if utils.match_response(http_res, "422", "application/json"):
843
- response_data = utils.unmarshal_json(
844
- http_res.text, errors.HTTPValidationErrorData
766
+ response_data = utils.unmarshal_json_response(
767
+ errors.HTTPValidationErrorData, http_res
845
768
  )
846
- raise errors.HTTPValidationError(data=response_data)
769
+ raise errors.HTTPValidationError(response_data, http_res)
847
770
  if utils.match_response(http_res, "4XX", "*"):
848
771
  http_res_text = await utils.stream_to_text_async(http_res)
849
- raise errors.APIError(
850
- "API error occurred", http_res.status_code, http_res_text, http_res
851
- )
772
+ raise errors.APIError("API error occurred", http_res, http_res_text)
852
773
  if utils.match_response(http_res, "5XX", "*"):
853
774
  http_res_text = await utils.stream_to_text_async(http_res)
854
- raise errors.APIError(
855
- "API error occurred", http_res.status_code, http_res_text, http_res
856
- )
775
+ raise errors.APIError("API error occurred", http_res, http_res_text)
857
776
 
858
- content_type = http_res.headers.get("Content-Type")
859
- http_res_text = await utils.stream_to_text_async(http_res)
860
- raise errors.APIError(
861
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
862
- http_res.status_code,
863
- http_res_text,
864
- http_res,
865
- )
777
+ raise errors.APIError("Unexpected response received", http_res)
@@ -91,33 +91,22 @@ class TransactionBundler(BaseSDK):
91
91
 
92
92
  response_data: Any = None
93
93
  if utils.match_response(http_res, "200", "application/json"):
94
- return utils.unmarshal_json(
95
- http_res.text, models.MulticallAuthorizationResponse
94
+ return utils.unmarshal_json_response(
95
+ models.MulticallAuthorizationResponse, http_res
96
96
  )
97
97
  if utils.match_response(http_res, "422", "application/json"):
98
- response_data = utils.unmarshal_json(
99
- http_res.text, errors.HTTPValidationErrorData
98
+ response_data = utils.unmarshal_json_response(
99
+ errors.HTTPValidationErrorData, http_res
100
100
  )
101
- raise errors.HTTPValidationError(data=response_data)
101
+ raise errors.HTTPValidationError(response_data, http_res)
102
102
  if utils.match_response(http_res, "4XX", "*"):
103
103
  http_res_text = utils.stream_to_text(http_res)
104
- raise errors.APIError(
105
- "API error occurred", http_res.status_code, http_res_text, http_res
106
- )
104
+ raise errors.APIError("API error occurred", http_res, http_res_text)
107
105
  if utils.match_response(http_res, "5XX", "*"):
108
106
  http_res_text = utils.stream_to_text(http_res)
109
- raise errors.APIError(
110
- "API error occurred", http_res.status_code, http_res_text, http_res
111
- )
107
+ raise errors.APIError("API error occurred", http_res, http_res_text)
112
108
 
113
- content_type = http_res.headers.get("Content-Type")
114
- http_res_text = utils.stream_to_text(http_res)
115
- raise errors.APIError(
116
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
117
- http_res.status_code,
118
- http_res_text,
119
- http_res,
120
- )
109
+ raise errors.APIError("Unexpected response received", http_res)
121
110
 
122
111
  async def bundler_authorization_async(
123
112
  self,
@@ -202,33 +191,22 @@ class TransactionBundler(BaseSDK):
202
191
 
203
192
  response_data: Any = None
204
193
  if utils.match_response(http_res, "200", "application/json"):
205
- return utils.unmarshal_json(
206
- http_res.text, models.MulticallAuthorizationResponse
194
+ return utils.unmarshal_json_response(
195
+ models.MulticallAuthorizationResponse, http_res
207
196
  )
208
197
  if utils.match_response(http_res, "422", "application/json"):
209
- response_data = utils.unmarshal_json(
210
- http_res.text, errors.HTTPValidationErrorData
198
+ response_data = utils.unmarshal_json_response(
199
+ errors.HTTPValidationErrorData, http_res
211
200
  )
212
- raise errors.HTTPValidationError(data=response_data)
201
+ raise errors.HTTPValidationError(response_data, http_res)
213
202
  if utils.match_response(http_res, "4XX", "*"):
214
203
  http_res_text = await utils.stream_to_text_async(http_res)
215
- raise errors.APIError(
216
- "API error occurred", http_res.status_code, http_res_text, http_res
217
- )
204
+ raise errors.APIError("API error occurred", http_res, http_res_text)
218
205
  if utils.match_response(http_res, "5XX", "*"):
219
206
  http_res_text = await utils.stream_to_text_async(http_res)
220
- raise errors.APIError(
221
- "API error occurred", http_res.status_code, http_res_text, http_res
222
- )
207
+ raise errors.APIError("API error occurred", http_res, http_res_text)
223
208
 
224
- content_type = http_res.headers.get("Content-Type")
225
- http_res_text = await utils.stream_to_text_async(http_res)
226
- raise errors.APIError(
227
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
228
- http_res.status_code,
229
- http_res_text,
230
- http_res,
231
- )
209
+ raise errors.APIError("Unexpected response received", http_res)
232
210
 
233
211
  def bundler_execute(
234
212
  self,
@@ -324,33 +302,22 @@ class TransactionBundler(BaseSDK):
324
302
 
325
303
  response_data: Any = None
326
304
  if utils.match_response(http_res, "200", "application/json"):
327
- return utils.unmarshal_json(
328
- http_res.text, models.UnsignedMulticallTransaction
305
+ return utils.unmarshal_json_response(
306
+ models.UnsignedMulticallTransaction, http_res
329
307
  )
330
308
  if utils.match_response(http_res, "422", "application/json"):
331
- response_data = utils.unmarshal_json(
332
- http_res.text, errors.HTTPValidationErrorData
309
+ response_data = utils.unmarshal_json_response(
310
+ errors.HTTPValidationErrorData, http_res
333
311
  )
334
- raise errors.HTTPValidationError(data=response_data)
312
+ raise errors.HTTPValidationError(response_data, http_res)
335
313
  if utils.match_response(http_res, "4XX", "*"):
336
314
  http_res_text = utils.stream_to_text(http_res)
337
- raise errors.APIError(
338
- "API error occurred", http_res.status_code, http_res_text, http_res
339
- )
315
+ raise errors.APIError("API error occurred", http_res, http_res_text)
340
316
  if utils.match_response(http_res, "5XX", "*"):
341
317
  http_res_text = utils.stream_to_text(http_res)
342
- raise errors.APIError(
343
- "API error occurred", http_res.status_code, http_res_text, http_res
344
- )
318
+ raise errors.APIError("API error occurred", http_res, http_res_text)
345
319
 
346
- content_type = http_res.headers.get("Content-Type")
347
- http_res_text = utils.stream_to_text(http_res)
348
- raise errors.APIError(
349
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
350
- http_res.status_code,
351
- http_res_text,
352
- http_res,
353
- )
320
+ raise errors.APIError("Unexpected response received", http_res)
354
321
 
355
322
  async def bundler_execute_async(
356
323
  self,
@@ -446,33 +413,22 @@ class TransactionBundler(BaseSDK):
446
413
 
447
414
  response_data: Any = None
448
415
  if utils.match_response(http_res, "200", "application/json"):
449
- return utils.unmarshal_json(
450
- http_res.text, models.UnsignedMulticallTransaction
416
+ return utils.unmarshal_json_response(
417
+ models.UnsignedMulticallTransaction, http_res
451
418
  )
452
419
  if utils.match_response(http_res, "422", "application/json"):
453
- response_data = utils.unmarshal_json(
454
- http_res.text, errors.HTTPValidationErrorData
420
+ response_data = utils.unmarshal_json_response(
421
+ errors.HTTPValidationErrorData, http_res
455
422
  )
456
- raise errors.HTTPValidationError(data=response_data)
423
+ raise errors.HTTPValidationError(response_data, http_res)
457
424
  if utils.match_response(http_res, "4XX", "*"):
458
425
  http_res_text = await utils.stream_to_text_async(http_res)
459
- raise errors.APIError(
460
- "API error occurred", http_res.status_code, http_res_text, http_res
461
- )
426
+ raise errors.APIError("API error occurred", http_res, http_res_text)
462
427
  if utils.match_response(http_res, "5XX", "*"):
463
428
  http_res_text = await utils.stream_to_text_async(http_res)
464
- raise errors.APIError(
465
- "API error occurred", http_res.status_code, http_res_text, http_res
466
- )
429
+ raise errors.APIError("API error occurred", http_res, http_res_text)
467
430
 
468
- content_type = http_res.headers.get("Content-Type")
469
- http_res_text = await utils.stream_to_text_async(http_res)
470
- raise errors.APIError(
471
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
472
- http_res.status_code,
473
- http_res_text,
474
- http_res,
475
- )
431
+ raise errors.APIError("Unexpected response received", http_res)
476
432
 
477
433
  def bundler_aave_loop(
478
434
  self,
@@ -591,33 +547,22 @@ class TransactionBundler(BaseSDK):
591
547
 
592
548
  response_data: Any = None
593
549
  if utils.match_response(http_res, "200", "application/json"):
594
- return utils.unmarshal_json(
595
- http_res.text, models.UnsignedMulticallTransaction
550
+ return utils.unmarshal_json_response(
551
+ models.UnsignedMulticallTransaction, http_res
596
552
  )
597
553
  if utils.match_response(http_res, "422", "application/json"):
598
- response_data = utils.unmarshal_json(
599
- http_res.text, errors.HTTPValidationErrorData
554
+ response_data = utils.unmarshal_json_response(
555
+ errors.HTTPValidationErrorData, http_res
600
556
  )
601
- raise errors.HTTPValidationError(data=response_data)
557
+ raise errors.HTTPValidationError(response_data, http_res)
602
558
  if utils.match_response(http_res, "4XX", "*"):
603
559
  http_res_text = utils.stream_to_text(http_res)
604
- raise errors.APIError(
605
- "API error occurred", http_res.status_code, http_res_text, http_res
606
- )
560
+ raise errors.APIError("API error occurred", http_res, http_res_text)
607
561
  if utils.match_response(http_res, "5XX", "*"):
608
562
  http_res_text = utils.stream_to_text(http_res)
609
- raise errors.APIError(
610
- "API error occurred", http_res.status_code, http_res_text, http_res
611
- )
563
+ raise errors.APIError("API error occurred", http_res, http_res_text)
612
564
 
613
- content_type = http_res.headers.get("Content-Type")
614
- http_res_text = utils.stream_to_text(http_res)
615
- raise errors.APIError(
616
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
617
- http_res.status_code,
618
- http_res_text,
619
- http_res,
620
- )
565
+ raise errors.APIError("Unexpected response received", http_res)
621
566
 
622
567
  async def bundler_aave_loop_async(
623
568
  self,
@@ -736,30 +681,19 @@ class TransactionBundler(BaseSDK):
736
681
 
737
682
  response_data: Any = None
738
683
  if utils.match_response(http_res, "200", "application/json"):
739
- return utils.unmarshal_json(
740
- http_res.text, models.UnsignedMulticallTransaction
684
+ return utils.unmarshal_json_response(
685
+ models.UnsignedMulticallTransaction, http_res
741
686
  )
742
687
  if utils.match_response(http_res, "422", "application/json"):
743
- response_data = utils.unmarshal_json(
744
- http_res.text, errors.HTTPValidationErrorData
688
+ response_data = utils.unmarshal_json_response(
689
+ errors.HTTPValidationErrorData, http_res
745
690
  )
746
- raise errors.HTTPValidationError(data=response_data)
691
+ raise errors.HTTPValidationError(response_data, http_res)
747
692
  if utils.match_response(http_res, "4XX", "*"):
748
693
  http_res_text = await utils.stream_to_text_async(http_res)
749
- raise errors.APIError(
750
- "API error occurred", http_res.status_code, http_res_text, http_res
751
- )
694
+ raise errors.APIError("API error occurred", http_res, http_res_text)
752
695
  if utils.match_response(http_res, "5XX", "*"):
753
696
  http_res_text = await utils.stream_to_text_async(http_res)
754
- raise errors.APIError(
755
- "API error occurred", http_res.status_code, http_res_text, http_res
756
- )
697
+ raise errors.APIError("API error occurred", http_res, http_res_text)
757
698
 
758
- content_type = http_res.headers.get("Content-Type")
759
- http_res_text = await utils.stream_to_text_async(http_res)
760
- raise errors.APIError(
761
- f"Unexpected response received (code: {http_res.status_code}, type: {content_type})",
762
- http_res.status_code,
763
- http_res_text,
764
- http_res,
765
- )
699
+ raise errors.APIError("Unexpected response received", http_res)