update tokenAPI and bug fixes
This commit is contained in:
parent
2c2d862a41
commit
7f4fbf4178
@ -1515,7 +1515,7 @@
|
||||
console.log("Starting the app! Please Wait!")
|
||||
floDapps.setCustomPrivKeyInput(getSignedIn)
|
||||
floDapps.setAppObjectStores({ savedIds: {}, savedUserData: {} })
|
||||
await floExchangeAPI.init("FMxYC7gYZhouzqtHZukGnPiQ8nvG4CMzXM", "exchange")
|
||||
await floExchangeAPI.init("exchange")
|
||||
console.log('Exchange API initialized!')
|
||||
floDapps.launchStartUp().then(result => {
|
||||
console.log(`Welcome ${floDapps.user.id}`);
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
(function (EXPORTS) { //floTokenAPI v1.2.1
|
||||
(function (EXPORTS) { //floTokenAPI v1.2.1a
|
||||
/* Token Operator to send/receive tokens via blockchain using API calls*/
|
||||
'use strict';
|
||||
const tokenAPI = EXPORTS;
|
||||
@ -68,9 +68,13 @@
|
||||
|
||||
const getBalance = tokenAPI.getBalance = function (floID, token = DEFAULT.currency) {
|
||||
return new Promise((resolve, reject) => {
|
||||
fetch_api(`api/v2/floAddressInfo/${floID}`)
|
||||
.then(result => resolve(result.floAddressBalances[token]?.balance || 0))
|
||||
.catch(error => reject(error))
|
||||
fetch_api(`api/v2/floAddressInfo/${floID}`).then(result => {
|
||||
let token_balance = 0
|
||||
if(result.floAddressBalances != null && typeof result.floAddressBalances == "object" && token in result.floAddressBalances){
|
||||
token_balance = result.floAddressBalances[token]["balance"] || 0
|
||||
}
|
||||
resolve(token_balance)
|
||||
}).catch(error => reject(error))
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user