New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New RPC API endpoints #9068
New RPC API endpoints #9068
Conversation
7fd6f97
to
42fa997
Compare
0129f1e
to
8b308b7
Compare
apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs
Outdated
Show resolved
Hide resolved
apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs
Outdated
Show resolved
Hide resolved
apps/explorer/priv/repo/migrations/20231227170848_add_proxy_verification_status.exs
Show resolved
Hide resolved
apps/explorer/lib/explorer/chain/smart_contract/proxy/verification_status.ex
Show resolved
Hide resolved
526d406
to
2d093cf
Compare
88cf7d8
to
29c4a23
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's handle the case when required parameters were not passed like here when calling /api?module=contract&action=verifysourcecode
:
2024-01-10T12:51:22.949 application=api request_id=F6jzlaFuqpFiSm0AAAZC [error] Error while calling RPC action"** (Phoenix.ActionClauseError) no function clause matching in BlockScoutWeb.API.RPC.ContractController.verifysourcecode/2\n\nThe following arguments were given to BlockScoutWeb.API.RPC.ContractController.verifysourcecode/2:\n\n # 1\n %Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, body_params: %{}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: \"localhost\", method: \"POST\", owner: #PID<0.1798.0>, params: %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"}, path_info: [], path_params: %{}, port: 4000, private: %{BlockScoutWeb.ApiRouter => {[\"api\"], %{Absinthe.Plug => [\"graphql\"], BlockScoutWeb.API.RPC.RPCTranslator => [], BlockScoutWeb.APIKeyV2Router => [\"v2\", \"key\"], BlockScoutWeb.SmartContractsApiV2Router => [\"v2\", \"smart-contracts\"], RPCTranslatorForwarder => []}}, BlockScoutWeb.Router => {[], %{Absinthe.Plug.GraphiQL => [\"graphiql\"], BlockScoutWeb.ApiRouter => [\"api\"], BlockScoutWeb.WebRouter => []}}, :before_send => [#Function<0.117693457/1 in BlockScoutWeb.Plug.Logger.call/2>, #Function<1.71982575/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>, #Function<2.86362936/1 in BlockScoutWeb.Endpoint.call/2>], :phoenix_action => :verifysourcecode, :phoenix_controller => BlockScoutWeb.API.RPC.ContractController, :phoenix_endpoint => BlockScoutWeb.Endpoint, :phoenix_format => \"json\", :phoenix_layout => {BlockScoutWeb.LayoutView, :app}, :phoenix_router => BlockScoutWeb.ApiRouter, :phoenix_view => BlockScoutWeb.API.RPC.ContractView, :plug_session_fetch => #Function<1.84243074/1 in Plug.Session.fetch_session/1>}, query_params: %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"}, query_string: \"module=contract&action=verifysourcecode\", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{\"accept\", \"*/*\"}, {\"accept-encoding\", \"gzip, deflate, br\"}, {\"cache-control\", \"no-cache\"}, {\"connection\", \"keep-alive\"}, {\"content-length\", \"0\"}, {\"host\", \"localhost:4000\"}, {\"postman-token\", \"7e6c1b7f-f860-4f14-82b6-b49bdaf7e880\"}, {\"user-agent\", \"PostmanRuntime/7.36.0\"}], request_path: \"/api\", resp_body: nil, resp_cookies: %{}, resp_headers: [{\"cache-control\", \"max-age=0, private, must-revalidate\"}, {\"x-request-id\", \"F6jzlaFuqpFiSm0AAAZC\"}, {\"access-control-allow-credentials\", \"true\"}, {\"access-control-allow-origin\", \"*\"}, {\"access-control-expose-headers\", \"\"}], scheme: :http, script_name: [\"api\"], secret_key_base: :..., state: :unset, status: nil}\n\n # 2\n %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"}\n\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:146: BlockScoutWeb.API.RPC.ContractController.verifysourcecode(%Plug.Conn{adapter: {Plug.Cowboy.Conn, :...}, assigns: %{}, body_params: %{}, cookies: %Plug.Conn.Unfetched{aspect: :cookies}, halted: false, host: \"localhost\", method: \"POST\", owner: #PID<0.1798.0>, params: %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"}, path_info: [], path_params: %{}, port: 4000, private: %{BlockScoutWeb.ApiRouter => {[\"api\"], %{Absinthe.Plug => [\"graphql\"], BlockScoutWeb.API.RPC.RPCTranslator => [], BlockScoutWeb.APIKeyV2Router => [\"v2\", \"key\"], BlockScoutWeb.SmartContractsApiV2Router => [\"v2\", \"smart-contracts\"], RPCTranslatorForwarder => []}}, BlockScoutWeb.Router => {[], %{Absinthe.Plug.GraphiQL => [\"graphiql\"], BlockScoutWeb.ApiRouter => [\"api\"], BlockScoutWeb.WebRouter => []}}, :before_send => [#Function<0.117693457/1 in BlockScoutWeb.Plug.Logger.call/2>, #Function<1.71982575/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>, #Function<2.86362936/1 in BlockScoutWeb.Endpoint.call/2>], :phoenix_action => :verifysourcecode, :phoenix_controller => BlockScoutWeb.API.RPC.ContractController, :phoenix_endpoint => BlockScoutWeb.Endpoint, :phoenix_format => \"json\", :phoenix_layout => {BlockScoutWeb.LayoutView, :app}, :phoenix_router => BlockScoutWeb.ApiRouter, :phoenix_view => BlockScoutWeb.API.RPC.ContractView, :plug_session_fetch => #Function<1.84243074/1 in Plug.Session.fetch_session/1>}, query_params: %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"}, query_string: \"module=contract&action=verifysourcecode\", remote_ip: {127, 0, 0, 1}, req_cookies: %Plug.Conn.Unfetched{aspect: :cookies}, req_headers: [{\"accept\", \"*/*\"}, {\"accept-encoding\", \"gzip, deflate, br\"}, {\"cache-control\", \"no-cache\"}, {\"connection\", \"keep-alive\"}, {\"content-length\", \"0\"}, {\"host\", \"localhost:4000\"}, {\"postman-token\", \"7e6c1b7f-f860-4f14-82b6-b49bdaf7e880\"}, {\"user-agent\", \"PostmanRuntime/7.36.0\"}], request_path: \"/api\", resp_body: nil, resp_cookies: %{}, resp_headers: [{\"cache-control\", \"max-age=0, private, must-revalidate\"}, {\"x-request-id\", \"F6jzlaFuqpFiSm0AAAZC\"}, {\"access-control-allow-credentials\", \"true\"}, {\"access-control-allow-origin\", \"*\"}, {\"access-control-expose-headers\", \"\"}], scheme: :http, script_name: [\"api\"], secret_key_base: :..., state: :unset, status: nil}, %{\"action\" => \"verifysourcecode\", \"module\" => \"contract\"})\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:1: BlockScoutWeb.API.RPC.ContractController.action/2\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:1: BlockScoutWeb.API.RPC.ContractController.phoenix_controller_pipeline/2\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/rpc_translator.ex:119: BlockScoutWeb.API.RPC.RPCTranslator.call_controller/3\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/rpc_translator.ex:37: BlockScoutWeb.API.RPC.RPCTranslator.call/2\n (phoenix 1.5.14) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2\n (phoenix 1.5.14) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2\n (phoenix 1.5.14) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2\n (phoenix 1.5.14) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2\n (block_scout_web 6.0.0) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint.plug_builder_call/2\n (block_scout_web 6.0.0) /Users/v/blockscout/deps/plug/lib/plug/debugger.ex:136: BlockScoutWeb.Endpoint.\"call (overridable 3)\"/2\n (block_scout_web 6.0.0) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint.\"call (overridable 4)\"/2\n (block_scout_web 6.0.0) /Users/v/blockscout/deps/spandex_phoenix/lib/spandex_phoenix.ex:151: BlockScoutWeb.Endpoint.call/2\n (phoenix 1.5.14) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3\n (stdlib 4.3.1.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3\n
a44efcf
to
fcf6705
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Error in checkproxyverification endpoint
http://localhost:4000/api/v1?module=contract&action=checkproxyverification&guid=5267789f4b7b4efd7bcb235d045080b9798ad87c659e7792
2024-01-10T13:59:41.047 application=api request_id=F6j3T8tJAkuQ_aQAAPPD [error] Error while calling RPC action"** (Plug.Conn.WrapperError) ** (KeyError) key :status not found in: nil. If you are using the dot syntax, such as map.field, make sure the left-hand side of the dot is a map\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:264: BlockScoutWeb.API.RPC.ContractController.checkproxyverification/2\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:1: BlockScoutWeb.API.RPC.ContractController.action/2\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/contract_controller.ex:1: BlockScoutWeb.API.RPC.ContractController.phoenix_controller_pipeline/2\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/rpc_translator.ex:119: BlockScoutWeb.API.RPC.RPCTranslator.call_controller/3\n (block_scout_web 6.0.0) lib/block_scout_web/controllers/api/rpc/rpc_translator.ex:37: BlockScoutWeb.API.RPC.RPCTranslator.call/2\n (phoenix 1.5.14) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2\n (phoenix 1.5.14) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2\n (phoenix 1.5.14) lib/phoenix/router/route.ex:41: Phoenix.Router.Route.call/2\n (phoenix 1.5.14) lib/phoenix/router.ex:352: Phoenix.Router.__call__/2\n (block_scout_web 6.0.0) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint.plug_builder_call/2\n (block_scout_web 6.0.0) /Users/v/blockscout/deps/plug/lib/plug/debugger.ex:136: BlockScoutWeb.Endpoint.\"call (overridable 3)\"/2\n (block_scout_web 6.0.0) lib/block_scout_web/endpoint.ex:1: BlockScoutWeb.Endpoint.\"call (overridable 4)\"/2\n (block_scout_web 6.0.0) /Users/v/blockscout/deps/spandex_phoenix/lib/spandex_phoenix.ex:151: BlockScoutWeb.Endpoint.call/2\n (phoenix 1.5.14) lib/phoenix/endpoint/cowboy2_handler.ex:65: Phoenix.Endpoint.Cowboy2Handler.init/4\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_handler.erl:37: :cowboy_handler.execute/2\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_stream_h.erl:306: :cowboy_stream_h.execute/3\n (cowboy 2.10.0) /Users/v/blockscout/deps/cowboy/src/cowboy_stream_h.erl:295: :cowboy_stream_h.request_process/3\n (stdlib 4.3.1.2) proc_lib.erl:240: :proc_lib.init_p_do_apply/3\n"
fcf6705
to
ff10166
Compare
e34505b
to
c461f12
Compare
* Done tokennfttx endpoint * Add solidity-single-file verification option to verifysourcecode endpoint * Fix tokentx bug * Add verifyproxycontract and checkproxyverification endpoints * Do not return twin contracts in getsourcecode RPC API endpoint * Process review comments * Update messages * Reset GA cache
#8847
Closes #8868
Closes #7137
Changelog
blockscout/docs#220
Checklist for your Pull Request (PR)
CHANGELOG.md
with this PRmaster
in the Version column. Changes will be reflected in this table: https://docs.blockscout.com/for-developers/information-and-settings/env-variables.