Skip to content

Add docs to convert from Ethers v6 to Ethers v5 #77

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

Open
MantisClone opened this issue Dec 6, 2024 · 0 comments
Open

Add docs to convert from Ethers v6 to Ethers v5 #77

MantisClone opened this issue Dec 6, 2024 · 0 comments

Comments

@MantisClone
Copy link
Member

MantisClone commented Dec 6, 2024

To convert Ethers v6 to Ethers v5, try the following snippets:

convertV6SignerToV5Signer.ts

import { providers as ethersV5Providers, Signer as ethersV5Signer } from 'ethers-v5';
import { Signer as ethersV6Signer } from 'ethers-v6';

export async function convertV6SignerToV5Signer(v6Signer: ethersV6Signer, providerUrl: string) {
  const address = await v6Signer.getAddress();
  const provider = new ethersV5Providers.JsonRpcProvider(providerUrl);
  const v5Signer = provider.getSigner(address);
  return v5Signer;
}

package.json

{
  "name": "your-project-name",
  "version": "1.0.0",
  "description": "Your project description",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "dependencies": {
    "ethers-v5": "npm:ethers@^5.7.2", // Alias for ethers v5
    "ethers-v6": "npm:ethers@^6.0.0", // Alias for ethers v6
  },
  "author": "Your Name",
  "license": "ISC"
}
@MantisClone MantisClone converted this from a draft issue Dec 6, 2024
@MantisClone MantisClone moved this from 🆕 New to 🎫 Backlog in Request Network Tech Backlog Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 🎫 Backlog
Development

No branches or pull requests

1 participant