Hyperliquid_Copy_Trader icon indicating copy to clipboard operation
Hyperliquid_Copy_Trader copied to clipboard

'LocalAccount' object has no attribute 'sign_typed_data'

Open JPLemelin opened this issue 6 months ago • 2 comments

Hi I got this error

| ERROR    | copy_engine.executor:_update_leverage - Error updating leverage: 'LocalAccount' object has no attribute 'sign_typed_data'
| ERROR    | copy_engine.executor:_update_leverage - Failed to update leverage for SOL to 2x

StackTrace:

Traceback (most recent call last):
  File "./src/copy_engine/executor.py", line 150, in _update_leverage
    signed_action = self._sign_action(action)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "./src/copy_engine/executor.py", line 104, in _sign_action
    signed_message = self.account.sign_typed_data(
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'LocalAccount' object has no attribute 'sign_typed_data'

From the requirements.txt

eth-account==0.11.0

According to the changelog of eth-account the sign_typed_data method on a LocalAccount was add in the version 0.13.5

Ref: https://eth-account.readthedocs.io/en/latest/release_notes.html#eth-account-v0-13-5-2025-02-04

JPLemelin avatar May 19 '26 03:05 JPLemelin

Follow-up:

I Updated the eth-account to 0.13.5 and now i was able to signed data.

Now on the first action, who update the leverage I got response error from hyperliquid

copy_engine.executor:_update_leverage - Signed action: '{"action": {"type": "updateLeverage", "asset": "SOL", "isCross": true, "leverage": 2}, "nonce": 1779160661196, "signature": {[...]}, "vaultAddress": null}'
ERROR    | copy_engine.executor:_update_leverage - ❌ Failed to update leverage => 422: Failed to deserialize the JSON body into the target type

The erro come from the body resquest, the asset should by a number not a string, ie index of coin, in this case SOL is "5".

Ref: https://hyperliquid.gitbook.io/hyperliquid-docs/for-developers/api/exchange-endpoint#update-leverage

Did you why a facing those issues ? I'm using the latest version of this repo https://github.com/MaxIsOntoSomething/Hyperliquid_Copy_Trader/commit/225e946e03f67ee621d765a9712a2706dcb1c0cb

JPLemelin avatar May 19 '26 03:05 JPLemelin

Should be fixed now!

MaxIsOntoSomething avatar Jun 03 '26 13:06 MaxIsOntoSomething