Skip to content

Commit 78c47e9

Browse files
committed
Fixes & cleanup
Fix private key signup method Removed TUSC Reset prompt operation permission scope upon switching blockchain accounts
1 parent 249f2a7 commit 78c47e9

19 files changed

+123
-139
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ The EOS blockchain has their own native javascript library that can be used (e.g
4040

4141
The wallet now also supports deeplinks, encrypted deeplinks, qr codes and local json files for generating blockchain request prompts for approval & broadcast with the BeetEOS wallet. These input methods do not require external packages, and can be stored for later use.
4242

43-
Supported blockchains: Bitshares, Bitshares testnet, TUSC, EOS, BEOS, TLOS.
43+
Supported blockchains: Bitshares, Bitshares testnet, EOS, BEOS, TLOS.
4444

4545
## For end users
4646

@@ -56,7 +56,7 @@ BeetEOS is an [electron-based app](https://www.electronjs.org) for [cross-platfo
5656

5757
To run BeetEOS it's simply a case of
5858

59-
``` bash
59+
```bash
6060
# clone
6161
git clone https://github.com/beetapp/beeteos
6262
cd beeteos

src/background.js

+30-22
Original file line numberDiff line numberDiff line change
@@ -423,8 +423,9 @@ async function _parseDeeplink(
423423
}
424424

425425
if (request.payload.method === Actions.INJECTED_CALL) {
426+
console.log({req: request.payload.params})
426427
let authorizedUse = false;
427-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
428+
if (["BTS", "BTS_TEST"].includes(chain)) {
428429
let tr;
429430
try {
430431
tr = await blockchain._parseTransactionBuilder(
@@ -443,16 +444,20 @@ async function _parseDeeplink(
443444
}
444445
}
445446
} else if (["EOS", "BEOS", "TLOS"].includes(chain)) {
446-
if (request.payload.params.actions) {
447-
for (
448-
let i = 0;
449-
i < request.payload.params.actions.length;
450-
i++
451-
) {
452-
let operation = request.payload.params.actions[i];
453-
if (settingsRows && settingsRows.includes(operation.name)) {
454-
authorizedUse = true;
455-
break;
447+
if (request.payload.params && request.payload.params.length > 1) {
448+
const actions = JSON.parse(request.payload.params[1]).actions;
449+
450+
if (actions) {
451+
for (
452+
let i = 0;
453+
i < actions.length;
454+
i++
455+
) {
456+
let operation = actions[i];
457+
if (settingsRows && settingsRows.includes(operation.name)) {
458+
authorizedUse = true;
459+
break;
460+
}
456461
}
457462
}
458463
}
@@ -680,6 +685,10 @@ const createWindow = async () => {
680685
responses["getAccessType"] = blockchain.getAccessType();
681686
}
682687

688+
if (methods.includes("getSignUpInput")) {
689+
responses["getSignUpInput"] = blockchain.getSignUpInput();
690+
}
691+
683692
if (methods.includes("getImportOptions")) {
684693
responses["getImportOptions"] = blockchain.getImportOptions();
685694
}
@@ -917,7 +926,7 @@ const createWindow = async () => {
917926

918927
let parsedData = JSON.parse(qrData);
919928
let authorizedUse = false;
920-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
929+
if (["BTS", "BTS_TEST"].includes(chain)) {
921930
const ops = parsedData.operations[0].operations;
922931
for (let i = 0; i < ops.length; i++) {
923932
let operation = ops[i];
@@ -946,7 +955,7 @@ const createWindow = async () => {
946955
if (authorizedUse) {
947956
let qrTX;
948957
try {
949-
qrTX = ["BTS", "BTS_TEST", "TUSC"].includes(chain)
958+
qrTX = ["BTS", "BTS_TEST"].includes(chain)
950959
? await blockchain.handleQR(
951960
JSON.stringify(parsedData.operations[0])
952961
)
@@ -964,7 +973,7 @@ const createWindow = async () => {
964973
origin: "localhost",
965974
appName: "qr",
966975
browser: qrChoice,
967-
params: ["BTS", "BTS_TEST", "TUSC"].includes(chain)
976+
params: ["BTS", "BTS_TEST"].includes(chain)
968977
? qrTX.toObject()
969978
: qrTX,
970979
chain: chain,
@@ -1121,7 +1130,6 @@ const createWindow = async () => {
11211130
"explore.beos.world",
11221131
"blocksights.info",
11231132
"telos.eosx.io",
1124-
"wallet.tusc.network",
11251133
];
11261134
ipcMain.on("openURL", (event, arg) => {
11271135
try {
@@ -1406,9 +1414,11 @@ if (currentOS === "win32" || currentOS === "linux") {
14061414
console.log(error);
14071415
return;
14081416
}
1409-
1410-
let deeplinkingUrl = deeplink.includes("beeteos://api/") ? deeplink.split("beeteos://api/")[1] : deeplink.split("rawbeeteos://api/")[1];
1411-
1417+
1418+
let deeplinkingUrl = deeplink.includes("beeteos://api/")
1419+
? deeplink.split("beeteos://api/")[1]
1420+
: deeplink.split("rawbeeteos://api/")[1];
1421+
14121422
let qs;
14131423
try {
14141424
qs = queryString.parse(deeplinkingUrl);
@@ -1419,9 +1429,7 @@ if (currentOS === "win32" || currentOS === "linux") {
14191429

14201430
if (qs) {
14211431
mainWindow.webContents.send(
1422-
deeplink.includes("raw")
1423-
? "rawdeeplink"
1424-
: "deeplink",
1432+
deeplink.includes("raw") ? "rawdeeplink" : "deeplink",
14251433
qs
14261434
);
14271435
}
@@ -1478,7 +1486,7 @@ if (currentOS === "win32" || currentOS === "linux") {
14781486
}
14791487

14801488
if (qs) {
1481-
dialog.showErrorBox("Error", JSON.stringify({qs: qs}));
1489+
dialog.showErrorBox("Error", JSON.stringify({ qs: qs }));
14821490
mainWindow.webContents.send(urlType, qs);
14831491
}
14841492
});

src/components/blockchains/ImportKeys.vue

+3-3
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
let privateKey = ref("");
4949
async function next() {
5050
let authorities = {};
51-
if (requiredFields.value.privateKey != null) {
51+
if (requiredFields.value && requiredFields.value.privateKey) {
5252
authorities.privateKey = privateKey.value;
5353
}
5454
@@ -107,7 +107,7 @@
107107
{{ t('common.keys_cta') }}
108108
</p>
109109

110-
<template v-if="requiredFields.privateKey !== null">
110+
<template v-if="requiredFields && requiredFields.privateKey">
111111
<p class="mb-2 font-weight-bold">
112112
{{ t(accessType == 'account' ? 'common.active_authority' : 'common.public_authority') }}
113113
</p>
@@ -131,7 +131,7 @@
131131
{{ t('common.back_btn') }}
132132
</ui-button>
133133

134-
<span v-if="requiredFields.privateKey != null">
134+
<span v-if="requiredFields && requiredFields.privateKey">
135135
<ui-button
136136
v-if="accountname !== '' && privateKey !== ''"
137137
raised

src/components/blockchains/bitshares/ImportBinFile.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
const emit = defineEmits(['back', 'continue', 'imported']);
1616
1717
onMounted(() => {
18-
if (!["BTS", "BTS_TEST", "TUSC"].includes(props.chain)) {
18+
if (!["BTS", "BTS_TEST"].includes(props.chain)) {
1919
throw "Unsupported chain!";
2020
}
2121
})

src/components/blockchains/bitshares/ImportCloudPass.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
const emit = defineEmits(['back', 'continue', 'imported']);
1616
1717
onMounted(() => {
18-
if (!["BTS", "BTS_TEST", "TUSC"].includes(props.chain)) {
18+
if (!["BTS", "BTS_TEST"].includes(props.chain)) {
1919
throw "Unsupported chain!";
2020
}
2121
})

src/components/local.vue

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, computed, onMounted, toRaw } from 'vue';
2+
import { ref, computed, onMounted, watch, toRaw } from 'vue';
33
import { useI18n } from 'vue-i18n';
44
55
import AccountSelect from "./account-select";
@@ -24,6 +24,19 @@
2424
return store.getters['AccountStore/getChain'];
2525
});
2626
27+
let selectedAccount = computed(() => {
28+
if (!store.state.WalletStore.isUnlocked) {
29+
return;
30+
}
31+
return store.getters["AccountStore/getCurrentSafeAccount"]()
32+
})
33+
34+
watch(selectedAccount, async (newVal, oldVal) => {
35+
console.log("User changed account - resetting configured scope!")
36+
chosenScope.value = null;
37+
selectedRows.value = null;
38+
}, {immediate: true});
39+
2740
let supportsLocal = ref(false);
2841
let operationTypes = ref([]);
2942
onMounted(async () => {

src/components/main-menu.vue

+6-6
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@
322322
} = args;
323323
324324
if (
325-
(["BTS", "BTS_TEST", "TUSC"].includes(chain)) &&
325+
(["BTS", "BTS_TEST"].includes(chain)) &&
326326
((!visualizedAccount && account && !account.accountName) || !visualizedParams)
327327
) {
328328
console.log("Missing required fields for injected call");
@@ -373,7 +373,7 @@
373373
374374
window.electron.popupApproved(request.id, async (args) => {
375375
let _request = request;
376-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
376+
if (["BTS", "BTS_TEST"].includes(chain)) {
377377
if (request.payload.memo) {
378378
let from;
379379
let to;
@@ -441,7 +441,7 @@
441441
}
442442
443443
let activeKey;
444-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
444+
if (["BTS", "BTS_TEST"].includes(chain)) {
445445
try {
446446
activeKey = request.payload.account_id
447447
? store.getters['AccountStore/getActiveKey'](request)
@@ -466,7 +466,7 @@
466466
467467
if (txType == "signAndBroadcast") {
468468
try {
469-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
469+
if (["BTS", "BTS_TEST"].includes(chain)) {
470470
finalResult = await window.electron.blockchainRequest({
471471
methods: ["signAndBroadcast"],
472472
account: null,
@@ -539,7 +539,7 @@
539539
window.electron.popupApproved(request.id, async (result) => {
540540
541541
let activeKey;
542-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
542+
if (["BTS", "BTS_TEST"].includes(chain)) {
543543
try {
544544
activeKey = request.payload.account_id
545545
? store.getters['AccountStore/getActiveKey'](request)
@@ -564,7 +564,7 @@
564564
565565
let transaction;
566566
try {
567-
if (["BTS", "BTS_TEST", "TUSC"].includes(chain)) {
567+
if (["BTS", "BTS_TEST"].includes(chain)) {
568568
transaction = await window.electron.requestSignature(request.payload.params, signingKey);
569569
} else if (["EOS", "BEOS", "TLOS"].includes(chain)) {
570570
transaction = await window.electron.requestSignature(JSON.parse(request.payload.params[1]), signingKey);

src/components/qr.vue

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { ref, computed, watchEffect, inject, onMounted, toRaw } from 'vue';
2+
import { ref, computed, watchEffect, inject, watch, onMounted, toRaw } from 'vue';
33
import { useI18n } from 'vue-i18n';
44
55
import AccountSelect from "./account-select";
@@ -38,6 +38,19 @@
3838
return store.getters['AccountStore/getChain'];
3939
});
4040
41+
let selectedAccount = computed(() => {
42+
if (!store.state.WalletStore.isUnlocked) {
43+
return;
44+
}
45+
return store.getters["AccountStore/getCurrentSafeAccount"]()
46+
})
47+
48+
watch(selectedAccount, async (newVal, oldVal) => {
49+
console.log("User changed account - resetting configured scope!")
50+
chosenScope.value = null;
51+
selectedRows.value = null;
52+
}, {immediate: true});
53+
4154
async function evaluateQR (data) {
4255
if (!data) {
4356
return;

src/components/raw-link.vue

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
88
import store from '../store/index.js';
99
import router from '../router/index.js';
10+
import { watch } from 'vue';
1011
1112
const { t } = useI18n({ useScope: 'global' });
1213
@@ -35,6 +36,19 @@
3536
}
3637
}
3738
39+
let selectedAccount = computed(() => {
40+
if (!store.state.WalletStore.isUnlocked) {
41+
return;
42+
}
43+
return store.getters["AccountStore/getCurrentSafeAccount"]()
44+
})
45+
46+
watch(selectedAccount, async (newVal, oldVal) => {
47+
console.log("User changed account - resetting configured scope!")
48+
chosenScope.value = null;
49+
selectedRows.value = null;
50+
}, {immediate: true});
51+
3852
let chain = computed(() => {
3953
return store.getters['AccountStore/getChain'];
4054
});

src/components/totp.vue

+14-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script setup>
2-
import { watchEffect, ref, computed, onMounted, toRaw } from 'vue';
2+
import { watchEffect, ref, computed, onMounted, watch, toRaw } from 'vue';
33
import { useI18n } from 'vue-i18n';
44
55
import AccountSelect from "./account-select";
@@ -13,6 +13,19 @@
1313
let chain = computed(() => {
1414
return store.getters['AccountStore/getChain'];
1515
});
16+
17+
let selectedAccount = computed(() => {
18+
if (!store.state.WalletStore.isUnlocked) {
19+
return;
20+
}
21+
return store.getters["AccountStore/getCurrentSafeAccount"]()
22+
})
23+
24+
watch(selectedAccount, async (newVal, oldVal) => {
25+
console.log("User changed account - resetting configured scope!")
26+
chosenScope.value = null;
27+
selectedRows.value = null;
28+
}, {immediate: true});
1629
1730
let compatible = ref(false);
1831
let operationTypes = ref([]);

src/config/config.js

-20
Original file line numberDiff line numberDiff line change
@@ -52,26 +52,6 @@ let _blockchains = {
5252
},
5353
],
5454
},
55-
TUSC: {
56-
coreSymbol: "TUSC",
57-
name: "The Universal Settlement Coin",
58-
chainId:
59-
"eb938e2a955e39e335120d0a99f3b9f8c04a9ed5690275ea5037d6bbadfc6cf3",
60-
nodeList: [
61-
{
62-
url: "wss://api.tusc.network/wallet",
63-
},
64-
{
65-
url: "wss://api.cryptotusc.com",
66-
},
67-
{
68-
url: "wss://tuscapi.gambitweb.com",
69-
},
70-
{
71-
url: "wss://api.readyrhino.one",
72-
},
73-
],
74-
},
7555
EOS: {
7656
coreSymbol: "EOS",
7757
name: "EOSmainnet",

0 commit comments

Comments
 (0)