Skip to content

Commit

Permalink
fix: gameta claimed name rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
jyeshe committed Nov 4, 2021
1 parent c8e8646 commit ce9293b
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions lib/ae_mdw/names.ex
Original file line number Diff line number Diff line change
Expand Up @@ -192,15 +192,23 @@ defmodule AeMdw.Names do
end

defp render_pointers([{_bi, txi} | _rest_updates]) do
%{"tx" => %{"pointers" => pointers}} = Txs.fetch!(txi)

pointers
|> Enum.map(fn %{"id" => id, "key" => key} -> {key, id} end)
|> Map.new()
txi
|> Txs.fetch!()
|> case do
%{"tx" => %{"pointers" => pointers}} -> pointers
%{"tx" => %{"tx" => %{"tx" => %{"pointers" => pointers}}}} -> pointers
end
|> Enum.into(%{}, fn %{"id" => id} -> {"account_pubkey", id} end)
end

defp render_ownership([{{_bi, _txi}, last_claim_txi} | _rest_claims], transfers) do
%{"tx" => %{"account_id" => orig_owner}} = Txs.fetch!(last_claim_txi)
orig_owner =
last_claim_txi
|> Txs.fetch!()
|> case do
%{"tx" => %{"account_id" => account_id}} -> account_id
%{"tx" => %{"tx" => %{"tx" => %{"account_id" => account_id}}}} -> account_id
end

case transfers do
[] ->
Expand Down

0 comments on commit ce9293b

Please sign in to comment.