Skip to content

Conversation

@rg911
Copy link
Contributor

@rg911 rg911 commented Nov 30, 2019

  • Added service to resolve alias(es) for transactions from block receipts.
  • Fixed unresolvedAddress bug in ResolutionStatement
  • Added e2e tests

Please note that there's discussion on NEM2 slack channel regarding the PrimaryId value in ResolutionStatement as if Harvest_Fee receipt exists on the block, the transaction index is less 1 against the Resolution entry primaryId. Solution here may change upon investigation results on catapult-server

Issue: #357

@coveralls
Copy link

coveralls commented Nov 30, 2019

Pull Request Test Coverage Report for Build 868

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 100.0%

Totals Coverage Status
Change from base Build 846: 0.0%
Covered Lines: 10
Relevant Lines: 10

💛 - Coveralls

* @param aggregateTransactionIndex Transaction index for aggregated transaction
* @returns {Observable<AccountAddressRestrictionTransaction>}
*/
resolveAliases(receiptHttp: ReceiptHttp, aggregateTransactionIndex?: number): Observable<AccountAddressRestrictionTransaction> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not fan of the double dispatch. It gets the Transaction model too complicated with internal methods the user doesn't really care. I would create a switch/handers statement in the TransactionService (especially when there is a static call TransactionService.getResolvedFromReceipt) and remove resolveAliases from the transaction hierarchy.

I would stop using the Http implementations and start using the Repository Interface, in this case, ReceiptRepository

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you mean to put all codes in to one class here? It's another option agree but the single class can be complicated and main thing here is you will lose the single responsibility for Transaction to resolve alias.

Regrading the interface, ts doesn't work like JAVA or C# which you can use unity or spring, There's no DI in TS SDK, so resolving the interface is not easy

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not about DI, it's just about using interfaces, you can do

resolveAliases(recipientRepository: RecipientRepository, aggregateTransactionIndex?: number)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you find the correct implementation of the injected interface?

Copy link
Contributor

@dgarcia360 dgarcia360 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done @rg11, now it looks complete 👍 I can't think of any other edge case, it would be great to have a second review before merging the PR.

@dgarcia360 dgarcia360 self-requested a review December 6, 2019 11:30
@rg911 rg911 merged commit 847006a into symbol:master Dec 6, 2019
@fboucquez fboucquez deleted the task/g357_standardize_transaction_service branch April 13, 2020 12:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants