Skip to content

Commit

Permalink
Fixed the script returned by blockfrost
Browse files Browse the repository at this point in the history
  • Loading branch information
cffls committed Mar 30, 2023
1 parent 4049a5c commit eabd613
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 10 deletions.
9 changes: 2 additions & 7 deletions pycardano/backend/blockfrost.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import warnings
from typing import Dict, List, Optional, Union

import cbor2
from blockfrost import ApiError, ApiUrls, BlockFrostApi
from blockfrost.utils import Namespace

Expand Down Expand Up @@ -152,13 +151,9 @@ def _get_script(
) -> Union[PlutusV1Script, PlutusV2Script, NativeScript]:
script_type = self.api.script(script_hash).type
if script_type == "plutusV1":
return PlutusV1Script(
cbor2.loads(bytes.fromhex(self.api.script_cbor(script_hash).cbor))
)
return PlutusV1Script(bytes.fromhex(self.api.script_cbor(script_hash).cbor))
elif script_type == "plutusV2":
return PlutusV2Script(
cbor2.loads(bytes.fromhex(self.api.script_cbor(script_hash).cbor))
)
return PlutusV2Script(bytes.fromhex(self.api.script_cbor(script_hash).cbor))
else:
script_json: JsonDict = self.api.script_json(
script_hash, return_type="json"
Expand Down
5 changes: 2 additions & 3 deletions test/pycardano/test_plutus.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
from dataclasses import dataclass
import unittest

from dataclasses import dataclass
from test.pycardano.util import check_two_way_cbor
from typing import Union, Dict, List
from typing import Dict, List, Union

import pytest

Expand Down

0 comments on commit eabd613

Please sign in to comment.