Skip to content

Commit

Permalink
Properly tag Tron stake/unstake/claim txs
Browse files Browse the repository at this point in the history
  • Loading branch information
paullinator committed Jan 10, 2024
1 parent 1f03775 commit 4ba48e5
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/actions/CategoriesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
direction = 'send'
break
}
case 'claim':
case 'unstake': {
let subcategory
if (action.stakeAssets.length === 1) subcategory = sprintf(lstrings.transaction_details_unstake_subcat_1s, ...getCurrencyCodes(action.stakeAssets))
Expand All @@ -423,6 +424,7 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
direction = 'receive'
break
}
case 'claimOrder':
case 'unstakeOrder': {
if (action.stakeAssets.length === 1) notes = sprintf(lstrings.transaction_details_unstake_order_notes_1s, ...getCurrencyCodes(action.stakeAssets))
else if (action.stakeAssets.length === 2)
Expand Down Expand Up @@ -518,6 +520,7 @@ export const pluginIdIcons: Record<string, string> = {
swapuz: EDGE_CONTENT_SERVER_URI + '/swapuz.png',
thorchain: EDGE_CONTENT_SERVER_URI + '/thorchain.png',
thorchainda: EDGE_CONTENT_SERVER_URI + '/thorchain.png',
tronResources: EDGE_CONTENT_SERVER_URI + '/TRON/TRON.png',
velodrome: EDGE_CONTENT_SERVER_URI + '/velodrome.png',
xrpdex: EDGE_CONTENT_SERVER_URI + '/xrpdex.png'
}
2 changes: 2 additions & 0 deletions src/constants/txActionConstants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import { lstrings } from '../locales/strings'

export const TX_ACTION_LABEL_MAP: Record<EdgeAssetActionType, string> = {
buy: lstrings.fiat_plugin_buy_currencycode,
claim: lstrings.transaction_details_claim,
claimOrder: lstrings.transaction_details_claim_order,
sell: lstrings.fiat_plugin_sell_currencycode_s,
sellNetworkFee: lstrings.fiat_plugin_sell_network_fee,
swap: lstrings.transaction_details_swap,
Expand Down
2 changes: 2 additions & 0 deletions src/locales/en_US.ts
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,8 @@ const strings = {
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_claim: 'Claim Staked Funds',
transaction_details_claim_order: 'Claim Order',
transaction_details_stake: 'Stake Funds',
transaction_details_stake_order: 'Stake Order',
transaction_details_stake_network_fee: 'Stake Network Fee',
Expand Down
2 changes: 2 additions & 0 deletions src/locales/strings/enUS.json
Original file line number Diff line number Diff line change
Expand Up @@ -627,6 +627,8 @@
"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_claim": "Claim Staked Funds",
"transaction_details_claim_order": "Claim Order",
"transaction_details_stake": "Stake Funds",
"transaction_details_stake_order": "Stake Order",
"transaction_details_stake_network_fee": "Stake Network Fee",
Expand Down
36 changes: 36 additions & 0 deletions src/plugins/stake-plugins/currency/tronStakePlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ export const makeTronStakePlugin = async (): Promise<StakePlugin> => {
otherParams: {
type: 'addV2',
params: { nativeAmount, resource }
},
assetAction: { assetActionType: 'stake' },
savedAction: {
actionType: 'stake',
pluginId: stakeProviderInfo.pluginId,
stakeAssets: [
{
pluginId,
tokenId: null,
nativeAmount
}
]
}
}
edgeTransaction = await wallet.makeSpend(spendInfo)
Expand All @@ -191,6 +203,18 @@ export const makeTronStakePlugin = async (): Promise<StakePlugin> => {
otherParams: {
type: 'removeV2',
params: { nativeAmount, resource }
},
assetAction: { assetActionType: 'unstake' },
savedAction: {
actionType: 'stake',
pluginId: stakeProviderInfo.pluginId,
stakeAssets: [
{
pluginId,
tokenId: null,
nativeAmount
}
]
}
}
edgeTransaction = await wallet.makeSpend(spendInfo)
Expand All @@ -202,6 +226,18 @@ export const makeTronStakePlugin = async (): Promise<StakePlugin> => {
spendTargets,
otherParams: {
type: 'withdrawExpireUnfreeze'
},
assetAction: { assetActionType: 'claim' },
savedAction: {
actionType: 'stake',
pluginId: stakeProviderInfo.pluginId,
stakeAssets: [
{
pluginId,
tokenId: null,
nativeAmount
}
]
}
}
edgeTransaction = await wallet.makeSpend(spendInfo)
Expand Down

0 comments on commit 4ba48e5

Please sign in to comment.