From e2c11133772b1e3850a1e4e1b3ae0c3f6f5ffaaa Mon Sep 17 00:00:00 2001 From: Fernando Date: Thu, 18 Mar 2021 11:33:10 -0300 Subject: [PATCH] Remove asset and activeAssets references (#2058) --- src/logic/safe/store/actions/fetchSafe.ts | 1 - src/logic/safe/store/models/safe.ts | 2 -- src/logic/safe/store/reducer/safe.ts | 2 -- .../shouldSafeStoreBeUpdated.test.ts | 21 ------------------- .../utils/__tests__/tokenHelpers.test.ts | 2 +- 5 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/logic/safe/store/actions/fetchSafe.ts b/src/logic/safe/store/actions/fetchSafe.ts index d7dcba4f..5ffa962a 100644 --- a/src/logic/safe/store/actions/fetchSafe.ts +++ b/src/logic/safe/store/actions/fetchSafe.ts @@ -87,7 +87,6 @@ export const buildSafe = async ( featuresEnabled, balances: localSafe?.balances || Map(), latestIncomingTxBlock: 0, - activeAssets: Set(), activeTokens: Set(), modules, spendingLimits, diff --git a/src/logic/safe/store/models/safe.ts b/src/logic/safe/store/models/safe.ts index 38616f17..7fb02abf 100644 --- a/src/logic/safe/store/models/safe.ts +++ b/src/logic/safe/store/models/safe.ts @@ -34,7 +34,6 @@ export type SafeRecordProps = { modules?: ModulePair[] | null spendingLimits?: SpendingLimit[] | null activeTokens: Set - activeAssets: Set balances: Map nonce: number latestIncomingTxBlock: number @@ -54,7 +53,6 @@ const makeSafe = Record({ modules: [], spendingLimits: [], activeTokens: Set(), - activeAssets: Set(), balances: Map(), nonce: 0, latestIncomingTxBlock: 0, diff --git a/src/logic/safe/store/reducer/safe.ts b/src/logic/safe/store/reducer/safe.ts index 44112c4b..c75baef4 100644 --- a/src/logic/safe/store/reducer/safe.ts +++ b/src/logic/safe/store/reducer/safe.ts @@ -25,7 +25,6 @@ export const buildSafe = (storedSafe: SafeRecordProps): SafeRecordProps => { const addresses = storedSafe.owners.map((owner) => checksumAddress(owner.address)) const owners = buildOwnersFrom(Array.from(names), Array.from(addresses)) const activeTokens = Set(storedSafe.activeTokens) - const activeAssets = Set(storedSafe.activeAssets) const balances = Map(storedSafe.balances) return { @@ -33,7 +32,6 @@ export const buildSafe = (storedSafe: SafeRecordProps): SafeRecordProps => { owners, balances, activeTokens, - activeAssets, latestIncomingTxBlock: 0, modules: null, } diff --git a/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts b/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts index 51ca8521..0ed862bb 100644 --- a/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts +++ b/src/logic/safe/utils/__tests__/shouldSafeStoreBeUpdated.test.ts @@ -7,7 +7,6 @@ const getMockedOldSafe = ({ needsUpdate, balances, recurringUser, - assets, activeTokens, owners, featuresEnabled, @@ -30,8 +29,6 @@ const getMockedOldSafe = ({ } const mockedActiveTokenAddress1 = '0x36591cd3DA96b21Ac9ca54cFaf80fe45107294F1' const mockedActiveTokenAddress2 = '0x92aF97cbF10742dD2527ffaBA70e34C03CFFC2c1' - const mockedActiveAssetsAddress1 = '0x503ab2a6A70c6C6ec8b25a4C87C784e1c8f8e8CD' - const mockedActiveAssetsAddress2 = '0xfdd4E685361CB7E89a4D27e03DCd0001448d731F' return { name: name || 'MockedSafe', @@ -42,7 +39,6 @@ const getMockedOldSafe = ({ modules: modules || [], spendingLimits: spendingLimits || [], activeTokens: activeTokens || Set([mockedActiveTokenAddress1, mockedActiveTokenAddress2]), - assets: assets || Set([mockedActiveAssetsAddress1, mockedActiveAssetsAddress2]), balances: balances || Map({ @@ -198,23 +194,6 @@ describe('shouldSafeStoreBeUpdated', () => { // Then expect(expectedResult).toEqual(true) }) - it(`Given an old activeAssets list and a new activeAssets list for the safe, should return true`, () => { - // given - const mockedActiveTokenAddress1 = '0x36591cd3DA96b21Ac9ca54cFaf80fe45107294F1' - const mockedActiveTokenAddress2 = '0x92aF97cbF10742dD2527ffaBA70e34C03CFFC2c1' - const oldActiveAssets = Set([mockedActiveTokenAddress1, mockedActiveTokenAddress2]) - const newActiveAssets = Set([mockedActiveTokenAddress1]) - const oldSafe = getMockedOldSafe({ assets: oldActiveAssets }) - const newSafeProps: Partial = { - assets: newActiveAssets, - } - - // When - const expectedResult = shouldSafeStoreBeUpdated(newSafeProps, oldSafe) - - // Then - expect(expectedResult).toEqual(true) - }) it(`Given an old balances list and a new balances list for the safe, should return true`, () => { // given const mockedActiveTokenAddress1 = '0x36591cd3DA96b21Ac9ca54cFaf80fe45107294F1' diff --git a/src/logic/tokens/utils/__tests__/tokenHelpers.test.ts b/src/logic/tokens/utils/__tests__/tokenHelpers.test.ts index c211e8b4..142c2d6a 100644 --- a/src/logic/tokens/utils/__tests__/tokenHelpers.test.ts +++ b/src/logic/tokens/utils/__tests__/tokenHelpers.test.ts @@ -58,7 +58,7 @@ describe('getERC20DecimalsAndSymbol', () => { symbol, decimals, logoUri: 'https://gnosis-safe-token-logos.s3.amazonaws.com/0x5592EC0cfb4dbc12D3aB100b257153436a1f0FEa.png', - balance: 0, + balance: { tokenBalance: '0', fiatBalance: '0' }, }) const expectedResult = { decimals,