Skip to content

Commit

Permalink
refactor: apply naming convention
Browse files Browse the repository at this point in the history
  • Loading branch information
Harasz committed Apr 19, 2022
1 parent b96d23a commit cc41154
Show file tree
Hide file tree
Showing 51 changed files with 60 additions and 60 deletions.
4 changes: 2 additions & 2 deletions e2e/assets.service.e2e.ts
@@ -1,11 +1,11 @@
import { Wallet } from 'ethers';
import { ethAddrPattern } from '@ew-did-registry/did';
import { replenish, rpcUrl, setupENS } from './utils/setup_contracts';
import { replenish, rpcUrl, setupENS } from './utils/setup-contracts';
import { AssetsService, CacheClient, fromPrivateKey } from '../src';

const mockGetAssetById = jest.fn();
const mockGetOwnedAssets = jest.fn();
jest.mock('../src/modules/cacheClient/cacheClient.service', () => {
jest.mock('../src/modules/cache-client/cache-client.service', () => {
return {
CacheClient: jest.fn().mockImplementation(() => {
return {
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions e2e/claims.service.e2e.ts
Expand Up @@ -21,7 +21,7 @@ import {
IClaimIssuance,
SignerT,
} from '../src';
import { replenish, root, rpcUrl, setupENS } from './utils/setup_contracts';
import { replenish, root, rpcUrl, setupENS } from './utils/setup-contracts';
import { ClaimManager__factory } from '../ethers/factories/ClaimManager__factory';
import { ProofVerifier } from '@ew-did-registry/claims';
import { ClaimManager } from '../ethers/ClaimManager';
Expand Down Expand Up @@ -91,7 +91,7 @@ const mockGetClaimsBySubject = jest.fn();
const mockRequestClaim = jest.fn();
const mockIssueClaim = jest.fn();
const mockRejectClaim = jest.fn();
jest.mock('../src/modules/cacheClient/cacheClient.service', () => {
jest.mock('../src/modules/cache-client/cache-client.service', () => {
return {
CacheClient: jest.fn().mockImplementation(() => {
return {
Expand Down
File renamed without changes.
Expand Up @@ -13,12 +13,12 @@ import {
RegistrationTypes,
SignerService,
} from '../../src';
import { replenish, root, rpcUrl, setupENS } from '../utils/setup_contracts';
import { replenish, root, rpcUrl, setupENS } from '../utils/setup-contracts';

const { namehash } = utils;

const mockGetRoleDefinition = jest.fn();
jest.mock('../../src/modules/cacheClient/cacheClient.service', () => {
jest.mock('../../src/modules/cache-client/cache-client.service', () => {
return {
CacheClient: jest.fn().mockImplementation(() => {
return {
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion e2e/fixtures/index.ts
@@ -1 +1 @@
export * from './externalVC';
export * from './external-vc';
File renamed without changes.
Expand Up @@ -14,7 +14,7 @@ import { OfferableIdentity__factory } from '../../ethers/factories/OfferableIden
import { ClaimManager__factory } from '../../ethers/factories/ClaimManager__factory';
import { ClaimManager } from '../../ethers/ClaimManager';
import { setChainConfig } from '../../src/config/chain.config';
import { labelhash } from '../../src/utils/ensHash';
import { labelhash } from '../../src/utils/ens-hash';
import { RoleDefinitionResolverV2 } from '../../ethers/RoleDefinitionResolverV2';

const { JsonRpcProvider } = providers;
Expand Down
2 changes: 1 addition & 1 deletion e2e/verifiable-credentials.service.e2e.ts
Expand Up @@ -4,7 +4,7 @@ import {
exampleExternalVCWithInvalidSubjectId,
validExampleExternalVC,
} from './fixtures';
import { replenish, rpcUrl, setupENS } from './utils/setup_contracts';
import { replenish, rpcUrl, setupENS } from './utils/setup-contracts';
import { fromPrivateKey } from '../src';
import {
getVerifiableCredentialsService,
Expand Down
4 changes: 2 additions & 2 deletions scripts/EW/createRoot.ts → scripts/EW/create-root.ts
Expand Up @@ -48,7 +48,7 @@ const rpcUrl = chainConfigs()[CHAIN_ID].rpcUrl;
roleType: 'app',
version: 1,
enrolmentPreconditions: [],
fields: [],
issuerFields: [],
metadata: {},
issuer: { issuerType: 'DID', did: [ENERGYWEB_OWNER] },
},
Expand All @@ -71,7 +71,7 @@ const rpcUrl = chainConfigs()[CHAIN_ID].rpcUrl;
roleType: 'app',
version: 1,
enrolmentPreconditions: [],
fields: [],
issuerFields: [],
metadata: {},
issuer: { issuerType: 'DID', did: [KYC_OWNER] },
},
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/config/cache.config.ts
@@ -1,5 +1,5 @@
import { EWC_CHAIN_ID, VOLTA_CHAIN_ID } from '@energyweb/credential-governance';
import { CacheServerClientOptions } from '../modules/cacheClient/cacheClient.types';
import { CacheServerClientOptions } from '../modules/cache-client/cache-client.types';

const cacheConfig: Record<number, CacheServerClientOptions> = {
[VOLTA_CHAIN_ID]: {
Expand Down
@@ -1,4 +1,4 @@
import { ERROR_MESSAGES } from './ErrorMessages';
import { ERROR_MESSAGES } from './error-messages';

export class ENSOwnerNotValidAddressError extends Error {
constructor(providedOwner: string) {
Expand Down
@@ -1,4 +1,4 @@
import { ERROR_MESSAGES } from './ErrorMessages';
import { ERROR_MESSAGES } from './error-messages';

export class ENSTypeNotSupportedError extends Error {
constructor() {
Expand Down
File renamed without changes.
14 changes: 7 additions & 7 deletions src/errors/index.ts
@@ -1,7 +1,7 @@
export { ENSTypeNotSupportedError } from './ENSTypeNotSupportedError';
export { MethodNotAvailableInNodeEnvError } from './MethodNotAvailableInNodeError';
export { ChangeOwnershipNotPossibleError } from './ChangeOwnershipNotPossibleError';
export { DeletingNamespaceNotPossibleError } from './DeletingNamespaceNotPossibleError';
export { ENSOwnerNotValidAddressError } from './ENSOwnerNotValidAddressError';
export { ERROR_MESSAGES } from './ErrorMessages';
export { MalformedDIDError } from './MalformedDIDError';
export { ENSTypeNotSupportedError } from './ens-type-not-supported.error';
export { MethodNotAvailableInNodeEnvError } from './method-not-available-in-node.error';
export { ChangeOwnershipNotPossibleError } from './change-ownership-not-possible.error';
export { DeletingNamespaceNotPossibleError } from './deleting-namespace-not-possible.error';
export { ENSOwnerNotValidAddressError } from './ens-owner-not-valid-address.error';
export { ERROR_MESSAGES } from './error-messages';
export { MalformedDIDError } from './malformed-did.error';
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions src/index.ts
Expand Up @@ -16,9 +16,9 @@

export * from './init';
export * from './modules/assets';
export * from './modules/cacheClient';
export * from './modules/cache-client';
export * from './modules/claims';
export * from './modules/didRegistry';
export * from './modules/did-registry';
export * from './modules/domains';
export * from './modules/messaging';
export * from './modules/signer';
Expand Down
4 changes: 2 additions & 2 deletions src/init.ts
Expand Up @@ -10,9 +10,9 @@ import {
SignerService,
} from './modules/signer';
import { StakingFactoryService } from './modules/staking';
import { DidRegistry } from './modules/didRegistry';
import { DidRegistry } from './modules/did-registry';
import { MessagingService } from './modules/messaging';
import { CacheClient } from './modules/cacheClient';
import { CacheClient } from './modules/cache-client';
import { DomainsService } from './modules/domains';
import { AssetsService } from './modules/assets';
import { ClaimsService } from './modules/claims';
Expand Down
4 changes: 2 additions & 2 deletions src/modules/assets/assets.service.ts
Expand Up @@ -4,8 +4,8 @@ import { addressOf } from '@ew-did-registry/did-ethr-resolver';
import { IdentityManager__factory } from '../../../ethers/factories/IdentityManager__factory';
import { OfferableIdentity__factory } from '../../../ethers/factories/OfferableIdentity__factory';
import { ChainConfig, chainConfigs } from '../../config/chain.config';
import { CacheClient } from '../cacheClient/cacheClient.service';
import { Order } from '../cacheClient/cacheClient.types';
import { CacheClient } from '../cache-client/cache-client.service';
import { Order } from '../cache-client/cache-client.types';
import { SignerService } from '../signer/signer.service';
import { AssetHistoryEventType } from './assets.types';

Expand Down
Expand Up @@ -10,7 +10,7 @@ import {
IClaimRequest,
} from '../claims/claims.types';
import { IPubKeyAndIdentityToken } from '../signer/signer.types';
import { AssetsFilter, ClaimsFilter } from './cacheClient.types';
import { AssetsFilter, ClaimsFilter } from './cache-client.types';
import { Asset, AssetHistory } from '../assets/assets.types';
import { IApp, IOrganization, IRole } from '../domains/domains.types';
import { Claim } from '../claims/claims.types';
Expand Down
Expand Up @@ -14,16 +14,16 @@ import { Asset } from '../assets/assets.types';
import {
executionEnvironment,
ExecutionEnvironment,
} from '../../utils/detectEnvironment';
} from '../../utils/detect-environment';
import { SignerService } from '../signer/signer.service';
import { IPubKeyAndIdentityToken } from '../signer/signer.types';
import { cacheConfigs } from '../../config/cache.config';
import { ICacheClient } from './ICacheClient';
import { ICacheClient } from './cache-client.interface';
import {
AssetsFilter,
ClaimsFilter,
TEST_LOGIN_ENDPOINT,
} from './cacheClient.types';
} from './cache-client.types';
import { SearchType } from '.';

export class CacheClient implements ICacheClient {
Expand Down
3 changes: 3 additions & 0 deletions src/modules/cache-client/index.ts
@@ -0,0 +1,3 @@
export * from './cache-client.interface';
export * from './cache-client.service';
export * from './cache-client.types';
3 changes: 0 additions & 3 deletions src/modules/cacheClient/index.ts

This file was deleted.

6 changes: 3 additions & 3 deletions src/modules/claims/claims.service.ts
Expand Up @@ -18,7 +18,7 @@ import { ClaimManager__factory } from '../../../ethers/factories/ClaimManager__f
import { ERROR_MESSAGES } from '../../errors';
import { emptyAddress } from '../../utils/constants';
import { canonizeSig } from '../../utils/enrollment';
import { CacheClient } from '../cacheClient/cacheClient.service';
import { CacheClient } from '../cache-client/cache-client.service';
import { DomainsService } from '../domains/domains.service';
import { NamespaceType } from '../domains/domains.types';
import { SignerService } from '../signer/signer.service';
Expand All @@ -33,8 +33,8 @@ import {
proof_type_hash,
typedMsgPrefix,
} from './claims.types';
import { DidRegistry } from '../didRegistry/didRegistry.service';
import { ClaimData } from '../didRegistry/did.types';
import { DidRegistry } from '../did-registry/did-registry.service';
import { ClaimData } from '../did-registry/did.types';
import { compareDID, isValidDID } from '../../utils/did';
import { JWT } from '@ew-did-registry/jwt';
import { privToPem, KeyType } from '@ew-did-registry/keys';
Expand Down
Expand Up @@ -32,16 +32,16 @@ import {
} from '@ew-did-registry/claims';
import { SignerService } from '../signer/signer.service';
import { ERROR_MESSAGES } from '../../errors';
import { CacheClient } from '../cacheClient/cacheClient.service';
import { ClaimData } from '../didRegistry/did.types';
import { CacheClient } from '../cache-client/cache-client.service';
import { ClaimData } from './did.types';
import { chainConfigs } from '../../config/chain.config';
import { AssetsService } from '../assets/assets.service';

import {
UpdateServicePoint,
UpdateDelegate,
UpdatePublicKey,
} from './didRegistry.validation';
} from './did-registry.validation';
import { getLogger } from '../../config/logger.config';

const { JsonRpcProvider } = providers;
Expand Down
File renamed without changes.
2 changes: 2 additions & 0 deletions src/modules/did-registry/index.ts
@@ -0,0 +1,2 @@
export * from './did-registry.service';
export * from './did.types';
2 changes: 0 additions & 2 deletions src/modules/didRegistry/index.ts

This file was deleted.

8 changes: 4 additions & 4 deletions src/modules/domains/domains.service.ts
Expand Up @@ -22,14 +22,14 @@ import {
ERROR_MESSAGES,
} from '../../errors';
import { emptyAddress } from '../../utils/constants';
import { labelhash, namehash } from '../../utils/ensHash';
import { CacheClient } from '../cacheClient/cacheClient.service';
import { labelhash, namehash } from '../../utils/ens-hash';
import { CacheClient } from '../cache-client/cache-client.service';
import { RegistrationTypes } from '../claims/claims.types';
import { SignerService } from '../signer/signer.service';
import { NamespaceType, IOrganization, MulticallTx } from './domains.types';
import { SearchType } from '../cacheClient/cacheClient.types';
import { SearchType } from '../cache-client/cache-client.types';
import { validateAddress } from '../../utils/address';
import { UnregisteredResolverError } from '../../errors/UnregisteredResolverError';
import { UnregisteredResolverError } from '../../errors/unregistered-resolver.error';
import { castToV2 } from './domains.types';
import { getLogger } from '../../config/logger.config';

Expand Down
2 changes: 1 addition & 1 deletion src/modules/messaging/messaging.service.ts
Expand Up @@ -11,7 +11,7 @@ import { SignerService } from '../signer/signer.service';
import {
executionEnvironment,
ExecutionEnvironment,
} from '../../utils/detectEnvironment';
} from '../../utils/detect-environment';
import { getLogger } from '../../config/logger.config';

export class MessagingService {
Expand Down
File renamed without changes.
File renamed without changes.
12 changes: 6 additions & 6 deletions src/modules/signer/index.ts
@@ -1,8 +1,8 @@
export * from './signer.service';
export * from './signer.types';
export * from './privateKeySigner';
export * from './metamaskSigner';
export * from './walletConnectMetamask';
export * from './walletConnectKms';
export * from './gnosisSigner';
export * from './ekcSigner';
export * from './private-key.signer';
export * from './metamask.signer';
export * from './wallet-connect-metamask';
export * from './wallet-connect-kms';
export * from './gnosis.signer';
export * from './ekc.signer';
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/modules/signer/signer.service.ts
Expand Up @@ -6,12 +6,12 @@ import {
} from '@ethersproject/abstract-signer';
import WalletConnectProvider from '@walletconnect/ethereum-provider';
import { Methods } from '@ew-did-registry/did';
import { ERROR_MESSAGES } from '../../errors/ErrorMessages';
import { ERROR_MESSAGES } from '../../errors/error-messages';
import { chainConfigs } from '../../config/chain.config';
import {
ExecutionEnvironment,
executionEnvironment,
} from '../../utils/detectEnvironment';
} from '../../utils/detect-environment';
import {
IPubKeyAndIdentityToken,
ProviderType,
Expand All @@ -21,7 +21,7 @@ import {
IS_ETH_SIGNER,
SignerT,
} from './signer.types';
import { EkcSigner } from './ekcSigner';
import { EkcSigner } from './ekc.signer';
import { computeAddress } from 'ethers/lib/utils';
import { getLogger } from '../../config/logger.config';

Expand Down
@@ -1,7 +1,7 @@
import { providers } from 'ethers';
import { SignerService } from './signer.service';
import { ProviderType } from './signer.types';
import { createWalletConnectProvider } from './walletConnectMetamask';
import { createWalletConnectProvider } from './wallet-connect-metamask';

export async function fromKms(
bridge: string,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion src/modules/staking/staking-pool.service.ts
@@ -1,7 +1,7 @@
import { BigNumber, ContractReceipt, providers, utils } from 'ethers';
import { StakingPool as StakingPoolContract } from '../../../ethers-staking';
import { StakingPool__factory } from '../../../ethers-staking/factories/StakingPool__factory';
import { ERROR_MESSAGES } from '../../errors/ErrorMessages';
import { ERROR_MESSAGES } from '../../errors/error-messages';
import { SignerService } from '../signer/signer.service';
import { chainConfigs } from '../../config/chain.config';
import { DomainsService } from '../domains/domains.service';
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/utils/index.ts
@@ -1,3 +1,3 @@
export * from './constants';
export * from './detectEnvironment';
export * from './detect-environment';
export * from './did';
Expand Up @@ -10,7 +10,7 @@ import { Methods } from '@ew-did-registry/did';
import { Signer } from 'ethers';
import { isValidDID } from './did';
import { ENSRegistry__factory } from '../../ethers/factories/ENSRegistry__factory';
import { labelhash, namehash } from './ensHash';
import { labelhash, namehash } from './ens-hash';
import { ChainId, chainConfigs } from '../config';
import { castToV2 } from '..';
import { getLogger } from '../config/logger.config';
Expand Down

0 comments on commit cc41154

Please sign in to comment.