Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ana/send claim rewards amount to extension #3736

Merged
merged 8 commits into from
Mar 20, 2020

Conversation

Bitcoinera
Copy link
Contributor

Closes #ISSUE

Description:

The TransactionData being returned from ModalWithdrawRewards was incomplete and the getter for stakingDenom there was broken too.

Includes a hack I'll need to refactor to include a last message in Claim rewards with the amount (for extension).

This is a work in progress.

Thank you! 🚀


For contributor:

  • Added changes entries. Run yarn changelog for a guided process.
  • Reviewed Files changed in the github PR explorer
  • Attach screenshots of the UI components on the PR description (if applicable)
  • Scope of work approved for big PRs

For reviewer:

  • Manually tested the changes on the UI

@Bitcoinera
Copy link
Contributor Author

Another possibility would be, instead of adding amount as the last message in the signMessage for extension, to add it in every message together with validators, like this:

(lines 103-109)

          txMessage = {
            ...txMessage,
            value: {
              ...txMessage.value,
              amount: transactionProperties.amounts
            }
          }

But there is not much difference and I think it is better to add it as the last one

@Bitcoinera Bitcoinera changed the title WIP Ana/send claim rewards amount to extension Ana/send claim rewards amount to extension Mar 19, 2020
@codecov
Copy link

codecov bot commented Mar 19, 2020

Codecov Report

Merging #3736 into develop will increase coverage by 0.19%.
The diff coverage is 100.00%.

@@             Coverage Diff             @@
##           develop    #3736      +/-   ##
===========================================
+ Coverage    86.88%   87.08%   +0.19%     
===========================================
  Files          125      125              
  Lines         2669     2671       +2     
  Branches       395      396       +1     
===========================================
+ Hits          2319     2326       +7     
+ Misses         330      325       -5     
  Partials        20       20              
Impacted Files Coverage Δ
src/scripts/extension-utils.js 96.55% <ø> (ø)
src/ActionModal/components/ActionModal.vue 96.05% <100.00%> (+0.01%) ⬆️
...rc/ActionModal/components/ModalWithdrawRewards.vue 97.29% <100.00%> (+13.96%) ⬆️
src/ActionModal/utils/ActionManager.js 100.00% <100.00%> (ø)
src/ActionModal/utils/signer.js 94.59% <100.00%> (ø)

@Bitcoinera
Copy link
Contributor Author

It is actually working quite well

type: "/".concat(type),
value: { amount: transactionProperties.amounts }
}
txMessages.push(claimAmountMessage)
Copy link
Collaborator

Choose a reason for hiding this comment

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

lol I get it now. very hacky... ^^
you remember that it is a bad idea to mix data types. same goes for adding pseudo messages to an actual message array.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Proposal:

extend getSigner in signer.js to return functions of the format (signMessage, metaData) => ... where metaData = { claimableRewards } then pass metaData to signWithExtension and send it to the extension. The extension now reads this prop and uses it to display this information.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

OK, so then I don't throw this into the messages... it feels weird to call this a metaData though. Especially when there is already a txMetaData already dancing around in ActionManager (can lead to confusion)

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeah this whole thing needs to be heavily refactored. you can call it anything else. how about displayingData.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, I will added it right there then. To txMetadata

Copy link
Contributor Author

@Bitcoinera Bitcoinera Mar 19, 2020

Choose a reason for hiding this comment

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

What about #3736 (comment)?

EDIT: doesn't work either

@Bitcoinera
Copy link
Contributor Author

Oops, you were right. The blockchain is not liking my message xD

I was wrong. It never worked

@faboweb
Copy link
Collaborator

faboweb commented Mar 19, 2020

Looks better! Why are e2e failing?

@Bitcoinera
Copy link
Contributor Author

Bitcoinera commented Mar 19, 2020

Looks better! Why are e2e failing?

Some problem with fetching from browserstack

EDIT: Let's merge 💃 !

submitType,
password,
displayedProperties
} = txMetaData
Copy link
Collaborator

Choose a reason for hiding this comment

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

😉

Comment on lines 742 to 744
displayedProperties:
this.title === "Claim Rewards" ? properties.amounts : null
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
displayedProperties:
this.title === "Claim Rewards" ? properties.amounts : null
}
displayedProperties: {
amounts: properties.amounts
}
}

@Bitcoinera
Copy link
Contributor Author

Give me a bit and I also implement this

@@ -60,8 +60,15 @@ export default {
computed: {
...mapGetters([`address`, `network`, `stakingDenom`]),
transactionData() {
if (!this.claimedReward) return {}
Copy link
Collaborator

Choose a reason for hiding this comment

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

what is this for? will this break if claimedReward is not there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I just copied from the other components 🤷‍♀

Yes, it would break but it would in any case. I can just get rid of it

By the way, we should merge this now that luniehq/lunie-browser-extension#179 is in, since otherwise it will break sowieso with the first claim rewards transaction

@faboweb faboweb merged commit 509a0a1 into develop Mar 20, 2020
@faboweb faboweb deleted the ana/send-claim-rewards-amount-to-extension branch March 20, 2020 23:39
faboweb added a commit that referenced this pull request Jun 2, 2020
* changelog

* preload network capabilities

* tests fixed

* add slug to store and mutations

* lunie version changed

* Aleksei/fixing path on extension (#173)

* changelog

* fixing redirect path after account creation in extension

* refactor isExtension getter using lunie config

Co-authored-by: Bitcoinera <[email protected]>

* correct submodule version

* added missing webpack resolution

* force checkout

* change to working commit

* make updates async

* remove package lock again

* use working commit

* first steps to parsing to v2 txs

* clone parsing from API

* linted

* move parsetx to store

* delete consolelog

* fix tests

* fix actions tests

* lint

* just in case add ledger_app like in fe

* working with #3736 in fe

* stay clean

* fix validators names in claim rewards

* fix tests

* lint

* working with #3736 now for real

* add claimable rewards

* lint. kill now unused functions

* changelog

* refactor property names

* linted

Co-authored-by: Aleksei Rudometov <[email protected]>
Co-authored-by: Bitcoinera <[email protected]>
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.

3 participants