Reputation: 458
I am trying to make a request to the Binance API using the universal transfer call that requires 3 params: "asset", "value" and "type". However, when I make the call with the required params I get the following response:
{
code: -1102,
msg: "Mandatory parameter 'type' was not sent, was empty/null, or malformed."
}
I can see that the parameter is being parsed in when I console.log but I still get the error:
[Object: null prototype] {
code: -1102,
msg: "Mandatory parameter 'type' was not sent, was empty/null, or malformed."
}
Here's the futuresTransferAsset() function I'm using the API from here
futuresTransferAsset: async ( asset, amount, type ) => {
let params = Object.assign( { asset, amount, type } );
return promiseRequest( 'v1/futures/transfer', params, { base:sapi, type:'SIGNED', method:'POST' } );
},
Here is the request:
const result = await binance.futuresTransferAsset('USDT', 1.00, 'UMFUTURE_MAIN')
Am I not parsing in the type param correctly?
Upvotes: 1
Views: 4920
Reputation: 436
hum! you're trying to build an Object in the line:
let params = Object.assign( { asset, amount, type } );
So you're passing three parameters to futureTransferAsset()
function. This line says that:
futuresTransferAsset('USDT', 1.00, 'UMFUTURE_MAIN')
Check what happens when you tried to build an Object
replacing the input params.
The "malformed" message could be related with a wrong definition of Object creating in params
var definition.
This an example to define an Object
:
*assetKeyName
, *amountKeyName
and *typeKeyName
are a supposed key name as best practice of Object
type definition.
In conclusion:
params
var.params
var is passing in promiseRequest
with a 'malformed' format or missing-format Object
.Please let know if I'm missing something.
Upvotes: 1