Skip to content

Commit

Permalink
Resolved #1350 Multi level multisig
Browse files Browse the repository at this point in the history
  • Loading branch information
AdriaCarrera committed Apr 6, 2021
1 parent ebd12a0 commit 29aac05
Showing 1 changed file with 1 addition and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,12 @@
import { Component, Prop, Vue, Watch } from 'vue-property-decorator';
import {
Account,
AccountAddressRestrictionTransaction,
AggregateTransaction,
AggregateTransactionCosignature,
CosignatureTransaction,
MultisigAccountInfo,
MultisigAccountModificationTransaction,
NetworkType,
TransactionStatus,
TransactionType,
} from 'symbol-sdk';
import { mapGetters } from 'vuex';

Expand All @@ -43,7 +40,6 @@ import { CosignatureQR } from 'symbol-qr-library';
import QRCodeDisplay from '@/components/QRCode/QRCodeDisplay/QRCodeDisplay.vue';
import { AccountService } from '@/services/AccountService';
import { LedgerService } from '@/services/LedgerService';
import { AccountMetadataTransaction } from 'symbol-sdk';

@Component({
components: {
Expand Down Expand Up @@ -160,34 +156,8 @@ export class ModalTransactionCosignatureTs extends Vue {
if (this.currentAccountMultisigInfo && this.currentAccountMultisigInfo.isMultisig()) {
return false;
}
const cosignerAddresses = this.transaction.innerTransactions.map((t) => t.signer?.address);
const cosignList = [];
this.transaction.innerTransactions.forEach((t) => {
if (t.type === TransactionType.MULTISIG_ACCOUNT_MODIFICATION.valueOf()) {
cosignList.push(...(t as MultisigAccountModificationTransaction).addressAdditions);
} else if (t.type === TransactionType.ACCOUNT_ADDRESS_RESTRICTION.valueOf()) {
cosignList.push(...(t as AccountAddressRestrictionTransaction).restrictionAdditions);
} else if (t.type === TransactionType.ACCOUNT_METADATA) {
cosignList.push((t as AccountMetadataTransaction).targetAddress);
}
});

if (cosignList.find((m) => this.currentAccount.address === m.plain()) !== undefined) {
return true;
}
const cosignRequired = cosignerAddresses.find((c) => {
if (c) {
return (
c.plain() === this.currentAccount.address ||
(this.currentAccountMultisigInfo &&
this.currentAccountMultisigInfo.multisigAddresses.find((m) => c.equals(m)) !== undefined)
);
}
return false;
});
return cosignRequired !== undefined;
}
return false;
return !this.transaction.signedByAccount(currentPubAccount);
}

public get cosignatures(): AggregateTransactionCosignature[] {
Expand Down

0 comments on commit 29aac05

Please sign in to comment.