Skip to content

Commit

Permalink
Merge pull request #85 from Polymarket/fix/sha3-fix
Browse files Browse the repository at this point in the history
[PLAT-1055] Fix: rm sha3, switch eip712_structs lib
  • Loading branch information
JonathanAmenechi authored Jul 18, 2024
2 parents 0733d48 + f6fd16b commit 92e4445
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 58 deletions.
11 changes: 6 additions & 5 deletions py_clob_client/signing/eip712.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from eip712_structs import make_domain
from poly_eip712_structs import make_domain
from eth_utils import keccak

from .model import ClobAuth
from ..signer import Signer
from web3 import Web3

CLOB_DOMAIN_NAME = "ClobAuthDomain"
CLOB_VERSION = "1"
Expand All @@ -20,7 +21,7 @@ def sign_clob_auth_message(signer: Signer, timestamp: int, nonce: int) -> str:
message=MSG_TO_SIGN,
)
chain_id = signer.get_chain_id()
auth_struct_hash = Web3.keccak(
auth_struct_hash = "0x" + keccak(
clob_auth_msg.signable_bytes(get_clob_auth_domain(chain_id))
)
return signer.sign(auth_struct_hash)
).hex()
return "0x" + signer.sign(auth_struct_hash)
2 changes: 1 addition & 1 deletion py_clob_client/signing/model.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from eip712_structs import EIP712Struct, Address, String, Uint
from poly_eip712_structs import EIP712Struct, Address, String, Uint


class ClobAuth(EIP712Struct):
Expand Down
58 changes: 8 additions & 50 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,51 +1,9 @@
aiohttp==3.8.1
aiosignal==1.2.0
async-timeout==4.0.2
attrs==21.4.0
base58==2.1.1
bitarray==1.2.2
certifi==2021.10.8
charset-normalizer==2.0.11
cytoolz==0.11.2
eip712-structs==1.1.0
eth-abi==2.1.1
eth-account==0.5.7
eth-hash==0.3.2
eth-keyfile==0.5.1
eth-keys==0.3.4
eth-rlp==0.2.1
eth-typing==2.3.0
eth-utils==1.10.0
frozenlist==1.3.0
hexbytes==0.2.2
idna==3.3
iniconfig==1.1.1
ipfshttpclient==0.8.0a2
jsonschema==3.2.0
lru-dict==1.1.7
multiaddr==0.0.9
multidict==6.0.2
netaddr==0.8.0
packaging==21.3
parsimonious==0.8.1
pluggy==1.0.0
protobuf==3.19.4
py==1.11.0
py-order-utils>=0.3.0
pycryptodome==3.14.0
pyparsing==3.0.7
pyrsistent==0.18.1
pysha3==1.0.2
pytest==6.2.5
black==24.4.2
eth-account===0.13.0
eth-utils===4.1.1
poly_eip712_structs==0.0.1
py_order_utils==0.3.1
pytest==8.2.2
python-dotenv==0.19.2
requests==2.27.1
rlp==2.0.1
six==1.16.0
toml==0.10.2
toolz==0.11.2
urllib3==1.26.8
varint==1.0.2
web3==5.27.0
websockets==9.1
yarl==1.7.2
black==22.3.0
requests==2.32.3
websockets==12.0
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="py_clob_client",
version="0.17.1",
version="0.17.2",
author="Polymarket Engineering",
author_email="[email protected]",
maintainer="Polymarket Engineering",
Expand All @@ -14,7 +14,14 @@
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/Polymarket/py-clob-client",
install_requires=["python-dotenv", "py-order-utils>=0.1.3"],
install_requires=[
"eth-account>=0.13.0",
"eth-utils>=4.1.1",
"poly_eip712_structs>=0.0.1",
"py-order-utils>=0.3.1",
"python-dotenv",
"requests"
],
project_urls={
"Bug Tracker": "https://github.com/Polymarket/py-clob-client/issues",
},
Expand Down

0 comments on commit 92e4445

Please sign in to comment.