@ensofinance/checkout-widget 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensofinance/checkout-widget",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "type": "module",
5
5
  "homepage": "https://www.enso.build/",
6
6
  "repository": {
@@ -1,19 +1,10 @@
1
- import { Box, chakra, Icon, Image } from "@chakra-ui/react";
1
+ import { Box, Icon, Image } from "@chakra-ui/react";
2
2
  import { Handshake, Lock, ShieldCheck } from "lucide-react";
3
3
 
4
4
  import { Button, Helper } from "./ui";
5
5
  import LogoSvg from "../assets/logo.svg";
6
6
  import { BodyWrapper } from "./ui/styled";
7
-
8
- export const HeaderTitle = chakra("h2", {
9
- base: {
10
- fontWeight: "600",
11
- fontSize: "16px",
12
- lineHeight: "100%",
13
- letterSpacing: "-0.4px",
14
- color: "fg",
15
- },
16
- });
7
+ import BinanceIcon from "@/assets/BinanceBadge.svg";
17
8
 
18
9
  const SecurityFeature = ({
19
10
  icon,
@@ -58,12 +49,7 @@ const ConfirmExchangeStep = ({ onConfirm }: { onConfirm: () => void }) => {
58
49
  return (
59
50
  <BodyWrapper>
60
51
  <Box display="flex" justifyContent="center" width="100%">
61
- <Box
62
- height="48px"
63
- width="48px"
64
- backgroundColor="gray.200"
65
- borderRadius="90%"
66
- />
52
+ <Image w={"48px"} src={BinanceIcon} />
67
53
  </Box>
68
54
 
69
55
  <Box
@@ -96,7 +82,7 @@ const ConfirmExchangeStep = ({ onConfirm }: { onConfirm: () => void }) => {
96
82
  />
97
83
 
98
84
  <Helper>
99
- <Image src={LogoSvg} color={"gray"} w={"24px"}/>
85
+ <Image src={LogoSvg} color={"gray"} w={"24px"} />
100
86
  Enso securely encrypts all user data.
101
87
  </Helper>
102
88
  </Box>
@@ -244,9 +244,9 @@ const CheckSessionKeyStep = ({
244
244
  clientId: address,
245
245
  onIntegrationConnected: (payload) => {
246
246
  console.log("onIntegrationConnected", payload);
247
+ meshLink.closeLink();
247
248
  setStep(WithdrawalStep.GetHoldings);
248
249
  handleMeshAccessPayload(payload.accessToken); // Persist access token and session id for future reloads
249
- meshLink.closeLink();
250
250
  },
251
251
  onExit: (error) => {
252
252
  console.log("onExit", error);
@@ -1,4 +1,4 @@
1
- import { useAccount } from "wagmi";
1
+ import { useAccount, useConfig } from "wagmi";
2
2
  import {
3
3
  useRouterControllerPostRouteShortcutTransaction,
4
4
  useRouterControllerRouteShortcutTransaction,
@@ -17,8 +17,14 @@ import { RouterControllerRouteShortcutTransactionParams } from "./model";
17
17
 
18
18
  export const useWalletBalance = () => {
19
19
  const { address } = useAccount();
20
+ const config = useConfig();
20
21
  const ensoApiToken = useAppStore((state) => state.ensoApiToken);
21
22
 
23
+ const supportedChainIds = useMemo(
24
+ () => new Set(config.chains.map((chain) => chain.id)),
25
+ [config.chains],
26
+ );
27
+
22
28
  const { data, isLoading } = useWalletControllerWalletBalances(
23
29
  {
24
30
  eoaAddress: address,
@@ -43,13 +49,18 @@ export const useWalletBalance = () => {
43
49
  +normalizeValue(balanace.amount, balanace.decimals) *
44
50
  +balanace.price,
45
51
  }))
46
- .filter((balance) => balance.total > 1 && balance.total < 10000)
52
+ .filter(
53
+ (balance) =>
54
+ balance.total > 1 &&
55
+ balance.total < 10000 &&
56
+ supportedChainIds.has(balance.chainId),
57
+ )
47
58
  .sort((a, b) => b.total - a.total);
48
59
 
49
60
  const total = holdingsList?.reduce((acc, { total }) => acc + total, 0);
50
61
 
51
62
  return { holdingsList, total };
52
- }, [data]);
63
+ }, [data, supportedChainIds]);
53
64
 
54
65
  return { holdingsList, total, isLoading };
55
66
  };
@@ -1,5 +0,0 @@
1
- <svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path d="M11.1667 21.3333C17.0778 21.3333 21.8333 16.5778 21.8333 10.6667C21.8333 4.75552 17.0778 0 11.1667 0C5.25552 0 0.5 4.75552 0.5 10.6667C0.5 16.5778 5.25552 21.3333 11.1667 21.3333Z" fill="#2775CA"/>
3
- <path d="M14.1001 12.3555C14.1001 10.7999 13.1667 10.2666 11.3001 10.0444C9.96672 9.8666 9.70005 9.51108 9.70005 8.88879C9.70005 8.26649 10.1445 7.8666 11.0334 7.8666C11.8334 7.8666 12.2779 8.13327 12.5001 8.79993C12.5445 8.93327 12.6779 9.02212 12.8112 9.02212H13.5222C13.7001 9.02212 13.8334 8.88879 13.8334 8.71108V8.6666C13.6556 7.68879 12.8556 6.93327 11.8334 6.84441V5.77775C11.8334 5.59993 11.7001 5.4666 11.4779 5.42212H10.8112C10.6334 5.42212 10.5001 5.55545 10.4556 5.77775V6.79993C9.12224 6.97775 8.27786 7.8666 8.27786 8.97775C8.27786 10.4444 9.16672 11.0221 11.0334 11.2444C12.2779 11.4666 12.6779 11.7333 12.6779 12.4444C12.6779 13.1556 12.0556 13.6444 11.2112 13.6444C10.0556 13.6444 9.65557 13.1555 9.52224 12.4888C9.47786 12.3111 9.34453 12.2221 9.2112 12.2221H8.45557C8.27786 12.2221 8.14453 12.3555 8.14453 12.5333V12.5777C8.32224 13.6888 9.03338 14.4888 10.5001 14.7111V15.7777C10.5001 15.9555 10.6334 16.0888 10.8556 16.1333H11.5222C11.7001 16.1333 11.8334 15.9999 11.8779 15.7777V14.7111C13.2112 14.4888 14.1001 13.5555 14.1001 12.3555Z" fill="white"/>
4
- <path fill-rule="evenodd" clip-rule="evenodd" d="M4.94453 8.48879C3.65557 11.9111 5.43339 15.7778 8.90005 17.0221C9.03339 17.1111 9.16672 17.2888 9.16672 17.4221V18.0444C9.16672 18.1333 9.16672 18.1778 9.12224 18.2221C9.07786 18.3999 8.90005 18.4888 8.72224 18.3999C6.23339 17.5999 4.32224 15.6888 3.52224 13.1999C2.18891 8.97775 4.50005 4.48879 8.72224 3.15546C8.76672 3.11108 8.85557 3.11108 8.90005 3.11108C9.07786 3.15546 9.16672 3.28879 9.16672 3.4666V4.08879C9.16672 4.31108 9.07786 4.44442 8.90005 4.53327C7.07786 5.19994 5.6112 6.62212 4.94453 8.48879ZM13.2112 3.33327C13.2556 3.15546 13.4334 3.0666 13.6112 3.15546C16.0556 3.95546 18.0112 5.8666 18.8112 8.39994C20.1445 12.6221 17.8334 17.1111 13.6112 18.4444C13.5667 18.4888 13.4779 18.4888 13.4334 18.4888C13.2556 18.4444 13.1667 18.3111 13.1667 18.1333V17.5111C13.1667 17.2888 13.2556 17.1555 13.4334 17.0666C15.2556 16.3999 16.7222 14.9778 17.3889 13.1111C18.6779 9.68879 16.9001 5.82212 13.4334 4.57775C13.3001 4.48879 13.1667 4.31108 13.1667 4.13327V3.51108C13.1667 3.42212 13.1667 3.37775 13.2112 3.33327Z" fill="white"/>
5
- </svg>