@aurora-is-near/intents-swap-widget 2.6.0 → 2.6.2

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 (83) hide show
  1. package/dist/components/InputAmount.d.ts +2 -2
  2. package/dist/{config-DN8VJllh.js → config-Dq9mlDST.js} +101 -103
  3. package/dist/{config-DN8VJllh.js.map → config-Dq9mlDST.js.map} +1 -1
  4. package/dist/config.d.ts +6 -31
  5. package/dist/config.js +4 -6
  6. package/dist/errors.js +1 -1
  7. package/dist/ext/alchemy/index.d.ts +1 -1
  8. package/dist/ext/alchemy/index.js +1 -1
  9. package/dist/ext/index.js +1 -1
  10. package/dist/features/BalanceRpcLoader/index.js +4 -4
  11. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +3 -3
  12. package/dist/features/ChainsDropdown/index.js +9 -9
  13. package/dist/features/DepositMethodSwitcher.js +1 -1
  14. package/dist/features/ErrorBoundary.js +1 -1
  15. package/dist/features/ExternalDeposit.js +1 -1
  16. package/dist/features/SendAddress/index.js +5 -5
  17. package/dist/features/SendAddress/useNotification.js +1 -1
  18. package/dist/features/SubmitButton/index.js +1 -1
  19. package/dist/features/SuccessScreen/index.js +1 -1
  20. package/dist/features/SwapDirectionSwitcher.js +1 -1
  21. package/dist/features/SwapQuote/SwapQuote.js +1 -1
  22. package/dist/features/TokenInput/TokenInput.js +7 -7
  23. package/dist/features/TokenInput/TokenInputSource.js +1 -1
  24. package/dist/features/TokenInput/TokenInputTarget.js +1 -1
  25. package/dist/features/TokenInput/WalletBalance.js +1 -1
  26. package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
  27. package/dist/features/TokenInput/utils/getPercentageDeltaColor.d.ts +1 -1
  28. package/dist/features/TokensList/TokenItem.js +4 -4
  29. package/dist/features/TokensList/TokensList.js +10 -10
  30. package/dist/features/TokensModal.js +4 -4
  31. package/dist/features/WalletCompatibilityCheck/index.js +7 -7
  32. package/dist/hooks/index.js +1 -1
  33. package/dist/hooks/useChains.js +1 -1
  34. package/dist/hooks/useCompatibilityCheck.js +1 -1
  35. package/dist/hooks/useDefaultToken.js +1 -1
  36. package/dist/hooks/useExternalDepositStatus.js +1 -1
  37. package/dist/hooks/useIntentsBalance.js +1 -1
  38. package/dist/hooks/useMakeDepositAddress.js +2 -2
  39. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  40. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  41. package/dist/hooks/useMakeQuote.js +1 -1
  42. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  43. package/dist/hooks/useMakeTransfer.js +1 -1
  44. package/dist/hooks/useMergedBalance.js +1 -1
  45. package/dist/hooks/useTokenInputPair.d.ts +1 -1
  46. package/dist/hooks/useTokenInputPair.js +1 -1
  47. package/dist/hooks/useTokens.js +1 -1
  48. package/dist/hooks/useTokensFiltered.js +1 -1
  49. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  50. package/dist/index.d.ts +1 -0
  51. package/dist/index.js +109 -108
  52. package/dist/machine/effects/index.js +1 -1
  53. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  54. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  55. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  56. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  57. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  58. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  59. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  60. package/dist/machine/events/index.js +1 -1
  61. package/dist/machine/events/tokenSelect.js +1 -1
  62. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  63. package/dist/machine/index.js +1 -1
  64. package/dist/machine/snap.js +1 -1
  65. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  66. package/dist/machine/subscriptions/index.js +1 -1
  67. package/dist/types/config.d.ts +89 -0
  68. package/dist/types/config.js +2 -0
  69. package/dist/types/config.js.map +1 -0
  70. package/dist/utils/intents/signers/near.js +1 -1
  71. package/dist/utils/intents/signers/privy.js +1 -1
  72. package/dist/utils/localstorage.js +32 -19
  73. package/dist/utils/localstorage.js.map +1 -1
  74. package/dist/utils/near/getNearNep141StorageBalance.js +4 -4
  75. package/dist/widgets/WidgetDeposit.js +5 -5
  76. package/dist/widgets/WidgetSwap.js +7 -7
  77. package/dist/widgets/WidgetWithdraw.js +5 -5
  78. package/package.json +1 -1
  79. package/src/config.tsx +9 -44
  80. package/src/index.ts +2 -0
  81. package/src/machine/effects/useSelectedTokensEffect.ts +1 -1
  82. package/src/types/config.ts +131 -0
  83. package/src/utils/localstorage.ts +33 -6
@@ -1,9 +1,9 @@
1
1
  import { InputElement } from 'imask';
2
2
  import { IMaskMixinProps } from 'react-imask';
3
3
  import { Props as InputProps } from './Input';
4
- export declare const MaskedInputAmount: import('react').ForwardRefExoticComponent<(IMaskMixinProps<InputElement> & Omit<InputProps, "className" | "children"> & {
4
+ export declare const MaskedInputAmount: import('react').ForwardRefExoticComponent<(IMaskMixinProps<InputElement> & Omit<InputProps, "children" | "className"> & {
5
5
  rawValue: string;
6
- }) & import('react').RefAttributes<import('react').ComponentType<IMaskMixinProps<InputElement> & Omit<InputProps, "className" | "children"> & {
6
+ }) & import('react').RefAttributes<import('react').ComponentType<IMaskMixinProps<InputElement> & Omit<InputProps, "children" | "className"> & {
7
7
  rawValue: string;
8
8
  }>>>;
9
9
  export declare const InputAmount: ({ value, setValue, ...props }: Omit<InputProps, "value"> & {
@@ -1,23 +1,23 @@
1
1
  import { jsx as q } from "react/jsx-runtime";
2
2
  import Te from "i18next";
3
3
  import { deepClone as M } from "valtio/utils";
4
- import { useSnapshot as P, snapshot as G, proxy as ne } from "valtio";
5
- import { useMemo as C, useEffect as h, useRef as O, createContext as Ie, useContext as ke } from "react";
4
+ import { useSnapshot as P, snapshot as $, proxy as ne } from "valtio";
5
+ import { useMemo as D, useEffect as h, useRef as O, createContext as Ie, useContext as ke } from "react";
6
6
  import { useQuery as se, useInfiniteQuery as ge, useQueryClient as Ae, QueryClient as he, QueryClientProvider as we } from "@tanstack/react-query";
7
7
  import { I18nextProvider as ye } from "react-i18next";
8
- import { CHAINS_LIST as Se, DEFAULT_CHAIN_ICON as be, DRY_QUOTE_ADDRESSES as J, CHAIN_POA_MAP as _e, CHAIN_BASE_TOKENS as Ee, EVM_CHAINS as ve } from "./constants/chains.js";
8
+ import { CHAINS_LIST as Se, DEFAULT_CHAIN_ICON as _e, DRY_QUOTE_ADDRESSES as J, CHAIN_POA_MAP as be, CHAIN_BASE_TOKENS as Ee, EVM_CHAINS as ve } from "./constants/chains.js";
9
9
  import { ErrorBoundary as Ne } from "react-error-boundary";
10
- import { derive as Ce } from "derive-valtio";
11
- import { machine as x, moveTo as y } from "./machine/machine.js";
10
+ import { derive as De } from "derive-valtio";
11
+ import { machine as L, moveTo as y } from "./machine/machine.js";
12
12
  import { guardStates as S } from "./machine/guards/index.js";
13
- import { getUsdTradeDelta as De } from "./machine/computed/getUsdTradeDelta.js";
13
+ import { getUsdTradeDelta as Ce } from "./machine/computed/getUsdTradeDelta.js";
14
14
  import { getIsDirectTransfer as qe } from "./machine/computed/getIsDirectTransfer.js";
15
15
  import { getIsDirectNonNearWithdrawal as Oe } from "./machine/computed/getIsDirectNonNearWithdrawal.js";
16
- import { getIsNearToIntentsSameAssetTransfer as xe } from "./machine/computed/getIsNearToIntentsSameAssetTransfer.js";
16
+ import { getIsNearToIntentsSameAssetTransfer as Le } from "./machine/computed/getIsNearToIntentsSameAssetTransfer.js";
17
17
  import { getIsDirectNearDeposit as Be } from "./machine/computed/getIsDirectNearDeposit.js";
18
18
  import "ethers";
19
- import Le from "lodash.once";
20
- import { logger as b } from "./logger.js";
19
+ import xe from "lodash.once";
20
+ import { logger as _ } from "./logger.js";
21
21
  import { fireEvent as d } from "./machine/events/utils/fireEvent.js";
22
22
  import { validateDryInputs as oe, validateExternalInputs as re, validateInternalInputs as ae } from "./machine/events/validateInputs.js";
23
23
  import { isQuoteIdle as Ue } from "./machine/subscriptions/checkers/isQuoteIdle.js";
@@ -26,12 +26,12 @@ import { isErrorChanged as Pe } from "./machine/subscriptions/checkers/isErrorCh
26
26
  import { isOnlyErrorChanged as We } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
27
27
  import { isValidInitialState as Re } from "./machine/subscriptions/checkers/isValidInitialState.js";
28
28
  import { isWalletDisconnected as Me } from "./machine/subscriptions/checkers/isWalletDisconnected.js";
29
- import { isSendAddressForbidden as Ve } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
30
- import { useAddClassToPortal as Fe } from "./hooks/useAddClassToPortal.js";
31
- import { initLocalisation as $e } from "./localisation.js";
32
- import { isAmountChangedFromQuote as Ge } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
29
+ import { isSendAddressForbidden as Fe } from "./machine/subscriptions/checkers/isSendAddressForbidden.js";
30
+ import { useAddClassToPortal as Ve } from "./hooks/useAddClassToPortal.js";
31
+ import { initLocalisation as Ge } from "./localisation.js";
32
+ import { isAmountChangedFromQuote as $e } from "./machine/subscriptions/checkers/isAmountChangedFromQuote.js";
33
33
  import { reset as Ke } from "./machine/events/reset.js";
34
- import { tokenSelectRotate as V } from "./machine/events/tokenSelectRotate.js";
34
+ import { tokenSelectRotate as F } from "./machine/events/tokenSelectRotate.js";
35
35
  import { errorSet as He } from "./machine/events/errorSet.js";
36
36
  import { quoteSet as je } from "./machine/events/quoteSet.js";
37
37
  import { addressSet as ze } from "./machine/events/addressSet.js";
@@ -43,7 +43,7 @@ import { walletAddressSet as Ye } from "./machine/events/walletAddressSet.js";
43
43
  import { tokenSetBalance as et } from "./machine/events/tokenSetBalance.js";
44
44
  import { transferSetStatus as tt } from "./machine/events/transferSetStatus.js";
45
45
  import { OneClickService as nt, QuoteRequest as w } from "@defuse-protocol/one-click-sdk-typescript";
46
- import { TOKENS_DATA as K, NATIVE_NEAR_DUMB_ASSET_ID as L, WNEAR_ASSET_ID as F } from "./constants/tokens.js";
46
+ import { TOKENS_DATA as K, NATIVE_NEAR_DUMB_ASSET_ID as x, WNEAR_ASSET_ID as V } from "./constants/tokens.js";
47
47
  import { isValidChain as st } from "./utils/checkers/isValidChain.js";
48
48
  import { useWalletBalance as ce } from "./hooks/useWalletBalance.js";
49
49
  import { parse as ot } from "./ext/alchemy/parse.js";
@@ -54,18 +54,18 @@ import { getIntentsBalances as it } from "./utils/intents/getIntentsBalance.js";
54
54
  import { getTokenBalanceKey as ct } from "./utils/intents/getTokenBalanceKey.js";
55
55
  import { snakeCase as lt } from "change-case";
56
56
  import { CanceledError as le, AxiosError as de } from "axios";
57
- import { oneClickApi as $, bridgeApi as dt } from "./network.js";
57
+ import { oneClickApi as G, bridgeApi as dt } from "./network.js";
58
58
  import { formatBigToHuman as B } from "./utils/formatters/formatBigToHuman.js";
59
59
  import { getMainTokenByChain as ut } from "./utils/tokens/getMainTokenByChain.js";
60
60
  import { getDefaultIntentsToken as ft } from "./utils/tokens/getDefaultIntentsToken.js";
61
61
  import { getTokenWithHighBalance as mt } from "./utils/tokens/getTokenWithHighBalance.js";
62
- const N = x.getStore(), pt = Ce({
63
- usdTradeDelta: (e) => De(e(N.context)),
62
+ const N = L.getStore(), pt = De({
63
+ usdTradeDelta: (e) => Ce(e(N.context)),
64
64
  isDirectTransfer: (e) => qe(e(N.context)),
65
- isNearToIntentsSameAssetTransfer: (e) => xe(e(N.context)),
65
+ isNearToIntentsSameAssetTransfer: (e) => Le(e(N.context)),
66
66
  isDirectNearDeposit: (e) => Be(e(N.context)),
67
67
  isDirectNonNearWithdrawal: (e) => Oe(e(N.context))
68
- }), Tt = () => P(pt), _ = () => {
68
+ }), Tt = () => P(pt), b = () => {
69
69
  const e = P(N);
70
70
  return {
71
71
  state: e.state,
@@ -86,12 +86,12 @@ const N = x.getStore(), pt = Ce({
86
86
  }
87
87
  n && re(e) ? y("input_valid_external") : s && ae(e) ? y("input_valid_internal") : y("initial_wallet");
88
88
  }, It = (e, t) => {
89
- const { config: s } = G(z);
89
+ const { config: s } = $(z);
90
90
  return e.targetToken && !e.sendAddress && !!e.walletAddress && !e.targetToken.isIntent && !t.find((n) => n?.key === "sendAddress") && s.walletSupportedChains.includes(e.targetToken.blockchain);
91
91
  }, kt = ({ debug: e }) => {
92
- x.onContextChange((t, s) => {
92
+ L.onContextChange((t, s) => {
93
93
  const n = s;
94
- if (e && b.debug("[WIDGET] Context changed", n), e && t.error && Pe(n) && b.debug(`[WIDGET] Error set to ${t.error.code}`), We(n) || Ge(t, n, e))
94
+ if (e && _.debug("[WIDGET] Context changed", n), e && t.error && Pe(n) && _.debug(`[WIDGET] Error set to ${t.error.code}`), We(n) || $e(t, n, e))
95
95
  return;
96
96
  if (Me(t, n)) {
97
97
  d("reset", null), y("initial_dry");
@@ -103,27 +103,27 @@ const N = x.getStore(), pt = Ce({
103
103
  const u = r ? "initial_dry" : "initial_wallet";
104
104
  y(u, {
105
105
  onMoved: () => {
106
- e && b.debug(
106
+ e && _.debug(
107
107
  `[WIDGET] Inputs changed. State moved to ${u}`
108
108
  );
109
109
  }
110
110
  });
111
111
  }
112
- Ue(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), Ve(t) && (t.sendAddress = void 0), It(t, n) && (t.sendAddress = t.walletAddress), ue(t);
112
+ Ue(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), Fe(t) && (t.sendAddress = void 0), It(t, n) && (t.sendAddress = t.walletAddress), ue(t);
113
113
  }
114
114
  });
115
115
  }, gt = ({ debug: e }) => {
116
- x.onTransition((t, s) => {
117
- e && b.debug(`===> [WIDGET] State moved from ${t} to ${s}`);
116
+ L.onTransition((t, s) => {
117
+ e && _.debug(`===> [WIDGET] State moved from ${t} to ${s}`);
118
118
  });
119
119
  }, At = (e, t) => {
120
- const { variant: s, token: n } = t, { config: o } = G(z);
120
+ const { variant: s, token: n } = t, { config: o } = $(z);
121
121
  switch (s) {
122
122
  case "source":
123
123
  if (n && n.assetId === e.targetToken?.assetId && n.isIntent === e.targetToken.isIntent && o.enableAutoTokensSwitching) {
124
124
  if (!e.sourceToken)
125
125
  return;
126
- V(e);
126
+ F(e);
127
127
  return;
128
128
  }
129
129
  if (n && !e.sourceToken && n.assetId === e.targetToken?.assetId && n.isIntent === e.targetToken.isIntent && o.enableAutoTokensSwitching)
@@ -134,7 +134,7 @@ const N = x.getStore(), pt = Ce({
134
134
  if (n && n.assetId === e.sourceToken?.assetId && n.isIntent === e.sourceToken.isIntent && o.enableAutoTokensSwitching) {
135
135
  if (!e.targetToken)
136
136
  return;
137
- V(e);
137
+ F(e);
138
138
  return;
139
139
  }
140
140
  e.targetToken = n;
@@ -143,13 +143,13 @@ const N = x.getStore(), pt = Ce({
143
143
  ie(s, { throwError: !1 });
144
144
  }
145
145
  }, g = (e, t) => {
146
- x.on(e, (s, n) => t(s, n));
146
+ L.on(e, (s, n) => t(s, n));
147
147
  }, ht = () => {
148
- g("quoteSetStatus", Ze), g("walletAddressSet", Ye), g("transferSetStatus", tt), g("tokenSelectRotate", V), g("tokenSetBalance", et), g("tokenSetAmount", Xe), g("depositTypeSet", Je), g("tokenSelect", At), g("addressSet", ze), g("errorSet", He), g("quoteSet", je), g("reset", Ke), g("validateDryInputs", oe), g("validateExternalInputs", re), g("validateInternalInputs", ae);
148
+ g("quoteSetStatus", Ze), g("walletAddressSet", Ye), g("transferSetStatus", tt), g("tokenSelectRotate", F), g("tokenSetBalance", et), g("tokenSetAmount", Xe), g("depositTypeSet", Je), g("tokenSelect", At), g("addressSet", ze), g("errorSet", He), g("quoteSet", je), g("reset", Ke), g("validateDryInputs", oe), g("validateExternalInputs", re), g("validateInternalInputs", ae);
149
149
  }, wt = (e) => {
150
150
  const t = e.symbol.toLowerCase();
151
151
  return K[t]?.icon ?? "";
152
- }, Y = (e) => Se[e].icon ?? be, yt = (e) => `${e.blockchain?.charAt(0).toUpperCase()}${e.blockchain?.slice(1)}`, St = (e) => K[e.symbol]?.name ?? e.symbol, W = (e) => {
152
+ }, Y = (e) => Se[e].icon ?? _e, yt = (e) => `${e.blockchain?.charAt(0).toUpperCase()}${e.blockchain?.slice(1)}`, St = (e) => K[e.symbol]?.name ?? e.symbol, W = (e) => {
153
153
  const {
154
154
  showIntentTokens: t,
155
155
  allowedTokensList: s,
@@ -159,7 +159,7 @@ const N = x.getStore(), pt = Ce({
159
159
  } = v(), u = se({
160
160
  queryKey: ["tokens"],
161
161
  queryFn: async () => await nt.getTokens()
162
- }), i = C(() => {
162
+ }), i = D(() => {
163
163
  if (!u.data)
164
164
  return [];
165
165
  const c = u.data.map((a) => {
@@ -182,7 +182,7 @@ const N = x.getStore(), pt = Ce({
182
182
  symbol: "NEAR",
183
183
  chainName: "Near",
184
184
  blockchain: "near",
185
- assetId: L,
185
+ assetId: x,
186
186
  chainIcon: Y("near"),
187
187
  icon: K.near?.icon ?? "",
188
188
  price: l?.price ?? 0,
@@ -206,7 +206,7 @@ const N = x.getStore(), pt = Ce({
206
206
  alchemyApiKey: t,
207
207
  ...s
208
208
  }) => {
209
- const { ctx: n } = _(), { tokens: o } = W(), { walletSupportedChains: r } = v(), { setWalletBalance: u } = ce(n.walletAddress), i = s.isEnabled && !!e && r.length > 0, c = ge({
209
+ const { ctx: n } = b(), { tokens: o } = W(), { walletSupportedChains: r } = v(), { setWalletBalance: u } = ce(n.walletAddress), i = s.isEnabled && !!e && r.length > 0, c = ge({
210
210
  initialPageParam: null,
211
211
  enabled: i && !!e && !!t,
212
212
  queryKey: ["walletTokensBalance", e],
@@ -223,7 +223,7 @@ const N = x.getStore(), pt = Ce({
223
223
  h(() => {
224
224
  i && c.data && c.hasNextPage && c.data.pages.length < ee && !c.isFetchingNextPage && c.fetchNextPage();
225
225
  }, [i, c]);
226
- const m = C(() => {
226
+ const m = D(() => {
227
227
  if (!c.data?.pages)
228
228
  return {};
229
229
  const l = ot(
@@ -249,10 +249,10 @@ const N = x.getStore(), pt = Ce({
249
249
  enabled: !!e && !!o && s.length > 0,
250
250
  queryKey: ["intentsBalances", o],
251
251
  queryFn: async () => o ? await it(o, n) : {}
252
- }), u = C(() => {
252
+ }), u = D(() => {
253
253
  switch (r.status) {
254
254
  case "error":
255
- return b.error("Unable to load intents balances:", r.error), {};
255
+ return _.error("Unable to load intents balances:", r.error), {};
256
256
  case "success":
257
257
  return Object.fromEntries(
258
258
  Object.entries(r.data).map(([i, c]) => [
@@ -270,11 +270,11 @@ const N = x.getStore(), pt = Ce({
270
270
  ...r,
271
271
  intentBalances: u
272
272
  };
273
- }, bt = ({
273
+ }, _t = ({
274
274
  isEnabled: e,
275
275
  alchemyApiKey: t
276
276
  }) => {
277
- const { ctx: s } = _(), n = Ae(), { refetch: o } = j(), { refetch: r } = fe({
277
+ const { ctx: s } = b(), n = Ae(), { refetch: o } = j(), { refetch: r } = fe({
278
278
  isEnabled: e,
279
279
  walletAddress: s.walletAddress,
280
280
  alchemyApiKey: t ?? ""
@@ -285,14 +285,14 @@ const N = x.getStore(), pt = Ce({
285
285
  setTimeout(i, 1e4);
286
286
  }), await r()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
287
287
  }, [s.state, e, t]);
288
- }, _t = () => {
288
+ }, bt = () => {
289
289
  const { walletAddress: e } = v(), { intentBalances: t } = j(), { walletBalance: s } = ce(e);
290
- return { mergedBalance: C(
290
+ return { mergedBalance: D(
291
291
  () => ({ ...s, ...t }),
292
292
  [s, t]
293
293
  ) };
294
294
  }, Et = ({ isEnabled: e }) => {
295
- const { ctx: t } = _(), { mergedBalance: s } = _t();
295
+ const { ctx: t } = b(), { mergedBalance: s } = bt();
296
296
  h(() => {
297
297
  if (!e)
298
298
  return;
@@ -321,7 +321,7 @@ const N = x.getStore(), pt = Ce({
321
321
  }, vt = ({
322
322
  isEnabled: e
323
323
  }) => {
324
- const { ctx: t } = _(), { tokens: s } = W();
324
+ const { ctx: t } = b(), { tokens: s } = W();
325
325
  h(() => {
326
326
  if (!e)
327
327
  return;
@@ -358,23 +358,23 @@ const N = x.getStore(), pt = Ce({
358
358
  });
359
359
  }, [s, t.sourceToken]);
360
360
  }, Nt = ({ isEnabled: e }) => {
361
- const { walletAddress: t } = v(), { ctx: s, state: n } = _();
361
+ const { walletAddress: t } = v(), { ctx: s, state: n } = b();
362
362
  h(() => {
363
363
  if (!e)
364
364
  return;
365
365
  d("walletAddressSet", t ?? void 0), S(s, ["initial_dry", "initial_wallet"]) && (n === "initial_wallet" && !t ? y("initial_dry") : n === "initial_dry" && t && y("initial_wallet"));
366
366
  }, [e, t, s, n]);
367
- }, Ct = () => {
368
- const { ctx: e } = _(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s, appName: n } = v(), o = !e.walletAddress, r = H({
367
+ }, Dt = () => {
368
+ const { ctx: e } = b(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s, appName: n } = v(), o = !e.walletAddress, r = H({
369
369
  addressType: t,
370
370
  walletAddress: o ? J[t] : e.walletAddress ?? ""
371
- }), u = O(null), i = O(new AbortController()), c = C(() => async (a) => $.post(
371
+ }), u = O(null), i = O(new AbortController()), c = D(() => async (a) => G.post(
372
372
  s,
373
373
  a,
374
374
  {
375
375
  signal: i.current.signal
376
376
  }
377
- ), [s, $]), m = o ? J[t] : e.walletAddress ?? "";
377
+ ), [s, G]), m = o ? J[t] : e.walletAddress ?? "";
378
378
  return {
379
379
  make: async ({ message: a, quoteType: T = "exact_in" } = {}) => {
380
380
  if (!S(e, [
@@ -383,14 +383,14 @@ const N = x.getStore(), pt = Ce({
383
383
  "input_valid_internal"
384
384
  ])) {
385
385
  const p = `Unable to run quote in current state ${e.state}`;
386
- throw b.error(`[WIDGET] ${p}`), new A({
386
+ throw _.error(`[WIDGET] ${p}`), new A({
387
387
  code: "QUOTE_INVALID_INITIAL",
388
388
  meta: { isDry: o, message: p }
389
389
  });
390
390
  }
391
391
  if (!r) {
392
392
  const p = "No corresponding intents account to run a quote";
393
- throw b.error(`[WIDGET] ${p}`), new A({
393
+ throw _.error(`[WIDGET] ${p}`), new A({
394
394
  code: "QUOTE_INVALID_INITIAL",
395
395
  meta: { isDry: o, message: p }
396
396
  });
@@ -406,9 +406,9 @@ const N = x.getStore(), pt = Ce({
406
406
  // 1 hour
407
407
  swapType: T === "exact_out" ? w.swapType.EXACT_OUTPUT : w.swapType.EXACT_INPUT,
408
408
  // Target
409
- destinationAsset: e.targetToken.assetId === L ? F : e.targetToken.assetId,
409
+ destinationAsset: e.targetToken.assetId === x ? V : e.targetToken.assetId,
410
410
  // Source
411
- originAsset: e.sourceToken.assetId === L ? F : e.sourceToken.assetId,
411
+ originAsset: e.sourceToken.assetId === x ? V : e.sourceToken.assetId,
412
412
  amount: T === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount
413
413
  };
414
414
  a && (k.customRecipientMsg = a), n && (k.referral = lt(n));
@@ -484,11 +484,11 @@ const N = x.getStore(), pt = Ce({
484
484
  i.current.abort("Abort quote manually"), i.current = new AbortController();
485
485
  }
486
486
  };
487
- }, Dt = () => {
488
- const { ctx: e } = _(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s } = v(), n = H({
487
+ }, Ct = () => {
488
+ const { ctx: e } = b(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s } = v(), n = H({
489
489
  addressType: t,
490
490
  walletAddress: e.walletAddress ?? ""
491
- }), o = O(null), r = O(new AbortController()), u = C(() => async (c) => dt.post(
491
+ }), o = O(null), r = O(new AbortController()), u = D(() => async (c) => dt.post(
492
492
  "",
493
493
  {
494
494
  id: 1,
@@ -504,7 +504,7 @@ const N = x.getStore(), pt = Ce({
504
504
  {
505
505
  signal: r.current.signal
506
506
  }
507
- ), [s, $]);
507
+ ), [s, G]);
508
508
  return {
509
509
  make: async () => {
510
510
  if (!S(e, [
@@ -513,7 +513,7 @@ const N = x.getStore(), pt = Ce({
513
513
  "input_valid_internal"
514
514
  ])) {
515
515
  const l = `Unable to run quote in current state ${e.state}`;
516
- throw b.error(`[WIDGET] ${l}`), new A({
516
+ throw _.error(`[WIDGET] ${l}`), new A({
517
517
  code: "QUOTE_INVALID_INITIAL",
518
518
  meta: { isDry: !1, message: l }
519
519
  });
@@ -536,13 +536,13 @@ const N = x.getStore(), pt = Ce({
536
536
  });
537
537
  if (!n) {
538
538
  const l = "No corresponding intents account to run a quote";
539
- throw b.error(`[WIDGET] ${l}`), new A({
539
+ throw _.error(`[WIDGET] ${l}`), new A({
540
540
  code: "QUOTE_INVALID_INITIAL",
541
541
  meta: { isDry: !1, message: l }
542
542
  });
543
543
  }
544
544
  o.current && (r.current.abort("Abort previous quote (auto)"), r.current = new AbortController());
545
- const m = _e[e.targetToken.blockchain];
545
+ const m = be[e.targetToken.blockchain];
546
546
  if (!m)
547
547
  throw new A({
548
548
  code: "QUOTE_INVALID_INITIAL",
@@ -574,7 +574,7 @@ const N = x.getStore(), pt = Ce({
574
574
  } catch (l) {
575
575
  if (l instanceof le)
576
576
  return;
577
- if (b.error(l), l instanceof de) {
577
+ if (_.error(l), l instanceof de) {
578
578
  const a = l.response?.data.message || l.message;
579
579
  throw new A({
580
580
  code: "QUOTE_FAILED",
@@ -594,19 +594,19 @@ const N = x.getStore(), pt = Ce({
594
594
  message: t,
595
595
  type: s = "exact_in"
596
596
  }) => {
597
- const { ctx: n } = _(), {
597
+ const { ctx: n } = b(), {
598
598
  isDirectTransfer: o,
599
599
  isDirectNonNearWithdrawal: r,
600
600
  isNearToIntentsSameAssetTransfer: u,
601
601
  isDirectNearDeposit: i
602
- } = Tt(), c = !n.walletAddress, m = e && !o && !r && !u && !i, { make: l, cancel: a } = Ct(), { make: T, cancel: D } = Dt(), I = () => {
603
- a(), D();
602
+ } = Tt(), c = !n.walletAddress, m = e && !o && !r && !u && !i, { make: l, cancel: a } = Dt(), { make: T, cancel: C } = Ct(), I = () => {
603
+ a(), C();
604
604
  };
605
605
  h(() => {
606
606
  const k = S(n, ["input_valid_dry"]), f = S(n, ["input_valid_external"]), p = S(n, ["input_valid_internal"]);
607
607
  (c && !k || !c && n.targetToken?.isIntent && !p || !c && !n.targetToken?.isIntent && !f) && I();
608
608
  }, [I, c, n]), h(() => {
609
- if (!m || n.sourceToken?.assetId === L && n.targetToken?.assetId === F)
609
+ if (!m || n.sourceToken?.assetId === x && n.targetToken?.assetId === V)
610
610
  return;
611
611
  const k = c ? n.state === "input_valid_dry" : n.state === "input_valid_external" && !n.targetToken?.isIntent || n.state === "input_valid_internal" && n.targetToken?.isIntent;
612
612
  (async () => {
@@ -650,7 +650,7 @@ const N = x.getStore(), pt = Ce({
650
650
  skipIntents: t = !1,
651
651
  target: s = "none"
652
652
  }) => {
653
- const { tokens: n } = W(), { ctx: o, state: r } = _(), { intentBalances: u } = j(), {
653
+ const { tokens: n } = W(), { ctx: o, state: r } = b(), { intentBalances: u } = j(), {
654
654
  walletSupportedChains: i,
655
655
  chainsFilter: c,
656
656
  walletAddress: m,
@@ -660,7 +660,7 @@ const N = x.getStore(), pt = Ce({
660
660
  walletSupportedChains: i,
661
661
  balances: u,
662
662
  across: "intents"
663
- }), [T, D] = C(() => !m && !t ? [
663
+ }), [T, C] = D(() => !m && !t ? [
664
664
  { token: ft({ tokens: n }), status: "loaded" },
665
665
  { token: void 0, status: "loaded" }
666
666
  ] : c.source.intents !== "none" && !t ? a ? [
@@ -690,8 +690,8 @@ const N = x.getStore(), pt = Ce({
690
690
  if (S(o, ["initial_dry", "initial_wallet"]) && (T.status === "loaded" && !o.sourceToken && d("tokenSelect", {
691
691
  variant: "source",
692
692
  token: T.token
693
- }), D.status === "loaded" && T.status === "loaded" && !o.targetToken)) {
694
- let k = D.token;
693
+ }), C.status === "loaded" && T.status === "loaded" && !o.targetToken)) {
694
+ let k = C.token;
695
695
  s === "same-asset" && (T.token?.isIntent ? k = n.find(
696
696
  (f) => !f.isIntent && f.symbol === o.sourceToken?.symbol && f.blockchain === R[l]
697
697
  ) : k = n.find(
@@ -701,7 +701,7 @@ const N = x.getStore(), pt = Ce({
701
701
  token: k
702
702
  });
703
703
  }
704
- }, [o, T, D, e]), h(() => {
704
+ }, [o, T, C, e]), h(() => {
705
705
  const I = S(o, ["initial_dry", "initial_wallet"]);
706
706
  if (!e || !I)
707
707
  return;
@@ -730,18 +730,18 @@ const N = x.getStore(), pt = Ce({
730
730
  }, 3e3);
731
731
  return () => clearTimeout(f);
732
732
  }, [n, T, t]), { source: o.sourceToken, target: o.targetToken };
733
- }, xt = ({
733
+ }, Lt = ({
734
734
  isEnabled: e,
735
735
  alchemyApiKey: t
736
736
  }) => {
737
- const { ctx: s } = _();
737
+ const { ctx: s } = b();
738
738
  fe({
739
739
  isEnabled: e,
740
740
  walletAddress: s.walletAddress,
741
741
  alchemyApiKey: t ?? ""
742
742
  });
743
- }, Bt = Le(({ debug: e }) => {
744
- e && b.debug("[WIDGET] Debug mode is enabled"), ht(), gt({ debug: e }), kt({ debug: e });
743
+ }, Bt = xe(({ debug: e }) => {
744
+ e && _.debug("[WIDGET] Debug mode is enabled"), ht(), gt({ debug: e }), kt({ debug: e });
745
745
  }), Zn = ({ listenTo: e, debug: t = !1 }) => {
746
746
  h(() => {
747
747
  Bt({ debug: t });
@@ -753,7 +753,7 @@ const N = x.getStore(), pt = Ce({
753
753
  ), o = e.find(
754
754
  (r) => Array.isArray(r) && r[0] === "makeQuote"
755
755
  );
756
- xt({
756
+ Lt({
757
757
  isEnabled: !!s,
758
758
  alchemyApiKey: s?.[1].alchemyApiKey
759
759
  }), Ot({
@@ -770,16 +770,16 @@ const N = x.getStore(), pt = Ce({
770
770
  isEnabled: e.includes("setSourceTokenBalance")
771
771
  }), vt({
772
772
  isEnabled: e.includes("setSourceTokenIntentsTarget")
773
- }), bt({
773
+ }), _t({
774
774
  isEnabled: e.includes("updateBalances"),
775
775
  alchemyApiKey: s?.[1].alchemyApiKey
776
776
  });
777
- }, Lt = x.getStore();
777
+ }, xt = L.getStore();
778
778
  class U extends Error {
779
779
  context;
780
780
  _is_widget_error = !0;
781
781
  constructor(t, s) {
782
- super(t), this.name = "WidgetError", this.cause = s?.cause, this.context = G(Lt).context;
782
+ super(t), this.name = "WidgetError", this.cause = s?.cause, this.context = $(xt).context;
783
783
  }
784
784
  }
785
785
  class me extends U {
@@ -807,7 +807,7 @@ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
807
807
  );
808
808
  throw s.context = e, s;
809
809
  }, Pt = ({ children: e }) => {
810
- const { ctx: t } = _();
810
+ const { ctx: t } = b();
811
811
  return /* @__PURE__ */ q(
812
812
  Ne,
813
813
  {
@@ -889,43 +889,41 @@ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
889
889
  ...t
890
890
  });
891
891
  Object.assign(n.current.config, o), Mt(o);
892
- }, [t]), $e(s ?? {}), Fe("headlessui-portal-root", "sw"), /* @__PURE__ */ q(we, { client: Wt, children: /* @__PURE__ */ q(ye, { i18n: Te, children: /* @__PURE__ */ q(pe.Provider, { value: n.current, children: /* @__PURE__ */ q(Pt, { children: /* @__PURE__ */ q("div", { className: "sw", children: e }) }) }) }) });
892
+ }, [t]), Ge(s ?? {}), Ve("headlessui-portal-root", "sw"), /* @__PURE__ */ q(we, { client: Wt, children: /* @__PURE__ */ q(ye, { i18n: Te, children: /* @__PURE__ */ q(pe.Provider, { value: n.current, children: /* @__PURE__ */ q(Pt, { children: /* @__PURE__ */ q("div", { className: "sw", children: e }) }) }) }) });
893
893
  };
894
894
  export {
895
- Q as A,
895
+ Lt as A,
896
896
  z as B,
897
- Mt as C,
898
- es as D,
899
897
  Pt as E,
900
898
  me as M,
901
899
  A as Q,
902
900
  Jn as T,
903
- U as W,
901
+ es as W,
904
902
  Xn as a,
905
- _ as b,
903
+ b,
906
904
  Zn as c,
907
905
  j as d,
908
- Ct as e,
909
- _t as f,
906
+ Dt as e,
907
+ bt as f,
910
908
  W as g,
911
909
  fe as h,
912
- Yn as i,
913
- v as j,
914
- It as k,
915
- kt as l,
916
- gt as m,
917
- ht as n,
918
- bt as o,
919
- Et as p,
920
- vt as q,
910
+ U as i,
911
+ Yn as j,
912
+ v as k,
913
+ It as l,
914
+ kt as m,
915
+ gt as n,
916
+ ht as o,
917
+ _t as p,
918
+ Et as q,
921
919
  Bt as r,
922
- Nt as s,
920
+ vt as s,
923
921
  At as t,
924
922
  Tt as u,
925
923
  ue as v,
926
- Dt as w,
927
- qt as x,
928
- Ot as y,
929
- xt as z
924
+ Nt as w,
925
+ Ct as x,
926
+ qt as y,
927
+ Ot as z
930
928
  };
931
- //# sourceMappingURL=config-DN8VJllh.js.map
929
+ //# sourceMappingURL=config-Dq9mlDST.js.map