Skip to content

Commit

Permalink
Correctly tag tokenApproval actionType in getTxActionDisplayInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge committed Sep 23, 2024
1 parent 4eb8156 commit 9e90e1c
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- added: Buy conversion tracking for Moonpay
- added: Error tracking for failure to report conversions to referral server
- changed: Remove whitespaces from custom token contract address input
- fixed: Correctly tag `tokenApproval` `actionType` in `getTxActionDisplayInfo`
- fixed: Clear previous swap errors when new amounts are entered or swap assets are changed in `SwapCreateScene`
- fixed: AddressTile2 touchable area states
- fixed: Cases where it was possible to create duplicate custom tokens
Expand Down
23 changes: 19 additions & 4 deletions src/actions/CategoriesActions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,8 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
const { assetActionType } = assetAct
payeeText = TX_ACTION_LABEL_MAP[assetActionType]

let unsupported = false

switch (actionType) {
case 'swap': {
iconPluginId = action.swapInfo.pluginId
Expand Down Expand Up @@ -379,7 +381,7 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
break
}
default:
console.error(`Unsupported EdgeTxAction assetAction:assetActionType: '${assetAction}:${assetActionType}'`)
unsupported = true
}
break
}
Expand Down Expand Up @@ -450,7 +452,7 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
}

default:
console.error(`Unsupported EdgeTxAction assetAction:assetActionType: '${assetAction}:${assetActionType}'`)
unsupported = true
}
break
}
Expand Down Expand Up @@ -479,13 +481,26 @@ export const getTxActionDisplayInfo = (tx: EdgeTransaction, account: EdgeAccount
break
}
default:
console.error(`Unsupported EdgeTxAction assetAction:assetActionType: '${assetAction}:${assetActionType}'`)
unsupported = true
}
break
}
case 'tokenApproval': {
switch (assetActionType) {
case 'tokenApproval': {
edgeCategory = { category: 'expense', subcategory: lstrings.wc_smartcontract_network_fee }
break
}
default:
unsupported = true
}
break
}
default:
console.error(`Unsupported EdgeTxAction assetAction: '${assetAction}'`)
unsupported = true
}

if (unsupported) console.error(`Unsupported EdgeTxAction assetAction:assetActionType '${assetAction}:${assetActionType}'`)
}
const savedData: EdgeMetadata = {
name: payeeText,
Expand Down

0 comments on commit 9e90e1c

Please sign in to comment.