|
48 | 48 | SubstrateMixin, |
49 | 49 | Preprocessed, |
50 | 50 | ) |
51 | | -from async_substrate_interface.utils import hex_to_bytes, json, generate_unique_id |
| 51 | +from async_substrate_interface.utils import hex_to_bytes, json, get_next_id |
52 | 52 | from async_substrate_interface.utils.decoding import ( |
53 | 53 | _determine_if_old_runtime_call, |
54 | 54 | _bt_decode_to_dict_or_list, |
@@ -620,7 +620,7 @@ async def send(self, payload: dict) -> int: |
620 | 620 | id: the internal ID of the request (incremented int) |
621 | 621 | """ |
622 | 622 | # async with self._lock: |
623 | | - original_id = generate_unique_id(json.dumps(payload)) |
| 623 | + original_id = get_next_id() |
624 | 624 | # self._open_subscriptions += 1 |
625 | 625 | try: |
626 | 626 | await self.ws.send(json.dumps({**payload, **{"id": original_id}})) |
@@ -904,15 +904,14 @@ async def decode_scale( |
904 | 904 | Returns: |
905 | 905 | Decoded object |
906 | 906 | """ |
907 | | - if scale_bytes == b"\x00": |
908 | | - obj = None |
| 907 | + if scale_bytes == b"": |
| 908 | + return None |
| 909 | + if type_string == "scale_info::0": # Is an AccountId |
| 910 | + # Decode AccountId bytes to SS58 address |
| 911 | + return ss58_encode(scale_bytes, SS58_FORMAT) |
909 | 912 | else: |
910 | | - if type_string == "scale_info::0": # Is an AccountId |
911 | | - # Decode AccountId bytes to SS58 address |
912 | | - return ss58_encode(scale_bytes, SS58_FORMAT) |
913 | | - else: |
914 | | - await self._wait_for_registry(_attempt, _retries) |
915 | | - obj = decode_by_type_string(type_string, self.registry, scale_bytes) |
| 913 | + await self._wait_for_registry(_attempt, _retries) |
| 914 | + obj = decode_by_type_string(type_string, self.registry, scale_bytes) |
916 | 915 | if return_scale_obj: |
917 | 916 | return ScaleObj(obj) |
918 | 917 | else: |
@@ -2245,7 +2244,7 @@ async def query_multi( |
2245 | 2244 | # Decode result for specified storage_key |
2246 | 2245 | storage_key = storage_key_map[change_storage_key] |
2247 | 2246 | if change_data is None: |
2248 | | - change_data = b"\x00" |
| 2247 | + change_data = b"" |
2249 | 2248 | else: |
2250 | 2249 | change_data = bytes.fromhex(change_data[2:]) |
2251 | 2250 | result.append( |
|
0 commit comments