@lifi/widget 3.32.0 → 3.32.2
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/CHANGELOG.md +15 -0
- package/dist/esm/config/constants.d.ts +1 -1
- package/dist/esm/config/constants.js +1 -1
- package/dist/esm/config/constants.js.map +1 -1
- package/dist/esm/config/version.d.ts +1 -1
- package/dist/esm/config/version.js +1 -1
- package/dist/esm/hooks/useExplorer.js +2 -2
- package/dist/esm/hooks/useExplorer.js.map +1 -1
- package/dist/esm/hooks/useFilteredByTokenBalances.js +1 -0
- package/dist/esm/hooks/useFilteredByTokenBalances.js.map +1 -1
- package/dist/esm/i18n/bn.json +4 -2
- package/dist/esm/i18n/de.json +4 -2
- package/dist/esm/i18n/es.json +4 -2
- package/dist/esm/i18n/fr.json +4 -2
- package/dist/esm/i18n/hi.json +4 -2
- package/dist/esm/i18n/id.json +4 -2
- package/dist/esm/i18n/it.json +4 -2
- package/dist/esm/i18n/ja.json +4 -2
- package/dist/esm/i18n/ko.json +4 -2
- package/dist/esm/i18n/pl.json +4 -2
- package/dist/esm/i18n/pt.json +4 -2
- package/dist/esm/i18n/th.json +4 -2
- package/dist/esm/i18n/tr.json +4 -2
- package/dist/esm/i18n/uk.json +4 -2
- package/dist/esm/i18n/vi.json +4 -2
- package/dist/esm/i18n/zh.json +4 -2
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +14 -2
- package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.d.ts +2 -1
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js +3 -9
- package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
- package/dist/esm/types/widget.d.ts +2 -3
- package/dist/esm/utils/converters.js +5 -0
- package/dist/esm/utils/converters.js.map +1 -1
- package/dist/esm/utils/format.js +6 -1
- package/dist/esm/utils/format.js.map +1 -1
- package/package.json +4 -5
- package/package.json.tmp +3 -4
- package/src/config/constants.ts +1 -1
- package/src/config/version.ts +1 -1
- package/src/hooks/useExplorer.ts +2 -2
- package/src/hooks/useFilteredByTokenBalances.ts +1 -0
- package/src/i18n/bn.json +4 -2
- package/src/i18n/de.json +4 -2
- package/src/i18n/es.json +4 -2
- package/src/i18n/fr.json +4 -2
- package/src/i18n/hi.json +4 -2
- package/src/i18n/id.json +4 -2
- package/src/i18n/it.json +4 -2
- package/src/i18n/ja.json +4 -2
- package/src/i18n/ko.json +4 -2
- package/src/i18n/pl.json +4 -2
- package/src/i18n/pt.json +4 -2
- package/src/i18n/th.json +4 -2
- package/src/i18n/tr.json +4 -2
- package/src/i18n/uk.json +4 -2
- package/src/i18n/vi.json +4 -2
- package/src/i18n/zh.json +4 -2
- package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +25 -5
- package/src/pages/TransactionDetailsPage/TransferIdCard.tsx +8 -13
- package/src/types/widget.ts +2 -2
- package/src/utils/converters.ts +5 -0
- package/src/utils/format.ts +7 -1
|
@@ -5,28 +5,21 @@ import { useTranslation } from 'react-i18next'
|
|
|
5
5
|
import { Card } from '../../components/Card/Card.js'
|
|
6
6
|
import { CardIconButton } from '../../components/Card/CardIconButton.js'
|
|
7
7
|
import { CardTitle } from '../../components/Card/CardTitle.js'
|
|
8
|
-
import { useExplorer } from '../../hooks/useExplorer.js'
|
|
9
8
|
|
|
10
9
|
interface TransferIdCardProps {
|
|
11
10
|
transferId: string
|
|
11
|
+
txLink?: string
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
const
|
|
15
|
-
transferId.indexOf('_') !== -1
|
|
16
|
-
? transferId.substring(0, transferId.indexOf('_'))
|
|
17
|
-
: transferId
|
|
18
|
-
|
|
19
|
-
export const TransferIdCard = ({ transferId }: TransferIdCardProps) => {
|
|
14
|
+
export const TransferIdCard = ({ transferId, txLink }: TransferIdCardProps) => {
|
|
20
15
|
const { t } = useTranslation()
|
|
21
|
-
const { getTransactionLink } = useExplorer()
|
|
22
16
|
|
|
23
17
|
const copyTransferId = async () => {
|
|
24
18
|
await navigator.clipboard.writeText(transferId)
|
|
25
19
|
}
|
|
26
20
|
|
|
27
21
|
const openTransferIdInExplorer = () => {
|
|
28
|
-
|
|
29
|
-
window.open(getTransactionLink({ txHash }), '_blank')
|
|
22
|
+
window.open(txLink, '_blank')
|
|
30
23
|
}
|
|
31
24
|
|
|
32
25
|
return (
|
|
@@ -49,9 +42,11 @@ export const TransferIdCard = ({ transferId }: TransferIdCardProps) => {
|
|
|
49
42
|
<CardIconButton size="small" onClick={copyTransferId}>
|
|
50
43
|
<ContentCopyRounded fontSize="inherit" />
|
|
51
44
|
</CardIconButton>
|
|
52
|
-
|
|
53
|
-
<
|
|
54
|
-
|
|
45
|
+
{txLink ? (
|
|
46
|
+
<CardIconButton size="small" onClick={openTransferIdInExplorer}>
|
|
47
|
+
<OpenInNew fontSize="inherit" />
|
|
48
|
+
</CardIconButton>
|
|
49
|
+
) : null}
|
|
55
50
|
</Box>
|
|
56
51
|
</Box>
|
|
57
52
|
<Typography
|
package/src/types/widget.ts
CHANGED
|
@@ -21,12 +21,12 @@ import type {
|
|
|
21
21
|
Theme,
|
|
22
22
|
} from '@mui/material'
|
|
23
23
|
import type { TypographyVariantsOptions } from '@mui/material/styles'
|
|
24
|
-
import type { Config as PortoConfig } from 'porto/Porto'
|
|
25
24
|
import type { CSSProperties, FC, ReactNode, RefObject } from 'react'
|
|
26
25
|
import type {
|
|
27
26
|
BaseAccountParameters,
|
|
28
27
|
CoinbaseWalletParameters,
|
|
29
28
|
MetaMaskParameters,
|
|
29
|
+
PortoParameters,
|
|
30
30
|
WalletConnectParameters,
|
|
31
31
|
} from 'wagmi/connectors'
|
|
32
32
|
import type {
|
|
@@ -142,7 +142,7 @@ export interface WidgetWalletConfig {
|
|
|
142
142
|
coinbase?: CoinbaseWalletParameters
|
|
143
143
|
metaMask?: MetaMaskParameters
|
|
144
144
|
baseAccount?: BaseAccountParameters
|
|
145
|
-
porto?: Partial<
|
|
145
|
+
porto?: Partial<PortoParameters>
|
|
146
146
|
/**
|
|
147
147
|
* Determines whether the widget should provide partial wallet management functionality.
|
|
148
148
|
*
|
package/src/utils/converters.ts
CHANGED
|
@@ -30,6 +30,7 @@ const buildProcessFromTxHistory = (tx: FullStatusData): Process[] => {
|
|
|
30
30
|
startedAt: sending.timestamp ?? Date.now(),
|
|
31
31
|
message: '',
|
|
32
32
|
status: processStatus,
|
|
33
|
+
chainId: sending.chainId,
|
|
33
34
|
txHash: sending.txHash,
|
|
34
35
|
txLink: sending.txLink,
|
|
35
36
|
doneAt: receiving.timestamp ?? Date.now(),
|
|
@@ -45,6 +46,7 @@ const buildProcessFromTxHistory = (tx: FullStatusData): Process[] => {
|
|
|
45
46
|
startedAt: sending.timestamp ?? Date.now(),
|
|
46
47
|
message: '',
|
|
47
48
|
status: processStatus, // can be FAILED
|
|
49
|
+
chainId: sending.chainId,
|
|
48
50
|
txHash: sending.txHash,
|
|
49
51
|
txLink: sending.txLink,
|
|
50
52
|
doneAt: sending.timestamp,
|
|
@@ -57,6 +59,7 @@ const buildProcessFromTxHistory = (tx: FullStatusData): Process[] => {
|
|
|
57
59
|
substatus,
|
|
58
60
|
substatusMessage: '',
|
|
59
61
|
doneAt: receiving.timestamp ?? Date.now(),
|
|
62
|
+
chainId: receiving.chainId,
|
|
60
63
|
txHash: receiving.txHash,
|
|
61
64
|
txLink: receiving.txLink,
|
|
62
65
|
},
|
|
@@ -211,6 +214,8 @@ export const buildRouteFromTxHistory = (
|
|
|
211
214
|
fromAmount: sending.amount,
|
|
212
215
|
toAmount: receiving.amount,
|
|
213
216
|
toToken: receiving.token,
|
|
217
|
+
internalTxLink: tx.lifiExplorerLink,
|
|
218
|
+
externalTxLink: tx.bridgeExplorerLink,
|
|
214
219
|
gasCosts: [
|
|
215
220
|
{
|
|
216
221
|
amount: sending.gasAmount,
|
package/src/utils/format.ts
CHANGED
|
@@ -54,7 +54,11 @@ export function formatInputAmount(
|
|
|
54
54
|
return amount
|
|
55
55
|
}
|
|
56
56
|
let formattedAmount = amount.trim().replaceAll(',', '.')
|
|
57
|
-
if (
|
|
57
|
+
if (
|
|
58
|
+
returnInitial &&
|
|
59
|
+
formattedAmount.startsWith('.') &&
|
|
60
|
+
!Number.parseFloat(formattedAmount)
|
|
61
|
+
) {
|
|
58
62
|
formattedAmount = `0${formattedAmount}`
|
|
59
63
|
}
|
|
60
64
|
const parsedAmount = Number.parseFloat(formattedAmount)
|
|
@@ -66,6 +70,8 @@ export function formatInputAmount(
|
|
|
66
70
|
}
|
|
67
71
|
if (returnInitial) {
|
|
68
72
|
return formattedAmount
|
|
73
|
+
} else if (formattedAmount.startsWith('.')) {
|
|
74
|
+
formattedAmount = `0${formattedAmount}`
|
|
69
75
|
}
|
|
70
76
|
let [integer, fraction = ''] = formattedAmount.split('.')
|
|
71
77
|
if (decimals !== null && fraction.length > decimals) {
|