@ensofinance/checkout-widget 0.1.6 → 0.1.7
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 +1014 -995
- package/dist/checkout-widget.es.js.map +1 -1
- package/dist/checkout-widget.umd.js +1 -1
- package/dist/checkout-widget.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/components/steps/ExchangeFlow.tsx +39 -28
- 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/package.json
CHANGED
|
@@ -159,18 +159,18 @@ export enum WithdrawalStep {
|
|
|
159
159
|
InitiateWithdrawal,
|
|
160
160
|
TrackUserOp,
|
|
161
161
|
}
|
|
162
|
-
const
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
]
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
WithdrawalStep.ChooseAmount,
|
|
172
|
-
WithdrawalStep.SignUserOp,
|
|
173
|
-
|
|
162
|
+
const withdrawalPreviousStep: Partial<Record<WithdrawalStep, WithdrawalStep>> =
|
|
163
|
+
{
|
|
164
|
+
[WithdrawalStep.CheckSessionKey]: WithdrawalStep.ChooseExchange,
|
|
165
|
+
[WithdrawalStep.ChooseExchangeAsset]: WithdrawalStep.ChooseExchange,
|
|
166
|
+
[WithdrawalStep.ChooseAmount]: WithdrawalStep.ChooseExchangeAsset,
|
|
167
|
+
[WithdrawalStep.SignUserOp]: WithdrawalStep.ChooseAmount,
|
|
168
|
+
[WithdrawalStep.InitiateWithdrawal]: WithdrawalStep.SignUserOp,
|
|
169
|
+
};
|
|
170
|
+
const balancePreviousStep: Partial<Record<WithdrawalStep, WithdrawalStep>> = {
|
|
171
|
+
[WithdrawalStep.ChooseAmount]: WithdrawalStep.ChooseBalanceAsset,
|
|
172
|
+
[WithdrawalStep.SignUserOp]: WithdrawalStep.ChooseAmount,
|
|
173
|
+
};
|
|
174
174
|
// Integration details are fetched dynamically from Mesh API.
|
|
175
175
|
|
|
176
176
|
// Mesh network IDs for EVM chains (from Mesh networks API)
|
|
@@ -901,7 +901,9 @@ const ChooseAmountStep = ({
|
|
|
901
901
|
}
|
|
902
902
|
|
|
903
903
|
try {
|
|
904
|
-
setAmountIn(
|
|
904
|
+
setAmountIn(
|
|
905
|
+
denormalizeValue(normalizedAmount, tokenInData.decimals),
|
|
906
|
+
);
|
|
905
907
|
} catch (error) {
|
|
906
908
|
setAmountIn("0");
|
|
907
909
|
}
|
|
@@ -918,7 +920,7 @@ const ChooseAmountStep = ({
|
|
|
918
920
|
|
|
919
921
|
// Limits validation logic - only for CEX withdrawals
|
|
920
922
|
const currentUsdValue = hasUsdValue
|
|
921
|
-
? getPositiveDecimalValue(usdValue) ?? 0
|
|
923
|
+
? (getPositiveDecimalValue(usdValue) ?? 0)
|
|
922
924
|
: 0;
|
|
923
925
|
const minValueForToken =
|
|
924
926
|
isWithdrawal && selectedToken
|
|
@@ -992,9 +994,7 @@ const ChooseAmountStep = ({
|
|
|
992
994
|
fontSize="xs"
|
|
993
995
|
h={3}
|
|
994
996
|
m={-1}
|
|
995
|
-
visibility={
|
|
996
|
-
isAmountInvalid ? "visible" : "hidden"
|
|
997
|
-
}
|
|
997
|
+
visibility={isAmountInvalid ? "visible" : "hidden"}
|
|
998
998
|
>
|
|
999
999
|
{!hasPositiveAmount
|
|
1000
1000
|
? "Please enter an amount"
|
|
@@ -1270,7 +1270,14 @@ const InitiateWithdrawalStep = ({
|
|
|
1270
1270
|
if (error) {
|
|
1271
1271
|
return (
|
|
1272
1272
|
<BodyWrapper>
|
|
1273
|
-
<Flex
|
|
1273
|
+
<Flex
|
|
1274
|
+
direction="column"
|
|
1275
|
+
align="center"
|
|
1276
|
+
justify="center"
|
|
1277
|
+
flex={1}
|
|
1278
|
+
p={6}
|
|
1279
|
+
gap={4}
|
|
1280
|
+
>
|
|
1274
1281
|
<Flex
|
|
1275
1282
|
align="center"
|
|
1276
1283
|
justify="center"
|
|
@@ -1279,7 +1286,11 @@ const InitiateWithdrawalStep = ({
|
|
|
1279
1286
|
borderRadius="full"
|
|
1280
1287
|
bg="orange.100"
|
|
1281
1288
|
>
|
|
1282
|
-
<Icon
|
|
1289
|
+
<Icon
|
|
1290
|
+
as={TriangleAlert}
|
|
1291
|
+
boxSize={6}
|
|
1292
|
+
color="orange.500"
|
|
1293
|
+
/>
|
|
1283
1294
|
</Flex>
|
|
1284
1295
|
<Text fontSize="md" textAlign="center" color="gray.700">
|
|
1285
1296
|
{error}
|
|
@@ -2035,15 +2046,15 @@ const ExchangeFlow = ({
|
|
|
2035
2046
|
minHeight={"16px"}
|
|
2036
2047
|
maxWidth={"16px"}
|
|
2037
2048
|
onClick={() => {
|
|
2038
|
-
const
|
|
2039
|
-
(
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
if (
|
|
2046
|
-
setCurrentStep(
|
|
2049
|
+
const previousStep = (
|
|
2050
|
+
isDelayedBalanceUsed(
|
|
2051
|
+
selectedIntegration?.type,
|
|
2052
|
+
)
|
|
2053
|
+
? balancePreviousStep
|
|
2054
|
+
: withdrawalPreviousStep
|
|
2055
|
+
)[currentStep];
|
|
2056
|
+
if (previousStep !== undefined) {
|
|
2057
|
+
setCurrentStep(previousStep);
|
|
2047
2058
|
} else {
|
|
2048
2059
|
setFlow("");
|
|
2049
2060
|
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
import type { BridgeTransactionResponseStatus } from "./bridgeTransactionResponseStatus";
|
|
12
|
-
import type { LayerZeroMessageStatus } from "./layerZeroMessageStatus";
|
|
13
|
-
import type { EnsoEvent } from "./ensoEvent";
|
|
14
|
-
import type { EnsoMetadata } from "./ensoMetadata";
|
|
15
|
-
|
|
16
|
-
export interface BridgeTransactionResponse {
|
|
17
|
-
/** Source chain ID */
|
|
18
|
-
sourceChainId: number;
|
|
19
|
-
/** Source transaction hash */
|
|
20
|
-
sourceTxHash: string;
|
|
21
|
-
/** Destination chain ID (if known) */
|
|
22
|
-
destinationChainId?: number;
|
|
23
|
-
/** Destination transaction hash (if completed) */
|
|
24
|
-
destinationTxHash?: string;
|
|
25
|
-
/** Overall bridge status */
|
|
26
|
-
status: BridgeTransactionResponseStatus;
|
|
27
|
-
/** LayerZero message information */
|
|
28
|
-
layerZeroMessage?: LayerZeroMessageStatus;
|
|
29
|
-
/** Enso shortcut event from source chain (ShortcutExecuted + execution result) */
|
|
30
|
-
ensoSourceEvent?: EnsoEvent;
|
|
31
|
-
/** Enso shortcut event from destination chain (ShortcutExecuted + execution result) */
|
|
32
|
-
ensoDestinationEvent?: EnsoEvent;
|
|
33
|
-
/** Enso transaction metadata */
|
|
34
|
-
ensoMetadata?: EnsoMetadata;
|
|
35
|
-
/** Error message if something went wrong */
|
|
36
|
-
error?: string;
|
|
37
|
-
}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Overall bridge status
|
|
14
|
-
*/
|
|
15
|
-
export type BridgeTransactionResponseStatus =
|
|
16
|
-
(typeof BridgeTransactionResponseStatus)[keyof typeof BridgeTransactionResponseStatus];
|
|
17
|
-
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
19
|
-
export const BridgeTransactionResponseStatus = {
|
|
20
|
-
pending: "pending",
|
|
21
|
-
inflight: "inflight",
|
|
22
|
-
delivered: "delivered",
|
|
23
|
-
failed: "failed",
|
|
24
|
-
unknown: "unknown",
|
|
25
|
-
} as const;
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
import type { RefundDetails } from "./refundDetails";
|
|
12
|
-
|
|
13
|
-
export interface EnsoEvent {
|
|
14
|
-
/** Account ID from ShortcutExecuted event */
|
|
15
|
-
accountId?: string;
|
|
16
|
-
/** Request ID from ShortcutExecuted event */
|
|
17
|
-
requestId?: string;
|
|
18
|
-
/** Block number where the event was emitted */
|
|
19
|
-
blockNumber: number;
|
|
20
|
-
/** Transaction hash */
|
|
21
|
-
transactionHash: string;
|
|
22
|
-
/** Chain ID where the event was emitted */
|
|
23
|
-
chainId: number;
|
|
24
|
-
/** Whether the shortcut execution was successful */
|
|
25
|
-
success: boolean;
|
|
26
|
-
/** Error data if execution failed */
|
|
27
|
-
error?: string;
|
|
28
|
-
/** Refund details if execution failed and funds were returned */
|
|
29
|
-
refundDetails?: RefundDetails;
|
|
30
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export interface EnsoMetadata {
|
|
13
|
-
/** Token in address */
|
|
14
|
-
tokenIn?: string;
|
|
15
|
-
/** Token out address */
|
|
16
|
-
tokenOut?: string;
|
|
17
|
-
/** Amount in */
|
|
18
|
-
amountIn?: string;
|
|
19
|
-
/** Chain ID from the request */
|
|
20
|
-
chainId?: number;
|
|
21
|
-
/** Timestamp of the request */
|
|
22
|
-
timestamp?: number;
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export type LayerZeroControllerCheckBridgeTransactionParams = {
|
|
13
|
-
/**
|
|
14
|
-
* Chain ID of the source transaction
|
|
15
|
-
*/
|
|
16
|
-
chainId: number;
|
|
17
|
-
/**
|
|
18
|
-
* Transaction hash
|
|
19
|
-
*/
|
|
20
|
-
txHash: string;
|
|
21
|
-
};
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export interface LayerZeroMessageStatus {
|
|
13
|
-
/** Source chain endpoint ID */
|
|
14
|
-
srcEid: number;
|
|
15
|
-
/** Destination chain endpoint ID */
|
|
16
|
-
dstEid: number;
|
|
17
|
-
/** Source chain ID (EVM) */
|
|
18
|
-
srcChainId?: number;
|
|
19
|
-
/** Destination chain ID (EVM) */
|
|
20
|
-
dstChainId?: number;
|
|
21
|
-
/** Message status from LayerZero */
|
|
22
|
-
status: string;
|
|
23
|
-
/** Source transaction hash */
|
|
24
|
-
srcTxHash?: string;
|
|
25
|
-
/** Destination transaction hash (if delivered) */
|
|
26
|
-
dstTxHash?: string;
|
|
27
|
-
/** Source block number */
|
|
28
|
-
srcBlockNumber?: number;
|
|
29
|
-
/** Destination block number (if delivered) */
|
|
30
|
-
dstBlockNumber?: number;
|
|
31
|
-
/** Source timestamp */
|
|
32
|
-
srcTimestamp?: string;
|
|
33
|
-
/** Destination timestamp (if delivered) */
|
|
34
|
-
dstTimestamp?: string;
|
|
35
|
-
/** Sender address */
|
|
36
|
-
sender?: string;
|
|
37
|
-
/** Receiver address */
|
|
38
|
-
receiver?: string;
|
|
39
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Generated by orval v7.11.1 🍺
|
|
3
|
-
* Do not edit manually.
|
|
4
|
-
* #### Enso API
|
|
5
|
-
- Find detailed documentation on [docs.enso.finance](https://docs.enso.finance).
|
|
6
|
-
- To use the API, **you must include your API Key in the Authorization header** (Bearer format).
|
|
7
|
-
- For testing, Swagger pre-authorizes you using the key: `1e02632d-6feb-4a75-a157-documentation` (1rps).
|
|
8
|
-
- Get your own API Key at [enso.finance/developers](https://developers.enso.build/).
|
|
9
|
-
* OpenAPI spec version: 1.0
|
|
10
|
-
*/
|
|
11
|
-
|
|
12
|
-
export interface RefundDetails {
|
|
13
|
-
/** Token address (0xeee... for native token) */
|
|
14
|
-
token: string;
|
|
15
|
-
/** Amount refunded */
|
|
16
|
-
amount: string;
|
|
17
|
-
/** Recipient address */
|
|
18
|
-
recipient: string;
|
|
19
|
-
/** Whether the refund is in native token */
|
|
20
|
-
isNative: boolean;
|
|
21
|
-
}
|