I haven’t tried to do a market order since the new releases. Last time I did it was with the python api. But in the description you have posted the CryptoCurrency amount is used as the first mentioned currency in the market. Maybe it has to be this way around?
What I’m actually interested in is using the apiKeyonly to login (without the secret ), instead of the whole json file. So instead of:
That is not technically possible @Oldsport. The apiKey parameter is just a identifier, what you actually use to authenticate is the secret part. This is true not only for Nash but for any API key system. So unfortunately there is not way around it
@Symiaq is correct, in a market order is not possible to define the resulting total since the price is undefined, you can only specify the order in base currency, so use CryptoCurrency.BTC instead.
But what if someone only want to use non authenticated API methods, for instance listMarket or getOrderBook ? Calling login is still required because the ‘apiKey’ is added into a Authorization header for all methods, even the non authenticated ones, but I guess the secret should not be required.
So maybe calling: nash.login({ apiKey: '58652459-39...', secret: "" }); works, but I haven’t tested it.
Markets buy have some technical limitations on the protocol, so to emulate that you can do a market sell in the inverse market. The equivalent would be:
Found something a little odd when executing a market sell order of USDC into BTC (so buying BTC with USDC):
Amount 0.13 for currency usdc is less than min amount for market: 5.00000000. Defaulting to min amount
0.13 < 5 so the message is appropriate, but I would have expected the trade not to go through and getting an error instead. I guess the frontend there for that, but it means if I build an app, it must also implement this front validation myself.
Withdrawal
I am trying to make a withdrawal from a personal account to an external one. Is signWithdrawRequest the right method for that? No luck with the following snippet:
@canesin My version was 5.0.11, I think it’s still the latest.
However, I changed the very method I’m using. I don’t know why it wasn’t showing up in the documentation search before, but I’m now trying to use transferToExternal.
I know the message looks pretty self-explanatory, but I did add the destination address to the whitelist of the API key I’m using. I even tried with a newly created API key, to no avail.
Doesn’t work for you on latest version? There was a specific issue with NEO transfers.
The secret is so long because it is a lot of information … it is keys for all the chains supported and homomorphic encryption keys. It needs to be able to sign transactions on all the chains and collaborate with the matching engine in the MPC protocol. Not a single simple secret to sign hmacs like usual to API keys.
It doesn’t look like it. I updated to version 5.0.19 and still getting that destination address is not part of the whitelisted addresses error. However the destination address is part of the API key whitelist.
Ok, I understand. FYI I had to split it in half to fit into cookies, not the best dev experience, but what can you do! Maybe I ought to use localStorage, but it feels less safe than httpOnly cookies.
Will verify, I guess might be some issue on sandbox.
Are you sending the secret to a server in the headers? If you share the use I might help. Normally if the use is only on the client side localStorage or sessionStorage might be better.
If it is used on the server only than doing a push for the keys once and having in a encrypted database might be better.
thanks for the report @Oldsport, will look into it - we use it in several places, so it is there will check if there is some issue on the middle of the path.