13
13
<template v-else >
14
14
<TransactionOverview
15
15
:transaction =" completeTransaction"
16
+ :additional-tag =" isAeppChatSuperhero
17
+ ? $t('modals.confirmTransactionSign.superheroChat')
18
+ : null"
16
19
/>
20
+ <div
21
+ v-if =" isAeppChatSuperhero || error"
22
+ class =" subtitle"
23
+ :class =" { warning: !!error }"
24
+ >
25
+ <template v-if =" !! error " >
26
+ {{ $t('modals.confirmTransactionSign.unableToExecute') }}
27
+ </template >
28
+ <template v-else >
29
+ <span class =" app-name" >{{ $t('modals.confirmTransactionSign.superheroChat') }}</span >
30
+ {{ $t('modals.confirmTransactionSign.confirmSigning') }}
31
+ </template >
32
+ </div >
17
33
<DetailsItem
18
34
v-if =" !!error"
19
35
:label =" $t('pages.transactionDetails.reason')"
20
36
:value =" error"
21
37
class =" reason"
22
38
data-cy =" reason"
23
39
/>
40
+ <DetailsItem
41
+ v-if =" decodedCallData?.functionName"
42
+ :label =" $t('modals.confirmTransactionSign.functionName')"
43
+ :value =" decodedCallData.functionName"
44
+ />
24
45
25
46
<template v-if =" (isDex || isDexAllowance ) && tokenList .length " >
26
47
<TransactionDetailsPoolTokenRow
86
107
expandable
87
108
:label =" $t('transaction.advancedDetails')"
88
109
>
110
+ <DetailsItem
111
+ v-if =" decodedCallData?.functionName"
112
+ :label =" $t('modals.confirmTransactionSign.functionName')"
113
+ :value =" decodedCallData.functionName"
114
+ />
115
+ <DetailsItem
116
+ v-if =" transactionArguments"
117
+ :label =" $t('modals.confirmTransactionSign.arguments')"
118
+ :value =" transactionArguments"
119
+ />
89
120
<DetailsItem
90
121
v-for =" key in filteredTxFields"
91
122
:key =" key"
@@ -133,6 +164,7 @@ import BigNumber from 'bignumber.js';
133
164
import { Encoded , getExecutionCost } from ' @aeternity/aepp-sdk' ;
134
165
import { ContractByteArrayEncoder , BytecodeContractCallEncoder } from ' @aeternity/aepp-calldata' ;
135
166
167
+ import JsonBig from ' @/lib/json-big' ;
136
168
import type {
137
169
ITokenResolved ,
138
170
ITransaction ,
@@ -142,8 +174,10 @@ import type {
142
174
TxFunctionRaw ,
143
175
} from ' @/types' ;
144
176
import { tg } from ' @/store/plugins/languages' ;
177
+ import { AeDecodedCallData } from ' @/protocols/aeternity/types' ;
145
178
import { RejectedByUserError } from ' @/lib/errors' ;
146
179
import {
180
+ SUPERHERO_CHAT_URL ,
147
181
PROTOCOL_AETERNITY ,
148
182
TX_DIRECTION ,
149
183
} from ' @/constants' ;
@@ -241,11 +275,16 @@ export default defineComponent({
241
275
const loading = ref (false );
242
276
const error = ref (' ' );
243
277
const verifying = ref (false );
278
+ const decodedCallData = ref <AeDecodedCallData | undefined >();
244
279
245
280
const availableTokens = useState (' fungibleTokens' , ' availableTokens' );
246
281
const getTxSymbol = useGetter (' getTxSymbol' );
247
282
const getTxAmountTotal = useGetter (' getTxAmountTotal' );
248
283
284
+ const isAeppChatSuperhero = computed (
285
+ () => ` ${popupProps .value ?.app ?.protocol }//${popupProps .value ?.app ?.name } ` === SUPERHERO_CHAT_URL ,
286
+ );
287
+
249
288
const transactionWrapped = computed (
250
289
(): Partial <ITransaction > => ({ tx: popupProps .value ?.tx as ITx }),
251
290
);
@@ -312,6 +351,10 @@ export default defineComponent({
312
351
() => txFunction .value && DEX_TRANSACTION_TAGS [txFunction .value ] === DEX_PROVIDE_LIQUIDITY ,
313
352
);
314
353
354
+ const transactionArguments = computed (() => decodedCallData .value ?.args ?.length
355
+ ? JsonBig .stringify (decodedCallData .value .args )
356
+ : undefined );
357
+
315
358
function getTokens(txParams : ITx ): ITokenResolved [] {
316
359
if (! isDex .value && ! isDexAllowance .value ) {
317
360
return [singleToken .value ];
@@ -404,7 +447,7 @@ export default defineComponent({
404
447
}
405
448
}
406
449
407
- async function loadAdditionalDexInfo () {
450
+ async function loadAdditionalContractCallInfo () {
408
451
if (popupProps .value ?.tx ?.contractId && popupProps .value .tx .callData ) {
409
452
try {
410
453
loading .value = true ;
@@ -420,13 +463,15 @@ export default defineComponent({
420
463
421
464
const bytecodeContractCallEncoder = new BytecodeContractCallEncoder (bytecode );
422
465
423
- const rawTxParams = bytecodeContractCallEncoder .decodeCall (
466
+ decodedCallData . value = bytecodeContractCallEncoder .decodeCall (
424
467
popupProps .value .tx .callData ,
425
- ) as any ;
468
+ ) as AeDecodedCallData ;
469
+
470
+ if (! decodedCallData .value ) return ;
426
471
427
472
const txParams = {
428
- function: rawTxParams .functionName as TxFunctionRaw ,
429
- arguments: rawTxParams .args .map ((arg : any ) => ({
473
+ function: decodedCallData . value .functionName as TxFunctionRaw ,
474
+ arguments: decodedCallData . value .args .map ((arg : any ) => ({
430
475
type: Array .isArray (arg ) ? ' list' : ' any' ,
431
476
value: Array .isArray (arg ) ? arg .map ((element ) => ({ value: element })) : arg ,
432
477
})) as TxArguments [],
@@ -462,7 +507,7 @@ export default defineComponent({
462
507
if (popupProps .value ) {
463
508
await Promise .all ([
464
509
verifyTransaction (),
465
- loadAdditionalDexInfo (),
510
+ loadAdditionalContractCallInfo (),
466
511
]);
467
512
} else {
468
513
error .value = t (' modals.transaction-failed.msg' );
@@ -474,37 +519,40 @@ export default defineComponent({
474
519
});
475
520
476
521
return {
477
- AnimatedSpinner ,
478
522
AE_SYMBOL ,
523
+ AnimatedSpinner ,
479
524
PROTOCOL_AETERNITY ,
480
525
TX_FIELDS_TO_DISPLAY ,
526
+ cancel ,
527
+ completeTransaction ,
528
+ decodedCallData ,
481
529
error ,
482
530
executionCost ,
483
- verifying ,
484
- loading ,
485
- showAdvanced ,
486
- transactionWrapped ,
487
- popupProps ,
488
531
filteredTxFields ,
489
- completeTransaction ,
490
- tokenList ,
491
- tokenAmount ,
492
- tokenSymbol ,
493
- totalAmount ,
494
- swapDirection ,
495
- swapDirectionTranslation ,
496
- isSwap ,
532
+ getLabels ,
533
+ getTxKeyLabel ,
534
+ getTxSymbol ,
535
+ isAeppChatSuperhero ,
497
536
isDex ,
498
537
isDexAllowance ,
499
538
isHash ,
539
+ isSwap ,
500
540
isTransactionAex9 ,
541
+ loading ,
542
+ nameAeFee ,
543
+ popupProps ,
544
+ showAdvanced ,
545
+ swapDirection ,
546
+ swapDirectionTranslation ,
501
547
swapTokenAmountData ,
502
- getTxSymbol ,
548
+ tokenAmount ,
549
+ tokenList ,
550
+ tokenSymbol ,
551
+ totalAmount ,
552
+ transactionArguments ,
553
+ transactionWrapped ,
503
554
txAeFee ,
504
- nameAeFee ,
505
- getLabels ,
506
- cancel ,
507
- getTxKeyLabel ,
555
+ verifying ,
508
556
};
509
557
},
510
558
});
@@ -523,6 +571,19 @@ export default defineComponent({
523
571
height : 56px ;
524
572
}
525
573
574
+ .subtitle {
575
+ margin : 8px 0 ;
576
+ color : variables .$color-grey-light ;
577
+
578
+ & .warning {
579
+ color : variables .$color-warning ;
580
+ }
581
+
582
+ .app-name {
583
+ color : variables .$color-white ;
584
+ }
585
+ }
586
+
526
587
.transaction-overview {
527
588
margin-bottom : 16px ;
528
589
}
0 commit comments