Skip to content
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

Hooks refactors 1 #472

Merged
merged 20 commits into from
Nov 21, 2024
Merged

Conversation

truemiller
Copy link
Collaborator

Proposed changes

Refactor hooks to support updated contexts
About half way through ~

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

@truemiller truemiller changed the base branch from refactor/multi-chain-support-frontend to refactor/review-all-contexts November 21, 2024 06:43
safeAddress: safe.address,
contractCall: new MulticallContract(
safe.address,
GNOSIS_SAFE_ABI,
Copy link
Collaborator

Choose a reason for hiding this comment

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

should base on service selected home chain id?

Copy link
Collaborator Author

@truemiller truemiller Nov 21, 2024

Choose a reason for hiding this comment

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

the contracts don't have an assigned chainId in the multicall package, they're processed via chain specific provider in step 2

frontend/hooks/useBalanceContext.ts Outdated Show resolved Hide resolved
frontend/hooks/useBalanceContext.ts Outdated Show resolved Hide resolved
frontend/hooks/useNeedsFunds.ts Show resolved Hide resolved
() => (safeBalance?.ETH || 0) >= (serviceFundRequirements?.eth || 0),
[serviceFundRequirements?.eth, safeBalance],
() => {
if (!serviceFundRequirements) return ;
Copy link
Collaborator

Choose a reason for hiding this comment

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

also small, but I noticed in needsInitialFunding you return false in similar cases, but here undefined;
for type safety and consistency, maybe you could specify the return type? might help prevent surprises

const hasEnoughEthForInitialFunding: boolean = useMemo(

Copy link
Collaborator Author

@truemiller truemiller Nov 21, 2024

Choose a reason for hiding this comment

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

yeah, i agree, however, boolean hides that the value is not yet loaded..
i.e. if it's true/false we can't assume that a new value is coming, or it is not yet defined due to awaiting some promise

@truemiller truemiller changed the base branch from refactor/review-all-contexts to refactor/multi-chain-support-frontend November 21, 2024 11:28
@truemiller truemiller merged commit c3c01f2 into refactor/multi-chain-support-frontend Nov 21, 2024
2 of 4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants