ccxt: idex {"error":"Invalid withdrawal signature. Please try again."}

Hello

  • OS: macOS
  • Programming Language version: PHP 7.3.9
  • CCXT version: 1.21.22
  • Exchange: IDEX
  • Method: Private (POST)
ccxt\ExchangeError  : idex {"error":"Invalid withdrawal signature. Please try again."}

  at /var/www/vhosts/xxxxxxx/xxxxxxxx/vendor/ccxt/ccxt/php/idex.php:1079
    1075|         if (is_array($response) && array_key_exists('error', $response)) {
    1076|             if (is_array($this->exceptions) && array_key_exists($response['error'], $this->exceptions)) {
    1077|                 throw new $this->exceptions[$response['error']]($this->id . ' ' . $response['error']);
    1078|             }
  > 1079|             throw new ExchangeError($this->id . ' ' . $body);
    1080|         }
    1081|     }
    1082| }
    1083| 

  Exception trace:

  1   ccxt\idex::handle_errors()
      /var/www/vhosts/xxxxxxx/xxxxxxxxx/vendor/ccxt/ccxt/php/base/Exchange.php:1398

  2   ccxt\Exchange::fetch()
      /var/www/vhosts/xxxxxxx/xxxxxxxxx/vendor/ccxt/ccxt/php/base/Exchange.php:1175

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (10 by maintainers)

Most upvoted comments

@ndubel the IDEX v1 API is now deprecated, the v2 API (idex2) is currently on Rinkeby and it will be launched on the mainnet on Oct 20: https://idex.io

yeah i will investigate this as soon as possible. it was working when we integrated the v1 originally, but i guess something has changed on one of our ends.

I couldn’t test with any other ones as the first POST request I need to make is to get an access_token.

Basically, the endpoint seems to check for a JSON body and the encode cahnges that for a query-styled string

For reference:

My issue ended up being caused by the encoding of the body in the fetch method (lines 528 & 529 in exchange.py)

request_body = body
if body:
    body = body.encode()

Removing the body encoding allowed the post request to function properly.

@kroitor I recently had issues with a POST request working correctly when using curl, but returning errors when using ccxt. I ended earching a bit deeper and found that the issue is related to the requests package.

It is a current issue over here: https://github.com/psf/requests/issues/5003

Perhaps, that’s the issue here as well?

The same, but Invalid cancel signature

fetch:
 idex POST https://api.idex.market/returnNextNonce
Request:
 { 'Content-Type': 'application/json', Accept: 'application/json' }
 {"address":"0x9a5c0xxxxxxxeb44c6009a"}

handleRestResponse:
 idex POST https://api.idex.market/returnNextNonce 200 OK
Response:
 {
  'Cf-Cache-Status': 'DYNAMIC',
  'Cf-Ray': 'x-WAW',
  Connection: 'keep-alive',
  'Content-Encoding': 'gzip',
  'Content-Type': 'application/json',
  Date: 'Thu, 27 Feb 2020 19:30:21 GMT',
  'Expect-Ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  Server: 'cloudflare',
  'Set-Cookie': '__cfduid=x; expires=Sat, 28-Mar-20 19:30:21 GMT; path=/; domain=.idex.market; HttpOnly; SameSite=Lax; Secure',
  'Strict-Transport-Security': 'max-age=15552000; preload',
  'Transfer-Encoding': 'chunked',
  'X-Content-Type-Options': 'nosniff'
}
 {"nonce":769469}

fetch:
 idex POST https://api.idex.market/cancel
Request:
 {
  'Content-Type': 'application/json',
  Accept: 'application/json',
  'API-Key': 'xxxxxxxx'
}
 {"orderHash":"xxxx","address":"xxx","nonce":769469,"r":"xxxx","s":"xxxx","v":27}

handleRestResponse:
 idex POST https://api.idex.market/cancel 400 Bad Request
Response:
 {
  'Cf-Cache-Status': 'DYNAMIC',
  'Cf-Ray': 'x-WAW',
  Connection: 'keep-alive',
  'Content-Encoding': 'gzip',
  'Content-Type': 'application/json',
  Date: 'Thu, 27 Feb 2020 19:30:23 GMT',
  'Expect-Ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
  Server: 'cloudflare',
  'Set-Cookie': '__cfduid=xxx; expires=Sat, 28-Mar-20 19:30:22 GMT; path=/; domain=.idex.market; HttpOnly; SameSite=Lax; Secure',
  'Strict-Transport-Security': 'max-age=15552000; preload',
  'Transfer-Encoding': 'chunked',
  'X-Content-Type-Options': 'nosniff'
}
 {"error":"Invalid cancel signature. Please try again."}

ExchangeError: idex {"error":"Invalid cancel signature. Please try again."}
    at idex.handleErrors (/var/www/node/bot/test/node_modules/ccxt/js/idex.js:1078:19)
    at /var/www/node/bot/test/node_modules/ccxt/js/base/Exchange.js:616:18
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async timeout (/var/www/node/bot/test/node_modules/ccxt/js/base/functions/time.js:178:24)
    at async idex.cancelOrder (/var/www/node/bot/test/node_modules/ccxt/js/idex.js:519:26)
    at async test (/var/www/node/bot/test/test.js:169:23) {
  constructor: [Function: ExchangeError],
  name: 'ExchangeError'
}

@kroitor thank you, but the php version have many bug also can’t make a idex market order