Typo fixes

This commit is contained in:
sairaj mote 2022-04-15 18:15:00 +05:30
parent c5f2908261
commit 237e2498b3
2 changed files with 7 additions and 7 deletions

View File

@ -1694,7 +1694,7 @@
} }
} }
catch (err) { catch (err) {
if ((err.data || err) === 'Insufficiant token balance' && asset === 'rupee') { if ((err.data || err) === 'Insufficient token balance' && asset === 'rupee') {
showWalletResult('error', `Failed`, err.data || err, 'open-upi') showWalletResult('error', `Failed`, err.data || err, 'open-upi')
} else { } else {
showWalletResult('error', `Failed`, err.data || err) showWalletResult('error', `Failed`, err.data || err)

View File

@ -1,9 +1,9 @@
'use strict'; 'use strict';
/* Token Operator to send/receive tokens from blockchain using API calls*/ /* Token Operator to send/receive tokens from blockchain using API calls*/
(function(GLOBAL) { (function (GLOBAL) {
const floTokenAPI = GLOBAL.floTokenAPI = { const floTokenAPI = GLOBAL.floTokenAPI = {
fetch_api: function(apicall) { fetch_api: function (apicall) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
console.log(floGlobals.tokenURL + apicall); console.log(floGlobals.tokenURL + apicall);
fetch(floGlobals.tokenURL + apicall).then(response => { fetch(floGlobals.tokenURL + apicall).then(response => {
@ -14,14 +14,14 @@
}).catch(error => reject(error)) }).catch(error => reject(error))
}) })
}, },
getBalance: function(floID, token = floGlobals.currency) { getBalance: function (floID, token = floGlobals.currency) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.fetch_api(`api/v1.0/getFloAddressBalance?token=${token}&floAddress=${floID}`) this.fetch_api(`api/v1.0/getFloAddressBalance?token=${token}&floAddress=${floID}`)
.then(result => resolve(result.balance || 0)) .then(result => resolve(result.balance || 0))
.catch(error => reject(error)) .catch(error => reject(error))
}) })
}, },
getTx: function(txID) { getTx: function (txID) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
this.fetch_api(`api/v1.0/getTransactionDetails/${txID}`).then(res => { this.fetch_api(`api/v1.0/getTransactionDetails/${txID}`).then(res => {
if (res.result === "error") if (res.result === "error")
@ -35,14 +35,14 @@
}).catch(error => reject(error)) }).catch(error => reject(error))
}) })
}, },
sendToken: function(privKey, amount, receiverID, message = "", token = floGlobals.currency) { sendToken: function (privKey, amount, receiverID, message = "", token = floGlobals.currency) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
let senderID = floCrypto.getFloID(privKey); let senderID = floCrypto.getFloID(privKey);
if (typeof amount !== "number" || amount <= 0) if (typeof amount !== "number" || amount <= 0)
return reject("Invalid amount"); return reject("Invalid amount");
this.getBalance(senderID, token).then(bal => { this.getBalance(senderID, token).then(bal => {
if (amount > bal) if (amount > bal)
return reject("Insufficiant token balance"); return reject(`Insufficient ${token} balance`);
floBlockchainAPI.writeData(senderID, `send ${amount} ${token}# ${message}`, privKey, receiverID) floBlockchainAPI.writeData(senderID, `send ${amount} ${token}# ${message}`, privKey, receiverID)
.then(txid => resolve(txid)) .then(txid => resolve(txid))
.catch(error => reject(error)) .catch(error => reject(error))