@ensofinance/checkout-widget 0.0.1

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 (128) hide show
  1. package/dist/checkout-widget.es.js +52889 -0
  2. package/dist/checkout-widget.es.js.map +1 -0
  3. package/dist/checkout-widget.umd.js +203 -0
  4. package/dist/checkout-widget.umd.js.map +1 -0
  5. package/dist/index.d.ts +23 -0
  6. package/enso-api.yaml +1982 -0
  7. package/orval.config.ts +25 -0
  8. package/package.json +79 -0
  9. package/src/assets/BinanceBadge.svg +4 -0
  10. package/src/assets/CoinbaseIcon.svg +4 -0
  11. package/src/assets/USD Coin (USDC).svg +5 -0
  12. package/src/assets/avecIcon.svg +5 -0
  13. package/src/assets/base.webp +0 -0
  14. package/src/assets/depositIcon.svg +6 -0
  15. package/src/assets/eth.webp +0 -0
  16. package/src/assets/ethMainnetIcon.svg +10 -0
  17. package/src/assets/fail.svg +5 -0
  18. package/src/assets/kraken.png +0 -0
  19. package/src/assets/logo.svg +10 -0
  20. package/src/assets/mastercard.png +0 -0
  21. package/src/assets/metamask.png +0 -0
  22. package/src/assets/rabby.png +0 -0
  23. package/src/assets/success.svg +4 -0
  24. package/src/assets/usdc.webp +0 -0
  25. package/src/assets/usdt.webp +0 -0
  26. package/src/assets/visa.png +0 -0
  27. package/src/assets/visa.webp +0 -0
  28. package/src/components/BridgeFee.tsx +58 -0
  29. package/src/components/ChakraProvider.tsx +372 -0
  30. package/src/components/Checkout.tsx +127 -0
  31. package/src/components/CheckoutModal.tsx +22 -0
  32. package/src/components/CircleTimer.tsx +66 -0
  33. package/src/components/CurrencySwapDisplay.tsx +153 -0
  34. package/src/components/DepositProcessing.tsx +116 -0
  35. package/src/components/ExchangeConfirmSecurity.tsx +110 -0
  36. package/src/components/QuoteParameters.tsx +341 -0
  37. package/src/components/TransactionDetailRow.tsx +124 -0
  38. package/src/components/cards/AssetCard.tsx +167 -0
  39. package/src/components/cards/ExchangeCard.tsx +53 -0
  40. package/src/components/cards/OptionCard.tsx +59 -0
  41. package/src/components/cards/WalletCard.tsx +99 -0
  42. package/src/components/cards/index.ts +6 -0
  43. package/src/components/modal.tsx +83 -0
  44. package/src/components/steps/ExchangeFlow.tsx +1402 -0
  45. package/src/components/steps/InitialStep.tsx +169 -0
  46. package/src/components/steps/QuoteStep.tsx +121 -0
  47. package/src/components/steps/WalletAmountStep.tsx +258 -0
  48. package/src/components/steps/WalletConfirmStep.tsx +404 -0
  49. package/src/components/steps/WalletTokenStep.tsx +128 -0
  50. package/src/components/ui/index.tsx +394 -0
  51. package/src/components/ui/styled.tsx +85 -0
  52. package/src/components/ui/toaster.tsx +43 -0
  53. package/src/components/ui/tooltip.tsx +46 -0
  54. package/src/enso-api/api.ts +173 -0
  55. package/src/enso-api/custom-instance.ts +35 -0
  56. package/src/enso-api/index.ts +5119 -0
  57. package/src/enso-api/model/action.ts +17 -0
  58. package/src/enso-api/model/actionAction.ts +52 -0
  59. package/src/enso-api/model/actionInputs.ts +12 -0
  60. package/src/enso-api/model/actionToBundle.ts +19 -0
  61. package/src/enso-api/model/actionToBundleAction.ts +53 -0
  62. package/src/enso-api/model/actionToBundleArgs.ts +12 -0
  63. package/src/enso-api/model/bundleControllerBundleShortcutTransactionParams.ts +53 -0
  64. package/src/enso-api/model/bundleControllerBundleShortcutTransactionRoutingStrategy.ts +23 -0
  65. package/src/enso-api/model/bundleShortcutTransaction.ts +35 -0
  66. package/src/enso-api/model/bundleShortcutTransactionAmountsOut.ts +15 -0
  67. package/src/enso-api/model/bundleShortcutTransactionFeeAmount.ts +12 -0
  68. package/src/enso-api/model/connectedNetwork.ts +16 -0
  69. package/src/enso-api/model/hop.ts +24 -0
  70. package/src/enso-api/model/hopArgs.ts +12 -0
  71. package/src/enso-api/model/index.ts +70 -0
  72. package/src/enso-api/model/iporControllerIporShortcutTransactionParams.ts +21 -0
  73. package/src/enso-api/model/iporShortcutInput.ts +33 -0
  74. package/src/enso-api/model/iporShortcutTransaction.ts +22 -0
  75. package/src/enso-api/model/lZDestinationTokenData.ts +19 -0
  76. package/src/enso-api/model/lZPoolLookupResponse.ts +26 -0
  77. package/src/enso-api/model/layerZeroControllerGetPoolAddressParams.ts +29 -0
  78. package/src/enso-api/model/network.ts +15 -0
  79. package/src/enso-api/model/networksControllerNetworksParams.ts +21 -0
  80. package/src/enso-api/model/nonTokenizedControllerTokens200.ts +15 -0
  81. package/src/enso-api/model/nonTokenizedControllerTokens200AllOf.ts +16 -0
  82. package/src/enso-api/model/nonTokenizedControllerTokensParams.ts +41 -0
  83. package/src/enso-api/model/nonTokenizedModel.ts +27 -0
  84. package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +64 -0
  85. package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionRoutingStrategy.ts +22 -0
  86. package/src/enso-api/model/paginatedResult.ts +16 -0
  87. package/src/enso-api/model/paginationMeta.ts +27 -0
  88. package/src/enso-api/model/positionModel.ts +77 -0
  89. package/src/enso-api/model/price.ts +20 -0
  90. package/src/enso-api/model/pricesControllerGetPricesParams.ts +17 -0
  91. package/src/enso-api/model/project.ts +15 -0
  92. package/src/enso-api/model/protocol.ts +15 -0
  93. package/src/enso-api/model/protocolModel.ts +26 -0
  94. package/src/enso-api/model/protocolsControllerFindAllParams.ts +21 -0
  95. package/src/enso-api/model/routeShortcutTransaction.ts +33 -0
  96. package/src/enso-api/model/routeShortcutVariableInputs.ts +68 -0
  97. package/src/enso-api/model/routeShortcutVariableInputsRoutingStrategy.ts +27 -0
  98. package/src/enso-api/model/routeShortcutVariableInputsVariableEstimates.ts +14 -0
  99. package/src/enso-api/model/routerControllerRouteShortcutTransactionParams.ts +91 -0
  100. package/src/enso-api/model/routerControllerRouteShortcutTransactionRoutingStrategy.ts +23 -0
  101. package/src/enso-api/model/standard.ts +18 -0
  102. package/src/enso-api/model/standardAction.ts +20 -0
  103. package/src/enso-api/model/standardActionAction.ts +53 -0
  104. package/src/enso-api/model/tokenModel.ts +36 -0
  105. package/src/enso-api/model/tokensControllerTokens200.ts +15 -0
  106. package/src/enso-api/model/tokensControllerTokens200AllOf.ts +16 -0
  107. package/src/enso-api/model/tokensControllerTokensParams.ts +91 -0
  108. package/src/enso-api/model/tokensControllerTokensType.ts +19 -0
  109. package/src/enso-api/model/transaction.ts +17 -0
  110. package/src/enso-api/model/userOperation.ts +28 -0
  111. package/src/enso-api/model/walletApproveTransaction.ts +24 -0
  112. package/src/enso-api/model/walletApproveTransactionTx.ts +15 -0
  113. package/src/enso-api/model/walletBalance.ts +29 -0
  114. package/src/enso-api/model/walletControllerCreateApproveTransactionParams.ts +35 -0
  115. package/src/enso-api/model/walletControllerCreateApproveTransactionRoutingStrategy.ts +23 -0
  116. package/src/enso-api/model/walletControllerWalletBalancesParams.ts +25 -0
  117. package/src/index.ts +17 -0
  118. package/src/store.ts +68 -0
  119. package/src/types/assets.d.ts +29 -0
  120. package/src/types/index.ts +21 -0
  121. package/src/util/common.tsx +324 -0
  122. package/src/util/constants.tsx +213 -0
  123. package/src/util/enso-hooks.tsx +203 -0
  124. package/src/util/index.tsx +68 -0
  125. package/src/util/tx-tracker.tsx +301 -0
  126. package/src/util/wallet.tsx +258 -0
  127. package/tsconfig.json +13 -0
  128. package/vite.config.ts +51 -0
@@ -0,0 +1,23 @@
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 RouterControllerRouteShortcutTransactionRoutingStrategy =
13
+ | (typeof RouterControllerRouteShortcutTransactionRoutingStrategy)[keyof typeof RouterControllerRouteShortcutTransactionRoutingStrategy]
14
+ | null;
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
17
+ export const RouterControllerRouteShortcutTransactionRoutingStrategy = {
18
+ ensowallet: "ensowallet",
19
+ router: "router",
20
+ delegate: "delegate",
21
+ "router-legacy": "router-legacy",
22
+ "delegate-legacy": "delegate-legacy",
23
+ } as const;
@@ -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 { Protocol } from "./protocol";
12
+ import type { StandardAction } from "./standardAction";
13
+
14
+ export interface Standard {
15
+ protocol: Protocol;
16
+ forks: Protocol[];
17
+ actions: StandardAction[];
18
+ }
@@ -0,0 +1,20 @@
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 { StandardActionAction } from "./standardActionAction";
12
+ import type { Network } from "./network";
13
+
14
+ export interface StandardAction {
15
+ action: StandardActionAction;
16
+ name: string;
17
+ functionNames: string[];
18
+ supportedChains: Network[];
19
+ inputs: string[];
20
+ }
@@ -0,0 +1,53 @@
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 StandardActionAction =
13
+ (typeof StandardActionAction)[keyof typeof StandardActionAction];
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
16
+ export const StandardActionAction = {
17
+ approve: "approve",
18
+ borrow: "borrow",
19
+ borrowwithpositionid: "borrowwithpositionid",
20
+ bridge: "bridge",
21
+ deposit: "deposit",
22
+ singledeposit: "singledeposit",
23
+ singledepositwithpositionid: "singledepositwithpositionid",
24
+ multideposit: "multideposit",
25
+ tokenizedsingledeposit: "tokenizedsingledeposit",
26
+ tokenizedmultideposit: "tokenizedmultideposit",
27
+ multioutsingledeposit: "multioutsingledeposit",
28
+ depositclmm: "depositclmm",
29
+ harvest: "harvest",
30
+ permittransferfrom: "permittransferfrom",
31
+ redeem: "redeem",
32
+ singleredeem: "singleredeem",
33
+ singleredeemwithpositionid: "singleredeemwithpositionid",
34
+ multiredeem: "multiredeem",
35
+ tokenizedsingleredeem: "tokenizedsingleredeem",
36
+ tokenizedmultiredeem: "tokenizedmultiredeem",
37
+ redeemclmm: "redeemclmm",
38
+ repay: "repay",
39
+ repaywithpositionid: "repaywithpositionid",
40
+ swap: "swap",
41
+ transfer: "transfer",
42
+ transferfrom: "transferfrom",
43
+ route: "route",
44
+ call: "call",
45
+ split: "split",
46
+ merge: "merge",
47
+ balance: "balance",
48
+ minamountout: "minamountout",
49
+ slippage: "slippage",
50
+ fee: "fee",
51
+ ensofee: "ensofee",
52
+ paymasterfee: "paymasterfee",
53
+ } as const;
@@ -0,0 +1,36 @@
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 interface TokenModel {
13
+ /** Ethereum address of the token */
14
+ address: string;
15
+ /** Chain ID of the network of the token */
16
+ chainId: number;
17
+ /** Type of token */
18
+ type: string;
19
+ /** Token decimals */
20
+ decimals: number;
21
+ /**
22
+ * Token name
23
+ * @nullable
24
+ */
25
+ symbol: string | null;
26
+ /**
27
+ * Token symbol
28
+ * @nullable
29
+ */
30
+ name: string | null;
31
+ /**
32
+ * A list of logos for the token
33
+ * @nullable
34
+ */
35
+ logosUri: string[] | null;
36
+ }
@@ -0,0 +1,15 @@
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 { PaginatedResult } from "./paginatedResult";
12
+ import type { TokensControllerTokens200AllOf } from "./tokensControllerTokens200AllOf";
13
+
14
+ export type TokensControllerTokens200 = PaginatedResult &
15
+ TokensControllerTokens200AllOf;
@@ -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 { PositionModel } from "./positionModel";
12
+
13
+ export type TokensControllerTokens200AllOf = {
14
+ /** Returned data for current page */
15
+ data?: PositionModel[];
16
+ };
@@ -0,0 +1,91 @@
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 { TokensControllerTokensType } from "./tokensControllerTokensType";
12
+
13
+ export type TokensControllerTokensParams = {
14
+ /**
15
+ * The overarching project or platform associated with the DeFi token
16
+ */
17
+ project?: string;
18
+ /**
19
+ * The specific standard integration or version of the DeFi project
20
+ */
21
+ protocolSlug?: string;
22
+ /**
23
+ * Underlying tokens of defi token
24
+ */
25
+ underlyingTokens?: string[];
26
+ /**
27
+ * Exact composition of underlying tokens of defi token
28
+ */
29
+ underlyingTokensExact?: string[];
30
+ /**
31
+ * Ethereum addresses for contract interaction of defi tokens
32
+ */
33
+ primaryAddress?: string[];
34
+ /**
35
+ * Ethereum addresses of the tokens
36
+ */
37
+ address?: string[];
38
+ /**
39
+ * Names of the tokens
40
+ */
41
+ name?: string[];
42
+ /**
43
+ * Symbols of the tokens
44
+ */
45
+ symbol?: string[];
46
+ /**
47
+ * Chain ID of the network of the token
48
+ */
49
+ chainId?: number;
50
+ /**
51
+ * Type of token.
52
+ If not provided, both types will be taken into account
53
+ */
54
+ type?: TokensControllerTokensType;
55
+ /**
56
+ * Pagination page number. Pages are of length 1000
57
+ */
58
+ page?: number;
59
+ /**
60
+ * Number of items per page (max 1000)
61
+ */
62
+ pageSize?: number;
63
+ /**
64
+ * Cursor for pagination. Pages are of length 1000
65
+ */
66
+ cursor?: number;
67
+ /**
68
+ * Whether to include token metadata (symbol, name and logos)
69
+ */
70
+ includeMetadata?: boolean;
71
+ /**
72
+ * Whether to include underlying tokes
73
+ */
74
+ includeUnderlying?: boolean;
75
+ /**
76
+ * Only include tokens with APY over this value
77
+ */
78
+ apyFrom?: number;
79
+ /**
80
+ * Only include tokens with APY below this value
81
+ */
82
+ apyTo?: number;
83
+ /**
84
+ * Only include tokens with TVL over this value
85
+ */
86
+ tvlFrom?: number;
87
+ /**
88
+ * Only include tokens with TVL below this value
89
+ */
90
+ tvlTo?: number;
91
+ };
@@ -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 TokensControllerTokensType =
13
+ (typeof TokensControllerTokensType)[keyof typeof TokensControllerTokensType];
14
+
15
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
16
+ export const TokensControllerTokensType = {
17
+ defi: "defi",
18
+ base: "base",
19
+ } as const;
@@ -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
+
12
+ export interface Transaction {
13
+ data: string;
14
+ to: string;
15
+ from: string;
16
+ value: string;
17
+ }
@@ -0,0 +1,28 @@
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 interface UserOperation {
13
+ callData: string;
14
+ callGasLimit: string;
15
+ factory: string;
16
+ factoryData: string;
17
+ maxFeePerGas: string;
18
+ maxPriorityFeePerGas: string;
19
+ nonce: string;
20
+ paymaster: string;
21
+ paymasterData: string;
22
+ paymasterPostOpGasLimit: string;
23
+ paymasterVerificationGasLimit: string;
24
+ preVerificationGas: string;
25
+ sender: string;
26
+ signature: string;
27
+ verificationGasLimit: string;
28
+ }
@@ -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 { WalletApproveTransactionTx } from "./walletApproveTransactionTx";
12
+
13
+ export interface WalletApproveTransaction {
14
+ /** The tx object to use in `ethers` */
15
+ tx: WalletApproveTransactionTx;
16
+ /** The gas estimate for the transaction */
17
+ gas: string;
18
+ /** The token address to approve */
19
+ token: string;
20
+ /** The amount of tokens to approve */
21
+ amount: string;
22
+ /** The spender address to approve */
23
+ spender: string;
24
+ }
@@ -0,0 +1,15 @@
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
+ /**
13
+ * The tx object to use in `ethers`
14
+ */
15
+ export type WalletApproveTransactionTx = { [key: string]: unknown };
@@ -0,0 +1,29 @@
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 interface WalletBalance {
13
+ /** The address of the token */
14
+ token: string;
15
+ /** The unformatted balance of the token */
16
+ amount: string;
17
+ /** Chain ID of the network */
18
+ chainId: number;
19
+ /** The unformatted balance of the token */
20
+ decimals: number;
21
+ /** Price of the token in usd */
22
+ price: string;
23
+ /** Name of the token */
24
+ name: string;
25
+ /** Symbol of the token */
26
+ symbol: string;
27
+ /** Logo of the token */
28
+ logoUri: string;
29
+ }
@@ -0,0 +1,35 @@
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 { WalletControllerCreateApproveTransactionRoutingStrategy } from "./walletControllerCreateApproveTransactionRoutingStrategy";
12
+
13
+ export type WalletControllerCreateApproveTransactionParams = {
14
+ /**
15
+ * Chain ID of the network to execute the transaction on
16
+ */
17
+ chainId?: number;
18
+ /**
19
+ * Ethereum address of the wallet to send the transaction from
20
+ */
21
+ fromAddress?: string;
22
+ /**
23
+ * Routing strategy to use
24
+ * @nullable
25
+ */
26
+ routingStrategy?: WalletControllerCreateApproveTransactionRoutingStrategy;
27
+ /**
28
+ * ERC20 token address of the token to approve
29
+ */
30
+ tokenAddress?: string;
31
+ /**
32
+ * Amount of tokens to approve in wei
33
+ */
34
+ amount?: string;
35
+ };
@@ -0,0 +1,23 @@
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 WalletControllerCreateApproveTransactionRoutingStrategy =
13
+ | (typeof WalletControllerCreateApproveTransactionRoutingStrategy)[keyof typeof WalletControllerCreateApproveTransactionRoutingStrategy]
14
+ | null;
15
+
16
+ // eslint-disable-next-line @typescript-eslint/no-redeclare
17
+ export const WalletControllerCreateApproveTransactionRoutingStrategy = {
18
+ ensowallet: "ensowallet",
19
+ router: "router",
20
+ delegate: "delegate",
21
+ "router-legacy": "router-legacy",
22
+ "delegate-legacy": "delegate-legacy",
23
+ } as const;
@@ -0,0 +1,25 @@
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 WalletControllerWalletBalancesParams = {
13
+ /**
14
+ * Chain ID (or 'all') to fetch balances for specified network
15
+ */
16
+ chainId: number;
17
+ /**
18
+ * Address of the eoa with which to associate the ensoWallet for balances
19
+ */
20
+ eoaAddress?: string;
21
+ /**
22
+ * If true returns balances for the provided address, instead of the associated ensoWallet
23
+ */
24
+ useEoa?: boolean;
25
+ };
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
1
+ import { CheckoutModal } from "./components/CheckoutModal";
2
+ import { Checkout } from "./components/Checkout";
3
+ import { type CheckoutModalProps, type CheckoutConfig } from "@/types";
4
+
5
+ // Export two versions for different integration needs
6
+ export {
7
+ // Modal version with isActive/setIsActive control
8
+ CheckoutModal,
9
+ CheckoutModalProps,
10
+
11
+ // Standalone widget version without modal
12
+ Checkout,
13
+ CheckoutConfig,
14
+ };
15
+
16
+ // Export theme type for TypeScript users
17
+ export type { WidgetTheme } from "./types";
package/src/store.ts ADDED
@@ -0,0 +1,68 @@
1
+ import { create } from "zustand";
2
+ import { DEFAULT_SLIPPAGE } from "./util/constants";
3
+ import { AccessTokenPayload } from "@meshconnect/web-link-sdk";
4
+
5
+ type Store = {
6
+ isCheckout: boolean;
7
+ setIsCheckout: (isCheckout: boolean) => void;
8
+
9
+ ensoApiToken: string;
10
+ setEnsoApiToken: (ensoApiToken: string) => void;
11
+
12
+ tokenIn: string;
13
+ setTokenIn: (tokenIn: string) => void;
14
+ tokenOut: string;
15
+ setTokenOut: (tokenOut: string) => void;
16
+ chainIdIn?: number;
17
+ setChainIdIn: (chainIdIn: number) => void;
18
+ chainIdOut?: number;
19
+ setChainIdOut: (chainIdOut: number) => void;
20
+ amountIn?: string;
21
+ setAmountIn: (amountIn: string) => void;
22
+
23
+ slippage?: number;
24
+ setSlippage: (slippage: number) => void;
25
+
26
+ // Mesh integration
27
+ meshAccessToken: AccessTokenPayload | null;
28
+ setMeshAccessToken: (meshAccessToken: AccessTokenPayload) => void;
29
+
30
+ // api state
31
+ sessionId: string;
32
+ setSessionId: (sessionId: string) => void;
33
+ linkToken: string;
34
+ setLinkToken: (linkToken: string) => void;
35
+ };
36
+
37
+ export const useAppStore = create<Store>((set) => ({
38
+ isCheckout: false,
39
+ setIsCheckout: (isCheckout: boolean) => set({ isCheckout }),
40
+
41
+ ensoApiToken: "",
42
+ setEnsoApiToken: (ensoApiToken: string) => set({ ensoApiToken }),
43
+
44
+ tokenIn: "",
45
+ setTokenIn: (tokenIn: string) => set({ tokenIn }),
46
+ tokenOut: "",
47
+ setTokenOut: (tokenOut: string) => set({ tokenOut }),
48
+ chainIdIn: undefined,
49
+ setChainIdIn: (chainIdIn: number) => set({ chainIdIn }),
50
+ chainIdOut: undefined,
51
+ setChainIdOut: (chainIdOut: number) => set({ chainIdOut }),
52
+ amountIn: "0",
53
+ setAmountIn: (amountIn: string) => set({ amountIn }),
54
+
55
+ slippage: DEFAULT_SLIPPAGE,
56
+ setSlippage: (slippage: number) => set({ slippage }),
57
+
58
+ // Mesh integration
59
+ meshAccessToken: null,
60
+ setMeshAccessToken: (meshAccessToken: AccessTokenPayload) =>
61
+ set({ meshAccessToken }),
62
+
63
+ // api state
64
+ sessionId: "",
65
+ setSessionId: (sessionId: string) => set({ sessionId }),
66
+ linkToken: "",
67
+ setLinkToken: (linkToken: string) => set({ linkToken }),
68
+ }));
@@ -0,0 +1,29 @@
1
+ declare module "*.png" {
2
+ const value: string;
3
+ export default value;
4
+ }
5
+
6
+ declare module "*.svg" {
7
+ const value: string;
8
+ export default value;
9
+ }
10
+
11
+ declare module "*.jpg" {
12
+ const value: string;
13
+ export default value;
14
+ }
15
+
16
+ declare module "*.jpeg" {
17
+ const value: string;
18
+ export default value;
19
+ }
20
+
21
+ declare module "*.gif" {
22
+ const value: string;
23
+ export default value;
24
+ }
25
+
26
+ declare module "*.webp" {
27
+ const value: string;
28
+ export default value;
29
+ }
@@ -0,0 +1,21 @@
1
+ // Re-export Chakra's SystemConfig as the theme type
2
+ import type { SystemConfig as WidgetTheme } from "@chakra-ui/react";
3
+
4
+ export type { WidgetTheme };
5
+
6
+ export type SupportedExchanges = "binance";
7
+
8
+ export type CheckoutConfig = {
9
+ tokenOut: string;
10
+ chainIdOut: number;
11
+ apiKey: string;
12
+ theme?: WidgetTheme;
13
+ enableExchange?: SupportedExchanges[];
14
+ };
15
+
16
+ export type CheckoutModalProps = {
17
+ config: CheckoutConfig;
18
+ isActive: boolean;
19
+ setIsActive: (active: boolean) => void;
20
+ onClose?: () => void;
21
+ };