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

Unable to create a user #209

Open
0x-General opened this issue Nov 15, 2022 · 2 comments
Open

Unable to create a user #209

0x-General opened this issue Nov 15, 2022 · 2 comments

Comments

@0x-General
Copy link

Hello, I am trying to create a new user with the following code but I'm getting a 400 error.

const keyPairWithYCoordinate = await client.onboarding.deriveStarkKey(address);

const onboardingInformation = await client.onboarding.createUser({
    starkKey: keyPairWithYCoordinate.publicKey,
    starkKeyYCoordinate: keyPairWithYCoordinate.publicKeyYCoordinate,
  }, address);

and I'm getting the following error message:

        [Symbol(kNeedDrain)]: false,
        [Symbol(corked)]: 0,
        [Symbol(kOutHeaders)]: [Object: null prototype] {
          accept: [ 'Accept', 'application/json, text/plain, */*' ],
          'content-type': [ 'Content-Type', 'application/json' ],
          'dydx-signature': [
            'DYDX-SIGNATURE',
            '0xf79cb7a5becb075cd59306f81d8507ec32e94c32fe265e697e8c07abc997bfb1482d5b893bdc8373dcf75abad9d3962585c2605b7f6736cf5b2fda54a9882d8a1c00'
          ],
          'dydx-ethereum-address': [
            'DYDX-ETHEREUM-ADDRESS',
            '0xB517c9f7a1489dF7895BdF6DC4D0F8d84B3B5CC7'
          ],
          'user-agent': [ 'User-Agent', 'axios/0.21.4' ],
          'content-length': [ 'Content-Length', 168 ],
          host: [ 'Host', 'api.stage.dydx.exchange' ]
        },
        [Symbol(kUniqueHeaders)]: null
      },
      data: {
        errors: [ { msg: 'Invalid signature for onboarding request' } ]
      }
    },
    isAxiosError: true,
    toJSON: [Function: toJSON]
  },
  status: 400,
  statusText: 'Bad Request',
  data: { errors: [ { msg: 'Invalid signature for onboarding request' } ] }
}

Any ideas?

@shah-smit
Copy link

I was able to create

client.onboarding.createUser(
                                {
                                    starkKey: starKey.publicKey,
                                    starkKeyYCoordinate: starKey.publicKeyYCoordinate,
                                    country: 'SG'
                                },
                                address,
                                null,
                                SigningMethod.MetaMask
                            ).then((responseFromNewUser) => {
                                return new Promise((resolve, reject) => resolve(responseFromNewUser.apiKey))
                            })

@sniper365
Copy link

Then create a new order?

I also showed me up the 400 bad request error

I think it's same issue 'invalid signature' when creating a new user or a new order

Any thoughts?

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

3 participants