Skip to content

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

Description

@MantisClone

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"
}

Activity

  1. converted this from a draft issue on Dec 6, 2024
  2. moved this from 🆕 New to 🎫 Backlog in Request Network Tech Backlogon Dec 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions