floTokenAPI v1.0.3a

check if amount is not NaN before sendToken
This commit is contained in:
sairajzero 2022-05-24 19:41:45 +05:30
parent 960aa1f52d
commit 29e20de25b

View File

@ -1,4 +1,4 @@
(function(EXPORTS) { //floTokenAPI v1.0.3
(function(EXPORTS) { //floTokenAPI v1.0.3a
/* Token Operator to send/receive tokens via blockchain using API calls*/
'use strict';
const tokenAPI = EXPORTS;
@ -58,7 +58,7 @@
tokenAPI.sendToken = function(privKey, amount, receiverID, message = "", token = DEFAULT.currency, options = {}) {
return new Promise((resolve, reject) => {
let senderID = floCrypto.getFloID(privKey);
if (typeof amount !== "number" || amount <= 0)
if (typeof amount !== "number" || isNaN(amount) || amount <= 0)
return reject("Invalid amount");
getBalance(senderID, token).then(bal => {
if (amount > bal)