@ensofinance/checkout-widget 0.0.16 → 0.0.17

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 (28) hide show
  1. package/dist/checkout-widget.es.js +4158 -4166
  2. package/dist/checkout-widget.es.js.map +1 -1
  3. package/dist/checkout-widget.umd.js +32 -32
  4. package/dist/checkout-widget.umd.js.map +1 -1
  5. package/orval.config.ts +14 -9
  6. package/package.json +1 -1
  7. package/src/components/steps/ExchangeFlow.tsx +0 -2
  8. package/src/enso-api/api.ts +19 -42
  9. package/src/enso-api/index.ts +491 -722
  10. package/src/enso-api/model/actionAction.ts +2 -0
  11. package/src/enso-api/model/actionToBundleAction.ts +2 -0
  12. package/src/enso-api/model/bridgeLatencyEstimate.ts +33 -0
  13. package/src/enso-api/model/bundleControllerBundleShortcutTransactionRoutingStrategy.ts +1 -1
  14. package/src/enso-api/model/bundleShortcutTransaction.ts +12 -3
  15. package/src/enso-api/model/bundleShortcutTransactionMinAmountsOut.ts +15 -0
  16. package/src/enso-api/model/index.ts +55 -53
  17. package/src/enso-api/model/nonTokenizedControllerTokensParams.ts +5 -1
  18. package/src/enso-api/model/nontokenizedControllerRouteNontokenizedShorcutTransactionParams.ts +1 -1
  19. package/src/enso-api/model/nontokenizedRouteShortcutTransaction.ts +3 -0
  20. package/src/enso-api/model/routeShortcutTransaction.ts +6 -3
  21. package/src/enso-api/model/routeShortcutVariableInputs.ts +1 -1
  22. package/src/enso-api/model/routeShortcutVariableInputsRoutingStrategy.ts +1 -1
  23. package/src/enso-api/model/routerControllerRouteShortcutTransactionRoutingStrategy.ts +1 -1
  24. package/src/enso-api/model/standardActionAction.ts +2 -0
  25. package/src/enso-api/model/userOperation.ts +6 -6
  26. package/src/enso-api/model/walletBalance.ts +20 -8
  27. package/src/enso-api/model/walletControllerCreateApproveTransactionRoutingStrategy.ts +1 -1
  28. package/src/enso-api/model/walletControllerWalletBalancesParams.ts +3 -3
package/orval.config.ts CHANGED
@@ -2,6 +2,7 @@ export default {
2
2
  enso: {
3
3
  output: {
4
4
  baseUrl: "https://api.enso.finance",
5
+ // baseUrl: "http://localhost:3000",
5
6
  mode: "single",
6
7
  prettier: true,
7
8
  target: "src/enso-api/index.ts",
@@ -24,17 +25,21 @@ export default {
24
25
  transformer: (spec: any) => {
25
26
  // Fix all malformed array schemas that have items: { type: 'array' } without proper definition
26
27
  const fixArraySchema = (obj: any) => {
27
- if (!obj || typeof obj !== 'object') return;
28
+ if (!obj || typeof obj !== "object") return;
28
29
 
29
30
  // Fix array items that are themselves arrays without proper items definition
30
- if (obj.type === 'array' && obj.items?.type === 'array' && !obj.items.items) {
31
+ if (
32
+ obj.type === "array" &&
33
+ obj.items?.type === "array" &&
34
+ !obj.items.items
35
+ ) {
31
36
  obj.items = {
32
37
  anyOf: [
33
- { type: 'string' },
34
- { type: 'number' },
35
- { type: 'boolean' },
36
- { type: 'object' },
37
- ]
38
+ { type: "string" },
39
+ { type: "number" },
40
+ { type: "boolean" },
41
+ { type: "object" },
42
+ ],
38
43
  };
39
44
  }
40
45
 
@@ -52,8 +57,8 @@ export default {
52
57
  }
53
58
 
54
59
  return spec;
55
- }
56
- }
60
+ },
61
+ },
57
62
  },
58
63
  },
59
64
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ensofinance/checkout-widget",
3
- "version": "0.0.16",
3
+ "version": "0.0.17",
4
4
  "type": "module",
5
5
  "homepage": "https://www.enso.build/",
6
6
  "repository": {
@@ -191,7 +191,6 @@ const useHandleMeshAccessPayload = () => {
191
191
  (accessTokenPayload: AccessTokenPayload, sessionId: string) => {
192
192
  setMeshAccessToken(accessTokenPayload); // Persist access token and session id for future reloads
193
193
 
194
- debugger;
195
194
  sessionStorage.setItem(
196
195
  `${deviceKey}:${selectedIntegration?.type}`,
197
196
  JSON.stringify({
@@ -349,7 +348,6 @@ const CheckSessionKeyStep = ({
349
348
  `${deviceKey}:${selectedIntegration.type}`,
350
349
  );
351
350
  // On load: check for persisted connection and hydrate state
352
- debugger;
353
351
  if (saved) {
354
352
  try {
355
353
  const parsed = JSON.parse(saved);
@@ -1,6 +1,5 @@
1
1
  import { useAccount, useConfig } from "wagmi";
2
2
  import {
3
- useRouterControllerPostRouteShortcutTransaction,
4
3
  useRouterControllerRouteShortcutTransaction,
5
4
  useTokensControllerTokens,
6
5
  useWalletControllerCreateApproveTransaction,
@@ -15,11 +14,9 @@ import { Token } from "@/util/common";
15
14
  import { useAppStore } from "@/store";
16
15
  import { Address } from "viem";
17
16
  import { formatNumber, normalizeValue } from "@/util";
18
- import { VITALIK_ADDRESS } from "@/util/constants";
19
17
  import {
20
18
  RouterControllerRouteShortcutTransactionParams,
21
19
  NontokenizedControllerRouteNontokenizedShorcutTransactionParams,
22
- NonTokenizedModel,
23
20
  ProtocolModel,
24
21
  } from "./model";
25
22
 
@@ -284,54 +281,34 @@ export const useProtocolData = (protocolSlug?: string) => {
284
281
  return { protocolData, isLoading };
285
282
  };
286
283
 
287
- export const useNontokenizedTokens = () => {
288
- const config = useConfig();
289
-
290
- const supportedChainIds = useMemo(
291
- () => config.chains.map((chain) => chain.id),
292
- [config.chains],
293
- );
294
-
284
+ export const useIsNontokenized = (tokenAddress?: string, chainId?: number) => {
295
285
  const { data, isLoading } = useNonTokenizedControllerTokens(
296
- {},
286
+ {
287
+ positionId: tokenAddress ? [tokenAddress] : undefined,
288
+ chainId,
289
+ },
297
290
  {
298
291
  query: {
299
- enabled: true,
292
+ enabled: !!tokenAddress && !!chainId,
293
+ },
294
+ },
295
+ );
296
+ const { data: addressData } = useNonTokenizedControllerTokens(
297
+ {
298
+ address: tokenAddress ? [tokenAddress] : undefined,
299
+ chainId,
300
+ },
301
+ {
302
+ query: {
303
+ enabled: !!tokenAddress && !!chainId,
300
304
  },
301
305
  },
302
306
  );
303
307
 
304
- const nontokenizedMap = useMemo(() => {
305
- if (!data?.data) return new Map<string, NonTokenizedModel>();
306
-
307
- const map = new Map<string, NonTokenizedModel>();
308
- data.data.forEach((token) => {
309
- if (supportedChainIds.includes(token.chainId)) {
310
- const key = `${token.chainId}-${token.address.toLowerCase()}`;
311
- map.set(key, token);
312
- }
313
- });
314
-
315
- return map;
316
- }, [data, supportedChainIds]);
317
-
318
- console.log(nontokenizedMap);
319
-
320
- return { nontokenizedMap, isLoading };
321
- };
322
-
323
- export const useIsNontokenized = (tokenAddress?: string, chainId?: number) => {
324
- const { nontokenizedMap, isLoading } = useNontokenizedTokens();
325
-
326
- const nontokenizedData = useMemo(() => {
327
- if (!tokenAddress || !chainId) return null;
328
-
329
- const key = `${chainId}-${tokenAddress.toLowerCase()}`;
330
- return nontokenizedMap.get(key) || null;
331
- }, [tokenAddress, chainId, nontokenizedMap]);
308
+ const nontokenizedData = data?.data?.[0] || addressData?.data?.[0] || null;
332
309
 
333
310
  return {
334
- isNontokenized: !!nontokenizedData,
311
+ isNontokenized: Boolean(nontokenizedData),
335
312
  nontokenizedData,
336
313
  isLoading,
337
314
  };