Skip to content

Commit

Permalink
refactor: disableActions retrieval ordering and error throwing
Browse files Browse the repository at this point in the history
  • Loading branch information
esaminu committed Mar 25, 2022
1 parent 329492c commit 3c78e65
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
18 changes: 6 additions & 12 deletions lib/account_multisig.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 3 additions & 9 deletions src/account_multisig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -316,17 +316,11 @@ export class Account2FA extends AccountMultisig {

async disableWithFAK({ contractBytes, cleanupContractBytes }: { contractBytes: Uint8Array, cleanupContractBytes?: Uint8Array }) {
let cleanupActions = [];
const keyConversionActions = await this.get2faDisableKeyConversionActions();
if(cleanupContractBytes) {
let deleteAllRequestsError;
await this.deleteAllRequests().catch(e => deleteAllRequestsError = e);
cleanupActions = await this.get2faDisableCleanupActions(cleanupContractBytes).catch(e => {
if(e.type === 'ContractHasExistingState') {
throw deleteAllRequestsError || e;
}
throw e;
});
await this.deleteAllRequests().catch(e => e);
cleanupActions = await this.get2faDisableCleanupActions(cleanupContractBytes);
}
const keyConversionActions = await this.get2faDisableKeyConversionActions();

const actions = [
...cleanupActions,
Expand Down

0 comments on commit 3c78e65

Please sign in to comment.