diff --git a/examples/create_api_key.py b/examples/create_api_key.py index 677c700..ed27a13 100644 --- a/examples/create_api_key.py +++ b/examples/create_api_key.py @@ -1,9 +1,15 @@ +from dotenv import load_dotenv +import os + from py_clob_client.client import ClobClient +load_dotenv() + def main(): host = "http://localhost:8080" - key = "0x" - client = ClobClient(host, key=key, chain_id=42) + key = os.getenv("PK") + chain_id = 80001 + client = ClobClient(host, key=key, chain_id=chain_id) print(client.create_api_key()) diff --git a/py_clob_client/signing/eip712.py b/py_clob_client/signing/eip712.py index be0e10f..86ea6dd 100644 --- a/py_clob_client/signing/eip712.py +++ b/py_clob_client/signing/eip712.py @@ -7,12 +7,13 @@ CLOB_VERSION = "1" MSG_TO_SIGN = "This message attests that I control the given wallet" -def get_clob_auth_domain(): - return make_domain(name=CLOB_DOMAIN_NAME, version=CLOB_VERSION, chainId=1) +def get_clob_auth_domain(chain_id:int): + return make_domain(name=CLOB_DOMAIN_NAME, version=CLOB_VERSION, chainId=chain_id) def sign_clob_auth_message(signer: Signer, timestamp: int)-> str: clob_auth_msg = ClobAuth(address=signer.address, timestamp=str(timestamp), message=MSG_TO_SIGN) - auth_struct_hash = Web3.keccak(clob_auth_msg.signable_bytes(get_clob_auth_domain())) + chain_id = signer.get_chain_id() + auth_struct_hash = Web3.keccak(clob_auth_msg.signable_bytes(get_clob_auth_domain(chain_id))) return signer.sign(auth_struct_hash) diff --git a/setup.py b/setup.py index 569f4b4..9256c67 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="py_clob_client", - version="0.0.5", + version="0.0.6", author="Jonathan Amenechi", author_email="jonathanamenechi@gmail.com", description="Python client for the Polymarket CLOB",