@skip-go/widget 3.10.0 → 3.10.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  import { jsx, Fragment, jsxs } from "react/jsx-runtime";
2
- import o, { useState, useMemo, useEffect, useContext, useRef, useDebugValue, createElement, useCallback, Fragment as Fragment$1 } from "react";
2
+ import o, { useContext, useState, useMemo, useEffect, useRef, useDebugValue, createElement, useCallback, Fragment as Fragment$1, forwardRef } from "react";
3
3
  import { Scope } from "react-shadow-scope";
4
4
  import { atom as atom$1, useAtomValue, useAtom, useSetAtom, createStore, Provider } from "jotai";
5
5
  import NiceModal, { useModal } from "@ebay/nice-modal-react";
@@ -43189,7 +43189,7 @@ function walletConnect(parameters) {
43189
43189
  const optionalChains = config2.chains.map((x2) => x2.id);
43190
43190
  if (!optionalChains.length)
43191
43191
  return;
43192
- const { EthereumProvider } = await import("./index.es-D26eUUH4.js");
43192
+ const { EthereumProvider } = await import("./index.es-COUg1FzR.js");
43193
43193
  return await EthereumProvider.init({
43194
43194
  ...parameters,
43195
43195
  disableProviderPing: true,
@@ -44497,12 +44497,14 @@ const VirtualList = ({
44497
44497
  renderItem,
44498
44498
  itemKey,
44499
44499
  className,
44500
- empty
44500
+ empty,
44501
+ expandedItemKey
44501
44502
  }) => {
44502
44503
  const theme = nt();
44503
44504
  const [currentlyFocusedElement, setCurrentlyFocusedElement] = useState();
44504
44505
  const listHeight = useListHeight(itemHeight);
44505
44506
  const listRef = useRef(null);
44507
+ const itemRefs = useRef({});
44506
44508
  useEffect(() => {
44507
44509
  var _a, _b, _c;
44508
44510
  const listElement = (_c = (_b = (_a = listRef.current) == null ? void 0 : _a.nativeElement) == null ? void 0 : _b.getElementsByClassName(
@@ -44541,6 +44543,13 @@ const VirtualList = ({
44541
44543
  (_a = listRef.current) == null ? void 0 : _a.scrollTo(0);
44542
44544
  }, 0);
44543
44545
  }, [listItems.length]);
44546
+ useEffect(() => {
44547
+ if (!listRef.current || expandedItemKey == null) return;
44548
+ const index = listItems.findIndex((item) => itemKey(item) === expandedItemKey);
44549
+ if (index !== -1) {
44550
+ listRef.current.scrollTo({ index, align: "top" });
44551
+ }
44552
+ }, [expandedItemKey, listItems, itemKey]);
44544
44553
  if (listItems.length === 0) {
44545
44554
  return /* @__PURE__ */ jsxs(StyledNoResultsContainer, { gap: 10, height: height ?? listHeight, children: [
44546
44555
  empty == null ? void 0 : empty.icon,
@@ -44567,7 +44576,9 @@ const VirtualList = ({
44567
44576
  backgroundColor: getHexColor(theme.primary.text.normal) + opacityToHex(50)
44568
44577
  }
44569
44578
  },
44570
- children: (item, index) => renderItem(item, index)
44579
+ children: (item, index) => renderItem(item, index, (el) => {
44580
+ itemRefs.current[itemKey(item)] = el;
44581
+ })
44571
44582
  }
44572
44583
  );
44573
44584
  };
@@ -51820,144 +51831,142 @@ const FilledWarningIcon = ({
51820
51831
  }
51821
51832
  )
51822
51833
  ] });
51823
- const TransactionHistoryPageHistoryItem = ({
51824
- index,
51825
- txHistoryItem,
51826
- showDetails,
51827
- onClickRow
51828
- }) => {
51829
- var _a, _b, _c;
51830
- const theme = nt();
51831
- const isMobileScreenSize = useIsMobileScreenSize();
51832
- const { data: chains2 } = useAtomValue(skipChainsAtom);
51833
- const {
51834
- status: historyStatus,
51835
- explorerLinks: txHistoryExplorerLinks,
51836
- transferAssetRelease
51837
- } = useTxHistory({
51838
- txHistoryItem,
51839
- index
51840
- });
51841
- const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
51842
- const {
51843
- route: {
51844
- amountIn,
51845
- amountOut,
51846
- sourceAssetDenom,
51847
- sourceAssetChainId,
51848
- destAssetDenom,
51849
- destAssetChainId
51850
- },
51851
- timestamp,
51852
- transactionDetails
51853
- } = txHistoryItem;
51854
- const initialTxHash = (_a = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _a.txHash;
51855
- const chainId = (_b = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _b.chainId;
51856
- const chainType = (_c = chains2 == null ? void 0 : chains2.find((chain) => chain.chainId === chainId)) == null ? void 0 : _c.chainType;
51857
- const derivedExplorerLink = createExplorerLink({
51858
- txHash: initialTxHash,
51859
- chainId,
51860
- chainType
51861
- });
51862
- const explorerLinks = useMemo(() => {
51863
- if (txHistoryExplorerLinks.length === 0 && derivedExplorerLink) {
51864
- return [derivedExplorerLink];
51865
- }
51866
- return txHistoryExplorerLinks;
51867
- }, [derivedExplorerLink, txHistoryExplorerLinks]);
51868
- const sourceAssetDetails = useGetAssetDetails({
51869
- assetDenom: sourceAssetDenom,
51870
- chainId: sourceAssetChainId,
51871
- tokenAmount: amountIn
51872
- });
51873
- const destinationAssetDetails = useGetAssetDetails({
51874
- assetDenom: destAssetDenom,
51875
- chainId: destAssetChainId,
51876
- tokenAmount: amountOut
51877
- });
51878
- const source = {
51879
- amount: sourceAssetDetails.amount,
51880
- asset: sourceAssetDetails.asset,
51881
- assetImage: sourceAssetDetails.assetImage ?? "",
51882
- chainName: sourceAssetDetails.chainName
51883
- };
51884
- const destination = {
51885
- amount: destinationAssetDetails.amount,
51886
- asset: destinationAssetDetails.asset,
51887
- assetImage: destinationAssetDetails.assetImage ?? "",
51888
- chainName: destinationAssetDetails.chainName
51889
- };
51890
- const renderStatus = useMemo(() => {
51891
- switch (historyStatus) {
51892
- case "unconfirmed":
51893
- case "pending":
51894
- return /* @__PURE__ */ jsx(
51895
- StyledAnimatedBorder,
51896
- {
51897
- width: 10,
51898
- height: 10,
51899
- backgroundColor: theme.primary.text.normal,
51900
- status: "pending"
51901
- }
51902
- );
51903
- case "completed":
51904
- return /* @__PURE__ */ jsx(StyledGreenDot, {});
51905
- case "incomplete":
51906
- case "failed": {
51907
- if (transferAssetRelease) {
51908
- return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
51909
- } else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
51910
- }
51911
- }
51912
- }, [
51913
- historyStatus,
51914
- theme.primary.text.normal,
51915
- theme.error.text,
51916
- theme.warning.text,
51917
- transferAssetRelease
51918
- ]);
51919
- const absoluteTimeString = useMemo(() => {
51920
- if (isMobileScreenSize) {
51921
- return getMobileDateFormat(new Date(timestamp));
51922
- }
51923
- return new Date(timestamp).toLocaleString();
51924
- }, [isMobileScreenSize, timestamp]);
51925
- const relativeTime = useMemo(() => {
51926
- if (historyStatus === "pending") {
51927
- return "In Progress";
51928
- }
51929
- if (!timestamp) return "";
51930
- return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
51931
- addSuffix: true
51932
- }).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
51933
- }, [timestamp, historyStatus]);
51934
- if (!txHistoryItem.route) return null;
51935
- return /* @__PURE__ */ jsxs(StyledHistoryContainer, { showDetails, children: [
51936
- /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
51937
- /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
51938
- /* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
51939
- /* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
51940
- /* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
51834
+ const TransactionHistoryPageHistoryItem = forwardRef(
51835
+ ({ index, txHistoryItem, showDetails, onClickRow }, ref) => {
51836
+ var _a, _b, _c;
51837
+ const theme = nt();
51838
+ const isMobileScreenSize = useIsMobileScreenSize();
51839
+ const { data: chains2 } = useAtomValue(skipChainsAtom);
51840
+ const {
51841
+ status: historyStatus,
51842
+ explorerLinks: txHistoryExplorerLinks,
51843
+ transferAssetRelease
51844
+ } = useTxHistory({
51845
+ txHistoryItem,
51846
+ index
51847
+ });
51848
+ const removeTransactionHistoryItem = useSetAtom(removeTransactionHistoryItemAtom);
51849
+ const {
51850
+ route: {
51851
+ amountIn,
51852
+ amountOut,
51853
+ sourceAssetDenom,
51854
+ sourceAssetChainId,
51855
+ destAssetDenom,
51856
+ destAssetChainId
51857
+ },
51858
+ timestamp,
51859
+ transactionDetails
51860
+ } = txHistoryItem;
51861
+ const initialTxHash = (_a = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _a.txHash;
51862
+ const chainId = (_b = transactionDetails == null ? void 0 : transactionDetails[0]) == null ? void 0 : _b.chainId;
51863
+ const chainType = (_c = chains2 == null ? void 0 : chains2.find((chain) => chain.chainId === chainId)) == null ? void 0 : _c.chainType;
51864
+ const derivedExplorerLink = createExplorerLink({
51865
+ txHash: initialTxHash,
51866
+ chainId,
51867
+ chainType
51868
+ });
51869
+ const explorerLinks = useMemo(() => {
51870
+ if (txHistoryExplorerLinks.length === 0 && derivedExplorerLink) {
51871
+ return [derivedExplorerLink];
51872
+ }
51873
+ return txHistoryExplorerLinks;
51874
+ }, [derivedExplorerLink, txHistoryExplorerLinks]);
51875
+ const sourceAssetDetails = useGetAssetDetails({
51876
+ assetDenom: sourceAssetDenom,
51877
+ chainId: sourceAssetChainId,
51878
+ tokenAmount: amountIn
51879
+ });
51880
+ const destinationAssetDetails = useGetAssetDetails({
51881
+ assetDenom: destAssetDenom,
51882
+ chainId: destAssetChainId,
51883
+ tokenAmount: amountOut
51884
+ });
51885
+ const source = {
51886
+ amount: sourceAssetDetails.amount,
51887
+ asset: sourceAssetDetails.asset,
51888
+ assetImage: sourceAssetDetails.assetImage ?? "",
51889
+ chainName: sourceAssetDetails.chainName
51890
+ };
51891
+ const destination = {
51892
+ amount: destinationAssetDetails.amount,
51893
+ asset: destinationAssetDetails.asset,
51894
+ assetImage: destinationAssetDetails.assetImage ?? "",
51895
+ chainName: destinationAssetDetails.chainName
51896
+ };
51897
+ const renderStatus = useMemo(() => {
51898
+ switch (historyStatus) {
51899
+ case "unconfirmed":
51900
+ case "pending":
51901
+ return /* @__PURE__ */ jsx(
51902
+ StyledAnimatedBorder,
51903
+ {
51904
+ width: 10,
51905
+ height: 10,
51906
+ backgroundColor: theme.primary.text.normal,
51907
+ status: "pending"
51908
+ }
51909
+ );
51910
+ case "completed":
51911
+ return /* @__PURE__ */ jsx(StyledGreenDot, {});
51912
+ case "incomplete":
51913
+ case "failed": {
51914
+ if (transferAssetRelease) {
51915
+ return /* @__PURE__ */ jsx(FilledWarningIcon, { backgroundColor: theme.warning.text });
51916
+ } else return /* @__PURE__ */ jsx(XIcon, { color: theme.error.text });
51917
+ }
51918
+ }
51919
+ }, [
51920
+ historyStatus,
51921
+ theme.primary.text.normal,
51922
+ theme.error.text,
51923
+ theme.warning.text,
51924
+ transferAssetRelease
51925
+ ]);
51926
+ const absoluteTimeString = useMemo(() => {
51927
+ if (isMobileScreenSize) {
51928
+ return getMobileDateFormat(new Date(timestamp));
51929
+ }
51930
+ return new Date(timestamp).toLocaleString();
51931
+ }, [isMobileScreenSize, timestamp]);
51932
+ const relativeTime = useMemo(() => {
51933
+ if (historyStatus === "pending") {
51934
+ return "In Progress";
51935
+ }
51936
+ if (!timestamp) return "";
51937
+ return formatDistanceStrict(new Date(timestamp), /* @__PURE__ */ new Date(), {
51938
+ addSuffix: true
51939
+ }).replace("minutes", "mins").replace("minute", "min").replace("hours", "hrs").replace("hour", "hr").replace("seconds", "secs").replace("second", "sec").replace("months", "mos").replace("month", "mo").replace("years", "yrs").replace("year", "yr");
51940
+ }, [timestamp, historyStatus]);
51941
+ if (!txHistoryItem.route) return null;
51942
+ return /* @__PURE__ */ jsxs(StyledHistoryContainer, { ref, showDetails, children: [
51943
+ /* @__PURE__ */ jsxs(StyledHistoryItemRow, { align: "center", justify: "space-between", onClick: onClickRow, children: [
51944
+ /* @__PURE__ */ jsxs(Row, { gap: 8, align: "center", children: [
51945
+ /* @__PURE__ */ jsx(RenderAssetAmount, { ...source, sourceAsset: true }),
51946
+ /* @__PURE__ */ jsx(ThinArrowIcon, { color: theme.primary.text.lowContrast, direction: "right" }),
51947
+ /* @__PURE__ */ jsx(RenderAssetAmount, { ...destination })
51948
+ ] }),
51949
+ /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
51950
+ /* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
51951
+ /* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
51952
+ ] })
51941
51953
  ] }),
51942
- /* @__PURE__ */ jsxs(Row, { align: "center", gap: 6, children: [
51943
- /* @__PURE__ */ jsx(SmallText, { children: relativeTime }),
51944
- /* @__PURE__ */ jsx(Row, { width: 20, align: "center", justify: "center", children: renderStatus })
51945
- ] })
51946
- ] }),
51947
- showDetails && /* @__PURE__ */ jsx(
51948
- TransactionHistoryPageHistoryItemDetails,
51949
- {
51950
- status: historyStatus,
51951
- sourceChainName: sourceAssetDetails.chainName ?? "--",
51952
- destinationChainName: destinationAssetDetails.chainName ?? "--",
51953
- absoluteTimeString,
51954
- onClickDelete: () => removeTransactionHistoryItem(index),
51955
- explorerLinks,
51956
- transferAssetRelease
51957
- }
51958
- )
51959
- ] });
51960
- };
51954
+ showDetails && /* @__PURE__ */ jsx(
51955
+ TransactionHistoryPageHistoryItemDetails,
51956
+ {
51957
+ status: historyStatus,
51958
+ sourceChainName: sourceAssetDetails.chainName ?? "--",
51959
+ destinationChainName: destinationAssetDetails.chainName ?? "--",
51960
+ absoluteTimeString,
51961
+ onClickDelete: () => removeTransactionHistoryItem(index),
51962
+ explorerLinks,
51963
+ transferAssetRelease
51964
+ }
51965
+ )
51966
+ ] });
51967
+ }
51968
+ );
51969
+ TransactionHistoryPageHistoryItem.displayName = "TransactionHistoryPageHistoryItem";
51961
51970
  const RenderAssetAmount = ({
51962
51971
  amount,
51963
51972
  asset,
@@ -52013,7 +52022,7 @@ const StyledGreenDot = dt.div`
52013
52022
  border-radius: 50%;
52014
52023
  `;
52015
52024
  const TransactionHistoryPage = () => {
52016
- var _a;
52025
+ var _a, _b, _c, _d;
52017
52026
  const theme = nt();
52018
52027
  const setCurrentPage = useSetAtom(currentPageAtom);
52019
52028
  const [itemIndexToShowDetail, setItemIndexToShowDetail] = useState(void 0);
@@ -52045,10 +52054,11 @@ const TransactionHistoryPage = () => {
52045
52054
  details: "No transactions yet",
52046
52055
  icon: /* @__PURE__ */ jsx(HistoryIcon, { width: 30, height: 30, color: (_a = theme == null ? void 0 : theme.primary) == null ? void 0 : _a.text.lowContrast })
52047
52056
  },
52048
- itemHeight: 1,
52049
- renderItem: (item, index) => /* @__PURE__ */ jsx(
52057
+ itemHeight: 55,
52058
+ renderItem: (item, index, refSetter) => /* @__PURE__ */ jsx(
52050
52059
  TransactionHistoryPageHistoryItem,
52051
52060
  {
52061
+ ref: refSetter,
52052
52062
  index,
52053
52063
  txHistoryItem: item,
52054
52064
  showDetails: index === itemIndexToShowDetail,
@@ -52061,9 +52071,10 @@ const TransactionHistoryPage = () => {
52061
52071
  }
52062
52072
  ),
52063
52073
  itemKey: (item) => {
52064
- var _a2;
52065
- return (_a2 = item.transactionDetails) == null ? void 0 : _a2[0].txHash;
52066
- }
52074
+ var _a2, _b2;
52075
+ return (_b2 = (_a2 = item == null ? void 0 : item.transactionDetails) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.txHash;
52076
+ },
52077
+ expandedItemKey: itemIndexToShowDetail ? (_d = (_c = (_b = historyList[itemIndexToShowDetail]) == null ? void 0 : _b.transactionDetails) == null ? void 0 : _c[0]) == null ? void 0 : _d.txHash : void 0
52067
52078
  },
52068
52079
  txHistory.length
52069
52080
  ) }),
@@ -52240,7 +52251,7 @@ const initSentry = () => {
52240
52251
  };
52241
52252
  const name = "@skip-go/widget";
52242
52253
  const description = "Swap widget";
52243
- const version = "3.10.0";
52254
+ const version = "3.10.2";
52244
52255
  const repository = {
52245
52256
  url: "https://github.com/skip-mev/skip-go",
52246
52257
  directory: "packages/widget"
@@ -52298,7 +52309,7 @@ const devDependencies = {
52298
52309
  "@typescript-eslint/parser": "^7.15.0",
52299
52310
  "@vitejs/plugin-react": "^4.3.1",
52300
52311
  buffer: "^6.0.3",
52301
- "chain-registry": "^1.69.212",
52312
+ "chain-registry": "^1.69.218",
52302
52313
  download: "^8.0.0",
52303
52314
  eslint: "^9.9.0",
52304
52315
  "eslint-config-prettier": "^9.1.0",
@@ -52343,7 +52354,6 @@ const dependencies = {
52343
52354
  "@cosmjs/stargate": "0.33.1",
52344
52355
  "@ebay/nice-modal-react": "^1.2.13",
52345
52356
  "@eslint/compat": "^1.1.1",
52346
- "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.44",
52347
52357
  "@penumbra-zone/bech32m": "^13.0.0",
52348
52358
  "@penumbra-zone/client": "^24.0.0",
52349
52359
  "@penumbra-zone/protobuf": "^7.2.0",
@@ -52365,7 +52375,7 @@ const dependencies = {
52365
52375
  "@walletconnect/solana-adapter": "^0.0.6",
52366
52376
  add: "^2.0.6",
52367
52377
  bech32: "^2.0.0",
52368
- graz: "0.3.1",
52378
+ graz: "0.3.2",
52369
52379
  jotai: "^2.10.1",
52370
52380
  "jotai-effect": "^1.0.2",
52371
52381
  "jotai-tanstack-query": "^0.8.6",
@@ -1,4 +1,4 @@
1
- import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-BJ7FPDIO.js";
1
+ import { g as getAugmentedNamespace, c as commonjsGlobal, a as getDefaultExportFromCjs, p as process$1 } from "./index-Ax9YbGG_.js";
2
2
  import qg, { PROPOSAL_EXPIRY_MESSAGE } from "@walletconnect/sign-client";
3
3
  const global = globalThis || void 0 || self;
4
4
  var buffer$1 = {};
package/build/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { W, d, l, o, r } from "./index-BJ7FPDIO.js";
1
+ import { W, d, l, o, r } from "./index-Ax9YbGG_.js";
2
2
  export {
3
3
  W as Widget,
4
4
  d as defaultTheme,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@skip-go/widget",
3
3
  "description": "Swap widget",
4
- "version": "3.10.0",
4
+ "version": "3.10.2",
5
5
  "repository": {
6
6
  "url": "https://github.com/skip-mev/skip-go",
7
7
  "directory": "packages/widget"
@@ -36,14 +36,13 @@
36
36
  "@cosmjs/stargate": "0.33.1",
37
37
  "@ebay/nice-modal-react": "^1.2.13",
38
38
  "@eslint/compat": "^1.1.1",
39
- "@leapwallet/cosmos-social-login-capsule-provider": "^0.0.44",
40
39
  "@penumbra-zone/bech32m": "^13.0.0",
41
40
  "@penumbra-zone/client": "^24.0.0",
42
41
  "@penumbra-zone/protobuf": "^7.2.0",
43
42
  "@penumbra-zone/transport-dom": "^7.5.0",
44
43
  "@r2wc/react-to-web-component": "^2.0.3",
45
44
  "@sentry/react": "^8.46.0",
46
- "@skip-go/client": "1.1.0",
45
+ "@skip-go/client": "1.1.1",
47
46
  "@solana/spl-token": "^0.4.8",
48
47
  "@solana/wallet-adapter-backpack": "^0.1.14",
49
48
  "@solana/wallet-adapter-coinbase": "^0.1.19",
@@ -58,7 +57,7 @@
58
57
  "@walletconnect/solana-adapter": "^0.0.6",
59
58
  "add": "^2.0.6",
60
59
  "bech32": "^2.0.0",
61
- "graz": "0.3.1",
60
+ "graz": "0.3.2",
62
61
  "jotai": "^2.10.1",
63
62
  "jotai-effect": "^1.0.2",
64
63
  "jotai-tanstack-query": "^0.8.6",