Skip to content

Commit

Permalink
fix Jason (#7)
Browse files Browse the repository at this point in the history
Co-authored-by: Ubuntu <[email protected]>
  • Loading branch information
ArseniiPetrovich and Ubuntu authored Nov 4, 2020
1 parent 167756d commit 63a14fd
Show file tree
Hide file tree
Showing 7 changed files with 64 additions and 1 deletion.
11 changes: 11 additions & 0 deletions apps/explorer/lib/explorer/chain/address.ex
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,17 @@ defmodule Explorer.Chain.Address do
:names
]}

@derive {Jason.Encoder,
except: [
:__meta__,
:smart_contract,
:decompiled_smart_contracts,
:token,
:contracts_creation_internal_transaction,
:contracts_creation_transaction,
:names
]}

@primary_key {:hash, Hash.Address, autogenerate: false}
schema "addresses" do
field(:fetched_coin_balance, Wei)
Expand Down
8 changes: 8 additions & 0 deletions apps/explorer/lib/explorer/chain/bridged_token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,14 @@ defmodule Explorer.Chain.BridgedToken do
:updated_at
]}

@derive {Jason.Encoder,
except: [
:__meta__,
:home_token_contract_address,
:inserted_at,
:updated_at
]}

@primary_key false
schema "bridged_tokens" do
field(:foreign_chain_id, :decimal)
Expand Down
8 changes: 8 additions & 0 deletions apps/explorer/lib/explorer/chain/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ defmodule Explorer.Chain.Token do
:updated_at
]}

@derive {Jason.Encoder,
except: [
:__meta__,
:contract_address,
:inserted_at,
:updated_at
]}

@primary_key false
schema "tokens" do
field(:name, :string)
Expand Down
23 changes: 22 additions & 1 deletion apps/explorer/lib/explorer/chain/transaction.ex
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,28 @@ defmodule Explorer.Chain.Transaction do
:s,
:v,
:status,
:value
:value,
:revert_reason
]}

@derive {Jason.Encoder,
only: [
:block_number,
:cumulative_gas_used,
:error,
:gas,
:gas_price,
:gas_used,
:index,
:created_contract_code_indexed_at,
:input,
:nonce,
:r,
:s,
:v,
:status,
:value,
:revert_reason
]}

@primary_key {:hash, Hash.Full, autogenerate: false}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ defmodule Explorer.Chain.Transaction.History.TransactionStats do

alias Explorer.Repo

@derive {Jason.Encoder,
except: [
:__meta__
]}

schema "transaction_stats" do
field(:date, :date)
field(:number_of_transactions, :integer)
Expand Down
5 changes: 5 additions & 0 deletions apps/explorer/lib/explorer/chain/wei.ex
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ defmodule Explorer.Chain.Wei do

alias Explorer.Chain.Wei

@derive {Jason.Encoder,
except: [
:__meta__
]}

defstruct ~w(value)a

use Ecto.Type
Expand Down
5 changes: 5 additions & 0 deletions apps/explorer/lib/explorer/exchange_rates/token.ex
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@ defmodule Explorer.ExchangeRates.Token do
volume_24h_usd: Decimal.t()
}

@derive {Jason.Encoder,
except: [
:__meta__
]}

@enforce_keys ~w(available_supply total_supply btc_value id last_updated market_cap_usd name symbol usd_value volume_24h_usd)a
defstruct ~w(available_supply total_supply btc_value id last_updated market_cap_usd name symbol usd_value volume_24h_usd)a

Expand Down

0 comments on commit 63a14fd

Please sign in to comment.