Browse Source

adding get foreign blockchain server history support for Q-apps

pull/308/head
kennycud 4 months ago
parent
commit
5cf52baa87
  1. 3
      plugins/plugins/core/components/qdn-action-types.js
  2. 40
      plugins/plugins/core/qdn/browser/browser.src.js

3
plugins/plugins/core/components/qdn-action-types.js

@ -37,6 +37,9 @@ export const GET_FOREIGN_FEE = 'GET_FOREIGN_FEE';
// UPDATE_FOREIGN_FEE action
export const UPDATE_FOREIGN_FEE = 'UPDATE_FOREIGN_FEE';
// GET_SERVER_CONNECTION_HISTORY
export let GET_SERVER_CONNECTION_HISTORY = "GET_SERVER_CONNECTION_HISTORY";
// GET_WALLET_BALANCE action
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE';

40
plugins/plugins/core/qdn/browser/browser.src.js

@ -2702,6 +2702,46 @@ class WebBrowser extends LitElement {
}
}
case actions.GET_SERVER_CONNECTION_HISTORY: {
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
}
try {
let coin = data.coin.toLowerCase();
response = await parentEpml.request('apiCall', {
type: 'api',
method: 'GET',
url: `/crosschain/${coin}/serverconnectionhistory`,
headers: {
'Accept': '*/*',
'Content-Type': 'application/json'
},
})
} catch (error) {
const data = {}
data['error'] = "Error in get server connection history"
response = JSON.stringify(data)
} finally {
break
}
}
case actions.GET_DAY_SUMMARY: {
try {
response = await parentEpml.request('apiCall', {

Loading…
Cancel
Save