Skip to content

Commit

Permalink
refactor: feedback from code review
Browse files Browse the repository at this point in the history
  • Loading branch information
jrhender committed May 26, 2021
1 parent a65ad73 commit 4c5b6c9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
5 changes: 3 additions & 2 deletions src/iam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -989,7 +989,8 @@ export class IAM extends IAMBase {
* @returns metadata string or empty string when there is no metadata
*
*/
async getDefinition({ type, namespace }: { type: ENSNamespaceTypes; namespace: string }) {
async getDefinition({ type, namespace }: { type: ENSNamespaceTypes; namespace: string })
: Promise<IRoleDefinition | IAppDefinition | IOrganizationDefinition> {
if (this._cacheClient && type) {
if (type === ENSNamespaceTypes.Roles) {
return this._cacheClient.getRoleDefinition({ namespace });
Expand All @@ -1004,7 +1005,7 @@ export class IAM extends IAMBase {
}
if (this._domainDefinitionReader) {
const roleHash = namehash(namespace);
return await this._domainDefinitionReader.read({ node: roleHash }) as IRoleDefinition | IAppDefinition | IOrganizationDefinition;
return await this._domainDefinitionReader.read({ node: roleHash });
}
throw new ENSResolverNotInitializedError();
}
Expand Down
8 changes: 4 additions & 4 deletions src/iam/chainConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,18 +58,18 @@ export const messagingOptions: Record<number, MessagingOptions> = {
* Used to override existing chain configuration or add a missing one
* Configuration must be set before constructing `IAM`
*/
export const setChainConfig = function (chainId: number, config: Partial<ChainConfig>) {
export const setChainConfig = (chainId: number, config: Partial<ChainConfig>) => {
chainConfigs[chainId] = { ...chainConfigs[chainId], ...config };
};

/**
* Used to override existing cache server configuration or add a missing one
* Configuration must be set before constructing `IAM`
*/
export const setCacheClientOptions = function (
export const setCacheClientOptions = (
chainId: number,
options: Partial<CacheServerClientOptions>
) {
) => {
cacheServerClientOptions[chainId] = { ...cacheServerClientOptions[chainId], ...options };
};

Expand All @@ -78,6 +78,6 @@ export const setCacheClientOptions = function (
* Configuration must be set before constructing `IAM`
*/

export const setMessagingOptions = function (chainId: number, options: Partial<MessagingOptions>) {
export const setMessagingOptions = (chainId: number, options: Partial<MessagingOptions>) => {
messagingOptions[chainId] = { ...messagingOptions[chainId], ...options };
};

0 comments on commit 4c5b6c9

Please sign in to comment.