Adds isEmptyAddress method

This commit is contained in:
Agustin Pane 2021-01-21 15:26:25 -03:00
parent 38c5bdf757
commit 8b1809d8eb
1 changed files with 6 additions and 0 deletions

View File

@ -1,12 +1,18 @@
import { List } from 'immutable' import { List } from 'immutable'
import { SafeRecord } from 'src/logic/safe/store/models/safe' import { SafeRecord } from 'src/logic/safe/store/models/safe'
import { sameString } from 'src/utils/strings' import { sameString } from 'src/utils/strings'
import { EMPTY_DATA } from 'src/logic/wallets/ethTransactions'
export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000' export const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000'
export const sameAddress = (firstAddress: string | undefined, secondAddress: string | undefined): boolean => { export const sameAddress = (firstAddress: string | undefined, secondAddress: string | undefined): boolean => {
return sameString(firstAddress, secondAddress) return sameString(firstAddress, secondAddress)
} }
export const isEmptyAddress = (address: string | undefined): boolean => {
if (!address) return true
return sameAddress(address, EMPTY_DATA) || sameAddress(address, ZERO_ADDRESS)
}
export const shortVersionOf = (value: string, cut: number): string => { export const shortVersionOf = (value: string, cut: number): string => {
if (!value) { if (!value) {
return 'Unknown' return 'Unknown'