Skip to content

Commit

Permalink
chore(wallet-mobile): CR updated legacy swap pt ids
Browse files Browse the repository at this point in the history
  • Loading branch information
stackchain committed Sep 2, 2024
1 parent 433e103 commit 4d0a7e9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion apps/wallet-mobile/src/features/Swap/common/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {isPrimaryToken, primaryTokenId as ptId} from '@yoroi/portfolio'
import {useTheme} from '@yoroi/theme'
import {Balance, HW} from '@yoroi/types'
import {SwapApi} from '@yoroi/types/src/swap/api'
import {freeze} from 'immer'
import {useMutation, UseMutationOptions} from 'react-query'
import {z} from 'zod'

Expand Down Expand Up @@ -79,8 +80,9 @@ export const parseOrderTxMetadata = (metadataJson: string, primaryTokenId: strin
}
}

const swapPtTokenIds = freeze([ptId, '', '.'])
const normalisePrimaryTokenId = (tokenId: string, primaryTokenId: string) => {
return tokenId === ptId || tokenId === '' ? primaryTokenId : tokenId
return swapPtTokenIds.includes(tokenId) ? primaryTokenId : tokenId
}

function containsOnlyValidChars(str?: string): boolean {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import {BigNumber} from 'bignumber.js'
import {Buffer} from 'buffer'
import _ from 'lodash'

import {logger} from '../../../kernel/logger/logger'
import {RawUtxo, YoroiUnsignedTx} from '../../types'
import {asQuantity, Utxos} from '../../utils'
import {Cardano, CardanoMobile} from '../../wallets'
Expand All @@ -26,7 +27,6 @@ import {
} from '../utils'
import {collateralConfig, findCollateralCandidates, utxosMaker} from '../utxoManager/utxos'
import {wrappedCsl as getCSL} from '../wrappedCsl'
import {logger} from '../../../kernel/logger/logger'

const MSL = init('msl')

Expand Down

0 comments on commit 4d0a7e9

Please sign in to comment.