Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: setting modules as dependencies #257

Merged
merged 2 commits into from
Oct 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 9.2.2

- Changed devDependencies to dependencies

## 9.2.1

- Fix ens-config.json path error
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@unstoppabledomains/resolution",
"version": "9.2.1",
"version": "9.2.2",
"description": "Domain Resolution for blockchain domains",
"main": "./build/index.js",
"directories": {
Expand Down Expand Up @@ -60,7 +60,6 @@
},
"homepage": "https://github.com/unstoppabledomains/resolution.git#readme",
"devDependencies": {
"@ensdomains/address-encoder": "0.2.18",
"@ethersproject/providers": "^5.4.5",
"@types/bn.js": "^4.11.6",
"@types/crypto-js": "^4.1.1",
Expand All @@ -73,8 +72,6 @@
"@unstoppabledomains/sizecheck": "^4.0.4",
"@zilliqa-js/core": "^3.3.4",
"audit-ci": "^3.1.1",
"bip44-constants": "^8.0.103",
"content-hash": "^2.5.2",
"dotenv": "^8.2.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -99,8 +96,11 @@
"access": "public"
},
"dependencies": {
"@ensdomains/address-encoder": "^0.2.22",
"@ethersproject/abi": "^5.0.1",
"bip44-constants": "^8.0.103",
"bn.js": "^4.4.0",
"content-hash": "^2.5.2",
"cross-fetch": "4.0.0",
"crypto-js": "^4.1.1",
"elliptic": "^6.5.4",
Expand Down
25 changes: 5 additions & 20 deletions src/Ens.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
import * as contentHash from 'content-hash';
import bip44Constants from 'bip44-constants';
import {formatsByCoinType} from '@ensdomains/address-encoder';
import EnsNetworkMap from 'ethereum-ens-network-map';
import {default as ensInterface} from './contracts/ens/ens';
import {default as resolverInterface} from './contracts/ens/resolver';
import {default as nameWrapperInterface} from './contracts/ens/nameWrapper';
Expand All @@ -6,7 +10,6 @@ import {default as reverseRegistrarInterface} from './contracts/ens/reverseRegis
import {EnsSupportedNetwork, EthCoinIndex, hasProvider} from './types';
import {ResolutionError, ResolutionErrorCode} from './errors/resolutionError';
import EthereumContract from './contracts/EthereumContract';
import EnsNetworkMap from 'ethereum-ens-network-map';
import {
EnsSource,
Locations,
Expand All @@ -25,7 +28,6 @@ import ConfigurationError, {
ConfigurationErrorCode,
} from './errors/configurationError';
import {EthereumNetworks} from './utils';
import {requireOrFail} from './utils/requireOrFail';
import ensConfig from './config/ens-config.json';
import Networking from './utils/Networking';

Expand Down Expand Up @@ -390,17 +392,7 @@ export default class Ens extends NamingService {
}

protected getCoinType(currencyTicker: string): string {
const bip44constants = requireOrFail(
'bip44-constants',
'bip44-constants',
'^8.0.5',
);
const formatsByCoinType = requireOrFail(
'@ensdomains/address-encoder',
'@ensdomains/address-encoder',
'>= 0.1.x <= 0.2.x',
).formatsByCoinType;
const coin = bip44constants.findIndex(
const coin = bip44Constants.findIndex(
(item) =>
item[1] === currencyTicker.toUpperCase() ||
item[2] === currencyTicker.toUpperCase(),
Expand Down Expand Up @@ -447,12 +439,6 @@ export default class Ens extends NamingService {
domain: string,
coinType: string,
): Promise<string | undefined> {
const formatsByCoinType = requireOrFail(
'@ensdomains/address-encoder',
'@ensdomains/address-encoder',
'>= 0.1.x <= 0.2.x',
).formatsByCoinType;

const resolverContract = new EthereumContract(
resolverInterface(resolver, coinType),
resolver,
Expand Down Expand Up @@ -490,7 +476,6 @@ export default class Ens extends NamingService {

// @see https://docs.ens.domains/ens-improvement-proposals/ensip-7-contenthash-field
private async getContentHash(domain: string): Promise<string | undefined> {
const contentHash = requireOrFail('content-hash', 'content-hash', '^2.5.2');
const nodeHash = this.namehash(domain);
const resolverContract = await this.getResolverContract(domain);
const contentHashEncoded = await this.callMethod(
Expand Down
Loading