@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.
- package/dist/checkout-widget.es.js +24133 -25422
- package/dist/checkout-widget.umd.js +59 -65
- package/dist/index.d.ts +1 -3
- package/package.json +2 -2
- package/src/assets/usdc.webp +0 -0
- package/src/assets/usdt.webp +0 -0
- package/src/components/AmountInput.tsx +25 -41
- package/src/components/ChakraProvider.tsx +13 -36
- package/src/components/Checkout.tsx +0 -3
- package/src/components/CurrencySwapDisplay.tsx +22 -59
- package/src/components/DepositProcessing.tsx +1 -1
- package/src/components/ExchangeConfirmSecurity.tsx +1 -1
- package/src/components/QuoteParameters.tsx +1 -1
- package/src/components/TransactionDetailRow.tsx +2 -2
- package/src/components/cards/ExchangeCard.tsx +1 -1
- package/src/components/cards/OptionCard.tsx +1 -2
- package/src/components/cards/WalletCard.tsx +1 -1
- package/src/components/modal.tsx +3 -3
- package/src/components/steps/ExchangeFlow.tsx +1404 -231
- package/src/components/steps/FlowSelector.tsx +60 -117
- package/src/components/steps/WalletFlow/WalletAmountStep.tsx +2 -2
- package/src/components/steps/WalletFlow/WalletConfirmStep.tsx +51 -92
- package/src/components/steps/WalletFlow/WalletFlow.tsx +16 -17
- package/src/components/steps/WalletFlow/WalletQuoteStep.tsx +2 -2
- package/src/components/steps/WalletFlow/WalletTokenStep.tsx +4 -6
- package/src/components/ui/index.tsx +6 -23
- package/src/components/ui/toaster.tsx +1 -2
- package/src/types/index.ts +0 -97
- package/src/util/constants.tsx +0 -27
- package/src/util/enso-hooks.tsx +61 -75
- package/dist/checkout-widget.es.js.map +0 -1
- package/dist/checkout-widget.umd.js.map +0 -1
- package/src/assets/providers/alchemypay.svg +0 -21
- package/src/assets/providers/banxa.svg +0 -21
- package/src/assets/providers/binanceconnect.svg +0 -14
- package/src/assets/providers/kryptonim.svg +0 -6
- package/src/assets/providers/mercuryo.svg +0 -21
- package/src/assets/providers/moonpay.svg +0 -14
- package/src/assets/providers/stripe.svg +0 -16
- package/src/assets/providers/swapped.svg +0 -1
- package/src/assets/providers/topper.svg +0 -14
- package/src/assets/providers/transak.svg +0 -21
- package/src/assets/providers/unlimit.svg +0 -21
- package/src/components/steps/CardBuyFlow/CardBuyFlow.tsx +0 -412
- package/src/components/steps/CardBuyFlow/ChooseAmountStep.tsx +0 -352
- package/src/components/steps/CardBuyFlow/OpenWidgetStep.tsx +0 -193
- package/src/components/steps/SmartAccountFlow.tsx +0 -372
- package/src/components/steps/shared/ChooseAmountStep.tsx +0 -325
- package/src/components/steps/shared/SignUserOpStep.tsx +0 -117
- package/src/components/steps/shared/TrackUserOpStep.tsx +0 -625
- package/src/components/steps/shared/exchangeIntegration.ts +0 -19
- package/src/components/steps/shared/types.ts +0 -22
- package/src/components/ui/transitions.tsx +0 -16
- package/src/enso-api/model/bridgeTransactionResponse.ts +0 -37
- package/src/enso-api/model/bridgeTransactionResponseStatus.ts +0 -25
- package/src/enso-api/model/ensoEvent.ts +0 -30
- package/src/enso-api/model/ensoMetadata.ts +0 -23
- package/src/enso-api/model/layerZeroControllerCheckBridgeTransactionParams.ts +0 -21
- package/src/enso-api/model/layerZeroMessageStatus.ts +0 -39
- package/src/enso-api/model/refundDetails.ts +0 -21
- 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;
|