diff --git a/.yalc/@ensdomains/ensjs/dist/cjs/utils/normalise.js b/.yalc/@ensdomains/ensjs/dist/cjs/utils/normalise.js index 83fbafd34..7095f5451 100644 --- a/.yalc/@ensdomains/ensjs/dist/cjs/utils/normalise.js +++ b/.yalc/@ensdomains/ensjs/dist/cjs/utils/normalise.js @@ -30,7 +30,7 @@ __export(normalise_exports, { module.exports = __toCommonJS(normalise_exports); var import_bytes = require("@ethersproject/bytes"); var import_keccak256 = require("@ethersproject/keccak256"); -var import_utf8 = require("@ethersproject/strings/lib/utf8"); +var import_strings = require("@ethersproject/strings"); var import_uts46bundle = __toESM(require("idna-uts46-hx/uts46bundle.js")); var import_labels = require("./labels"); const zeros = new Uint8Array(32); @@ -46,7 +46,7 @@ const namehash = (name) => { labelSha = (0, import_labels.decodeLabelhash)(labels[i]); } else { const normalised = normalise(labels[i]); - labelSha = (0, import_keccak256.keccak256)((0, import_utf8.toUtf8Bytes)(normalised)); + labelSha = (0, import_keccak256.keccak256)((0, import_strings.toUtf8Bytes)(normalised)); } result = (0, import_keccak256.keccak256)((0, import_bytes.concat)([result, labelSha])); } diff --git a/.yalc/@ensdomains/ensjs/dist/esm/utils/normalise.mjs b/.yalc/@ensdomains/ensjs/dist/esm/utils/normalise.mjs index e3432295d..974bbbb73 100644 --- a/.yalc/@ensdomains/ensjs/dist/esm/utils/normalise.mjs +++ b/.yalc/@ensdomains/ensjs/dist/esm/utils/normalise.mjs @@ -1,7 +1,7 @@ // src/utils/normalise.ts import { concat, hexlify } from "@ethersproject/bytes"; import { keccak256 } from "@ethersproject/keccak256"; -import { toUtf8Bytes } from "@ethersproject/strings/lib.esm/utf8.js"; +import { toUtf8Bytes } from "@ethersproject/strings"; import uts46 from "idna-uts46-hx/uts46bundle.js"; import { decodeLabelhash, isEncodedLabelhash } from "./labels.mjs"; var zeros = new Uint8Array(32); diff --git a/.yalc/@ensdomains/ensjs/package.json b/.yalc/@ensdomains/ensjs/package.json index 8114a77e6..e4e336b58 100644 --- a/.yalc/@ensdomains/ensjs/package.json +++ b/.yalc/@ensdomains/ensjs/package.json @@ -99,5 +99,5 @@ "@ethersproject/transactions": "^5.7.0", "@ethersproject/web": "^5.7.1" }, - "yalcSig": "a48202939e398afd18e432ee23beb45d" + "yalcSig": "c2af0cee9f72f35c5bf7a20b63b75f07" } diff --git a/.yalc/@ensdomains/ensjs/src/utils/normalise.ts b/.yalc/@ensdomains/ensjs/src/utils/normalise.ts index 8d512670c..57a42ca5d 100644 --- a/.yalc/@ensdomains/ensjs/src/utils/normalise.ts +++ b/.yalc/@ensdomains/ensjs/src/utils/normalise.ts @@ -1,6 +1,6 @@ import { concat, hexlify } from '@ethersproject/bytes' import { keccak256 } from '@ethersproject/keccak256' -import { toUtf8Bytes } from '@ethersproject/strings/lib/utf8' +import { toUtf8Bytes } from '@ethersproject/strings' import uts46 from 'idna-uts46-hx/uts46bundle.js' import { decodeLabelhash, isEncodedLabelhash } from './labels' diff --git a/.yalc/@ensdomains/ensjs/yalc.sig b/.yalc/@ensdomains/ensjs/yalc.sig index 5e2e11e17..f7a10823c 100644 --- a/.yalc/@ensdomains/ensjs/yalc.sig +++ b/.yalc/@ensdomains/ensjs/yalc.sig @@ -1 +1 @@ -a48202939e398afd18e432ee23beb45d \ No newline at end of file +c2af0cee9f72f35c5bf7a20b63b75f07 \ No newline at end of file diff --git a/deploy/00_deploy_bulk_renewal.ts b/deploy/00_deploy_bulk_renewal.ts index dc2ba0378..88821a805 100644 --- a/deploy/00_deploy_bulk_renewal.ts +++ b/deploy/00_deploy_bulk_renewal.ts @@ -1,9 +1,10 @@ /* eslint-disable import/no-extraneous-dependencies */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' +import { namehash } from '@ensdomains/ensjs/utils/normalise' + const labelHash = (label: string) => ethers.utils.keccak256(ethers.utils.toUtf8Bytes(label)) const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { diff --git a/deploy/00_get_registration_gas_values.ts b/deploy/00_get_registration_gas_values.ts index e8acabe86..174e05330 100644 --- a/deploy/00_get_registration_gas_values.ts +++ b/deploy/00_get_registration_gas_values.ts @@ -1,12 +1,13 @@ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-await-in-loop */ -import { namehash } from 'ethers/lib/utils' import fs from 'fs/promises' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' +import { namehash } from '@ensdomains/ensjs/utils/normalise' + const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) { if (!hre.network.tags.generate) { return true diff --git a/deploy/00_legacy_registry.ts b/deploy/00_legacy_registry.ts index 0fc42e458..6edf15e7e 100644 --- a/deploy/00_legacy_registry.ts +++ b/deploy/00_legacy_registry.ts @@ -1,10 +1,10 @@ /* eslint-disable import/no-extraneous-dependencies, import/extensions */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' import { labelhash } from '@ensdomains/ensjs/utils/labels' +import { namehash } from '@ensdomains/ensjs/utils/normalise' const ZERO_HASH = '0x0000000000000000000000000000000000000000000000000000000000000000' diff --git a/deploy/00_migrate_legacy_records.ts b/deploy/00_migrate_legacy_records.ts index 36f4ed3c3..e9b1e083b 100644 --- a/deploy/00_migrate_legacy_records.ts +++ b/deploy/00_migrate_legacy_records.ts @@ -1,11 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-await-in-loop */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' +import { namehash } from '@ensdomains/ensjs/utils/normalise' + const names = [ { label: 'migrated-resolver-to-be-updated', diff --git a/deploy/00_register_contracts.ts b/deploy/00_register_contracts.ts index 397663c9b..b9c1e41b0 100644 --- a/deploy/00_register_contracts.ts +++ b/deploy/00_register_contracts.ts @@ -1,11 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-await-in-loop */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' +import { namehash } from '@ensdomains/ensjs/utils/normalise' + const names = [ { label: 'data', diff --git a/deploy/00_register_legacy.ts b/deploy/00_register_legacy.ts index 36cc96741..19379c691 100644 --- a/deploy/00_register_legacy.ts +++ b/deploy/00_register_legacy.ts @@ -1,12 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-await-in-loop */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' import { labelhash } from '@ensdomains/ensjs/utils/labels' +import { namehash } from '@ensdomains/ensjs/utils/normalise' type Name = { label: string diff --git a/deploy/00_register_wrapped.ts b/deploy/00_register_wrapped.ts index 6ffded249..c4308a52e 100644 --- a/deploy/00_register_wrapped.ts +++ b/deploy/00_register_wrapped.ts @@ -1,12 +1,12 @@ /* eslint-disable import/no-extraneous-dependencies */ /* eslint-disable no-await-in-loop */ -import { namehash } from 'ethers/lib/utils' import { ethers } from 'hardhat' import { DeployFunction } from 'hardhat-deploy/types' import { HardhatRuntimeEnvironment } from 'hardhat/types' import { PublicResolver__factory } from '@ensdomains/ensjs/generated/factories/PublicResolver__factory' +import { namehash } from '@ensdomains/ensjs/utils/normalise' import { RecordOptions } from '@ensdomains/ensjs/utils/recordHelpers' import { RegistrationParams, diff --git a/loaders/ethers-loader.js b/loaders/ethers-loader.js new file mode 100644 index 000000000..94c9e0fb2 --- /dev/null +++ b/loaders/ethers-loader.js @@ -0,0 +1,74 @@ +const { readdirSync, statSync } = require('fs') +const { join, basename } = require('path') + +const requireAll = (dir) => + readdirSync(dir).reduce((modules, file) => { + const fPath = join(dir, file) + const fPathAsModule = fPath.replace(/.*\/node_modules\//, '') + if (fPath.includes('esm') || fPath.includes('src')) return modules + if (statSync(fPath).isDirectory()) { + return { ...modules, ...requireAll(fPath) } + } + if (file.endsWith('.js')) { + const imported = require(fPath) + let keyMap = Object.keys(imported).map((k) => [k, fPathAsModule]) + if (file === 'index.js') { + keyMap = keyMap.filter(([k]) => !modules[k]) + if (dir.match(/.*\/lib$/g)) { + const [modName] = dir.match(/@ethersproject\/[a-z\-]*/) + return { + ...modules, + ...Object.fromEntries(keyMap), + [modName.replace('@ethersproject/', '')]: modName, + } + } + } + return { ...modules, ...Object.fromEntries(keyMap) } + } + return modules + }, {}) + +const modules = requireAll(join(__dirname, '../node_modules/@ethersproject')) + +exports.default = function (source) { + const newModules = {} + + source = source.replace( + /(?<=\n|^)import {(.*?)} from ["']ethers(\/lib\/((ethers)|(utils)))?["'];\n/gm, + (m, p1) => { + const items = p1.split(',').map((i) => i.trim()) + for (const item of items) { + const original = item.split(' as ')[0] + const importRef = modules[original] + if (importRef) { + if (!importRef.endsWith('js')) { + newModules[importRef] = item + } else { + const arr = newModules[importRef] + if (!arr) newModules[importRef] = [item] + else if (!arr.includes(item)) arr.push(item) + } + } else { + throw new Error(`Could not find module for ${original}`) + } + } + return '' + }, + ) + + let newImports = '' + for (const [k, v] of Object.entries(newModules)) { + if (v === 'logger') { + if (!newModules['@ethersproject/logger/lib/index.js']) { + newImports += `import { Logger } from '${k}';\n` + } + newImports += `const logger = new Logger('ethers');\n` + } else if (typeof v === 'object') { + newImports += `import { ${v.join(', ')} } from '${k}';\n` + } else { + newImports += `import * as ${v} from '${k}';\n` + } + } + + return newImports + source +} diff --git a/next.config.js b/next.config.js index 7697f73b6..807518dc0 100644 --- a/next.config.js +++ b/next.config.js @@ -69,6 +69,14 @@ let nextConfig = { return hash }, webpack: (config, options) => { + config.module.rules.push({ + // test for .js or .mjs + test: /(?=12.4'} peerDependencies: @@ -4067,12 +4072,12 @@ packages: '@vanilla-extract/dynamic': 2.0.2 '@vanilla-extract/sprinkles': 1.4.1_@vanilla-extract+css@1.7.0 clsx: 1.1.1 - ethers: 5.7.1 + ethers: 5.7.2 qrcode: 1.5.0 react: 17.0.2 react-dom: 17.0.2_react@17.0.2 react-remove-scroll: 2.5.4_bwnomau7tnufn56w7nc32j7my4 - wagmi: 0.6.8_xsefmyfaf6lcwqv5jl3f44fore + wagmi: 0.6.8_ausszscqktexhgugz2qxue6rny transitivePeerDependencies: - '@types/react' dev: false @@ -5834,7 +5839,7 @@ packages: '@vanilla-extract/css': 1.7.0 dev: false - /@wagmi/core/0.5.8_kmrkfzmiz5apfxlayfva3hwiai: + /@wagmi/core/0.5.8_5ftux245h3766k2kgra3pefoxa: resolution: {integrity: sha512-1mABf1bXyn3AOHyQkios4FTGqoARa8y1tf7GMH6t1c7q0nAMSbpXoTDdjEidUHy8qhWoG0y3Ez4PjCi8WQnmMg==} peerDependencies: '@coinbase/wallet-sdk': '>=3.3.0' @@ -5846,9 +5851,7 @@ packages: '@walletconnect/ethereum-provider': optional: true dependencies: - '@coinbase/wallet-sdk': 3.5.3 - '@walletconnect/ethereum-provider': 1.8.0 - ethers: 5.7.1 + ethers: 5.7.2 eventemitter3: 4.0.7 zustand: 4.1.1_immer@9.0.15+react@17.0.2 transitivePeerDependencies: @@ -5856,7 +5859,7 @@ packages: - react dev: false - /@wagmi/core/0.5.8_u2cbuxkgrbriqlaofoboagg5ai: + /@wagmi/core/0.5.8_6o7qlqixt7rvy6p5to6xkpdm2u: resolution: {integrity: sha512-1mABf1bXyn3AOHyQkios4FTGqoARa8y1tf7GMH6t1c7q0nAMSbpXoTDdjEidUHy8qhWoG0y3Ez4PjCi8WQnmMg==} peerDependencies: '@coinbase/wallet-sdk': '>=3.3.0' @@ -5868,7 +5871,9 @@ packages: '@walletconnect/ethereum-provider': optional: true dependencies: - ethers: 5.7.1 + '@coinbase/wallet-sdk': 3.5.3 + '@walletconnect/ethereum-provider': 1.8.0 + ethers: 5.7.2 eventemitter3: 4.0.7 zustand: 4.1.1_immer@9.0.15+react@17.0.2 transitivePeerDependencies: @@ -11540,43 +11545,6 @@ packages: - utf-8-validate dev: true - /ethers/5.7.1: - resolution: {integrity: sha512-5krze4dRLITX7FpU8J4WscXqADiKmyeNlylmmDLbS95DaZpBhDe2YSwRQwKXWNyXcox7a3gBgm/MkGXV1O1S/Q==} - dependencies: - '@ethersproject/abi': 5.7.0 - '@ethersproject/abstract-provider': 5.7.0 - '@ethersproject/abstract-signer': 5.7.0 - '@ethersproject/address': 5.7.0 - '@ethersproject/base64': 5.7.0 - '@ethersproject/basex': 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/hdnode': 5.7.0 - '@ethersproject/json-wallets': 5.7.0 - '@ethersproject/keccak256': 5.7.0 - '@ethersproject/logger': 5.7.0 - '@ethersproject/networks': 5.7.1 - '@ethersproject/pbkdf2': 5.7.0 - '@ethersproject/properties': 5.7.0 - '@ethersproject/providers': 5.7.1 - '@ethersproject/random': 5.7.0 - '@ethersproject/rlp': 5.7.0 - '@ethersproject/sha2': 5.7.0 - '@ethersproject/signing-key': 5.7.0 - '@ethersproject/solidity': 5.7.0 - '@ethersproject/strings': 5.7.0 - '@ethersproject/transactions': 5.7.0 - '@ethersproject/units': 5.7.0 - '@ethersproject/wallet': 5.7.0 - '@ethersproject/web': 5.7.1 - '@ethersproject/wordlists': 5.7.0 - transitivePeerDependencies: - - bufferutil - - utf-8-validate - /ethers/5.7.2: resolution: {integrity: sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==} dependencies: @@ -13090,16 +13058,6 @@ packages: hardhat: 2.11.2_mwhvu7sfp6vq5ryuwb6hlbjfka dev: true - /hardhat-deploy-ethers/0.3.0-beta.13_liuail6phkx7un26teqxcf6yx4: - resolution: {integrity: sha512-PdWVcKB9coqWV1L7JTpfXRCI91Cgwsm7KLmBcwZ8f0COSm1xtABHZTyz3fvF6p42cTnz1VM0QnfDvMFlIRkSNw==} - peerDependencies: - ethers: ^5.0.0 - hardhat: ^2.0.0 - dependencies: - ethers: 5.7.1 - hardhat: 2.11.2_mwhvu7sfp6vq5ryuwb6hlbjfka - dev: true - /hardhat-deploy-ethers/0.3.0-beta.13_vf54o5zygcw7cr76twqof3t24a: resolution: {integrity: sha512-PdWVcKB9coqWV1L7JTpfXRCI91Cgwsm7KLmBcwZ8f0COSm1xtABHZTyz3fvF6p42cTnz1VM0QnfDvMFlIRkSNw==} peerDependencies: @@ -13107,8 +13065,7 @@ packages: hardhat: ^2.0.0 dependencies: ethers: 5.7.2 - hardhat: 2.11.2 - dev: false + hardhat: 2.11.2_mwhvu7sfp6vq5ryuwb6hlbjfka /hardhat-deploy/0.11.16: resolution: {integrity: sha512-dEpbrp3wewfEkDVroOiOteDvKc2BOMQzbjljHJkk65mb8gQZ0c0GsZBoLXROWSRoNhPCFjEDAhKPqBds5pclqQ==} @@ -18347,7 +18304,7 @@ packages: react: 17.0.2 react-remove-scroll-bar: 2.3.3_bwnomau7tnufn56w7nc32j7my4 react-style-singleton: 2.2.1_bwnomau7tnufn56w7nc32j7my4 - tslib: 2.4.0 + tslib: 2.4.1 use-callback-ref: 1.3.0_bwnomau7tnufn56w7nc32j7my4 use-sidecar: 1.1.2_bwnomau7tnufn56w7nc32j7my4 dev: false @@ -18943,7 +18900,7 @@ packages: /rxjs/7.5.7: resolution: {integrity: sha512-z9MzKh/UcOqB3i20H6rtrlaE/CgjLOvheWK/9ILrbhROGTweAi1BaFsTT9FbwZi5Trr1qNRs+MXkhmR06awzQA==} dependencies: - tslib: 2.4.0 + tslib: 2.4.1 dev: true /safe-buffer/5.1.2: @@ -20848,6 +20805,7 @@ packages: /tslib/2.4.0: resolution: {integrity: sha512-d6xOpEDfsi2CZVlPQzGeux8XMwLT9hssAsaPYExaQMuYskwb+x1x7J371tWlbBdWHroy99KnVB6qIkUbs5X3UQ==} + dev: false /tslib/2.4.1: resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==} @@ -21459,7 +21417,7 @@ packages: xml-name-validator: 3.0.0 dev: true - /wagmi/0.6.8_xsefmyfaf6lcwqv5jl3f44fore: + /wagmi/0.6.8_ausszscqktexhgugz2qxue6rny: resolution: {integrity: sha512-pIOn7I56KPfdPQ1WRIWzWnpC8eJZm1V25Rcn5fbgOJ2eV3kjGNchnIub/ERY1VMKywxkCAfgXfn2D/tqwCJsWw==} peerDependencies: ethers: '>=5.5.1' @@ -21469,9 +21427,9 @@ packages: '@tanstack/query-sync-storage-persister': 4.10.3 '@tanstack/react-query': 4.10.3_sfoxds7t5ydpegc3knd667wn6m '@tanstack/react-query-persist-client': 4.10.3_44u2an622imnmu2zk5qotweaoa - '@wagmi/core': 0.5.8_kmrkfzmiz5apfxlayfva3hwiai + '@wagmi/core': 0.5.8_6o7qlqixt7rvy6p5to6xkpdm2u '@walletconnect/ethereum-provider': 1.8.0 - ethers: 5.7.1 + ethers: 5.7.2 react: 17.0.2 use-sync-external-store: 1.2.0_react@17.0.2 transitivePeerDependencies: @@ -23152,7 +23110,7 @@ packages: use-sync-external-store: 1.2.0_react@17.0.2 dev: false - file:.yalc/@ensdomains/ensjs_ieqas7m66pmgjq3ruwnquy4qyq: + file:.yalc/@ensdomains/ensjs_f2qxwv66g46rb33uzxnl5nluty: resolution: {directory: .yalc/@ensdomains/ensjs, type: directory} id: file:.yalc/@ensdomains/ensjs name: '@ensdomains/ensjs' @@ -23176,7 +23134,19 @@ packages: '@ensdomains/content-hash': 2.5.7 '@ensdomains/dnsprovejs': 0.4.1 '@ensdomains/dnssecoraclejs': 0.2.7_kdpqpin542yrq2nndtznhtz4cm - '@ethersproject/providers': 5.7.1 + '@ethersproject/abi': 5.7.0 + '@ethersproject/abstract-provider': 5.7.0 + '@ethersproject/abstract-signer': 5.7.0 + '@ethersproject/address': 5.7.0 + '@ethersproject/bignumber': 5.7.0 + '@ethersproject/bytes': 5.7.0 + '@ethersproject/contracts': 5.7.0 + '@ethersproject/keccak256': 5.7.0 + '@ethersproject/providers': 5.7.2 + '@ethersproject/solidity': 5.7.0 + '@ethersproject/strings': 5.7.0 + '@ethersproject/transactions': 5.7.0 + '@ethersproject/web': 5.7.1 cbor: 8.1.0 dns-packet: 5.4.0 graphql: 16.6.0 diff --git a/src/components/@atoms/CurrencyText/CurrencyText.test.tsx b/src/components/@atoms/CurrencyText/CurrencyText.test.tsx index ad3662555..15693e5b0 100644 --- a/src/components/@atoms/CurrencyText/CurrencyText.test.tsx +++ b/src/components/@atoms/CurrencyText/CurrencyText.test.tsx @@ -1,6 +1,6 @@ import { mockFunction, render, screen } from '@app/test-utils' -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useEthPrice } from '@app/hooks/useEthPrice' diff --git a/src/components/@atoms/CurrencyText/CurrencyText.tsx b/src/components/@atoms/CurrencyText/CurrencyText.tsx index b4476638e..791f9f9e8 100644 --- a/src/components/@atoms/CurrencyText/CurrencyText.tsx +++ b/src/components/@atoms/CurrencyText/CurrencyText.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useEthPrice } from '@app/hooks/useEthPrice' import { CurrencyDisplay } from '@app/types' diff --git a/src/components/@atoms/GasDisplay.tsx b/src/components/@atoms/GasDisplay.tsx index 0b47d3f00..5398a2dbf 100644 --- a/src/components/@atoms/GasDisplay.tsx +++ b/src/components/@atoms/GasDisplay.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import styled, { css } from 'styled-components' import GasSVG from '@app/assets/Gas.svg' diff --git a/src/components/@atoms/Invoice/Invoice.test.tsx b/src/components/@atoms/Invoice/Invoice.test.tsx index d1dad997e..53c582902 100644 --- a/src/components/@atoms/Invoice/Invoice.test.tsx +++ b/src/components/@atoms/Invoice/Invoice.test.tsx @@ -1,6 +1,6 @@ import { mockFunction, render, screen } from '@app/test-utils' -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useEthPrice } from '@app/hooks/useEthPrice' diff --git a/src/components/@atoms/Invoice/Invoice.tsx b/src/components/@atoms/Invoice/Invoice.tsx index 6afed57ab..9cd48c9eb 100644 --- a/src/components/@atoms/Invoice/Invoice.tsx +++ b/src/components/@atoms/Invoice/Invoice.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import styled, { css } from 'styled-components' import { Colors } from '@ensdomains/thorin' diff --git a/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.test.tsx b/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.test.tsx index b4e4dfe2d..cee37ddf1 100644 --- a/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.test.tsx +++ b/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.test.tsx @@ -1,6 +1,6 @@ import { render, screen, waitFor } from '@app/test-utils' -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { RegistrationTimeComparisonBanner } from './RegistrationTimeComparisonBanner' diff --git a/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.tsx b/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.tsx index 848ebcd14..720757bc3 100644 --- a/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.tsx +++ b/src/components/@atoms/RegistrationTimeComparisonBanner/RegistrationTimeComparisonBanner.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' diff --git a/src/components/@molecules/DogFood.tsx b/src/components/@molecules/DogFood.tsx index b98dfe888..66032afdb 100644 --- a/src/components/@molecules/DogFood.tsx +++ b/src/components/@molecules/DogFood.tsx @@ -1,10 +1,10 @@ -import { ethers } from 'ethers' +import { isAddress } from '@ethersproject/address' +import pMemoize from 'p-memoize' import { useEffect, useRef } from 'react' import { useForm } from 'react-hook-form' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' import { useQuery } from 'wagmi' -import pMemoize from 'p-memoize'; import { Input } from '@ensdomains/thorin' @@ -72,7 +72,7 @@ export const DogFood = ( ? t('errors.addressLength') : undefined, isAddress: (value) => - !disabled && !value?.includes('.') && !ethers.utils.isAddress(value) + !disabled && !value?.includes('.') && !isAddress(value) ? t('errors.invalidAddress') : undefined, hasAddressRecord: async (value) => { diff --git a/src/components/@molecules/ProfileEditor/Avatar/AvatarNFT.tsx b/src/components/@molecules/ProfileEditor/Avatar/AvatarNFT.tsx index 2b3510ff8..3345d50df 100644 --- a/src/components/@molecules/ProfileEditor/Avatar/AvatarNFT.tsx +++ b/src/components/@molecules/ProfileEditor/Avatar/AvatarNFT.tsx @@ -1,5 +1,5 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { ReactNode, useCallback, useState } from 'react' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' diff --git a/src/components/@molecules/ProfileEditor/Avatar/AvatarUpload.tsx b/src/components/@molecules/ProfileEditor/Avatar/AvatarUpload.tsx index 0b31732df..57c96a7e0 100644 --- a/src/components/@molecules/ProfileEditor/Avatar/AvatarUpload.tsx +++ b/src/components/@molecules/ProfileEditor/Avatar/AvatarUpload.tsx @@ -1,6 +1,6 @@ /* eslint-disable no-multi-assign */ +import { sha256 } from '@ethersproject/sha2' import { useMutation } from '@tanstack/react-query' -import { sha256 } from 'ethers/lib/utils' import { useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' diff --git a/src/components/@molecules/TransactionDialogManager/stage/TransactionStageModal.tsx b/src/components/@molecules/TransactionDialogManager/stage/TransactionStageModal.tsx index e879b72c2..01945e7d6 100644 --- a/src/components/@molecules/TransactionDialogManager/stage/TransactionStageModal.tsx +++ b/src/components/@molecules/TransactionDialogManager/stage/TransactionStageModal.tsx @@ -1,5 +1,6 @@ +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import type { JsonRpcSigner } from '@ethersproject/providers' -import { BigNumber, utils } from 'ethers' +import { toUtf8String } from '@ethersproject/strings' import { Dispatch, useCallback, useEffect, useMemo, useState } from 'react' import { useTranslation } from 'react-i18next' import styled, { css, keyframes } from 'styled-components' @@ -419,7 +420,7 @@ export const TransactionStageModal = ({ return 'transaction.dialog.error.gasLimit' } catch (err: any) { const code = err.data.replace('Reverted ', '') - const reason = utils.toUtf8String(`0x${code.substr(138)}`) + const reason = toUtf8String(`0x${code.substr(138)}`) return reason } }, diff --git a/src/components/pages/import/[name]/AddTextRecord.tsx b/src/components/pages/import/[name]/AddTextRecord.tsx index fdaca51c9..cda35bee6 100644 --- a/src/components/pages/import/[name]/AddTextRecord.tsx +++ b/src/components/pages/import/[name]/AddTextRecord.tsx @@ -1,4 +1,4 @@ -import { utils } from 'ethers' +import { isAddress } from '@ethersproject/address' import { Dispatch, SetStateAction, useState } from 'react' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' @@ -144,7 +144,7 @@ export const AddTextRecord = ({ // DNS record is not set setSyncWarning(false) setErrorState(Errors.DNS_RECORD_DOES_NOT_EXIST) - } else if (!utils.isAddress(dnsOwner)) { + } else if (!isAddress(dnsOwner)) { // Invalid DNS record setSyncWarning(false) setErrorState(Errors.DNS_RECORD_INVALID) diff --git a/src/components/pages/profile/[name]/tabs/MoreTab/Fuses.test.tsx b/src/components/pages/profile/[name]/tabs/MoreTab/Fuses.test.tsx index fe16b962f..863db5c24 100644 --- a/src/components/pages/profile/[name]/tabs/MoreTab/Fuses.test.tsx +++ b/src/components/pages/profile/[name]/tabs/MoreTab/Fuses.test.tsx @@ -1,6 +1,6 @@ import { mockFunction, render, screen } from '@app/test-utils' -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useRouter } from 'next/router' import Fuses from './Fuses' diff --git a/src/components/pages/profile/[name]/tabs/MoreTab/Token.test.tsx b/src/components/pages/profile/[name]/tabs/MoreTab/Token.test.tsx index ca7b22681..12d51622e 100644 --- a/src/components/pages/profile/[name]/tabs/MoreTab/Token.test.tsx +++ b/src/components/pages/profile/[name]/tabs/MoreTab/Token.test.tsx @@ -1,6 +1,9 @@ import { mockFunction, render, screen } from '@app/test-utils' -import { BigNumber, utils } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' + +import { labelhash } from '@ensdomains/ensjs/utils/labels' +import { namehash } from '@ensdomains/ensjs/utils/normalise' import { useChainId } from '@app/hooks/useChainId' import { useBreakpoint } from '@app/utils/BreakpointProvider' @@ -22,22 +25,22 @@ describe('Token', () => { mockUseChainId.mockReturnValue(1) const name = 'nick.eth' const label = 'nick' - const labelhash = utils.keccak256(utils.toUtf8Bytes(label)) - const tokenId = BigNumber.from(labelhash).toString() + const labelHash = labelhash(label) + const tokenId = BigNumber.from(labelHash).toString() render() - expect(screen.getByText(labelhash)).toBeVisible() + expect(screen.getByText(labelHash)).toBeVisible() expect(screen.getByText(tokenId)).toBeVisible() }) it('should display the correct tokenID (decimal and hex) for an wrapped names', () => { mockUseChainId.mockReturnValue(1) const name = 'nick.eth' - const namehash = utils.namehash(name) - const tokenId = BigNumber.from(namehash).toString() + const nameHash = namehash(name) + const tokenId = BigNumber.from(nameHash).toString() render() - expect(screen.getByText(namehash)).toBeVisible() + expect(screen.getByText(nameHash)).toBeVisible() expect(screen.getByText(tokenId)).toBeVisible() }) }) diff --git a/src/components/pages/profile/[name]/tabs/MoreTab/Token.tsx b/src/components/pages/profile/[name]/tabs/MoreTab/Token.tsx index 04aeeecb6..07ca275ca 100644 --- a/src/components/pages/profile/[name]/tabs/MoreTab/Token.tsx +++ b/src/components/pages/profile/[name]/tabs/MoreTab/Token.tsx @@ -1,9 +1,9 @@ -import { BigNumber } from 'ethers' -import { namehash } from 'ethers/lib/utils' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' import { labelhash } from '@ensdomains/ensjs/utils/labels' +import { namehash } from '@ensdomains/ensjs/utils/normalise' import { Typography, mq } from '@ensdomains/thorin' import { NFTWithPlaceholder } from '@app/components/NFTWithPlaceholder' diff --git a/src/constants/gasLimits.ts b/src/constants/gasLimits.ts index b75c87886..bbad0e483 100644 --- a/src/constants/gasLimits.ts +++ b/src/constants/gasLimits.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' const SingleNameGasLimit = BigNumber.from('105000') const BulkRenewalBaseGasLimit = BigNumber.from('105000') diff --git a/src/hooks/transactions/TransactionStoreContext.tsx b/src/hooks/transactions/TransactionStoreContext.tsx index 1adb48f74..d555c60cd 100644 --- a/src/hooks/transactions/TransactionStoreContext.tsx +++ b/src/hooks/transactions/TransactionStoreContext.tsx @@ -1,4 +1,4 @@ -import { providers } from 'ethers' +import type { BaseProvider } from '@ethersproject/providers' import React, { createContext, useContext, useEffect, useState } from 'react' import { useAccount, useProvider } from 'wagmi' @@ -14,7 +14,7 @@ let storeSingleton: ReturnType | undefined const TransactionStoreContext = createContext(null) export function TransactionStoreProvider({ children }: { children: React.ReactNode }) { - const provider = useProvider() + const provider = useProvider() const { address } = useAccount() const chainId = useChainId() diff --git a/src/hooks/transactions/transactionStore.ts b/src/hooks/transactions/transactionStore.ts index e4f683a59..1e498eb0b 100644 --- a/src/hooks/transactions/transactionStore.ts +++ b/src/hooks/transactions/transactionStore.ts @@ -2,7 +2,8 @@ /* eslint-disable @typescript-eslint/no-use-before-define */ // this is taken from rainbowkit -import { BigNumber, providers } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' +import type { BaseProvider, Block } from '@ethersproject/providers' const storageKey = 'transaction-data' @@ -72,19 +73,15 @@ function validateTransaction(transaction: NewTransaction): string[] { return errors } -export function createTransactionStore({ - provider: initialProvider, -}: { - provider: providers.BaseProvider -}) { +export function createTransactionStore({ provider: initialProvider }: { provider: BaseProvider }) { let data: Data = loadData() let provider = initialProvider const listeners: Set<() => void> = new Set() const transactionRequestCache: Map> = new Map() - const blockRequestCache: Map> = new Map() + const blockRequestCache: Map> = new Map() - function setProvider(newProvider: providers.BaseProvider): void { + function setProvider(newProvider: BaseProvider): void { provider = newProvider } diff --git a/src/hooks/useEstimateGasLimitForTransactions.ts b/src/hooks/useEstimateGasLimitForTransactions.ts index 8db026df8..aa09a1763 100644 --- a/src/hooks/useEstimateGasLimitForTransactions.ts +++ b/src/hooks/useEstimateGasLimitForTransactions.ts @@ -1,5 +1,5 @@ import type { JsonRpcSigner } from '@ethersproject/providers' -import { utils } from 'ethers' +import { formatEther } from '@ethersproject/units' import { useQuery, useSigner } from 'wagmi' import { @@ -68,7 +68,7 @@ export const useEstimateGasLimitForTransactions = ( return { gasLimit: data?.gasLimit, - gasCostEth: utils.formatEther(data?.gasCost || 0), + gasCostEth: formatEther(data?.gasCost || 0), estimates: data?.estimates, ...results, } diff --git a/src/hooks/useEstimateRegistration.ts b/src/hooks/useEstimateRegistration.ts index 9f6818b19..cc48e296e 100644 --- a/src/hooks/useEstimateRegistration.ts +++ b/src/hooks/useEstimateRegistration.ts @@ -1,5 +1,5 @@ -import { BigNumber } from 'ethers' -import { toUtf8Bytes } from 'ethers/lib/utils' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' +import { toUtf8Bytes } from '@ethersproject/strings/lib/utf8' import { useMemo } from 'react' import { useFeeData, useQuery } from 'wagmi' diff --git a/src/hooks/useEthPrice.ts b/src/hooks/useEthPrice.ts index 2d2794db0..8ce3bb35f 100644 --- a/src/hooks/useEthPrice.ts +++ b/src/hooks/useEthPrice.ts @@ -1,4 +1,5 @@ -import { BigNumber, ethers } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' +import { Contract } from '@ethersproject/contracts' import { useProvider, useQuery } from 'wagmi' import AggregatorInterface from '@ensdomains/ens-contracts/build/contracts/AggregatorInterface.json' @@ -26,7 +27,7 @@ export const useEthPrice = () => { } if (!address) throw new Error('Contract address not found') if (typeof address !== 'string') throw new Error('Contract address is wrong type') - const oracle = new ethers.Contract(address, AggregatorInterface, provider) + const oracle = new Contract(address, AggregatorInterface, provider) const latest = (await oracle.latestAnswer()) as BigNumber return latest }, diff --git a/src/hooks/useResolverStatus.test.ts b/src/hooks/useResolverStatus.test.ts index 7bb4c50b6..bfb36be11 100644 --- a/src/hooks/useResolverStatus.test.ts +++ b/src/hooks/useResolverStatus.test.ts @@ -1,8 +1,9 @@ import { mockFunction, renderHook } from '@app/test-utils' -import { useProfile } from './useProfile' -import { useResolverStatus } from './useResolverStatus' + import { useEns } from '../utils/EnsProvider' import { useContractAddress } from './useContractAddress' +import { useProfile } from './useProfile' +import { useResolverStatus } from './useResolverStatus' jest.mock('@app/utils/EnsProvider') jest.mock('@app/hooks/useContractAddress') diff --git a/src/hooks/useResolverStatus.ts b/src/hooks/useResolverStatus.ts index c1061964b..a75c976fe 100644 --- a/src/hooks/useResolverStatus.ts +++ b/src/hooks/useResolverStatus.ts @@ -1,9 +1,11 @@ -import { useEns } from '@app/utils/EnsProvider' +import { useQuery } from '@tanstack/react-query' + import { Profile } from '@app/types' +import { useEns } from '@app/utils/EnsProvider' import { contentHashToString } from '@app/utils/contenthash' -import { useQuery } from '@tanstack/react-query' -import { useProfile } from './useProfile' + import { useContractAddress } from './useContractAddress' +import { useProfile } from './useProfile' const areRecordsEqual = (a: Profile['records'], b: Profile['records']): boolean => { const areTextsEqual = Object.values( diff --git a/src/hooks/useValidate.test.ts b/src/hooks/useValidate.test.ts index 2c7ba0088..ca8d95955 100644 --- a/src/hooks/useValidate.test.ts +++ b/src/hooks/useValidate.test.ts @@ -1,13 +1,13 @@ import { mockFunction, renderHook } from '@app/test-utils' -import { isAddress } from 'ethers/lib/utils' +import { isAddress } from '@ethersproject/address' import { parseInputType, validateName } from '@ensdomains/ensjs/utils/validation' import { useValidate, useValidateOrAddress } from './useValidate' jest.mock('@ensdomains/ensjs/utils/validation') -jest.mock('ethers/lib/utils') +jest.mock('@ethersproject/address') const mockParseInputType = mockFunction(parseInputType) const mockValidateName = mockFunction(validateName) diff --git a/src/hooks/useValidate.ts b/src/hooks/useValidate.ts index 1c7854287..10f853438 100644 --- a/src/hooks/useValidate.ts +++ b/src/hooks/useValidate.ts @@ -1,4 +1,4 @@ -import { isAddress } from 'ethers/lib/utils' +import { isAddress } from '@ethersproject/address' import { useEffect, useMemo, useState } from 'react' import { parseInputType, validateName } from '@ensdomains/ensjs/utils/validation' diff --git a/src/test-utils.tsx b/src/test-utils.tsx index 9aa74f854..534676fb9 100644 --- a/src/test-utils.tsx +++ b/src/test-utils.tsx @@ -1,11 +1,11 @@ /* eslint-disable import/no-extraneous-dependencies */ +import { StaticJsonRpcProvider } from '@ethersproject/providers/lib/url-json-rpc-provider' +import { Wallet } from '@ethersproject/wallet' import { QueryClient, QueryClientProvider } from '@tanstack/react-query' import { RenderOptions, render } from '@testing-library/react' import { RenderHookOptions, renderHook } from '@testing-library/react-hooks' import userEvent from '@testing-library/user-event' import { MockConnector } from '@wagmi/core/connectors/mock' -import { providers } from 'ethers' -import { Wallet } from 'ethers/lib/ethers' import React, { FC, ReactElement } from 'react' import { ThemeProvider } from 'styled-components' import { WagmiConfig, createClient } from 'wagmi' @@ -15,13 +15,18 @@ import { ThorinGlobalStyles, lightTheme } from '@ensdomains/thorin' import { DeepPartial } from './types' jest.mock('wagmi', () => { - const { useQuery, useInfiniteQuery, createClient, WagmiConfig } = jest.requireActual('wagmi') + const { + useQuery, + useInfiniteQuery, + createClient: _createClient, + WagmiConfig: _WagmiConfig, + } = jest.requireActual('wagmi') return { useQuery, useInfiniteQuery, - createClient, - WagmiConfig, + createClient: _createClient, + WagmiConfig: _WagmiConfig, useAccount: jest.fn(), useNetwork: jest.fn(), useProvider: jest.fn(), @@ -50,7 +55,7 @@ beforeEach(() => queryClient.clear()) const privateKey = '0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80' -class EthersProviderWrapper extends providers.StaticJsonRpcProvider { +class EthersProviderWrapper extends StaticJsonRpcProvider { toJSON() { return `` } diff --git a/src/transaction-flow/input/ExtendNames/ExtendNames-flow.tsx b/src/transaction-flow/input/ExtendNames/ExtendNames-flow.tsx index c8822acef..ce4464e67 100644 --- a/src/transaction-flow/input/ExtendNames/ExtendNames-flow.tsx +++ b/src/transaction-flow/input/ExtendNames/ExtendNames-flow.tsx @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { useState } from 'react' import { useTranslation } from 'react-i18next' import styled, { css } from 'styled-components' diff --git a/src/transaction-flow/transaction/extendNames.ts b/src/transaction-flow/transaction/extendNames.ts index 9a6489e04..c39df5f21 100644 --- a/src/transaction-flow/transaction/extendNames.ts +++ b/src/transaction-flow/transaction/extendNames.ts @@ -1,5 +1,5 @@ +import type { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import type { JsonRpcSigner } from '@ethersproject/providers' -import type { BigNumber } from 'ethers' import type { TFunction } from 'react-i18next' import { HelperProps, PublicENS, Transaction, TransactionDisplayItem } from '@app/types' diff --git a/src/transaction-flow/transaction/testSendName.ts b/src/transaction-flow/transaction/testSendName.ts index 7c6c4a10e..53823728f 100644 --- a/src/transaction-flow/transaction/testSendName.ts +++ b/src/transaction-flow/transaction/testSendName.ts @@ -1,5 +1,5 @@ +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import type { JsonRpcSigner } from '@ethersproject/providers' -import { BigNumber } from 'ethers' import type { TFunction } from 'react-i18next' import { PublicENS, Transaction, TransactionDisplayItem } from '@app/types' diff --git a/src/types/index.ts b/src/types/index.ts index ffef07aee..ef41eb71c 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -1,5 +1,5 @@ +import type { PopulatedTransaction } from '@ethersproject/contracts' import type { JsonRpcSigner } from '@ethersproject/providers' -import { PopulatedTransaction } from 'ethers' import { ComponentProps } from 'react' import type { TFunction } from 'react-i18next' diff --git a/src/utils/contenthash.ts b/src/utils/contenthash.ts index 9759a6b8b..ad442c4d9 100644 --- a/src/utils/contenthash.ts +++ b/src/utils/contenthash.ts @@ -1,4 +1,4 @@ -import { utils } from 'ethers' +import { isHexString } from '@ethersproject/bytes/lib/index' import contentHash from '@ensdomains/content-hash' import { DecodedContentHash } from '@ensdomains/ensjs/utils/contentHash' @@ -134,7 +134,7 @@ export const validateContent = (encoded: string) => { export const isValidContenthash = (encoded: string) => { try { const codec = contentHash.getCodec(encoded) - return utils.isHexString(encoded) && supportedCodecs.includes(codec) + return isHexString(encoded) && supportedCodecs.includes(codec) } catch { return false } diff --git a/src/utils/currency.ts b/src/utils/currency.ts index 1c9ad66ed..ace601969 100644 --- a/src/utils/currency.ts +++ b/src/utils/currency.ts @@ -1,4 +1,5 @@ -import { BigNumber, FixedNumber } from 'ethers' +import { formatFixed } from '@ethersproject/bignumber' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' export const makeDisplay = ( val: BigNumber | number, @@ -6,12 +7,7 @@ export const makeDisplay = ( symbol: string, fromDecimals: number = 18, ) => { - let number: number - if (val instanceof BigNumber) { - number = FixedNumber.fromValue(val, fromDecimals).toUnsafeFloat() - } else { - number = val - } + const number = typeof val === 'number' ? val : Number(formatFixed(val, fromDecimals)) const options: Intl.NumberFormatOptions & { [x: string]: string } = { style: 'currency', currency: symbol.toLowerCase(), diff --git a/src/utils/gradient.ts b/src/utils/gradient.ts index f76aa0790..20dae7d07 100644 --- a/src/utils/gradient.ts +++ b/src/utils/gradient.ts @@ -1,4 +1,4 @@ -import { arrayify } from 'ethers/lib/utils' +import { arrayify } from '@ethersproject/bytes/lib/index' import { namehash } from '@ensdomains/ensjs/utils/normalise' diff --git a/src/utils/registrationStatus.test.ts b/src/utils/registrationStatus.test.ts index ac5f3b192..e80fb3435 100644 --- a/src/utils/registrationStatus.test.ts +++ b/src/utils/registrationStatus.test.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import { ReturnedENS } from '@app/types' diff --git a/src/utils/registrationStatus.ts b/src/utils/registrationStatus.ts index 53a3a9f91..3a133a06e 100644 --- a/src/utils/registrationStatus.ts +++ b/src/utils/registrationStatus.ts @@ -1,4 +1,4 @@ -import { BigNumber } from 'ethers' +import { BigNumber } from '@ethersproject/bignumber/lib/bignumber' import type { ReturnedENS } from '@app/types/index' diff --git a/src/utils/utils.ts b/src/utils/utils.ts index a2c38a307..6d0f2652a 100644 --- a/src/utils/utils.ts +++ b/src/utils/utils.ts @@ -1,4 +1,4 @@ -import { toUtf8Bytes } from 'ethers/lib/utils' +import { toUtf8Bytes } from '@ethersproject/strings/lib/utf8' import { networkName } from './constants' diff --git a/src/validators/validateContract.ts b/src/validators/validateContract.ts index 88a9bce2d..f8a29c8d6 100644 --- a/src/validators/validateContract.ts +++ b/src/validators/validateContract.ts @@ -1,4 +1,5 @@ -import { ethers } from 'ethers' +import { isAddress } from '@ethersproject/address' +import { Contract } from '@ethersproject/contracts' const supportsInterfaceAbi = [ { @@ -72,11 +73,11 @@ const validateContract = async ( address: string, provider: any, ) => { - if (!ethers.utils.isAddress(address)) { + if (!isAddress(address)) { return ['Address is not a valid address'] } - const maybeContract = new ethers.Contract(address, supportsInterfaceAbi, provider) + const maybeContract = new Contract(address, supportsInterfaceAbi, provider) let results try { results = await Promise.all( diff --git a/tsconfig.json b/tsconfig.json index 484fa38ee..247b2f69d 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -17,7 +17,7 @@ } }, "compilerOptions": { - "target": "es6", + "target": "es2020", "lib": ["dom", "dom.iterable", "esnext"], "downlevelIteration": true, "allowJs": true, diff --git a/yalc.lock b/yalc.lock index 73495cac3..276326317 100644 --- a/yalc.lock +++ b/yalc.lock @@ -2,8 +2,8 @@ "version": "v1", "packages": { "@ensdomains/ensjs": { - "signature": "a48202939e398afd18e432ee23beb45d", - "file": true, + "signature": "c2af0cee9f72f35c5bf7a20b63b75f07", + "pure": true, "replaced": "3.0.0-alpha.37" } }