[Update] Refactor ethers adapter and pin ethers version (#4430)
<!-- start pr-codex -->
## PR-Codex overview
This PR updates the `ethers` package version across multiple packages and introduces new exports in the `ethers5.ts` and `ethers6.ts` files.
### Detailed summary
- Updated `ethers` package version to `"5.7.2"`
- Added new exports in `ethers5.ts` and `ethers6.ts`
- Modified imports in `provider-setup.tsx` to use updated exports
> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}`
<!-- end pr-codex -->
This commit is contained in:
Vendored
+1
-1
@@ -3,4 +3,4 @@
|
||||
/// <reference types="next/navigation-types/compat/navigation" />
|
||||
|
||||
// NOTE: This file should not be edited
|
||||
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||
// see https://nextjs.org/docs/app/building-your-application/configuring/typescript for more information.
|
||||
|
||||
@@ -65,7 +65,7 @@
|
||||
"color": "^4.2.3",
|
||||
"compare-versions": "^6.1.0",
|
||||
"date-fns": "^3.6.0",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"flat": "^6.0.1",
|
||||
"framer-motion": "^11.2.12",
|
||||
"fuse.js": "7.0.0",
|
||||
|
||||
@@ -12,12 +12,13 @@ import {
|
||||
import { useQueryClient } from "@tanstack/react-query";
|
||||
import { ThirdwebSDKProvider } from "@thirdweb-dev/react";
|
||||
import type { Signer } from "ethers";
|
||||
import * as ethers from "ethers";
|
||||
import { useSupportedChains } from "hooks/chains/configureChains";
|
||||
import { useNativeColorMode } from "hooks/useNativeColorMode";
|
||||
import { getDashboardChainRpc } from "lib/rpc";
|
||||
import { StorageSingleton } from "lib/sdk";
|
||||
import { useEffect, useMemo, useState } from "react";
|
||||
import { ethers5Adapter } from "thirdweb/adapters/ethers5";
|
||||
import { toEthersSigner } from "thirdweb/adapters/ethers5";
|
||||
import { type ChainMetadata, ethereum } from "thirdweb/chains";
|
||||
import {
|
||||
useActiveAccount,
|
||||
@@ -130,11 +131,12 @@ function useEthersSigner() {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const s = await ethers5Adapter.signer.toEthers({
|
||||
account: activeAccount,
|
||||
chain: activeChain,
|
||||
client: thirdwebClient,
|
||||
});
|
||||
const s = await toEthersSigner(
|
||||
ethers,
|
||||
thirdwebClient,
|
||||
activeAccount,
|
||||
activeChain,
|
||||
);
|
||||
if (active) {
|
||||
setSigner(s);
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@
|
||||
"eslint-plugin-inclusive-language": "^2.2.1",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"express": "^4.19.2",
|
||||
"fastify": "^4.28.0",
|
||||
"next": "14.2.8",
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
"commander": "^9.5.0",
|
||||
"detect-package-manager": "^2.0.1",
|
||||
"enquirer": "^2.4.1",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"got": "11.8.5",
|
||||
"inquirer": "^8.2.6",
|
||||
"js-yaml": "^4.1.0",
|
||||
|
||||
@@ -439,7 +439,7 @@
|
||||
"@thirdweb-dev/tsconfig": "workspace:*",
|
||||
"@typechain/ethers-v5": "10.0.0",
|
||||
"eslint-config-thirdweb": "workspace:*",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"typechain": "^8.3.2",
|
||||
"typescript": "5.5.4"
|
||||
},
|
||||
@@ -467,4 +467,4 @@
|
||||
"build": "bun ./scripts/revert-exports.ts && pnpm typechain && tsc && pnpm preconstruct build && pnpm extract-abi",
|
||||
"push": "yalc push"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
"crypto-js": "^4.2.0",
|
||||
"eslint": "8.57.0",
|
||||
"eslint-config-thirdweb": "workspace:*",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"js-awe": "^1.0.65",
|
||||
"tinybench": "^2.6.0",
|
||||
"typescript": "5.5.4",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
},
|
||||
"sideEffects": false,
|
||||
"dependencies": {
|
||||
"ethers": "^5.7.2"
|
||||
"ethers": "5.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@preconstruct/cli": "2.7.0",
|
||||
|
||||
@@ -75,7 +75,7 @@
|
||||
"eslint-plugin-inclusive-language": "^2.2.1",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"react": "18.3.1",
|
||||
"typedoc-gen": "workspace:*",
|
||||
"typescript": "5.5.4"
|
||||
|
||||
@@ -92,7 +92,7 @@
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-svg-jsx": "^1.2.4",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"react": "18.3.1",
|
||||
"react-dom": "18.3.1",
|
||||
"stream": "npm:stream-browserify@^3.0.0",
|
||||
|
||||
@@ -101,7 +101,7 @@
|
||||
"eslint-plugin-inclusive-language": "^2.2.1",
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"ethers-aws-kms-signer": "^1.3.2",
|
||||
"hardhat": "^2.22.2",
|
||||
"mocha": "10.5.1",
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"@thirdweb-dev/storage": "workspace:*",
|
||||
"@thirdweb-dev/wallets": "workspace:*",
|
||||
"detect-browser": "^5.3.0",
|
||||
"ethers": "^5.7.2"
|
||||
"ethers": "5.7.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@thirdweb-dev/tsconfig": "workspace:*",
|
||||
|
||||
@@ -599,7 +599,7 @@
|
||||
"eslint-plugin-prettier": "^5.2.1",
|
||||
"eslint-plugin-tsdoc": "^0.3.0",
|
||||
"ethereum-provider": "^0.7.7",
|
||||
"ethers": "^5.7.2",
|
||||
"ethers": "5.7.2",
|
||||
"ethers-aws-kms-signer": "^1.3.2",
|
||||
"hardhat": "^2.22.2",
|
||||
"tweetnacl": "^1.0.3",
|
||||
|
||||
@@ -354,7 +354,9 @@ export async function fromEthersContract<abi extends Abi>(
|
||||
* @returns - A Promise that resolves to an Account object.
|
||||
* @internal
|
||||
*/
|
||||
async function fromEthersSigner(signer: ethers5.Signer): Promise<Account> {
|
||||
export async function fromEthersSigner(
|
||||
signer: ethers5.Signer,
|
||||
): Promise<Account> {
|
||||
const address = await signer.getAddress();
|
||||
const account: Account = {
|
||||
address,
|
||||
|
||||
@@ -235,7 +235,7 @@ export const ethers6Adapter = /* @__PURE__ */ (() => {
|
||||
* @returns The ethers.js provider.
|
||||
* @internal
|
||||
*/
|
||||
function toEthersProvider(
|
||||
export function toEthersProvider(
|
||||
ethers: Ethers6,
|
||||
client: ThirdwebClient,
|
||||
chain: Chain,
|
||||
@@ -260,7 +260,7 @@ function toEthersProvider(
|
||||
* @returns A Promise that resolves to an ethers.js Contract.
|
||||
* @internal
|
||||
*/
|
||||
async function toEthersContract<abi extends Abi = []>(
|
||||
export async function toEthersContract<abi extends Abi = []>(
|
||||
ethers: Ethers6,
|
||||
twContract: ThirdwebContract<abi>,
|
||||
account?: Account,
|
||||
@@ -302,7 +302,7 @@ type FromEthersContractOptions = {
|
||||
* @returns A promise that resolves to a ThirdwebContract instance.
|
||||
* @internal
|
||||
*/
|
||||
async function fromEthersContract<abi extends Abi>({
|
||||
export async function fromEthersContract<abi extends Abi>({
|
||||
client,
|
||||
ethersContract,
|
||||
chain,
|
||||
@@ -321,7 +321,9 @@ async function fromEthersContract<abi extends Abi>({
|
||||
* @returns - A Promise that resolves to an Account object.
|
||||
* @internal
|
||||
*/
|
||||
async function fromEthersSigner(signer: ethers6.Signer): Promise<Account> {
|
||||
export async function fromEthersSigner(
|
||||
signer: ethers6.Signer,
|
||||
): Promise<Account> {
|
||||
const address = await signer.getAddress();
|
||||
const account: Account = {
|
||||
address,
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
export { ethers5Adapter } from "../../adapters/ethers5.js";
|
||||
export {
|
||||
ethers5Adapter,
|
||||
fromEthersContract,
|
||||
toEthersContract,
|
||||
toEthersProvider,
|
||||
toEthersSigner,
|
||||
fromEthersSigner,
|
||||
} from "../../adapters/ethers5.js";
|
||||
|
||||
@@ -1 +1,8 @@
|
||||
export { ethers6Adapter } from "../../adapters/ethers6.js";
|
||||
export {
|
||||
ethers6Adapter,
|
||||
toEthersSigner,
|
||||
fromEthersContract,
|
||||
fromEthersSigner,
|
||||
toEthersContract,
|
||||
toEthersProvider,
|
||||
} from "../../adapters/ethers6.js";
|
||||
|
||||
Generated
+11
-11
@@ -261,7 +261,7 @@ importers:
|
||||
specifier: ^3.6.0
|
||||
version: 3.6.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
flat:
|
||||
specifier: ^6.0.1
|
||||
@@ -1160,7 +1160,7 @@ importers:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
express:
|
||||
specifier: ^4.19.2
|
||||
@@ -1232,7 +1232,7 @@ importers:
|
||||
specifier: ^2.4.1
|
||||
version: 2.4.1
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
got:
|
||||
specifier: 11.8.5
|
||||
@@ -1357,7 +1357,7 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../eslint-config-thirdweb
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
typechain:
|
||||
specifier: ^8.3.2
|
||||
@@ -1394,7 +1394,7 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../eslint-config-thirdweb
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
js-awe:
|
||||
specifier: ^1.0.65
|
||||
@@ -1491,7 +1491,7 @@ importers:
|
||||
legacy_packages/payments:
|
||||
dependencies:
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
devDependencies:
|
||||
'@preconstruct/cli':
|
||||
@@ -1646,7 +1646,7 @@ importers:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
react:
|
||||
specifier: 18.3.1
|
||||
@@ -1746,7 +1746,7 @@ importers:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
react:
|
||||
specifier: 18.3.1
|
||||
@@ -1897,7 +1897,7 @@ importers:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
ethers-aws-kms-signer:
|
||||
specifier: ^1.3.2
|
||||
@@ -2000,7 +2000,7 @@ importers:
|
||||
specifier: ^5.3.0
|
||||
version: 5.3.0
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
devDependencies:
|
||||
'@thirdweb-dev/tsconfig':
|
||||
@@ -2182,7 +2182,7 @@ importers:
|
||||
specifier: ^0.7.7
|
||||
version: 0.7.7
|
||||
ethers:
|
||||
specifier: ^5.7.2
|
||||
specifier: 5.7.2
|
||||
version: 5.7.2([email protected])([email protected])
|
||||
ethers-aws-kms-signer:
|
||||
specifier: ^1.3.2
|
||||
|
||||
Reference in New Issue
Block a user