feat: allow decoding input as utf-8

pull/1484/head
zachdaniel 6 years ago
parent 292bbe7c75
commit 343a9bd083
  1. 1
      apps/block_scout_web/assets/js/app.js
  2. 10
      apps/block_scout_web/assets/js/lib/transaction_input_dropdown.js
  3. 30
      apps/block_scout_web/lib/block_scout_web/templates/transaction/overview.html.eex
  4. 3
      apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
  5. 49
      apps/block_scout_web/priv/gettext/default.pot
  6. 51
      apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po

@ -46,6 +46,7 @@ import './lib/stop_propagation'
import './lib/token_balance_dropdown'
import './lib/token_balance_dropdown_search'
import './lib/token_transfers_toggle'
import './lib/transaction_input_dropdown'
import './lib/async_listing_load'
import './lib/tooltip'
import './lib/try_api'

@ -0,0 +1,10 @@
import $ from 'jquery'
$('.tx-input-dropdown').click(function (e) {
var el = $(e.currentTarget)
var target = $(el.attr('data-target'))
target.show()
target.siblings('.transaction-input').hide()
$('#tx-input-decoding-button').text(el.text())
})

@ -93,15 +93,37 @@
<dl class="row">
<dt class="col-sm-3 text-muted"><%= gettext "Raw Input" %></dt>
<dd class="col-sm-9">
<div class="raw-transaction-input">
<div class="transaction-input" id="tx-raw-input">
<button type="button" class="copy icon-link mb-1" data-toggle="tooltip" data-placement="top" data-clipboard-text="<%= @transaction.input %>" aria-label="Copy Value">
<i class="fas fa-clone"></i>
</button>
<div class="tile tile-muted">
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0"><code><%= @transaction.input %></code></pre>
</div>
</div>
<div class="transaction-input" id="tx-utf8-input" style="display: none;">
<button type="button" class="copy icon-link mb-1" data-toggle="tooltip" data-placement="top" data-clipboard-text="<%= @transaction.input %>" aria-label="Copy Value">
<i class="fas fa-clone"></i>
</button>
<div class="tile tile-muted">
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0">
<code><%= @transaction.input %></code>
</pre>
<pre class="pre-scrollable pre-scrollable-shorty pre-wrap mb-0"><code><%= @transaction.input.bytes %></code></pre>
</div>
</div>
<div class="dropdown pt-1">
<button class="btn btn-secondary btn-sm dropdown-toggle" type="button" id="tx-input-decoding-button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<%= gettext("Hex (Default)") %>
</button>
<div class="dropdown-menu" aria-labelledby="transaction-input-decoding-button">
<a class="dropdown-item tx-input-dropdown" data-target="#tx-raw-input" id="tx-dropdown-raw">
<%= gettext("Hex (Default)") %>
</a>
<a class="dropdown-item tx-input-dropdown" data-target="#tx-utf8-input" id="tx-dropdown-utf8">
<%= gettext("UTF-8") %>
</a>
</div>
</div>
</dd>

@ -91,6 +91,9 @@ defmodule BlockScoutWeb.TransactionView do
def contract_creation?(_), do: false
# def utf8_encode() do
# end
def fee(%Transaction{} = transaction) do
{_, value} = Chain.fee(transaction, :wei)
value

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:118
#: lib/block_scout_web/views/transaction_view.ex:121
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -278,12 +278,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:195
#: lib/block_scout_web/views/transaction_view.ex:198
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:194
#: lib/block_scout_web/views/transaction_view.ex:197
msgid "Contract Creation"
msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:125
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:120
#: lib/block_scout_web/views/transaction_view.ex:123
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -392,7 +392,7 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26
#: lib/block_scout_web/templates/transaction/overview.html.eex:118
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether"
msgstr ""
@ -431,7 +431,7 @@ msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:131
#: lib/block_scout_web/templates/transaction/overview.html.eex:153
msgid "Gas"
msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:270
#: lib/block_scout_web/views/transaction_view.ex:248
#: lib/block_scout_web/views/transaction_view.ex:251
msgid "Internal Transactions"
msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:143
#: lib/block_scout_web/templates/transaction/overview.html.eex:165
msgid "Limit"
msgstr ""
@ -521,7 +521,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:249
#: lib/block_scout_web/views/transaction_view.ex:252
msgid "Logs"
msgstr ""
@ -533,7 +533,7 @@ msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:109
#: lib/block_scout_web/views/transaction_view.ex:112
msgid "Max of"
msgstr ""
@ -662,8 +662,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55
#: lib/block_scout_web/views/transaction_view.ex:117
#: lib/block_scout_web/views/transaction_view.ex:151
#: lib/block_scout_web/views/transaction_view.ex:120
#: lib/block_scout_web/views/transaction_view.ex:154
msgid "Pending"
msgstr ""
@ -768,7 +768,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:119
#: lib/block_scout_web/views/transaction_view.ex:122
msgid "Success"
msgstr ""
@ -879,7 +879,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:193
#: lib/block_scout_web/views/transaction_view.ex:196
msgid "Token Transfer"
msgstr ""
@ -891,7 +891,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:247
#: lib/block_scout_web/views/transaction_view.ex:250
msgid "Token Transfers"
msgstr ""
@ -932,7 +932,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:196
#: lib/block_scout_web/views/transaction_view.ex:199
msgid "Transaction"
msgstr ""
@ -999,7 +999,7 @@ msgid "Unique Token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:136
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
msgid "Used"
msgstr ""
@ -1020,7 +1020,7 @@ msgid "Validations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:118
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
msgid "Value"
msgstr ""
@ -1642,3 +1642,14 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/overview.html.eex:85
msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
#: lib/block_scout_web/templates/transaction/overview.html.eex:121
msgid "Hex (Default)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:125
msgid "UTF-8"
msgstr ""

@ -49,7 +49,7 @@ msgid "%{subnetwork} Explorer - BlockScout"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:118
#: lib/block_scout_web/views/transaction_view.ex:121
msgid "(Awaiting internal transactions for status)"
msgstr ""
@ -278,12 +278,12 @@ msgid "Contract Address Pending"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:195
#: lib/block_scout_web/views/transaction_view.ex:198
msgid "Contract Call"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:194
#: lib/block_scout_web/views/transaction_view.ex:197
msgid "Contract Creation"
msgstr ""
@ -377,12 +377,12 @@ msgid "Error trying to fetch balances."
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:122
#: lib/block_scout_web/views/transaction_view.ex:125
msgid "Error: %{reason}"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:120
#: lib/block_scout_web/views/transaction_view.ex:123
msgid "Error: (Awaiting internal transactions for reason)"
msgstr ""
@ -392,7 +392,7 @@ msgstr ""
#: lib/block_scout_web/templates/layout/app.html.eex:51
#: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:19
#: lib/block_scout_web/templates/transaction/_tile.html.eex:26
#: lib/block_scout_web/templates/transaction/overview.html.eex:118
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
#: lib/block_scout_web/views/wei_helpers.ex:72
msgid "Ether"
msgstr "POA"
@ -431,7 +431,7 @@ msgid "GET"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:131
#: lib/block_scout_web/templates/transaction/overview.html.eex:153
msgid "Gas"
msgstr ""
@ -495,7 +495,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:43
#: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:10
#: lib/block_scout_web/views/address_view.ex:270
#: lib/block_scout_web/views/transaction_view.ex:248
#: lib/block_scout_web/views/transaction_view.ex:251
msgid "Internal Transactions"
msgstr ""
@ -513,7 +513,7 @@ msgid "Less than"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:143
#: lib/block_scout_web/templates/transaction/overview.html.eex:165
msgid "Limit"
msgstr ""
@ -521,7 +521,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:21
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:48
#: lib/block_scout_web/templates/transaction_log/index.html.eex:10
#: lib/block_scout_web/views/transaction_view.ex:249
#: lib/block_scout_web/views/transaction_view.ex:252
msgid "Logs"
msgstr ""
@ -533,7 +533,7 @@ msgid "Market Cap"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:109
#: lib/block_scout_web/views/transaction_view.ex:112
msgid "Max of"
msgstr ""
@ -662,8 +662,8 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/layout/_topnav.html.eex:44
#: lib/block_scout_web/templates/transaction/overview.html.eex:55
#: lib/block_scout_web/views/transaction_view.ex:117
#: lib/block_scout_web/views/transaction_view.ex:151
#: lib/block_scout_web/views/transaction_view.ex:120
#: lib/block_scout_web/views/transaction_view.ex:154
msgid "Pending"
msgstr ""
@ -768,7 +768,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/_emission_reward_tile.html.eex:8
#: lib/block_scout_web/views/transaction_view.ex:119
#: lib/block_scout_web/views/transaction_view.ex:122
msgid "Success"
msgstr ""
@ -879,7 +879,7 @@ msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/tokens/transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/templates/transaction_token_transfer/_token_transfer.html.eex:4
#: lib/block_scout_web/views/transaction_view.ex:193
#: lib/block_scout_web/views/transaction_view.ex:196
msgid "Token Transfer"
msgstr ""
@ -891,7 +891,7 @@ msgstr ""
#: lib/block_scout_web/templates/transaction/_tabs.html.eex:36
#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:10
#: lib/block_scout_web/views/tokens/overview_view.ex:35
#: lib/block_scout_web/views/transaction_view.ex:247
#: lib/block_scout_web/views/transaction_view.ex:250
msgid "Token Transfers"
msgstr ""
@ -932,7 +932,7 @@ msgid "Total transactions"
msgstr ""
#, elixir-format
#: lib/block_scout_web/views/transaction_view.ex:196
#: lib/block_scout_web/views/transaction_view.ex:199
msgid "Transaction"
msgstr ""
@ -999,7 +999,7 @@ msgid "Unique Token"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:136
#: lib/block_scout_web/templates/transaction/overview.html.eex:158
msgid "Used"
msgstr ""
@ -1020,7 +1020,7 @@ msgid "Validations"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:118
#: lib/block_scout_web/templates/transaction/overview.html.eex:140
msgid "Value"
msgstr ""
@ -1638,7 +1638,18 @@ msgstr ""
msgid "Transactions Sent"
msgstr ""
#, elixir-format, fuzzy
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:85
msgid "Transaction Speed"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:116
#: lib/block_scout_web/templates/transaction/overview.html.eex:121
msgid "Hex (Default)"
msgstr ""
#, elixir-format
#: lib/block_scout_web/templates/transaction/overview.html.eex:125
msgid "UTF-8"
msgstr ""

Loading…
Cancel
Save