Workflow updating files of flowallet
This commit is contained in:
parent
7a1703fffe
commit
f57095d969
@ -17,8 +17,7 @@
|
|||||||
/* Constants for FLO blockchain operations !!Make sure to add this at beginning!! */
|
/* Constants for FLO blockchain operations !!Make sure to add this at beginning!! */
|
||||||
const floGlobals = {
|
const floGlobals = {
|
||||||
blockchain: "FLO",
|
blockchain: "FLO",
|
||||||
tokenApiUrl: 'https://ranchimallflo.duckdns.org',
|
tokenURL: 'https://ranchimallflo.ranchimall.net/',
|
||||||
tokenURL: 'https://ranchimallflo.duckdns.org/',
|
|
||||||
expirationDays: 60,
|
expirationDays: 60,
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@ -42,7 +41,7 @@
|
|||||||
compactIDB.initDB("FLOwebWallet", IDBObjects).then(async result => {
|
compactIDB.initDB("FLOwebWallet", IDBObjects).then(async result => {
|
||||||
render.savedIds();
|
render.savedIds();
|
||||||
if (!floGlobals.tokens || !floGlobals.smartContracts) {
|
if (!floGlobals.tokens || !floGlobals.smartContracts) {
|
||||||
fetchJson(`${floGlobals.tokenApiUrl}/api/v2/tokenSmartContractList`).then(({ tokens, smartContracts }) => {
|
fetchJson(`${floGlobals.tokenURL}api/v2/tokenSmartContractList`).then(({ tokens, smartContracts }) => {
|
||||||
floGlobals.scMap = new Map()
|
floGlobals.scMap = new Map()
|
||||||
floGlobals.tokens = tokens.sort((a, b) => a.localeCompare(b))
|
floGlobals.tokens = tokens.sort((a, b) => a.localeCompare(b))
|
||||||
floGlobals.smartContracts = smartContracts
|
floGlobals.smartContracts = smartContracts
|
||||||
@ -2265,7 +2264,7 @@
|
|||||||
const senderFloAddr = floCrypto.getFloID(senderPrivateKey)
|
const senderFloAddr = floCrypto.getFloID(senderPrivateKey)
|
||||||
Promise.all([
|
Promise.all([
|
||||||
floWebWallet.getBalance(senderFloAddr),
|
floWebWallet.getBalance(senderFloAddr),
|
||||||
fetchJson(`${floGlobals.tokenApiUrl}/api/v2/floAddressBalance/${senderFloAddr}`)
|
fetchJson(`${floGlobals.tokenURL}api/v2/floAddressBalance/${senderFloAddr}`)
|
||||||
]).then(([retrievedBal, { floAddressBalances }]) => {
|
]).then(([retrievedBal, { floAddressBalances }]) => {
|
||||||
renderBalance({ balance: parseFloat(retrievedBal), address: senderFloAddr })
|
renderBalance({ balance: parseFloat(retrievedBal), address: senderFloAddr })
|
||||||
let ownedTokens = []
|
let ownedTokens = []
|
||||||
@ -2483,7 +2482,7 @@
|
|||||||
getRef('flo_balance').innerHTML = `<sm-spinner></sm-spinner>`;
|
getRef('flo_balance').innerHTML = `<sm-spinner></sm-spinner>`;
|
||||||
const [floBalance, tokenBalances] = await Promise.all([
|
const [floBalance, tokenBalances] = await Promise.all([
|
||||||
floWebWallet.getBalance(queriedFloId),
|
floWebWallet.getBalance(queriedFloId),
|
||||||
fetchJson(`${floGlobals.tokenApiUrl}/api/v2/floAddressBalance/${queriedFloId}`).then(({ floAddressBalances }) => floAddressBalances)
|
fetchJson(`${floGlobals.tokenURL}api/v2/floAddressBalance/${queriedFloId}`).then(({ floAddressBalances }) => floAddressBalances)
|
||||||
])
|
])
|
||||||
let ownedTokens = []
|
let ownedTokens = []
|
||||||
for (const token in tokenBalances) {
|
for (const token in tokenBalances) {
|
||||||
@ -2509,7 +2508,7 @@
|
|||||||
//console.log('data entered is a FLO address');
|
//console.log('data entered is a FLO address');
|
||||||
resolve('address')
|
resolve('address')
|
||||||
} else if (text.length == 64 && returnHexNumber(text)) {
|
} else if (text.length == 64 && returnHexNumber(text)) {
|
||||||
fetchJson(`${floGlobals.tokenApiUrl}/api/v2/categoriseString/` + text)
|
fetchJson(`${floGlobals.tokenURL}api/v2/categoriseString/` + text)
|
||||||
.then(function (myJson) {
|
.then(function (myJson) {
|
||||||
resolve(myJson['type'])
|
resolve(myJson['type'])
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
@ -2788,7 +2787,7 @@
|
|||||||
name = floGlobals.smartContracts[0].contractName
|
name = floGlobals.smartContracts[0].contractName
|
||||||
address = floGlobals.smartContracts[0].contractAddress
|
address = floGlobals.smartContracts[0].contractAddress
|
||||||
}
|
}
|
||||||
fetchJson(`${floGlobals.tokenApiUrl}/api/v2/smartContractInfo?contractName=${name}&contractAddress=${address}`)
|
fetchJson(`${floGlobals.tokenURL}api/v2/smartContractInfo?contractName=${name}&contractAddress=${address}`)
|
||||||
.then(info => {
|
.then(info => {
|
||||||
console.log(info)
|
console.log(info)
|
||||||
const {
|
const {
|
||||||
|
|||||||
448
flowallet/index.min.html
Normal file
448
flowallet/index.min.html
Normal file
File diff suppressed because one or more lines are too long
@ -1,4 +1,4 @@
|
|||||||
(function (EXPORTS) { //floTokenAPI v1.0.4a
|
(function (EXPORTS) { //floTokenAPI v1.1.0
|
||||||
/* Token Operator to send/receive tokens via blockchain using API calls*/
|
/* Token Operator to send/receive tokens via blockchain using API calls*/
|
||||||
'use strict';
|
'use strict';
|
||||||
const tokenAPI = EXPORTS;
|
const tokenAPI = EXPORTS;
|
||||||
@ -67,15 +67,15 @@
|
|||||||
|
|
||||||
const getBalance = tokenAPI.getBalance = function (floID, token = DEFAULT.currency) {
|
const getBalance = tokenAPI.getBalance = function (floID, token = DEFAULT.currency) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch_api(`api/v1.0/getFloAddressBalance?token=${token}&floAddress=${floID}`)
|
fetch_api(`api/v2/floAddressInfo/${floID}`)
|
||||||
.then(result => resolve(result.balance || 0))
|
.then(result => resolve(result.floAddressBalances[token]?.balance || 0))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
tokenAPI.getTx = function (txID) {
|
tokenAPI.getTx = function (txID) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch_api(`api/v1.0/getTransactionDetails/${txID}`).then(res => {
|
fetch_api(`api/v2/transactionDetails/${txID}`).then(res => {
|
||||||
if (res.result === "error")
|
if (res.result === "error")
|
||||||
reject(res.description);
|
reject(res.description);
|
||||||
else if (!res.parsedFloData)
|
else if (!res.parsedFloData)
|
||||||
@ -169,7 +169,7 @@
|
|||||||
|
|
||||||
tokenAPI.getAllTxs = function (floID, token = DEFAULT.currency) {
|
tokenAPI.getAllTxs = function (floID, token = DEFAULT.currency) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
fetch_api(`api/v1.0/getFloAddressTransactions?token=${token}&floAddress=${floID}`)
|
fetch_api(`api/v2/floAddressTransactions/${floID}${token ? `?token=${token}` : ''}`)
|
||||||
.then(result => resolve(result))
|
.then(result => resolve(result))
|
||||||
.catch(error => reject(error))
|
.catch(error => reject(error))
|
||||||
})
|
})
|
||||||
|
|||||||
2
flowallet/scripts/floTokenAPI.min.js
vendored
2
flowallet/scripts/floTokenAPI.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in New Issue
Block a user