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

Show EdgeTxAction Info in Transaction List #4526

Merged
merged 1 commit into from
Oct 25, 2023
Merged

Conversation

Jon-edge
Copy link
Collaborator

@Jon-edge Jon-edge commented Oct 11, 2023

Screenshot 2023-10-11 at 3 38 09 PM Screenshot 2023-10-11 at 3 38 00 PM Screenshot 2023-10-11 at 3 37 39 PM

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Requirements

If you have made any visual changes to the GUI. Make sure you have:

  • Tested on iOS device
  • Tested on Android device
  • Tested on small-screen device (iPod Touch)
  • Tested on large-screen device (tablet)

Comment on lines 678 to 700
transaction_details_swap: 'Swap Funds',
transaction_details_swap_order_cancel: 'Swap Order Canceled',
transaction_details_swap_order_post: 'Swap Order Opened',
transaction_details_swap_order_fill: 'Swap Order Filled',
transaction_details_stake: 'Stake Funds',
transaction_details_stake_order: 'Stake Order',
transaction_details_unstake: 'Unstake Funds',
transaction_details_unstake_order: 'Unstake Order',

transaction_details_swap_subcat_2s: '%1$s to %2$s',
transaction_details_swap_order_post_subcat_2s: '%1$s to %2$s Order Opened',
transaction_details_swap_order_fill_subcat_2s: '%1$s to %2$s Order Filled',
transaction_details_swap_order_cancel_subcat_2s: '%1$s to %2$s Order Canceled',
transaction_details_stake_subcat_1s: 'Stake %1$s',
transaction_details_stake_subcat_2s: 'Stake %1$s and %2$s',
transaction_details_stake_order_subcat_1s: 'Create Stake %1$s Order',
transaction_details_stake_order_subcat_2s: 'Create Stake %1$s and %2$s Order',
transaction_details_unstake_subcat_1s: 'Unstake %1$s',
transaction_details_unstake_subcat_2s: 'Unstake %1$s and %2$s',
transaction_details_unstake_order_subcat_1s: 'Create Unstake %1$s Order',
transaction_details_unstake_order_subcat_2s: 'Create Unstake %1$s and %2$s Order',
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like these aren't really "categories", but more like notes. From an accounting point of view, I would expect something simple like "Expense:Staking" or "Exchange:Swap" for the category, and then details like "Trade XYZ token for ZZZ token" as a memo or note or something, but maybe I am wrong. I would ask @paullinator for a second opinion on this design.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah agreed, defaults for notes sound better. I'll sync up with him on this

Comment on lines 105 to 108
/**
* Given an EdgeTxAction, returns the display value for pre-filling the 'Category' tile
*/
getTxActionSplitCategory = (action: EdgeTxAction | undefined): SplitCategory | undefined => {
Copy link
Contributor

@swansontec swansontec Oct 16, 2023

Choose a reason for hiding this comment

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

Can we fold this logic into the splitCategory function, or at least move it into the same file so it's accessible as a utility function?

Maybe we could call it getTransactionCategory(walllet: EdgeCurrencyWallet, tx: EdgeTransaction): SplitCategory, and then this function could look at both tx.action and tx.metadata.category, which would both be available in that case.

That way, we can utilize this function in the CSV export / QBO export functions, or any other places where we need the category. Right now, the CSV export won't match the tx details, since we don't have the logic consolidated.

@Jon-edge Jon-edge force-pushed the jon/display-txinfo branch 4 times, most recently from 3248ed6 to c7b8fe0 Compare October 24, 2023 23:43
wallet: EdgeCurrencyWallet,
tokenId?: string
): { splitCategory: SplitCategory; notes?: string } | undefined => {
const action = tx.action
Copy link
Contributor

Choose a reason for hiding this comment

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

Could be const {action} = tx

if (action.stakeAssets.length === 1) subcategory = sprintf(lstrings.transaction_details_stake_subcat_1s, ...getCurrencyCodes(action.stakeAssets))
else if (action.stakeAssets.length === 2) subcategory = sprintf(lstrings.transaction_details_stake_subcat_2s, ...getCurrencyCodes(action.stakeAssets))
else {
console.error(`Unsupported number of assets for '${type}' EdgeTxActionSwapType`)
Copy link
Contributor

Choose a reason for hiding this comment

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

I would use warn instead of error, since as a dev I don't want a big red screen of death if my wallet gets into this state.

@Jon-edge
Copy link
Collaborator Author

/rebase

@Jon-edge Jon-edge enabled auto-merge October 25, 2023 19:47
@Jon-edge Jon-edge merged commit 4cb9dd9 into develop Oct 25, 2023
2 checks passed
@Jon-edge Jon-edge deleted the jon/display-txinfo branch October 25, 2023 20:02
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.

2 participants