Typo fixes
This commit is contained in:
parent
c5f2908261
commit
237e2498b3
@ -1694,7 +1694,7 @@
|
||||
}
|
||||
}
|
||||
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')
|
||||
} else {
|
||||
showWalletResult('error', `Failed`, err.data || err)
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
'use strict';
|
||||
|
||||
/* Token Operator to send/receive tokens from blockchain using API calls*/
|
||||
(function(GLOBAL) {
|
||||
(function (GLOBAL) {
|
||||
const floTokenAPI = GLOBAL.floTokenAPI = {
|
||||
fetch_api: function(apicall) {
|
||||
fetch_api: function (apicall) {
|
||||
return new Promise((resolve, reject) => {
|
||||
console.log(floGlobals.tokenURL + apicall);
|
||||
fetch(floGlobals.tokenURL + apicall).then(response => {
|
||||
@ -14,14 +14,14 @@
|
||||
}).catch(error => reject(error))
|
||||
})
|
||||
},
|
||||
getBalance: function(floID, token = floGlobals.currency) {
|
||||
getBalance: function (floID, token = floGlobals.currency) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.fetch_api(`api/v1.0/getFloAddressBalance?token=${token}&floAddress=${floID}`)
|
||||
.then(result => resolve(result.balance || 0))
|
||||
.catch(error => reject(error))
|
||||
})
|
||||
},
|
||||
getTx: function(txID) {
|
||||
getTx: function (txID) {
|
||||
return new Promise((resolve, reject) => {
|
||||
this.fetch_api(`api/v1.0/getTransactionDetails/${txID}`).then(res => {
|
||||
if (res.result === "error")
|
||||
@ -35,14 +35,14 @@
|
||||
}).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) => {
|
||||
let senderID = floCrypto.getFloID(privKey);
|
||||
if (typeof amount !== "number" || amount <= 0)
|
||||
return reject("Invalid amount");
|
||||
this.getBalance(senderID, token).then(bal => {
|
||||
if (amount > bal)
|
||||
return reject("Insufficiant token balance");
|
||||
return reject(`Insufficient ${token} balance`);
|
||||
floBlockchainAPI.writeData(senderID, `send ${amount} ${token}# ${message}`, privKey, receiverID)
|
||||
.then(txid => resolve(txid))
|
||||
.catch(error => reject(error))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user