diff --git a/packages/@core-js/src/utils/common.ts b/packages/@core-js/src/utils/common.ts index 666320929..3cc300cc5 100644 --- a/packages/@core-js/src/utils/common.ts +++ b/packages/@core-js/src/utils/common.ts @@ -27,3 +27,11 @@ export function throttle( return throttled; } + +export function excludeUndefinedValues(obj: T): T { + return Object.keys(obj).reduce((acc, key) => { + const _acc = acc; + if (obj[key] !== undefined) _acc[key] = obj[key]; + return _acc; + }, {} as T); +} diff --git a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx index fb9772d50..3a1588883 100644 --- a/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx +++ b/packages/mobile/src/core/ModalContainer/NFTOperations/Modals/SignRawModal.tsx @@ -160,7 +160,7 @@ export const SignRawModal = memo((props) => { } } - return null; + return undefined; }; return ( @@ -173,9 +173,9 @@ export const SignRawModal = memo((props) => { ((props) => { const { action } = props; const { type, payload } = action; + const pureProps = excludeUndefinedValues(props); switch (type) { case ActionType.TonTransfer: return ( - + {!!payload.comment && } ); case ActionType.JettonTransfer: return ( - + {!!payload.comment && } ); case ActionType.NftItemTransfer: return ( - + {!!payload.comment && } ); case ActionType.NftPurchase: return ( - + ); @@ -47,7 +49,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.parse(payload.contract.address).toShort()} title={t('transactions.smartcontract_exec')} iconName="ic-gear-28" - {...props} + {...pureProps} /> ); case ActionType.Unknown: @@ -56,7 +58,7 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.unknown')} subtitle={t('transactions.unknown_description')} subtitleNumberOfLines={2} - {...props} + {...pureProps} /> ); case ActionType.AuctionBid: @@ -65,7 +67,7 @@ export const ActionListItemByType = memo((props) => { subtitle={modifyNftName(payload.nft?.metadata?.name)} title={t('transactions.bid')} iconName="ic-tray-arrow-up-28" - {...props} + {...pureProps} /> ); case ActionType.ContractDeploy: @@ -74,7 +76,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.parse(payload.address).toShort()} title={t('transactions.wallet_initialized')} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.ReceiveTRC20: @@ -84,7 +86,7 @@ export const ActionListItemByType = memo((props) => { title={t('transaction_type_receive')} iconName="ic-tray-arrow-down-28" greenValue - {...props} + {...pureProps} /> ); case ActionType.SendTRC20: @@ -93,7 +95,7 @@ export const ActionListItemByType = memo((props) => { subtitle={Address.toShort(payload.recipient)} title={t('transaction_type_sent')} iconName="ic-tray-arrow-up-28" - {...props} + {...pureProps} /> ); case ActionType.JettonBurn: @@ -102,7 +104,7 @@ export const ActionListItemByType = memo((props) => { subtitle={payload.jetton.name} title={t('transactions.burned')} iconName="ic-fire-28" - {...props} + {...pureProps} /> ); case ActionType.JettonMint: @@ -110,7 +112,7 @@ export const ActionListItemByType = memo((props) => { ); case ActionType.DepositStake: @@ -119,7 +121,7 @@ export const ActionListItemByType = memo((props) => { pictureSource={getImplementationIcon(action.payload.implementation)} title={t('transactions.deposit')} subtitle={payload.pool.name} - {...props} + {...pureProps} /> ); case ActionType.WithdrawStake: @@ -129,7 +131,7 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.withdraw')} subtitle={payload.pool.name} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.WithdrawStakeRequest: @@ -139,17 +141,17 @@ export const ActionListItemByType = memo((props) => { title={t('transactions.withdrawal_request')} subtitle={payload.pool.name} iconName="ic-donemark-28" - {...props} + {...pureProps} /> ); case ActionType.JettonSwap: - return ; + return ; case ActionType.Subscribe: - return ; + return ; case ActionType.UnSubscribe: - return ; + return ; default: - return ; + return ; } });