dydxprotocol / dydx-v3-python

Python client for dYdX (API v3)
Apache License 2.0
304 stars 174 forks source link

Error using the example order.py #218

Open NeoSephiroth opened 7 months ago

NeoSephiroth commented 7 months ago

Hi! I tried using both python 3.9 and 3.11 but I always get the same error:

r, s = sign(self.hash, int(private_key_hex, 16))
                           ^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: int() can't convert non-string with explicit base

the error is traced to signable.py in this function:

 def sign(self, private_key_hex):
        """Sign the hash of the object using the given private key."""
        r, s = sign(self.hash, int(private_key_hex, 16))
        return serialize_signature(r, s)

if I print the stark key I get this ( I print it just a few lines of code before the order_response = client.private.create_order(**order_params)
line of codes where the error generates

My stark key is ( I will just delete the last 15 digits of the private key, but anyway the wallet linked has just test tokens so I don't mind if you even find the private key of my eth wallet ):

{'public_key': '0x36992ce4d3eee06485afbbeedb34b82e42ed481935baebe989bfcfff3e67193', 'public_key_y_coordinate': '0x56a72417ea2c445f858c2c07841a7b643411f70528627664a622adb6ff149b1', 'private_key': '0x4499ce78a19b9dae7865dc65e425f65e6d9d8c82365c8d11XXXXXXXXXXXXXXX'}

NeoSephiroth commented 7 months ago

The order.py I'm using is this one https://github.com/dydxprotocol/dydx-v3-python/blob/master/examples/orders.py