Skip to content

Conversation

@peachbits
Copy link
Contributor

@peachbits peachbits commented Nov 24, 2025

CHANGELOG

Does this branch warrant an entry to the CHANGELOG?

  • Yes
  • No

Dependencies

none

Description

none

Note

Add optional payoutTokenId to EdgeTxSwap, updating cleaners and tests accordingly.

  • Types:
    • Add optional payoutTokenId?: EdgeTokenId to EdgeTxSwap (src/types/types.ts).
  • Cleaners:
    • Export asEdgeTokenId and include optional payoutTokenId in asEdgeTxSwap (src/core/currency/wallet/currency-wallet-cleaners.ts).
  • Tests:
    • Update swap fixtures and spend test to include payoutTokenId (test/fake/fake-transactions.ts, test/core/currency/wallet/currency-wallet.test.ts).
  • Changelog:
    • Note addition of payoutTokenId to EdgeTxSwap.

Written by Cursor Bugbot for commit 9bc3e1b. This will update automatically on new commits. Configure here.


Comment on lines 34 to 58
export function getTokenMultiplier(
currencyInfo: EdgeCurrencyInfo,
allTokens: EdgeTokenMap,
tokenId: EdgeTokenId
): string {
if (tokenId == null) {
for (const denomination of currencyInfo.denominations) {
if (denomination.name === currencyInfo.currencyCode) {
return denomination.multiplier
}
}
} else {
const token: EdgeToken | undefined = allTokens[tokenId]
if (token != null) {
for (const denomination of token.denominations) {
if (denomination.name === token.currencyCode) {
return denomination.multiplier
}
}
}
}

return '1'
}

Copy link
Contributor

@swansontec swansontec Nov 25, 2025

Choose a reason for hiding this comment

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

The core should not provide utility functions like this, since everything goes over an expensive bridge. The denominationToNative and nativeToDenomination functions were historical accidents, and deprecation message says to "Use the information in EdgeCurrencyInfo / EdgeToken". We want to delete these guys, not replace them.

These types of utilities should move into edge-currency-accountbased and edge-react-gui in some sort of /utils file, since then they can be fast & synchronous.

Copy link
Contributor

@swansontec swansontec left a comment

Choose a reason for hiding this comment

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

The PR description is weird now (maybe edit that before merging), but the code is solid.

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