@lifi/widget 4.7.0 → 4.8.0

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.
Files changed (144) hide show
  1. package/dist/esm/components/AmountInput/AmountInput.style.d.ts.map +1 -1
  2. package/dist/esm/components/Card/Card.d.ts.map +1 -1
  3. package/dist/esm/components/Card/CardIconButton.d.ts.map +1 -1
  4. package/dist/esm/components/ContractComponent/ItemPrice.d.ts.map +1 -1
  5. package/dist/esm/components/ListItem/ListItemButton.d.ts.map +1 -1
  6. package/dist/esm/components/ListItemButton.d.ts.map +1 -1
  7. package/dist/esm/components/Token/Token.d.ts.map +1 -1
  8. package/dist/esm/components/TokenList/types.d.ts.map +1 -1
  9. package/dist/esm/config/version.d.ts +1 -1
  10. package/dist/esm/config/version.js +1 -1
  11. package/dist/esm/config/version.js.map +1 -1
  12. package/dist/esm/hooks/useAvailableChains.d.ts.map +1 -1
  13. package/dist/esm/hooks/useAvailableChains.js +21 -38
  14. package/dist/esm/hooks/useAvailableChains.js.map +1 -1
  15. package/dist/esm/hooks/useExplorer.d.ts +1 -1
  16. package/dist/esm/hooks/useExplorer.d.ts.map +1 -1
  17. package/dist/esm/hooks/useExplorer.js +7 -3
  18. package/dist/esm/hooks/useExplorer.js.map +1 -1
  19. package/dist/esm/hooks/useFromTokenSufficiency.js +3 -3
  20. package/dist/esm/hooks/useFromTokenSufficiency.js.map +1 -1
  21. package/dist/esm/hooks/useGasRecommendation.js +3 -3
  22. package/dist/esm/hooks/useGasRecommendation.js.map +1 -1
  23. package/dist/esm/hooks/useGasSufficiency.js +3 -3
  24. package/dist/esm/hooks/useGasSufficiency.js.map +1 -1
  25. package/dist/esm/hooks/useIsBatchingSupported.js +2 -2
  26. package/dist/esm/hooks/useIsBatchingSupported.js.map +1 -1
  27. package/dist/esm/hooks/useRouteExecution.js +6 -6
  28. package/dist/esm/hooks/useRouteExecution.js.map +1 -1
  29. package/dist/esm/hooks/useRoutes.js +7 -7
  30. package/dist/esm/hooks/useRoutes.js.map +1 -1
  31. package/dist/esm/hooks/useTokenBalance.js +4 -4
  32. package/dist/esm/hooks/useTokenBalance.js.map +1 -1
  33. package/dist/esm/hooks/useTokenBalancesQueries.js +3 -3
  34. package/dist/esm/hooks/useTokenBalancesQueries.js.map +1 -1
  35. package/dist/esm/hooks/useTokenSearch.js +3 -3
  36. package/dist/esm/hooks/useTokenSearch.js.map +1 -1
  37. package/dist/esm/hooks/useTokens.js +14 -14
  38. package/dist/esm/hooks/useTokens.js.map +1 -1
  39. package/dist/esm/hooks/useTools.d.ts.map +1 -1
  40. package/dist/esm/hooks/useTools.js +26 -27
  41. package/dist/esm/hooks/useTools.js.map +1 -1
  42. package/dist/esm/hooks/useTransactionDetails.js +2 -2
  43. package/dist/esm/hooks/useTransactionDetails.js.map +1 -1
  44. package/dist/esm/hooks/useTransactionHistory.js +3 -3
  45. package/dist/esm/hooks/useTransactionHistory.js.map +1 -1
  46. package/dist/esm/index.d.ts +5 -1
  47. package/dist/esm/index.js +3 -1
  48. package/dist/esm/pages/RoutesPage/RoutesPage.style.d.ts.map +1 -1
  49. package/dist/esm/pages/SendToWallet/BookmarksPage.js +2 -1
  50. package/dist/esm/pages/SendToWallet/BookmarksPage.js.map +1 -1
  51. package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js +2 -1
  52. package/dist/esm/pages/SendToWallet/ConnectedWalletsPage.js.map +1 -1
  53. package/dist/esm/pages/SendToWallet/RecentWalletsPage.js +2 -1
  54. package/dist/esm/pages/SendToWallet/RecentWalletsPage.js.map +1 -1
  55. package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js +2 -1
  56. package/dist/esm/pages/SendToWallet/SendToConfiguredWalletPage.js.map +1 -1
  57. package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js +2 -1
  58. package/dist/esm/pages/TransactionDetailsPage/TransactionDetailsPage.js.map +1 -1
  59. package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js +2 -1
  60. package/dist/esm/pages/TransactionDetailsPage/TransferIdCard.js.map +1 -1
  61. package/dist/esm/providers/I18nProvider/types.d.ts.map +1 -1
  62. package/dist/esm/providers/WidgetProvider/WidgetProvider.d.ts.map +1 -1
  63. package/dist/esm/providers/WidgetProvider/WidgetProvider.js +9 -1
  64. package/dist/esm/providers/WidgetProvider/WidgetProvider.js.map +1 -1
  65. package/dist/esm/providers/WidgetProvider/types.d.ts +2 -0
  66. package/dist/esm/providers/WidgetProvider/types.d.ts.map +1 -1
  67. package/dist/esm/queries/getChains.d.ts +38 -0
  68. package/dist/esm/queries/getChains.d.ts.map +1 -0
  69. package/dist/esm/queries/getChains.js +51 -0
  70. package/dist/esm/queries/getChains.js.map +1 -0
  71. package/dist/esm/queries/getTools.d.ts +26 -0
  72. package/dist/esm/queries/getTools.d.ts.map +1 -0
  73. package/dist/esm/queries/getTools.js +30 -0
  74. package/dist/esm/queries/getTools.js.map +1 -0
  75. package/dist/esm/queries/index.d.ts +4 -0
  76. package/dist/esm/queries/index.js +3 -0
  77. package/dist/esm/queries/types.d.ts +25 -0
  78. package/dist/esm/queries/types.d.ts.map +1 -0
  79. package/dist/esm/shared.d.ts +3 -1
  80. package/dist/esm/shared.js +3 -1
  81. package/dist/esm/stores/StoreProvider.d.ts.map +1 -1
  82. package/dist/esm/stores/StoreProvider.js +16 -17
  83. package/dist/esm/stores/StoreProvider.js.map +1 -1
  84. package/dist/esm/stores/header/useHeaderStore.d.ts +1 -1
  85. package/dist/esm/stores/header/useHeaderStore.d.ts.map +1 -1
  86. package/dist/esm/stores/header/useHeaderStore.js.map +1 -1
  87. package/dist/esm/themes/createTheme.d.ts.map +1 -1
  88. package/dist/esm/types/events.d.ts.map +1 -1
  89. package/dist/esm/types/token.d.ts.map +1 -1
  90. package/dist/esm/types/widget.d.ts +30 -0
  91. package/dist/esm/types/widget.d.ts.map +1 -1
  92. package/dist/esm/types/widget.js.map +1 -1
  93. package/dist/esm/utils/queries.js.map +1 -1
  94. package/dist/esm/utils/scopeKeys.d.ts +6 -0
  95. package/dist/esm/utils/scopeKeys.d.ts.map +1 -0
  96. package/dist/esm/utils/scopeKeys.js +8 -0
  97. package/dist/esm/utils/scopeKeys.js.map +1 -0
  98. package/dist/esm/utils/url.d.ts +5 -0
  99. package/dist/esm/utils/url.d.ts.map +1 -0
  100. package/dist/esm/utils/url.js +17 -0
  101. package/dist/esm/utils/url.js.map +1 -0
  102. package/package.json +12 -4
  103. package/src/config/version.ts +1 -1
  104. package/src/hooks/useAvailableChains.test.tsx +170 -0
  105. package/src/hooks/useAvailableChains.ts +29 -47
  106. package/src/hooks/useExplorer.test.tsx +106 -0
  107. package/src/hooks/useExplorer.ts +11 -5
  108. package/src/hooks/useFromTokenSufficiency.ts +2 -2
  109. package/src/hooks/useGasRecommendation.ts +2 -2
  110. package/src/hooks/useGasSufficiency.ts +2 -2
  111. package/src/hooks/useIsBatchingSupported.ts +2 -2
  112. package/src/hooks/useRouteExecution.ts +5 -5
  113. package/src/hooks/useRoutes.ts +6 -6
  114. package/src/hooks/useTokenBalance.ts +4 -4
  115. package/src/hooks/useTokenBalancesQueries.ts +3 -3
  116. package/src/hooks/useTokenSearch.ts +7 -3
  117. package/src/hooks/useTokens.ts +13 -14
  118. package/src/hooks/useTools.sharedEntry.test.tsx +155 -0
  119. package/src/hooks/useTools.ts +42 -37
  120. package/src/hooks/useTransactionDetails.ts +3 -3
  121. package/src/hooks/useTransactionHistory.ts +2 -2
  122. package/src/index.ts +2 -1
  123. package/src/pages/SendToWallet/BookmarksPage.tsx +3 -3
  124. package/src/pages/SendToWallet/ConnectedWalletsPage.tsx +3 -3
  125. package/src/pages/SendToWallet/RecentWalletsPage.tsx +3 -3
  126. package/src/pages/SendToWallet/SendToConfiguredWalletPage.tsx +3 -3
  127. package/src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx +5 -5
  128. package/src/pages/TransactionDetailsPage/TransferIdCard.tsx +2 -1
  129. package/src/providers/WidgetProvider/WidgetProvider.test.tsx +73 -0
  130. package/src/providers/WidgetProvider/WidgetProvider.tsx +13 -0
  131. package/src/providers/WidgetProvider/types.ts +2 -0
  132. package/src/queries/getChains.ts +93 -0
  133. package/src/queries/getTools.ts +62 -0
  134. package/src/queries/index.ts +30 -0
  135. package/src/queries/sharedCache.test.tsx +223 -0
  136. package/src/queries/types.ts +38 -0
  137. package/src/shared.ts +2 -0
  138. package/src/stores/StoreProvider.test.tsx +107 -0
  139. package/src/stores/StoreProvider.tsx +8 -6
  140. package/src/stores/header/useHeaderStore.tsx +3 -4
  141. package/src/types/widget.ts +30 -0
  142. package/src/utils/queries.ts +1 -0
  143. package/src/utils/scopeKeys.ts +18 -0
  144. package/src/utils/url.ts +17 -0
@@ -1 +1 @@
1
- {"version":3,"file":"useTransactionDetails.js","names":[],"sources":["../../../src/hooks/useTransactionDetails.ts"],"sourcesContent":["import type { FullStatusData } from '@lifi/sdk'\nimport { getStatus, type StatusResponse } from '@lifi/sdk'\nimport { useAccount } from '@lifi/wallet-management'\nimport {\n keepPreviousData,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { useSDKClient } from '../providers/SDKClientProvider.js'\nimport { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'\nimport { getQueryKey } from '../utils/queries.js'\n\nexport const useTransactionDetails = (\n transactionHash?: string\n): {\n transaction: StatusResponse | undefined\n isLoading: boolean\n} => {\n const { account, accounts } = useAccount()\n const queryClient = useQueryClient()\n const { keyPrefix } = useWidgetConfig()\n const sdkClient = useSDKClient()\n\n const transactionHistoryQueryKey = useMemo(\n () => getQueryKey('transaction-history', keyPrefix),\n [keyPrefix]\n )\n\n const { data, isLoading } = useQuery({\n queryKey: [transactionHistoryQueryKey, transactionHash],\n queryFn: async ({ queryKey: [, transactionHash], signal }) => {\n if (transactionHash) {\n for (const account of accounts) {\n const cachedHistory = queryClient.getQueryData<StatusResponse[]>([\n transactionHistoryQueryKey,\n account.address,\n ])\n\n const transaction = cachedHistory?.find(\n (t) => t.sending.txHash === transactionHash\n )\n\n if (transaction) {\n return transaction\n }\n }\n\n const transaction = await getStatus(\n sdkClient,\n {\n txHash: transactionHash,\n },\n { signal }\n )\n\n const fromAddress = (transaction as FullStatusData)?.fromAddress\n\n if (fromAddress) {\n queryClient.setQueryData<StatusResponse[]>(\n [transactionHistoryQueryKey, fromAddress],\n (data) => (data ? [...data, transaction!] : [transaction!])\n )\n }\n\n return transaction\n }\n },\n refetchInterval: 300_000,\n enabled: account.isConnected && Boolean(transactionHash),\n initialData: () => {\n for (const account of accounts) {\n const transaction = queryClient\n .getQueryData<StatusResponse[]>([\n transactionHistoryQueryKey,\n account.address,\n ])\n ?.find((t) => t.sending.txHash === transactionHash)\n if (transaction) {\n return transaction\n }\n }\n },\n placeholderData: keepPreviousData,\n })\n\n return {\n transaction: data,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;AAaA,MAAa,yBACX,oBAIG;CACH,MAAM,EAAE,SAAS,aAAa,WAAW;CACzC,MAAM,cAAc,eAAe;CACnC,MAAM,EAAE,cAAc,gBAAgB;CACtC,MAAM,YAAY,aAAa;CAE/B,MAAM,6BAA6B,cAC3B,YAAY,uBAAuB,SAAS,GAClD,CAAC,SAAS,CACZ;CAEA,MAAM,EAAE,MAAM,cAAc,SAAS;EACnC,UAAU,CAAC,4BAA4B,eAAe;EACtD,SAAS,OAAO,EAAE,UAAU,GAAG,kBAAkB,aAAa;GAC5D,IAAI,iBAAiB;IACnB,KAAK,MAAM,WAAW,UAAU;KAM9B,MAAM,cALgB,YAAY,aAA+B,CAC/D,4BACA,QAAQ,OACV,CAEgC,CAAC,EAAE,MAChC,MAAM,EAAE,QAAQ,WAAW,eAC9B;KAEA,IAAI,aACF,OAAO;IAEX;IAEA,MAAM,cAAc,MAAM,UACxB,WACA,EACE,QAAQ,gBACV,GACA,EAAE,OAAO,CACX;IAEA,MAAM,cAAe,aAAgC;IAErD,IAAI,aACF,YAAY,aACV,CAAC,4BAA4B,WAAW,IACvC,SAAU,OAAO,CAAC,GAAG,MAAM,WAAY,IAAI,CAAC,WAAY,CAC3D;IAGF,OAAO;GACT;EACF;EACA,iBAAiB;EACjB,SAAS,QAAQ,eAAe,QAAQ,eAAe;EACvD,mBAAmB;GACjB,KAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,cAAc,YACjB,aAA+B,CAC9B,4BACA,QAAQ,OACV,CAAC,CAAC,EACA,MAAM,MAAM,EAAE,QAAQ,WAAW,eAAe;IACpD,IAAI,aACF,OAAO;GAEX;EACF;EACA,iBAAiB;CACnB,CAAC;CAED,OAAO;EACL,aAAa;EACb;CACF;AACF"}
1
+ {"version":3,"file":"useTransactionDetails.js","names":[],"sources":["../../../src/hooks/useTransactionDetails.ts"],"sourcesContent":["import type { FullStatusData } from '@lifi/sdk'\nimport { getStatus, type StatusResponse } from '@lifi/sdk'\nimport { useAccount } from '@lifi/wallet-management'\nimport {\n keepPreviousData,\n useQuery,\n useQueryClient,\n} from '@tanstack/react-query'\nimport { useMemo } from 'react'\nimport { useSDKClient } from '../providers/SDKClientProvider.js'\nimport { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'\nimport { getQueryKey } from '../utils/queries.js'\n\nexport const useTransactionDetails = (\n transactionHash?: string\n): {\n transaction: StatusResponse | undefined\n isLoading: boolean\n} => {\n const { account, accounts } = useAccount()\n const queryClient = useQueryClient()\n const { storageScopeKey } = useWidgetConfig()\n const sdkClient = useSDKClient()\n\n const transactionHistoryQueryKey = useMemo(\n () => getQueryKey('transaction-history', storageScopeKey),\n [storageScopeKey]\n )\n\n const { data, isLoading } = useQuery({\n queryKey: [transactionHistoryQueryKey, transactionHash],\n queryFn: async ({ queryKey: [, transactionHash], signal }) => {\n if (transactionHash) {\n for (const account of accounts) {\n const cachedHistory = queryClient.getQueryData<StatusResponse[]>([\n transactionHistoryQueryKey,\n account.address,\n ])\n\n const transaction = cachedHistory?.find(\n (t) => t.sending.txHash === transactionHash\n )\n\n if (transaction) {\n return transaction\n }\n }\n\n const transaction = await getStatus(\n sdkClient,\n {\n txHash: transactionHash,\n },\n { signal }\n )\n\n const fromAddress = (transaction as FullStatusData)?.fromAddress\n\n if (fromAddress) {\n queryClient.setQueryData<StatusResponse[]>(\n [transactionHistoryQueryKey, fromAddress],\n (data) => (data ? [...data, transaction!] : [transaction!])\n )\n }\n\n return transaction\n }\n },\n refetchInterval: 300_000,\n enabled: account.isConnected && Boolean(transactionHash),\n initialData: () => {\n for (const account of accounts) {\n const transaction = queryClient\n .getQueryData<StatusResponse[]>([\n transactionHistoryQueryKey,\n account.address,\n ])\n ?.find((t) => t.sending.txHash === transactionHash)\n if (transaction) {\n return transaction\n }\n }\n },\n placeholderData: keepPreviousData,\n })\n\n return {\n transaction: data,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;AAaA,MAAa,yBACX,oBAIG;CACH,MAAM,EAAE,SAAS,aAAa,WAAW;CACzC,MAAM,cAAc,eAAe;CACnC,MAAM,EAAE,oBAAoB,gBAAgB;CAC5C,MAAM,YAAY,aAAa;CAE/B,MAAM,6BAA6B,cAC3B,YAAY,uBAAuB,eAAe,GACxD,CAAC,eAAe,CAClB;CAEA,MAAM,EAAE,MAAM,cAAc,SAAS;EACnC,UAAU,CAAC,4BAA4B,eAAe;EACtD,SAAS,OAAO,EAAE,UAAU,GAAG,kBAAkB,aAAa;GAC5D,IAAI,iBAAiB;IACnB,KAAK,MAAM,WAAW,UAAU;KAM9B,MAAM,cALgB,YAAY,aAA+B,CAC/D,4BACA,QAAQ,OACV,CAEgC,CAAC,EAAE,MAChC,MAAM,EAAE,QAAQ,WAAW,eAC9B;KAEA,IAAI,aACF,OAAO;IAEX;IAEA,MAAM,cAAc,MAAM,UACxB,WACA,EACE,QAAQ,gBACV,GACA,EAAE,OAAO,CACX;IAEA,MAAM,cAAe,aAAgC;IAErD,IAAI,aACF,YAAY,aACV,CAAC,4BAA4B,WAAW,IACvC,SAAU,OAAO,CAAC,GAAG,MAAM,WAAY,IAAI,CAAC,WAAY,CAC3D;IAGF,OAAO;GACT;EACF;EACA,iBAAiB;EACjB,SAAS,QAAQ,eAAe,QAAQ,eAAe;EACvD,mBAAmB;GACjB,KAAK,MAAM,WAAW,UAAU;IAC9B,MAAM,cAAc,YACjB,aAA+B,CAC9B,4BACA,QAAQ,OACV,CAAC,CAAC,EACA,MAAM,MAAM,EAAE,QAAQ,WAAW,eAAe;IACpD,IAAI,aACF,OAAO;GAEX;EACF;EACA,iBAAiB;CACnB,CAAC;CAED,OAAO;EACL,aAAa;EACb;CACF;AACF"}
@@ -1,8 +1,8 @@
1
1
  import { useWidgetConfig } from "../providers/WidgetProvider/WidgetProvider.js";
2
2
  import { useSDKClient } from "../providers/SDKClientProvider.js";
3
- import { getQueryKey } from "../utils/queries.js";
4
3
  import { getSourceTxHash } from "../stores/routes/utils.js";
5
4
  import { useRouteExecutionStoreContext } from "../stores/routes/RouteExecutionStore.js";
5
+ import { getQueryKey } from "../utils/queries.js";
6
6
  import { useTools } from "./useTools.js";
7
7
  import { buildRouteFromTxHistory } from "../utils/converters.js";
8
8
  import { getTransactionHistory } from "@lifi/sdk";
@@ -13,12 +13,12 @@ import { useAccount } from "@lifi/wallet-management";
13
13
  const useTransactionHistory = () => {
14
14
  const store = useRouteExecutionStoreContext();
15
15
  const { accounts } = useAccount();
16
- const { keyPrefix } = useWidgetConfig();
16
+ const { storageScopeKey } = useWidgetConfig();
17
17
  const sdkClient = useSDKClient();
18
18
  const { tools } = useTools();
19
19
  const { data: routeExecutions, isLoading } = useQueries({
20
20
  queries: accounts.map((account) => ({
21
- queryKey: [getQueryKey("transaction-history", keyPrefix), account.address],
21
+ queryKey: [getQueryKey("transaction-history", storageScopeKey), account.address],
22
22
  queryFn: (async ({ queryKey: [, accountAddress], signal }) => {
23
23
  if (!accountAddress) return [];
24
24
  const date = /* @__PURE__ */ new Date();
@@ -1 +1 @@
1
- {"version":3,"file":"useTransactionHistory.js","names":[],"sources":["../../../src/hooks/useTransactionHistory.ts"],"sourcesContent":["import type { FullStatusData, StatusResponse } from '@lifi/sdk'\nimport { getTransactionHistory } from '@lifi/sdk'\nimport { useAccount } from '@lifi/wallet-management'\nimport type { QueryFunction } from '@tanstack/react-query'\nimport { useQueries } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { useSDKClient } from '../providers/SDKClientProvider.js'\nimport { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'\nimport { useRouteExecutionStoreContext } from '../stores/routes/RouteExecutionStore.js'\nimport type {\n RouteExecution,\n RouteExecutionState,\n} from '../stores/routes/types.js'\nimport { getSourceTxHash } from '../stores/routes/utils.js'\nimport { buildRouteFromTxHistory } from '../utils/converters.js'\nimport { getQueryKey } from '../utils/queries.js'\nimport { useTools } from './useTools.js'\n\nexport const useTransactionHistory = (): {\n data: RouteExecution[]\n isLoading: boolean\n} => {\n const store = useRouteExecutionStoreContext()\n const { accounts } = useAccount()\n const { keyPrefix } = useWidgetConfig()\n const sdkClient = useSDKClient()\n const { tools } = useTools()\n\n const { data: routeExecutions, isLoading } = useQueries({\n queries: accounts.map((account) => ({\n queryKey: [\n getQueryKey('transaction-history', keyPrefix),\n account.address,\n ],\n queryFn: (async ({ queryKey: [, accountAddress], signal }) => {\n if (!accountAddress) {\n return []\n }\n const date = new Date()\n date.setFullYear(date.getFullYear() - 10)\n\n const response = await getTransactionHistory(\n sdkClient,\n {\n wallet: accountAddress,\n fromTimestamp: Math.floor(date.getTime() / 1000),\n toTimestamp: Math.floor(Date.now() / 1000),\n },\n { signal }\n )\n\n return response.transfers\n }) as QueryFunction<StatusResponse[], (string | undefined)[], never>,\n refetchInterval: 300_000,\n enabled: Boolean(account.address),\n })),\n combine: (results) => {\n const uniqueTransactions = new Map<string, StatusResponse>()\n results.forEach((result) => {\n if (result.data) {\n result.data.forEach((transaction) => {\n if (\n (transaction as FullStatusData)?.transactionId &&\n (transaction as FullStatusData)?.receiving?.chainId &&\n transaction?.sending.chainId\n ) {\n uniqueTransactions.set(\n (transaction as FullStatusData).transactionId,\n transaction\n )\n }\n })\n }\n })\n // Convert raw API transactions into RouteExecution objects.\n const data = Array.from(uniqueTransactions.values()).flatMap(\n (transaction) => {\n const routeExecution = buildRouteFromTxHistory(\n transaction as FullStatusData,\n tools\n )\n return routeExecution ? [routeExecution] : []\n }\n )\n return {\n data,\n isLoading: results.some((result) => result.isLoading),\n }\n },\n })\n\n // Stable Set — only recreated when data actually changes (TanStack Query structural sharing).\n const apiTxHashes = useMemo(\n () => new Set(routeExecutions.map((r) => getSourceTxHash(r.route))),\n [routeExecutions]\n )\n\n // Remove local store routes already indexed by the API to avoid duplicates.\n // Must be in an effect — combine runs during render, so store mutations there\n // would trigger \"Cannot update a component while rendering\" in concurrent mode.\n useEffect(() => {\n if (!apiTxHashes.size) {\n return\n }\n const { routes, deleteRoute } = store.getState() as RouteExecutionState\n for (const [id, routeExecution] of Object.entries(routes)) {\n const txHash = getSourceTxHash(\n (routeExecution as RouteExecution | undefined)?.route\n )\n if (txHash && apiTxHashes.has(txHash)) {\n deleteRoute(id)\n }\n }\n }, [apiTxHashes, store])\n\n return {\n data: routeExecutions,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,8BAGR;CACH,MAAM,QAAQ,8BAA8B;CAC5C,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,EAAE,cAAc,gBAAgB;CACtC,MAAM,YAAY,aAAa;CAC/B,MAAM,EAAE,UAAU,SAAS;CAE3B,MAAM,EAAE,MAAM,iBAAiB,cAAc,WAAW;EACtD,SAAS,SAAS,KAAK,aAAa;GAClC,UAAU,CACR,YAAY,uBAAuB,SAAS,GAC5C,QAAQ,OACV;GACA,UAAU,OAAO,EAAE,UAAU,GAAG,iBAAiB,aAAa;IAC5D,IAAI,CAAC,gBACH,OAAO,CAAC;IAEV,MAAM,uBAAO,IAAI,KAAK;IACtB,KAAK,YAAY,KAAK,YAAY,IAAI,EAAE;IAYxC,QAAO,MAVgB,sBACrB,WACA;KACE,QAAQ;KACR,eAAe,KAAK,MAAM,KAAK,QAAQ,IAAI,GAAI;KAC/C,aAAa,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;IAC3C,GACA,EAAE,OAAO,CACX,EAAA,CAEgB;GAClB;GACA,iBAAiB;GACjB,SAAS,QAAQ,QAAQ,OAAO;EAClC,EAAE;EACF,UAAU,YAAY;GACpB,MAAM,qCAAqB,IAAI,IAA4B;GAC3D,QAAQ,SAAS,WAAW;IAC1B,IAAI,OAAO,MACT,OAAO,KAAK,SAAS,gBAAgB;KACnC,IACG,aAAgC,iBAChC,aAAgC,WAAW,WAC5C,aAAa,QAAQ,SAErB,mBAAmB,IAChB,YAA+B,eAChC,WACF;IAEJ,CAAC;GAEL,CAAC;GAWD,OAAO;IACL,MAVW,MAAM,KAAK,mBAAmB,OAAO,CAAC,CAAC,CAAC,SAClD,gBAAgB;KACf,MAAM,iBAAiB,wBACrB,aACA,KACF;KACA,OAAO,iBAAiB,CAAC,cAAc,IAAI,CAAC;IAC9C,CAGG;IACH,WAAW,QAAQ,MAAM,WAAW,OAAO,SAAS;GACtD;EACF;CACF,CAAC;CAGD,MAAM,cAAc,cACZ,IAAI,IAAI,gBAAgB,KAAK,MAAM,gBAAgB,EAAE,KAAK,CAAC,CAAC,GAClE,CAAC,eAAe,CAClB;CAKA,gBAAgB;EACd,IAAI,CAAC,YAAY,MACf;EAEF,MAAM,EAAE,QAAQ,gBAAgB,MAAM,SAAS;EAC/C,KAAK,MAAM,CAAC,IAAI,mBAAmB,OAAO,QAAQ,MAAM,GAAG;GACzD,MAAM,SAAS,gBACZ,gBAA+C,KAClD;GACA,IAAI,UAAU,YAAY,IAAI,MAAM,GAClC,YAAY,EAAE;EAElB;CACF,GAAG,CAAC,aAAa,KAAK,CAAC;CAEvB,OAAO;EACL,MAAM;EACN;CACF;AACF"}
1
+ {"version":3,"file":"useTransactionHistory.js","names":[],"sources":["../../../src/hooks/useTransactionHistory.ts"],"sourcesContent":["import type { FullStatusData, StatusResponse } from '@lifi/sdk'\nimport { getTransactionHistory } from '@lifi/sdk'\nimport { useAccount } from '@lifi/wallet-management'\nimport type { QueryFunction } from '@tanstack/react-query'\nimport { useQueries } from '@tanstack/react-query'\nimport { useEffect, useMemo } from 'react'\nimport { useSDKClient } from '../providers/SDKClientProvider.js'\nimport { useWidgetConfig } from '../providers/WidgetProvider/WidgetProvider.js'\nimport { useRouteExecutionStoreContext } from '../stores/routes/RouteExecutionStore.js'\nimport type {\n RouteExecution,\n RouteExecutionState,\n} from '../stores/routes/types.js'\nimport { getSourceTxHash } from '../stores/routes/utils.js'\nimport { buildRouteFromTxHistory } from '../utils/converters.js'\nimport { getQueryKey } from '../utils/queries.js'\nimport { useTools } from './useTools.js'\n\nexport const useTransactionHistory = (): {\n data: RouteExecution[]\n isLoading: boolean\n} => {\n const store = useRouteExecutionStoreContext()\n const { accounts } = useAccount()\n const { storageScopeKey } = useWidgetConfig()\n const sdkClient = useSDKClient()\n const { tools } = useTools()\n\n const { data: routeExecutions, isLoading } = useQueries({\n queries: accounts.map((account) => ({\n queryKey: [\n getQueryKey('transaction-history', storageScopeKey),\n account.address,\n ],\n queryFn: (async ({ queryKey: [, accountAddress], signal }) => {\n if (!accountAddress) {\n return []\n }\n const date = new Date()\n date.setFullYear(date.getFullYear() - 10)\n\n const response = await getTransactionHistory(\n sdkClient,\n {\n wallet: accountAddress,\n fromTimestamp: Math.floor(date.getTime() / 1000),\n toTimestamp: Math.floor(Date.now() / 1000),\n },\n { signal }\n )\n\n return response.transfers\n }) as QueryFunction<StatusResponse[], (string | undefined)[], never>,\n refetchInterval: 300_000,\n enabled: Boolean(account.address),\n })),\n combine: (results) => {\n const uniqueTransactions = new Map<string, StatusResponse>()\n results.forEach((result) => {\n if (result.data) {\n result.data.forEach((transaction) => {\n if (\n (transaction as FullStatusData)?.transactionId &&\n (transaction as FullStatusData)?.receiving?.chainId &&\n transaction?.sending.chainId\n ) {\n uniqueTransactions.set(\n (transaction as FullStatusData).transactionId,\n transaction\n )\n }\n })\n }\n })\n // Convert raw API transactions into RouteExecution objects.\n const data = Array.from(uniqueTransactions.values()).flatMap(\n (transaction) => {\n const routeExecution = buildRouteFromTxHistory(\n transaction as FullStatusData,\n tools\n )\n return routeExecution ? [routeExecution] : []\n }\n )\n return {\n data,\n isLoading: results.some((result) => result.isLoading),\n }\n },\n })\n\n // Stable Set — only recreated when data actually changes (TanStack Query structural sharing).\n const apiTxHashes = useMemo(\n () => new Set(routeExecutions.map((r) => getSourceTxHash(r.route))),\n [routeExecutions]\n )\n\n // Remove local store routes already indexed by the API to avoid duplicates.\n // Must be in an effect — combine runs during render, so store mutations there\n // would trigger \"Cannot update a component while rendering\" in concurrent mode.\n useEffect(() => {\n if (!apiTxHashes.size) {\n return\n }\n const { routes, deleteRoute } = store.getState() as RouteExecutionState\n for (const [id, routeExecution] of Object.entries(routes)) {\n const txHash = getSourceTxHash(\n (routeExecution as RouteExecution | undefined)?.route\n )\n if (txHash && apiTxHashes.has(txHash)) {\n deleteRoute(id)\n }\n }\n }, [apiTxHashes, store])\n\n return {\n data: routeExecutions,\n isLoading,\n }\n}\n"],"mappings":";;;;;;;;;;;;AAkBA,MAAa,8BAGR;CACH,MAAM,QAAQ,8BAA8B;CAC5C,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,EAAE,oBAAoB,gBAAgB;CAC5C,MAAM,YAAY,aAAa;CAC/B,MAAM,EAAE,UAAU,SAAS;CAE3B,MAAM,EAAE,MAAM,iBAAiB,cAAc,WAAW;EACtD,SAAS,SAAS,KAAK,aAAa;GAClC,UAAU,CACR,YAAY,uBAAuB,eAAe,GAClD,QAAQ,OACV;GACA,UAAU,OAAO,EAAE,UAAU,GAAG,iBAAiB,aAAa;IAC5D,IAAI,CAAC,gBACH,OAAO,CAAC;IAEV,MAAM,uBAAO,IAAI,KAAK;IACtB,KAAK,YAAY,KAAK,YAAY,IAAI,EAAE;IAYxC,QAAO,MAVgB,sBACrB,WACA;KACE,QAAQ;KACR,eAAe,KAAK,MAAM,KAAK,QAAQ,IAAI,GAAI;KAC/C,aAAa,KAAK,MAAM,KAAK,IAAI,IAAI,GAAI;IAC3C,GACA,EAAE,OAAO,CACX,EAAA,CAEgB;GAClB;GACA,iBAAiB;GACjB,SAAS,QAAQ,QAAQ,OAAO;EAClC,EAAE;EACF,UAAU,YAAY;GACpB,MAAM,qCAAqB,IAAI,IAA4B;GAC3D,QAAQ,SAAS,WAAW;IAC1B,IAAI,OAAO,MACT,OAAO,KAAK,SAAS,gBAAgB;KACnC,IACG,aAAgC,iBAChC,aAAgC,WAAW,WAC5C,aAAa,QAAQ,SAErB,mBAAmB,IAChB,YAA+B,eAChC,WACF;IAEJ,CAAC;GAEL,CAAC;GAWD,OAAO;IACL,MAVW,MAAM,KAAK,mBAAmB,OAAO,CAAC,CAAC,CAAC,SAClD,gBAAgB;KACf,MAAM,iBAAiB,wBACrB,aACA,KACF;KACA,OAAO,iBAAiB,CAAC,cAAc,IAAI,CAAC;IAC9C,CAGG;IACH,WAAW,QAAQ,MAAM,WAAW,OAAO,SAAS;GACtD;EACF;CACF,CAAC;CAGD,MAAM,cAAc,cACZ,IAAI,IAAI,gBAAgB,KAAK,MAAM,gBAAgB,EAAE,KAAK,CAAC,CAAC,GAClE,CAAC,eAAe,CAClB;CAKA,gBAAgB;EACd,IAAI,CAAC,YAAY,MACf;EAEF,MAAM,EAAE,QAAQ,gBAAgB,MAAM,SAAS;EAC/C,KAAK,MAAM,CAAC,IAAI,mBAAmB,OAAO,QAAQ,MAAM,GAAG;GACzD,MAAM,SAAS,gBACZ,gBAA+C,KAClD;GACA,IAAI,UAAU,YAAY,IAAI,MAAM,GAClC,YAAY,EAAE;EAElB;CACF,GAAG,CAAC,aAAa,KAAK,CAAC;CAEvB,OAAO;EACL,MAAM;EACN;CACF;AACF"}
@@ -14,6 +14,10 @@ import { useWidgetChains } from "./hooks/useWidgetChains.js";
14
14
  import { navigationRoutes } from "./utils/navigationRoutes.js";
15
15
  import { ChainPinned, ChainTokenSelected, ContactSupport, FormFieldChanged, LowAddressActivityConfirmed, NavigationTabChanged, RouteExecutionUpdate, RouteHighValueLossUpdate, RouteSelected, SettingUpdated, TokenSearch, WidgetEvent, WidgetEvents } from "./types/events.js";
16
16
  import { WidgetEventEmitter, useWidgetEvents, widgetEvents } from "./hooks/useWidgetEvents.js";
17
+ import { QueryParameter, ScopeKeyParameter } from "./queries/types.js";
18
+ import { GetChainsOptions, GetChainsQueryFnData, GetChainsQueryKey, GetChainsQueryKeyParameters, GetChainsQueryOptions, getChainsQueryKey, getChainsQueryOptions, supportedChainTypes } from "./queries/getChains.js";
19
+ import { GetToolsOptions, GetToolsQueryFnData, GetToolsQueryKey, GetToolsQueryKeyParameters, GetToolsQueryOptions, getToolsQueryKey, getToolsQueryOptions } from "./queries/getTools.js";
20
+ import "./queries/index.js";
17
21
  import { Bookmark, BookmarkActions, BookmarkProps, BookmarkState, BookmarkStore } from "./stores/bookmarks/types.js";
18
22
  import { useFieldActions } from "./stores/form/useFieldActions.js";
19
23
  import { useFieldValues } from "./stores/form/useFieldValues.js";
@@ -31,4 +35,4 @@ import { getPriceImpact } from "./utils/getPriceImpact.js";
31
35
  import { percentFormatter } from "./utils/percentFormatter.js";
32
36
  import { ChainId, ChainType, CoinKey } from "@lifi/sdk";
33
37
  export type * from "@lifi/sdk";
34
- export { AllowDeny, AllowDenyItems, AllowDenySet, AllowDenySetItem, AllowDenySets, Appearance, Bookmark, BookmarkActions, BookmarkProps, BookmarkState, BookmarkStore, CalculateFeeParams, ChainId, ChainPinned, ChainTokenSelected, ChainType, CoinKey, ContactSupport, CustomMode, DefaultFieldValues, DefaultUI, DefaultValues, DisabledUIConfig, ExpansionType, ExplorerUrl, ExtractValueType, FieldNames, FieldValues, FormActions, FormFieldArray, FormFieldChanged, FormFieldNames, FormFieldOptions, FormKeyHelper, FormProps, FormRef, FormRefProps, FormState, FormStoreStore, FormType, FormTypeProps, FormValueControl, FormValues, FormValuesState, GenericFormValue, HiddenUIConfig, InternalNavigationTabKey, InternalWidgetMode, ItemPrice, ItemPriceProps, App as LiFiWidget, LowAddressActivityConfirmed, ModeOptions, NFT, NFTBase, NFTBaseProps, NFTOwner, NFTProps, NavigationProps, NavigationTabChanged, NavigationTabKey, PoweredByType, RequiredUIConfig, ResetOptions, RouteExecutionUpdate, RouteHighValueLossUpdate, RouteLabel, RouteLabelRule, RouteSelected, SetFieldValueFunction, SetOptions, SettingUpdated, SplitMode, SplitModeOptions, SplitNavigationTabKey, ToAddress, type TokenAmount, TokenSearch, TouchedFields, ValidationActions, ValidationProps, WidgetChains, WidgetConfig, WidgetConfigPartialProps, WidgetConfigProps, WidgetContractTool, type WidgetDrawer, WidgetDrawerProps, WidgetEvent, type WidgetEventEmitter, WidgetEvents, WidgetFeeConfig, WidgetLanguages, WidgetMode, WidgetProps, WidgetProvider, WidgetSDKConfig, WidgetSkeleton, WidgetTheme, WidgetThemeComponents, WidgetTokens, WidgetVariant, WidgetWalletConfig, azureLightTheme, compactNumberFormatter, createTheme, currencyExtendedFormatter, defaultMaxHeight, formatDuration, formatInputAmount, formatSlippage, formatTokenAmount, formatTokenPrice, getPriceImpact, jumperTheme, name, navigationRoutes, palette, paletteDark, paletteLight, percentFormatter, priceToTokenAmount, usdDecimals, useFieldActions, useFieldValues, useWidgetChains, useWidgetEvents, version, watermelonLightTheme, widgetEvents, windows95Theme, wrapLongWords };
38
+ export { AllowDeny, AllowDenyItems, AllowDenySet, AllowDenySetItem, AllowDenySets, Appearance, Bookmark, BookmarkActions, BookmarkProps, BookmarkState, BookmarkStore, CalculateFeeParams, ChainId, ChainPinned, ChainTokenSelected, ChainType, CoinKey, ContactSupport, CustomMode, DefaultFieldValues, DefaultUI, DefaultValues, DisabledUIConfig, ExpansionType, ExplorerUrl, ExtractValueType, FieldNames, FieldValues, FormActions, FormFieldArray, FormFieldChanged, FormFieldNames, FormFieldOptions, FormKeyHelper, FormProps, FormRef, FormRefProps, FormState, FormStoreStore, FormType, FormTypeProps, FormValueControl, FormValues, FormValuesState, GenericFormValue, type GetChainsOptions, type GetChainsQueryFnData, type GetChainsQueryKey, type GetChainsQueryKeyParameters, type GetChainsQueryOptions, type GetToolsOptions, type GetToolsQueryFnData, type GetToolsQueryKey, type GetToolsQueryKeyParameters, type GetToolsQueryOptions, HiddenUIConfig, InternalNavigationTabKey, InternalWidgetMode, ItemPrice, ItemPriceProps, App as LiFiWidget, LowAddressActivityConfirmed, ModeOptions, NFT, NFTBase, NFTBaseProps, NFTOwner, NFTProps, NavigationProps, NavigationTabChanged, NavigationTabKey, PoweredByType, type QueryParameter, RequiredUIConfig, ResetOptions, RouteExecutionUpdate, RouteHighValueLossUpdate, RouteLabel, RouteLabelRule, RouteSelected, type ScopeKeyParameter, SetFieldValueFunction, SetOptions, SettingUpdated, SplitMode, SplitModeOptions, SplitNavigationTabKey, ToAddress, type TokenAmount, TokenSearch, TouchedFields, ValidationActions, ValidationProps, WidgetChains, WidgetConfig, WidgetConfigPartialProps, WidgetConfigProps, WidgetContractTool, type WidgetDrawer, WidgetDrawerProps, WidgetEvent, type WidgetEventEmitter, WidgetEvents, WidgetFeeConfig, WidgetLanguages, WidgetMode, WidgetProps, WidgetProvider, WidgetSDKConfig, WidgetSkeleton, WidgetTheme, WidgetThemeComponents, WidgetTokens, WidgetVariant, WidgetWalletConfig, azureLightTheme, compactNumberFormatter, createTheme, currencyExtendedFormatter, defaultMaxHeight, formatDuration, formatInputAmount, formatSlippage, formatTokenAmount, formatTokenPrice, getChainsQueryKey, getChainsQueryOptions, getPriceImpact, getToolsQueryKey, getToolsQueryOptions, jumperTheme, name, navigationRoutes, palette, paletteDark, paletteLight, percentFormatter, priceToTokenAmount, supportedChainTypes, usdDecimals, useFieldActions, useFieldValues, useWidgetChains, useWidgetEvents, version, watermelonLightTheme, widgetEvents, windows95Theme, wrapLongWords };
package/dist/esm/index.js CHANGED
@@ -4,11 +4,13 @@ import { defaultMaxHeight } from "./config/constants.js";
4
4
  import { ExpansionType } from "./types/widget.js";
5
5
  import { navigationRoutes } from "./utils/navigationRoutes.js";
6
6
  import { name, version } from "./config/version.js";
7
+ import { getChainsQueryKey, getChainsQueryOptions, supportedChainTypes } from "./queries/getChains.js";
7
8
  import { useFieldActions } from "./stores/form/useFieldActions.js";
8
9
  import { formatDuration, formatInputAmount, formatSlippage, formatTokenAmount, formatTokenPrice, priceToTokenAmount, usdDecimals, wrapLongWords } from "./utils/format.js";
9
10
  import { FormKeyHelper } from "./stores/form/types.js";
10
11
  import { useFieldValues } from "./stores/form/useFieldValues.js";
11
12
  import { getPriceImpact } from "./utils/getPriceImpact.js";
13
+ import { getToolsQueryKey, getToolsQueryOptions } from "./queries/getTools.js";
12
14
  import { compactNumberFormatter } from "./utils/compactNumberFormatter.js";
13
15
  import { currencyExtendedFormatter } from "./utils/currencyExtendedFormatter.js";
14
16
  import { percentFormatter } from "./utils/percentFormatter.js";
@@ -25,4 +27,4 @@ import { jumperTheme } from "./themes/jumper.js";
25
27
  import { watermelonLightTheme } from "./themes/watermelonLight.js";
26
28
  import { windows95Theme } from "./themes/windows95.js";
27
29
  import { ChainId, ChainType, CoinKey } from "@lifi/sdk";
28
- export { ChainId, ChainType, CoinKey, ExpansionType, FormKeyHelper, ItemPrice, App as LiFiWidget, NFT, NFTBase, WidgetEvent, WidgetSkeleton, azureLightTheme, compactNumberFormatter, createTheme, currencyExtendedFormatter, defaultMaxHeight, formatDuration, formatInputAmount, formatSlippage, formatTokenAmount, formatTokenPrice, getPriceImpact, jumperTheme, name, navigationRoutes, palette, paletteDark, paletteLight, percentFormatter, priceToTokenAmount, usdDecimals, useFieldActions, useFieldValues, useWidgetChains, useWidgetEvents, version, watermelonLightTheme, widgetEvents, windows95Theme, wrapLongWords };
30
+ export { ChainId, ChainType, CoinKey, ExpansionType, FormKeyHelper, ItemPrice, App as LiFiWidget, NFT, NFTBase, WidgetEvent, WidgetSkeleton, azureLightTheme, compactNumberFormatter, createTheme, currencyExtendedFormatter, defaultMaxHeight, formatDuration, formatInputAmount, formatSlippage, formatTokenAmount, formatTokenPrice, getChainsQueryKey, getChainsQueryOptions, getPriceImpact, getToolsQueryKey, getToolsQueryOptions, jumperTheme, name, navigationRoutes, palette, paletteDark, paletteLight, percentFormatter, priceToTokenAmount, supportedChainTypes, usdDecimals, useFieldActions, useFieldValues, useWidgetChains, useWidgetEvents, version, watermelonLightTheme, widgetEvents, windows95Theme, wrapLongWords };
@@ -1 +1 @@
1
- {"version":3,"file":"RoutesPage.style.d.ts","names":[],"sources":["../../../../src/pages/RoutesPage/RoutesPage.style.ts"],"mappings":";;;cAGa,SAAO,MAAM,GAAG,MAAM,sBAAsB"}
1
+ {"version":3,"file":"RoutesPage.style.d.ts","names":["Stack","MuiStack"],"sources":["../../../../src/pages/RoutesPage/RoutesPage.style.ts"],"mappings":";;;cAGaA,SAAO,MAAM,GAAG,MAAM,sBAAsBC"}
@@ -6,6 +6,7 @@ import { PageContainer } from "../../components/PageContainer.js";
6
6
  import { defaultChainIdsByType } from "../../utils/chainType.js";
7
7
  import { useToAddressRequirements } from "../../hooks/useToAddressRequirements.js";
8
8
  import { shortenAddress } from "../../utils/wallet.js";
9
+ import { openInNewTab } from "../../utils/url.js";
9
10
  import { useExplorer } from "../../hooks/useExplorer.js";
10
11
  import { useHeader } from "../../hooks/useHeader.js";
11
12
  import { useListHeight } from "../../hooks/useListHeight.js";
@@ -88,7 +89,7 @@ const BookmarksPage = () => {
88
89
  {
89
90
  icon: /* @__PURE__ */ jsx(OpenInNewRounded, {}),
90
91
  label: t("button.viewOnExplorer"),
91
- onClick: () => window.open(getAddressLink(bookmark.address, defaultChainIdsByType[bookmark.chainType]), "_blank")
92
+ onClick: () => openInNewTab(getAddressLink(bookmark.address, defaultChainIdsByType[bookmark.chainType]))
92
93
  },
93
94
  {
94
95
  icon: /* @__PURE__ */ jsx(DeleteOutline, {}),
@@ -1 +1 @@
1
- {"version":3,"file":"BookmarksPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/BookmarksPage.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport DeleteOutline from '@mui/icons-material/DeleteOutlined'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport TurnedIn from '@mui/icons-material/TurnedIn'\nimport { Button, List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport type { BottomSheetBase } from '../../components/BottomSheet/types.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport type { Bookmark } from '../../stores/bookmarks/types.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useBookmarks } from '../../stores/bookmarks/useBookmarks.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { shortenAddress } from '../../utils/wallet.js'\nimport { BookmarkAddressSheet } from './BookmarkAddressSheet.js'\nimport { BookmarkButtonContainer } from './SendToWalletPage.style.js'\n\nexport const BookmarksPage = (): JSX.Element => {\n const { t } = useTranslation()\n const bookmarkAddressSheetRef = useRef<BottomSheetBase>(null)\n const listParentRef = useRef<HTMLUListElement | null>(null)\n const buttonRef = useRef<HTMLDivElement | null>(null)\n const { bookmarks } = useBookmarks()\n const { requiredToChainType } = useToAddressRequirements()\n const { addBookmark, removeBookmark, setSelectedBookmark } =\n useBookmarkActions()\n const navigate = useNavigate()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n\n useHeader(t('header.bookmarkedWallets'))\n\n const { listHeight } = useListHeight({\n listParentRef,\n headerRef: buttonRef,\n })\n\n const handleAddBookmark = () => {\n bookmarkAddressSheetRef.current?.open()\n }\n\n const handleBookmarkSelected = (bookmark: Bookmark) => {\n setFieldValue('toAddress', bookmark.address, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark(bookmark)\n navigate({ to: navigationRoutes.home, replace: true })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {bookmarks.map((bookmark) => (\n <ListItem key={bookmark.address} sx={{ position: 'relative' }}>\n <ListItemButton\n onClick={() => handleBookmarkSelected(bookmark)}\n disabled={\n requiredToChainType &&\n requiredToChainType !== bookmark.chainType\n }\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[bookmark.chainType]}\n />\n </ListItemAvatar>\n <ListItemText\n primary={bookmark.name}\n secondary={shortenAddress(bookmark.address)}\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== bookmark.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(bookmark.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n window.open(\n getAddressLink(\n bookmark.address,\n defaultChainIdsByType[bookmark.chainType]\n ),\n '_blank'\n ),\n },\n {\n icon: <DeleteOutline />,\n label: t('button.delete'),\n onClick: () => removeBookmark(bookmark.address),\n },\n ]}\n />\n </ListItem>\n ))}\n {!bookmarks.length && (\n <EmptyListIndicator\n icon={<TurnedIn />}\n title={t('sendToWallet.noBookmarkedWallets')}\n message={t('sendToWallet.noBookmarkedWalletsMessage')}\n />\n )}\n </List>\n <BookmarkButtonContainer ref={buttonRef}>\n <Button variant=\"contained\" onClick={handleAddBookmark}>\n {t('sendToWallet.addBookmark')}\n </Button>\n </BookmarkButtonContainer>\n <BookmarkAddressSheet\n ref={bookmarkAddressSheetRef}\n onAddBookmark={addBookmark}\n />\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,sBAAmC;CAC9C,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,0BAA0B,OAAwB,IAAI;CAC5D,MAAM,gBAAgB,OAAgC,IAAI;CAC1D,MAAM,YAAY,OAA8B,IAAI;CACpD,MAAM,EAAE,cAAc,aAAa;CACnC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EAAE,aAAa,gBAAgB,wBACnC,mBAAmB;CACrB,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CAEvC,UAAU,EAAE,0BAA0B,CAAC;CAEvC,MAAM,EAAE,eAAe,cAAc;EACnC;EACA,WAAW;CACb,CAAC;CAED,MAAM,0BAA0B;EAC9B,wBAAwB,SAAS,KAAK;CACxC;CAEA,MAAM,0BAA0B,aAAuB;EACrD,cAAc,aAAa,SAAS,SAAS;GAC3C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB,QAAQ;EAC5B,SAAS;GAAE,IAAI,iBAAiB;GAAM,SAAS;EAAK,CAAC;CACvD;CAEA,OACE,qBAAC,eAAD;EAAe,gBAAA;EAAf,UAAA;GACE,qBAAC,MAAD;IACE,WAAU;IACV,KAAK;IACL,OAAO;KAAE,QAAQ;KAAY,UAAU;IAAO;IAC9C,gBAAA;IACA,IAAI,EAAE,YAAY,IAAI;IALxB,UAAA,CAOG,UAAU,KAAK,aACd,qBAACA,YAAD;KAAiC,IAAI,EAAE,UAAU,WAAW;KAA5D,UAAA,CACE,qBAACC,kBAAD;MACE,eAAe,uBAAuB,QAAQ;MAC9C,UACE,uBACA,wBAAwB,SAAS;MAJrC,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD,EACE,SAAS,sBAAsB,SAAS,WACzC,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;OACE,SAAS,SAAS;OAClB,WAAW,eAAe,SAAS,OAAO;MAC3C,CAAA,CACa;KAChB,CAAA,GAAA,oBAAC,aAAD;MACE,UACE,CAAC,EACC,uBACA,wBAAwB,SAAS;MAGrC,OAAO;OACL;QACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;QAC3B,OAAO,EAAE,oBAAoB;QAC7B,eACE,UAAU,UAAU,UAAU,SAAS,OAAO;OAClD;OACA;QACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;QACzB,OAAO,EAAE,uBAAuB;QAChC,eACE,OAAO,KACL,eACE,SAAS,SACT,sBAAsB,SAAS,UACjC,GACA,QACF;OACJ;OACA;QACE,MAAM,oBAAC,eAAD,CAAgB,CAAA;QACtB,OAAO,EAAE,eAAe;QACxB,eAAe,eAAe,SAAS,OAAO;OAChD;MACF;KACD,CAAA,CACO;IAnDK,GAAA,SAAS,OAmDd,CACX,GACA,CAAC,UAAU,UACV,oBAAC,oBAAD;KACE,MAAM,oBAAC,UAAD,CAAW,CAAA;KACjB,OAAO,EAAE,kCAAkC;KAC3C,SAAS,EAAE,yCAAyC;IACrD,CAAA,CAEC;;GACN,oBAAC,yBAAD;IAAyB,KAAK;IAC5B,UAAA,oBAAC,QAAD;KAAQ,SAAQ;KAAY,SAAS;KAClC,UAAA,EAAE,0BAA0B;IACvB,CAAA;GACe,CAAA;GACzB,oBAAC,sBAAD;IACE,KAAK;IACL,eAAe;GAChB,CAAA;EACY;;AAEnB"}
1
+ {"version":3,"file":"BookmarksPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/BookmarksPage.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport DeleteOutline from '@mui/icons-material/DeleteOutlined'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport TurnedIn from '@mui/icons-material/TurnedIn'\nimport { Button, List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport type { BottomSheetBase } from '../../components/BottomSheet/types.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport type { Bookmark } from '../../stores/bookmarks/types.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useBookmarks } from '../../stores/bookmarks/useBookmarks.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { openInNewTab } from '../../utils/url.js'\nimport { shortenAddress } from '../../utils/wallet.js'\nimport { BookmarkAddressSheet } from './BookmarkAddressSheet.js'\nimport { BookmarkButtonContainer } from './SendToWalletPage.style.js'\n\nexport const BookmarksPage = (): JSX.Element => {\n const { t } = useTranslation()\n const bookmarkAddressSheetRef = useRef<BottomSheetBase>(null)\n const listParentRef = useRef<HTMLUListElement | null>(null)\n const buttonRef = useRef<HTMLDivElement | null>(null)\n const { bookmarks } = useBookmarks()\n const { requiredToChainType } = useToAddressRequirements()\n const { addBookmark, removeBookmark, setSelectedBookmark } =\n useBookmarkActions()\n const navigate = useNavigate()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n\n useHeader(t('header.bookmarkedWallets'))\n\n const { listHeight } = useListHeight({\n listParentRef,\n headerRef: buttonRef,\n })\n\n const handleAddBookmark = () => {\n bookmarkAddressSheetRef.current?.open()\n }\n\n const handleBookmarkSelected = (bookmark: Bookmark) => {\n setFieldValue('toAddress', bookmark.address, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark(bookmark)\n navigate({ to: navigationRoutes.home, replace: true })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {bookmarks.map((bookmark) => (\n <ListItem key={bookmark.address} sx={{ position: 'relative' }}>\n <ListItemButton\n onClick={() => handleBookmarkSelected(bookmark)}\n disabled={\n requiredToChainType &&\n requiredToChainType !== bookmark.chainType\n }\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[bookmark.chainType]}\n />\n </ListItemAvatar>\n <ListItemText\n primary={bookmark.name}\n secondary={shortenAddress(bookmark.address)}\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== bookmark.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(bookmark.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n openInNewTab(\n getAddressLink(\n bookmark.address,\n defaultChainIdsByType[bookmark.chainType]\n )\n ),\n },\n {\n icon: <DeleteOutline />,\n label: t('button.delete'),\n onClick: () => removeBookmark(bookmark.address),\n },\n ]}\n />\n </ListItem>\n ))}\n {!bookmarks.length && (\n <EmptyListIndicator\n icon={<TurnedIn />}\n title={t('sendToWallet.noBookmarkedWallets')}\n message={t('sendToWallet.noBookmarkedWalletsMessage')}\n />\n )}\n </List>\n <BookmarkButtonContainer ref={buttonRef}>\n <Button variant=\"contained\" onClick={handleAddBookmark}>\n {t('sendToWallet.addBookmark')}\n </Button>\n </BookmarkButtonContainer>\n <BookmarkAddressSheet\n ref={bookmarkAddressSheetRef}\n onAddBookmark={addBookmark}\n />\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,sBAAmC;CAC9C,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,0BAA0B,OAAwB,IAAI;CAC5D,MAAM,gBAAgB,OAAgC,IAAI;CAC1D,MAAM,YAAY,OAA8B,IAAI;CACpD,MAAM,EAAE,cAAc,aAAa;CACnC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EAAE,aAAa,gBAAgB,wBACnC,mBAAmB;CACrB,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CAEvC,UAAU,EAAE,0BAA0B,CAAC;CAEvC,MAAM,EAAE,eAAe,cAAc;EACnC;EACA,WAAW;CACb,CAAC;CAED,MAAM,0BAA0B;EAC9B,wBAAwB,SAAS,KAAK;CACxC;CAEA,MAAM,0BAA0B,aAAuB;EACrD,cAAc,aAAa,SAAS,SAAS;GAC3C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB,QAAQ;EAC5B,SAAS;GAAE,IAAI,iBAAiB;GAAM,SAAS;EAAK,CAAC;CACvD;CAEA,OACE,qBAAC,eAAD;EAAe,gBAAA;EAAf,UAAA;GACE,qBAAC,MAAD;IACE,WAAU;IACV,KAAK;IACL,OAAO;KAAE,QAAQ;KAAY,UAAU;IAAO;IAC9C,gBAAA;IACA,IAAI,EAAE,YAAY,IAAI;IALxB,UAAA,CAOG,UAAU,KAAK,aACd,qBAACA,YAAD;KAAiC,IAAI,EAAE,UAAU,WAAW;KAA5D,UAAA,CACE,qBAACC,kBAAD;MACE,eAAe,uBAAuB,QAAQ;MAC9C,UACE,uBACA,wBAAwB,SAAS;MAJrC,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD,EACE,SAAS,sBAAsB,SAAS,WACzC,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;OACE,SAAS,SAAS;OAClB,WAAW,eAAe,SAAS,OAAO;MAC3C,CAAA,CACa;KAChB,CAAA,GAAA,oBAAC,aAAD;MACE,UACE,CAAC,EACC,uBACA,wBAAwB,SAAS;MAGrC,OAAO;OACL;QACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;QAC3B,OAAO,EAAE,oBAAoB;QAC7B,eACE,UAAU,UAAU,UAAU,SAAS,OAAO;OAClD;OACA;QACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;QACzB,OAAO,EAAE,uBAAuB;QAChC,eACE,aACE,eACE,SAAS,SACT,sBAAsB,SAAS,UACjC,CACF;OACJ;OACA;QACE,MAAM,oBAAC,eAAD,CAAgB,CAAA;QACtB,OAAO,EAAE,eAAe;QACxB,eAAe,eAAe,SAAS,OAAO;OAChD;MACF;KACD,CAAA,CACO;IAlDK,GAAA,SAAS,OAkDd,CACX,GACA,CAAC,UAAU,UACV,oBAAC,oBAAD;KACE,MAAM,oBAAC,UAAD,CAAW,CAAA;KACjB,OAAO,EAAE,kCAAkC;KAC3C,SAAS,EAAE,yCAAyC;IACrD,CAAA,CAEC;;GACN,oBAAC,yBAAD;IAAyB,KAAK;IAC5B,UAAA,oBAAC,QAAD;KAAQ,SAAQ;KAAY,SAAS;KAClC,UAAA,EAAE,0BAA0B;IACvB,CAAA;GACe,CAAA;GACzB,oBAAC,sBAAD;IACE,KAAK;IACL,eAAe;GAChB,CAAA;EACY;;AAEnB"}
@@ -4,6 +4,7 @@ import { useFieldActions } from "../../stores/form/useFieldActions.js";
4
4
  import { PageContainer } from "../../components/PageContainer.js";
5
5
  import { useToAddressRequirements } from "../../hooks/useToAddressRequirements.js";
6
6
  import { shortenAddress } from "../../utils/wallet.js";
7
+ import { openInNewTab } from "../../utils/url.js";
7
8
  import { useExplorer } from "../../hooks/useExplorer.js";
8
9
  import { useHeader } from "../../hooks/useHeader.js";
9
10
  import { useListHeight } from "../../hooks/useListHeight.js";
@@ -72,7 +73,7 @@ const ConnectedWalletsPage = () => {
72
73
  icon: /* @__PURE__ */ jsx(OpenInNewRounded, {}),
73
74
  label: t("button.viewOnExplorer"),
74
75
  onClick: () => {
75
- if (account.address) window.open(getAddressLink(account.address, account.chainId), "_blank");
76
+ if (account.address) openInNewTab(getAddressLink(account.address, account.chainId));
76
77
  }
77
78
  }] : []];
78
79
  return /* @__PURE__ */ jsxs(ListItem$1, {
@@ -1 +1 @@
1
- {"version":3,"file":"ConnectedWalletsPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/ConnectedWalletsPage.tsx"],"sourcesContent":["import { useAccount } from '@lifi/wallet-management'\nimport type { Account } from '@lifi/widget-provider'\nimport ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport Wallet from '@mui/icons-material/Wallet'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { shortenAddress } from '../../utils/wallet.js'\n\nexport const ConnectedWalletsPage = (): JSX.Element => {\n const { t } = useTranslation()\n const { accounts } = useAccount()\n const { setSelectedBookmark } = useBookmarkActions()\n const { requiredToChainType } = useToAddressRequirements()\n const navigate = useNavigate()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n const listParentRef = useRef<HTMLUListElement | null>(null)\n\n useHeader(t('sendToWallet.connectedWallets'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleWalletSelected = (account: Account) => {\n setFieldValue('toAddress', account.address!, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark({\n name: account.connector?.name,\n address: account.address!,\n chainType: account.chainType!,\n isConnectedAccount: true,\n })\n navigate({\n to: navigationRoutes.home,\n replace: true,\n })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {accounts.map((account) => {\n const walletAddress = shortenAddress(account.address)\n const menuItems = [\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () => {\n if (account.address) {\n navigator.clipboard.writeText(account.address)\n }\n },\n },\n ...(account.chainId\n ? [\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () => {\n if (account.address) {\n window.open(\n getAddressLink(account.address, account.chainId),\n '_blank'\n )\n }\n },\n },\n ]\n : []),\n ]\n\n return (\n <ListItem key={account.address} sx={{ position: 'relative' }}>\n <ListItemButton\n onClick={() => handleWalletSelected(account)}\n disabled={\n requiredToChainType &&\n requiredToChainType !== account.chainType\n }\n >\n <ListItemAvatar>\n <AccountAvatar chainId={account.chainId} account={account} />\n </ListItemAvatar>\n <ListItemText\n primary={account.connector?.name}\n secondary={walletAddress}\n />\n </ListItemButton>\n <ContextMenu\n items={menuItems}\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== account.chainType\n )\n }\n />\n </ListItem>\n )\n })}\n {!accounts.length && (\n <EmptyListIndicator\n icon={<Wallet />}\n title={t('sendToWallet.noConnectedWallets')}\n message={t('sendToWallet.noConnectedWalletsMessage')}\n />\n )}\n </List>\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAa,6BAA0C;CACrD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,EAAE,wBAAwB,mBAAmB;CACnD,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CACvC,MAAM,gBAAgB,OAAgC,IAAI;CAE1D,UAAU,EAAE,+BAA+B,CAAC;CAE5C,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,wBAAwB,YAAqB;EACjD,cAAc,aAAa,QAAQ,SAAU;GAC3C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB;GAClB,MAAM,QAAQ,WAAW;GACzB,SAAS,QAAQ;GACjB,WAAW,QAAQ;GACnB,oBAAoB;EACtB,CAAC;EACD,SAAS;GACP,IAAI,iBAAiB;GACrB,SAAS;EACX,CAAC;CACH;CAEA,OACE,oBAAC,eAAD;EAAe,gBAAA;EACb,UAAA,qBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GALxB,UAAA,CAOG,SAAS,KAAK,YAAY;IACzB,MAAM,gBAAgB,eAAe,QAAQ,OAAO;IACpD,MAAM,YAAY,CAChB;KACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;KAC3B,OAAO,EAAE,oBAAoB;KAC7B,eAAe;MACb,IAAI,QAAQ,SACV,UAAU,UAAU,UAAU,QAAQ,OAAO;KAEjD;IACF,GACA,GAAI,QAAQ,UACR,CACE;KACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;KACzB,OAAO,EAAE,uBAAuB;KAChC,eAAe;MACb,IAAI,QAAQ,SACV,OAAO,KACL,eAAe,QAAQ,SAAS,QAAQ,OAAO,GAC/C,QACF;KAEJ;IACF,CACF,IACA,CAAC,CACP;IAEA,OACE,qBAACA,YAAD;KAAgC,IAAI,EAAE,UAAU,WAAW;KAA3D,UAAA,CACE,qBAACC,kBAAD;MACE,eAAe,qBAAqB,OAAO;MAC3C,UACE,uBACA,wBAAwB,QAAQ;MAJpC,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD;OAAe,SAAS,QAAQ;OAAkB;MAAU,CAAA,EAC9C,CAAA,GAChB,oBAAC,cAAD;OACE,SAAS,QAAQ,WAAW;OAC5B,WAAW;MACZ,CAAA,CACa;KAChB,CAAA,GAAA,oBAAC,aAAD;MACE,OAAO;MACP,UACE,CAAC,EACC,uBACA,wBAAwB,QAAQ;KAGrC,CAAA,CACO;IAzBK,GAAA,QAAQ,OAyBb;GAEd,CAAC,GACA,CAAC,SAAS,UACT,oBAAC,oBAAD;IACE,MAAM,oBAAC,QAAD,CAAS,CAAA;IACf,OAAO,EAAE,iCAAiC;IAC1C,SAAS,EAAE,wCAAwC;GACpD,CAAA,CAEC;;CACO,CAAA;AAEnB"}
1
+ {"version":3,"file":"ConnectedWalletsPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/ConnectedWalletsPage.tsx"],"sourcesContent":["import { useAccount } from '@lifi/wallet-management'\nimport type { Account } from '@lifi/widget-provider'\nimport ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport Wallet from '@mui/icons-material/Wallet'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { openInNewTab } from '../../utils/url.js'\nimport { shortenAddress } from '../../utils/wallet.js'\n\nexport const ConnectedWalletsPage = (): JSX.Element => {\n const { t } = useTranslation()\n const { accounts } = useAccount()\n const { setSelectedBookmark } = useBookmarkActions()\n const { requiredToChainType } = useToAddressRequirements()\n const navigate = useNavigate()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n const listParentRef = useRef<HTMLUListElement | null>(null)\n\n useHeader(t('sendToWallet.connectedWallets'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleWalletSelected = (account: Account) => {\n setFieldValue('toAddress', account.address!, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark({\n name: account.connector?.name,\n address: account.address!,\n chainType: account.chainType!,\n isConnectedAccount: true,\n })\n navigate({\n to: navigationRoutes.home,\n replace: true,\n })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {accounts.map((account) => {\n const walletAddress = shortenAddress(account.address)\n const menuItems = [\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () => {\n if (account.address) {\n navigator.clipboard.writeText(account.address)\n }\n },\n },\n ...(account.chainId\n ? [\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () => {\n if (account.address) {\n openInNewTab(\n getAddressLink(account.address, account.chainId)\n )\n }\n },\n },\n ]\n : []),\n ]\n\n return (\n <ListItem key={account.address} sx={{ position: 'relative' }}>\n <ListItemButton\n onClick={() => handleWalletSelected(account)}\n disabled={\n requiredToChainType &&\n requiredToChainType !== account.chainType\n }\n >\n <ListItemAvatar>\n <AccountAvatar chainId={account.chainId} account={account} />\n </ListItemAvatar>\n <ListItemText\n primary={account.connector?.name}\n secondary={walletAddress}\n />\n </ListItemButton>\n <ContextMenu\n items={menuItems}\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== account.chainType\n )\n }\n />\n </ListItem>\n )\n })}\n {!accounts.length && (\n <EmptyListIndicator\n icon={<Wallet />}\n title={t('sendToWallet.noConnectedWallets')}\n message={t('sendToWallet.noConnectedWalletsMessage')}\n />\n )}\n </List>\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,MAAa,6BAA0C;CACrD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,EAAE,aAAa,WAAW;CAChC,MAAM,EAAE,wBAAwB,mBAAmB;CACnD,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CACvC,MAAM,gBAAgB,OAAgC,IAAI;CAE1D,UAAU,EAAE,+BAA+B,CAAC;CAE5C,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,wBAAwB,YAAqB;EACjD,cAAc,aAAa,QAAQ,SAAU;GAC3C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB;GAClB,MAAM,QAAQ,WAAW;GACzB,SAAS,QAAQ;GACjB,WAAW,QAAQ;GACnB,oBAAoB;EACtB,CAAC;EACD,SAAS;GACP,IAAI,iBAAiB;GACrB,SAAS;EACX,CAAC;CACH;CAEA,OACE,oBAAC,eAAD;EAAe,gBAAA;EACb,UAAA,qBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GALxB,UAAA,CAOG,SAAS,KAAK,YAAY;IACzB,MAAM,gBAAgB,eAAe,QAAQ,OAAO;IACpD,MAAM,YAAY,CAChB;KACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;KAC3B,OAAO,EAAE,oBAAoB;KAC7B,eAAe;MACb,IAAI,QAAQ,SACV,UAAU,UAAU,UAAU,QAAQ,OAAO;KAEjD;IACF,GACA,GAAI,QAAQ,UACR,CACE;KACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;KACzB,OAAO,EAAE,uBAAuB;KAChC,eAAe;MACb,IAAI,QAAQ,SACV,aACE,eAAe,QAAQ,SAAS,QAAQ,OAAO,CACjD;KAEJ;IACF,CACF,IACA,CAAC,CACP;IAEA,OACE,qBAACA,YAAD;KAAgC,IAAI,EAAE,UAAU,WAAW;KAA3D,UAAA,CACE,qBAACC,kBAAD;MACE,eAAe,qBAAqB,OAAO;MAC3C,UACE,uBACA,wBAAwB,QAAQ;MAJpC,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD;OAAe,SAAS,QAAQ;OAAkB;MAAU,CAAA,EAC9C,CAAA,GAChB,oBAAC,cAAD;OACE,SAAS,QAAQ,WAAW;OAC5B,WAAW;MACZ,CAAA,CACa;KAChB,CAAA,GAAA,oBAAC,aAAD;MACE,OAAO;MACP,UACE,CAAC,EACC,uBACA,wBAAwB,QAAQ;KAGrC,CAAA,CACO;IAzBK,GAAA,QAAQ,OAyBb;GAEd,CAAC,GACA,CAAC,SAAS,UACT,oBAAC,oBAAD;IACE,MAAM,oBAAC,QAAD,CAAS,CAAA;IACf,OAAO,EAAE,iCAAiC;IAC1C,SAAS,EAAE,wCAAwC;GACpD,CAAA,CAEC;;CACO,CAAA;AAEnB"}
@@ -6,6 +6,7 @@ import { PageContainer } from "../../components/PageContainer.js";
6
6
  import { defaultChainIdsByType } from "../../utils/chainType.js";
7
7
  import { useToAddressRequirements } from "../../hooks/useToAddressRequirements.js";
8
8
  import { shortenAddress } from "../../utils/wallet.js";
9
+ import { openInNewTab } from "../../utils/url.js";
9
10
  import { useExplorer } from "../../hooks/useExplorer.js";
10
11
  import { useHeader } from "../../hooks/useHeader.js";
11
12
  import { useListHeight } from "../../hooks/useListHeight.js";
@@ -89,7 +90,7 @@ const RecentWalletsPage = () => {
89
90
  {
90
91
  icon: /* @__PURE__ */ jsx(OpenInNewRounded, {}),
91
92
  label: t("button.viewOnExplorer"),
92
- onClick: () => window.open(getAddressLink(recentWallet.address, defaultChainIdsByType[recentWallet.chainType]), "_blank")
93
+ onClick: () => openInNewTab(getAddressLink(recentWallet.address, defaultChainIdsByType[recentWallet.chainType]))
93
94
  },
94
95
  {
95
96
  icon: /* @__PURE__ */ jsx(TurnedInNot, {}),
@@ -1 +1 @@
1
- {"version":3,"file":"RecentWalletsPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/RecentWalletsPage.tsx"],"sourcesContent":["import AccountBalanceWalletIcon from '@mui/icons-material/AccountBalanceWallet'\nimport ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport DeleteOutline from '@mui/icons-material/DeleteOutlined'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport TurnedInNot from '@mui/icons-material/TurnedInNot'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport type { BottomSheetBase } from '../../components/BottomSheet/types.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport type { Bookmark } from '../../stores/bookmarks/types.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useBookmarks } from '../../stores/bookmarks/useBookmarks.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { shortenAddress } from '../../utils/wallet.js'\nimport { BookmarkAddressSheet } from './BookmarkAddressSheet.js'\n\nexport const RecentWalletsPage = (): JSX.Element => {\n const { t } = useTranslation()\n const navigate = useNavigate()\n const [bookmarkTarget, setBookmarkTarget] = useState<Bookmark>()\n const bookmarkAddressSheetRef = useRef<BottomSheetBase>(null)\n const listParentRef = useRef<HTMLUListElement | null>(null)\n const { recentWallets } = useBookmarks()\n const { requiredToChainType } = useToAddressRequirements()\n const {\n removeRecentWallet,\n addBookmark,\n setSelectedBookmark,\n addRecentWallet,\n } = useBookmarkActions()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n\n useHeader(t('header.recentWallets'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleRecentSelected = (recentWallet: Bookmark) => {\n addRecentWallet(recentWallet)\n setFieldValue('toAddress', recentWallet.address, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark(recentWallet)\n navigate({\n to: navigationRoutes.home,\n replace: true,\n })\n }\n\n const handleAddBookmark = (bookmark: Bookmark) => {\n addBookmark(bookmark)\n navigate({ to: navigationRoutes.bookmarks, replace: true })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {recentWallets.map((recentWallet) => (\n <ListItem key={recentWallet.address} sx={{ position: 'relative' }}>\n <ListItemButton\n disabled={\n requiredToChainType &&\n requiredToChainType !== recentWallet.chainType\n }\n onClick={() => handleRecentSelected(recentWallet)}\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[recentWallet.chainType]}\n />\n </ListItemAvatar>\n <ListItemText\n primary={\n recentWallet.name || shortenAddress(recentWallet.address)\n }\n secondary={\n recentWallet.name\n ? shortenAddress(recentWallet.address)\n : undefined\n }\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== recentWallet.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(recentWallet.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n window.open(\n getAddressLink(\n recentWallet.address,\n defaultChainIdsByType[recentWallet.chainType]\n ),\n '_blank'\n ),\n },\n {\n icon: <TurnedInNot />,\n label: t('button.bookmark'),\n onClick: () => {\n setBookmarkTarget(recentWallet)\n bookmarkAddressSheetRef.current?.open()\n },\n },\n {\n icon: <DeleteOutline />,\n label: t('button.delete'),\n onClick: () => removeRecentWallet(recentWallet.address),\n },\n ]}\n />\n </ListItem>\n ))}\n {!recentWallets.length && (\n <EmptyListIndicator\n icon={<AccountBalanceWalletIcon />}\n title={t('sendToWallet.noRecentWallets')}\n message={t('sendToWallet.noRecentWalletsMessage')}\n />\n )}\n </List>\n <BookmarkAddressSheet\n ref={bookmarkAddressSheetRef}\n validatedWallet={bookmarkTarget}\n onAddBookmark={handleAddBookmark}\n />\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,MAAa,0BAAuC;CAClD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,CAAC,gBAAgB,qBAAqB,SAAmB;CAC/D,MAAM,0BAA0B,OAAwB,IAAI;CAC5D,MAAM,gBAAgB,OAAgC,IAAI;CAC1D,MAAM,EAAE,kBAAkB,aAAa;CACvC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EACJ,oBACA,aACA,qBACA,oBACE,mBAAmB;CACvB,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CAEvC,UAAU,EAAE,sBAAsB,CAAC;CAEnC,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,wBAAwB,iBAA2B;EACvD,gBAAgB,YAAY;EAC5B,cAAc,aAAa,aAAa,SAAS;GAC/C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB,YAAY;EAChC,SAAS;GACP,IAAI,iBAAiB;GACrB,SAAS;EACX,CAAC;CACH;CAEA,MAAM,qBAAqB,aAAuB;EAChD,YAAY,QAAQ;EACpB,SAAS;GAAE,IAAI,iBAAiB;GAAW,SAAS;EAAK,CAAC;CAC5D;CAEA,OACE,qBAAC,eAAD;EAAe,gBAAA;EAAf,UAAA,CACE,qBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GALxB,UAAA,CAOG,cAAc,KAAK,iBAClB,qBAACA,YAAD;IAAqC,IAAI,EAAE,UAAU,WAAW;IAAhE,UAAA,CACE,qBAACC,kBAAD;KACE,UACE,uBACA,wBAAwB,aAAa;KAEvC,eAAe,qBAAqB,YAAY;KALlD,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD,EACE,SAAS,sBAAsB,aAAa,WAC7C,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;MACE,SACE,aAAa,QAAQ,eAAe,aAAa,OAAO;MAE1D,WACE,aAAa,OACT,eAAe,aAAa,OAAO,IACnC,KAAA;KAEP,CAAA,CACa;IAChB,CAAA,GAAA,oBAAC,aAAD;KACE,UACE,CAAC,EACC,uBACA,wBAAwB,aAAa;KAGzC,OAAO;MACL;OACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;OAC3B,OAAO,EAAE,oBAAoB;OAC7B,eACE,UAAU,UAAU,UAAU,aAAa,OAAO;MACtD;MACA;OACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;OACzB,OAAO,EAAE,uBAAuB;OAChC,eACE,OAAO,KACL,eACE,aAAa,SACb,sBAAsB,aAAa,UACrC,GACA,QACF;MACJ;MACA;OACE,MAAM,oBAAC,aAAD,CAAc,CAAA;OACpB,OAAO,EAAE,iBAAiB;OAC1B,eAAe;QACb,kBAAkB,YAAY;QAC9B,wBAAwB,SAAS,KAAK;OACxC;MACF;MACA;OACE,MAAM,oBAAC,eAAD,CAAgB,CAAA;OACtB,OAAO,EAAE,eAAe;OACxB,eAAe,mBAAmB,aAAa,OAAO;MACxD;KACF;IACD,CAAA,CACO;GAjEK,GAAA,aAAa,OAiElB,CACX,GACA,CAAC,cAAc,UACd,oBAAC,oBAAD;IACE,MAAM,oBAAC,0BAAD,CAA2B,CAAA;IACjC,OAAO,EAAE,8BAA8B;IACvC,SAAS,EAAE,qCAAqC;GACjD,CAAA,CAEC;EACN,CAAA,GAAA,oBAAC,sBAAD;GACE,KAAK;GACL,iBAAiB;GACjB,eAAe;EAChB,CAAA,CACY;;AAEnB"}
1
+ {"version":3,"file":"RecentWalletsPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/RecentWalletsPage.tsx"],"sourcesContent":["import AccountBalanceWalletIcon from '@mui/icons-material/AccountBalanceWallet'\nimport ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport DeleteOutline from '@mui/icons-material/DeleteOutlined'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport TurnedInNot from '@mui/icons-material/TurnedInNot'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { useNavigate } from '@tanstack/react-router'\nimport { type JSX, useRef, useState } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport type { BottomSheetBase } from '../../components/BottomSheet/types.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { EmptyListIndicator } from '../../components/EmptyListIndicator/EmptyListIndicator.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport type { Bookmark } from '../../stores/bookmarks/types.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useBookmarks } from '../../stores/bookmarks/useBookmarks.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { openInNewTab } from '../../utils/url.js'\nimport { shortenAddress } from '../../utils/wallet.js'\nimport { BookmarkAddressSheet } from './BookmarkAddressSheet.js'\n\nexport const RecentWalletsPage = (): JSX.Element => {\n const { t } = useTranslation()\n const navigate = useNavigate()\n const [bookmarkTarget, setBookmarkTarget] = useState<Bookmark>()\n const bookmarkAddressSheetRef = useRef<BottomSheetBase>(null)\n const listParentRef = useRef<HTMLUListElement | null>(null)\n const { recentWallets } = useBookmarks()\n const { requiredToChainType } = useToAddressRequirements()\n const {\n removeRecentWallet,\n addBookmark,\n setSelectedBookmark,\n addRecentWallet,\n } = useBookmarkActions()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n\n useHeader(t('header.recentWallets'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleRecentSelected = (recentWallet: Bookmark) => {\n addRecentWallet(recentWallet)\n setFieldValue('toAddress', recentWallet.address, {\n isTouched: true,\n isDirty: true,\n })\n setSelectedBookmark(recentWallet)\n navigate({\n to: navigationRoutes.home,\n replace: true,\n })\n }\n\n const handleAddBookmark = (bookmark: Bookmark) => {\n addBookmark(bookmark)\n navigate({ to: navigationRoutes.bookmarks, replace: true })\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {recentWallets.map((recentWallet) => (\n <ListItem key={recentWallet.address} sx={{ position: 'relative' }}>\n <ListItemButton\n disabled={\n requiredToChainType &&\n requiredToChainType !== recentWallet.chainType\n }\n onClick={() => handleRecentSelected(recentWallet)}\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[recentWallet.chainType]}\n />\n </ListItemAvatar>\n <ListItemText\n primary={\n recentWallet.name || shortenAddress(recentWallet.address)\n }\n secondary={\n recentWallet.name\n ? shortenAddress(recentWallet.address)\n : undefined\n }\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== recentWallet.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(recentWallet.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n openInNewTab(\n getAddressLink(\n recentWallet.address,\n defaultChainIdsByType[recentWallet.chainType]\n )\n ),\n },\n {\n icon: <TurnedInNot />,\n label: t('button.bookmark'),\n onClick: () => {\n setBookmarkTarget(recentWallet)\n bookmarkAddressSheetRef.current?.open()\n },\n },\n {\n icon: <DeleteOutline />,\n label: t('button.delete'),\n onClick: () => removeRecentWallet(recentWallet.address),\n },\n ]}\n />\n </ListItem>\n ))}\n {!recentWallets.length && (\n <EmptyListIndicator\n icon={<AccountBalanceWalletIcon />}\n title={t('sendToWallet.noRecentWallets')}\n message={t('sendToWallet.noRecentWalletsMessage')}\n />\n )}\n </List>\n <BookmarkAddressSheet\n ref={bookmarkAddressSheetRef}\n validatedWallet={bookmarkTarget}\n onAddBookmark={handleAddBookmark}\n />\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8BA,MAAa,0BAAuC;CAClD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,CAAC,gBAAgB,qBAAqB,SAAmB;CAC/D,MAAM,0BAA0B,OAAwB,IAAI;CAC5D,MAAM,gBAAgB,OAAgC,IAAI;CAC1D,MAAM,EAAE,kBAAkB,aAAa;CACvC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EACJ,oBACA,aACA,qBACA,oBACE,mBAAmB;CACvB,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CAEvC,UAAU,EAAE,sBAAsB,CAAC;CAEnC,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,wBAAwB,iBAA2B;EACvD,gBAAgB,YAAY;EAC5B,cAAc,aAAa,aAAa,SAAS;GAC/C,WAAW;GACX,SAAS;EACX,CAAC;EACD,oBAAoB,YAAY;EAChC,SAAS;GACP,IAAI,iBAAiB;GACrB,SAAS;EACX,CAAC;CACH;CAEA,MAAM,qBAAqB,aAAuB;EAChD,YAAY,QAAQ;EACpB,SAAS;GAAE,IAAI,iBAAiB;GAAW,SAAS;EAAK,CAAC;CAC5D;CAEA,OACE,qBAAC,eAAD;EAAe,gBAAA;EAAf,UAAA,CACE,qBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GALxB,UAAA,CAOG,cAAc,KAAK,iBAClB,qBAACA,YAAD;IAAqC,IAAI,EAAE,UAAU,WAAW;IAAhE,UAAA,CACE,qBAACC,kBAAD;KACE,UACE,uBACA,wBAAwB,aAAa;KAEvC,eAAe,qBAAqB,YAAY;KALlD,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD,EACE,SAAS,sBAAsB,aAAa,WAC7C,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;MACE,SACE,aAAa,QAAQ,eAAe,aAAa,OAAO;MAE1D,WACE,aAAa,OACT,eAAe,aAAa,OAAO,IACnC,KAAA;KAEP,CAAA,CACa;IAChB,CAAA,GAAA,oBAAC,aAAD;KACE,UACE,CAAC,EACC,uBACA,wBAAwB,aAAa;KAGzC,OAAO;MACL;OACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;OAC3B,OAAO,EAAE,oBAAoB;OAC7B,eACE,UAAU,UAAU,UAAU,aAAa,OAAO;MACtD;MACA;OACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;OACzB,OAAO,EAAE,uBAAuB;OAChC,eACE,aACE,eACE,aAAa,SACb,sBAAsB,aAAa,UACrC,CACF;MACJ;MACA;OACE,MAAM,oBAAC,aAAD,CAAc,CAAA;OACpB,OAAO,EAAE,iBAAiB;OAC1B,eAAe;QACb,kBAAkB,YAAY;QAC9B,wBAAwB,SAAS,KAAK;OACxC;MACF;MACA;OACE,MAAM,oBAAC,eAAD,CAAgB,CAAA;OACtB,OAAO,EAAE,eAAe;OACxB,eAAe,mBAAmB,aAAa,OAAO;MACxD;KACF;IACD,CAAA,CACO;GAhEK,GAAA,aAAa,OAgElB,CACX,GACA,CAAC,cAAc,UACd,oBAAC,oBAAD;IACE,MAAM,oBAAC,0BAAD,CAA2B,CAAA;IACjC,OAAO,EAAE,8BAA8B;IACvC,SAAS,EAAE,qCAAqC;GACjD,CAAA,CAEC;EACN,CAAA,GAAA,oBAAC,sBAAD;GACE,KAAK;GACL,iBAAiB;GACjB,eAAe;EAChB,CAAA,CACY;;AAEnB"}
@@ -6,6 +6,7 @@ import { defaultChainIdsByType } from "../../utils/chainType.js";
6
6
  import { useToAddressRequirements } from "../../hooks/useToAddressRequirements.js";
7
7
  import { useNavigateBack } from "../../hooks/useNavigateBack.js";
8
8
  import { shortenAddress } from "../../utils/wallet.js";
9
+ import { openInNewTab } from "../../utils/url.js";
9
10
  import { useExplorer } from "../../hooks/useExplorer.js";
10
11
  import { useHeader } from "../../hooks/useHeader.js";
11
12
  import { useListHeight } from "../../hooks/useListHeight.js";
@@ -71,7 +72,7 @@ const SendToConfiguredWalletPage = () => {
71
72
  }, {
72
73
  icon: /* @__PURE__ */ jsx(OpenInNewRounded, {}),
73
74
  label: t("button.viewOnExplorer"),
74
- onClick: () => window.open(getAddressLink(toAddress.address, defaultChainIdsByType[toAddress.chainType]), "_blank")
75
+ onClick: () => openInNewTab(getAddressLink(toAddress.address, defaultChainIdsByType[toAddress.chainType]))
75
76
  }]
76
77
  })]
77
78
  }, toAddress.address))
@@ -1 +1 @@
1
- {"version":3,"file":"SendToConfiguredWalletPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/SendToConfiguredWalletPage.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useNavigateBack } from '../../hooks/useNavigateBack.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport type { ToAddress } from '../../types/widget.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { shortenAddress } from '../../utils/wallet.js'\n\nexport const SendToConfiguredWalletPage = (): JSX.Element => {\n const { t } = useTranslation()\n const navigateBack = useNavigateBack()\n const { toAddresses } = useWidgetConfig()\n const { requiredToChainType } = useToAddressRequirements()\n const { setSelectedBookmark } = useBookmarkActions()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n const listParentRef = useRef<HTMLUListElement | null>(null)\n\n useHeader(t('header.sendToWallet'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleCuratedSelected = (toAddress: ToAddress) => {\n setSelectedBookmark(toAddress)\n setFieldValue('toAddress', toAddress.address, {\n isTouched: true,\n isDirty: true,\n })\n navigateBack()\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {toAddresses?.map((toAddress) => (\n <ListItem key={toAddress.address} sx={{ position: 'relative' }}>\n <ListItemButton\n disabled={\n requiredToChainType &&\n requiredToChainType !== toAddress.chainType\n }\n onClick={() => handleCuratedSelected(toAddress)}\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[toAddress.chainType]}\n toAddress={toAddress}\n />\n </ListItemAvatar>\n <ListItemText\n primary={toAddress.name || shortenAddress(toAddress.address)}\n secondary={\n toAddress.name ? shortenAddress(toAddress.address) : undefined\n }\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== toAddress.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(toAddress.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n window.open(\n getAddressLink(\n toAddress.address,\n defaultChainIdsByType[toAddress.chainType]\n ),\n '_blank'\n ),\n },\n ]}\n />\n </ListItem>\n ))}\n </List>\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,mCAAgD;CAC3D,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,eAAe,gBAAgB;CACrC,MAAM,EAAE,gBAAgB,gBAAgB;CACxC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EAAE,wBAAwB,mBAAmB;CACnD,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CACvC,MAAM,gBAAgB,OAAgC,IAAI;CAE1D,UAAU,EAAE,qBAAqB,CAAC;CAElC,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,yBAAyB,cAAyB;EACtD,oBAAoB,SAAS;EAC7B,cAAc,aAAa,UAAU,SAAS;GAC5C,WAAW;GACX,SAAS;EACX,CAAC;EACD,aAAa;CACf;CAEA,OACE,oBAAC,eAAD;EAAe,gBAAA;EACb,UAAA,oBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GAErB,UAAA,aAAa,KAAK,cACjB,qBAACA,YAAD;IAAkC,IAAI,EAAE,UAAU,WAAW;IAA7D,UAAA,CACE,qBAACC,kBAAD;KACE,UACE,uBACA,wBAAwB,UAAU;KAEpC,eAAe,sBAAsB,SAAS;KALhD,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD;MACE,SAAS,sBAAsB,UAAU;MAC9B;KACZ,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;MACE,SAAS,UAAU,QAAQ,eAAe,UAAU,OAAO;MAC3D,WACE,UAAU,OAAO,eAAe,UAAU,OAAO,IAAI,KAAA;KAExD,CAAA,CACa;IAChB,CAAA,GAAA,oBAAC,aAAD;KACE,UACE,CAAC,EACC,uBACA,wBAAwB,UAAU;KAGtC,OAAO,CACL;MACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;MAC3B,OAAO,EAAE,oBAAoB;MAC7B,eACE,UAAU,UAAU,UAAU,UAAU,OAAO;KACnD,GACA;MACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;MACzB,OAAO,EAAE,uBAAuB;MAChC,eACE,OAAO,KACL,eACE,UAAU,SACV,sBAAsB,UAAU,UAClC,GACA,QACF;KACJ,CACF;IACD,CAAA,CACO;GAjDK,GAAA,UAAU,OAiDf,CACX;EACG,CAAA;CACO,CAAA;AAEnB"}
1
+ {"version":3,"file":"SendToConfiguredWalletPage.js","names":["ListItem","ListItemButton"],"sources":["../../../../src/pages/SendToWallet/SendToConfiguredWalletPage.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNewRounded from '@mui/icons-material/OpenInNewRounded'\nimport { List, ListItemAvatar, ListItemText } from '@mui/material'\nimport { type JSX, useRef } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { AccountAvatar } from '../../components/Avatar/AccountAvatar.js'\nimport { ContextMenu } from '../../components/ContextMenu.js'\nimport { ListItem } from '../../components/ListItem/ListItem.js'\nimport { ListItemButton } from '../../components/ListItem/ListItemButton.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useListHeight } from '../../hooks/useListHeight.js'\nimport { useNavigateBack } from '../../hooks/useNavigateBack.js'\nimport { useToAddressRequirements } from '../../hooks/useToAddressRequirements.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { useBookmarkActions } from '../../stores/bookmarks/useBookmarkActions.js'\nimport { useFieldActions } from '../../stores/form/useFieldActions.js'\nimport type { ToAddress } from '../../types/widget.js'\nimport { defaultChainIdsByType } from '../../utils/chainType.js'\nimport { openInNewTab } from '../../utils/url.js'\nimport { shortenAddress } from '../../utils/wallet.js'\n\nexport const SendToConfiguredWalletPage = (): JSX.Element => {\n const { t } = useTranslation()\n const navigateBack = useNavigateBack()\n const { toAddresses } = useWidgetConfig()\n const { requiredToChainType } = useToAddressRequirements()\n const { setSelectedBookmark } = useBookmarkActions()\n const { setFieldValue } = useFieldActions()\n const { getAddressLink } = useExplorer()\n const listParentRef = useRef<HTMLUListElement | null>(null)\n\n useHeader(t('header.sendToWallet'))\n\n const { listHeight } = useListHeight({ listParentRef })\n\n const handleCuratedSelected = (toAddress: ToAddress) => {\n setSelectedBookmark(toAddress)\n setFieldValue('toAddress', toAddress.address, {\n isTouched: true,\n isDirty: true,\n })\n navigateBack()\n }\n\n return (\n <PageContainer disableGutters>\n <List\n className=\"long-list\"\n ref={listParentRef}\n style={{ height: listHeight, overflow: 'auto' }}\n disablePadding\n sx={{ paddingTop: 1.5 }}\n >\n {toAddresses?.map((toAddress) => (\n <ListItem key={toAddress.address} sx={{ position: 'relative' }}>\n <ListItemButton\n disabled={\n requiredToChainType &&\n requiredToChainType !== toAddress.chainType\n }\n onClick={() => handleCuratedSelected(toAddress)}\n >\n <ListItemAvatar>\n <AccountAvatar\n chainId={defaultChainIdsByType[toAddress.chainType]}\n toAddress={toAddress}\n />\n </ListItemAvatar>\n <ListItemText\n primary={toAddress.name || shortenAddress(toAddress.address)}\n secondary={\n toAddress.name ? shortenAddress(toAddress.address) : undefined\n }\n />\n </ListItemButton>\n <ContextMenu\n disabled={\n !!(\n requiredToChainType &&\n requiredToChainType !== toAddress.chainType\n )\n }\n items={[\n {\n icon: <ContentCopyRounded />,\n label: t('button.copyAddress'),\n onClick: () =>\n navigator.clipboard.writeText(toAddress.address),\n },\n {\n icon: <OpenInNewRounded />,\n label: t('button.viewOnExplorer'),\n onClick: () =>\n openInNewTab(\n getAddressLink(\n toAddress.address,\n defaultChainIdsByType[toAddress.chainType]\n )\n ),\n },\n ]}\n />\n </ListItem>\n ))}\n </List>\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAuBA,MAAa,mCAAgD;CAC3D,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,eAAe,gBAAgB;CACrC,MAAM,EAAE,gBAAgB,gBAAgB;CACxC,MAAM,EAAE,wBAAwB,yBAAyB;CACzD,MAAM,EAAE,wBAAwB,mBAAmB;CACnD,MAAM,EAAE,kBAAkB,gBAAgB;CAC1C,MAAM,EAAE,mBAAmB,YAAY;CACvC,MAAM,gBAAgB,OAAgC,IAAI;CAE1D,UAAU,EAAE,qBAAqB,CAAC;CAElC,MAAM,EAAE,eAAe,cAAc,EAAE,cAAc,CAAC;CAEtD,MAAM,yBAAyB,cAAyB;EACtD,oBAAoB,SAAS;EAC7B,cAAc,aAAa,UAAU,SAAS;GAC5C,WAAW;GACX,SAAS;EACX,CAAC;EACD,aAAa;CACf;CAEA,OACE,oBAAC,eAAD;EAAe,gBAAA;EACb,UAAA,oBAAC,MAAD;GACE,WAAU;GACV,KAAK;GACL,OAAO;IAAE,QAAQ;IAAY,UAAU;GAAO;GAC9C,gBAAA;GACA,IAAI,EAAE,YAAY,IAAI;GAErB,UAAA,aAAa,KAAK,cACjB,qBAACA,YAAD;IAAkC,IAAI,EAAE,UAAU,WAAW;IAA7D,UAAA,CACE,qBAACC,kBAAD;KACE,UACE,uBACA,wBAAwB,UAAU;KAEpC,eAAe,sBAAsB,SAAS;KALhD,UAAA,CAOE,oBAAC,gBAAD,EAAA,UACE,oBAAC,eAAD;MACE,SAAS,sBAAsB,UAAU;MAC9B;KACZ,CAAA,EACa,CAAA,GAChB,oBAAC,cAAD;MACE,SAAS,UAAU,QAAQ,eAAe,UAAU,OAAO;MAC3D,WACE,UAAU,OAAO,eAAe,UAAU,OAAO,IAAI,KAAA;KAExD,CAAA,CACa;IAChB,CAAA,GAAA,oBAAC,aAAD;KACE,UACE,CAAC,EACC,uBACA,wBAAwB,UAAU;KAGtC,OAAO,CACL;MACE,MAAM,oBAAC,oBAAD,CAAqB,CAAA;MAC3B,OAAO,EAAE,oBAAoB;MAC7B,eACE,UAAU,UAAU,UAAU,UAAU,OAAO;KACnD,GACA;MACE,MAAM,oBAAC,kBAAD,CAAmB,CAAA;MACzB,OAAO,EAAE,uBAAuB;MAChC,eACE,aACE,eACE,UAAU,SACV,sBAAsB,UAAU,UAClC,CACF;KACJ,CACF;IACD,CAAA,CACO;GAhDK,GAAA,UAAU,OAgDf,CACX;EACG,CAAA;CACO,CAAA;AAEnB"}
@@ -5,6 +5,7 @@ import { PageContainer } from "../../components/PageContainer.js";
5
5
  import { getSourceTxHash } from "../../stores/routes/utils.js";
6
6
  import { useRouteExecutionStore } from "../../stores/routes/RouteExecutionStore.js";
7
7
  import { useTools } from "../../hooks/useTools.js";
8
+ import { isHttpUrl } from "../../utils/url.js";
8
9
  import { useExplorer } from "../../hooks/useExplorer.js";
9
10
  import { useHeader } from "../../hooks/useHeader.js";
10
11
  import { buildRouteFromTxHistory } from "../../utils/converters.js";
@@ -52,7 +53,7 @@ const TransactionDetailsPage = () => {
52
53
  let supportId = getSourceTxHash(routeExecution?.route) ?? routeExecution?.route.id ?? "";
53
54
  const internalTxLink = routeExecution?.route?.steps?.at(-1)?.execution?.internalTxLink;
54
55
  const externalTxLink = routeExecution?.route?.steps?.at(-1)?.execution?.externalTxLink;
55
- const txLink = (url ? internalTxLink?.replace("https://scan.li.fi", url) : internalTxLink) || externalTxLink || getTransactionLink({ txHash: supportId });
56
+ const txLink = [url ? internalTxLink?.replace("https://scan.li.fi", url) : internalTxLink, externalTxLink].find(isHttpUrl) ?? getTransactionLink({ txHash: supportId });
56
57
  if (process.env.NODE_ENV === "development") supportId += `_${routeExecution?.route.id}`;
57
58
  const startedAt = new Date(routeExecution?.route.steps[0].execution?.startedAt ?? 0);
58
59
  if (isLoading && !storedRouteExecution) return /* @__PURE__ */ jsx(TransactionDetailsSkeleton, {});
@@ -1 +1 @@
1
- {"version":3,"file":"TransactionDetailsPage.js","names":[],"sources":["../../../../src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx"],"sourcesContent":["import type { FullStatusData } from '@lifi/sdk'\nimport { useLocation, useNavigate } from '@tanstack/react-router'\nimport { useEffect, useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { ContractComponent } from '../../components/ContractComponent/ContractComponent.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { TransactionCard } from '../../components/TransactionCard/TransactionCard.js'\nimport { internalExplorerUrl } from '../../config/constants.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useTools } from '../../hooks/useTools.js'\nimport { useTransactionDetails } from '../../hooks/useTransactionDetails.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { useRouteExecutionStore } from '../../stores/routes/RouteExecutionStore.js'\nimport { getSourceTxHash } from '../../stores/routes/utils.js'\nimport { buildRouteFromTxHistory } from '../../utils/converters.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { ReceiptsCard } from './ReceiptsCard.js'\nimport { TransactionDetailsSkeleton } from './TransactionDetailsSkeleton.js'\nimport { TransferIdCard } from './TransferIdCard.js'\n\nexport const TransactionDetailsPage: React.FC = () => {\n const { t } = useTranslation()\n const navigate = useNavigate()\n const { mode, modeOptions, contractSecondaryComponent, explorerUrls } =\n useWidgetConfig()\n const { search }: any = useLocation()\n const { tools } = useTools()\n const { getTransactionLink } = useExplorer()\n const storedRouteExecution = useRouteExecutionStore((store) =>\n search?.routeId ? store.routes[search.routeId] : undefined\n )\n const { transaction, isLoading } = useTransactionDetails(\n !storedRouteExecution && search?.transactionHash\n )\n\n const title =\n mode === 'custom'\n ? t(`header.${modeOptions?.custom?.type ?? 'checkout'}Details`)\n : t('header.transactionDetails')\n useHeader(title)\n\n const routeExecution = useMemo(() => {\n if (storedRouteExecution) {\n return storedRouteExecution\n }\n if (isLoading) {\n return\n }\n if (transaction) {\n return buildRouteFromTxHistory(transaction as FullStatusData, tools)\n }\n }, [isLoading, storedRouteExecution, tools, transaction])\n\n useEffect(() => {\n if (!isLoading && !routeExecution) {\n navigate({ to: navigationRoutes.home })\n }\n }, [isLoading, navigate, routeExecution])\n\n const explorerUrl = explorerUrls?.internal?.[0]\n const url = typeof explorerUrl === 'string' ? explorerUrl : explorerUrl?.url\n\n const sourceTxHash = getSourceTxHash(routeExecution?.route)\n let supportId = sourceTxHash ?? routeExecution?.route.id ?? ''\n\n const internalTxLink =\n routeExecution?.route?.steps?.at(-1)?.execution?.internalTxLink\n const externalTxLink =\n routeExecution?.route?.steps?.at(-1)?.execution?.externalTxLink\n\n const txLink =\n (url\n ? internalTxLink?.replace(internalExplorerUrl, url)\n : internalTxLink) ||\n externalTxLink ||\n getTransactionLink({ txHash: supportId })\n\n if (process.env.NODE_ENV === 'development') {\n supportId += `_${routeExecution?.route.id}`\n }\n\n const startedAt = new Date(\n routeExecution?.route.steps[0].execution?.startedAt ?? 0\n )\n\n if (isLoading && !storedRouteExecution) {\n return <TransactionDetailsSkeleton />\n }\n\n if (!routeExecution?.route) {\n return null\n }\n\n return (\n <PageContainer\n topGutters\n bottomGutters\n sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}\n >\n <TransactionCard route={routeExecution.route} date={startedAt} />\n {mode === 'custom' && contractSecondaryComponent ? (\n <ContractComponent>{contractSecondaryComponent}</ContractComponent>\n ) : null}\n <ReceiptsCard route={routeExecution.route} />\n {supportId ? (\n <TransferIdCard transferId={supportId} txLink={txLink} />\n ) : null}\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqBA,MAAa,+BAAyC;CACpD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,MAAM,aAAa,4BAA4B,iBACrD,gBAAgB;CAClB,MAAM,EAAE,WAAgB,YAAY;CACpC,MAAM,EAAE,UAAU,SAAS;CAC3B,MAAM,EAAE,uBAAuB,YAAY;CAC3C,MAAM,uBAAuB,wBAAwB,UACnD,QAAQ,UAAU,MAAM,OAAO,OAAO,WAAW,KAAA,CACnD;CACA,MAAM,EAAE,aAAa,cAAc,sBACjC,CAAC,wBAAwB,QAAQ,eACnC;CAEA,MAAM,QACJ,SAAS,WACL,EAAE,UAAU,aAAa,QAAQ,QAAQ,WAAW,QAAQ,IAC5D,EAAE,2BAA2B;CACnC,UAAU,KAAK;CAEf,MAAM,iBAAiB,cAAc;EACnC,IAAI,sBACF,OAAO;EAET,IAAI,WACF;EAEF,IAAI,aACF,OAAO,wBAAwB,aAA+B,KAAK;CAEvE,GAAG;EAAC;EAAW;EAAsB;EAAO;CAAW,CAAC;CAExD,gBAAgB;EACd,IAAI,CAAC,aAAa,CAAC,gBACjB,SAAS,EAAE,IAAI,iBAAiB,KAAK,CAAC;CAE1C,GAAG;EAAC;EAAW;EAAU;CAAc,CAAC;CAExC,MAAM,cAAc,cAAc,WAAW;CAC7C,MAAM,MAAM,OAAO,gBAAgB,WAAW,cAAc,aAAa;CAGzE,IAAI,YADiB,gBAAgB,gBAAgB,KAC1B,KAAK,gBAAgB,MAAM,MAAM;CAE5D,MAAM,iBACJ,gBAAgB,OAAO,OAAO,GAAG,EAAE,CAAC,EAAE,WAAW;CACnD,MAAM,iBACJ,gBAAgB,OAAO,OAAO,GAAG,EAAE,CAAC,EAAE,WAAW;CAEnD,MAAM,UACH,MACG,gBAAgB,QAAA,sBAA6B,GAAG,IAChD,mBACJ,kBACA,mBAAmB,EAAE,QAAQ,UAAU,CAAC;CAE1C,IAAI,QAAQ,IAAI,aAAa,eAC3B,aAAa,IAAI,gBAAgB,MAAM;CAGzC,MAAM,YAAY,IAAI,KACpB,gBAAgB,MAAM,MAAM,EAAE,CAAC,WAAW,aAAa,CACzD;CAEA,IAAI,aAAa,CAAC,sBAChB,OAAO,oBAAC,4BAAD,CAA6B,CAAA;CAGtC,IAAI,CAAC,gBAAgB,OACnB,OAAO;CAGT,OACE,qBAAC,eAAD;EACE,YAAA;EACA,eAAA;EACA,IAAI;GAAE,SAAS;GAAQ,eAAe;GAAU,KAAK;EAAE;EAHzD,UAAA;GAKE,oBAAC,iBAAD;IAAiB,OAAO,eAAe;IAAO,MAAM;GAAY,CAAA;GAC/D,SAAS,YAAY,6BACpB,oBAAC,mBAAD,EAAA,UAAoB,2BAA8C,CAAA,IAChE;GACJ,oBAAC,cAAD,EAAc,OAAO,eAAe,MAAQ,CAAA;GAC3C,YACC,oBAAC,gBAAD;IAAgB,YAAY;IAAmB;GAAS,CAAA,IACtD;EACS;;AAEnB"}
1
+ {"version":3,"file":"TransactionDetailsPage.js","names":[],"sources":["../../../../src/pages/TransactionDetailsPage/TransactionDetailsPage.tsx"],"sourcesContent":["import type { FullStatusData } from '@lifi/sdk'\nimport { useLocation, useNavigate } from '@tanstack/react-router'\nimport { useEffect, useMemo } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { ContractComponent } from '../../components/ContractComponent/ContractComponent.js'\nimport { PageContainer } from '../../components/PageContainer.js'\nimport { TransactionCard } from '../../components/TransactionCard/TransactionCard.js'\nimport { internalExplorerUrl } from '../../config/constants.js'\nimport { useExplorer } from '../../hooks/useExplorer.js'\nimport { useHeader } from '../../hooks/useHeader.js'\nimport { useTools } from '../../hooks/useTools.js'\nimport { useTransactionDetails } from '../../hooks/useTransactionDetails.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { useRouteExecutionStore } from '../../stores/routes/RouteExecutionStore.js'\nimport { getSourceTxHash } from '../../stores/routes/utils.js'\nimport { buildRouteFromTxHistory } from '../../utils/converters.js'\nimport { navigationRoutes } from '../../utils/navigationRoutes.js'\nimport { isHttpUrl } from '../../utils/url.js'\nimport { ReceiptsCard } from './ReceiptsCard.js'\nimport { TransactionDetailsSkeleton } from './TransactionDetailsSkeleton.js'\nimport { TransferIdCard } from './TransferIdCard.js'\n\nexport const TransactionDetailsPage: React.FC = () => {\n const { t } = useTranslation()\n const navigate = useNavigate()\n const { mode, modeOptions, contractSecondaryComponent, explorerUrls } =\n useWidgetConfig()\n const { search }: any = useLocation()\n const { tools } = useTools()\n const { getTransactionLink } = useExplorer()\n const storedRouteExecution = useRouteExecutionStore((store) =>\n search?.routeId ? store.routes[search.routeId] : undefined\n )\n const { transaction, isLoading } = useTransactionDetails(\n !storedRouteExecution && search?.transactionHash\n )\n\n const title =\n mode === 'custom'\n ? t(`header.${modeOptions?.custom?.type ?? 'checkout'}Details`)\n : t('header.transactionDetails')\n useHeader(title)\n\n const routeExecution = useMemo(() => {\n if (storedRouteExecution) {\n return storedRouteExecution\n }\n if (isLoading) {\n return\n }\n if (transaction) {\n return buildRouteFromTxHistory(transaction as FullStatusData, tools)\n }\n }, [isLoading, storedRouteExecution, tools, transaction])\n\n useEffect(() => {\n if (!isLoading && !routeExecution) {\n navigate({ to: navigationRoutes.home })\n }\n }, [isLoading, navigate, routeExecution])\n\n const explorerUrl = explorerUrls?.internal?.[0]\n const url = typeof explorerUrl === 'string' ? explorerUrl : explorerUrl?.url\n\n const sourceTxHash = getSourceTxHash(routeExecution?.route)\n let supportId = sourceTxHash ?? routeExecution?.route.id ?? ''\n\n const internalTxLink =\n routeExecution?.route?.steps?.at(-1)?.execution?.internalTxLink\n const externalTxLink =\n routeExecution?.route?.steps?.at(-1)?.execution?.externalTxLink\n\n const txLink =\n [\n url ? internalTxLink?.replace(internalExplorerUrl, url) : internalTxLink,\n externalTxLink,\n ].find(isHttpUrl) ?? getTransactionLink({ txHash: supportId })\n\n if (process.env.NODE_ENV === 'development') {\n supportId += `_${routeExecution?.route.id}`\n }\n\n const startedAt = new Date(\n routeExecution?.route.steps[0].execution?.startedAt ?? 0\n )\n\n if (isLoading && !storedRouteExecution) {\n return <TransactionDetailsSkeleton />\n }\n\n if (!routeExecution?.route) {\n return null\n }\n\n return (\n <PageContainer\n topGutters\n bottomGutters\n sx={{ display: 'flex', flexDirection: 'column', gap: 2 }}\n >\n <TransactionCard route={routeExecution.route} date={startedAt} />\n {mode === 'custom' && contractSecondaryComponent ? (\n <ContractComponent>{contractSecondaryComponent}</ContractComponent>\n ) : null}\n <ReceiptsCard route={routeExecution.route} />\n {supportId ? (\n <TransferIdCard transferId={supportId} txLink={txLink} />\n ) : null}\n </PageContainer>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsBA,MAAa,+BAAyC;CACpD,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,WAAW,YAAY;CAC7B,MAAM,EAAE,MAAM,aAAa,4BAA4B,iBACrD,gBAAgB;CAClB,MAAM,EAAE,WAAgB,YAAY;CACpC,MAAM,EAAE,UAAU,SAAS;CAC3B,MAAM,EAAE,uBAAuB,YAAY;CAC3C,MAAM,uBAAuB,wBAAwB,UACnD,QAAQ,UAAU,MAAM,OAAO,OAAO,WAAW,KAAA,CACnD;CACA,MAAM,EAAE,aAAa,cAAc,sBACjC,CAAC,wBAAwB,QAAQ,eACnC;CAEA,MAAM,QACJ,SAAS,WACL,EAAE,UAAU,aAAa,QAAQ,QAAQ,WAAW,QAAQ,IAC5D,EAAE,2BAA2B;CACnC,UAAU,KAAK;CAEf,MAAM,iBAAiB,cAAc;EACnC,IAAI,sBACF,OAAO;EAET,IAAI,WACF;EAEF,IAAI,aACF,OAAO,wBAAwB,aAA+B,KAAK;CAEvE,GAAG;EAAC;EAAW;EAAsB;EAAO;CAAW,CAAC;CAExD,gBAAgB;EACd,IAAI,CAAC,aAAa,CAAC,gBACjB,SAAS,EAAE,IAAI,iBAAiB,KAAK,CAAC;CAE1C,GAAG;EAAC;EAAW;EAAU;CAAc,CAAC;CAExC,MAAM,cAAc,cAAc,WAAW;CAC7C,MAAM,MAAM,OAAO,gBAAgB,WAAW,cAAc,aAAa;CAGzE,IAAI,YADiB,gBAAgB,gBAAgB,KAC1B,KAAK,gBAAgB,MAAM,MAAM;CAE5D,MAAM,iBACJ,gBAAgB,OAAO,OAAO,GAAG,EAAE,CAAC,EAAE,WAAW;CACnD,MAAM,iBACJ,gBAAgB,OAAO,OAAO,GAAG,EAAE,CAAC,EAAE,WAAW;CAEnD,MAAM,SACJ,CACE,MAAM,gBAAgB,QAAA,sBAA6B,GAAG,IAAI,gBAC1D,cACF,CAAC,CAAC,KAAK,SAAS,KAAK,mBAAmB,EAAE,QAAQ,UAAU,CAAC;CAE/D,IAAI,QAAQ,IAAI,aAAa,eAC3B,aAAa,IAAI,gBAAgB,MAAM;CAGzC,MAAM,YAAY,IAAI,KACpB,gBAAgB,MAAM,MAAM,EAAE,CAAC,WAAW,aAAa,CACzD;CAEA,IAAI,aAAa,CAAC,sBAChB,OAAO,oBAAC,4BAAD,CAA6B,CAAA;CAGtC,IAAI,CAAC,gBAAgB,OACnB,OAAO;CAGT,OACE,qBAAC,eAAD;EACE,YAAA;EACA,eAAA;EACA,IAAI;GAAE,SAAS;GAAQ,eAAe;GAAU,KAAK;EAAE;EAHzD,UAAA;GAKE,oBAAC,iBAAD;IAAiB,OAAO,eAAe;IAAO,MAAM;GAAY,CAAA;GAC/D,SAAS,YAAY,6BACpB,oBAAC,mBAAD,EAAA,UAAoB,2BAA8C,CAAA,IAChE;GACJ,oBAAC,cAAD,EAAc,OAAO,eAAe,MAAQ,CAAA;GAC3C,YACC,oBAAC,gBAAD;IAAgB,YAAY;IAAmB;GAAS,CAAA,IACtD;EACS;;AAEnB"}
@@ -1,6 +1,7 @@
1
1
  import { useWidgetConfig } from "../../providers/WidgetProvider/WidgetProvider.js";
2
2
  import { Card as Card$1 } from "../../components/Card/Card.js";
3
3
  import { CardIconButton } from "../../components/Card/CardIconButton.js";
4
+ import { openInNewTab } from "../../utils/url.js";
4
5
  import { CardTitle } from "../../components/Card/CardTitle.js";
5
6
  import { ContactSupportButton } from "./ContactSupportButton.js";
6
7
  import { Box, Typography } from "@mui/material";
@@ -16,7 +17,7 @@ const TransferIdCard = ({ transferId, txLink }) => {
16
17
  await navigator.clipboard.writeText(transferId);
17
18
  };
18
19
  const openTransferIdInExplorer = () => {
19
- window.open(txLink, "_blank");
20
+ openInNewTab(txLink);
20
21
  };
21
22
  return /* @__PURE__ */ jsxs(Card$1, {
22
23
  type: "default",
@@ -1 +1 @@
1
- {"version":3,"file":"TransferIdCard.js","names":["Card"],"sources":["../../../../src/pages/TransactionDetailsPage/TransferIdCard.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNew from '@mui/icons-material/OpenInNew'\nimport { Box, Typography } from '@mui/material'\nimport type { JSX } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Card } from '../../components/Card/Card.js'\nimport { CardIconButton } from '../../components/Card/CardIconButton.js'\nimport { CardTitle } from '../../components/Card/CardTitle.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { ContactSupportButton } from './ContactSupportButton.js'\n\ninterface TransferIdCardProps {\n transferId: string\n txLink?: string\n}\n\nexport const TransferIdCard = ({\n transferId,\n txLink,\n}: TransferIdCardProps): JSX.Element => {\n const { t } = useTranslation()\n const { hiddenUI } = useWidgetConfig()\n\n const copyTransferId = async () => {\n await navigator.clipboard.writeText(transferId)\n }\n\n const openTransferIdInExplorer = () => {\n window.open(txLink, '_blank')\n }\n\n return (\n <Card type=\"default\" indented>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <CardTitle sx={{ p: 0 }}>{t('main.transferId')}</CardTitle>\n <Box\n sx={{\n gap: 1,\n display: 'flex',\n }}\n >\n <CardIconButton size=\"small\" onClick={copyTransferId}>\n <ContentCopyRounded fontSize=\"inherit\" />\n </CardIconButton>\n {txLink ? (\n <CardIconButton size=\"small\" onClick={openTransferIdInExplorer}>\n <OpenInNew fontSize=\"inherit\" />\n </CardIconButton>\n ) : null}\n {!hiddenUI?.contactSupport ? (\n <ContactSupportButton supportId={transferId} />\n ) : null}\n </Box>\n </Box>\n <Typography\n variant=\"body2\"\n sx={{\n pt: 2,\n wordBreak: 'break-all',\n }}\n >\n {transferId}\n </Typography>\n </Card>\n )\n}\n"],"mappings":";;;;;;;;;;;AAgBA,MAAa,kBAAkB,EAC7B,YACA,aACsC;CACtC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,EAAE,aAAa,gBAAgB;CAErC,MAAM,iBAAiB,YAAY;EACjC,MAAM,UAAU,UAAU,UAAU,UAAU;CAChD;CAEA,MAAM,iCAAiC;EACrC,OAAO,KAAK,QAAQ,QAAQ;CAC9B;CAEA,OACE,qBAACA,QAAD;EAAM,MAAK;EAAU,UAAA;EAArB,UAAA,CACE,qBAAC,KAAD;GACE,IAAI;IACF,SAAS;IACT,YAAY;IACZ,gBAAgB;GAClB;GALF,UAAA,CAOE,oBAAC,WAAD;IAAW,IAAI,EAAE,GAAG,EAAE;IAAI,UAAA,EAAE,iBAAiB;GAAa,CAAA,GAC1D,qBAAC,KAAD;IACE,IAAI;KACF,KAAK;KACL,SAAS;IACX;IAJF,UAAA;KAME,oBAAC,gBAAD;MAAgB,MAAK;MAAQ,SAAS;MACpC,UAAA,oBAAC,oBAAD,EAAoB,UAAS,UAAW,CAAA;KAC1B,CAAA;KACf,SACC,oBAAC,gBAAD;MAAgB,MAAK;MAAQ,SAAS;MACpC,UAAA,oBAAC,WAAD,EAAW,UAAS,UAAW,CAAA;KACjB,CAAA,IACd;KACH,CAAC,UAAU,iBACV,oBAAC,sBAAD,EAAsB,WAAW,WAAa,CAAA,IAC5C;IACD;GACF,CAAA,CAAA;EACL,CAAA,GAAA,oBAAC,YAAD;GACE,SAAQ;GACR,IAAI;IACF,IAAI;IACJ,WAAW;GACb;GAEC,UAAA;EACS,CAAA,CACR;;AAEV"}
1
+ {"version":3,"file":"TransferIdCard.js","names":["Card"],"sources":["../../../../src/pages/TransactionDetailsPage/TransferIdCard.tsx"],"sourcesContent":["import ContentCopyRounded from '@mui/icons-material/ContentCopyRounded'\nimport OpenInNew from '@mui/icons-material/OpenInNew'\nimport { Box, Typography } from '@mui/material'\nimport type { JSX } from 'react'\nimport { useTranslation } from 'react-i18next'\nimport { Card } from '../../components/Card/Card.js'\nimport { CardIconButton } from '../../components/Card/CardIconButton.js'\nimport { CardTitle } from '../../components/Card/CardTitle.js'\nimport { useWidgetConfig } from '../../providers/WidgetProvider/WidgetProvider.js'\nimport { openInNewTab } from '../../utils/url.js'\nimport { ContactSupportButton } from './ContactSupportButton.js'\n\ninterface TransferIdCardProps {\n transferId: string\n txLink?: string\n}\n\nexport const TransferIdCard = ({\n transferId,\n txLink,\n}: TransferIdCardProps): JSX.Element => {\n const { t } = useTranslation()\n const { hiddenUI } = useWidgetConfig()\n\n const copyTransferId = async () => {\n await navigator.clipboard.writeText(transferId)\n }\n\n const openTransferIdInExplorer = () => {\n openInNewTab(txLink)\n }\n\n return (\n <Card type=\"default\" indented>\n <Box\n sx={{\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'space-between',\n }}\n >\n <CardTitle sx={{ p: 0 }}>{t('main.transferId')}</CardTitle>\n <Box\n sx={{\n gap: 1,\n display: 'flex',\n }}\n >\n <CardIconButton size=\"small\" onClick={copyTransferId}>\n <ContentCopyRounded fontSize=\"inherit\" />\n </CardIconButton>\n {txLink ? (\n <CardIconButton size=\"small\" onClick={openTransferIdInExplorer}>\n <OpenInNew fontSize=\"inherit\" />\n </CardIconButton>\n ) : null}\n {!hiddenUI?.contactSupport ? (\n <ContactSupportButton supportId={transferId} />\n ) : null}\n </Box>\n </Box>\n <Typography\n variant=\"body2\"\n sx={{\n pt: 2,\n wordBreak: 'break-all',\n }}\n >\n {transferId}\n </Typography>\n </Card>\n )\n}\n"],"mappings":";;;;;;;;;;;;AAiBA,MAAa,kBAAkB,EAC7B,YACA,aACsC;CACtC,MAAM,EAAE,MAAM,eAAe;CAC7B,MAAM,EAAE,aAAa,gBAAgB;CAErC,MAAM,iBAAiB,YAAY;EACjC,MAAM,UAAU,UAAU,UAAU,UAAU;CAChD;CAEA,MAAM,iCAAiC;EACrC,aAAa,MAAM;CACrB;CAEA,OACE,qBAACA,QAAD;EAAM,MAAK;EAAU,UAAA;EAArB,UAAA,CACE,qBAAC,KAAD;GACE,IAAI;IACF,SAAS;IACT,YAAY;IACZ,gBAAgB;GAClB;GALF,UAAA,CAOE,oBAAC,WAAD;IAAW,IAAI,EAAE,GAAG,EAAE;IAAI,UAAA,EAAE,iBAAiB;GAAa,CAAA,GAC1D,qBAAC,KAAD;IACE,IAAI;KACF,KAAK;KACL,SAAS;IACX;IAJF,UAAA;KAME,oBAAC,gBAAD;MAAgB,MAAK;MAAQ,SAAS;MACpC,UAAA,oBAAC,oBAAD,EAAoB,UAAS,UAAW,CAAA;KAC1B,CAAA;KACf,SACC,oBAAC,gBAAD;MAAgB,MAAK;MAAQ,SAAS;MACpC,UAAA,oBAAC,WAAD,EAAW,UAAS,UAAW,CAAA;KACjB,CAAA,IACd;KACH,CAAC,UAAU,iBACV,oBAAC,sBAAD,EAAsB,WAAW,WAAa,CAAA,IAC5C;IACD;GACF,CAAA,CAAA;EACL,CAAA,GAAA,oBAAC,YAAD;GACE,SAAQ;GACR,IAAI;IACF,IAAI;IACJ,WAAW;GACb;GAEC,UAAA;EACS,CAAA,CACR;;AAEV"}
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/providers/I18nProvider/types.ts"],"mappings":";;YAEY,gBAAgB,KAAK,sBAE1B,WAAW,KAAK,gBAAgB,EAAE,SAErC;YAEQ;YAmBA,0BAA0B;YAE1B,uBAEL,KAAK,eAAe,gBAAgB;GAGjB,mBAAA,gBAAgB"}
1
+ {"version":3,"file":"types.d.ts","names":["enResource"],"sources":["../../../../src/providers/I18nProvider/types.ts"],"mappings":";;YAEY,gBAAgB,KAAK,sBAE1B,WAAW,KAAK,gBAAgB,EAAE,SAErC;YAEQ;YAmBA,0BAA0BA;YAE1B,uBAEL,KAAK,eAAe,gBAAgB;GAGjB,mBAAA,gBAAgB"}
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.d.ts","names":[],"sources":["../../../../src/providers/WidgetProvider/WidgetProvider.tsx"],"mappings":";;;qBAaa,uBAAsB;qBAEtB,gBAAgB,MAAM,GACjC,MAAM,kBAAkB"}
1
+ {"version":3,"file":"WidgetProvider.d.ts","names":[],"sources":["../../../../src/providers/WidgetProvider/WidgetProvider.tsx"],"mappings":";;;qBAmBa,uBAAsB;qBAEtB,gBAAgB,MAAM,GACjC,MAAM,kBAAkB"}
@@ -1,9 +1,11 @@
1
1
  import { useSettingsActions } from "../../stores/settings/useSettingsActions.js";
2
+ import { defaultQueryScopeKey, resolveQueryScopeKey, resolveStorageScopeKey } from "../../utils/scopeKeys.js";
2
3
  import { createContext, use, useId, useMemo } from "react";
3
4
  import { jsx } from "react/jsx-runtime";
4
5
  const WidgetContext = createContext({
5
6
  elementId: "",
6
- integrator: ""
7
+ integrator: "",
8
+ queryScopeKey: defaultQueryScopeKey
7
9
  });
8
10
  const useWidgetConfig = () => use(WidgetContext);
9
11
  const WidgetProvider = ({ children, config: widgetConfig }) => {
@@ -11,9 +13,14 @@ const WidgetProvider = ({ children, config: widgetConfig }) => {
11
13
  const { setDefaultSettings } = useSettingsActions();
12
14
  if (!widgetConfig?.integrator) throw new Error("Required property \"integrator\" is missing.");
13
15
  const value = useMemo(() => {
16
+ const scopeKeys = {
17
+ storageScopeKey: resolveStorageScopeKey(widgetConfig),
18
+ queryScopeKey: resolveQueryScopeKey(widgetConfig)
19
+ };
14
20
  try {
15
21
  const value = {
16
22
  ...widgetConfig,
23
+ ...scopeKeys,
17
24
  elementId
18
25
  };
19
26
  setDefaultSettings(value);
@@ -22,6 +29,7 @@ const WidgetProvider = ({ children, config: widgetConfig }) => {
22
29
  console.warn(e);
23
30
  return {
24
31
  ...widgetConfig,
32
+ ...scopeKeys,
25
33
  elementId,
26
34
  integrator: widgetConfig.integrator
27
35
  };
@@ -1 +1 @@
1
- {"version":3,"file":"WidgetProvider.js","names":[],"sources":["../../../../src/providers/WidgetProvider/WidgetProvider.tsx"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext, use, useId, useMemo } from 'react'\nimport { useSettingsActions } from '../../stores/settings/useSettingsActions.js'\nimport type { WidgetContextProps, WidgetProviderProps } from './types.js'\n\nconst initialContext: WidgetContextProps = {\n elementId: '',\n integrator: '',\n}\n\nexport const WidgetContext: Context<WidgetContextProps> =\n createContext<WidgetContextProps>(initialContext)\n\nexport const useWidgetConfig = (): WidgetContextProps => use(WidgetContext)\n\nexport const WidgetProvider: React.FC<\n React.PropsWithChildren<WidgetProviderProps>\n> = ({ children, config: widgetConfig }) => {\n const elementId = useId()\n const { setDefaultSettings } = useSettingsActions()\n\n if (!widgetConfig?.integrator) {\n throw new Error('Required property \"integrator\" is missing.')\n }\n\n const value = useMemo((): WidgetContextProps => {\n try {\n // Create widget configuration object\n const value = {\n ...widgetConfig,\n elementId,\n } as WidgetContextProps\n\n // Set default settings for widget settings store\n setDefaultSettings(value)\n\n return value\n } catch (e) {\n console.warn(e)\n return {\n ...widgetConfig,\n elementId,\n integrator: widgetConfig.integrator,\n }\n }\n }, [elementId, widgetConfig, setDefaultSettings])\n return <WidgetContext value={value}>{children}</WidgetContext>\n}\n"],"mappings":";;;AAUA,MAAa,gBACX,cAAkC;CALlC,WAAW;CACX,YAAY;AAIsB,CAAc;AAElD,MAAa,wBAA4C,IAAI,aAAa;AAE1E,MAAa,kBAER,EAAE,UAAU,QAAQ,mBAAmB;CAC1C,MAAM,YAAY,MAAM;CACxB,MAAM,EAAE,uBAAuB,mBAAmB;CAElD,IAAI,CAAC,cAAc,YACjB,MAAM,IAAI,MAAM,8CAA4C;CAG9D,MAAM,QAAQ,cAAkC;EAC9C,IAAI;GAEF,MAAM,QAAQ;IACZ,GAAG;IACH;GACF;GAGA,mBAAmB,KAAK;GAExB,OAAO;EACT,SAAS,GAAG;GACV,QAAQ,KAAK,CAAC;GACd,OAAO;IACL,GAAG;IACH;IACA,YAAY,aAAa;GAC3B;EACF;CACF,GAAG;EAAC;EAAW;EAAc;CAAkB,CAAC;CAChD,OAAO,oBAAC,eAAD;EAAsB;EAAQ;CAAwB,CAAA;AAC/D"}
1
+ {"version":3,"file":"WidgetProvider.js","names":[],"sources":["../../../../src/providers/WidgetProvider/WidgetProvider.tsx"],"sourcesContent":["import type { Context } from 'react'\nimport { createContext, use, useId, useMemo } from 'react'\nimport { useSettingsActions } from '../../stores/settings/useSettingsActions.js'\nimport {\n defaultQueryScopeKey,\n resolveQueryScopeKey,\n resolveStorageScopeKey,\n} from '../../utils/scopeKeys.js'\nimport type { WidgetContextProps, WidgetProviderProps } from './types.js'\n\nconst initialContext: WidgetContextProps = {\n elementId: '',\n integrator: '',\n queryScopeKey: defaultQueryScopeKey,\n}\n\nexport const WidgetContext: Context<WidgetContextProps> =\n createContext<WidgetContextProps>(initialContext)\n\nexport const useWidgetConfig = (): WidgetContextProps => use(WidgetContext)\n\nexport const WidgetProvider: React.FC<\n React.PropsWithChildren<WidgetProviderProps>\n> = ({ children, config: widgetConfig }) => {\n const elementId = useId()\n const { setDefaultSettings } = useSettingsActions()\n\n if (!widgetConfig?.integrator) {\n throw new Error('Required property \"integrator\" is missing.')\n }\n\n const value = useMemo((): WidgetContextProps => {\n // Resolved once, so nothing below reads the deprecated keyPrefix.\n const scopeKeys = {\n storageScopeKey: resolveStorageScopeKey(widgetConfig),\n queryScopeKey: resolveQueryScopeKey(widgetConfig),\n }\n try {\n // Create widget configuration object\n const value = {\n ...widgetConfig,\n ...scopeKeys,\n elementId,\n } as WidgetContextProps\n\n // Set default settings for widget settings store\n setDefaultSettings(value)\n\n return value\n } catch (e) {\n console.warn(e)\n return {\n ...widgetConfig,\n ...scopeKeys,\n elementId,\n integrator: widgetConfig.integrator,\n }\n }\n }, [elementId, widgetConfig, setDefaultSettings])\n return <WidgetContext value={value}>{children}</WidgetContext>\n}\n"],"mappings":";;;;AAgBA,MAAa,gBACX,cAAkC;CANlC,WAAW;CACX,YAAY;CACZ,eAAe;AAImB,CAAc;AAElD,MAAa,wBAA4C,IAAI,aAAa;AAE1E,MAAa,kBAER,EAAE,UAAU,QAAQ,mBAAmB;CAC1C,MAAM,YAAY,MAAM;CACxB,MAAM,EAAE,uBAAuB,mBAAmB;CAElD,IAAI,CAAC,cAAc,YACjB,MAAM,IAAI,MAAM,8CAA4C;CAG9D,MAAM,QAAQ,cAAkC;EAE9C,MAAM,YAAY;GAChB,iBAAiB,uBAAuB,YAAY;GACpD,eAAe,qBAAqB,YAAY;EAClD;EACA,IAAI;GAEF,MAAM,QAAQ;IACZ,GAAG;IACH,GAAG;IACH;GACF;GAGA,mBAAmB,KAAK;GAExB,OAAO;EACT,SAAS,GAAG;GACV,QAAQ,KAAK,CAAC;GACd,OAAO;IACL,GAAG;IACH,GAAG;IACH;IACA,YAAY,aAAa;GAC3B;EACF;CACF,GAAG;EAAC;EAAW;EAAc;CAAkB,CAAC;CAChD,OAAO,oBAAC,eAAD;EAAsB;EAAQ;CAAwB,CAAA;AAC/D"}
@@ -2,6 +2,8 @@ import { WidgetConfig } from "../../types/widget.js";
2
2
  //#region src/providers/WidgetProvider/types.d.ts
3
3
  export type WidgetContextProps = WidgetConfig & {
4
4
  elementId: string;
5
+ /** Always resolved by `WidgetProvider` — see `resolveQueryScopeKey`. */
6
+ queryScopeKey: string;
5
7
  };
6
8
  export interface WidgetProviderProps {
7
9
  config?: WidgetConfig;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/providers/WidgetProvider/types.ts"],"mappings":";;YAEY,qBAAqB;EAC/B;;iBAGe;EACf,SAAS"}
1
+ {"version":3,"file":"types.d.ts","names":[],"sources":["../../../../src/providers/WidgetProvider/types.ts"],"mappings":";;YAEY,qBAAqB;EAC/B;;EAEA;;iBAGe;EACf,SAAS"}
@@ -0,0 +1,38 @@
1
+ import { FactoryQueryOptions, QueryParameter, ScopeKeyParameter } from "./types.js";
2
+ import { ChainType, ExtendedChain, SDKClient } from "@lifi/sdk";
3
+ //#region src/queries/getChains.d.ts
4
+ /** Every chain type the widget supports, in the order keys are built in. */
5
+ export declare const supportedChainTypes: readonly ChainType[];
6
+ export type GetChainsQueryFnData = ExtendedChain[];
7
+ export type GetChainsQueryKeyParameters = {
8
+ /** API base the client talks to. Different bases return different chains. */
9
+ apiUrl: string;
10
+ chainTypes: readonly ChainType[];
11
+ } & ScopeKeyParameter;
12
+ export type GetChainsQueryKey = readonly ["chains", {
13
+ apiUrl: string;
14
+ chainTypes: ChainType[];
15
+ scopeKey?: string;
16
+ }];
17
+ /** The key alone — to read, set or invalidate the entry. */
18
+ export declare function getChainsQueryKey(parameters: GetChainsQueryKeyParameters): GetChainsQueryKey;
19
+ export type GetChainsOptions<selectData = GetChainsQueryFnData> = {
20
+ /** Chain types to request, in any order. Defaults to every supported type. */
21
+ chainTypes?: readonly ChainType[] | undefined;
22
+ } & ScopeKeyParameter & QueryParameter<GetChainsQueryFnData, selectData, GetChainsQueryKey>;
23
+ export type GetChainsQueryOptions<selectData = GetChainsQueryFnData> = FactoryQueryOptions<GetChainsQueryFnData, selectData, GetChainsQueryKey>;
24
+ /**
25
+ * Query options for the chain list of one API base.
26
+ *
27
+ * The key is `['chains', { apiUrl, chainTypes, scopeKey }]`: the API base and
28
+ * the requested types decide the response, the scope isolates integrations.
29
+ * The widget and a host app that build their options here, with the same
30
+ * scope, therefore share one cache entry and one request.
31
+ *
32
+ * The query has no side effects. A caller that needs the chains in its SDK
33
+ * client's storage calls `client.setChains` on the data — the entry may have
34
+ * been filled by another caller, so a `queryFn` cannot be relied on to run.
35
+ */
36
+ export declare function getChainsQueryOptions<selectData = GetChainsQueryFnData>(client: SDKClient, options?: GetChainsOptions<selectData>): GetChainsQueryOptions<selectData>;
37
+ //#endregion
38
+ //# sourceMappingURL=getChains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getChains.d.ts","names":[],"sources":["../../../src/queries/getChains.ts"],"mappings":";;;;qBASa,8BAA8B;YAS/B,uBAAuB;YAEvB;;EAEV;EACA,qBAAqB;IACnB;YAEQ;EAER;EAAgB,YAAY;EAAa;;;wBAS7B,kBACd,YAAY,8BACX;YAiBS,iBAAiB,aAAa;;EAExC,sBAAsB;IACpB,oBACF,eAAe,sBAAsB,YAAY;YAEvC,sBAAsB,aAAa,wBAC7C,oBAAoB,sBAAsB,YAAY;;;;;;;;;;;;;wBAcxC,sBAAsB,aAAa,sBACjD,QAAQ,WACR,UAAS,iBAAiB,cACzB,sBAAsB"}