8000 Decode method name from encoded data when sending Tx by kautukkundan · Pull Request #56 · getwax/bls-wallet · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Decode method name from encoded data when sending Tx #56

Merged
merged 5 commits into from
Nov 23, 2021

Conversation

kautukkundan
Copy link
Contributor
@kautukkundan kautukkundan commented Nov 19, 2021

What is this PR doing?

  • changed Confirm class component to functional component
  • changed format of prompt text
  • fetch method from parity registry
  • fetch method from etherscan api
  • added useInputDecode hook to decode encoded method data
  • added decoded function to UI

How can these changes be manually tested?

  1. install new packages using yarn
  2. add env variable PROVIDER_URL = alchemy/infura endpoint for mainnet and ETHERSCAN_KEY = currently unused
  3. run ENV=local yarn run dev:chrome and import extension as a package inside chrome
  4. create a tx by inputting contract addr and function data - can use this tx or any other from etherscan

Does this PR resolve or contribute to any issues?

Checklist

  • I have manually tested these changes
  • Post a link to the PR in the group chat

Guidelines

  • If your PR is not ready, mark it as a draft
  • The resolve conversation button is for reviewers, not authors
    • (But add a 'done' comment or similar)

@github-actions github-actions bot added the extension Browser extension related label Nov 19, 2021
@kautukkundan kautukkundan changed the title updated confirm to use functional component Decode method name from encoded data when sending Tx Nov 21, 2021
@kautukkundan
Copy link
Contributor Author

confirmation box now displays actual method name

Screenshot 2021-11-22 at 3 18 24 AM

@github-actions github-actions bot added the contracts Smart contract related label Nov 21, 2021
@kautukkundan kautukkundan marked this pull request as ready for review November 21, 2021 23:39
Copy link
Collaborator
@jacque006 jacque006 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One optimization for address lookup, other changes look good.

One other note as we look at using functional React components. There are a number of optimizations you can do using useMemo & useCallback to reduce re-renders. https://www.backtofrontend.com/react-optimizations-memo-usecallback-usememo/ does a very good job of highlighting some basic cases. There would be some good uses for these especially for the useInputDecode hook, but might be overkill at this point. If you're interested in trying those out, I'd be happy to show you offline :)

@kautukkundan
Copy link
Contributor Author

There are a number of optimizations you can do using useMemo & useCallback to reduce re-renders.

Yeah Agreed, however each trigger creates a new self-contained window (with independent states) and the state is set once (default -> final) via url params. Since the state does not depend on any other interaction it wont change at all and the window will only be rendered once. So I guess for now memoization might not be needed here. WDYT?

@jacque006
Copy link
Collaborator
8000

In that case the memoization is likely a premature optimization. Can revisit when/if that hook is used in other places in the future.

@jacque006 jacque006 merged commit ae91fb0 into main Nov 23, 2021
@jacque006 jacque006 deleted the kk/function-decode branch November 23, 2021 18:02
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
contracts Smart contract related extension Browser extension related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0