@ensofinance/checkout-widget 0.0.13 → 0.0.14
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 +8421 -8103
- package/dist/checkout-widget.es.js.map +1 -1
- package/dist/checkout-widget.umd.js +31 -31
- package/dist/checkout-widget.umd.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/orval.config.ts +40 -6
- package/package.json +1 -1
- package/src/components/BridgeFee.tsx +3 -3
- package/src/components/Checkout.tsx +2 -2
- package/src/components/ExchangeConfirmSecurity.tsx +16 -3
- package/src/components/QuoteParameters.tsx +33 -18
- package/src/components/TransactionDetailRow.tsx +6 -5
- package/src/components/cards/AssetCard.tsx +2 -2
- package/src/components/cards/OptionCard.tsx +2 -0
- package/src/components/steps/ExchangeFlow.tsx +254 -96
- package/src/components/steps/FlowSelector.tsx +26 -10
- package/src/components/steps/WalletFlow/WalletAmountStep.tsx +22 -23
- package/src/components/steps/WalletFlow/WalletTokenStep.tsx +5 -3
- package/src/components/ui/index.tsx +0 -3
- package/src/enso-api/api.ts +144 -3
- package/src/enso-api/custom-instance.ts +1 -0
- package/src/enso-api/index.ts +29 -118
- package/src/enso-api/model/approveActionDto.ts +17 -0
- package/src/enso-api/model/approveArgsDto.ts +22 -0
- package/src/enso-api/model/approveArgsDtoAmount.ts +16 -0
- package/src/enso-api/model/balanceActionDto.ts +17 -0
- package/src/enso-api/model/balanceArgsDto.ts +15 -0
- package/src/enso-api/model/borrowActionDto.ts +18 -0
- package/src/enso-api/model/borrowArgsDto.ts +22 -0
- package/src/enso-api/model/borrowArgsDtoAmountOut.ts +16 -0
- package/src/enso-api/model/bridgeActionDto.ts +19 -0
- package/src/enso-api/model/bridgeArgsDto.ts +29 -0
- package/src/enso-api/model/bridgeArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/bridgeArgsDtoCallbackItem.ts +64 -0
- package/src/enso-api/model/bundleControllerBundleShortcutTransactionBodyItem.ts +69 -0
- package/src/enso-api/model/callActionDto.ts +18 -0
- package/src/enso-api/model/callArgsDto.ts +29 -0
- package/src/enso-api/model/callArgsDtoArgsItem.ts +17 -0
- package/src/enso-api/model/callArgsDtoArgsItemAnyOf.ts +12 -0
- package/src/enso-api/model/callArgsDtoValue.ts +16 -0
- package/src/enso-api/model/callOutput.ts +15 -0
- package/src/enso-api/model/depositActionDto.ts +18 -0
- package/src/enso-api/model/depositArgsDto.ts +28 -0
- package/src/enso-api/model/depositArgsDtoAmountIn.ts +20 -0
- package/src/enso-api/model/depositArgsDtoAmountInOneOfItem.ts +13 -0
- package/src/enso-api/model/depositArgsDtoTokenIn.ts +15 -0
- package/src/enso-api/model/depositArgsDtoTokenOut.ts +15 -0
- package/src/enso-api/model/depositCLMMActionDto.ts +18 -0
- package/src/enso-api/model/depositCLMMArgsDto.ts +30 -0
- package/src/enso-api/model/depositCLMMArgsDtoAmountInItem.ts +17 -0
- package/src/enso-api/model/depositCLMMArgsDtoAmountInItemAnyOf.ts +12 -0
- package/src/enso-api/model/ensoFeeActionDto.ts +17 -0
- package/src/enso-api/model/ensoFeeArgsDto.ts +20 -0
- package/src/enso-api/model/ensoFeeArgsDtoAmount.ts +16 -0
- package/src/enso-api/model/feeActionDto.ts +17 -0
- package/src/enso-api/model/feeArgsDto.ts +22 -0
- package/src/enso-api/model/feeArgsDtoAmount.ts +16 -0
- package/src/enso-api/model/harvestActionDto.ts +19 -0
- package/src/enso-api/model/harvestArgsDto.ts +17 -0
- package/src/enso-api/model/index.ts +115 -4
- package/src/enso-api/model/mergeActionDto.ts +17 -0
- package/src/enso-api/model/mergeArgsDto.ts +22 -0
- package/src/enso-api/model/mergeArgsDtoAmountInItem.ts +13 -0
- package/src/enso-api/model/minAmountOutActionDto.ts +17 -0
- package/src/enso-api/model/minAmountOutArgsDto.ts +19 -0
- package/src/enso-api/model/minAmountOutArgsDtoAmountOut.ts +16 -0
- package/src/enso-api/model/minAmountOutArgsDtoMinAmountOut.ts +16 -0
- package/src/enso-api/model/multiDepositActionDto.ts +18 -0
- package/src/enso-api/model/multiDepositArgsDto.ts +24 -0
- package/src/enso-api/model/multiDepositArgsDtoAmountInItem.ts +17 -0
- package/src/enso-api/model/multiDepositArgsDtoAmountInItemAnyOf.ts +12 -0
- package/src/enso-api/model/multiOutSingleDepositActionDto.ts +18 -0
- package/src/enso-api/model/multiOutSingleDepositArgsDto.ts +24 -0
- package/src/enso-api/model/multiOutSingleDepositArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/multiRedeemActionDto.ts +18 -0
- package/src/enso-api/model/multiRedeemArgs2Dto.ts +24 -0
- package/src/enso-api/model/multiRedeemArgs2DtoAmountIn.ts +16 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +8 -0
- package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionRoutingStrategy.ts +1 -0
- package/src/enso-api/model/nontokenizedRouteShortcutTransaction.ts +31 -0
- package/src/enso-api/model/paymasterFeeActionDto.ts +17 -0
- package/src/enso-api/model/paymasterFeeArgsDto.ts +18 -0
- package/src/enso-api/model/paymasterFeeArgsDtoAmount.ts +16 -0
- package/src/enso-api/model/permitTransferFromActionDto.ts +18 -0
- package/src/enso-api/model/permitTransferFromArgsDto.ts +29 -0
- package/src/enso-api/model/permitTransferFromArgsDtoAmount.ts +20 -0
- package/src/enso-api/model/permitTransferFromArgsDtoAmountOneOfItem.ts +13 -0
- package/src/enso-api/model/permitTransferFromArgsDtoToken.ts +15 -0
- package/src/enso-api/model/positionModel.ts +14 -0
- package/src/enso-api/model/redeemActionDto.ts +18 -0
- package/src/enso-api/model/redeemArgsDto.ts +25 -0
- package/src/enso-api/model/redeemArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/redeemArgsDtoTokenOut.ts +15 -0
- package/src/enso-api/model/redeemCLMMActionDto.ts +18 -0
- package/src/enso-api/model/redeemCLMMArgsDto.ts +24 -0
- package/src/enso-api/model/redeemCLMMArgsDtoLiquidity.ts +16 -0
- package/src/enso-api/model/repayActionDto.ts +18 -0
- package/src/enso-api/model/repayArgsDto.ts +22 -0
- package/src/enso-api/model/repayArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/routeActionDto.ts +20 -0
- package/src/enso-api/model/routeArgsDto.ts +38 -0
- package/src/enso-api/model/routeArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/singleDepositActionDto.ts +18 -0
- package/src/enso-api/model/singleDepositArgsDto.ts +24 -0
- package/src/enso-api/model/singleDepositArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/singleRedeemActionDto.ts +18 -0
- package/src/enso-api/model/singleRedeemArgs2Dto.ts +24 -0
- package/src/enso-api/model/singleRedeemArgs2DtoAmountIn.ts +16 -0
- package/src/enso-api/model/slippageActionDto.ts +17 -0
- package/src/enso-api/model/slippageArgsDto.ts +18 -0
- package/src/enso-api/model/slippageArgsDtoAmountOut.ts +16 -0
- package/src/enso-api/model/splitActionDto.ts +17 -0
- package/src/enso-api/model/splitArgsDto.ts +22 -0
- package/src/enso-api/model/splitArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/swapActionDto.ts +18 -0
- package/src/enso-api/model/swapArgsDto.ts +30 -0
- package/src/enso-api/model/swapArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/tokenizedMultiDepositActionDto.ts +18 -0
- package/src/enso-api/model/tokenizedMultiDepositArgsDto.ts +24 -0
- package/src/enso-api/model/tokenizedMultiDepositArgsDtoAmountInItem.ts +17 -0
- package/src/enso-api/model/tokenizedMultiDepositArgsDtoAmountInItemAnyOf.ts +14 -0
- package/src/enso-api/model/tokenizedMultiRedeemActionDto.ts +18 -0
- package/src/enso-api/model/tokenizedMultiRedeemArgsDto.ts +24 -0
- package/src/enso-api/model/tokenizedMultiRedeemArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/tokenizedSingleDepositActionDto.ts +18 -0
- package/src/enso-api/model/tokenizedSingleDepositArgsDto.ts +24 -0
- package/src/enso-api/model/tokenizedSingleDepositArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/tokenizedSingleRedeemActionDto.ts +18 -0
- package/src/enso-api/model/tokenizedSingleRedeemArgsDto.ts +24 -0
- package/src/enso-api/model/tokenizedSingleRedeemArgsDtoAmountIn.ts +16 -0
- package/src/enso-api/model/tokensControllerTokensLiquidityType.ts +19 -0
- package/src/enso-api/model/tokensControllerTokensParams.ts +6 -0
- package/src/enso-api/model/transferActionDto.ts +18 -0
- package/src/enso-api/model/transferArgsDto.ts +22 -0
- package/src/enso-api/model/transferArgsDtoAmount.ts +16 -0
- package/src/enso-api/model/transferFromActionDto.ts +18 -0
- package/src/enso-api/model/transferFromArgsDto.ts +24 -0
- package/src/enso-api/model/transferFromArgsDtoAmount.ts +16 -0
- package/src/index.ts +1 -0
- package/src/store.ts +12 -5
- package/src/types/index.ts +9 -3
- package/src/util/common.tsx +2 -0
- package/src/util/enso-hooks.tsx +72 -11
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to swap (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type SwapArgsDtoAmountIn = string | CallOutput;
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedMultiDepositArgsDto } from "./tokenizedMultiDepositArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedMultiDepositActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TokenizedMultiDepositArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedMultiDepositArgsDtoAmountInItem } from "./tokenizedMultiDepositArgsDtoAmountInItem";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedMultiDepositArgsDto {
|
|
14
|
+
/** Input token addresses */
|
|
15
|
+
tokenIn: string[];
|
|
16
|
+
/** Output token address */
|
|
17
|
+
tokenOut: string;
|
|
18
|
+
/** Amounts to deposit (or previous output references) */
|
|
19
|
+
amountIn: TokenizedMultiDepositArgsDtoAmountInItem[];
|
|
20
|
+
/** Primary contract address */
|
|
21
|
+
primaryAddress: string;
|
|
22
|
+
/** Receiver address */
|
|
23
|
+
receiver?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedMultiDepositArgsDtoAmountInItemAnyOf } from "./tokenizedMultiDepositArgsDtoAmountInItemAnyOf";
|
|
12
|
+
|
|
13
|
+
export type TokenizedMultiDepositArgsDtoAmountInItem =
|
|
14
|
+
| string
|
|
15
|
+
| number
|
|
16
|
+
| boolean
|
|
17
|
+
| TokenizedMultiDepositArgsDtoAmountInItemAnyOf;
|
|
@@ -0,0 +1,14 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type TokenizedMultiDepositArgsDtoAmountInItemAnyOf = {
|
|
13
|
+
[key: string]: unknown;
|
|
14
|
+
};
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedMultiRedeemArgsDto } from "./tokenizedMultiRedeemArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedMultiRedeemActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TokenizedMultiRedeemArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedMultiRedeemArgsDtoAmountIn } from "./tokenizedMultiRedeemArgsDtoAmountIn";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedMultiRedeemArgsDto {
|
|
14
|
+
/** Input token address */
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
/** Output token addresses */
|
|
17
|
+
tokenOut: string[];
|
|
18
|
+
/** Amount to redeem (or previous output reference) */
|
|
19
|
+
amountIn: TokenizedMultiRedeemArgsDtoAmountIn;
|
|
20
|
+
/** Primary contract address */
|
|
21
|
+
primaryAddress: string;
|
|
22
|
+
/** Receiver address */
|
|
23
|
+
receiver?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to redeem (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type TokenizedMultiRedeemArgsDtoAmountIn = string | CallOutput;
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedSingleDepositArgsDto } from "./tokenizedSingleDepositArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedSingleDepositActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TokenizedSingleDepositArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedSingleDepositArgsDtoAmountIn } from "./tokenizedSingleDepositArgsDtoAmountIn";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedSingleDepositArgsDto {
|
|
14
|
+
/** Input token address */
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
/** Output token address */
|
|
17
|
+
tokenOut: string;
|
|
18
|
+
/** Amount to deposit (or previous output reference) */
|
|
19
|
+
amountIn: TokenizedSingleDepositArgsDtoAmountIn;
|
|
20
|
+
/** Primary contract address */
|
|
21
|
+
primaryAddress: string;
|
|
22
|
+
/** Receiver address */
|
|
23
|
+
receiver?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to deposit (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type TokenizedSingleDepositArgsDtoAmountIn = string | CallOutput;
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedSingleRedeemArgsDto } from "./tokenizedSingleRedeemArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedSingleRedeemActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TokenizedSingleRedeemArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TokenizedSingleRedeemArgsDtoAmountIn } from "./tokenizedSingleRedeemArgsDtoAmountIn";
|
|
12
|
+
|
|
13
|
+
export interface TokenizedSingleRedeemArgsDto {
|
|
14
|
+
/** Input token address */
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
/** Output token address */
|
|
17
|
+
tokenOut: string;
|
|
18
|
+
/** Amount to redeem (or previous output reference) */
|
|
19
|
+
amountIn: TokenizedSingleRedeemArgsDtoAmountIn;
|
|
20
|
+
/** Primary contract address */
|
|
21
|
+
primaryAddress: string;
|
|
22
|
+
/** Receiver address */
|
|
23
|
+
receiver?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to redeem (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type TokenizedSingleRedeemArgsDtoAmountIn = string | CallOutput;
|
|
@@ -0,0 +1,19 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
export type TokensControllerTokensLiquidityType =
|
|
13
|
+
(typeof TokensControllerTokensLiquidityType)[keyof typeof TokensControllerTokensLiquidityType];
|
|
14
|
+
|
|
15
|
+
// eslint-disable-next-line @typescript-eslint/no-redeclare
|
|
16
|
+
export const TokensControllerTokensLiquidityType = {
|
|
17
|
+
SingleToken: "SingleToken",
|
|
18
|
+
MultiToken: "MultiToken",
|
|
19
|
+
} as const;
|
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
* OpenAPI spec version: 1.0
|
|
10
10
|
*/
|
|
11
11
|
import type { TokensControllerTokensType } from "./tokensControllerTokensType";
|
|
12
|
+
import type { TokensControllerTokensLiquidityType } from "./tokensControllerTokensLiquidityType";
|
|
12
13
|
|
|
13
14
|
export type TokensControllerTokensParams = {
|
|
14
15
|
/**
|
|
@@ -53,6 +54,11 @@ export type TokensControllerTokensParams = {
|
|
|
53
54
|
*/
|
|
54
55
|
type?: TokensControllerTokensType;
|
|
55
56
|
/**
|
|
57
|
+
* Type of liquidity.
|
|
58
|
+
If not provided, both types will be taken into account
|
|
59
|
+
*/
|
|
60
|
+
liquidityType?: TokensControllerTokensLiquidityType;
|
|
61
|
+
/**
|
|
56
62
|
* Pagination page number. Pages are of length 1000
|
|
57
63
|
*/
|
|
58
64
|
page?: number;
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TransferArgsDto } from "./transferArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TransferActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TransferArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TransferArgsDtoAmount } from "./transferArgsDtoAmount";
|
|
12
|
+
|
|
13
|
+
export interface TransferArgsDto {
|
|
14
|
+
/** Token address */
|
|
15
|
+
token: string;
|
|
16
|
+
/** Amount to transfer (or previous output reference) */
|
|
17
|
+
amount: TransferArgsDtoAmount;
|
|
18
|
+
/** Receiver address */
|
|
19
|
+
receiver: string;
|
|
20
|
+
/** Optional ERC721/1155 token id */
|
|
21
|
+
id?: string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to transfer (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type TransferArgsDtoAmount = string | CallOutput;
|
|
@@ -0,0 +1,18 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TransferFromArgsDto } from "./transferFromArgsDto";
|
|
12
|
+
|
|
13
|
+
export interface TransferFromActionDto {
|
|
14
|
+
/** Protocol */
|
|
15
|
+
protocol: string;
|
|
16
|
+
action: string;
|
|
17
|
+
args: TransferFromArgsDto;
|
|
18
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { TransferFromArgsDtoAmount } from "./transferFromArgsDtoAmount";
|
|
12
|
+
|
|
13
|
+
export interface TransferFromArgsDto {
|
|
14
|
+
/** Token address */
|
|
15
|
+
token: string;
|
|
16
|
+
/** Sender address */
|
|
17
|
+
sender: string;
|
|
18
|
+
/** Receiver address */
|
|
19
|
+
receiver: string;
|
|
20
|
+
/** Amount to transfer (or previous output reference) */
|
|
21
|
+
amount: TransferFromArgsDtoAmount;
|
|
22
|
+
/** Optional ERC721/1155 token id */
|
|
23
|
+
id?: string;
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
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://enso.finance/developers).
|
|
9
|
+
* OpenAPI spec version: 1.0
|
|
10
|
+
*/
|
|
11
|
+
import type { CallOutput } from "./callOutput";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Amount to transfer (or previous output reference)
|
|
15
|
+
*/
|
|
16
|
+
export type TransferFromArgsDtoAmount = string | CallOutput;
|
package/src/index.ts
CHANGED
package/src/store.ts
CHANGED
|
@@ -3,9 +3,15 @@ import { AccessTokenPayload } from "@meshconnect/web-link-sdk";
|
|
|
3
3
|
import { DEFAULT_SLIPPAGE } from "./util/constants";
|
|
4
4
|
|
|
5
5
|
type Store = {
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
// The selected integration object from Mesh /integrations
|
|
7
|
+
selectedIntegration?: {
|
|
8
|
+
id: string;
|
|
9
|
+
type: string; // brokerType
|
|
10
|
+
name: string;
|
|
11
|
+
} | null;
|
|
12
|
+
setSelectedIntegration: (
|
|
13
|
+
selectedIntegration: { id: string; type: string; name: string } | null,
|
|
14
|
+
) => void;
|
|
9
15
|
|
|
10
16
|
ensoApiToken: string;
|
|
11
17
|
setEnsoApiToken: (ensoApiToken: string) => void;
|
|
@@ -36,8 +42,9 @@ type Store = {
|
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
export const useAppStore = create<Store>((set) => ({
|
|
39
|
-
|
|
40
|
-
|
|
45
|
+
selectedIntegration: null,
|
|
46
|
+
setSelectedIntegration: (selectedIntegration) =>
|
|
47
|
+
set({ selectedIntegration }),
|
|
41
48
|
|
|
42
49
|
ensoApiToken: "",
|
|
43
50
|
setEnsoApiToken: (ensoApiToken: string) => set({ ensoApiToken }),
|
package/src/types/index.ts
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Re-export Chakra's SystemConfig as the theme type
|
|
2
2
|
import type { SystemConfig as WidgetTheme } from "@chakra-ui/react";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
enum SupportedExchanges {
|
|
5
|
+
Binance = "binance",
|
|
6
|
+
Kraken = "kraken",
|
|
7
|
+
Coinbase = "coinbase",
|
|
8
|
+
Bybit = "bybit",
|
|
9
|
+
}
|
|
7
10
|
|
|
8
11
|
export type CheckoutConfig = {
|
|
9
12
|
tokenOut: string;
|
|
@@ -19,3 +22,6 @@ export type CheckoutModalProps = {
|
|
|
19
22
|
setIsActive: (active: boolean) => void;
|
|
20
23
|
onClose?: () => void;
|
|
21
24
|
};
|
|
25
|
+
|
|
26
|
+
export type { WidgetTheme };
|
|
27
|
+
export { SupportedExchanges };
|
package/src/util/common.tsx
CHANGED
package/src/util/enso-hooks.tsx
CHANGED
|
@@ -5,8 +5,10 @@ import { useCallback, useMemo } from "react";
|
|
|
5
5
|
import {
|
|
6
6
|
useEnsoToken,
|
|
7
7
|
useEnsoPrice,
|
|
8
|
-
|
|
8
|
+
useTokenizedRouteData,
|
|
9
9
|
useSmartAccountBalance,
|
|
10
|
+
useIsNontokenized,
|
|
11
|
+
useNontokenizedRouteData,
|
|
10
12
|
} from "@/enso-api/api";
|
|
11
13
|
import { getWalletDisplayName, getWalletIcon } from "@/util/wallet";
|
|
12
14
|
import { formatUSD, normalizeValue } from "@/util";
|
|
@@ -78,7 +80,9 @@ export const useAppDetails = () => {
|
|
|
78
80
|
const slippage = useAppStore((state) => state.slippage);
|
|
79
81
|
const chainIdIn = useAppStore((state) => state.chainIdIn);
|
|
80
82
|
const chainIdOut = useAppStore((state) => state.chainIdOut);
|
|
81
|
-
const
|
|
83
|
+
const selectedIntegration = useAppStore(
|
|
84
|
+
(state) => state.selectedIntegration,
|
|
85
|
+
);
|
|
82
86
|
|
|
83
87
|
const {
|
|
84
88
|
data: [tokenInData],
|
|
@@ -89,6 +93,42 @@ export const useAppDetails = () => {
|
|
|
89
93
|
const { data: tokenInPrice } = useEnsoPrice(chainIdIn, tokenIn);
|
|
90
94
|
const { data: tokenOutPrice } = useEnsoPrice(chainIdOut, tokenOut);
|
|
91
95
|
|
|
96
|
+
const { isNontokenized, nontokenizedData } = useIsNontokenized(
|
|
97
|
+
tokenOut,
|
|
98
|
+
chainIdOut,
|
|
99
|
+
);
|
|
100
|
+
|
|
101
|
+
// Use underlying tokens if target is nontokenized, otherwise use tokenOutData
|
|
102
|
+
const effectiveTokenOutData = useMemo(() => {
|
|
103
|
+
if (isNontokenized && nontokenizedData?.underlyingTokens) {
|
|
104
|
+
// Map underlying tokens to Token format with logoURI
|
|
105
|
+
const underlyingTokens = nontokenizedData.underlyingTokens.map(
|
|
106
|
+
(token) => ({
|
|
107
|
+
...token,
|
|
108
|
+
logoURI: token.logosUri?.[0],
|
|
109
|
+
}),
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Return first underlying token as primary, with all underlyingTokens available
|
|
113
|
+
return {
|
|
114
|
+
...underlyingTokens[0],
|
|
115
|
+
underlyingTokens,
|
|
116
|
+
protocol: nontokenizedData.protocol,
|
|
117
|
+
name:
|
|
118
|
+
nontokenizedData.protocol + " " + underlyingTokens[0].name,
|
|
119
|
+
isNontokenized: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return tokenOutData;
|
|
124
|
+
}, [isNontokenized, nontokenizedData, tokenOutData]);
|
|
125
|
+
|
|
126
|
+
const nontokenizedPrice = useEnsoPrice(
|
|
127
|
+
chainIdOut,
|
|
128
|
+
effectiveTokenOutData?.address,
|
|
129
|
+
);
|
|
130
|
+
const effectivePrice = isNontokenized ? nontokenizedPrice : tokenOutPrice;
|
|
131
|
+
|
|
92
132
|
return {
|
|
93
133
|
chainIdIn,
|
|
94
134
|
chainIdOut,
|
|
@@ -101,7 +141,10 @@ export const useAppDetails = () => {
|
|
|
101
141
|
tokenOutPrice,
|
|
102
142
|
tokenIn,
|
|
103
143
|
tokenOut,
|
|
104
|
-
|
|
144
|
+
selectedIntegration,
|
|
145
|
+
effectiveTokenOutData,
|
|
146
|
+
effectivePrice,
|
|
147
|
+
isNontokenized,
|
|
105
148
|
};
|
|
106
149
|
};
|
|
107
150
|
|
|
@@ -209,16 +252,12 @@ export const useRouteData = () => {
|
|
|
209
252
|
tokenInPrice,
|
|
210
253
|
tokenIn,
|
|
211
254
|
tokenOut,
|
|
212
|
-
|
|
255
|
+
selectedIntegration,
|
|
256
|
+
isNontokenized,
|
|
213
257
|
} = useAppDetails();
|
|
214
258
|
|
|
215
|
-
const {
|
|
216
|
-
|
|
217
|
-
isLoading,
|
|
218
|
-
error,
|
|
219
|
-
isFetched,
|
|
220
|
-
} = useEnsoData({
|
|
221
|
-
routingStrategy: isCheckout ? "checkout" : "router",
|
|
259
|
+
const standardRoute = useTokenizedRouteData({
|
|
260
|
+
routingStrategy: selectedIntegration?.type ? "checkout" : "router",
|
|
222
261
|
fromAddress: address,
|
|
223
262
|
receiver: address,
|
|
224
263
|
spender: address,
|
|
@@ -228,8 +267,30 @@ export const useRouteData = () => {
|
|
|
228
267
|
slippage,
|
|
229
268
|
chainId: chainIdIn,
|
|
230
269
|
outChainId: chainIdOut,
|
|
270
|
+
enabled: !isNontokenized,
|
|
231
271
|
});
|
|
232
272
|
|
|
273
|
+
const nontokenizedRoute = useNontokenizedRouteData({
|
|
274
|
+
routingStrategy: selectedIntegration?.type ? "checkout" : "router",
|
|
275
|
+
fromAddress: address,
|
|
276
|
+
receiver: address,
|
|
277
|
+
spender: address,
|
|
278
|
+
amountIn,
|
|
279
|
+
tokenIn,
|
|
280
|
+
positionOut: tokenOut,
|
|
281
|
+
slippage,
|
|
282
|
+
chainId: chainIdIn,
|
|
283
|
+
outChainId: chainIdOut,
|
|
284
|
+
enabled: isNontokenized,
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
const {
|
|
288
|
+
data: routeData,
|
|
289
|
+
isLoading,
|
|
290
|
+
error,
|
|
291
|
+
isFetched,
|
|
292
|
+
} = isNontokenized ? nontokenizedRoute : standardRoute;
|
|
293
|
+
|
|
233
294
|
const usdAmountIn = useMemo(
|
|
234
295
|
() =>
|
|
235
296
|
formatUSD(
|