diff --git a/pyproject.toml b/pyproject.toml index 3ce69dc..084ea13 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "sw-utils" -version = "0.3.28" +version = "0.3.29" description = "StakeWise Python utils" authors = ["StakeWise Labs "] license = "GPL-3.0-or-later" diff --git a/sw_utils/ipfs.py b/sw_utils/ipfs.py index 9625abe..0dec319 100644 --- a/sw_utils/ipfs.py +++ b/sw_utils/ipfs.py @@ -118,16 +118,7 @@ async def upload_bytes(self, data: bytes) -> str: async def upload_json(self, data: dict | list) -> str: if not data: raise ValueError('Empty data provided') - headers = self.headers.copy() - headers['Content-Type'] = 'application/json' - async with ClientSession(headers=headers) as session: - async with session.post( - url=self.json_endpoint, - data=_dump_json({'pinataOptions': {'cidVersion': 1}, 'pinataContent': data}), - ) as response: - response.raise_for_status() - ipfs_id = (await response.json())['IpfsHash'] - return _strip_ipfs_prefix(ipfs_id) + return await self.upload_bytes(Json().encode(data)) async def remove(self, ipfs_hash: str) -> None: if not ipfs_hash: