After doing offer.send(), I use this function :
setTimeout(confirm2FA, 5000, offer.id, 0);
function confirm2FA(offerID,tries) {
return new Promise((resolve, reject) => {
community.acceptConfirmationForObject(config.coinflip.identitySecret, offerID, (err) => {
if (err)
{
if(tries < 2) {
tries++;
setTimeout(confirm2FA, 25000, offerID, tries);
reject('Offer confirmation 2FA: ' + err);
}
else
{
console.log("couldnt confirm");
}
}
else {
console.log("confirmed");
resolve(true); // Offer is confirmed by 2FA
}
});
});
}
and I get rate limited (error 429) pretty often, what am I doing wrong? (It usually confirms on the 3rd time)