Skip to content
This repository has been archived by the owner on Jul 12, 2024. It is now read-only.

Commit

Permalink
Update mock and replace 0xproject/util with ethers v5
Browse files Browse the repository at this point in the history
  • Loading branch information
makoto committed Apr 8, 2021
1 parent 8968deb commit 5c87c0f
Show file tree
Hide file tree
Showing 5 changed files with 634 additions and 2,611 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"@babel/plugin-transform-spread": "^7.2.2",
"@babel/polyfill": "^7.4.4",
"@babel/preset-env": "^7.4.4",
"@ensdomains/mock": "^2.0.31",
"@ensdomains/mock": "^2.0.37",
"babel-eslint": "^9.0.0",
"babel-jest": "^23.6.0",
"babel-jest-assertions": "^0.1.0",
Expand All @@ -44,7 +44,6 @@
"web3": "^1.2.11"
},
"dependencies": {
"@0xproject/utils": "^2.0.2",
"@babel/runtime": "^7.4.4",
"@ensdomains/address-encoder": "^0.1.7",
"@ensdomains/ens": "0.4.3",
Expand Down
4 changes: 2 additions & 2 deletions src/testing-utils/extendExpect.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const HEX_REGEX = /^0x[0-9A-F]*$/i

import { addressUtils } from '@0xproject/utils'
import { ethers } from 'ethers'

expect.extend({
toBeHex(received) {
Expand All @@ -20,7 +20,7 @@ expect.extend({
},
toBeEthAddress(received) {
const pass =
typeof received === 'string' && addressUtils.isAddress(received)
typeof received === 'string' && ethers.utils.isAddress(received)

if (pass) {
return {
Expand Down
4 changes: 2 additions & 2 deletions src/utils/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addressUtils } from '@0xproject/utils'
import { ethers } from 'ethers'

import {
isEncodedLabelhash,
Expand Down Expand Up @@ -90,7 +90,7 @@ const parseSearchTerm = (term, validTld) => {
}

return 'unsupported'
} else if (addressUtils.isAddress(term)) {
} else if (ethers.utils.isAddress(term)) {
return 'address'
} else {
//check if the search term is actually a tld
Expand Down
4 changes: 2 additions & 2 deletions src/utils/records.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { addressUtils } from '@0xproject/utils'
import { ethers } from 'ethers'
import { validateContent } from './contents'
export function validateRecord(record) {
if (!record.type) {
Expand All @@ -13,7 +13,7 @@ export function validateRecord(record) {

switch (type) {
case 'address':
return addressUtils.isAddress(value)
return ethers.utils.isAddress(value)
case 'content':
return validateContent(value)
default:
Expand Down
Loading

0 comments on commit 5c87c0f

Please sign in to comment.