Skip to content

Commit

Permalink
Lints
Browse files Browse the repository at this point in the history
  • Loading branch information
olegnn committed Oct 31, 2024
1 parent cb07230 commit b4d5b15
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
import { ensureInstanceOf } from "../../utils";
import AbstractStatusListCredentialModule from "../../modules/abstract/status-list-credential/module";
import { ensureInstanceOf } from '../../utils';
import AbstractStatusListCredentialModule from '../../modules/abstract/status-list-credential/module';
import {
HEX_ID_REG_EXP_PATTERN,
METHOD_REG_EXP_PATTERN,
Resolver,
} from "../generic";
} from '../generic';

const STATUS_LIST_ID_MATCHER = new RegExp(
`^status-list2021:${METHOD_REG_EXP_PATTERN}:${HEX_ID_REG_EXP_PATTERN}$`
`^status-list2021:${METHOD_REG_EXP_PATTERN}:${HEX_ID_REG_EXP_PATTERN}$`,
);

class StatusListResolver extends Resolver {
prefix = "status-list2021";
prefix = 'status-list2021';

get method() {
return this.statusListCredentialModule.methods();
Expand All @@ -29,21 +29,21 @@ class StatusListResolver extends Resolver {
*/
this.statusListCredentialModule = ensureInstanceOf(
statusListCredentialModule,
AbstractStatusListCredentialModule
AbstractStatusListCredentialModule,
);
}

async resolve(statusListId) {
const match = statusListId.match(STATUS_LIST_ID_MATCHER);
if (!match) {
throw new Error(
`Invalid \`StatusList2021Credential\` id: \`${statusListId}\``
`Invalid \`StatusList2021Credential\` id: \`${statusListId}\``,
);
}
const [, _, id] = statusListId.match(STATUS_LIST_ID_MATCHER);

const cred = await this.statusListCredentialModule.getStatusListCredential(
id
id,
);

return cred?.value.list.toJSON();
Expand Down

0 comments on commit b4d5b15

Please sign in to comment.