(args)
| 569 | } |
| 570 | |
| 571 | function decodeConfirmTx(args) { |
| 572 | const { |
| 573 | tx: { |
| 574 | txParams, |
| 575 | txParams: { value, gas, from, to }, |
| 576 | hash, |
| 577 | }, |
| 578 | conversionRate, |
| 579 | currentCurrency, |
| 580 | actionKey, |
| 581 | primaryCurrency, |
| 582 | selectedAddress, |
| 583 | } = args; |
| 584 | |
| 585 | const ticker = getTicker(args.ticker); |
| 586 | const totalEth = hexToBN(value); |
| 587 | const renderTotalEth = `${renderFromWei(totalEth)} ${ticker}`; |
| 588 | const renderTotalEthFiat = weiToFiat( |
| 589 | totalEth, |
| 590 | conversionRate, |
| 591 | currentCurrency, |
| 592 | ); |
| 593 | |
| 594 | const totalGas = calculateTotalGas(txParams); |
| 595 | const totalValue = isBN(totalEth) ? totalEth.add(totalGas) : totalGas; |
| 596 | |
| 597 | const renderFrom = renderFullAddress(from); |
| 598 | const renderTo = renderFullAddress(to); |
| 599 | |
| 600 | const tokenList = Engine.context.TokenListController.state.tokenList; |
| 601 | let symbol; |
| 602 | if (renderTo in tokenList) { |
| 603 | symbol = tokenList[renderTo].symbol; |
| 604 | } |
| 605 | let transactionType; |
| 606 | if (actionKey === strings('transactions.approve')) |
| 607 | transactionType = TRANSACTION_TYPES.APPROVE; |
| 608 | else if (actionKey === strings('transactions.swaps_transaction')) |
| 609 | transactionType = TRANSACTION_TYPES.SWAPS_TRANSACTION; |
| 610 | else if ( |
| 611 | actionKey === strings('transactions.smart_contract_interaction') || |
| 612 | (!actionKey.includes(strings('transactions.sent')) && |
| 613 | !actionKey.includes(strings('transactions.received'))) |
| 614 | ) |
| 615 | transactionType = TRANSACTION_TYPES.SITE_INTERACTION; |
| 616 | else if (renderFrom === selectedAddress) |
| 617 | transactionType = TRANSACTION_TYPES.SENT; |
| 618 | else if (renderTo === selectedAddress) |
| 619 | transactionType = TRANSACTION_TYPES.RECEIVED; |
| 620 | const transactionElement = { |
| 621 | renderTo, |
| 622 | renderFrom, |
| 623 | actionKey: symbol ? `${symbol} ${actionKey}` : actionKey, |
| 624 | value: renderTotalEth, |
| 625 | fiatValue: renderTotalEthFiat, |
| 626 | transactionType, |
| 627 | }; |
| 628 | let transactionDetails = { |
no test coverage detected