mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-04-23 19:37:52 +00:00
Added qortal requests
This commit is contained in:
parent
e3ef24dc5e
commit
7ca9acaf3a
@ -20,7 +20,9 @@ import {
|
|||||||
setSideEffectAction,
|
setSideEffectAction,
|
||||||
setTabNotifications,
|
setTabNotifications,
|
||||||
allowQAPPAutoBalance,
|
allowQAPPAutoBalance,
|
||||||
removeQAPPAutoBalance
|
removeQAPPAutoBalance,
|
||||||
|
allowQAPPAutoTransactions,
|
||||||
|
removeQAPPAutoTransactions
|
||||||
} from '../../redux/app/app-actions'
|
} from '../../redux/app/app-actions'
|
||||||
import settings from '../../functional-components/settings-page'
|
import settings from '../../functional-components/settings-page'
|
||||||
import './welcome-page'
|
import './welcome-page'
|
||||||
@ -56,7 +58,9 @@ window.reduxAction = {
|
|||||||
allowShowSyncIndicator: allowShowSyncIndicator,
|
allowShowSyncIndicator: allowShowSyncIndicator,
|
||||||
removeShowSyncIndicator: removeShowSyncIndicator,
|
removeShowSyncIndicator: removeShowSyncIndicator,
|
||||||
allowQAPPAutoBalance: allowQAPPAutoBalance,
|
allowQAPPAutoBalance: allowQAPPAutoBalance,
|
||||||
removeQAPPAutoBalance: removeQAPPAutoBalance
|
removeQAPPAutoBalance: removeQAPPAutoBalance,
|
||||||
|
allowQAPPAutoTransactions: allowQAPPAutoTransactions,
|
||||||
|
removeQAPPAutoTransactions: removeQAPPAutoTransactions
|
||||||
}
|
}
|
||||||
|
|
||||||
const animationDuration = 0.7 // Seconds
|
const animationDuration = 0.7 // Seconds
|
||||||
|
@ -10,7 +10,9 @@ import {
|
|||||||
removeQAPPAutoLists,
|
removeQAPPAutoLists,
|
||||||
setIsOpenDevDialog,
|
setIsOpenDevDialog,
|
||||||
allowQAPPAutoBalance,
|
allowQAPPAutoBalance,
|
||||||
removeQAPPAutoBalance
|
removeQAPPAutoBalance,
|
||||||
|
allowQAPPAutoTransactions,
|
||||||
|
removeQAPPAutoTransactions
|
||||||
} from '../../redux/app/app-actions'
|
} from '../../redux/app/app-actions'
|
||||||
import { securityViewStyles } from '../../styles/core-css'
|
import { securityViewStyles } from '../../styles/core-css'
|
||||||
import FileSaver from 'file-saver'
|
import FileSaver from 'file-saver'
|
||||||
@ -87,6 +89,12 @@ class SecurityView extends connect(store)(LitElement) {
|
|||||||
</label>
|
</label>
|
||||||
<mwc-checkbox style="margin-right: -15px;" id="balanceButton" @click=${(e) => this.checkForBalance(e)} ?checked=${store.getState().app.qAPPAutoBalance}></mwc-checkbox>
|
<mwc-checkbox style="margin-right: -15px;" id="balanceButton" @click=${(e) => this.checkForBalance(e)} ?checked=${store.getState().app.qAPPAutoBalance}></mwc-checkbox>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="checkbox-row">
|
||||||
|
<label for="transactionsButton" id="transactionsButtonLabel" style="color: var(--black);">
|
||||||
|
Always allow wallet txs to be retrieved automatically
|
||||||
|
</label>
|
||||||
|
<mwc-checkbox style="margin-right: -15px;" id="transactionsButton" @click=${(e) => this.checkForTransactions(e)} ?checked=${store.getState().app.qAPPAutoTransactions}></mwc-checkbox>
|
||||||
|
</div>
|
||||||
<div class="checkbox-row">
|
<div class="checkbox-row">
|
||||||
<label for="authButton" id="authButtonLabel" style="color: var(--black);">
|
<label for="authButton" id="authButtonLabel" style="color: var(--black);">
|
||||||
${get('browserpage.bchange39')}
|
${get('browserpage.bchange39')}
|
||||||
@ -124,6 +132,14 @@ class SecurityView extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkForTransactions(e) {
|
||||||
|
if (e.target.checked) {
|
||||||
|
store.dispatch(removeQAPPAutoTransactions(false))
|
||||||
|
} else {
|
||||||
|
store.dispatch(allowQAPPAutoTransactions(true))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
checkForLists(e) {
|
checkForLists(e) {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
store.dispatch(removeQAPPAutoLists(false))
|
store.dispatch(removeQAPPAutoLists(false))
|
||||||
|
@ -26,7 +26,9 @@ import {
|
|||||||
ALLOW_SHOW_SYNC_INDICATOR,
|
ALLOW_SHOW_SYNC_INDICATOR,
|
||||||
REMOVE_SHOW_SYNC_INDICATOR,
|
REMOVE_SHOW_SYNC_INDICATOR,
|
||||||
ALLOW_QAPP_AUTO_BALANCE,
|
ALLOW_QAPP_AUTO_BALANCE,
|
||||||
REMOVE_QAPP_AUTO_BALANCE
|
REMOVE_QAPP_AUTO_BALANCE,
|
||||||
|
ALLOW_QAPP_AUTO_TRANSACTIONS,
|
||||||
|
REMOVE_QAPP_AUTO_TRANSACTIONS
|
||||||
} from '../app-action-types'
|
} from '../app-action-types'
|
||||||
|
|
||||||
export const doUpdateBlockInfo = (blockObj) => {
|
export const doUpdateBlockInfo = (blockObj) => {
|
||||||
@ -136,6 +138,20 @@ export const removeQAPPAutoBalance = (payload) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const allowQAPPAutoTransactions = (payload) => {
|
||||||
|
return {
|
||||||
|
type: ALLOW_QAPP_AUTO_TRANSACTIONS,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const removeQAPPAutoTransactions = (payload) => {
|
||||||
|
return {
|
||||||
|
type: REMOVE_QAPP_AUTO_TRANSACTIONS,
|
||||||
|
payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
export const allowQAPPAutoLists = (payload) => {
|
export const allowQAPPAutoLists = (payload) => {
|
||||||
return {
|
return {
|
||||||
type: ALLOW_QAPP_AUTO_LISTS,
|
type: ALLOW_QAPP_AUTO_LISTS,
|
||||||
|
@ -41,3 +41,5 @@ export const ALLOW_SHOW_SYNC_INDICATOR = 'ALLOW_SHOW_SYNC_INDICATOR'
|
|||||||
export const REMOVE_SHOW_SYNC_INDICATOR = 'REMOVE_SHOW_SYNC_INDICATOR'
|
export const REMOVE_SHOW_SYNC_INDICATOR = 'REMOVE_SHOW_SYNC_INDICATOR'
|
||||||
export const ALLOW_QAPP_AUTO_BALANCE = 'ALLOW_QAPP_AUTO_BALANCE'
|
export const ALLOW_QAPP_AUTO_BALANCE = 'ALLOW_QAPP_AUTO_BALANCE'
|
||||||
export const REMOVE_QAPP_AUTO_BALANCE = 'REMOVE_QAPP_AUTO_BALANCE'
|
export const REMOVE_QAPP_AUTO_BALANCE = 'REMOVE_QAPP_AUTO_BALANCE'
|
||||||
|
export const ALLOW_QAPP_AUTO_TRANSACTIONS = 'ALLOW_QAPP_AUTO_TRANSACTIONS'
|
||||||
|
export const REMOVE_QAPP_AUTO_TRANSACTIONS = 'REMOVE_QAPP_AUTO_TRANSACTIONS'
|
||||||
|
@ -42,7 +42,9 @@ import {
|
|||||||
ALLOW_SHOW_SYNC_INDICATOR,
|
ALLOW_SHOW_SYNC_INDICATOR,
|
||||||
REMOVE_SHOW_SYNC_INDICATOR,
|
REMOVE_SHOW_SYNC_INDICATOR,
|
||||||
ALLOW_QAPP_AUTO_BALANCE,
|
ALLOW_QAPP_AUTO_BALANCE,
|
||||||
REMOVE_QAPP_AUTO_BALANCE
|
REMOVE_QAPP_AUTO_BALANCE,
|
||||||
|
ALLOW_QAPP_AUTO_TRANSACTIONS,
|
||||||
|
REMOVE_QAPP_AUTO_TRANSACTIONS
|
||||||
} from './app-action-types'
|
} from './app-action-types'
|
||||||
import { initWorkersReducer } from './reducers/init-workers'
|
import { initWorkersReducer } from './reducers/init-workers'
|
||||||
import { loginReducer } from './reducers/login-reducer'
|
import { loginReducer } from './reducers/login-reducer'
|
||||||
@ -92,6 +94,7 @@ const INITIAL_STATE = {
|
|||||||
qAPPFriendsList: loadStateFromLocalStorage('qAPPFriendsList') || false,
|
qAPPFriendsList: loadStateFromLocalStorage('qAPPFriendsList') || false,
|
||||||
showSyncIndicator: loadStateFromLocalStorage('showSyncIndicator') || false,
|
showSyncIndicator: loadStateFromLocalStorage('showSyncIndicator') || false,
|
||||||
qAPPAutoBalance: loadStateFromLocalStorage('qAPPAutoBalance') || false,
|
qAPPAutoBalance: loadStateFromLocalStorage('qAPPAutoBalance') || false,
|
||||||
|
qAPPAutoTransactions: loadStateFromLocalStorage('qAPPAutoTransactions') || false,
|
||||||
chatLastSeen: [],
|
chatLastSeen: [],
|
||||||
newTab: null,
|
newTab: null,
|
||||||
tabInfo: {},
|
tabInfo: {},
|
||||||
@ -270,6 +273,22 @@ export default (state = INITIAL_STATE, action) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case ALLOW_QAPP_AUTO_TRANSACTIONS: {
|
||||||
|
saveStateToLocalStorage("qAPPAutoTransactions", true)
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
qAPPAutoTransactions: action.payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
case REMOVE_QAPP_AUTO_TRANSACTIONS: {
|
||||||
|
saveStateToLocalStorage("qAPPAutoTransactions", false)
|
||||||
|
return {
|
||||||
|
...state,
|
||||||
|
qAPPAutoTransactions: action.payload
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
case ALLOW_QAPP_AUTO_LISTS: {
|
case ALLOW_QAPP_AUTO_LISTS: {
|
||||||
saveStateToLocalStorage("qAPPAutoLists", true)
|
saveStateToLocalStorage("qAPPAutoLists", true)
|
||||||
return {
|
return {
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
// IS_USING_PUBLIC_NODE
|
// IS_USING_PUBLIC_NODE
|
||||||
export const IS_USING_PUBLIC_NODE = 'IS_USING_PUBLIC_NODE'
|
export const IS_USING_PUBLIC_NODE = 'IS_USING_PUBLIC_NODE'
|
||||||
|
|
||||||
|
// GET_ARRR_SYNC_STATUS
|
||||||
|
export const GET_ARRR_SYNC_STATUS = 'GET_ARRR_SYNC_STATUS'
|
||||||
|
|
||||||
|
// GET_NODE_INFO
|
||||||
|
export const GET_NODE_INFO = 'GET_NODE_INFO'
|
||||||
|
|
||||||
|
// GET_NODE_STATUS
|
||||||
|
export const GET_NODE_STATUS = 'GET_NODE_STATUS'
|
||||||
|
|
||||||
// ADMIN_ACTION
|
// ADMIN_ACTION
|
||||||
export const ADMIN_ACTION = 'ADMIN_ACTION'
|
export const ADMIN_ACTION = 'ADMIN_ACTION'
|
||||||
|
|
||||||
@ -123,6 +132,9 @@ export const OPEN_PROFILE = 'OPEN_PROFILE'
|
|||||||
// GET_USER_WALLET
|
// GET_USER_WALLET
|
||||||
export const GET_USER_WALLET = 'GET_USER_WALLET'
|
export const GET_USER_WALLET = 'GET_USER_WALLET'
|
||||||
|
|
||||||
|
// GET_USER_WALLET_TRANSACTIONS
|
||||||
|
export const GET_USER_WALLET_TRANSACTIONS = 'GET_USER_WALLET_TRANSACTIONS'
|
||||||
|
|
||||||
// GET_WALLET_BALANCE
|
// GET_WALLET_BALANCE
|
||||||
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE'
|
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE'
|
||||||
|
|
||||||
|
@ -13,7 +13,10 @@ import {
|
|||||||
processTransactionV2,
|
processTransactionV2,
|
||||||
publishData,
|
publishData,
|
||||||
requestQueueGetAtAddresses,
|
requestQueueGetAtAddresses,
|
||||||
tradeBotCreateRequest
|
tradeBotCreateRequest,
|
||||||
|
getArrrSyncStatus,
|
||||||
|
getNodeInfo,
|
||||||
|
getNodeStatus
|
||||||
} from '../../../utils/classes'
|
} from '../../../utils/classes'
|
||||||
import {appendBuffer} from '../../../utils/utilities'
|
import {appendBuffer} from '../../../utils/utilities'
|
||||||
import {QORT_DECIMALS} from '../../../../../crypto/api/constants'
|
import {QORT_DECIMALS} from '../../../../../crypto/api/constants'
|
||||||
@ -319,6 +322,21 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case actions.GET_ARRR_SYNC_STATUS: {
|
||||||
|
response = await getArrrSyncStatus()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case actions.GET_NODE_INFO: {
|
||||||
|
response = await getNodeInfo()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
|
case actions.GET_NODE_STATUS: {
|
||||||
|
response = await getNodeStatus()
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
case actions.ADMIN_ACTION: {
|
case actions.ADMIN_ACTION: {
|
||||||
let type = data.type
|
let type = data.type
|
||||||
let value = data.value
|
let value = data.value
|
||||||
@ -2701,6 +2719,132 @@ class WebBrowser extends LitElement {
|
|||||||
}
|
}
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case actions.GET_USER_WALLET_TRANSACTIONS: {
|
||||||
|
const requiredFields = ['coin']
|
||||||
|
const missingFields = []
|
||||||
|
let dataSentBack = {}
|
||||||
|
let skip = false
|
||||||
|
let res3
|
||||||
|
requiredFields.forEach((field) => {
|
||||||
|
if (!data[field]) {
|
||||||
|
missingFields.push(field)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
if (missingFields.length > 0) {
|
||||||
|
const missingFieldsString = missingFields.join(', ')
|
||||||
|
const tryAgain = get("walletpage.wchange44")
|
||||||
|
await showErrorAndWait(
|
||||||
|
"MISSING_FIELDS",
|
||||||
|
{
|
||||||
|
id1: missingFieldsString,
|
||||||
|
id2: tryAgain
|
||||||
|
}
|
||||||
|
)
|
||||||
|
dataSentBack['error'] = `Missing fields: ${missingFieldsString}`
|
||||||
|
response = JSON.stringify(dataSentBack)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
if (window.parent.reduxStore.getState().app.qAPPAutoTransactions) {
|
||||||
|
skip = true
|
||||||
|
}
|
||||||
|
if (!skip) {
|
||||||
|
res3 = await showModalAndWait(
|
||||||
|
actions.GET_USER_WALLET_TRANSACTIONS
|
||||||
|
)
|
||||||
|
}
|
||||||
|
if ((res3 && res3.action === 'accept') || skip) {
|
||||||
|
let coin = data.coin
|
||||||
|
if (coin === "QORT") {
|
||||||
|
let qortAddress = window.parent.reduxStore.getState().app.selectedAddress.address
|
||||||
|
try {
|
||||||
|
this.loader.show()
|
||||||
|
response = await parentEpml.request('apiCall', {
|
||||||
|
url: `/transactions/address/${qortAddress}?limit=0&reverse=true`
|
||||||
|
})
|
||||||
|
this.loader.hide()
|
||||||
|
break
|
||||||
|
} catch (error) {
|
||||||
|
this.loader.hide()
|
||||||
|
let myMsg1 = get("browserpage.bchange21")
|
||||||
|
let myMsg2 = get("walletpage.wchange44")
|
||||||
|
await showErrorAndWait("ACTION_FAILED", {id1: myMsg1, id2: myMsg2})
|
||||||
|
const data = {}
|
||||||
|
data['error'] = error.message ? error.message : get("browserpage.bchange21")
|
||||||
|
response = JSON.stringify(data)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
let _url = ``
|
||||||
|
let _body = null
|
||||||
|
switch (coin) {
|
||||||
|
case 'BTC':
|
||||||
|
_url = `/crosschain/btc/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.derivedMasterPublicKey
|
||||||
|
break
|
||||||
|
case 'LTC':
|
||||||
|
_url = `/crosschain/ltc/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
|
||||||
|
break
|
||||||
|
case 'DOGE':
|
||||||
|
_url = `/crosschain/doge/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
|
||||||
|
break
|
||||||
|
case 'DGB':
|
||||||
|
_url = `/crosschain/dgb/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
|
||||||
|
break
|
||||||
|
case 'RVN':
|
||||||
|
_url = `/crosschain/rvn/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
|
||||||
|
break
|
||||||
|
case 'ARRR':
|
||||||
|
_url = `/crosschain/arrr/wallettransactions?apiKey=${this.getApiKey()}`
|
||||||
|
_body = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
|
||||||
|
break
|
||||||
|
default:
|
||||||
|
break
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
this.loader.show()
|
||||||
|
const res = await parentEpml.request('apiCall', {
|
||||||
|
url: _url,
|
||||||
|
method: 'POST',
|
||||||
|
body: _body
|
||||||
|
})
|
||||||
|
if (!res.ok) {
|
||||||
|
this.loader.hide()
|
||||||
|
let myMsg1 = get("browserpage.bchange21")
|
||||||
|
let myMsg2 = get("walletpage.wchange44")
|
||||||
|
await showErrorAndWait("ACTION_FAILED", { id1: myMsg1, id2: myMsg2 })
|
||||||
|
const data = {}
|
||||||
|
data['error'] = get("browserpage.bchange21")
|
||||||
|
response = JSON.stringify(data)
|
||||||
|
break
|
||||||
|
} else {
|
||||||
|
this.loader.hide()
|
||||||
|
response = res
|
||||||
|
break
|
||||||
|
}
|
||||||
|
} catch (error) {
|
||||||
|
this.loader.hide()
|
||||||
|
let myMsg1 = get("browserpage.bchange21")
|
||||||
|
let myMsg2 = get("walletpage.wchange44")
|
||||||
|
await showErrorAndWait("ACTION_FAILED", { id1: myMsg1, id2: myMsg2 })
|
||||||
|
const data = {}
|
||||||
|
data['error'] = error.message ? error.message : get("browserpage.bchange21")
|
||||||
|
response = JSON.stringify(data)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (res3.action === 'reject') {
|
||||||
|
let myMsg1 = get("transactions.declined")
|
||||||
|
let myMsg2 = get("walletpage.wchange44")
|
||||||
|
await showErrorAndWait("DECLINED_REQUEST", { id1: myMsg1, id2: myMsg2 })
|
||||||
|
response = '{"error": "User declined request"}'
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break
|
||||||
|
|
||||||
case actions.GET_WALLET_BALANCE: {
|
case actions.GET_WALLET_BALANCE: {
|
||||||
const requiredFields = ['coin']
|
const requiredFields = ['coin']
|
||||||
const missingFields = []
|
const missingFields = []
|
||||||
@ -5226,7 +5370,6 @@ async function showModalAndWait(type, data) {
|
|||||||
${type === actions.GET_PROFILE_DATA ? `
|
${type === actions.GET_PROFILE_DATA ? `
|
||||||
<div class="modal-subcontainer">
|
<div class="modal-subcontainer">
|
||||||
<p class="modal-paragraph">${get("browserpage.bchange49")}: <span style="font-weight: bold"> ${data.property}</span></p>
|
<p class="modal-paragraph">${get("browserpage.bchange49")}: <span style="font-weight: bold"> ${data.property}</span></p>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
||||||
@ -5294,6 +5437,18 @@ async function showModalAndWait(type, data) {
|
|||||||
<p class="modal-paragraph">${data.text3}</p>
|
<p class="modal-paragraph">${data.text3}</p>
|
||||||
<p class="modal-paragraph">${get("walletpage.wchange36")}: <span>${data.fee}</span></p>
|
<p class="modal-paragraph">${get("walletpage.wchange36")}: <span>${data.fee}</span></p>
|
||||||
` : ''}
|
` : ''}
|
||||||
|
|
||||||
|
${type === actions.GET_USER_WALLET_TRANSACTIONS ? `
|
||||||
|
<div class="modal-subcontainer">
|
||||||
|
<p class="modal-paragraph">Do you give this application permission to retrieve your wallet transactions?</p>
|
||||||
|
<div class="checkbox-row">
|
||||||
|
<label for="transactionsButton" id="transactionsButtonLabel" style="color: var(--black);">
|
||||||
|
Always allow wallet txs to be retrieved automatically
|
||||||
|
</label>
|
||||||
|
<mwc-checkbox style="margin-right: -15px;" id="transactionsButton" ?checked=${window.parent.reduxStore.getState().app.qAPPAutoTransactions}></mwc-checkbox>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
` : ''}
|
||||||
</div>
|
</div>
|
||||||
<div class="modal-buttons">
|
<div class="modal-buttons">
|
||||||
<button id="cancel-button">${get("browserpage.bchange27")}</button>
|
<button id="cancel-button">${get("browserpage.bchange27")}</button>
|
||||||
@ -5365,7 +5520,7 @@ async function showModalAndWait(type, data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
const checkbox1 = modal.querySelector('#abalanceButton')
|
const checkbox1 = modal.querySelector('#balanceButton')
|
||||||
if (checkbox1) {
|
if (checkbox1) {
|
||||||
checkbox1.addEventListener('click', (e) => {
|
checkbox1.addEventListener('click', (e) => {
|
||||||
if (e.target.checked) {
|
if (e.target.checked) {
|
||||||
@ -5394,6 +5549,24 @@ async function showModalAndWait(type, data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const labelButton3 = modal.querySelector('#transactionsButtonLabel')
|
||||||
|
if (labelButton3) {
|
||||||
|
labelButton1.addEventListener('click', () => {
|
||||||
|
this.shadowRoot.getElementById('transactionsButton').click()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
const checkbox3 = modal.querySelector('#transactionsButton')
|
||||||
|
if (checkbox3) {
|
||||||
|
checkbox1.addEventListener('click', (e) => {
|
||||||
|
if (e.target.checked) {
|
||||||
|
window.parent.reduxStore.dispatch(window.parent.reduxAction.removeQAPPAutoTransacions(false))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
window.parent.reduxStore.dispatch(window.parent.reduxAction.allowQAPPAutoTransacions(true))
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
const labelButtonFriendsList = modal.querySelector('#friendsListLabel')
|
const labelButtonFriendsList = modal.querySelector('#friendsListLabel')
|
||||||
if (labelButtonFriendsList) {
|
if (labelButtonFriendsList) {
|
||||||
labelButtonFriendsList.addEventListener('click', () => {
|
labelButtonFriendsList.addEventListener('click', () => {
|
||||||
|
@ -1552,3 +1552,99 @@ export const cancelTradeOfferTradeBot = async (body, keyPair) => {
|
|||||||
throw new Error("Failed to Cancel Sell Order. Try again!")
|
throw new Error("Failed to Cancel Sell Order. Try again!")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const getArrrSyncStatus = async () => {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
const nodeUrl = `${myNode.protocol}://${myNode.domain}:${myNode.port}`
|
||||||
|
const myApiKey = myNode.apiKey
|
||||||
|
const url = `${nodeUrl}/crosschain/arrr/syncstatus?apiKey=${myApiKey}`
|
||||||
|
const arrrSeed = window.parent.reduxStore.getState().app.selectedAddress.arrrWallet.seed58
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: "POST",
|
||||||
|
headers: {
|
||||||
|
Accept: "*/*"
|
||||||
|
},
|
||||||
|
body: arrrSeed
|
||||||
|
})
|
||||||
|
|
||||||
|
let res
|
||||||
|
|
||||||
|
try {
|
||||||
|
res = await response.clone().json()
|
||||||
|
} catch (e) {
|
||||||
|
res = await response.text()
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message || "Error in retrieving arrr sync status")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getNodeInfo = async () => {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
const nodeUrl = `${myNode.protocol}://${myNode.domain}:${myNode.port}`
|
||||||
|
const url = `${nodeUrl}/admin/info`
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
Accept: "*/*"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) console.error("Failed to retrieve node info")
|
||||||
|
|
||||||
|
let res
|
||||||
|
|
||||||
|
try {
|
||||||
|
res = await response.clone().json()
|
||||||
|
} catch (e) {
|
||||||
|
res = await response.text()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.error && res.message) {
|
||||||
|
console.error(res.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message || "Error in retrieving node info")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export const getNodeStatus = async () => {
|
||||||
|
const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node]
|
||||||
|
const nodeUrl = `${myNode.protocol}://${myNode.domain}:${myNode.port}`
|
||||||
|
const url = `${nodeUrl}/admin/status`
|
||||||
|
|
||||||
|
try {
|
||||||
|
const response = await fetch(url, {
|
||||||
|
method: "GET",
|
||||||
|
headers: {
|
||||||
|
Accept: "*/*"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
if (!response.ok) console.error("Failed to retrieve node status")
|
||||||
|
|
||||||
|
let res
|
||||||
|
|
||||||
|
try {
|
||||||
|
res = await response.clone().json()
|
||||||
|
} catch (e) {
|
||||||
|
res = await response.text()
|
||||||
|
}
|
||||||
|
|
||||||
|
if (res.error && res.message) {
|
||||||
|
console.error(res.message)
|
||||||
|
}
|
||||||
|
|
||||||
|
return res
|
||||||
|
} catch (error) {
|
||||||
|
console.error(error.message || "Error in retrieving node status")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user