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

fix: type multicall usage #380

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

fix: type multicall usage #380

wants to merge 2 commits into from

Conversation

zzmp
Copy link
Contributor

@zzmp zzmp commented Jan 12, 2023

Adds typings for multicall hooks to improve multicall ergonomics and reduce the chance of misuse (eg ReferenceErrors).
Although functional, this is a POC - it is better to move this into redux-multicall itself so it can be useful for interface and other consumers as well.

@vercel
Copy link

vercel bot commented Jan 12, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated
widgets ✅ Ready (Inspect) Visit Preview Jan 12, 2023 at 3:12AM (UTC)

@zzmp zzmp changed the title lint: type multicall usage fix: type multicall usage Jan 12, 2023
@vercel vercel bot temporarily deployed to Preview January 12, 2023 03:12 Inactive
result: C['functions'][M] extends (...args: any) => Promise<infer T> ? T | undefined : never
}

type MultipleContractParams<
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that *ContractParams is actually lossy, because it loses the names/documentation around the parameters and only retains their typing. Arguably, this should be explicit so that names are retained for a better devX. wdyt?

@zzmp zzmp requested a review from JFrankfurt January 12, 2023 18:35
import { useWeb3React } from '@web3-react/core'
import { Interface } from 'ethers/lib/utils'
Copy link
Contributor Author

@zzmp zzmp Jan 12, 2023

Choose a reason for hiding this comment

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

This should be @ethersproject/contract-interfaces or something similar, not from the ethers umbrella package.

@@ -8,9 +8,9 @@ import useIsArgentWallet from './useIsArgentWallet'
export function useArgentWalletContract(): ArgentWalletContract | null {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This type is now implied, and can be removed from the function definition.

@JFrankfurt JFrankfurt removed their request for review November 2, 2023 16:43
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.

1 participant