Remove asset and activeAssets references (#2058)

This commit is contained in:
Fernando 2021-03-18 11:33:10 -03:00 committed by GitHub
parent a504ad495a
commit e2c1113377
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 1 additions and 27 deletions

View File

@ -87,7 +87,6 @@ export const buildSafe = async (
featuresEnabled,
balances: localSafe?.balances || Map(),
latestIncomingTxBlock: 0,
activeAssets: Set(),
activeTokens: Set(),
modules,
spendingLimits,

View File

@ -34,7 +34,6 @@ export type SafeRecordProps = {
modules?: ModulePair[] | null
spendingLimits?: SpendingLimit[] | null
activeTokens: Set<string>
activeAssets: Set<string>
balances: Map<string, BalanceRecord>
nonce: number
latestIncomingTxBlock: number
@ -54,7 +53,6 @@ const makeSafe = Record<SafeRecordProps>({
modules: [],
spendingLimits: [],
activeTokens: Set(),
activeAssets: Set(),
balances: Map(),
nonce: 0,
latestIncomingTxBlock: 0,

View File

@ -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,
}

View File

@ -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<SafeRecordProps> = {
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'

View File

@ -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,