Skip to content

Commit

Permalink
feat(domains): add MulticallTx type
Browse files Browse the repository at this point in the history
  • Loading branch information
JGiter committed Apr 5, 2022
1 parent c7508c2 commit 3be1e6f
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 148 deletions.
238 changes: 119 additions & 119 deletions package-lock.json

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions package.json
Expand Up @@ -64,15 +64,15 @@
"@energyweb/onchain-claims": "^1.0.1-alpha.22.0",
"@energyweb/staking-pool": "^1.0.0-rc.14",
"@ensdomains/ens": "^0.6.2",
"@ew-did-registry/claims": "^0.6.3-alpha.519.0",
"@ew-did-registry/did": "^0.6.3-alpha.519.0",
"@ew-did-registry/did-document": "^0.6.3-alpha.502.0",
"@ew-did-registry/did-ethr-resolver": "^0.6.3-alpha.519.0",
"@ew-did-registry/did-ipfs-store": "^0.6.3-alpha.519.0",
"@ew-did-registry/did-resolver-interface": "^0.6.3-alpha.519.0",
"@ew-did-registry/jwt": "^0.6.3-alpha.519.0",
"@ew-did-registry/keys": "^0.6.3-alpha.519.0",
"@ew-did-registry/proxyidentity": "^0.6.3-alpha.519.0",
"@ew-did-registry/claims": "^0.6.3-alpha.531.0",
"@ew-did-registry/did": "^0.6.3-alpha.531.0",
"@ew-did-registry/did-document": "^0.6.3-alpha.531.0",
"@ew-did-registry/did-ethr-resolver": "^0.6.3-alpha.531.0",
"@ew-did-registry/did-ipfs-store": "^0.6.3-alpha.531.0",
"@ew-did-registry/did-resolver-interface": "^0.6.3-alpha.531.0",
"@ew-did-registry/jwt": "^0.6.3-alpha.531.0",
"@ew-did-registry/keys": "^0.6.3-alpha.531.0",
"@ew-did-registry/proxyidentity": "^0.6.3-alpha.531.0",
"@gnosis.pm/safe-apps-provider": "0.8.0",
"@gnosis.pm/safe-apps-sdk": "4.3.0",
"@metamask/detect-provider": "^1.2.0",
Expand Down
2 changes: 1 addition & 1 deletion src/config/chain.config.ts
Expand Up @@ -63,7 +63,7 @@ const chainConfig: Record<number, ChainConfig> = {
rpcUrl: 'https://rpc.energyweb.org/',
ensRegistryAddress: EWC_ENS_REGISTRY_ADDRESS,
ensResolverV2Address: EWC_RESOLVER_V2_ADDRESS,
ensResolverAddress: '',
ensResolverAddress: EWC_RESOLVER_V2_ADDRESS,
ensPublicResolverAddress: EWC_PUBLIC_RESOLVER_ADDRESS,
domainNotifierAddress: EWC_DOMAIN_NOTIFER_ADDRESS,
assetManagerAddress: EWC_IDENTITY_MANAGER_ADDRESS,
Expand Down
1 change: 0 additions & 1 deletion src/index.ts
Expand Up @@ -43,4 +43,3 @@ export {
IRoleDefinitionText,
IRoleDefinitionV2,
} from '@energyweb/credential-governance';
export {} from '@energyweb/onchain-claims';
22 changes: 4 additions & 18 deletions src/modules/domains/domains.service.ts
@@ -1,5 +1,4 @@
import { BigNumber, utils } from 'ethers';
import { TransactionReceipt } from '@ethersproject/abstract-provider';
import { BigNumber } from 'ethers';
import {
IAppDefinition,
IOrganizationDefinition,
Expand All @@ -23,19 +22,17 @@ import {
ERROR_MESSAGES,
} from '../../errors';
import { emptyAddress } from '../../utils/constants';
import { labelhash } from '../../utils/ensHash';
import { labelhash, namehash } from '../../utils/ensHash';
import { CacheClient } from '../cacheClient/cacheClient.service';
import { RegistrationTypes } from '../claims/claims.types';
import { SignerService } from '../signer/signer.service';
import { NamespaceType, IOrganization } from './domains.types';
import { NamespaceType, IOrganization, MulticallTx } from './domains.types';
import { SearchType } from '../cacheClient/cacheClient.types';
import { validateAddress } from '../../utils/address';
import { UnregisteredResolverError } from '../../errors/UnregisteredResolverError';
import { castToV2 } from './domains.types';
import { getLogger } from '../../config/logger.config';

const { namehash } = utils;

export class DomainsService {
private chainId: number;
private _ensRegistry: ENSRegistry;
Expand Down Expand Up @@ -368,18 +365,7 @@ export class DomainsService {
newOwner: string;
returnSteps?: boolean;
withSubdomains?: boolean;
}): Promise<
| {
tx: EncodedCall;
next: ({
retryCheck,
}?: {
retryCheck?: boolean | undefined;
}) => Promise<TransactionReceipt | undefined>;
info: string;
}[]
| undefined
> {
}): Promise<MulticallTx | undefined> {
DomainsService.validateOwnerAddress(newOwner);
const orgNamespaces = [
`${NamespaceType.Role}.${namespace}`,
Expand Down
10 changes: 10 additions & 0 deletions src/modules/domains/domains.types.ts
@@ -1,10 +1,12 @@
import {
EncodedCall,
IAppDefinition,
IOrganizationDefinition,
IRevokerDefinition,
IRoleDefinition,
IRoleDefinitionV2,
} from '@energyweb/credential-governance';
import { providers } from 'ethers';

export enum NamespaceType {
Role = 'roles',
Expand Down Expand Up @@ -60,3 +62,11 @@ export function castToV2(
return <IRoleDefinitionV2>roleDef;
}
}

export type MulticallTx = {
tx: EncodedCall;
next: (opts?: {
retryCheck?: boolean;
}) => Promise<providers.TransactionReceipt | undefined>;
info: string;
}[];

0 comments on commit 3be1e6f

Please sign in to comment.