From 4d0a7e9c6208bab95769d582edc64166e07728e1 Mon Sep 17 00:00:00 2001 From: Juliano Lazzarotto <30806844+stackchain@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:38:22 +0100 Subject: [PATCH] chore(wallet-mobile): CR updated legacy swap pt ids --- apps/wallet-mobile/src/features/Swap/common/helpers.ts | 4 +++- apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30.ts | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/wallet-mobile/src/features/Swap/common/helpers.ts b/apps/wallet-mobile/src/features/Swap/common/helpers.ts index f9a374cdbe..355e291ce5 100644 --- a/apps/wallet-mobile/src/features/Swap/common/helpers.ts +++ b/apps/wallet-mobile/src/features/Swap/common/helpers.ts @@ -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' @@ -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 { diff --git a/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30.ts b/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30.ts index 92554f8d52..850edbf90a 100644 --- a/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30.ts +++ b/apps/wallet-mobile/src/yoroi-wallets/cardano/cip30/cip30.ts @@ -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' @@ -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')