Compare commits

..

10 Commits

Author SHA1 Message Date
Jordan Frankfurt
fd964c5b74 feat(google-analytics): add tx hash to swap events (#3854) 2022-05-19 15:30:04 -05:00
Jordan Frankfurt
83b6eec271 fix(copy-icon): makes copy icon configurable for different uses (#3853) 2022-05-19 15:09:29 -05:00
Noah Zinsmeister
cd76fffbbe fix build warning 2022-05-17 10:53:48 -04:00
Noah Zinsmeister
2c0ac56296 Revert "fix build warning"
This reverts commit f836e3ca32.
2022-05-17 10:53:01 -04:00
Noah Zinsmeister
f836e3ca32 fix build warning 2022-05-17 10:48:29 -04:00
Crowdin Bot
1733fbb378 chore(i18n): synchronize translations from crowdin [skip ci] 2022-05-17 10:11:18 +00:00
Crowdin Bot
78142270a8 chore(i18n): synchronize translations from crowdin [skip ci] 2022-05-16 21:07:07 +00:00
dependabot[bot]
db4e2a9bee chore(deps-dev): bump @uniswap/default-token-list from 3.1.0 to 3.2.0 (#3755)
Bumps [@uniswap/default-token-list](https://github.com/Uniswap/default-token-list) from 3.1.0 to 3.2.0.
- [Release notes](https://github.com/Uniswap/default-token-list/releases)
- [Commits](https://github.com/Uniswap/default-token-list/compare/v3.1.0...v3.2.0)

---
updated-dependencies:
- dependency-name: "@uniswap/default-token-list"
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-05-16 17:00:10 -04:00
Michael Wei
9cee94a473 fix: ignore dbg.json files during typechain (#3751) 2022-05-16 16:55:37 -04:00
Noah Zinsmeister
db5a14387f perf: constrain log-fetching block ranges (#3846)
* first pass

* don't re-fetch historical logs

* hide cancelled proposals by default
2022-05-16 16:45:27 -04:00
47 changed files with 303 additions and 108 deletions

View File

@@ -143,7 +143,7 @@
},
"scripts": {
"contracts:compile:abi": "typechain --target ethers-v5 --out-dir src/abis/types \"./src/abis/**/*.json\"",
"contracts:compile:v3": "typechain --target ethers-v5 --out-dir src/types/v3 \"./node_modules/@uniswap/**/artifacts/contracts/**/*.json\"",
"contracts:compile:v3": "typechain --target ethers-v5 --out-dir src/types/v3 \"./node_modules/@uniswap/**/artifacts/contracts/**/*[!dbg].json\"",
"contracts:compile": "yarn contracts:compile:abi && yarn contracts:compile:v3",
"graphql:generate": "graphql-codegen --config codegen.yml",
"prei18n:extract": "touch src/locales/en-US.po",

View File

@@ -10,7 +10,6 @@ const CopyIcon = styled(LinkStyledButton)`
flex-shrink: 0;
display: flex;
text-decoration: none;
font-size: 12px;
:hover,
:active,
:focus {
@@ -18,20 +17,36 @@ const CopyIcon = styled(LinkStyledButton)`
color: ${({ color, theme }) => color || theme.text2};
}
`
const TransactionStatusText = styled.span`
const StyledText = styled.span`
margin-left: 0.25rem;
font-size: 12px;
${({ theme }) => theme.flexRowNoWrap};
align-items: center;
`
const Copied = ({ iconSize }: { iconSize?: number }) => (
<StyledText>
<CheckCircle size={iconSize ?? '16'} />
<StyledText>
<Trans>Copied</Trans>
</StyledText>
</StyledText>
)
const Icon = ({ iconSize }: { iconSize?: number }) => (
<StyledText>
<Copy size={iconSize ?? '16'} />
</StyledText>
)
interface BaseProps {
toCopy: string
color?: string
iconSize?: number
iconPosition?: 'left' | 'right'
}
export type CopyHelperProps = BaseProps & Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, keyof BaseProps>
export default function CopyHelper({ color, toCopy, children }: CopyHelperProps) {
export default function CopyHelper({ color, toCopy, children, iconSize, iconPosition }: CopyHelperProps) {
const [isCopied, setCopied] = useCopyClipboard()
const copy = useCallback(() => {
setCopied(toCopy)
@@ -39,20 +54,11 @@ export default function CopyHelper({ color, toCopy, children }: CopyHelperProps)
return (
<CopyIcon onClick={copy} color={color}>
{iconPosition === 'left' ? isCopied ? <Copied iconSize={iconSize} /> : <Icon iconSize={iconSize} /> : null}
{iconPosition === 'left' && <>&nbsp;</>}
{isCopied ? '' : children}
&nbsp;
{isCopied ? (
<TransactionStatusText>
<CheckCircle size={'12'} />
<TransactionStatusText>
<Trans>Copied</Trans>
</TransactionStatusText>
</TransactionStatusText>
) : (
<TransactionStatusText>
<Copy size={'12'} />
</TransactionStatusText>
)}
{iconPosition === 'right' && <>&nbsp;</>}
{iconPosition === 'right' ? isCopied ? <Copied iconSize={iconSize} /> : <Icon iconSize={iconSize} /> : null}
</CopyIcon>
)
}

View File

@@ -1,5 +1,6 @@
import { Trans } from '@lingui/macro'
import { Connector } from '@web3-react/types'
import CopyHelper from 'components/AccountDetails/Copy'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import { useCallback, useContext } from 'react'
import { ExternalLink as LinkIcon } from 'react-feather'
@@ -17,7 +18,6 @@ import { ExplorerDataType, getExplorerLink } from '../../utils/getExplorerLink'
import { ButtonSecondary } from '../Button'
import StatusIcon from '../Identicon/StatusIcon'
import { AutoRow } from '../Row'
import Copy from './Copy'
import Transaction from './Transaction'
const HeaderRow = styled.div`
@@ -310,11 +310,11 @@ export default function AccountDetails({
<AccountControl>
<div>
{account && (
<Copy toCopy={account}>
<CopyHelper toCopy={account} iconPosition="left">
<span style={{ marginLeft: '4px' }}>
<Trans>Copy Address</Trans>
</span>
</Copy>
</CopyHelper>
)}
{chainId && account && (
<AddressLink
@@ -336,11 +336,11 @@ export default function AccountDetails({
<AccountControl>
<div>
{account && (
<Copy toCopy={account}>
<CopyHelper toCopy={account} iconPosition="left">
<span style={{ marginLeft: '4px' }}>
<Trans>Copy Address</Trans>
</span>
</Copy>
</CopyHelper>
)}
{chainId && account && (
<AddressLink

View File

@@ -18,6 +18,9 @@ const WarningIcon = styled(AlertOctagon)`
min-width: 22px;
color: ${({ theme }) => theme.warning};
`
const Copy = styled(CopyHelper)`
font-size: 12px;
`
interface ConnectedAccountBlockedProps {
account: string | null | undefined
@@ -46,9 +49,9 @@ export default function ConnectedAccountBlocked(props: ConnectedAccountBlockedPr
<ThemedText.Main fontSize={12}>
<Trans>If you believe this is an error, please send an email including your address to </Trans>{' '}
</ThemedText.Main>
<CopyHelper toCopy="compliance@uniswap.org" color={theme.primary1}>
compliance@uniswap.org.
</CopyHelper>
<Copy iconSize={12} toCopy="compliance@uniswap.org" color={theme.primary1} iconPosition="right">
compliance@uniswap.org
</Copy>
</ContentWrapper>
</Modal>
)

View File

@@ -22,7 +22,7 @@ import { ApplicationModal } from '../../state/application/reducer'
import { ExternalLink, ThemedText } from '../../theme'
import { isMobile } from '../../utils/userAgent'
import AccountDetails from '../AccountDetails'
import Card, { LightCard } from '../Card'
import { LightCard } from '../Card'
import Modal from '../Modal'
import Option from './Option'
import PendingView from './PendingView'
@@ -109,16 +109,6 @@ const HoverText = styled.div`
}
`
const LinkCard = styled(Card)`
background-color: ${({ theme }) => theme.bg1};
color: ${({ theme }) => theme.text3};
:hover {
cursor: pointer;
filter: brightness(0.9);
}
`
const WALLET_VIEWS = {
OPTIONS: 'options',
OPTIONS_SECONDARY: 'options_secondary',

View File

@@ -1,6 +1,7 @@
import {
GOVERNANCE_ALPHA_V0_ADDRESSES,
GOVERNANCE_ALPHA_V1_ADDRESSES,
GOVERNANCE_BRAVO_ADDRESSES,
TIMELOCK_ADDRESS,
UNI_ADDRESS,
} from './addresses'
@@ -11,7 +12,8 @@ export const COMMON_CONTRACT_NAMES: Record<number, { [address: string]: string }
[UNI_ADDRESS[SupportedChainId.MAINNET]]: 'UNI',
[TIMELOCK_ADDRESS[SupportedChainId.MAINNET]]: 'Timelock',
[GOVERNANCE_ALPHA_V0_ADDRESSES[SupportedChainId.MAINNET]]: 'Governance (V0)',
[GOVERNANCE_ALPHA_V1_ADDRESSES[SupportedChainId.MAINNET]]: 'Governance',
[GOVERNANCE_ALPHA_V1_ADDRESSES[SupportedChainId.MAINNET]]: 'Governance (V1)',
[GOVERNANCE_BRAVO_ADDRESSES[SupportedChainId.MAINNET]]: 'Governance',
'0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e': 'ENS Registry',
'0x4976fb03C32e5B8cfe2b6cCB31c09Ba78EBaBa41': 'ENS Public Resolver',
},

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: af_ZA\n"
"Language-Team: Afrikaans\n"
@@ -1505,6 +1505,10 @@ msgstr "Deel van die swembad"
msgid "Share of Pool:"
msgstr "Aandeel van die poel:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Vertoning is gekanselleer"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Toon geslote posisies"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ar_SA\n"
"Language-Team: Arabic\n"
@@ -1505,6 +1505,10 @@ msgstr "حصة من المجموعة"
msgid "Share of Pool:"
msgstr "مشاركة المجموعة:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "إظهار الملغاة"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "إظهار المراكز المغلقة"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ca_ES\n"
"Language-Team: Catalan\n"
@@ -1505,6 +1505,10 @@ msgstr "Quota de grup"
msgid "Share of Pool:"
msgstr "Quota de grup:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Mostra cancel·lada"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Mostra posicions tancades"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: cs_CZ\n"
"Language-Team: Czech\n"
@@ -1505,6 +1505,10 @@ msgstr "Podíl na fondu"
msgid "Share of Pool:"
msgstr "Podíl na fondu:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Zobrazit zrušeno"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Zobrazit uzavřené pozice"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: da_DK\n"
"Language-Team: Danish\n"
@@ -1505,6 +1505,10 @@ msgstr "Andel i pulje"
msgid "Share of Pool:"
msgstr "Andel i pulje:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Show annulleret"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Vis lukkede positioner"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: de_DE\n"
"Language-Team: German\n"
@@ -1505,6 +1505,10 @@ msgstr "Anteil am Pool"
msgid "Share of Pool:"
msgstr "Anteil am Pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Show abgesagt"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Geschlossene Positionen anzeigen"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: el_GR\n"
"Language-Team: Greek\n"
@@ -1505,6 +1505,10 @@ msgstr "Μερίδιο από τη Δεξαμενή"
msgid "Share of Pool:"
msgstr "Μερίδιο από τη Δεξαμενή:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Εμφάνιση ακυρώθηκε"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Εμφάνιση κλειστών θέσεων"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: es_ES\n"
"Language-Team: Spanish\n"
@@ -1505,6 +1505,10 @@ msgstr "Participación del fondo común"
msgid "Share of Pool:"
msgstr "Participación del fondo común:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Mostrar cancelado"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Mostrar posiciones cerradas"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: fi_FI\n"
"Language-Team: Finnish\n"
@@ -1505,6 +1505,10 @@ msgstr "Poolin osuus"
msgid "Share of Pool:"
msgstr "Poolin osuus:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Esitys peruutettu"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Näytä suljetut sijainnit"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: fr_FR\n"
"Language-Team: French\n"
@@ -1505,6 +1505,10 @@ msgstr "Part du pool"
msgid "Share of Pool:"
msgstr "Part dans la pool :"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Afficher annulé"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Afficher les positions fermées"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: he_IL\n"
"Language-Team: Hebrew\n"
@@ -1505,6 +1505,10 @@ msgstr "נתח המאגר"
msgid "Share of Pool:"
msgstr "נתח המאגר:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "ההצגה בוטלה"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "הראה עמדות סגורות"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: hu_HU\n"
"Language-Team: Hungarian\n"
@@ -1506,6 +1506,10 @@ msgstr "Pool részesedése"
msgid "Share of Pool:"
msgstr "Pool részesedése:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Show Canceled"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Zárt pozíciók megjelenítése"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: id_ID\n"
"Language-Team: Indonesian\n"
@@ -1505,6 +1505,10 @@ msgstr "Bagian dari Pool"
msgid "Share of Pool:"
msgstr "Bagian dari Pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Tampilkan Dibatalkan"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Tampilkan posisi tertutup"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: it_IT\n"
"Language-Team: Italian\n"
@@ -1505,6 +1505,10 @@ msgstr "Quota del pool"
msgid "Share of Pool:"
msgstr "Quota del pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Mostra annullata"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Mostra posizioni chiuse"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ja_JP\n"
"Language-Team: Japanese\n"
@@ -1505,6 +1505,10 @@ msgstr "プールのシェア"
msgid "Share of Pool:"
msgstr "プールのシェア:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "キャンセルされた表示"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "決済したポジションを表示"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ko_KR\n"
"Language-Team: Korean\n"
@@ -1505,6 +1505,10 @@ msgstr "풀 쉐어"
msgid "Share of Pool:"
msgstr "풀 쉐어:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "취소된 표시"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "마감된 위치 표시"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: nl_NL\n"
"Language-Team: Dutch\n"
@@ -1505,6 +1505,10 @@ msgstr "Aandeel in pool"
msgid "Share of Pool:"
msgstr "Aandeel in pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Toon Geannuleerd"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Toon gesloten posities"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: no_NO\n"
"Language-Team: Norwegian\n"
@@ -1505,6 +1505,10 @@ msgstr "Andel av pott"
msgid "Share of Pool:"
msgstr "Deling av pott:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Vis avbrutt"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Vis lukkede stillinger"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: pl_PL\n"
"Language-Team: Polish\n"
@@ -1505,6 +1505,10 @@ msgstr "Udział puli"
msgid "Share of Pool:"
msgstr "Udział w puli:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Pokaż anulowane"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Pokaż zamknięte pozycje"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: pt_BR\n"
"Language-Team: Portuguese, Brazilian\n"
@@ -1505,6 +1505,10 @@ msgstr "Compartilhamento de Lotes"
msgid "Share of Pool:"
msgstr "Compartilhamento do Lote:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Mostrar cancelado"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Mostrar posições fechadas"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: pt_PT\n"
"Language-Team: Portuguese\n"
@@ -1505,6 +1505,10 @@ msgstr "Parcela da Pool"
msgid "Share of Pool:"
msgstr "Parcela da Pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Mostrar cancelado"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Mostrar posições fechadas"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ro_RO\n"
"Language-Team: Romanian\n"
@@ -1505,6 +1505,10 @@ msgstr "Cota de Grup"
msgid "Share of Pool:"
msgstr "Cota de Grup:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Show Anulat"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Afișați pozițiile închise"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: ru_RU\n"
"Language-Team: Russian\n"
@@ -1505,6 +1505,10 @@ msgstr "Доля в пуле"
msgid "Share of Pool:"
msgstr "Доля в пуле:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Показать отменено"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Показать закрытые позиции"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-17 10:11\n"
"Last-Translator: \n"
"Language: sl_SI\n"
"Language-Team: Slovenian\n"
@@ -1505,6 +1505,10 @@ msgstr "Delež v skladu"
msgid "Share of Pool:"
msgstr "Delež sklada:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Prikaz preklican"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Pokaži zaprte položaje"
@@ -1594,7 +1598,7 @@ msgstr "Izpolnite 10-minutno anketo in nam pomagajte izboljšati vašo izkušnjo
#: src/components/WalletModal/index.tsx
msgid "Tally"
msgstr "Tally"
msgstr "Povzetek"
#: src/components/Popups/SurveyPopup.tsx
msgid "Tell us what you think ↗"
@@ -1638,7 +1642,7 @@ msgstr "Aplikacija na varen način prebere naslov vaše denarnice in ga deli s T
#: src/components/WalletModal/PendingView.tsx
msgid "The connection attempt failed. Please click try again and follow the steps to connect in your wallet."
msgstr "Poskus povezave ni uspel. Kliknite Poskusi znova in sledite korakom za povezavo v denarnici."
msgstr "Poskus povezave ni uspel. Kliknite Poskusi znova in sledite navodilom za povezavo v svoji denarnici."
#: src/components/swap/SwapWarningDropdown.tsx
msgid "The cost of sending this transaction is more than half of the value of the input amount."

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: sr_SP\n"
"Language-Team: Serbian (Cyrillic)\n"
@@ -1505,6 +1505,10 @@ msgstr "Удео фонда"
msgid "Share of Pool:"
msgstr "Удео фонда:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Схов Цанцеллед"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Покажите затворене позиције"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: sv_SE\n"
"Language-Team: Swedish\n"
@@ -1505,6 +1505,10 @@ msgstr "Andel av poolen"
msgid "Share of Pool:"
msgstr "Andel av Pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Visa inställd"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Visa stängda positioner"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: sw_TZ\n"
"Language-Team: Swahili, Tanzania\n"
@@ -1505,6 +1505,10 @@ msgstr "Sehemu ya Dimbwi"
msgid "Share of Pool:"
msgstr "Shiriki la Dimbwi:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Onyesho Limeghairiwa"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Onyesha nafasi zilizofungwa"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: th_TH\n"
"Language-Team: Thai\n"
@@ -1505,6 +1505,10 @@ msgstr "ส่วนแบ่งของพูล"
msgid "Share of Pool:"
msgstr "ส่วนแบ่งของพูล:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "ยกเลิกการแสดง"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "แสดงตำแหน่งที่ปิด"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: tr_TR\n"
"Language-Team: Turkish\n"
@@ -1505,6 +1505,10 @@ msgstr "Havuz Payı"
msgid "Share of Pool:"
msgstr "Havuz Payı:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "İptal Edilenleri Göster"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Kapalı pozisyonları göster"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: uk_UA\n"
"Language-Team: Ukrainian\n"
@@ -1505,6 +1505,10 @@ msgstr "Частка пулу"
msgid "Share of Pool:"
msgstr "Частка пулу:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Показати скасовано"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Показати закриті позиції"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: vi_VN\n"
"Language-Team: Vietnamese\n"
@@ -1505,6 +1505,10 @@ msgstr "Chia sẻ của Pool"
msgid "Share of Pool:"
msgstr "Chia sẻ của Pool:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "Hiển thị Đã bị Hủy"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "Hiển thị các vị trí đã đóng"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: zh_CN\n"
"Language-Team: Chinese Simplified\n"
@@ -1505,6 +1505,10 @@ msgstr "流动池份额"
msgid "Share of Pool:"
msgstr "流动池份额:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "节目取消"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "显示已关闭的仓位"

View File

@@ -3,7 +3,7 @@ msgstr ""
"Project-Id-Version: uniswap-interface\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2022-05-13 23:06\n"
"PO-Revision-Date: 2022-05-16 21:06\n"
"Last-Translator: \n"
"Language: zh_TW\n"
"Language-Team: Chinese Traditional\n"
@@ -1505,6 +1505,10 @@ msgstr "流動池份額"
msgid "Share of Pool:"
msgstr "流動池份額:"
#: src/pages/Vote/Landing.tsx
msgid "Show Cancelled"
msgstr "節目取消"
#: src/pages/Pool/index.tsx
msgid "Show closed positions"
msgstr "顯示已關閉的倉位"

View File

@@ -286,6 +286,11 @@ export default function Swap({ history }: RouteComponentProps) {
swapCallback()
.then((hash) => {
setSwapState({ attemptingTxn: false, tradeToConfirm, showConfirm, swapErrorMessage: undefined, txHash: hash })
ReactGA.event({
category: 'Swap',
action: 'transaction hash',
label: hash,
})
ReactGA.event({
category: 'Swap',
action:

View File

@@ -7,16 +7,18 @@ import FormattedCurrencyAmount from 'components/FormattedCurrencyAmount'
import Loader from 'components/Loader'
import { AutoRow, RowBetween, RowFixed } from 'components/Row'
import { SwitchLocaleLink } from 'components/SwitchLocaleLink'
import Toggle from 'components/Toggle'
import DelegateModal from 'components/vote/DelegateModal'
import ProposalEmptyState from 'components/vote/ProposalEmptyState'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import JSBI from 'jsbi'
import { darken } from 'polished'
import { useState } from 'react'
import { Link } from 'react-router-dom'
import { Button } from 'rebass/styled-components'
import { useModalOpen, useToggleDelegateModal } from 'state/application/hooks'
import { ApplicationModal } from 'state/application/reducer'
import { ProposalData } from 'state/governance/hooks'
import { ProposalData, ProposalState } from 'state/governance/hooks'
import { useAllProposalData, useUserDelegatee, useUserVotes } from 'state/governance/hooks'
import { useTokenBalance } from 'state/wallet/hooks'
import styled from 'styled-components/macro'
@@ -107,6 +109,8 @@ const StyledExternalLink = styled(ExternalLink)`
export default function Landing() {
const { account, chainId } = useActiveWeb3React()
const [hideCancelled, setHideCancelled] = useState(true)
// toggle for showing delegation modal
const showDelegateModal = useModalOpen(ApplicationModal.DELEGATE)
const toggleDelegateModal = useToggleDelegateModal()
@@ -237,10 +241,24 @@ export default function Landing() {
)}
</RowBetween>
)}
{allProposals?.length === 0 && <ProposalEmptyState />}
{allProposals?.length > 0 && (
<AutoColumn gap="md">
<RowBetween>
<ThemedText.Main>
<Trans>Show Cancelled</Trans>
</ThemedText.Main>
<Toggle isActive={!hideCancelled} toggle={() => setHideCancelled((hideCancelled) => !hideCancelled)} />
</RowBetween>
</AutoColumn>
)}
{allProposals
?.slice(0)
?.reverse()
?.filter((p: ProposalData) => (hideCancelled ? p.status !== ProposalState.CANCELED : true))
?.map((p: ProposalData) => {
return (
<Proposal as={Link} to={`/vote/${p.governorIndex}/${p.id}`} key={`${p.governorIndex}${p.id}`}>
@@ -253,6 +271,7 @@ export default function Landing() {
)
})}
</TopSection>
<ThemedText.SubHeader color="text3">
<Trans>A minimum threshold of 0.25% of the total UNI supply is required to submit proposals</Trans>
</ThemedText.SubHeader>

View File

@@ -123,10 +123,20 @@ const FOUR_BYTES_DIR: { [sig: string]: string } = {
*/
function useFormattedProposalCreatedLogs(
contract: Contract | null,
indices: number[][]
indices: number[][],
fromBlock?: number,
toBlock?: number
): FormattedProposalLog[] | undefined {
// create filters for ProposalCreated events
const filter = useMemo(() => contract?.filters?.ProposalCreated(), [contract])
const filter = useMemo(() => {
const filter = contract?.filters?.ProposalCreated()
if (!filter) return undefined
return {
...filter,
fromBlock,
toBlock,
}
}, [contract, fromBlock, toBlock])
const useLogsResult = useLogs(filter)
@@ -244,9 +254,9 @@ export function useAllProposalData(): { data: ProposalData[]; loading: boolean }
const proposalStatesV2 = useSingleContractMultipleData(gov2, 'state', gov2ProposalIndexes)
// get metadata from past events
const formattedLogsV0 = useFormattedProposalCreatedLogs(gov0, gov0ProposalIndexes)
const formattedLogsV1 = useFormattedProposalCreatedLogs(gov1, gov1ProposalIndexes)
const formattedLogsV2 = useFormattedProposalCreatedLogs(gov2, gov2ProposalIndexes)
const formattedLogsV0 = useFormattedProposalCreatedLogs(gov0, gov0ProposalIndexes, 11042287, 12563484)
const formattedLogsV1 = useFormattedProposalCreatedLogs(gov1, gov1ProposalIndexes, 12686656, 13059343)
const formattedLogsV2 = useFormattedProposalCreatedLogs(gov2, gov2ProposalIndexes, 13538153)
const uni = useMemo(() => (chainId ? UNI[chainId] : undefined), [chainId])

View File

@@ -1,10 +1,11 @@
import { Filter } from '@ethersproject/providers'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useBlockNumber from 'lib/hooks/useBlockNumber'
import { useEffect, useMemo } from 'react'
import { useAppDispatch, useAppSelector } from '../hooks'
import { addListener, removeListener } from './slice'
import { EventFilter, filterToKey, Log } from './utils'
import { filterToKey, isHistoricalLog, Log } from './utils'
export enum LogsState {
// The filter is invalid
@@ -26,10 +27,10 @@ export interface UseLogsResult {
/**
* Returns the logs for the given filter as of the latest block, re-fetching from the library every block.
* @param filter The logs filter, without `blockHash`, `fromBlock` or `toBlock` defined.
* @param filter The logs filter, with `fromBlock` or `toBlock` optionally specified.
* The filter parameter should _always_ be memoized, or else will trigger constant refetching
*/
export function useLogs(filter: EventFilter | undefined): UseLogsResult {
export function useLogs(filter: Filter | undefined): UseLogsResult {
const { chainId } = useActiveWeb3React()
const blockNumber = useBlockNumber()
@@ -45,17 +46,16 @@ export function useLogs(filter: EventFilter | undefined): UseLogsResult {
}
}, [chainId, dispatch, filter])
const filterKey = useMemo(() => (filter ? filterToKey(filter) : undefined), [filter])
return useMemo(() => {
if (!chainId || !filterKey || !blockNumber)
if (!chainId || !filter || !blockNumber)
return {
logs: undefined,
state: LogsState.INVALID,
}
const state = logs[chainId]?.[filterKey]
const state = logs[chainId]?.[filterToKey(filter)]
const result = state?.results
if (!result) {
return {
state: LogsState.LOADING,
@@ -71,8 +71,13 @@ export function useLogs(filter: EventFilter | undefined): UseLogsResult {
}
return {
state: result.blockNumber >= blockNumber ? LogsState.SYNCED : LogsState.SYNCING,
// if we're only fetching logs until a block that has already elapsed, we're synced regardless of result.blockNumber
state: isHistoricalLog(filter, blockNumber)
? LogsState.SYNCED
: result.blockNumber >= blockNumber
? LogsState.SYNCED
: LogsState.SYNCING,
logs: result.logs,
}
}, [blockNumber, chainId, filterKey, logs])
}, [blockNumber, chainId, filter, logs])
}

View File

@@ -1,6 +1,7 @@
import { Filter } from '@ethersproject/providers'
import { createSlice, PayloadAction } from '@reduxjs/toolkit'
import { EventFilter, filterToKey, Log } from './utils'
import { filterToKey, Log } from './utils'
export interface LogsState {
[chainId: number]: {
@@ -26,7 +27,7 @@ const slice = createSlice({
name: 'logs',
initialState: {} as LogsState,
reducers: {
addListener(state, { payload: { chainId, filter } }: PayloadAction<{ chainId: number; filter: EventFilter }>) {
addListener(state, { payload: { chainId, filter } }: PayloadAction<{ chainId: number; filter: Filter }>) {
if (!state[chainId]) state[chainId] = {}
const key = filterToKey(filter)
if (!state[chainId][key])
@@ -39,7 +40,7 @@ const slice = createSlice({
state,
{
payload: { chainId, filters, blockNumber },
}: PayloadAction<{ chainId: number; filters: EventFilter[]; blockNumber: number }>
}: PayloadAction<{ chainId: number; filters: Filter[]; blockNumber: number }>
) {
if (!state[chainId]) return
for (const filter of filters) {
@@ -52,7 +53,7 @@ const slice = createSlice({
state,
{
payload: { chainId, filter, results },
}: PayloadAction<{ chainId: number; filter: EventFilter; results: { blockNumber: number; logs: Log[] } }>
}: PayloadAction<{ chainId: number; filter: Filter; results: { blockNumber: number; logs: Log[] } }>
) {
if (!state[chainId]) return
const key = filterToKey(filter)
@@ -64,7 +65,7 @@ const slice = createSlice({
state,
{
payload: { chainId, filter, blockNumber },
}: PayloadAction<{ chainId: number; blockNumber: number; filter: EventFilter }>
}: PayloadAction<{ chainId: number; blockNumber: number; filter: Filter }>
) {
if (!state[chainId]) return
const key = filterToKey(filter)
@@ -75,7 +76,7 @@ const slice = createSlice({
error: true,
}
},
removeListener(state, { payload: { chainId, filter } }: PayloadAction<{ chainId: number; filter: EventFilter }>) {
removeListener(state, { payload: { chainId, filter } }: PayloadAction<{ chainId: number; filter: Filter }>) {
if (!state[chainId]) return
const key = filterToKey(filter)
if (!state[chainId][key]) return

View File

@@ -1,10 +1,11 @@
import { Filter } from '@ethersproject/providers'
import useActiveWeb3React from 'hooks/useActiveWeb3React'
import useBlockNumber from 'lib/hooks/useBlockNumber'
import { useEffect, useMemo } from 'react'
import { useAppDispatch, useAppSelector } from '../hooks'
import { fetchedLogs, fetchedLogsError, fetchingLogs } from './slice'
import { EventFilter, keyToFilter } from './utils'
import { isHistoricalLog, keyToFilter } from './utils'
export default function Updater(): null {
const dispatch = useAppDispatch()
@@ -13,7 +14,7 @@ export default function Updater(): null {
const blockNumber = useBlockNumber()
const filtersNeedFetch: EventFilter[] = useMemo(() => {
const filtersNeedFetch: Filter[] = useMemo(() => {
if (!chainId || typeof blockNumber !== 'number') return []
const active = state[chainId]
@@ -25,6 +26,8 @@ export default function Updater(): null {
if (listeners === 0) return false
if (typeof fetchingBlockNumber === 'number' && fetchingBlockNumber >= blockNumber) return false
if (results && typeof results.blockNumber === 'number' && results.blockNumber >= blockNumber) return false
// this condition ensures that if a log is historical, and it's already fetched, we don't re-fetch it
if (isHistoricalLog(keyToFilter(key), blockNumber) && results?.logs !== undefined) return false
return true
})
.map((key) => keyToFilter(key))
@@ -35,11 +38,16 @@ export default function Updater(): null {
dispatch(fetchingLogs({ chainId, filters: filtersNeedFetch, blockNumber }))
filtersNeedFetch.forEach((filter) => {
// provide defaults if {from,to}Block are missing
let fromBlock = filter.fromBlock ?? 0
let toBlock = filter.toBlock ?? blockNumber
if (typeof fromBlock === 'string') fromBlock = Number.parseInt(fromBlock)
if (typeof toBlock === 'string') toBlock = Number.parseInt(toBlock)
library
.getLogs({
...filter,
fromBlock: 0,
toBlock: blockNumber,
fromBlock,
toBlock,
})
.then((logs) => {
dispatch(

View File

@@ -1,7 +1,4 @@
export interface EventFilter {
address?: string
topics?: Array<string | Array<string> | null>
}
import { Filter } from '@ethersproject/providers'
export interface Log {
topics: Array<string>
@@ -15,17 +12,17 @@ export interface Log {
* Converts a filter to the corresponding string key
* @param filter the filter to convert
*/
export function filterToKey(filter: EventFilter): string {
export function filterToKey(filter: Filter): string {
return `${filter.address ?? ''}:${
filter.topics?.map((topic) => (topic ? (Array.isArray(topic) ? topic.join(';') : topic) : '\0'))?.join('-') ?? ''
}`
}:${filter.fromBlock ?? ''}:${filter.toBlock ?? ''}`
}
/**
* Convert a filter key to the corresponding filter
* @param key key to convert
*/
export function keyToFilter(key: string): EventFilter {
export function keyToFilter(key: string): Filter {
const pcs = key.split(':')
const address = pcs[0]
const topics = pcs[1].split('-').map((topic) => {
@@ -34,9 +31,26 @@ export function keyToFilter(key: string): EventFilter {
if (parts.length === 1) return parts[0]
return parts
})
const fromBlock = pcs[2]
const toBlock = pcs[3]
return {
address: address.length === 0 ? undefined : address,
topics,
fromBlock: fromBlock.length === 0 ? undefined : fromBlock,
toBlock: toBlock.length === 0 ? undefined : toBlock,
}
}
/**
* Determines whether a filter is for a historical log that doesn't need to be re-fetched.
* @param filter The filter to check.
* @param blockNumber The current block number.
*/
export function isHistoricalLog(filter: Filter, blockNumber: number): boolean {
if (!filter.toBlock) return false
let toBlock = filter.toBlock
if (typeof toBlock === 'string') toBlock = Number.parseInt(toBlock)
return toBlock <= blockNumber
}

View File

@@ -4498,9 +4498,9 @@
integrity sha512-vFPWoGzDjHP4i2l7yLaober/lZMmzOZXXirVF8XNyfNzRxgmYCWKO6SzKtfEUwxpd3/KUebgdK55II4Mnak62A==
"@uniswap/default-token-list@^3.0.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-3.1.0.tgz#a54bda17ecbbc1c57dc2274d8dd9ddc9c87492d1"
integrity sha512-ih5qHKCJwCubqGBzvsfXRzh0CSWqRPCEscFxYenRh2kKs/NE7Q+jMW69dBWg03O8N8cNuoZYk0yJ7n6v+yE0oA==
version "3.2.0"
resolved "https://registry.yarnpkg.com/@uniswap/default-token-list/-/default-token-list-3.2.0.tgz#2a9c381dabf0062ef234cd4cca33aa156e5e3e45"
integrity sha512-3wqLMiNZT6WrvSwZL6KwnPKNH5/MAS0agvu/KgUbYs5a+eKURSfYpWLbAGA4yJPdqJLipQYXrQG2xdtXjn9WCA==
"@uniswap/governance@^1.0.2":
version "1.0.2"