Skip to content
This repository was archived by the owner on Jun 5, 2025. It is now read-only.

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 { Contract } from '@ethersproject/contracts'
import { CallState as CallStateBase } from '@uniswap/redux-multicall'
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.

import { useContract } from './useContract'
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 subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants