Merge pull request #1095 from gnosis/2.5.2-dev-master-backmerge
2.5.2 dev master backmerge
This commit is contained in:
commit
67feb555ea
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "safe-react",
|
||||
"version": "2.5.1",
|
||||
"version": "2.5.2",
|
||||
"description": "Allowing crypto users manage funds in a safer way",
|
||||
"website": "https://github.com/gnosis/safe-react#readme",
|
||||
"bugs": {
|
||||
|
|
|
@ -9,7 +9,7 @@ import saveTokens from './saveTokens'
|
|||
|
||||
import generateBatchRequests from 'src/logic/contracts/generateBatchRequests'
|
||||
import { fetchTokenList } from 'src/logic/tokens/api'
|
||||
import { makeToken } from 'src/logic/tokens/store/model/token'
|
||||
import { makeToken, Token } from 'src/logic/tokens/store/model/token'
|
||||
import { tokensSelector } from 'src/logic/tokens/store/selectors'
|
||||
import { getWeb3 } from 'src/logic/wallets/getWeb3'
|
||||
import { store } from 'src/store'
|
||||
|
@ -57,7 +57,7 @@ const getTokenValues = (tokenAddress) =>
|
|||
methods: ['decimals', 'name', 'symbol'],
|
||||
})
|
||||
|
||||
export const getTokenInfos = async (tokenAddress) => {
|
||||
export const getTokenInfos = async (tokenAddress: string): Promise<Token> => {
|
||||
if (!tokenAddress) {
|
||||
return null
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import { ALTERNATIVE_TOKEN_ABI } from 'src/logic/tokens/utils/alternativeAbi'
|
|||
import { web3ReadOnly as web3 } from 'src/logic/wallets/getWeb3'
|
||||
import { isEmptyData } from 'src/routes/safe/store/actions/transactions/utils/transactionHelpers'
|
||||
import { TxServiceModel } from 'src/routes/safe/store/actions/transactions/fetchTransactions/loadOutgoingTransactions'
|
||||
import { Map } from 'immutable'
|
||||
|
||||
export const ETH_ADDRESS = '0x000'
|
||||
export const SAFE_TRANSFER_FROM_WITHOUT_DATA_HASH = '42842e0e'
|
||||
|
@ -39,11 +40,15 @@ export const isAddressAToken = async (tokenAddress: string): Promise<boolean> =>
|
|||
return call !== '0x'
|
||||
}
|
||||
|
||||
export const isTokenTransfer = (tx: any): boolean => {
|
||||
export const isTokenTransfer = (tx: TxServiceModel): boolean => {
|
||||
return !isEmptyData(tx.data) && tx.data.substring(0, 10) === '0xa9059cbb' && Number(tx.value) === 0
|
||||
}
|
||||
|
||||
export const isSendERC721Transaction = (tx: any, txCode: string, knownTokens: any) => {
|
||||
export const isSendERC721Transaction = (
|
||||
tx: TxServiceModel,
|
||||
txCode: string,
|
||||
knownTokens: Map<string, Token>,
|
||||
): boolean => {
|
||||
// "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85" - ens token contract, includes safeTransferFrom
|
||||
// but no proper ERC721 standard implemented
|
||||
return (
|
||||
|
@ -79,9 +84,9 @@ export const getERC20DecimalsAndSymbol = async (
|
|||
address: tokenAddress,
|
||||
methods: ['decimals', 'symbol'],
|
||||
})
|
||||
|
||||
return { decimals: Number(tokenDecimals), symbol: tokenSymbol }
|
||||
}
|
||||
return { decimals: storedTokenInfo.decimals as number, symbol: storedTokenInfo.symbol }
|
||||
} catch (err) {
|
||||
console.error(`Failed to retrieve token info for ERC20 token ${tokenAddress}`)
|
||||
}
|
||||
|
@ -92,7 +97,7 @@ export const getERC20DecimalsAndSymbol = async (
|
|||
export const isSendERC20Transaction = async (
|
||||
tx: TxServiceModel,
|
||||
txCode: string,
|
||||
knownTokens: any,
|
||||
knownTokens: Map<string, Token>,
|
||||
): Promise<boolean> => {
|
||||
let isSendTokenTx = !isSendERC721Transaction(tx, txCode, knownTokens) && isTokenTransfer(tx)
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ export type OutgoingTxs = {
|
|||
|
||||
export type BatchProcessTxsProps = OutgoingTxs & {
|
||||
currentUser?: string
|
||||
knownTokens: Record<string, Token>
|
||||
knownTokens: Map<string, Token>
|
||||
safe: SafeRecord
|
||||
}
|
||||
|
||||
|
|
|
@ -85,7 +85,7 @@ export const isCustomTransaction = async (
|
|||
tx: TxServiceModel,
|
||||
txCode: string,
|
||||
safeAddress: string,
|
||||
knownTokens: Record<string, Token>,
|
||||
knownTokens: Map<string, Token>,
|
||||
): Promise<boolean> => {
|
||||
return (
|
||||
isOutgoingTransaction(tx, safeAddress) &&
|
||||
|
@ -340,7 +340,7 @@ export const mockTransaction = (tx: TxToMock, safeAddress: string, state): Promi
|
|||
...tx,
|
||||
}
|
||||
|
||||
const knownTokens: Record<string, Token> = state[TOKEN_REDUCER_ID]
|
||||
const knownTokens: Map<string, Token> = state[TOKEN_REDUCER_ID]
|
||||
const safe: SafeRecord = state[SAFE_REDUCER_ID].getIn([SAFE_REDUCER_ID, safeAddress])
|
||||
const cancellationTxs = state[CANCELLATION_TRANSACTIONS_REDUCER_ID].get(safeAddress) || Map()
|
||||
const outgoingTxs = state[TRANSACTIONS_REDUCER_ID].get(safeAddress) || List()
|
||||
|
|
Loading…
Reference in New Issue