diff --git a/plugins/plugins/core/components/qdn-action-types.js b/plugins/plugins/core/components/qdn-action-types.js index 1cfa0f44..e6aeb21f 100644 --- a/plugins/plugins/core/components/qdn-action-types.js +++ b/plugins/plugins/core/components/qdn-action-types.js @@ -25,6 +25,9 @@ export const GET_USER_WALLET = 'GET_USER_WALLET'; // GET_USER_WALLET_INFO action 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 export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE'; diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js index 8efa2a58..b5354bf9 100644 --- a/plugins/plugins/core/qdn/browser/browser.src.js +++ b/plugins/plugins/core/qdn/browser/browser.src.js @@ -845,12 +845,12 @@ class WebBrowser extends LitElement { data64 = await fileToBase64(data.file) } if (!data64) { - + dataSentBack['error'] = "Please include data to encrypt" response = JSON.stringify(dataSentBack) break } - + const encryptDataResponse = encryptDataGroup({ data64, publicKeys: publicKeys }) @@ -859,7 +859,7 @@ class WebBrowser extends LitElement { response = JSON.stringify(encryptDataResponse) break; } else { - + dataSentBack['error'] = "Unable to encrypt" response = JSON.stringify(dataSentBack) break @@ -2611,6 +2611,50 @@ class WebBrowser extends LitElement { 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: { try { const summary = await parentEpml.request('apiCall', {