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

API key not found #129

Open
ianhomew opened this issue Oct 5, 2021 · 6 comments
Open

API key not found #129

ianhomew opened this issue Oct 5, 2021 · 6 comments

Comments

@ianhomew
Copy link

ianhomew commented Oct 5, 2021

const main = async () => {

    let client = new DydxClient(HTTP_HOST, {
        web3: web3,
        apiTimeout: 3000,
        networkId: 1,
    })

    client.starkPrivateKey = await client.onboarding.deriveStarkKey(address)
    client.apiKeyCredentials = await client.onboarding.recoverDefaultApiCredentials(address)

    const keys = await client.private.getApiKeys();
    console.log(keys);return; //   "msg": "API key not found"
}

This is full code and I always get "API key not found". I do not have any idea to solve this problem...
For solving this problem, I try to login in with my METAMASK on the website.
After I do the recovery step by step, it always showed "API key not found" like the code above.

@ianhomew
Copy link
Author

ianhomew commented Oct 5, 2021

I face this problem for a long time, please anyone help me...

@ianhomew
Copy link
Author

ianhomew commented Nov 4, 2021

no one can answer me the question...????????

let api_key_response = await client.ethPrivate.createApiKey(
        address
    )
    let api_keys = await client.private.getApiKeys()

NOT WORKING..............................................for a VERY LONG TIME....

"msg": "API key not found"

@ianhomew
Copy link
Author

ianhomew commented Nov 4, 2021

    let user = await client.private.getUser()
    console.log(user)

"msg": "API key not found"

@ianhomew
Copy link
Author

ianhomew commented Nov 4, 2021

await client.private.getAccount(address)

"msg": "API key not found"

@ianhomew
Copy link
Author

ianhomew commented Nov 4, 2021

I WANT MY MONEY BACK

@captainbuckkets
Copy link

captainbuckkets commented Nov 5, 2021

I was able to perform successful onboarding with this code

client = new DydxClient(HTTP_HOST, {
        web3,
        apiTimeout: 3000,
        networkId: 3
    })

    const userExists = await client.public.doesUserExistWithAddress(
        address,
    );
    console.log(userExists)

    if (!userExists.exists) {

        const keyPairWithYCoordinate = await client.onboarding.deriveStarkKey(
            address,
        );
        client.starkKey = keyPairWithYCoordinate.publicKey
        client.starkKeyYCoordinate = keyPairWithYCoordinate.publicKeyYCoordinate

        console.log("Creating user...")
        const newUser = await client.onboarding.createUser(
            address
        )

        console.log(newUser)
    }

    const apiCreds = await client.onboarding.recoverDefaultApiCredentials(address)
    client.apiKeyCredentials = apiCreds
    console.log(client.apiKeyCredentials)

    const timestamp = new Date().toISOString()
    const signature = client.private.sign({
        requestPath: '/ws/accounts',
        method: 'GET',
        isoTimestamp: timestamp,
    })
    const msg = {
        type: 'subscribe',
        channel: 'v3_accounts',
        accountNumber: '0',
        apiKey: apiCreds.key,
        signature,
        timestamp,
        passphrase: apiCreds.passphrase
    }

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

2 participants