forked from blockscout/blockscout
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: API endpoint to re-fetch token instance metadata (blockscout#10097
) * feat: Re-fetch token instance metadata * Partially process review comments * Process reviewer comments. Part 2 * Process reviewer comments. Part 3 * Process reviewer comments. Part 4 * Fix events * Add test * Remove :token preload * fix formatting * Fix tests * Remove unused aliases * Add reCAPTCHA for token instance re-fetch API endpoint * Check event on websocket at /api/v2/tokens/{address_hash}/instances/{token_id}/refetch-metadata endpoint
- Loading branch information
Showing
76 changed files
with
950 additions
and
178 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
apps/block_scout_web/lib/block_scout_web/channels/token_instance_channel.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule BlockScoutWeb.TokenInstanceChannel do | ||
@moduledoc """ | ||
Establishes pub/sub channel for live updates of token instances events. | ||
""" | ||
use BlockScoutWeb, :channel | ||
|
||
intercept(["fetched_token_instance_metadata"]) | ||
|
||
def join("fetched_token_instance_metadata", _params, socket) do | ||
{:ok, %{}, socket} | ||
end | ||
|
||
def join("token_instances:" <> _token_contract_address_hash, _params, socket) do | ||
{:ok, %{}, socket} | ||
end | ||
|
||
def handle_out( | ||
"fetched_token_instance_metadata", | ||
res, | ||
%Phoenix.Socket{handler: BlockScoutWeb.UserSocketV2} = socket | ||
) do | ||
push(socket, "fetched_token_instance_metadata", res) | ||
|
||
{:noreply, socket} | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
apps/block_scout_web/lib/block_scout_web/controllers/admin/setup_controller.ex
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.