Skip to content

Commit

Permalink
Merge pull request #269 from rg911/task/g267_cosignatory_issue_in_ws
Browse files Browse the repository at this point in the history
WS listener cosignatory and block channel issue and other small issues fixes
  • Loading branch information
fboucquez authored Sep 26, 2019
2 parents 7952d24 + 88b28b7 commit 1d7a18b
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -87,4 +87,5 @@ modules.xml
# End of https://www.gitignore.io/api/intellij+iml
dist/
ts-docs
docs/
docs/
.vscode/launch.json
24 changes: 11 additions & 13 deletions src/infrastructure/Listener.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,16 +126,16 @@ export class Listener {
channelName: ListenerChannelName.block, message: new BlockInfo(
message.meta.hash,
message.meta.generationHash,
message.meta.totalFee ? new UInt64(message.meta.totalFee) : new UInt64([0, 0]),
message.meta.totalFee ? UInt64.fromNumericString(message.meta.totalFee) : new UInt64([0, 0]),
message.meta.numTransactions,
message.block.signature,
PublicAccount.createFromPublicKey(message.block.signerPublicKey, networkType),
networkType,
parseInt(message.block.version.toString(16).substr(2, 2), 16), // Tx version
message.block.type,
new UInt64(message.block.height),
new UInt64(message.block.timestamp),
new UInt64(message.block.difficulty),
UInt64.fromNumericString(message.block.height),
UInt64.fromNumericString(message.block.timestamp),
UInt64.fromNumericString(message.block.difficulty),
message.block.feeMultiplier,
message.block.previousBlockHash,
message.block.blockTransactionsHash,
Expand All @@ -151,13 +151,13 @@ export class Listener {
message.status,
Deadline.createFromDTO(message.deadline)),
});
} else if (message.meta) {
this.messageSubject.next({channelName: message.meta.channelName, message: message.meta.hash});
} else if (message.parentHash) {
this.messageSubject.next({
channelName: ListenerChannelName.cosignature,
message: new CosignatureSignedTransaction(message.parentHash, message.signature, message.signerPublicKey),
});
} else if (message.meta && message.meta.hash) {
this.messageSubject.next({channelName: message.meta.channelName, message: message.meta.hash});
}
};
} else {
Expand Down Expand Up @@ -371,7 +371,8 @@ export class Listener {
}
});
transaction.innerTransactions.map((innerTransaction: InnerTransaction) => {
if (this.transactionHasSignerOrReceptor(innerTransaction, address)) {
if (this.transactionHasSignerOrReceptor(innerTransaction, address) ||
this.accountAddedToMultiSig(innerTransaction, address)) {
transactionFromAddress = true;
}
});
Expand Down Expand Up @@ -405,14 +406,11 @@ export class Listener {
* @param address - Address
* @returns boolean
*/
// tslint:disable-next-line:adjacent-overload-signatures
private accountAddedToMultiSig(transaction: Transaction, address: Address): boolean {
if (transaction instanceof MultisigAccountModificationTransaction) {
transaction.modifications.map((_: MultisigCosignatoryModification) => {
if (_.modificiationType === CosignatoryModificationAction.Add && _.cosignatoryPublicAccount.address.equals(address)) {
return true;
}
});
return transaction.modifications.find((_: MultisigCosignatoryModification) =>
_.modificiationType === CosignatoryModificationAction.Add &&
_.cosignatoryPublicAccount.address.equals(address)) !== undefined;
}
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class MosaicGlobalRestrictionTransaction extends Transaction {
* @param previousRestrictionValue - The previous restriction value.
* @param previousRestrictionType - The previous restriction type.
* @param newRestrictionValue - The new restriction value.
* @param previousRestrictionType - The previous restriction tpye.
* @param newRestrictionType - The new restriction tpye.
* @param networkType - The network type.
* @param referenceMosaicId - (Optional) The mosaic id providing the restriction key.
* @param maxFee - (Optional) Max fee defined by the sender
Expand Down

0 comments on commit 1d7a18b

Please sign in to comment.