diff --git a/lib/components/ens-cache-provider.react.js b/lib/components/ens-cache-provider.react.js --- a/lib/components/ens-cache-provider.react.js +++ b/lib/components/ens-cache-provider.react.js @@ -2,7 +2,8 @@ import * as React from 'react'; -import { ENSCache, type EthersProvider } from '../utils/ens-cache.js'; +import type { EthersProvider } from '../types/ethers-types.js'; +import { ENSCache } from '../utils/ens-cache.js'; import { getENSNames as baseGetENSNames, type GetENSNames, diff --git a/lib/types/ethers-types.js b/lib/types/ethers-types.js new file mode 100644 --- /dev/null +++ b/lib/types/ethers-types.js @@ -0,0 +1,8 @@ +// @flow + +export type EthersProvider = { + +lookupAddress: (address: string) => Promise, + +resolveName: (name: string) => Promise, + +getAvatar: (name: string) => Promise, + ... +}; diff --git a/lib/utils/ens-cache.js b/lib/utils/ens-cache.js --- a/lib/utils/ens-cache.js +++ b/lib/utils/ens-cache.js @@ -3,6 +3,7 @@ import namehash from 'eth-ens-namehash'; import sleep from './sleep.js'; +import type { EthersProvider } from '../types/ethers-types.js'; const cacheTimeout = 24 * 60 * 60 * 1000; // one day const failedQueryCacheTimeout = 5 * 60 * 1000; // five minutes @@ -13,12 +14,6 @@ throw new Error(`ENS fetch for ${identifier} timed out`); } -export type EthersProvider = { - +lookupAddress: (address: string) => Promise, - +resolveName: (name: string) => Promise, - +getAvatar: (name: string) => Promise, - ... -}; type ENSNameQueryCacheEntry = { // We normalize ETH addresses to lowercase characters +normalizedETHAddress: string, diff --git a/native/utils/ethers-utils.js b/native/utils/ethers-utils.js --- a/native/utils/ethers-utils.js +++ b/native/utils/ethers-utils.js @@ -4,7 +4,7 @@ import { ethers } from 'ethers'; -import type { EthersProvider } from 'lib/utils/ens-cache.js'; +import type { EthersProvider } from 'lib/types/ethers-types.js'; let alchemyKey; try {