Skip to content

Commit

Permalink
chore: remove all ethers5 peer deps (#787)
Browse files Browse the repository at this point in the history
* chore: remove all ethers5 peer deps

* Removes redundant dep

* Updates TSDocs

* One step ahead to remove ethers direct dep

* ensure web app bypass build cache at every restart

* Fix issue with duplicated wagmi in example apps

---------

Co-authored-by: Cesare Naldi <[email protected]>
  • Loading branch information
krzysu and cesarenaldi authored Dec 22, 2023
1 parent 6fa2ede commit 1a97c39
Show file tree
Hide file tree
Showing 42 changed files with 414 additions and 1,172 deletions.
12 changes: 12 additions & 0 deletions .changeset/grumpy-bugs-sip.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@lens-protocol/blockchain-bindings": patch
"@lens-protocol/gated-content": patch
"@lens-protocol/shared-kernel": patch
"@lens-protocol/react-native": patch
"@lens-protocol/react-web": patch
"@lens-protocol/client": patch
"@lens-protocol/react": patch
"@lens-protocol/wagmi": patch
---

**chore:** Removed peer dependency on ethers@5
2 changes: 1 addition & 1 deletion examples/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"private": true,
"version": "0.1.0",
"scripts": {
"dev": "vite",
"dev": "vite --force",
"build": "vite build",
"build:with-packages": "turbo run build --filter=...example-web",
"preview": "vite preview",
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"arweave",
"react",
"react-native",
"@tanstack/query-core",
"csstype",
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"license": "MIT",
"dependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/units": "^5.7.0",
"@lens-protocol/domain": "workspace:*",
"@lens-protocol/shared-kernel": "workspace:*",
"ethers": "^5.7.2",
Expand All @@ -61,9 +64,6 @@
"typescript": "5.2.2"
},
"prettier": "@lens-protocol/prettier-config",
"peerDependencies": {
"ethers": "^5.7.2"
},
"babel": {
"presets": [
"@babel/preset-env",
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain-bindings/src/TypedData.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TypedDataField } from 'ethers';
import { TypedDataField } from '@ethersproject/abstract-signer';

export type Eip712TypedDataDomain = {
name: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain-bindings/src/contracts.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Contract } from '@ethersproject/contracts';
import { Provider } from '@ethersproject/providers';
import { EvmAddress } from '@lens-protocol/shared-kernel';
import { Contract } from 'ethers';

import lensFollowNftAbi from './abi/LensFollowNFT.json';
import lensHubAbi from './abi/LensHub.json';
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain-bindings/src/types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
/* tslint:disable */
/* eslint-disable */
import type { Listener } from '@ethersproject/providers';
import type { Event, EventFilter } from 'ethers';
import type { Event, EventFilter } from '@ethersproject/contracts';

export interface TypedEvent<TArgsArray extends Array<any> = any, TArgsObject = any> extends Event {
args: TArgsArray & TArgsObject;
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain-bindings/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parseUnits } from '@ethersproject/units';
import { CryptoAmount, EvmAddress } from '@lens-protocol/shared-kernel';
import { utils } from 'ethers';

export function hexToInt(hex: string): number {
return parseInt(hex, 16);
Expand All @@ -11,5 +11,5 @@ export function isTheSameAddress(address1: EvmAddress, address2: EvmAddress) {
}

export function bigNumber(from: CryptoAmount) {
return utils.parseUnits(from.toFixed(), from.asset.decimals);
return parseUnits(from.toFixed(), from.asset.decimals);
}
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
"license": "MIT",
"dependencies": {
"@ethersproject/abi": "^5.7.0",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/address": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
Expand Down Expand Up @@ -89,7 +90,6 @@
"@types/node": "^18.18.12",
"dotenv": "^16.3.1",
"eslint": "^8.54.0",
"ethers": "^5.7.2",
"jest": "^29.7.0",
"prettier": "^3.1.0",
"ts-jest": "^29.1.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/LensClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Wallet } from '@ethersproject/wallet';
import { InMemoryStorageProvider } from '@lens-protocol/storage';
import { Wallet } from 'ethers';

import { LensClient } from '.';
import { buildTestEnvironment } from './__helpers__';
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/__helpers__/BundlrUploader.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { NodeBundlr } from '@bundlr-network/client';
import { Wallet } from '@ethersproject/wallet';
import { UnknownObject } from '@lens-protocol/shared-kernel';
import { Wallet } from 'ethers';

export class BundlrUploader {
constructor(private readonly signer: Wallet) {}
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/__helpers__/setup.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Wallet } from '@ethersproject/wallet';
import { invariant, never, UnknownObject } from '@lens-protocol/shared-kernel';
import { Wallet } from 'ethers';

import { LensClient } from '../LensClient';
import { ProfileFragment } from '../graphql';
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/gated/__helpers/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Wallet } from 'ethers';
import { Wallet } from '@ethersproject/wallet';

import { buildTestEnvironment } from '../../__helpers__';
import { LensClient } from '../LensClient';
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/gated/__tests__/LensClient.spec.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Wallet } from '@ethersproject/wallet';
import { faker } from '@faker-js/faker';
import { CannotDecryptError, isEncryptedPublicationMetadata } from '@lens-protocol/gated-content';
import * as metadata from '@lens-protocol/metadata';
import { invariant } from '@lens-protocol/shared-kernel';
import { Wallet } from 'ethers';

import {
authenticate,
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* @module Base
* @module Core
*
* @example
* Development example:
Expand Down
2 changes: 1 addition & 1 deletion packages/client/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { TypedDataDomain, TypedDataField } from 'ethers';
import type { TypedDataDomain, TypedDataField } from '@ethersproject/abstract-signer';

export type TypedData = {
domain: TypedDataDomain;
Expand Down
9 changes: 8 additions & 1 deletion packages/gated-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
"@lit-protocol/encryption": "2.1.62",
"@lit-protocol/node-client": "^2.1.62",
"@lit-protocol/types": "2.1.62",
"siwe": "^1.1.6",
"siwe": "^2.1.4",
"traverse": "^0.6.7",
"tslib": "^2.6.2"
},
Expand Down Expand Up @@ -116,5 +116,12 @@
"web/index.ts"
],
"exports": true
},
"pnpm": {
"peerDependencyRules": {
"ignoreMissing": [
"react"
]
}
}
}
1 change: 0 additions & 1 deletion packages/react-native/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@
},
"peerDependencies": {
"@types/react": "^18.0.0",
"ethers": "^5.7.2",
"react": "~18.2.0",
"react-native": "~0.72.7",
"react-native-mmkv": "~2.11.0"
Expand Down
6 changes: 3 additions & 3 deletions packages/react-native/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
*
* | Package Manager | Command |
* |:---------------:|:------- |
* | npm | `npm install @lens-protocol/react-native@latest ethers@legacy-v5` |
* | yarn | `yarn add @lens-protocol/react-native@latest ethers@legacy-v5` |
* | pnpm | `pnpm add @lens-protocol/react-native@latest ethers@legacy-v5` |
* | npm | `npm install @lens-protocol/react-native@latest` |
* | yarn | `yarn add @lens-protocol/react-native@latest` |
* | pnpm | `pnpm add @lens-protocol/react-native@latest` |
*
* First we need to create so-called bindings. Bindings are just an object implementing the {@link IBindings} interface. This is used by the Lens SDK to access the Signer and the Provider.
*
Expand Down
58 changes: 2 additions & 56 deletions packages/react-v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,62 +35,8 @@
"tsc": "tsc --noEmit"
},
"license": "MIT",
"dependencies": {
"@apollo/client": "^3.8.7",
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@lens-protocol/api-bindings": "workspace:*",
"@lens-protocol/blockchain-bindings": "workspace:*",
"@lens-protocol/domain": "workspace:*",
"@lens-protocol/gated-content": "workspace:*",
"@lens-protocol/shared-kernel": "workspace:*",
"@lens-protocol/storage": "workspace:*",
"graphql": "^16.8.1",
"jwt-decode": "^3.1.2",
"lodash": "^4.17.21",
"tslib": "^2.6.2",
"uuid": "^9.0.1",
"zod": "^3.22.4"
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@ensdomains/ens": "0.4.4",
"@ensdomains/resolver": "0.2.4",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@faker-js/faker": "^7.6.0",
"@lens-protocol/eslint-config": "workspace:*",
"@lens-protocol/prettier-config": "workspace:*",
"@lens-protocol/tsconfig": "workspace:*",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.5.10",
"@types/jest-when": "^3.5.5",
"@types/lodash": "^4.14.202",
"@types/react": "^18.2.38",
"@types/uuid": "^9.0.7",
"eslint": "^8.54.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"ethereum-waffle": "^4.0.10",
"ethers": "^5.7.2",
"ganache": "7.7.4",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-mock-extended": "^3.0.5",
"jest-when": "^3.6.0",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-jest": "^29.1.1",
"typescript": "5.2.2"
},
"peerDependencies": {
"ethers": "^5.7.2",
"react": "^18.2.0"
},
"dependencies": {},
"devDependencies": {},
"prettier": "@lens-protocol/prettier-config",
"babel": {
"presets": [
Expand Down
46 changes: 2 additions & 44 deletions packages/react-web-v1/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,50 +36,8 @@
"tsc": "tsc --noEmit"
},
"license": "MIT",
"dependencies": {
"@lens-protocol/api-bindings": "0.10.1",
"@lens-protocol/domain": "0.10.1",
"@lens-protocol/gated-content": "0.3.3",
"@lens-protocol/react": "1.3.1",
"@lens-protocol/shared-kernel": "0.10.0",
"@lens-protocol/storage": "0.7.4",
"tslib": "^2.6.2"
},
"devDependencies": {
"@babel/core": "^7.23.3",
"@babel/preset-env": "^7.23.3",
"@babel/preset-react": "^7.23.3",
"@babel/preset-typescript": "^7.23.3",
"@lens-protocol/eslint-config": "workspace:*",
"@lens-protocol/prettier-config": "workspace:*",
"@lens-protocol/tsconfig": "workspace:*",
"@testing-library/react": "^13.4.0",
"@types/jest": "^29.5.10",
"@types/jest-when": "^3.5.5",
"@types/react": "^18.2.38",
"eslint": "^8.54.0",
"eslint-plugin-react": "^7.33.2",
"eslint-plugin-react-hooks": "^4.6.0",
"ethers": "^5.7.2",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"jest-mock-extended": "^3.0.5",
"jest-when": "^3.6.0",
"prettier": "^2.8.8",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"ts-jest": "^29.1.1",
"typescript": "5.2.2"
},
"peerDependencies": {
"ethers": "^5.7.2",
"react": "^18.2.0"
},
"peerDependenciesMeta": {
"@xmtp/react-sdk": {
"optional": true
}
},
"dependencies": {},
"devDependencies": {},
"prettier": "@lens-protocol/prettier-config",
"babel": {
"presets": [
Expand Down
1 change: 0 additions & 1 deletion packages/react-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@
"peerDependencies": {
"@types/react": "^18.0.0",
"@xmtp/react-sdk": "^3.0.0",
"ethers": "^5.7.2",
"react": "^18.2.0"
},
"peerDependenciesMeta": {
Expand Down
16 changes: 8 additions & 8 deletions packages/react-web/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
/**
* @module Core
*
* ## Quick start
*
* Install:
*
* | Package Manager | Command |
* |:---------------:|:------- |
* | npm | `npm install @lens-protocol/react-web@alpha ethers@legacy-v5` |
* | yarn | `yarn add @lens-protocol/react-web@alpha ethers@legacy-v5` |
* | pnpm | `pnpm add @lens-protocol/react-web@alpha ethers@legacy-v5` |
* | npm | `npm install @lens-protocol/react-web@latest` |
* | yarn | `yarn add @lens-protocol/react-web@latest` |
* | pnpm | `pnpm add @lens-protocol/react-web@latest` |
*
* If you use [wagmi](https://wagmi.sh/) you can install the companion package:
*
* | Package Manager | Command |
* |:---------------:|:------- |
* | npm | `npm install @lens-protocol/wagmi@alpha` |
* | yarn | `yarn add @lens-protocol/wagmi@alpha` |
* | pnpm | `pnpm add @lens-protocol/wagmi@alpha` |
* | npm | `npm install @lens-protocol/wagmi@latest` |
* | yarn | `yarn add @lens-protocol/wagmi@latest` |
* | pnpm | `pnpm add @lens-protocol/wagmi@latest` |
*
* In the following examples we will show you integration with wagmi and we will explain later how to use custom bindings.
*
Expand Down Expand Up @@ -65,8 +67,6 @@
* getSigner: () => wallet
* };
* ```
*
* @module Index
*/
'use client';

Expand Down
5 changes: 3 additions & 2 deletions packages/react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@
"@ethersproject/abstract-signer": "^5.7.0",
"@ethersproject/address": "^5.7.0",
"@ethersproject/bignumber": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@ethersproject/constants": "^5.7.0",
"@ethersproject/contracts": "^5.7.0",
"@ethersproject/hash": "^5.7.0",
"@ethersproject/logger": "^5.7.0",
"@ethersproject/providers": "^5.7.2",
"@ethersproject/wallet": "^5.7.0",
"@lens-protocol/api-bindings": "workspace:*",
Expand All @@ -75,7 +78,6 @@
"@ensdomains/ens": "0.4.4",
"@ensdomains/resolver": "0.2.4",
"@ethersproject/abi": "^5.7.0",
"@ethersproject/bytes": "^5.7.0",
"@faker-js/faker": "^7.6.0",
"@lens-protocol/eslint-config": "workspace:*",
"@lens-protocol/prettier-config": "workspace:*",
Expand Down Expand Up @@ -104,7 +106,6 @@
},
"peerDependencies": {
"@types/react": "^18.0.0",
"ethers": "^5.7.2",
"react": "^18.2.0"
},
"peerDependenciesMeta": {
Expand Down
Loading

0 comments on commit 1a97c39

Please sign in to comment.