In the following example, I have two questions.
- I failed to receive the balance update notifications for “binance.websockets.userData” when someone transfer the ICP (amount: 0.00000001) to my account.
- For the following api, it will report error: binance.sapiRequest is not a function
binance.sapiRequest(‘v1/pay/transactions’, { timestamp: Date.now(), limit: 1 }, (error, response)
TypeError: binance.sapiRequest is not a function
at getRecentTransactions (file:///D:/index.mjs:43:19)
at handler (file:///D:/index.mjs:30:20)
======================================================
import Binance from “node-binance-api”;
try{
const binance = new Binance().options({
APIKEY: "api key of my account ",
APISECRET: "secret key of my account "
});
binance.websockets.userData(balance_update => {
console.log("Balance Update: ", balance_update);
transactions = getRecentTransactions(binance);
}, execution_update => {
console.log("Execution Update: ", execution_update);
});
}
catch(error) {
console.error("get error : "+ error)
}
async function getRecentTransactions(binance) {
await binance.sapiRequest('v1/pay/transactions',
{ timestamp: Date.now(), limit: 1 }, (error, response) => {
if (error) return console.error(error);
console.log("Recent Transaction: ", response);
return response.data;
// parseTransactionResponse(response);
});
}