forked from Qortal/qortal-ui
Merge pull request #308 from kennycud/master
Q-App Support for Foreign Blockchain Use
This commit is contained in:
commit
f587743dc2
@ -31,6 +31,24 @@ export const GET_CROSSCHAIN_SERVER_INFO = 'GET_CROSSCHAIN_SERVER_INFO'
|
||||
// GET_TX_ACTIVITY_SUMMARY
|
||||
export const GET_TX_ACTIVITY_SUMMARY = 'GET_TX_ACTIVITY_SUMMARY'
|
||||
|
||||
// GET_FOREIGN_FEE action
|
||||
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";
|
||||
|
||||
// SET_CURRENT_FOREIGN_SERVER
|
||||
export let SET_CURRENT_FOREIGN_SERVER = "SET_CURRENT_FOREIGN_SERVER";
|
||||
|
||||
// ADD_FOREIGN_SERVER
|
||||
export let ADD_FOREIGN_SERVER = "ADD_FOREIGN_SERVER";
|
||||
|
||||
// REMOVE_FOREIGN_SERVER
|
||||
export let REMOVE_FOREIGN_SERVER = "REMOVE_FOREIGN_SERVER";
|
||||
|
||||
// GET_WALLET_BALANCE action
|
||||
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE'
|
||||
|
||||
@ -91,11 +109,5 @@ export const GET_DAY_SUMMARY = 'GET_DAY_SUMMARY'
|
||||
// GET_FRIENDS_LIST
|
||||
export const GET_FRIENDS_LIST = 'GET_FRIENDS_LIST'
|
||||
|
||||
// GET_FOREIGN_FEE
|
||||
export const GET_FOREIGN_FEE = 'GET_FOREIGN_FEE'
|
||||
|
||||
// UPDATE_FOREIGN_FEE
|
||||
export const UPDATE_FOREIGN_FEE = 'UPDATE_FOREIGN_FEE'
|
||||
|
||||
// OPEN_PROFILE
|
||||
export const OPEN_PROFILE = 'OPEN_PROFILE'
|
||||
export const OPEN_PROFILE = 'OPEN_PROFILE'
|
||||
|
@ -1894,12 +1894,14 @@ class WebBrowser extends LitElement {
|
||||
case actions.GET_FOREIGN_FEE: {
|
||||
const requiredFields = ['coin','type']
|
||||
const missingFields = []
|
||||
requiredFields.forEach((field) => {
|
||||
|
||||
requiredFields.forEach((field) => {
|
||||
if (!data[field]) {
|
||||
missingFields.push(field)
|
||||
}
|
||||
})
|
||||
if (missingFields.length > 0) {
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
const missingFieldsString = missingFields.join(', ')
|
||||
const errorMsg = `Missing fields: ${missingFieldsString}`
|
||||
let data = {}
|
||||
@ -1907,6 +1909,7 @@ class WebBrowser extends LitElement {
|
||||
response = JSON.stringify(data)
|
||||
break
|
||||
}
|
||||
|
||||
try {
|
||||
let coin = data.coin;
|
||||
let type = data.type;
|
||||
@ -1931,11 +1934,13 @@ class WebBrowser extends LitElement {
|
||||
case actions.UPDATE_FOREIGN_FEE: {
|
||||
const requiredFields = ['coin','type']
|
||||
const missingFields = []
|
||||
|
||||
requiredFields.forEach((field) => {
|
||||
if (!data[field]) {
|
||||
missingFields.push(field)
|
||||
}
|
||||
})
|
||||
|
||||
if (missingFields.length > 0) {
|
||||
const missingFieldsString = missingFields.join(', ')
|
||||
const errorMsg = `Missing fields: ${missingFieldsString}`
|
||||
@ -1944,6 +1949,7 @@ class WebBrowser extends LitElement {
|
||||
response = JSON.stringify(data)
|
||||
break
|
||||
}
|
||||
|
||||
try {
|
||||
let coin = data.coin;
|
||||
let type = data.type;
|
||||
@ -1967,6 +1973,98 @@ 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.SET_CURRENT_FOREIGN_SERVER: {
|
||||
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;
|
||||
let host = data.host;
|
||||
let port = data.port;
|
||||
let type = data.type;
|
||||
|
||||
const body = {
|
||||
hostName: host,
|
||||
port: port,
|
||||
connectionType: type
|
||||
}
|
||||
|
||||
const bodyToString = JSON.stringify(body)
|
||||
|
||||
response = await parentEpml.request('apiCall', {
|
||||
type: 'api',
|
||||
method: 'POST',
|
||||
url: `/crosschain/${coin}/setcurrentserver?apiKey=${this.getApiKey()}`,
|
||||
headers: {
|
||||
'Accept': '*/*',
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
body: `${bodyToString}`
|
||||
})
|
||||
} catch (error) {
|
||||
const data = {}
|
||||
data['error'] = "Error in set current server"
|
||||
response = JSON.stringify(data)
|
||||
} finally {
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
case actions.GET_DAY_SUMMARY: {
|
||||
try {
|
||||
response = await parentEpml.request('apiCall', {
|
||||
@ -3910,4 +4008,4 @@ async function showErrorAndWait(type, data, data1) {
|
||||
// Add the styles for the modal
|
||||
const styleSheet = new CSSStyleSheet()
|
||||
styleSheet.replaceSync(webBrowserModalStyles)
|
||||
document.adoptedStyleSheets = [styleSheet]
|
||||
document.adoptedStyleSheets = [styleSheet]
|
||||
|
Loading…
x
Reference in New Issue
Block a user