@lifi/widget 4.9.0 → 4.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -10
- package/dist/esm/components/TokenList/TokenDetailsSheet.js +5 -8
- package/dist/esm/components/TokenList/TokenDetailsSheet.js.map +1 -1
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js +30 -2
- package/dist/esm/components/TokenList/TokenDetailsSheetContent.js.map +1 -1
- package/dist/esm/components/TokenList/TokenListItem.js +36 -47
- package/dist/esm/components/TokenList/TokenListItem.js.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.d.ts.map +1 -1
- package/dist/esm/components/TokenList/VirtualizedTokenList.js +2 -2
- package/dist/esm/components/TokenList/VirtualizedTokenList.js.map +1 -1
- package/dist/esm/components/TokenList/tokenVerificationIcons.js +29 -0
- package/dist/esm/components/TokenList/tokenVerificationIcons.js.map +1 -0
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/config/version.js.map +1 -1
- package/dist/esm/hooks/usePacedValue.js +1 -1
- package/dist/esm/hooks/usePacedValue.js.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.d.ts.map +1 -1
- package/dist/esm/hooks/useRouteExecutionMessage.js +4 -8
- package/dist/esm/hooks/useRouteExecutionMessage.js.map +1 -1
- package/dist/esm/i18n/bn.json +567 -266
- package/dist/esm/i18n/de.json +552 -251
- package/dist/esm/i18n/en.json +12 -62
- package/dist/esm/i18n/es.json +522 -221
- package/dist/esm/i18n/fr.json +541 -240
- package/dist/esm/i18n/hi.json +592 -291
- package/dist/esm/i18n/id.json +485 -184
- package/dist/esm/i18n/it.json +546 -245
- package/dist/esm/i18n/ja.json +512 -211
- package/dist/esm/i18n/ko.json +553 -252
- package/dist/esm/i18n/pl.json +598 -297
- package/dist/esm/i18n/pt.json +513 -212
- package/dist/esm/i18n/th.json +554 -253
- package/dist/esm/i18n/tr.json +538 -237
- package/dist/esm/i18n/uk.json +514 -213
- package/dist/esm/i18n/vi.json +550 -249
- package/dist/esm/i18n/zh.json +528 -227
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js +70 -18
- package/dist/esm/pages/TransactionPage/TransactionFailedButtons.js.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.d.ts +3 -0
- package/dist/esm/pages/TransactionPage/utils.d.ts.map +1 -1
- package/dist/esm/pages/TransactionPage/utils.js +27 -1
- package/dist/esm/pages/TransactionPage/utils.js.map +1 -1
- package/dist/esm/shared.d.ts +2 -2
- package/dist/esm/shared.js +2 -2
- package/dist/esm/stores/routes/utils.d.ts +1 -1
- package/dist/esm/stores/routes/utils.d.ts.map +1 -1
- package/dist/esm/stores/routes/utils.js +13 -1
- package/dist/esm/stores/routes/utils.js.map +1 -1
- package/dist/esm/utils/getErrorMessage.js +4 -0
- package/dist/esm/utils/getErrorMessage.js.map +1 -1
- package/dist/esm/utils/token.js +13 -1
- package/dist/esm/utils/token.js.map +1 -1
- package/package.json +4 -4
- package/src/components/TokenList/TokenDetailsSheet.tsx +5 -9
- package/src/components/TokenList/TokenDetailsSheetContent.tsx +46 -4
- package/src/components/TokenList/TokenListItem.tsx +44 -68
- package/src/components/TokenList/VirtualizedTokenList.tsx +3 -6
- package/src/components/TokenList/tokenVerificationIcons.ts +15 -0
- package/src/components/TokenList/types.ts +3 -11
- package/src/config/version.ts +1 -1
- package/src/hooks/usePacedValue.ts +1 -1
- package/src/hooks/useRouteExecutionMessage.ts +10 -13
- package/src/pages/TransactionPage/TransactionFailedButtons.test.tsx +497 -0
- package/src/pages/TransactionPage/TransactionFailedButtons.tsx +78 -9
- package/src/pages/TransactionPage/utils.ts +81 -0
- package/src/shared.ts +1 -0
- package/src/stores/routes/utils.ts +24 -1
- package/src/utils/getErrorMessage.ts +5 -0
- package/src/utils/token.ts +48 -0
|
@@ -8,6 +8,11 @@ import { useTranslation } from 'react-i18next'
|
|
|
8
8
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
9
9
|
import { useExplorer } from '../../hooks/useExplorer.js'
|
|
10
10
|
import { useToken } from '../../hooks/useToken.js'
|
|
11
|
+
import type { TokenAmount } from '../../types/token.js'
|
|
12
|
+
import {
|
|
13
|
+
getTokenStatusTextKey,
|
|
14
|
+
getTokenVerificationBadge,
|
|
15
|
+
} from '../../utils/token.js'
|
|
11
16
|
import { shortenAddress } from '../../utils/wallet.js'
|
|
12
17
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
13
18
|
import { CardIconButton } from '../Card/CardIconButton.js'
|
|
@@ -17,10 +22,10 @@ import {
|
|
|
17
22
|
TokenDetailsSheetContainer,
|
|
18
23
|
TokenDetailsSheetHeader,
|
|
19
24
|
} from './TokenDetailsSheetContent.style.js'
|
|
25
|
+
import { tokenVerificationIcons } from './tokenVerificationIcons.js'
|
|
20
26
|
|
|
21
27
|
interface TokenDetailsSheetContentProps {
|
|
22
|
-
|
|
23
|
-
chainId: number | undefined
|
|
28
|
+
listToken: TokenAmount | undefined
|
|
24
29
|
withoutContractAddress: boolean
|
|
25
30
|
onClose: () => void
|
|
26
31
|
}
|
|
@@ -28,8 +33,7 @@ interface TokenDetailsSheetContentProps {
|
|
|
28
33
|
const noDataLabel = '-'
|
|
29
34
|
|
|
30
35
|
export const TokenDetailsSheetContent = ({
|
|
31
|
-
|
|
32
|
-
chainId,
|
|
36
|
+
listToken,
|
|
33
37
|
withoutContractAddress,
|
|
34
38
|
onClose,
|
|
35
39
|
}: TokenDetailsSheetContentProps): JSX.Element => {
|
|
@@ -37,9 +41,22 @@ export const TokenDetailsSheetContent = ({
|
|
|
37
41
|
const { getAddressLink } = useExplorer()
|
|
38
42
|
const { getChainById } = useAvailableChains()
|
|
39
43
|
|
|
44
|
+
const tokenAddress = listToken?.address
|
|
45
|
+
const chainId = listToken?.chainId
|
|
40
46
|
const { token, isLoading } = useToken(chainId, tokenAddress, true)
|
|
41
47
|
const chain = useMemo(() => getChainById(chainId), [chainId, getChainById])
|
|
42
48
|
|
|
49
|
+
// The row token, not the fetched one: only the list sets the flags.
|
|
50
|
+
const statusBadge = listToken
|
|
51
|
+
? getTokenVerificationBadge(listToken)
|
|
52
|
+
: undefined
|
|
53
|
+
const statusIcon = statusBadge
|
|
54
|
+
? tokenVerificationIcons[statusBadge]
|
|
55
|
+
: undefined
|
|
56
|
+
const statusText = listToken
|
|
57
|
+
? t(getTokenStatusTextKey(listToken))
|
|
58
|
+
: noDataLabel
|
|
59
|
+
|
|
43
60
|
const copyContractAddress = async (e: React.MouseEvent) => {
|
|
44
61
|
e.stopPropagation()
|
|
45
62
|
try {
|
|
@@ -215,6 +232,31 @@ export const TokenDetailsSheetContent = ({
|
|
|
215
232
|
: noDataLabel}
|
|
216
233
|
</Typography>
|
|
217
234
|
</MetricWithSkeleton>
|
|
235
|
+
<MetricContainer>
|
|
236
|
+
<Label>{t('tokenMetric.status')}</Label>
|
|
237
|
+
<Box sx={{ display: 'flex', alignItems: 'flex-start', gap: 1 }}>
|
|
238
|
+
{statusIcon ? (
|
|
239
|
+
<statusIcon.Icon
|
|
240
|
+
sx={{
|
|
241
|
+
flexShrink: 0,
|
|
242
|
+
fontSize: 20,
|
|
243
|
+
color: statusIcon.color,
|
|
244
|
+
}}
|
|
245
|
+
/>
|
|
246
|
+
) : null}
|
|
247
|
+
<Typography
|
|
248
|
+
sx={{
|
|
249
|
+
minWidth: 0,
|
|
250
|
+
fontWeight: 500,
|
|
251
|
+
fontSize: '14px',
|
|
252
|
+
lineHeight: '20px',
|
|
253
|
+
color: 'text.primary',
|
|
254
|
+
}}
|
|
255
|
+
>
|
|
256
|
+
{statusText}
|
|
257
|
+
</Typography>
|
|
258
|
+
</Box>
|
|
259
|
+
</MetricContainer>
|
|
218
260
|
</TokenDetailsSheetContainer>
|
|
219
261
|
)
|
|
220
262
|
}
|
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import type { StaticToken } from '@lifi/sdk'
|
|
2
2
|
import { ChainType } from '@lifi/sdk'
|
|
3
3
|
import InfoOutlinedIcon from '@mui/icons-material/InfoOutlined'
|
|
4
|
-
import ReportRoundedIcon from '@mui/icons-material/ReportRounded'
|
|
5
|
-
import VerifiedIcon from '@mui/icons-material/Verified'
|
|
6
4
|
import {
|
|
7
5
|
Avatar,
|
|
8
6
|
Box,
|
|
@@ -18,14 +16,19 @@ import type { JSX, MouseEventHandler } from 'react'
|
|
|
18
16
|
import { memo, useMemo, useRef, useState } from 'react'
|
|
19
17
|
import { useTranslation } from 'react-i18next'
|
|
20
18
|
import { useLongPress } from '../../hooks/useLongPress.js'
|
|
19
|
+
import type { TokenAmount } from '../../types/token.js'
|
|
21
20
|
import { formatTokenAmount, formatTokenPrice } from '../../utils/format.js'
|
|
22
|
-
import {
|
|
21
|
+
import {
|
|
22
|
+
getTokenVerificationBadge,
|
|
23
|
+
getTokenVerificationProvider,
|
|
24
|
+
} from '../../utils/token.js'
|
|
23
25
|
import { shortenAddress } from '../../utils/wallet.js'
|
|
24
26
|
import { TokenAvatar } from '../Avatar/TokenAvatar.js'
|
|
25
27
|
import { ListItemButton } from '../ListItem/ListItemButton.js'
|
|
26
28
|
import { PinTokenButton } from './PinTokenButton.js'
|
|
27
29
|
import { RemoveRecentTokenButton } from './RemoveRecentTokenButton.js'
|
|
28
30
|
import { IconButton, ListItem } from './TokenList.style.js'
|
|
31
|
+
import { tokenVerificationIcons } from './tokenVerificationIcons.js'
|
|
29
32
|
import type {
|
|
30
33
|
TokenListItemAvatarProps,
|
|
31
34
|
TokenListItemButtonProps,
|
|
@@ -88,23 +91,17 @@ const TokenListItemAvatar = memo(({ token }: TokenListItemAvatarProps) => {
|
|
|
88
91
|
})
|
|
89
92
|
|
|
90
93
|
interface OpenTokenDetailsButtonProps {
|
|
91
|
-
|
|
94
|
+
token: TokenAmount
|
|
92
95
|
withoutContractAddress: boolean
|
|
93
|
-
|
|
94
|
-
onClick: (
|
|
95
|
-
tokenAddress: string,
|
|
96
|
-
withoutContractAddress: boolean,
|
|
97
|
-
chainId: number
|
|
98
|
-
) => void
|
|
96
|
+
onClick: (token: TokenAmount, withoutContractAddress: boolean) => void
|
|
99
97
|
}
|
|
100
98
|
|
|
101
99
|
const OpenTokenDetailsButton = ({
|
|
102
|
-
|
|
100
|
+
token,
|
|
103
101
|
withoutContractAddress,
|
|
104
|
-
chainId,
|
|
105
102
|
onClick,
|
|
106
103
|
}: OpenTokenDetailsButtonProps) => {
|
|
107
|
-
if (!
|
|
104
|
+
if (!token.address) {
|
|
108
105
|
return null
|
|
109
106
|
}
|
|
110
107
|
return (
|
|
@@ -113,7 +110,7 @@ const OpenTokenDetailsButton = ({
|
|
|
113
110
|
onClick={(e) => {
|
|
114
111
|
e.stopPropagation()
|
|
115
112
|
e.currentTarget.blur() // Remove focus to prevent accessibility issues when opening drawer
|
|
116
|
-
onClick(
|
|
113
|
+
onClick(token, withoutContractAddress)
|
|
117
114
|
}}
|
|
118
115
|
>
|
|
119
116
|
<InfoOutlinedIcon />
|
|
@@ -169,65 +166,46 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
169
166
|
)
|
|
170
167
|
|
|
171
168
|
const longPressEvents = useLongPress(() =>
|
|
172
|
-
onShowTokenDetails(token
|
|
169
|
+
onShowTokenDetails(token, withoutContractAddress)
|
|
173
170
|
)
|
|
174
171
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
let
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
verificationBadge = {
|
|
184
|
-
Icon: VerifiedIcon,
|
|
185
|
-
color: 'info.main',
|
|
186
|
-
title: chainName
|
|
172
|
+
const verificationBadge = getTokenVerificationBadge(token)
|
|
173
|
+
const verificationIcon = verificationBadge
|
|
174
|
+
? tokenVerificationIcons[verificationBadge]
|
|
175
|
+
: undefined
|
|
176
|
+
let verificationTitle = ''
|
|
177
|
+
switch (verificationBadge) {
|
|
178
|
+
case 'native':
|
|
179
|
+
verificationTitle = chainName
|
|
187
180
|
? t('tooltip.tokenNativeOnChain', {
|
|
188
181
|
tokenSymbol: token.symbol,
|
|
189
182
|
chainName,
|
|
190
183
|
})
|
|
191
|
-
: t('tooltip.tokenNative', { tokenSymbol: token.symbol })
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
Icon: ReportRoundedIcon,
|
|
196
|
-
color: 'error.main',
|
|
197
|
-
title: t('warning.message.tokenFlagged', {
|
|
184
|
+
: t('tooltip.tokenNative', { tokenSymbol: token.symbol })
|
|
185
|
+
break
|
|
186
|
+
case 'flagged':
|
|
187
|
+
verificationTitle = t('warning.message.tokenFlagged', {
|
|
198
188
|
tokenSymbol: token.symbol,
|
|
199
|
-
})
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Icon: VerifiedIcon,
|
|
205
|
-
color: 'success.main',
|
|
206
|
-
title: provider
|
|
189
|
+
})
|
|
190
|
+
break
|
|
191
|
+
case 'verified': {
|
|
192
|
+
const provider = getTokenVerificationProvider(token)
|
|
193
|
+
verificationTitle = provider
|
|
207
194
|
? t('tooltip.tokenVerifiedByProvider', {
|
|
208
195
|
tokenSymbol: token.symbol,
|
|
209
196
|
provider,
|
|
210
197
|
})
|
|
211
|
-
: t('tooltip.tokenVerified', { tokenSymbol: token.symbol })
|
|
198
|
+
: t('tooltip.tokenVerified', { tokenSymbol: token.symbol })
|
|
199
|
+
break
|
|
212
200
|
}
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
!token.listed &&
|
|
216
|
-
!token.verified
|
|
217
|
-
) {
|
|
218
|
-
verificationBadge = {
|
|
219
|
-
Icon: ReportRoundedIcon,
|
|
220
|
-
color: 'warning.main',
|
|
221
|
-
title: t('warning.message.tokenUnverifiedByProvider', {
|
|
201
|
+
case 'unverifiedByProvider':
|
|
202
|
+
verificationTitle = t('warning.message.tokenUnverifiedByProvider', {
|
|
222
203
|
tokenSymbol: token.symbol,
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
color: 'warning.main',
|
|
229
|
-
title: t('warning.message.tokenUnverified'),
|
|
230
|
-
}
|
|
204
|
+
})
|
|
205
|
+
break
|
|
206
|
+
case 'unverified':
|
|
207
|
+
verificationTitle = t('warning.message.tokenUnverified')
|
|
208
|
+
break
|
|
231
209
|
}
|
|
232
210
|
|
|
233
211
|
return (
|
|
@@ -261,13 +239,13 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
261
239
|
primary={
|
|
262
240
|
<Box sx={{ display: 'flex', alignItems: 'center', gap: 0.5 }}>
|
|
263
241
|
{token.symbol}
|
|
264
|
-
{
|
|
265
|
-
<Tooltip title={
|
|
266
|
-
<
|
|
242
|
+
{verificationIcon && (
|
|
243
|
+
<Tooltip title={verificationTitle} placement="top" arrow>
|
|
244
|
+
<verificationIcon.Icon
|
|
267
245
|
sx={{
|
|
268
246
|
display: 'flex',
|
|
269
247
|
fontSize: 16,
|
|
270
|
-
color:
|
|
248
|
+
color: verificationIcon.color,
|
|
271
249
|
cursor: 'help',
|
|
272
250
|
}}
|
|
273
251
|
/>
|
|
@@ -313,9 +291,8 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
313
291
|
>
|
|
314
292
|
<Box>
|
|
315
293
|
<OpenTokenDetailsButton
|
|
316
|
-
|
|
294
|
+
token={token}
|
|
317
295
|
withoutContractAddress={withoutContractAddress}
|
|
318
|
-
chainId={token.chainId}
|
|
319
296
|
onClick={onShowTokenDetails}
|
|
320
297
|
/>
|
|
321
298
|
<PinTokenButton
|
|
@@ -385,9 +362,8 @@ const TokenListItemButton: React.FC<TokenListItemButtonProps> = memo(
|
|
|
385
362
|
</Box>
|
|
386
363
|
<Box>
|
|
387
364
|
<OpenTokenDetailsButton
|
|
388
|
-
|
|
365
|
+
token={token}
|
|
389
366
|
withoutContractAddress={withoutContractAddress}
|
|
390
|
-
chainId={token.chainId}
|
|
391
367
|
onClick={onShowTokenDetails}
|
|
392
368
|
/>
|
|
393
369
|
<PinTokenButton
|
|
@@ -5,6 +5,7 @@ import { useCallback, useEffect, useMemo, useRef } from 'react'
|
|
|
5
5
|
import { useTranslation } from 'react-i18next'
|
|
6
6
|
import { useAvailableChains } from '../../hooks/useAvailableChains.js'
|
|
7
7
|
import { getTokenKey } from '../../stores/recentTokens/utils.js'
|
|
8
|
+
import type { TokenAmount } from '../../types/token.js'
|
|
8
9
|
import { isHoistableNative } from '../../utils/tokenList.js'
|
|
9
10
|
import { createBandResolver } from '../../utils/tokenListBands.js'
|
|
10
11
|
import { RecentTokensHeader } from './RecentTokensHeader.js'
|
|
@@ -53,12 +54,8 @@ export const VirtualizedTokenList: FC<VirtualizedTokenListProps> = ({
|
|
|
53
54
|
const tokenDetailsSheetRef = useRef<TokenDetailsSheetBase>(null)
|
|
54
55
|
|
|
55
56
|
const onShowTokenDetails = useCallback(
|
|
56
|
-
(
|
|
57
|
-
tokenDetailsSheetRef.current?.open(
|
|
58
|
-
tokenAddress,
|
|
59
|
-
noContractAddress,
|
|
60
|
-
chainId
|
|
61
|
-
)
|
|
57
|
+
(token: TokenAmount, noContractAddress: boolean) => {
|
|
58
|
+
tokenDetailsSheetRef.current?.open(token, noContractAddress)
|
|
62
59
|
},
|
|
63
60
|
[]
|
|
64
61
|
)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import ReportRoundedIcon from '@mui/icons-material/ReportRounded'
|
|
2
|
+
import VerifiedIcon from '@mui/icons-material/Verified'
|
|
3
|
+
import type { SvgIcon } from '@mui/material'
|
|
4
|
+
import type { TokenVerificationBadge } from '../../utils/token.js'
|
|
5
|
+
|
|
6
|
+
export const tokenVerificationIcons: Record<
|
|
7
|
+
TokenVerificationBadge,
|
|
8
|
+
{ Icon: typeof SvgIcon; color: string }
|
|
9
|
+
> = {
|
|
10
|
+
native: { Icon: VerifiedIcon, color: 'info.main' },
|
|
11
|
+
flagged: { Icon: ReportRoundedIcon, color: 'error.main' },
|
|
12
|
+
verified: { Icon: VerifiedIcon, color: 'success.main' },
|
|
13
|
+
unverifiedByProvider: { Icon: ReportRoundedIcon, color: 'warning.main' },
|
|
14
|
+
unverified: { Icon: ReportRoundedIcon, color: 'warning.main' },
|
|
15
|
+
}
|
|
@@ -38,11 +38,7 @@ interface TokenListItemBaseProps {
|
|
|
38
38
|
|
|
39
39
|
export interface TokenListItemProps extends TokenListItemBaseProps {
|
|
40
40
|
token: TokenAmount
|
|
41
|
-
onShowTokenDetails: (
|
|
42
|
-
tokenAddress: string,
|
|
43
|
-
noContractAddress: boolean,
|
|
44
|
-
chainId: number
|
|
45
|
-
) => void
|
|
41
|
+
onShowTokenDetails: (token: TokenAmount, noContractAddress: boolean) => void
|
|
46
42
|
chain?: ExtendedChain
|
|
47
43
|
/** Resolved for every row, unlike `chain`, which the list passes only in all-networks mode. */
|
|
48
44
|
chainName?: string
|
|
@@ -53,11 +49,7 @@ export interface TokenListItemProps extends TokenListItemBaseProps {
|
|
|
53
49
|
}
|
|
54
50
|
|
|
55
51
|
export interface TokenListItemButtonProps {
|
|
56
|
-
onShowTokenDetails: (
|
|
57
|
-
tokenAddress: string,
|
|
58
|
-
noContractAddress: boolean,
|
|
59
|
-
chainId: number
|
|
60
|
-
) => void
|
|
52
|
+
onShowTokenDetails: (token: TokenAmount, noContractAddress: boolean) => void
|
|
61
53
|
onClick?(tokenAddress: string, chainId?: number): void
|
|
62
54
|
token: TokenAmount
|
|
63
55
|
chain?: ExtendedChain
|
|
@@ -73,6 +65,6 @@ export interface TokenListItemAvatarProps {
|
|
|
73
65
|
|
|
74
66
|
export interface TokenDetailsSheetBase {
|
|
75
67
|
isOpen(): void
|
|
76
|
-
open(
|
|
68
|
+
open(token: TokenAmount, noContractAddress: boolean): void
|
|
77
69
|
close(): void
|
|
78
70
|
}
|
package/src/config/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export const name = '@lifi/widget'
|
|
2
|
-
export const version = '4.
|
|
2
|
+
export const version = '4.10.1'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useEffect, useRef, useState } from 'react'
|
|
2
2
|
|
|
3
3
|
/** Smallest gap between UI updates, in milliseconds. */
|
|
4
|
-
const DISPLAY_INTERVAL = 1200
|
|
4
|
+
export const DISPLAY_INTERVAL = 1200
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Returns `live`, but changes it at most once every {@link DISPLAY_INTERVAL}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RouteExtended } from '@lifi/sdk'
|
|
2
2
|
import { useTranslation } from 'react-i18next'
|
|
3
3
|
import { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'
|
|
4
4
|
import { RouteExecutionStatus } from '../stores/routes/types.js'
|
|
5
|
+
import { getFailedStepAction } from '../stores/routes/utils.js'
|
|
5
6
|
import { getActionMessage } from '../utils/getActionMessage.js'
|
|
6
7
|
import { getErrorMessage } from '../utils/getErrorMessage.js'
|
|
7
8
|
import { useAvailableChains } from './useAvailableChains.js'
|
|
@@ -76,20 +77,16 @@ export const useRouteExecutionMessage = (
|
|
|
76
77
|
break
|
|
77
78
|
}
|
|
78
79
|
case RouteExecutionStatus.Failed: {
|
|
79
|
-
const
|
|
80
|
-
|
|
81
|
-
)
|
|
82
|
-
if (!step) {
|
|
80
|
+
const failed = getFailedStepAction(route)
|
|
81
|
+
if (!failed) {
|
|
83
82
|
break
|
|
84
83
|
}
|
|
85
|
-
const
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} // synthetic action to represent a failed execution with no actions
|
|
92
|
-
const actionMessage = getErrorMessage(t, getChainById, step, action)
|
|
84
|
+
const actionMessage = getErrorMessage(
|
|
85
|
+
t,
|
|
86
|
+
getChainById,
|
|
87
|
+
failed.step,
|
|
88
|
+
failed.action
|
|
89
|
+
)
|
|
93
90
|
title = actionMessage.title
|
|
94
91
|
message = actionMessage.message
|
|
95
92
|
break
|