-
Notifications
You must be signed in to change notification settings - Fork 262
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
Conversation
2d752f5
to
4a61d0b
Compare
src/locales/en_US.ts
Outdated
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', |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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
/** | ||
* Given an EdgeTxAction, returns the display value for pre-filling the 'Category' tile | ||
*/ | ||
getTxActionSplitCategory = (action: EdgeTxAction | undefined): SplitCategory | undefined => { |
There was a problem hiding this comment.
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.
3248ed6
to
c7b8fe0
Compare
src/actions/CategoriesActions.ts
Outdated
wallet: EdgeCurrencyWallet, | ||
tokenId?: string | ||
): { splitCategory: SplitCategory; notes?: string } | undefined => { | ||
const action = tx.action |
There was a problem hiding this comment.
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
src/actions/CategoriesActions.ts
Outdated
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`) |
There was a problem hiding this comment.
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.
/rebase |
c7b8fe0
to
7f0c619
Compare
7f0c619
to
c310a22
Compare
CHANGELOG
Does this branch warrant an entry to the CHANGELOG?
Dependencies
noneRequirements
If you have made any visual changes to the GUI. Make sure you have: