def big_map_query(self, path): """ Construct a query for big_map_get request :param path: BigMap key, string, int, or hex-string (since Babylon you can have more than one BigMap at arbitrary position) :param storage: :return: dict """ key = basename(path) big_map_path = dirname(path) big_map_id = self.big_map_id(join('/', big_map_path)) if big_map_path else None key_prim, _, _ = self._locate_big_map(big_map_id) encoded_key = encode_literal(key, key_prim) if big_map_id: query = dict( big_map_id=big_map_id, script_expr=base58_encode(blake2b_32(encoded_key.encode()), b'expr') ) else: query = dict( key=encoded_key, type={'prim': key_prim} ) return query
def make_item(x): key = encode_literal(x[0], key_prim, binary=True) if x[1] is not None: value = encode_micheline(x[1], self.schema, root=value_root, binary=True) else: value = None return {"key": key, "value": value}
def big_map_query(self, key, big_map_path=None): """ Construct a query for big_map_get request :param key: BigMap key, string, int, or hex-string :param big_map_path: Json path to BigMap, leave None to use default (since Babylon you can have more than one BigMap at arbitrary position) :return: dict """ # TODO: convert to big_map id (integer) key_prim, _ = self._locate_big_map(big_map_path) return dict(key=encode_literal(key, key_prim), type={'prim': key_prim})