Skip to content
This repository has been archived by the owner on Jun 11, 2024. It is now read-only.

Commit

Permalink
🌱 Add _isMultisignatureAccount
Browse files Browse the repository at this point in the history
  • Loading branch information
ishantiw committed Aug 16, 2022
1 parent dfc74fb commit 2878388
Showing 1 changed file with 24 additions and 1 deletion.
25 changes: 24 additions & 1 deletion framework/src/modules/auth/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ import {
genesisAuthStoreSchema,
registerMultisignatureParamsSchema,
} from './schemas';
import { AuthAccount, GenesisAuthStore } from './types';
import { AuthAccount, GenesisAuthStore, ImmutableStoreCallback } from './types';
import {
getIDAsKeyForStore,
isMultisignatureAccount,
Expand Down Expand Up @@ -252,4 +252,27 @@ export class AuthModule extends BaseModule {
authAccountSchema,
);
}

// TODO: Changed it to private once implemented
protected async _isMultisignatureAccount(
getStore: ImmutableStoreCallback,
address: Buffer,
): Promise<boolean> {
const authSubstore = getStore(getIDAsKeyForStore(MODULE_ID_AUTH), STORE_PREFIX_AUTH);
try {
const authAccount = await authSubstore.getWithSchema<AuthAccount>(address, authAccountSchema);

if (authAccount.numberOfSignatures === 0) {
return false;
}

return true;
} catch (error) {
if (!(error instanceof NotFoundError)) {
throw error;
}

return false;
}
}
}

0 comments on commit 2878388

Please sign in to comment.