Skip to content

Commit

Permalink
Further EOS work
Browse files Browse the repository at this point in the history
Fix danish locale
Add raw deeplink scripts for EOS
Trigger prompt via raw deeplinks (tested, not broadcast)
Initial support for QR and TOTP (untested)
Fix i18n keys
Properly visualize EOS params and account
  • Loading branch information
grctest committed Jan 16, 2024
1 parent 628f58f commit 04730b0
Show file tree
Hide file tree
Showing 16 changed files with 538 additions and 135 deletions.
6 changes: 4 additions & 2 deletions src/components/blockchains/operations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@
let thead = ref(['ID', 'Method', 'Info'])
let chain = store.getters['AccountStore/getChain'];
let tbody = ref([
{
field: 'id',
Expand All @@ -39,13 +41,13 @@
{
field: 'method',
fn: data => {
return t(`operations.injected.BTS.${data.method}.method`)
return t(`operations.injected.${chain}.${data.method}.method`)
}
},
{
field: 'info',
fn: data => {
return t(`operations.injected.BTS.${data.method}.tooltip`)
return t(`operations.injected.${chain}.${data.method}.tooltip`)
}
}
]);
Expand Down
2 changes: 1 addition & 1 deletion src/components/local.vue
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@
</router-link>
</span>
<span v-else>
{{ t('common.local.notSupported') }}
{{ t('common.local.unsupported') }}
</span>
</div>
</template>
6 changes: 3 additions & 3 deletions src/components/popups.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
text: !type.id === type.method
? `${type.id}: ${type.method.replaceAll("_", " ")}`
: type.method.replaceAll("_", " "),
tooltip: t(`operations.injected.BTS.${type.method}.tooltip`)
tooltip: t(`operations.injected.${thisChain}.${type.method}.tooltip`)
}
});
}
Expand All @@ -135,8 +135,8 @@
break;
} else {
injectChips.push({
text: `${foundCurrent.id}: ` + t(`operations.injected.BTS.${foundCurrent.method}`),
tooltip: t(`operations.injected.BTS.${foundCurrent.method}.tooltip`)
text: `${foundCurrent.id}: ` + t(`operations.injected.${thisChain}.${foundCurrent.method}`),
tooltip: t(`operations.injected.${thisChain}.${foundCurrent.method}.tooltip`)
})
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/components/popups/transactionrequestpopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,14 @@
{{ t(visualizedParams[page - 1].title) }}
</div>
<div>
{{ t(`operations.injected.BTS.${visualizedParams[page - 1].method}.headers.request`) }}
{{ t(`operations.injected.${props.request.payload.chain}.${visualizedParams[page - 1].method}.headers.request`) }}
</div>
<div
v-for="row in visualizedParams[page - 1].rows"
:key="row.key"
:class="$tt('subtitle2')"
>
{{ t(`operations.injected.BTS.${visualizedParams[page - 1].method}.rows.${row.key}`, row.params) }}
{{ t(`operations.injected.${props.request.payload.chain}.${visualizedParams[page - 1].method}.rows.${row.key}`, row.params) }}
</div>
</ui-card-text>
</ui-card-content>
Expand Down
4 changes: 2 additions & 2 deletions src/components/popups/transactionresultpopup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@
<b>{{ t(visualizedParams[page - 1].title) }}</b>
</div>
<div>
{{ t(`operations.injected.BTS.${visualizedParams[page - 1].method}.headers.result`) }}
{{ t(`operations.injected.${props.request.payload.chain}.${visualizedParams[page - 1].method}.headers.result`) }}
</div>
<div
v-for="row in visualizedParams[page - 1].rows"
:key="row.key"
:class="$tt('subtitle2')"
>
{{ t(`operations.injected.BTS.${visualizedParams[page - 1].method}.rows.${row.key}`, row.params) }}
{{ t(`operations.injected.${props.request.payload.chain}.${visualizedParams[page - 1].method}.rows.${row.key}`, row.params) }}
</div>
</ui-card-text>
</ui-card-content>
Expand Down
30 changes: 22 additions & 8 deletions src/components/qr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
let qrTX;
try {
qrTX = await blockchain.handleQR(data);
qrTX = refChain === "BTS" ? await blockchain.handleQR(data) : JSON.parse(data);
} catch (error) {
console.log(error);
ipcRenderer.send("notify", t("common.qr.promptFailure"));
Expand All @@ -46,11 +46,25 @@
}
let authorizedUse = false;
for (let i = 0; i < qrTX.operations.length; i++) {
let operation = qrTX.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
if (refChain === "BTS") {
for (let i = 0; i < qrTX.operations.length; i++) {
let operation = qrTX.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
}
}
} else if (
refChain === "EOS" ||
refChain === "BEOS" ||
refChain === "TLOS"
) {
for (let i = 0; i < qrTX.actions.length; i++) {
let operation = qrTX.actions[i];
if (settingsRows.value && settingsRows.value.includes(operation.name)) {
authorizedUse = true;
break;
}
}
}
Expand All @@ -71,7 +85,7 @@
origin: 'localhost',
appName: 'qr',
browser: qrChoice.value,
params: qrTX.toObject(),
params: refChain === "BTS" ? qrTX.toObject() : qrTX,
chain: refChain
}
}
Expand Down Expand Up @@ -287,7 +301,7 @@
</router-link>
</span>
<span v-else>
{{ t('common.qr.notSupported') }}
{{ t('common.qr.unsupported') }}
</span>
</div>
</template>
36 changes: 29 additions & 7 deletions src/components/raw-link.vue
Original file line number Diff line number Diff line change
Expand Up @@ -166,17 +166,39 @@
if (apiobj.type === Actions.INJECTED_CALL) {
let tr;
try {
tr = blockchain._parseTransactionBuilder(request.payload.params);
if (chain === "BTS") {
tr = blockchain._parseTransactionBuilder(request.payload.params);
} else if (
chain === "EOS" ||
chain === "BEOS" ||
chain === "TLOS"
) {
tr = JSON.parse(request.payload.params[1]);
}
} catch (error) {
console.log(error)
}
let authorizedUse = false;
for (let i = 0; i < tr.operations.length; i++) {
let operation = tr.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
if (chain === "BTS") {
for (let i = 0; i < tr.operations.length; i++) {
let operation = tr.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
}
}
} else if (
chain === "EOS" ||
chain === "BEOS" ||
chain === "TLOS"
) {
for (let i = 0; i < tr.actions.length; i++) {
let operation = tr.actions[i];
if (settingsRows.value && settingsRows.value.includes(operation.name)) {
authorizedUse = true;
break;
}
}
}
Expand Down Expand Up @@ -316,7 +338,7 @@
</router-link>
</span>
<span v-else>
{{ t('common.totp.notSupported') }}
{{ t('common.totp.unsupported') }}
</span>
</div>
</template>
4 changes: 2 additions & 2 deletions src/components/receipt.vue
Original file line number Diff line number Diff line change
Expand Up @@ -174,14 +174,14 @@
<b>{{ t(visualizedParams[page > 0 ? page - 1 : 0].title) }}</b>
</div>
<div style="margin-bottom: 5px;">
{{ t(`operations.injected.BTS.${visualizedParams[page > 0 ? page - 1 : 0].method}.headers.result`) }}
{{ t(`operations.injected.${chain}.${visualizedParams[page > 0 ? page - 1 : 0].method}.headers.result`) }}
</div>
<div
v-for="row in visualizedParams[page > 0 ? page - 1 : 0].rows"
:key="row.key"
:class="$tt('subtitle2')"
>
{{ t(`operations.injected.BTS.${visualizedParams[page > 0 ? page - 1 : 0].method}.rows.${row.key}`, row.params) }}
{{ t(`operations.injected.${chain}.${visualizedParams[page > 0 ? page - 1 : 0].method}.rows.${row.key}`, row.params) }}
</div>
</ui-card-text>
</ui-card-content>
Expand Down
26 changes: 20 additions & 6 deletions src/components/totp.vue
Original file line number Diff line number Diff line change
Expand Up @@ -263,11 +263,25 @@
}
let authorizedUse = false;
for (let i = 0; i < tr.operations.length; i++) {
let operation = tr.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
if (chain === "BTS") {
for (let i = 0; i < tr.operations.length; i++) {
let operation = tr.operations[i];
if (settingsRows.value && settingsRows.value.includes(operation[0])) {
authorizedUse = true;
break;
}
}
} else if (
chain === "EOS" ||
chain === "BEOS" ||
chain === "TLOS"
) {
for (let i = 0; i < tr.actions.length; i++) {
let operation = tr.actions[i];
if (settingsRows.value && settingsRows.value.includes(operation.name)) {
authorizedUse = true;
break;
}
}
}
Expand Down Expand Up @@ -464,7 +478,7 @@
</router-link>
</span>
<span v-else>
{{ t('common.totp.notSupported') }}
{{ t('common.totp.unsupported') }}
</span>
</div>
</template>
Loading

0 comments on commit 04730b0

Please sign in to comment.