Merge branch 'development' of github.com:gnosis/safe-react into development

This commit is contained in:
Mati Dastugue 2021-03-08 21:10:17 -03:00
commit 8bbc1ce62d
9 changed files with 61 additions and 34 deletions

View File

@ -161,7 +161,7 @@
"@gnosis.pm/safe-apps-sdk": "1.0.3",
"@gnosis.pm/safe-apps-sdk-v1": "npm:@gnosis.pm/safe-apps-sdk@0.4.2",
"@gnosis.pm/safe-contracts": "1.1.1-dev.2",
"@gnosis.pm/safe-react-components": "https://github.com/gnosis/safe-react-components.git#fb1a523",
"@gnosis.pm/safe-react-components": "https://github.com/gnosis/safe-react-components.git#f610327",
"@gnosis.pm/util-contracts": "2.0.6",
"@ledgerhq/hw-transport-node-hid-singleton": "5.41.0",
"@material-ui/core": "^4.11.0",

View File

@ -42,15 +42,25 @@ export const loadPagedHistoryTransactions = async (
export const loadHistoryTransactions = async (safeAddress: string): Promise<HistoryGatewayResponse['results']> => {
const historyTransactionsUrl = getHistoryTransactionsUrl(safeAddress)
const {
data: { results, ...pointers },
} = await axios.get<HistoryGatewayResponse, AxiosResponse<HistoryGatewayResponse>>(historyTransactionsUrl)
try {
const {
data: { results, ...pointers },
} = await axios.get<HistoryGatewayResponse, AxiosResponse<HistoryGatewayResponse>>(historyTransactionsUrl)
if (!historyPointers[safeAddress]) {
historyPointers[safeAddress] = pointers
if (!historyPointers[safeAddress]) {
historyPointers[safeAddress] = pointers
}
return results
} catch (error) {
// When the safe is just created there is a delay until the gateway recognize the
// safe address, when that happens it returns 404.
if (error.response.status === 404) {
return []
}
throw Error(`There was an error trying to fetch history txs from safeAddress ${safeAddress}`)
}
return results
}
/************/
@ -90,14 +100,23 @@ export const loadPagedQueuedTransactions = async (
export const loadQueuedTransactions = async (safeAddress: string): Promise<QueuedGatewayResponse['results']> => {
const queuedTransactionsUrl = getQueuedTransactionsUrl(safeAddress)
try {
const {
data: { results, ...pointers },
} = await axios.get<QueuedGatewayResponse, AxiosResponse<QueuedGatewayResponse>>(queuedTransactionsUrl)
const {
data: { results, ...pointers },
} = await axios.get<QueuedGatewayResponse, AxiosResponse<QueuedGatewayResponse>>(queuedTransactionsUrl)
if (!queuedPointers[safeAddress] || queuedPointers[safeAddress].next === null) {
queuedPointers[safeAddress] = pointers
}
if (!queuedPointers[safeAddress] || queuedPointers[safeAddress].next === null) {
queuedPointers[safeAddress] = pointers
return results
} catch (error) {
// When the safe is just created there is a delay until the gateway recognize the
// safe address, when that happens it returns 404.
if (error.response.status === 404) {
return []
}
throw Error(`There was an error trying to fetch queued txs from safeAddress ${safeAddress}`)
}
return results
}

View File

@ -17,7 +17,7 @@ const SIGNERS = {
const getSignersByWallet = (isHW) =>
isHW ? [SIGNERS.ETH_SIGN] : [SIGNERS.EIP712_V3, SIGNERS.EIP712_V4, SIGNERS.EIP712, SIGNERS.ETH_SIGN]
export const SAFE_VERSION_FOR_OFFCHAIN_SIGNATURES = '>=1.1.1'
export const SAFE_VERSION_FOR_OFFCHAIN_SIGNATURES = '>=1.0.0'
export const tryOffchainSigning = async (safeTxHash: string, txArgs, isHW: boolean): Promise<string> => {
let signature

View File

@ -14,7 +14,7 @@ type FeatureConfigByVersion = {
}
const FEATURES_BY_VERSION: FeatureConfigByVersion[] = [
{ name: FEATURES.ERC721, validVersion: '>=1.1.1' },
{ name: FEATURES.ERC721 },
{ name: FEATURES.ERC1155, validVersion: '>=1.1.1' },
{ name: FEATURES.SAFE_APPS },
{ name: FEATURES.CONTRACT_INTERACTION },

View File

@ -1,15 +1,17 @@
import { Loader } from '@gnosis.pm/safe-react-components'
import { Loader, Title } from '@gnosis.pm/safe-react-components'
import React, { ReactElement } from 'react'
import { usePagedHistoryTransactions } from './hooks/usePagedHistoryTransactions'
import { Centered } from './styled'
import { Centered, NoTransactions } from './styled'
import { HistoryTxList } from './HistoryTxList'
import { TxsInfiniteScroll } from './TxsInfiniteScroll'
import Img from 'src/components/layout/Img'
import NoTransactionsImage from './assets/no-transactions.svg'
export const HistoryTransactions = (): ReactElement => {
const { count, hasMore, next, transactions, isLoading } = usePagedHistoryTransactions()
if (count === 0) {
if (isLoading || !transactions) {
return (
<Centered>
<Loader size="md" />
@ -17,6 +19,15 @@ export const HistoryTransactions = (): ReactElement => {
)
}
if (count === 0) {
return (
<NoTransactions>
<Img alt="No Transactions yet" src={NoTransactionsImage} />
<Title size="xs">History transactions will appear here </Title>
</NoTransactions>
)
}
return (
<TxsInfiniteScroll next={next} hasMore={hasMore} isLoading={isLoading}>
<HistoryTxList transactions={transactions} />

View File

@ -1,23 +1,16 @@
import { Loader, Title } from '@gnosis.pm/safe-react-components'
import React, { ReactElement } from 'react'
import style from 'styled-components'
import Img from 'src/components/layout/Img'
import { ActionModal } from './ActionModal'
import NoTransactionsImage from './assets/no-transactions.svg'
import { usePagedQueuedTransactions } from './hooks/usePagedQueuedTransactions'
import { QueueTxList } from './QueueTxList'
import { Centered } from './styled'
import { Centered, NoTransactions } from './styled'
import { TxActionProvider } from './TxActionProvider'
import { TxsInfiniteScroll } from './TxsInfiniteScroll'
import { TxLocationContext } from './TxLocationProvider'
const NoTransactions = style.div`
display: flex;
flex-direction: column;
margin-top: 60px;
`
export const QueueTransactions = (): ReactElement => {
const { count, isLoading, hasMore, next, transactions } = usePagedQueuedTransactions()
@ -35,7 +28,7 @@ export const QueueTransactions = (): ReactElement => {
return (
<NoTransactions>
<Img alt="No Transactions yet" src={NoTransactionsImage} />
<Title size="xs">Transactions will appear here </Title>
<Title size="xs">Queue transactions will appear here </Title>
</NoTransactions>
)
}

View File

@ -46,7 +46,6 @@ export const RejectTxModal = ({ isOpen, onClose, gwTransaction }: Props): React.
isOffChainSignature,
isCreation,
gasLimit,
gasEstimation,
gasPriceFormatted,
} = useEstimateTransactionGas({
txData: EMPTY_DATA,
@ -85,7 +84,7 @@ export const RejectTxModal = ({ isOpen, onClose, gwTransaction }: Props): React.
<EditableTxParameters
ethGasLimit={gasLimit}
ethGasPrice={gasPriceFormatted}
safeTxGas={gasEstimation.toString()}
safeTxGas={'0'}
safeNonce={nonce.toString()}
parametersStatus={getParametersStatus()}
>

View File

@ -503,3 +503,8 @@ export const AlignItemsWithMargin = styled.div`
margin-right: 6px;
}
`
export const NoTransactions = styled.div`
display: flex;
flex-direction: column;
margin-top: 60px;
`

View File

@ -1561,9 +1561,9 @@
solc "0.5.14"
truffle "^5.1.21"
"@gnosis.pm/safe-react-components@https://github.com/gnosis/safe-react-components.git#fb1a523":
"@gnosis.pm/safe-react-components@https://github.com/gnosis/safe-react-components.git#f610327":
version "0.5.0"
resolved "https://github.com/gnosis/safe-react-components.git#fb1a523ece12aa54e7e6a1169c7cd13da5bf5b61"
resolved "https://github.com/gnosis/safe-react-components.git#f610327c109810547513079196514b05cda63844"
dependencies:
classnames "^2.2.6"
react-media "^1.10.0"
@ -15713,7 +15713,7 @@ polished@^3.3.1:
resolved "https://registry.yarnpkg.com/polished/-/polished-3.6.7.tgz#44cbd0047f3187d83db0c479ef0c7d5583af5fb6"
integrity sha512-b4OViUOihwV0icb9PHmWbR+vPqaSzSAEbgLskvb7ANPATVXGiYv/TQFHQo65S53WU9i5EQ1I03YDOJW7K0bmYg==
dependencies:
"@babel/runtime" "^7.12.5"
"@babel/runtime" "^7.9.2"
popper.js@1.16.1-lts:
version "1.16.1-lts"