Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

eth_signTypedData not supported by Infura & AlchemyAPI #126

Open
rayeaster opened this issue Sep 28, 2021 · 8 comments
Open

eth_signTypedData not supported by Infura & AlchemyAPI #126

rayeaster opened this issue Sep 28, 2021 · 8 comments

Comments

@rayeaster
Copy link

rayeaster commented Sep 28, 2021

Any plan to provide alteranative so we could use Infura or Alchemy RPC nodes?
Thanks

(node:5748) UnhandledPromiseRejectionWarning: Error: Unsupported method [eth_signTypedData]. See available methods at https://docs.alchemy.com/alchemy/documentation/apis
at SignOnboardingAction.ethSignTypedDataInternal  (xxxxx\@dydxprotocol\v3-client\build\src\eth-signing\signer.js:68:19)

see also at https://community.infura.io/t/eth-signtypeddata-is-currently-working/2626/3

@crazyoptimist
Copy link

It works with Infura.
The problem is that you can't get stark private key from the API itself. Login to the trading dashboard, connect your wallet, and open the "Application" tab in the browser console. You will be able to get "API Key Pair" and "Stark Key Pair" from the local storage section. Use those for initializing the client object. It will work then.

@patpatwithhat
Copy link

@crazyoptimist, thanks, that worked for me!
Another way would be to use https://moralis.io/ .
Working with this node, fixed the issue above for me.

@crazyoptimist
Copy link

Glad it helped!

@svax974
Copy link

svax974 commented Nov 17, 2022

Hello,
@patpatwithhat : can you tell me how do you initialize the dYdX client with the Moralis API Key please ?
Thanks !

@patpatwithhat
Copy link

patpatwithhat commented Nov 17, 2022

Hey,
you can go for an approach like this:

        const web3 = new Web3(process.env.MORALIS)
        
        const host = networkId === 1 ? HTTP_HOST_MAINNET : HTTP_HOST_ROPSTEN
        DYDXConnector._client = new DydxClient(
            host,
            {
                apiTimeout: 3000,
                networkId: networkId,
                web3: web3,

                starkPrivateKey: keyPair,
                apiKeyCredentials: apiCreds
            }

        );

Or maybe you can have a look here in my project:
https://github.com/patpatwithhat/dydx_nodejs_connector
That's also available as an npm package.

Btw you need an moralis endpoint with an adress like this: https://asdf123.usemoralis.com:2053/server

@svax974
Copy link

svax974 commented Nov 17, 2022

@patpatwithhat indeed, this is what I miss, Moralis endpoints. It seems it is not a free service.
Thanks for your answer anyway.

@5x12
Copy link

5x12 commented Feb 7, 2023

@patpatwithhat how did you manage to get it working, if you mind me asking?

I've managed to sign, but then I am stuck with transferring it to endpoint to pass it to web3 library.

from moralis import auth

api_key = '8ExCSTkEbKH233qewaef0jtIqyNOYPTSm23qefaefxmGcT5KmFJeCVgWSDKzY'
body = {
    "domain": "defi.finance", 
    "chainId": "1", 
    "address": "0x08EAaE620392dEB7C6339651d4c36f5F7de82b23", 
    "statement": "Please confirm", 
    "uri": "https://defi.finance/", 
    "expirationTime": "2020-01-01T00:00:00.000Z", 
    "notBefore": "2020-01-01T00:00:00.000Z", 
    "resources": ['https://docs.moralis.io/'], 
    "timeout": 15, 
}

result = auth.challenge.request_challenge_evm(
    api_key=api_key,
    body=body,
)

result is returning this str:

{'id': 'k1wzcuMzHhqCmz6lq', 'message': 'defi.finance wants you to sign in with your Ethereum account:\n0x08EAaE62039bdEB7C6339671d4c36f5F7de82b27\n\nPlease confirm\n\nURI: https://defi.finance/\nVersion: 1\nChain ID: 1\nNonce: qwfOUBQ8cFJJrYmSc\nIssued At: 2023-02-07T13:45:36.152Z\nExpiration Time: 2020-01-01T00:00:00.000Z\nNot Before: 2020-01-01T00:00:00.000Z\nResources:\n- https://docs.moralis.io/', 'profileId': '0x4f9983d3c678733c09556f7469fff7051d82f7fd408dbd064a57cf76435c12f4'}

@patpatwithhat
Copy link

This looks like u are building a web request.
Didn't try it that way.
I used node.js.
Are you even trying to use DYDX?

If you read your str:
'message': 'defi.finance wants you to sign in with your Ethereum account:\n0x08EAaE62039bdEB7C6339671d4c36f5F7de82b27\n\nPlease confirm\n\nURI: https://defi.finance/\n
I would say, you have to open https://defi.finance and confirm something.
Dunno, what that page is.

Also, I wouldn't recommend you share API keys at all!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants