Skip to content

Commit

Permalink
clean up sonar cloud issues
Browse files Browse the repository at this point in the history
  • Loading branch information
storywithoutend committed Oct 14, 2024
1 parent f63e4a4 commit 12e2714
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 20 deletions.
6 changes: 1 addition & 5 deletions packages/ensjs/deploy/00_register_wrapped.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,9 @@ const names = [
* @type {import('hardhat-deploy/types').DeployFunction}
*/
const func = async function (hre) {
const { getNamedAccounts, network } = hre
const allNamedAccts = await getNamedAccounts()

const { network } = hre
const nameGenerator = await makeNameGenerator(hre)

const publicResolver = await ethers.getContract('PublicResolver')

await network.provider.send('anvil_setBlockTimestampInterval', [60])

for (const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ describe('check that concurrent names all have the same expiry date', () => {
const owner = ownerData?.registrant ?? ownerData?.owner
expect(owner).toEqual(user4)
const expiryData = await getExpiry(publicClient, { name })
const expiryValue = expiryData?.expiry?.value || 0n
const expiryValue = expiryData?.expiry?.value ?? 0n
if (!expiry) expiry = expiryValue

const wrapperData = await getWrapperData(publicClient, { name })
Expand Down
3 changes: 0 additions & 3 deletions packages/ensjs/src/functions/subgraph/getNamesForAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,6 @@ const getOrderByFilter = ({
}
case 'createdAt': {
return getCreatedAtOrderFilter({ lastDomain, orderDirection })
return {
[`createdAt_${operator}`]: `${lastDomain.createdAt.value / 1000}`,
}
}
default:
throw new InvalidOrderByError({
Expand Down
6 changes: 3 additions & 3 deletions packages/ensjs/utils/legacyNameGenerator.cjs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable import/no-extraneous-dependencies */
const { namehash, labelhash } = require('viem')

const makeNameGenerator = async (hre, optionalNonceManager ) => {
const { getNamedAccounts, network } = hre
const makeNameGenerator = async (hre, optionalNonceManager) => {
const { getNamedAccounts } = hre
const allNamedAccts = await getNamedAccounts()
const controller = await ethers.getContract('LegacyETHRegistrarController')
const publicResolver = await ethers.getContract('LegacyPublicResolver')
const registry = await ethers.getContract('ENSRegistry')
const nonceManager = optionalNonceManager ? optionalNonceManager : { getNonce: () => undefined}
const nonceManager = optionalNonceManager ?? { getNonce: () => undefined}

return {
commit: async ({ label, namedOwner, namedAddr }) => {
Expand Down
5 changes: 2 additions & 3 deletions packages/ensjs/utils/nonceManager.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,9 @@

return {
getNonce: (name) => {
const test = nonceMap[name]
const nonce = nonceMap[name]
nonceMap[name]++
return test
return numberToHex(nonceMap[name])
return nonce
}
}

Expand Down
7 changes: 2 additions & 5 deletions packages/ensjs/utils/wrappedNameGenerator.cjs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
/* eslint-disable import/no-extraneous-dependencies */

const { BigNumber } = require('ethers')
const { parseUnits } = require('ethers/lib/utils')
const { namehash } = require('viem/ens')

const makeNameGenerator = async (hre, optionalNonceManager) => {
const { getNamedAccounts, network } = hre
const { getNamedAccounts } = hre
const allNamedAccts = await getNamedAccounts()
const controller = await ethers.getContract('ETHRegistrarController')
const publicResolver = await ethers.getContract('PublicResolver')
const nameWrapper = await ethers.getContract('NameWrapper')
const nonceManager = optionalNonceManager
? optionalNonceManager
: { getNonce: () => undefined }
const nonceManager = optionalNonceManager ?? { getNonce: () => undefined }

return {
commit: async ({
Expand Down

0 comments on commit 12e2714

Please sign in to comment.