Closed splundge closed 6 years ago
Hi @splundge ,
What is the response you get from the API?
Thanks, Justin
the response i get is
{"success":false,"errorCode":1,"errorMessage":"Authentication failed."}
@splundge ,
What language are you using? I'll try to replicate. Are you turning the body into a JSON string before using it to create the signature?
Thanks, Justin
I'm using C#. Give this a whirl. (make sure to put your pub/priv key in there) you also need to reference newtonsoft json. Or you can just remove the json convertion and read the response manually
@justin-ngin hey justin did you end up getting this to work?
@splundge ,
Sorry for the delay. I'm still working on this and hope to have something for you by today.
Regards, Justin
Sorry for the double post! I wasn't sure if this thread got buried :)
@splundge ,
I think I've almost got it. The signature it is creating is incorrect. If your other endpoints are working, it must be something inside the Withdraw method, but I can't see what it might be as the logged requestBody looks exactly like it's supposed to.
@splundge,
solved it. WithdrawalPath was not being passed into GetAuthenticationHeaders, and therefore wasn't being included in the string to generate the signature. Please let me know if that gets you up and running.
public void Withdraw(Currency currency, decimal quantity, string depositAddress)
{
var adjustedQuantity = (int)(quantity * 100000000m);
var requestBody = String.Format("{{\"amount\":{0},\"address\":\"{1}\",\"currency\":\"{2}\"}}",
adjustedQuantity,
depositAddress,
currency.ToString().ToUpper());
var result = Post<WithdrawResponse>(WithdrawalPath, requestBody, GetAuthenticationHeaders(**WithdrawalPath**, requestBody));
if (!result.success)
throw new Exception(String.Format("{0} {1}", result.errorCode, result.errorMessage));
}
Cheers, Justin
holy crap. what a stupid mistake. I fixed it up and it works. what a waste of time! Sorry Justin. Really appreciate your help with this issue!!
Hi I can create orders and get my account balance, but I can't seem to withdraw? This indicates that my authentication is correct. But something's wrong with the withdrawal.
I've replace the sensitive information here. What's wrong with the structure of this request?