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

Strongly-typed contracts #9

Open
janklimo opened this issue May 8, 2021 · 3 comments
Open

Strongly-typed contracts #9

janklimo opened this issue May 8, 2021 · 3 comments

Comments

@janklimo
Copy link

janklimo commented May 8, 2021

Is there a way to currently (or in the future) make the contract aware of the functions it supports? Example:

Screen Shot 2021-05-09 at 01 36 19

Thanks to TypeChain we have a generated contract type which would be as follows for the example above:

start_time(
  overrides?: CallOverrides
): Promise<{
  0: BigNumber;
}>;

I'm thinking there might be a way to pass it to the Contract class if we make it generic — taking contract type as a type argument.

@apoorvlathey
Copy link

It would be great to see it natively supported by the package.

Till then, we can do like this:

const contract = new MulticallContract(address, ABI) as unknown as ContractType

@ChrisChan888
Copy link

ChrisChan888 commented Feb 7, 2022

It would be great to see it natively supported by the package.

Till then, we can do like this:

const contract = new MulticallContract(address, ABI) as unknown as ContractType

Will return values with typed in this expression when calling provider.all?

@apoorvlathey
Copy link

It would be great to see it natively supported by the package.
Till then, we can do like this:

const contract = new MulticallContract(address, ABI) as unknown as ContractType

Will return values with typed in this expression when calling provider.all?

image

Sadly no. You'd have to provide the return datatypes manually to .all as shown above

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

No branches or pull requests

3 participants