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

Ethers v6 target #803

Closed
wants to merge 29 commits into from
Closed

Ethers v6 target #803

wants to merge 29 commits into from

Conversation

zemse
Copy link
Contributor

@zemse zemse commented Feb 3, 2023

For trying out this PR in your project:

npm i typechain-target-ethers-v6
  1. You can install the above temporary package and use ethers-v6 as target in your typechain config (or you can clone this repo and publish yourself).
  2. Make sure ethers version is updated in your project.
  3. Make sure typescript version is >=4.7.
  4. Make sure in your tsconfig: moduleResolution is node16 or nodenext. (Known issue for Rollup Support moduleResolution: 'node16'+ for package.json exports ezolenko/rollup-plugin-typescript2#437)

@changeset-bot
Copy link

changeset-bot bot commented Feb 3, 2023

🦋 Changeset detected

Latest commit: 0770179

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 3 packages
Name Type
example-ethers-v6 Major
@typechain/ethers-v6 Major
@typechain/ethers-v6-test Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

This is because ethers internally imports @adraffy/ens-normalize/xnf
which gives typecheck error if not using node16 module resolution. The
potential issue of using node16 is that common js imports stop working
for a dependency that has exports field defined in it's package json.
@socket-security
Copy link

socket-security bot commented Feb 5, 2023

Socket Security Pull Request Report

👍 No new dependency issues detected in pull request

Pull request report summary
Issue Status
Install scripts ✅ 0 issues
Native code ✅ 0 issues
Bin script confusion ✅ 0 issues
Bin script shell injection ✅ 0 issues
Unresolved require ✅ 0 issues
Invalid package.json ✅ 0 issues
HTTP dependency ✅ 0 issues
Git dependency ✅ 0 issues
Potential typo squat ✅ 0 issues
Known Malware ✅ 0 issues
Telemetry ✅ 0 issues
Protestware/Troll package ✅ 0 issues
Bot Commands

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of package-name@version specifiers. e.g. @SocketSecurity ignore foo@1.0.0 bar@2.4.2

⚠️ Please accept the latest app permissions to ensure bot commands work properly. Accept the new permissions here.

Powered by socket.dev

@dawsbot
Copy link

dawsbot commented Feb 12, 2023

Pretty exciting to see this potential support coming soon 🙏 Thanks @zemse

@zemse zemse marked this pull request as ready for review February 15, 2023 21:17
@stevealexrs
Copy link

stevealexrs commented Feb 16, 2023

It is so version specific that it requires ethers@6.0.0-beta-exports.10

@zemse
Copy link
Contributor Author

zemse commented Feb 17, 2023

typechain-target-ethers-v6@0.0.2 is published with this fix.

@stevealexrs
Copy link

stevealexrs commented Feb 18, 2023

How do I provide structs as function input? The generated struct is declared like this:

export declare namespace ContractName {
  export type SignatureStruct = {
    signer: AddressLike;
    v: BigNumberish;
    r: BytesLike;
    s: BytesLike;
  };
}

using import { type ContractName } from 'path' doesn't work

EDIT: It is fine, I got the syntax mix up. 😳 I should cast it as interface instead of init it like an object, ie { } as Structure instead of Structure {}.

@zemse
Copy link
Contributor Author

zemse commented Feb 18, 2023

That should be import type { ContractName } from 'path', notice "type" is outside of the {}. Or if that was a typo can you describe more about the error you are facing?

// example
import type { ISwapRouter } from '../typechain';
const input: ISwapRouter.ExactInputParamsStruct = {
  path: '0x1234',
  recipient: '0x000',
  deadline: 1,
  amountIn: 1,
  amountOutMinimum: 1,
};

@krzkaczor
Copy link
Member

@zemse thank you so much for this work.

Final fixes are done in: #808

@krzkaczor krzkaczor closed this Feb 21, 2023
@krzkaczor krzkaczor mentioned this pull request Feb 21, 2023
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.

None yet

4 participants