mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-14 11:15:50 +00:00
Merge pull request #261 from kennycud/master
Adding crosschain server info support for Q-apps
This commit is contained in:
commit
d84ab71d32
@ -25,6 +25,9 @@ export const GET_USER_WALLET = 'GET_USER_WALLET';
|
|||||||
// GET_USER_WALLET_INFO action
|
// GET_USER_WALLET_INFO action
|
||||||
export const GET_USER_WALLET_INFO = 'GET_USER_WALLET_INFO';
|
export const GET_USER_WALLET_INFO = 'GET_USER_WALLET_INFO';
|
||||||
|
|
||||||
|
// GET_CROSSCHAIN_SERVER_INFO action
|
||||||
|
export const GET_CROSSCHAIN_SERVER_INFO = 'GET_CROSSCHAIN_SERVER_INFO';
|
||||||
|
|
||||||
// GET_WALLET_BALANCE action
|
// GET_WALLET_BALANCE action
|
||||||
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE';
|
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE';
|
||||||
|
|
||||||
|
@ -845,12 +845,12 @@ class WebBrowser extends LitElement {
|
|||||||
data64 = await fileToBase64(data.file)
|
data64 = await fileToBase64(data.file)
|
||||||
}
|
}
|
||||||
if (!data64) {
|
if (!data64) {
|
||||||
|
|
||||||
dataSentBack['error'] = "Please include data to encrypt"
|
dataSentBack['error'] = "Please include data to encrypt"
|
||||||
response = JSON.stringify(dataSentBack)
|
response = JSON.stringify(dataSentBack)
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
const encryptDataResponse = encryptDataGroup({
|
const encryptDataResponse = encryptDataGroup({
|
||||||
data64, publicKeys: publicKeys
|
data64, publicKeys: publicKeys
|
||||||
})
|
})
|
||||||
@ -859,7 +859,7 @@ class WebBrowser extends LitElement {
|
|||||||
response = JSON.stringify(encryptDataResponse)
|
response = JSON.stringify(encryptDataResponse)
|
||||||
break;
|
break;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dataSentBack['error'] = "Unable to encrypt"
|
dataSentBack['error'] = "Unable to encrypt"
|
||||||
response = JSON.stringify(dataSentBack)
|
response = JSON.stringify(dataSentBack)
|
||||||
break
|
break
|
||||||
@ -2611,6 +2611,50 @@ class WebBrowser extends LitElement {
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case actions.GET_CROSSCHAIN_SERVER_INFO: {
|
||||||
|
const requiredFields = ['coin']
|
||||||
|
const missingFields = []
|
||||||
|
|
||||||
|
requiredFields.forEach((field) => {
|
||||||
|
if (!data[field]) {
|
||||||
|
missingFields.push(field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (missingFields.length > 0) {
|
||||||
|
const missingFieldsString = missingFields.join(', ')
|
||||||
|
const errorMsg = `Missing fields: ${missingFieldsString}`
|
||||||
|
let data = {}
|
||||||
|
data['error'] = errorMsg
|
||||||
|
response = JSON.stringify(data)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
let _url = `/crosschain/` + data.coin.toLowerCase() + `/serverinfos`
|
||||||
|
try {
|
||||||
|
this.loader.show()
|
||||||
|
const res = await parentEpml.request('apiCall', {
|
||||||
|
url: _url,
|
||||||
|
method: 'GET',
|
||||||
|
headers: {
|
||||||
|
'Accept': '*/*'
|
||||||
|
}
|
||||||
|
})
|
||||||
|
response = JSON.stringify(res.servers);
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error)
|
||||||
|
const data = {}
|
||||||
|
const errorMsg = error.message || 'Error in retrieving server info'
|
||||||
|
data['error'] = errorMsg
|
||||||
|
response = JSON.stringify(data)
|
||||||
|
return
|
||||||
|
} finally {
|
||||||
|
this.loader.hide()
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
case actions.GET_DAY_SUMMARY: {
|
case actions.GET_DAY_SUMMARY: {
|
||||||
try {
|
try {
|
||||||
const summary = await parentEpml.request('apiCall', {
|
const summary = await parentEpml.request('apiCall', {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user