mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-02-14 11:15:50 +00:00
Add qortalRequest for altcoin wallets
This commit is contained in:
parent
bcef0aae61
commit
74871a81ef
@ -729,7 +729,8 @@
|
||||
"bchange45": "Encrypt",
|
||||
"bchange46": "Do you give this application permission to save the following file",
|
||||
"bchange47": "Instant publish - requires",
|
||||
"bchange48": "Do you give this application permission to send you notifications"
|
||||
"bchange48": "Do you give this application permission to send you notifications",
|
||||
"bchange49": "Do you give this application permission to get your wallet information?"
|
||||
},
|
||||
"datapage": {
|
||||
"dchange1": "Data Management",
|
||||
|
@ -19,6 +19,9 @@ export const JOIN_GROUP = 'JOIN_GROUP';
|
||||
// DEPLOY_AT action
|
||||
export const DEPLOY_AT = 'DEPLOY_AT';
|
||||
|
||||
// GET_USER_WALLET action
|
||||
export const GET_USER_WALLET = 'GET_USER_WALLET';
|
||||
|
||||
// GET_WALLET_BALANCE action
|
||||
export const GET_WALLET_BALANCE = 'GET_WALLET_BALANCE';
|
||||
|
||||
|
@ -2059,6 +2059,70 @@ class WebBrowser extends LitElement {
|
||||
break
|
||||
}
|
||||
|
||||
case actions.GET_USER_WALLET: {
|
||||
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
|
||||
}
|
||||
const res3 = await showModalAndWait(
|
||||
actions.GET_USER_WALLET
|
||||
);
|
||||
|
||||
if (res3.action === 'accept') {
|
||||
let coin = data.coin;
|
||||
let userWallet = {};
|
||||
|
||||
switch (coin) {
|
||||
case 'QORT':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.base58PublicKey
|
||||
break
|
||||
case 'BTC':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.btcWallet.derivedMasterPublicKey
|
||||
break
|
||||
case 'LTC':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.ltcWallet.derivedMasterPublicKey
|
||||
break
|
||||
case 'DOGE':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.dogeWallet.derivedMasterPublicKey
|
||||
break
|
||||
case 'DGB':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.dgbWallet.derivedMasterPublicKey
|
||||
break
|
||||
case 'RVN':
|
||||
userWallet['address'] = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.address
|
||||
userWallet['publickey'] = window.parent.reduxStore.getState().app.selectedAddress.rvnWallet.derivedMasterPublicKey
|
||||
break
|
||||
case 'ARRR':
|
||||
break
|
||||
default:
|
||||
break
|
||||
}
|
||||
response = JSON.stringify(userWallet);
|
||||
break;
|
||||
} else if (res3.action === 'reject') {
|
||||
response = '{"error": "User declined request"}';
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case actions.GET_WALLET_BALANCE: {
|
||||
const requiredFields = ['coin']
|
||||
const missingFields = []
|
||||
|
Loading…
x
Reference in New Issue
Block a user