v3-client icon indicating copy to clipboard operation
v3-client copied to clipboard

getActiveOrders

Open snowkidind opened this issue 2 years ago • 8 comments

https://github.com/dydxprotocol/v3-client/blob/16b171f49b0822b7c51d8d9290576a208893250a/src/modules/private.ts#L399

Documentation states that id should be optional and it is not here.

    async getActiveOrders(market, side, id, genericParams = {}) {
        return this._get('active-orders', {
            market,
            side,
            id, // is not optional
            ...genericParams,
        });
    }

snowkidind avatar Apr 02 '22 10:04 snowkidind

When I test v3/active-orders, return "MSG ":"Unauthorized". Why

zoo475698058 avatar Apr 25 '22 08:04 zoo475698058

You need to initialize the client.

Check out the gist I made at https://gist.github.com/snowkidind/9545ca43962dc1251a226031ea797b06


const init =  async () => {
  try {
    const apiCreds1 = await client1.onboarding.recoverDefaultApiCredentials(signer1.address)
    client1.apiKeyCredentials = apiCreds1
    const keyPairWithYCoordinate1 = await client1.onboarding.deriveStarkKey(signer1.address)
    client1.starkPrivateKey = keyPairWithYCoordinate1.privateKey
    inited = true
  } catch (error) {
    console.log(error)
    console.log('WARNING: An error occurred initializing dydx client')
  }
}

snowkidind avatar Apr 25 '22 13:04 snowkidind

您需要初始化客户端。

查看我在 https://gist.github.com/snowkidind/9545ca43962dc1251a226031ea797b06上制作的要点


const init =  async () => {
  try {
    const apiCreds1 = await client1.onboarding.recoverDefaultApiCredentials(signer1.address)
    client1.apiKeyCredentials = apiCreds1
    const keyPairWithYCoordinate1 = await client1.onboarding.deriveStarkKey(signer1.address)
    client1.starkPrivateKey = keyPairWithYCoordinate1.privateKey
    inited = true
  } catch (error) {
    console.log(error)
    console.log('WARNING: An error occurred initializing dydx client')
  }
}

Thank you, my problem has been solved because of secretKey URl safe processing. Now I'm trying to deal with Invalid Signature for Order

zoo475698058 avatar Apr 26 '22 08:04 zoo475698058

Ever figure this out @zoo475698058? Running into the exact same issue. The documentation for this client is very poor.

shaw-matt avatar May 26 '22 20:05 shaw-matt

Same issue with Invalid Signature. We need example code for this in the docs or in the GitHub examples folder.

CryptoWizardsNet avatar Jun 15 '22 14:06 CryptoWizardsNet

Ever figure this out @zoo475698058? Running into the exact same issue. The documentation for this client is very poor.

@shaw-matt I have tried everything to figure this out and still failing. Have you had any success yet?

CryptoWizardsNet avatar Jun 15 '22 16:06 CryptoWizardsNet

I have finally figured it out. When using the Stark private key, you do not need a signature.

This was a very painful process to find out and needed to go right into the Python code. Luckily there was a comment which gave it away in the Python repository.

CryptoWizardsNet avatar Jun 15 '22 16:06 CryptoWizardsNet

+1 to last comment - really hard to figure that out.

kungla avatar Dec 20 '22 14:12 kungla