@ensofinance/checkout-widget 0.1.8 → 0.1.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.
Files changed (61) hide show
  1. package/dist/checkout-widget.es.js +24133 -25422
  2. package/dist/checkout-widget.umd.js +59 -65
  3. package/dist/index.d.ts +1 -3
  4. package/package.json +2 -2
  5. package/src/assets/usdc.webp +0 -0
  6. package/src/assets/usdt.webp +0 -0
  7. package/src/components/AmountInput.tsx +25 -41
  8. package/src/components/ChakraProvider.tsx +13 -36
  9. package/src/components/Checkout.tsx +0 -3
  10. package/src/components/CurrencySwapDisplay.tsx +22 -59
  11. package/src/components/DepositProcessing.tsx +1 -1
  12. package/src/components/ExchangeConfirmSecurity.tsx +1 -1
  13. package/src/components/QuoteParameters.tsx +1 -1
  14. package/src/components/TransactionDetailRow.tsx +2 -2
  15. package/src/components/cards/ExchangeCard.tsx +1 -1
  16. package/src/components/cards/OptionCard.tsx +1 -2
  17. package/src/components/cards/WalletCard.tsx +1 -1
  18. package/src/components/modal.tsx +3 -3
  19. package/src/components/steps/ExchangeFlow.tsx +1404 -231
  20. package/src/components/steps/FlowSelector.tsx +60 -117
  21. package/src/components/steps/WalletFlow/WalletAmountStep.tsx +2 -2
  22. package/src/components/steps/WalletFlow/WalletConfirmStep.tsx +51 -92
  23. package/src/components/steps/WalletFlow/WalletFlow.tsx +16 -17
  24. package/src/components/steps/WalletFlow/WalletQuoteStep.tsx +2 -2
  25. package/src/components/steps/WalletFlow/WalletTokenStep.tsx +4 -6
  26. package/src/components/ui/index.tsx +6 -23
  27. package/src/components/ui/toaster.tsx +1 -2
  28. package/src/types/index.ts +0 -97
  29. package/src/util/constants.tsx +0 -27
  30. package/src/util/enso-hooks.tsx +61 -75
  31. package/dist/checkout-widget.es.js.map +0 -1
  32. package/dist/checkout-widget.umd.js.map +0 -1
  33. package/src/assets/providers/alchemypay.svg +0 -21
  34. package/src/assets/providers/banxa.svg +0 -21
  35. package/src/assets/providers/binanceconnect.svg +0 -14
  36. package/src/assets/providers/kryptonim.svg +0 -6
  37. package/src/assets/providers/mercuryo.svg +0 -21
  38. package/src/assets/providers/moonpay.svg +0 -14
  39. package/src/assets/providers/stripe.svg +0 -16
  40. package/src/assets/providers/swapped.svg +0 -1
  41. package/src/assets/providers/topper.svg +0 -14
  42. package/src/assets/providers/transak.svg +0 -21
  43. package/src/assets/providers/unlimit.svg +0 -21
  44. package/src/components/steps/CardBuyFlow/CardBuyFlow.tsx +0 -412
  45. package/src/components/steps/CardBuyFlow/ChooseAmountStep.tsx +0 -352
  46. package/src/components/steps/CardBuyFlow/OpenWidgetStep.tsx +0 -193
  47. package/src/components/steps/SmartAccountFlow.tsx +0 -372
  48. package/src/components/steps/shared/ChooseAmountStep.tsx +0 -325
  49. package/src/components/steps/shared/SignUserOpStep.tsx +0 -117
  50. package/src/components/steps/shared/TrackUserOpStep.tsx +0 -625
  51. package/src/components/steps/shared/exchangeIntegration.ts +0 -19
  52. package/src/components/steps/shared/types.ts +0 -22
  53. package/src/components/ui/transitions.tsx +0 -16
  54. package/src/enso-api/model/bridgeTransactionResponse.ts +0 -37
  55. package/src/enso-api/model/bridgeTransactionResponseStatus.ts +0 -25
  56. package/src/enso-api/model/ensoEvent.ts +0 -30
  57. package/src/enso-api/model/ensoMetadata.ts +0 -23
  58. package/src/enso-api/model/layerZeroControllerCheckBridgeTransactionParams.ts +0 -21
  59. package/src/enso-api/model/layerZeroMessageStatus.ts +0 -39
  60. package/src/enso-api/model/refundDetails.ts +0 -21
  61. package/src/util/meld-hooks.tsx +0 -533
@@ -1,117 +0,0 @@
1
- import { useState } from "react";
2
- import { Flex, Skeleton } from "@chakra-ui/react";
3
- import { useAccount, useSignMessage } from "wagmi";
4
- import { getUserOperationHash } from "viem/account-abstraction";
5
-
6
- import { BodyWrapper } from "../../ui/styled";
7
- import { Button, Input } from "../../ui";
8
- import QuoteParameters from "../../QuoteParameters";
9
- import { TransactionDetailRow } from "../../TransactionDetailRow";
10
- import { useAppDetails, useRouteData } from "@/util/enso-hooks";
11
- import { ENTRY_POINT_ADDRESS } from "@/util/constants";
12
-
13
- const SignUserOpStep = ({
14
- setStep,
15
- setUserOp,
16
- nextStep,
17
- }: {
18
- nextStep: number;
19
- setStep: (step: number) => void;
20
- setUserOp: (userOp: any) => void;
21
- }) => {
22
- const { chainIdIn } = useAppDetails();
23
- const { routeLoading, usdAmountIn, routeData } = useRouteData();
24
- const { signMessageAsync } = useSignMessage();
25
- const { address } = useAccount();
26
- const [isSigning, setIsSigning] = useState(false);
27
-
28
- const handleSignUserOp = async () => {
29
- if (!routeData || (routeData as any)?.error) {
30
- console.error("No valid router data available");
31
- return;
32
- }
33
-
34
- try {
35
- setIsSigning(true);
36
-
37
- const userOperation = routeData?.userOp;
38
- if (!userOperation) {
39
- console.error("No userOperation found in routeData");
40
- return;
41
- }
42
-
43
- console.log("Signing userOperation:", userOperation);
44
-
45
- const userOpHash = getUserOperationHash({
46
- // @ts-ignore
47
- userOperation,
48
- entryPointAddress: ENTRY_POINT_ADDRESS,
49
- entryPointVersion: "0.7",
50
- chainId: chainIdIn,
51
- });
52
-
53
- const signature = await signMessageAsync({
54
- account: address as `0x${string}`,
55
- message: { raw: userOpHash as `0x${string}` },
56
- });
57
-
58
- const signedUserOp = {
59
- ...userOperation,
60
- signature,
61
- };
62
-
63
- console.log("signedUserOp", JSON.stringify(signedUserOp));
64
-
65
- setUserOp(signedUserOp);
66
- setStep(nextStep);
67
- } catch (error) {
68
- console.error("Failed to sign userOperation:", error);
69
- } finally {
70
- setIsSigning(false);
71
- }
72
- };
73
-
74
- return (
75
- <BodyWrapper>
76
- <Flex
77
- flexDirection={"column"}
78
- gap={"16px"}
79
- alignItems={"center"}
80
- width={"100%"}
81
- >
82
- <Skeleton
83
- loading={routeLoading}
84
- width={routeLoading ? "156px" : "auto"}
85
- >
86
- <Input
87
- readOnly
88
- marginY={"8px"}
89
- variant={"text"}
90
- placeholder={"$10.00"}
91
- value={usdAmountIn}
92
- />
93
- </Skeleton>
94
-
95
- <QuoteParameters />
96
- </Flex>
97
-
98
- <TransactionDetailRow />
99
-
100
- <Button
101
- disabled={
102
- !!(routeData as any)?.message || routeLoading || isSigning
103
- }
104
- loading={routeLoading || isSigning}
105
- onClick={handleSignUserOp}
106
- >
107
- {routeLoading
108
- ? "Loading quote"
109
- : isSigning
110
- ? "Signing..."
111
- : "Sign Transaction"}
112
- </Button>
113
- </BodyWrapper>
114
- );
115
- };
116
-
117
- export default SignUserOpStep;