Skip to content

Commit 6fbf24a

Browse files
authored
refactor(swap): move swap calculation functions to manager (#3689)
1 parent ef5a10b commit 6fbf24a

16 files changed

+236
-145
lines changed

apps/wallet-mobile/src/features/Swap/useCases/ReviewSwap/TransactionSummary.stories.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import {storiesOf} from '@storybook/react-native'
22
import {tokenInfoMocks} from '@yoroi/portfolio'
3-
import {mockSwapManager, mockSwapStateDefault, orderMocks, SwapOrderCalculation, SwapProvider} from '@yoroi/swap'
3+
import {mockSwapManager, mockSwapStateDefault, orderMocks, SwapProvider} from '@yoroi/swap'
4+
import {Swap} from '@yoroi/types'
45
import React from 'react'
56
import {StyleSheet, View} from 'react-native'
67

@@ -33,8 +34,9 @@ storiesOf('TransactionSummary', module) //
3334
)
3435
})
3536

36-
const TxSummary = ({calculation}: {calculation: SwapOrderCalculation}) => {
37+
const TxSummary = ({calculation}: {calculation: Swap.OrderCalculation}) => {
3738
const orderData = {...mocks.confirmTx.orderData, selectedPoolCalculation: calculation}
39+
3840
return (
3941
<WalletManagerProviderMock wallet={{...walletMocks.wallet}}>
4042
<SwapProvider

apps/wallet-mobile/src/kernel/config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ export const governaceAfterBlock = freeze({
1212

1313
export const agreementDate = 1691967600000
1414

15-
export const loggerLevel: App.Logger.Level = isDev ? App.Logger.Level.Debug : App.Logger.Level.Warn
15+
export const loggerLevel: App.Logger.Level = isDev ? App.Logger.Level.Log : App.Logger.Level.Warn

packages/swap/src/helpers/mocks.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import {Swap} from '@yoroi/types'
22

3-
import {SwapOrderCalculation} from '../types'
43
import {tokenInfoMocks} from '../tokenInfo.mocks'
54

65
const mockedPools1: Swap.Pool[] = [
@@ -600,7 +599,7 @@ const mockedPools8: Swap.Pool[] = [
600599
},
601600
]
602601

603-
const mockedOrderCalculations1: SwapOrderCalculation[] = [
602+
const mockedOrderCalculations1: Swap.OrderCalculation[] = [
604603
{
605604
order: {
606605
side: 'sell',
@@ -1197,7 +1196,7 @@ const mockedOrderCalculations1: SwapOrderCalculation[] = [
11971196
},
11981197
]
11991198

1200-
const mockedOrderCalculations2: SwapOrderCalculation[] = [
1199+
const mockedOrderCalculations2: Swap.OrderCalculation[] = [
12011200
{
12021201
order: {
12031202
side: 'buy',

0 commit comments

Comments
 (0)