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

chore: remove all ethers5 peer deps #787

Merged
merged 7 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
3 changes: 0 additions & 3 deletions packages/blockchain-bindings/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,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/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 { 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/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
3 changes: 2 additions & 1 deletion packages/gated-content/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@
"@lit-protocol/encryption": "2.1.62",
"@lit-protocol/node-client": "^2.1.62",
"@lit-protocol/types": "2.1.62",
"siwe": "^1.1.6",
"@spruceid/siwe-parser": "^2.0.2",
cesarenaldi marked this conversation as resolved.
Show resolved Hide resolved
"siwe": "^2.1.4",
"traverse": "^0.6.7",
"tslib": "^2.6.2"
},
Expand Down
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
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
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
2 changes: 1 addition & 1 deletion packages/react/src/polls/adapters/SnapshotVoteFactory.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getAddress } from '@ethersproject/address';
import {
SafeApolloClient,
GetSnapshotProposalDocument,
Expand All @@ -15,7 +16,6 @@ import {
VoteChoice,
} from '@lens-protocol/domain/use-cases/polls';
import { invariant, InvariantError, never } from '@lens-protocol/shared-kernel';
import { getAddress } from 'ethers/lib/utils';

import { vote2Types, voteArray2Types, voteString2Types } from './types';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { getAddress } from '@ethersproject/address';
import {
SnapshotProposal,
SnapshotSpaceId,
Expand All @@ -12,7 +13,6 @@ import { AppId, PollId } from '@lens-protocol/domain/entities';
import { mockAppId, mockCreateUnsignedVoteRequest, mockWallet } from '@lens-protocol/domain/mocks';
import { InvariantError, never } from '@lens-protocol/shared-kernel';
import { mockEvmAddress } from '@lens-protocol/shared-kernel/mocks';
import { getAddress } from 'ethers/lib/utils';

import { SnapshotVoteFactory, UnsignedVote } from '../SnapshotVoteFactory';
import { vote2Types, voteArray2Types, voteString2Types } from '../types';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { BigNumber } from '@ethersproject/bignumber';
import { MaxUint256 } from '@ethersproject/constants';
import { erc20, bigNumber } from '@lens-protocol/blockchain-bindings';
import {
IPaidTransactionGateway,
TokenAllowanceLimit,
TokenAllowanceRequest,
} from '@lens-protocol/domain/use-cases/transactions';
import { Amount, BigDecimal, CryptoNativeAsset, Data } from '@lens-protocol/shared-kernel';
import { BigNumber, constants } from 'ethers';

import { AbstractContractCallGateway, ContractCallDetails } from './AbstractContractCallGateway';

Expand All @@ -18,7 +19,7 @@ function resolveApproveAmount(request: TokenAllowanceRequest): BigNumber {
case TokenAllowanceLimit.EXACT:
return bigNumber(request.amount);
case TokenAllowanceLimit.INFINITE:
return constants.MaxUint256;
return MaxUint256;
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { JsonRpcProvider } from '@ethersproject/providers';
import { FeeHistoryResult } from '@lens-protocol/blockchain-bindings';
import {
Amount,
Expand All @@ -6,7 +7,6 @@ import {
Denomination,
never,
} from '@lens-protocol/shared-kernel';
import { providers } from 'ethers';

export class Eip1559GasPriceEstimate<T extends CryptoNativeAsset = CryptoNativeAsset> {
constructor(readonly baseFee: Amount<T>, readonly maxPriorityFeePerGas: Amount<T>) {}
Expand Down Expand Up @@ -92,7 +92,7 @@ export type CryptoNativeAmountFactory<T extends CryptoNativeAsset> = (

export class Eip1559GasPriceEstimator<T extends CryptoNativeAsset> {
constructor(
private readonly provider: providers.JsonRpcProvider,
private readonly provider: JsonRpcProvider,
private readonly createAmount: CryptoNativeAmountFactory<T>,
) {}

Expand Down
24 changes: 12 additions & 12 deletions packages/react/src/wallet/adapters/ConcreteWallet.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { TypedDataSigner } from '@ethersproject/abstract-signer';
import { TypedDataSigner, Signer } from '@ethersproject/abstract-signer';
import { getAddress } from '@ethersproject/address';
import { ErrorCode } from '@ethersproject/logger';
import { TransactionRequest } from '@ethersproject/providers';
import { TypedData } from '@lens-protocol/blockchain-bindings';
import {
Expand Down Expand Up @@ -27,8 +29,6 @@ import {
PromiseResult,
success,
} from '@lens-protocol/shared-kernel';
import { errors, Signer } from 'ethers';
import { getAddress } from 'ethers/lib/utils';
import { z } from 'zod';

import { UnsignedVote } from '../../polls/adapters/SnapshotVoteFactory';
Expand Down Expand Up @@ -159,9 +159,9 @@ export class ConcreteWallet extends Wallet {
const signedCall = SignedProtocolCall.create({ unsignedCall, signature });
return success(signedCall);
} catch (err) {
assertErrorObjectWithCode<errors>(err);
assertErrorObjectWithCode<ErrorCode>(err);

if (err.code === errors.ACTION_REJECTED) {
if (err.code === ErrorCode.ACTION_REJECTED) {
return failure(new UserRejectedError());
}

Expand Down Expand Up @@ -195,9 +195,9 @@ export class ConcreteWallet extends Wallet {
const signature = await signer.signMessage(message);
return success(signature as Signature);
} catch (err) {
assertErrorObjectWithCode<errors>(err);
assertErrorObjectWithCode<ErrorCode>(err);

if (err.code === errors.ACTION_REJECTED) {
if (err.code === ErrorCode.ACTION_REJECTED) {
return failure(new UserRejectedError());
}
throw err;
Expand Down Expand Up @@ -239,12 +239,12 @@ export class ConcreteWallet extends Wallet {

return success(transaction);
} catch (err) {
assertErrorObjectWithCode<errors>(err);
assertErrorObjectWithCode<ErrorCode>(err);

switch (err.code) {
case errors.ACTION_REJECTED:
case ErrorCode.ACTION_REJECTED:
return failure(new UserRejectedError(err.message));
case errors.INSUFFICIENT_FUNDS:
case ErrorCode.INSUFFICIENT_FUNDS:
return failure(new InsufficientGasError(matic()));
}

Expand Down Expand Up @@ -289,9 +289,9 @@ export class ConcreteWallet extends Wallet {
);
return success(signedVote);
} catch (err) {
assertErrorObjectWithCode<errors>(err);
assertErrorObjectWithCode<ErrorCode>(err);

if (err.code === errors.ACTION_REJECTED) {
if (err.code === ErrorCode.ACTION_REJECTED) {
return failure(new UserRejectedError());
}
throw err;
Expand Down
Loading
Loading