-
Notifications
You must be signed in to change notification settings - Fork 208
fix: type multicall usage #380
base: main
Are you sure you want to change the base?
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
| result: C['functions'][M] extends (...args: any) => Promise<infer T> ? T | undefined : never | ||
| } | ||
|
|
||
| type MultipleContractParams< |
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.
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?
| 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' |
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.
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 { |
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.
This type is now implied, and can be removed from the function definition.
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.