@aurora-is-near/intents-swap-widget 2.3.2 → 2.4.0

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 (93) hide show
  1. package/dist/{config-C3Ii_szE.js → config-BhnkBtE4.js} +229 -224
  2. package/dist/config-BhnkBtE4.js.map +1 -0
  3. package/dist/config.d.ts +14 -6
  4. package/dist/config.js +1 -1
  5. package/dist/errors.js +1 -1
  6. package/dist/ext/alchemy/index.js +1 -1
  7. package/dist/ext/index.js +1 -1
  8. package/dist/features/BalanceRpcLoader/index.js +1 -1
  9. package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
  10. package/dist/features/ChainsDropdown/index.d.ts +2 -1
  11. package/dist/features/ChainsDropdown/index.js +55 -50
  12. package/dist/features/ChainsDropdown/index.js.map +1 -1
  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 +1 -1
  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 +1 -1
  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/TokensList/TokenItem.js +1 -1
  28. package/dist/features/TokensList/TokensList.d.ts +2 -1
  29. package/dist/features/TokensList/TokensList.js +39 -37
  30. package/dist/features/TokensList/TokensList.js.map +1 -1
  31. package/dist/features/TokensList/index.d.ts +2 -1
  32. package/dist/features/TokensModal.d.ts +2 -1
  33. package/dist/features/TokensModal.js +61 -44
  34. package/dist/features/TokensModal.js.map +1 -1
  35. package/dist/features/WalletCompatibilityCheck/index.js +1 -1
  36. package/dist/hooks/index.js +1 -1
  37. package/dist/hooks/useChains.d.ts +1 -1
  38. package/dist/hooks/useChains.js +21 -18
  39. package/dist/hooks/useChains.js.map +1 -1
  40. package/dist/hooks/useCompatibilityCheck.js +1 -1
  41. package/dist/hooks/useExternalDepositStatus.js +1 -1
  42. package/dist/hooks/useIntentsBalance.js +1 -1
  43. package/dist/hooks/useMakeDepositAddress.js +1 -1
  44. package/dist/hooks/useMakeIntentsTransfer.js +1 -1
  45. package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
  46. package/dist/hooks/useMakeQuote.js +1 -1
  47. package/dist/hooks/useMakeQuoteTransfer.js +1 -1
  48. package/dist/hooks/useMakeTransfer.js +1 -1
  49. package/dist/hooks/useMergedBalance.js +1 -1
  50. package/dist/hooks/useTokenInputPair.js +1 -1
  51. package/dist/hooks/useTokens.d.ts +1 -2
  52. package/dist/hooks/useTokens.js +1 -1
  53. package/dist/hooks/useTokensFiltered.d.ts +2 -1
  54. package/dist/hooks/useTokensFiltered.js +30 -22
  55. package/dist/hooks/useTokensFiltered.js.map +1 -1
  56. package/dist/hooks/useTokensIntentsUnique.js +1 -1
  57. package/dist/index.js +1 -1
  58. package/dist/machine/effects/index.js +1 -1
  59. package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
  60. package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
  61. package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
  62. package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
  63. package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
  64. package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
  65. package/dist/machine/effects/useWalletConnEffect.js +1 -1
  66. package/dist/machine/events/index.js +1 -1
  67. package/dist/machine/events/tokenSelect.js +1 -1
  68. package/dist/machine/events/validateInputAndMoveTo.js +1 -1
  69. package/dist/machine/index.js +1 -1
  70. package/dist/machine/snap.js +1 -1
  71. package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
  72. package/dist/machine/subscriptions/index.js +1 -1
  73. package/dist/utils/intents/signers/near.js +1 -1
  74. package/dist/utils/intents/signers/privy.js +1 -1
  75. package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
  76. package/dist/widgets/WidgetDeposit.js +2 -1
  77. package/dist/widgets/WidgetDeposit.js.map +1 -1
  78. package/dist/widgets/WidgetSwap.js +15 -14
  79. package/dist/widgets/WidgetSwap.js.map +1 -1
  80. package/dist/widgets/WidgetWithdraw.js +15 -14
  81. package/dist/widgets/WidgetWithdraw.js.map +1 -1
  82. package/package.json +2 -1
  83. package/src/config.tsx +7 -3
  84. package/src/features/ChainsDropdown/index.tsx +35 -22
  85. package/src/features/TokensList/TokensList.tsx +3 -0
  86. package/src/features/TokensModal.tsx +12 -1
  87. package/src/hooks/useChains.ts +31 -5
  88. package/src/hooks/useTokens.ts +24 -9
  89. package/src/hooks/useTokensFiltered.ts +17 -7
  90. package/src/widgets/WidgetDeposit.tsx +1 -0
  91. package/src/widgets/WidgetSwap.tsx +1 -0
  92. package/src/widgets/WidgetWithdraw.tsx +1 -0
  93. package/dist/config-C3Ii_szE.js.map +0 -1
@@ -2,13 +2,13 @@ import { jsx as q } from "react/jsx-runtime";
2
2
  import Te from "i18next";
3
3
  import { deepClone as R } from "valtio/utils";
4
4
  import { useSnapshot as Q, snapshot as $, proxy as ne } from "valtio";
5
- import { useMemo as C, useEffect as h, useRef as O, createContext as ke, useContext as Ie } from "react";
6
- import { useQuery as se, useInfiniteQuery as ge, useQueryClient as Ae, QueryClient as he, QueryClientProvider as ye } from "@tanstack/react-query";
7
- import { I18nextProvider as we } from "react-i18next";
5
+ import { useMemo as C, useEffect as h, useRef as O, createContext as Ie, useContext as ke } from "react";
6
+ import { useQuery as se, useInfiniteQuery as ge, useQueryClient as Ae, QueryClient as he, QueryClientProvider as we } from "@tanstack/react-query";
7
+ import { I18nextProvider as ye } from "react-i18next";
8
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";
9
9
  import { ErrorBoundary as Ne } from "react-error-boundary";
10
10
  import { derive as Ce } from "derive-valtio";
11
- import { machine as x, moveTo as w } from "./machine/machine.js";
11
+ import { machine as x, moveTo as y } from "./machine/machine.js";
12
12
  import { guardStates as S } from "./machine/guards/index.js";
13
13
  import { getUsdTradeDelta as De } from "./machine/computed/getUsdTradeDelta.js";
14
14
  import { getIsDirectTransfer as qe } from "./machine/computed/getIsDirectTransfer.js";
@@ -16,11 +16,11 @@ import { getIsDirectNonNearWithdrawal as Oe } from "./machine/computed/getIsDire
16
16
  import { getIsNearToIntentsSameAssetTransfer as xe } from "./machine/computed/getIsNearToIntentsSameAssetTransfer.js";
17
17
  import { getIsDirectNearDeposit as Be } from "./machine/computed/getIsDirectNearDeposit.js";
18
18
  import "ethers";
19
- import Ue from "lodash.once";
19
+ import Le from "lodash.once";
20
20
  import { logger as b } 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
- import { isQuoteIdle as Le } from "./machine/subscriptions/checkers/isQuoteIdle.js";
23
+ import { isQuoteIdle as Ue } from "./machine/subscriptions/checkers/isQuoteIdle.js";
24
24
  import { isInputChanged as Qe } from "./machine/subscriptions/checkers/isInputChanged.js";
25
25
  import { isErrorChanged as Pe } from "./machine/subscriptions/checkers/isErrorChanged.js";
26
26
  import { isOnlyErrorChanged as We } from "./machine/subscriptions/checkers/isOnlyErrorChanged.js";
@@ -42,8 +42,8 @@ import { depositTypeSet as Je } from "./machine/events/depositTypeSet.js";
42
42
  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
- import { OneClickService as nt, QuoteRequest as y } from "@defuse-protocol/one-click-sdk-typescript";
46
- import { TOKENS_DATA as G, NATIVE_NEAR_DUMB_ASSET_ID as U, WNEAR_ASSET_ID as V } from "./constants/tokens.js";
45
+ import { OneClickService as nt, QuoteRequest as w } from "@defuse-protocol/one-click-sdk-typescript";
46
+ import { TOKENS_DATA as G, NATIVE_NEAR_DUMB_ASSET_ID as L, 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";
@@ -74,7 +74,7 @@ const N = x.getStore(), pt = Ce({
74
74
  }, Xn = (e) => {
75
75
  const t = Q(N);
76
76
  if (!S(t.context, [e]))
77
- throw new L(
77
+ throw new U(
78
78
  `[WIDGET] Attempt to access snapshot for ${e} state while context does not match`
79
79
  );
80
80
  return t.context;
@@ -82,26 +82,26 @@ const N = x.getStore(), pt = Ce({
82
82
  const t = !e.walletAddress, s = !t && e.targetToken?.isIntent === !0, n = !t && e.targetToken?.isIntent === !1;
83
83
  if (t) {
84
84
  const o = oe(e);
85
- return w(o ? "input_valid_dry" : "initial_dry");
85
+ return y(o ? "input_valid_dry" : "initial_dry");
86
86
  }
87
- n && re(e) ? w("input_valid_external") : s && ae(e) ? w("input_valid_internal") : w("initial_wallet");
88
- }, kt = (e, t) => {
87
+ n && re(e) ? y("input_valid_external") : s && ae(e) ? y("input_valid_internal") : y("initial_wallet");
88
+ }, It = (e, t) => {
89
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
- }, It = ({ debug: e }) => {
91
+ }, kt = ({ debug: e }) => {
92
92
  x.onContextChange((t, s) => {
93
93
  const n = s;
94
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))
95
95
  return;
96
96
  if (Me(t, n)) {
97
- d("reset", null), w("initial_dry");
97
+ d("reset", null), y("initial_dry");
98
98
  return;
99
99
  }
100
- const { isChanged: o, isDry: a } = Qe(t, n);
100
+ const { isChanged: o, isDry: r } = Qe(t, n);
101
101
  if (o) {
102
102
  if (Re(t)) {
103
- const u = a ? "initial_dry" : "initial_wallet";
104
- w(u, {
103
+ const u = r ? "initial_dry" : "initial_wallet";
104
+ y(u, {
105
105
  onMoved: () => {
106
106
  e && b.debug(
107
107
  `[WIDGET] Inputs changed. State moved to ${u}`
@@ -109,7 +109,7 @@ const N = x.getStore(), pt = Ce({
109
109
  }
110
110
  });
111
111
  }
112
- Le(t) || (t.quote = void 0, t.quoteStatus = "idle", t.transferStatus = { status: "idle" }), Ve(t) && (t.sendAddress = void 0), kt(t, n) && (t.sendAddress = t.walletAddress), ue(t);
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);
113
113
  }
114
114
  });
115
115
  }, gt = ({ debug: e }) => {
@@ -142,143 +142,148 @@ const N = x.getStore(), pt = Ce({
142
142
  default:
143
143
  ie(s, { throwError: !1 });
144
144
  }
145
- }, I = (e, t) => {
145
+ }, g = (e, t) => {
146
146
  x.on(e, (s, n) => t(s, n));
147
147
  }, ht = () => {
148
- I("quoteSetStatus", Ze), I("walletAddressSet", Ye), I("transferSetStatus", tt), I("tokenSelectRotate", M), I("tokenSetBalance", et), I("tokenSetAmount", Xe), I("depositTypeSet", Je), I("tokenSelect", At), I("addressSet", ze), I("errorSet", He), I("quoteSet", je), I("reset", Ke), I("validateDryInputs", oe), I("validateExternalInputs", re), I("validateInternalInputs", ae);
149
- }, yt = (e) => {
148
+ g("quoteSetStatus", Ze), g("walletAddressSet", Ye), g("transferSetStatus", tt), g("tokenSelectRotate", M), 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
+ }, wt = (e) => {
150
150
  const t = e.symbol.toLowerCase();
151
151
  return G[t]?.icon ?? "";
152
- }, Y = (e) => Se[e].icon ?? be, wt = (e) => `${e.blockchain?.charAt(0).toUpperCase()}${e.blockchain?.slice(1)}`, St = (e) => G[e.symbol]?.name ?? e.symbol, P = (e = {}) => {
153
- const { showIntentTokens: t, allowedTokensList: s, filterTokens: n } = v(), o = se({
154
- ...e,
152
+ }, Y = (e) => Se[e].icon ?? be, yt = (e) => `${e.blockchain?.charAt(0).toUpperCase()}${e.blockchain?.slice(1)}`, St = (e) => G[e.symbol]?.name ?? e.symbol, P = (e) => {
153
+ const {
154
+ showIntentTokens: t,
155
+ allowedTokensList: s,
156
+ allowedSourceTokensList: n,
157
+ allowedTargetTokensList: o,
158
+ filterTokens: r
159
+ } = v(), u = se({
155
160
  queryKey: ["tokens"],
156
161
  queryFn: async () => await nt.getTokens()
157
- }), a = C(() => {
158
- if (!o.data)
162
+ }), i = C(() => {
163
+ if (!u.data)
159
164
  return [];
160
- const u = o.data.map((l) => {
161
- const c = l.blockchain.toLowerCase();
162
- return !st(c) || s && !s.includes(l.assetId) ? null : {
163
- ...l,
164
- blockchain: c,
165
+ const c = u.data.map((a) => {
166
+ const T = a.blockchain.toLowerCase();
167
+ return !st(T) || s && !s.includes(a.assetId) || e === "source" && n && !n.includes(a.assetId) || e === "target" && o && !o.includes(a.assetId) ? null : {
168
+ ...a,
169
+ blockchain: T,
165
170
  isIntent: !1,
166
- icon: yt(l),
167
- name: St(l),
168
- chainIcon: Y(c),
169
- chainName: wt(l),
170
- contractAddress: l.contractAddress
171
+ icon: wt(a),
172
+ name: St(a),
173
+ chainIcon: Y(T),
174
+ chainName: yt(a),
175
+ contractAddress: a.contractAddress
171
176
  };
172
- }).filter((l) => !!l).filter(n ?? (() => !0)), r = u.filter(
173
- (l) => l.symbol.toLowerCase() !== "wnear"
174
- ), i = u.find((l) => l.symbol.toLowerCase() === "wnear");
175
- return r.push({
177
+ }).filter((a) => !!a).filter(r ?? (() => !0)), m = c.filter(
178
+ (a) => a.symbol.toLowerCase() !== "wnear"
179
+ ), l = c.find((a) => a.symbol.toLowerCase() === "wnear");
180
+ return m.push({
176
181
  name: "NEAR",
177
182
  symbol: "NEAR",
178
183
  chainName: "Near",
179
184
  blockchain: "near",
180
- assetId: U,
185
+ assetId: L,
181
186
  chainIcon: Y("near"),
182
187
  icon: G.near?.icon ?? "",
183
- price: i?.price ?? 0,
184
- contractAddress: i?.contractAddress,
188
+ price: l?.price ?? 0,
189
+ contractAddress: l?.contractAddress,
185
190
  isIntent: !1,
186
191
  decimals: 24
187
192
  }), t ? [
188
- ...r,
193
+ ...m,
189
194
  // add intents tokens to the full list
190
- ...u.map(
191
- (l) => l.symbol.toLowerCase() === "wnear" ? { ...l, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...l, isIntent: !0 }
195
+ ...c.map(
196
+ (a) => a.symbol.toLowerCase() === "wnear" ? { ...a, symbol: "NEAR", name: "NEAR", isIntent: !0 } : { ...a, isIntent: !0 }
192
197
  )
193
- ] : r;
194
- }, [o.data, t, n]);
198
+ ] : m;
199
+ }, [u.data, t, r]);
195
200
  return {
196
- ...o,
197
- tokens: a
201
+ ...u,
202
+ tokens: i
198
203
  };
199
204
  }, ee = 3, fe = ({
200
205
  walletAddress: e,
201
206
  alchemyApiKey: t,
202
207
  ...s
203
208
  }) => {
204
- const { ctx: n } = _(), { tokens: o } = P(), { walletSupportedChains: a } = v(), { setWalletBalance: u } = ce(n.walletAddress), r = s.isEnabled && !!e && a.length > 0, i = ge({
209
+ const { ctx: n } = _(), { tokens: o } = P(), { walletSupportedChains: r } = v(), { setWalletBalance: u } = ce(n.walletAddress), i = s.isEnabled && !!e && r.length > 0, c = ge({
205
210
  initialPageParam: null,
206
- enabled: r && !!e && !!t,
211
+ enabled: i && !!e && !!t,
207
212
  queryKey: ["walletTokensBalance", e],
208
- queryFn: async ({ pageParam: c }) => rt({ alchemyApiKey: t })({
209
- pageParam: c ? `${c}` : null,
213
+ queryFn: async ({ pageParam: l }) => rt({ alchemyApiKey: t })({
214
+ pageParam: l ? `${l}` : null,
210
215
  walletAddress: e,
211
- walletSupportedChains: a
216
+ walletSupportedChains: r
212
217
  }),
213
- getNextPageParam: (c, m) => {
214
- if (c.pageKey && !(m.length >= ee))
215
- return c.pageKey;
218
+ getNextPageParam: (l, a) => {
219
+ if (l.pageKey && !(a.length >= ee))
220
+ return l.pageKey;
216
221
  }
217
222
  });
218
223
  h(() => {
219
- r && i.data && i.hasNextPage && i.data.pages.length < ee && !i.isFetchingNextPage && i.fetchNextPage();
220
- }, [r, i]);
221
- const l = C(() => {
222
- if (!i.data?.pages)
224
+ i && c.data && c.hasNextPage && c.data.pages.length < ee && !c.isFetchingNextPage && c.fetchNextPage();
225
+ }, [i, c]);
226
+ const m = C(() => {
227
+ if (!c.data?.pages)
223
228
  return {};
224
- const c = ot(
229
+ const l = ot(
225
230
  o,
226
- i.data.pages.flatMap((m) => m.data)
231
+ c.data.pages.flatMap((a) => a.data)
227
232
  );
228
- return o.forEach((m) => {
229
- at(m.blockchain) && !(m.assetId in c) && (c[m.assetId] = "0");
230
- }), c;
231
- }, [i.data, o]);
233
+ return o.forEach((a) => {
234
+ at(a.blockchain) && !(a.assetId in l) && (l[a.assetId] = "0");
235
+ }), l;
236
+ }, [c.data, o]);
232
237
  return h(() => {
233
- S(n, ["initial_wallet"]) && (u(n.walletAddress, l), n.sourceToken && Object.keys(l).includes(n.sourceToken.assetId) && d("tokenSetBalance", l[n.sourceToken.assetId]));
234
- }, [l]), {
235
- status: i.status,
236
- refetch: i.refetch,
237
- balances: l
238
+ S(n, ["initial_wallet"]) && (u(n.walletAddress, m), n.sourceToken && Object.keys(m).includes(n.sourceToken.assetId) && d("tokenSetBalance", m[n.sourceToken.assetId]));
239
+ }, [m]), {
240
+ status: c.status,
241
+ refetch: c.refetch,
242
+ balances: m
238
243
  };
239
244
  }, H = () => {
240
- const { walletAddress: e, intentsAccountType: t } = v(), { tokens: s } = P(), n = s.filter((r) => r.isIntent).map((r) => r.assetId), o = K({
245
+ const { walletAddress: e, intentsAccountType: t } = v(), { tokens: s } = P(), n = s.filter((i) => i.isIntent).map((i) => i.assetId), o = K({
241
246
  walletAddress: e ?? "",
242
247
  addressType: t
243
- }), a = se({
248
+ }), r = se({
244
249
  enabled: !!e && !!o && s.length > 0,
245
250
  queryKey: ["intentsBalances", o],
246
251
  queryFn: async () => o ? await it(o, n) : {}
247
252
  }), u = C(() => {
248
- switch (a.status) {
253
+ switch (r.status) {
249
254
  case "error":
250
- return b.error("Unable to load intents balances:", a.error), {};
255
+ return b.error("Unable to load intents balances:", r.error), {};
251
256
  case "success":
252
257
  return Object.fromEntries(
253
- Object.entries(a.data).map(([r, i]) => [
254
- `intent-${r}`,
255
- i
258
+ Object.entries(r.data).map(([i, c]) => [
259
+ `intent-${i}`,
260
+ c
256
261
  ])
257
262
  );
258
263
  case "pending":
259
264
  return {};
260
265
  default:
261
- return ie(a, { throwError: !1 }), {};
266
+ return ie(r, { throwError: !1 }), {};
262
267
  }
263
- }, [a]) ?? {};
268
+ }, [r]) ?? {};
264
269
  return {
265
- ...a,
270
+ ...r,
266
271
  intentBalances: u
267
272
  };
268
273
  }, bt = ({
269
274
  isEnabled: e,
270
275
  alchemyApiKey: t
271
276
  }) => {
272
- const { ctx: s } = _(), n = Ae(), { refetch: o } = H(), { refetch: a } = fe({
277
+ const { ctx: s } = _(), n = Ae(), { refetch: o } = H(), { refetch: r } = fe({
273
278
  isEnabled: e,
274
279
  walletAddress: s.walletAddress,
275
280
  alchemyApiKey: t ?? ""
276
281
  });
277
282
  h(() => {
278
283
  const u = S(s, ["transfer_success"]);
279
- !e || !u || (async () => (await o(), t && (await new Promise((r) => {
280
- setTimeout(r, 1e4);
281
- }), await a()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
284
+ !e || !u || (async () => (await o(), t && (await new Promise((i) => {
285
+ setTimeout(i, 1e4);
286
+ }), await r()), await n.invalidateQueries({ queryKey: ["tokenBalance"] })))();
282
287
  }, [s.state, e, t]);
283
288
  }, _t = () => {
284
289
  const { walletAddress: e } = v(), { intentBalances: t } = H(), { walletBalance: s } = ce(e);
@@ -326,30 +331,30 @@ const N = x.getStore(), pt = Ce({
326
331
  }
327
332
  const { sourceToken: n } = t;
328
333
  if (t.sourceToken.assetId in te) {
329
- const r = s.find(
330
- (i) => i.isIntent && i.assetId === te[n.assetId]
334
+ const i = s.find(
335
+ (c) => c.isIntent && c.assetId === te[n.assetId]
331
336
  );
332
337
  d("tokenSelect", {
333
338
  variant: "target",
334
- token: r
339
+ token: i
335
340
  });
336
341
  return;
337
342
  }
338
343
  const o = s.find(
339
- (r) => r.isIntent && r.symbol === n.symbol && r.blockchain === "near"
344
+ (i) => i.isIntent && i.symbol === n.symbol && i.blockchain === "near"
340
345
  );
341
346
  if (o) {
342
347
  d("tokenSelect", { variant: "target", token: o });
343
348
  return;
344
349
  }
345
- const a = s.find(
346
- (r) => r.isIntent && r.assetId === n.assetId
350
+ const r = s.find(
351
+ (i) => i.isIntent && i.assetId === n.assetId
347
352
  ), u = s.find(
348
- (r) => r.isIntent && r.symbol === "USDC" && r.blockchain === "near"
353
+ (i) => i.isIntent && i.symbol === "USDC" && i.blockchain === "near"
349
354
  );
350
355
  d("tokenSelect", {
351
356
  variant: "target",
352
- token: a ?? u
357
+ token: r ?? u
353
358
  });
354
359
  }, [s, t.sourceToken]);
355
360
  }, Nt = ({ isEnabled: e }) => {
@@ -357,41 +362,41 @@ const N = x.getStore(), pt = Ce({
357
362
  h(() => {
358
363
  if (!e)
359
364
  return;
360
- d("walletAddressSet", t ?? void 0), S(s, ["initial_dry", "initial_wallet"]) && (n === "initial_wallet" && !t ? w("initial_dry") : n === "initial_dry" && t && w("initial_wallet"));
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"));
361
366
  }, [e, t, s, n]);
362
367
  }, Ct = () => {
363
- const { ctx: e } = _(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s, appName: n } = v(), o = !e.walletAddress, a = K({
368
+ const { ctx: e } = _(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s, appName: n } = v(), o = !e.walletAddress, r = K({
364
369
  addressType: t,
365
370
  walletAddress: o ? J[t] : e.walletAddress ?? ""
366
- }), u = O(null), r = O(new AbortController()), i = C(() => async (m) => F.post(
371
+ }), u = O(null), i = O(new AbortController()), c = C(() => async (a) => F.post(
367
372
  s,
368
- m,
373
+ a,
369
374
  {
370
- signal: r.current.signal
375
+ signal: i.current.signal
371
376
  }
372
- ), [s, F]), l = o ? J[t] : e.walletAddress ?? "";
377
+ ), [s, F]), m = o ? J[t] : e.walletAddress ?? "";
373
378
  return {
374
- make: async ({ message: m, quoteType: A = "exact_in" } = {}) => {
379
+ make: async ({ message: a, quoteType: T = "exact_in" } = {}) => {
375
380
  if (!S(e, [
376
381
  "input_valid_dry",
377
382
  "input_valid_external",
378
383
  "input_valid_internal"
379
384
  ])) {
380
385
  const p = `Unable to run quote in current state ${e.state}`;
381
- throw b.error(`[WIDGET] ${p}`), new g({
386
+ throw b.error(`[WIDGET] ${p}`), new A({
382
387
  code: "QUOTE_INVALID_INITIAL",
383
388
  meta: { isDry: o, message: p }
384
389
  });
385
390
  }
386
- if (!a) {
391
+ if (!r) {
387
392
  const p = "No corresponding intents account to run a quote";
388
- throw b.error(`[WIDGET] ${p}`), new g({
393
+ throw b.error(`[WIDGET] ${p}`), new A({
389
394
  code: "QUOTE_INVALID_INITIAL",
390
395
  meta: { isDry: o, message: p }
391
396
  });
392
397
  }
393
- u.current && (r.current.abort("Abort previous quote (auto)"), r.current = new AbortController());
394
- let T;
398
+ u.current && (i.current.abort("Abort previous quote (auto)"), i.current = new AbortController());
399
+ let I;
395
400
  const k = {
396
401
  // Settings
397
402
  dry: o,
@@ -399,32 +404,32 @@ const N = x.getStore(), pt = Ce({
399
404
  // 1%
400
405
  deadline: new Date(Date.now() + 3600 * 1e3).toISOString(),
401
406
  // 1 hour
402
- swapType: A === "exact_out" ? y.swapType.EXACT_OUTPUT : y.swapType.EXACT_INPUT,
407
+ swapType: T === "exact_out" ? w.swapType.EXACT_OUTPUT : w.swapType.EXACT_INPUT,
403
408
  // Target
404
- destinationAsset: e.targetToken.assetId === U ? V : e.targetToken.assetId,
409
+ destinationAsset: e.targetToken.assetId === L ? V : e.targetToken.assetId,
405
410
  // Source
406
- originAsset: e.sourceToken.assetId === U ? V : e.sourceToken.assetId,
407
- amount: A === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount
411
+ originAsset: e.sourceToken.assetId === L ? V : e.sourceToken.assetId,
412
+ amount: T === "exact_out" ? e.targetTokenAmount : e.sourceTokenAmount
408
413
  };
409
- m && (k.customRecipientMsg = m), n && (k.referral = lt(n));
414
+ a && (k.customRecipientMsg = a), n && (k.referral = lt(n));
410
415
  try {
411
- e.sourceToken.isIntent && e.targetToken.isIntent && (u.current = i({
416
+ e.sourceToken.isIntent && e.targetToken.isIntent && (u.current = c({
412
417
  ...k,
413
- recipient: a,
414
- recipientType: y.recipientType.INTENTS,
415
- depositType: y.depositType.INTENTS,
418
+ recipient: r,
419
+ recipientType: w.recipientType.INTENTS,
420
+ depositType: w.depositType.INTENTS,
416
421
  // Refund
417
- refundTo: a,
418
- refundType: y.refundType.INTENTS
419
- }), T = (await u.current).data), u.current = i({
422
+ refundTo: r,
423
+ refundType: w.refundType.INTENTS
424
+ }), I = (await u.current).data), u.current = c({
420
425
  ...k,
421
- recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress : a,
422
- recipientType: e.targetToken.isIntent ? y.recipientType.INTENTS : y.recipientType.DESTINATION_CHAIN,
423
- depositType: e.sourceToken.isIntent ? y.depositType.INTENTS : y.depositType.ORIGIN_CHAIN,
426
+ recipient: !e.targetToken.isIntent && e.sendAddress ? e.sendAddress : r,
427
+ recipientType: e.targetToken.isIntent ? w.recipientType.INTENTS : w.recipientType.DESTINATION_CHAIN,
428
+ depositType: e.sourceToken.isIntent ? w.depositType.INTENTS : w.depositType.ORIGIN_CHAIN,
424
429
  // Refund
425
- refundTo: e.sourceToken.isIntent ? a : l,
426
- refundType: e.sourceToken.isIntent ? y.refundType.INTENTS : y.refundType.ORIGIN_CHAIN
427
- }), T = (await u.current).data;
430
+ refundTo: e.sourceToken.isIntent ? r : m,
431
+ refundType: e.sourceToken.isIntent ? w.refundType.INTENTS : w.refundType.ORIGIN_CHAIN
432
+ }), I = (await u.current).data;
428
433
  } catch (p) {
429
434
  if (p instanceof le)
430
435
  return;
@@ -432,20 +437,20 @@ const N = x.getStore(), pt = Ce({
432
437
  const E = p.response?.data.message || p.message;
433
438
  if (E.includes("Amount is too low")) {
434
439
  const X = E.match(/\d+/), Z = X ? X[0] : void 0;
435
- throw new g({
440
+ throw new A({
436
441
  code: "QUOTE_AMOUNT_IS_TOO_LOW",
437
442
  meta: {
438
443
  minAmount: (Z && B(Z, e.sourceToken.decimals)) ?? "0"
439
444
  }
440
445
  });
441
446
  }
442
- throw E.includes("recipient is not valid") ? new g({
447
+ throw E.includes("recipient is not valid") ? new A({
443
448
  code: "TOKEN_IS_NOT_SUPPORTED"
444
- }) : E.includes("Failed to get a deposit address") ? new g({
449
+ }) : E.includes("Failed to get a deposit address") ? new A({
445
450
  code: "QUOTE_NO_ONE_TIME_ADDRESS"
446
451
  }) : p;
447
452
  }
448
- throw new g({
453
+ throw new A({
449
454
  code: "QUOTE_FAILED",
450
455
  meta: {
451
456
  // @ts-expect-error In case error has a message
@@ -457,33 +462,33 @@ const N = x.getStore(), pt = Ce({
457
462
  if (o)
458
463
  f = {
459
464
  dry: !0,
460
- ...T.quote,
465
+ ...I.quote,
461
466
  deadline: void 0,
462
467
  depositAddress: void 0
463
468
  };
464
- else if (T.quote.deadline && T.quote.depositAddress)
469
+ else if (I.quote.deadline && I.quote.depositAddress)
465
470
  f = {
466
471
  dry: !1,
467
- ...T.quote,
468
- deadline: T.quote.deadline,
469
- depositAddress: T.quote.depositAddress
472
+ ...I.quote,
473
+ deadline: I.quote.deadline,
474
+ depositAddress: I.quote.depositAddress
470
475
  };
471
476
  else
472
- throw new g({
477
+ throw new A({
473
478
  code: "QUOTE_INVALID",
474
479
  meta: { isDry: o }
475
480
  });
476
481
  return f;
477
482
  },
478
483
  cancel: () => {
479
- r.current.abort("Abort quote manually"), r.current = new AbortController();
484
+ i.current.abort("Abort quote manually"), i.current = new AbortController();
480
485
  }
481
486
  };
482
487
  }, Dt = () => {
483
488
  const { ctx: e } = _(), { intentsAccountType: t, oneClickApiQuoteProxyUrl: s } = v(), n = K({
484
489
  addressType: t,
485
490
  walletAddress: e.walletAddress ?? ""
486
- }), o = O(null), a = O(new AbortController()), u = C(() => async (i) => dt.post(
491
+ }), o = O(null), r = O(new AbortController()), u = C(() => async (c) => dt.post(
487
492
  "",
488
493
  {
489
494
  id: 1,
@@ -491,13 +496,13 @@ const N = x.getStore(), pt = Ce({
491
496
  method: "deposit_address",
492
497
  params: [
493
498
  {
494
- account_id: i.accountId,
495
- chain: i.chain
499
+ account_id: c.accountId,
500
+ chain: c.chain
496
501
  }
497
502
  ]
498
503
  },
499
504
  {
500
- signal: a.current.signal
505
+ signal: r.current.signal
501
506
  }
502
507
  ), [s, F]);
503
508
  return {
@@ -507,14 +512,14 @@ const N = x.getStore(), pt = Ce({
507
512
  "input_valid_external",
508
513
  "input_valid_internal"
509
514
  ])) {
510
- const c = `Unable to run quote in current state ${e.state}`;
511
- throw b.error(`[WIDGET] ${c}`), new g({
515
+ const l = `Unable to run quote in current state ${e.state}`;
516
+ throw b.error(`[WIDGET] ${l}`), new A({
512
517
  code: "QUOTE_INVALID_INITIAL",
513
- meta: { isDry: !1, message: c }
518
+ meta: { isDry: !1, message: l }
514
519
  });
515
520
  }
516
521
  if (e.sourceToken.assetId !== e.targetToken.assetId)
517
- throw new g({
522
+ throw new A({
518
523
  code: "QUOTE_INVALID_INITIAL",
519
524
  meta: {
520
525
  isDry: !1,
@@ -522,7 +527,7 @@ const N = x.getStore(), pt = Ce({
522
527
  }
523
528
  });
524
529
  if (e.sourceToken.isIntent)
525
- throw new g({
530
+ throw new A({
526
531
  code: "QUOTE_INVALID_INITIAL",
527
532
  meta: {
528
533
  isDry: !1,
@@ -530,22 +535,22 @@ const N = x.getStore(), pt = Ce({
530
535
  }
531
536
  });
532
537
  if (!n) {
533
- const c = "No corresponding intents account to run a quote";
534
- throw b.error(`[WIDGET] ${c}`), new g({
538
+ const l = "No corresponding intents account to run a quote";
539
+ throw b.error(`[WIDGET] ${l}`), new A({
535
540
  code: "QUOTE_INVALID_INITIAL",
536
- meta: { isDry: !1, message: c }
541
+ meta: { isDry: !1, message: l }
537
542
  });
538
543
  }
539
- o.current && (a.current.abort("Abort previous quote (auto)"), a.current = new AbortController());
540
- const l = _e[e.targetToken.blockchain];
541
- if (!l)
542
- throw new g({
544
+ o.current && (r.current.abort("Abort previous quote (auto)"), r.current = new AbortController());
545
+ const m = _e[e.targetToken.blockchain];
546
+ if (!m)
547
+ throw new A({
543
548
  code: "QUOTE_INVALID_INITIAL",
544
549
  meta: { isDry: !1, message: "Chain is not supported by POA" }
545
550
  });
546
551
  try {
547
552
  return o.current = u({
548
- chain: l,
553
+ chain: m,
549
554
  accountId: n
550
555
  }), {
551
556
  depositAddress: (await o.current).data.result.address,
@@ -566,22 +571,22 @@ const N = x.getStore(), pt = Ce({
566
571
  timeEstimate: 0,
567
572
  dry: !1
568
573
  };
569
- } catch (c) {
570
- if (c instanceof le)
574
+ } catch (l) {
575
+ if (l instanceof le)
571
576
  return;
572
- if (b.error(c), c instanceof de) {
573
- const m = c.response?.data.message || c.message;
574
- throw new g({
577
+ if (b.error(l), l instanceof de) {
578
+ const a = l.response?.data.message || l.message;
579
+ throw new A({
575
580
  code: "QUOTE_FAILED",
576
581
  meta: {
577
- message: m ?? "Failed to fetch quote. Please try again."
582
+ message: a ?? "Failed to fetch quote. Please try again."
578
583
  }
579
584
  });
580
585
  }
581
586
  }
582
587
  },
583
588
  cancel: () => {
584
- a.current.abort("Abort quote manually"), a.current = new AbortController();
589
+ r.current.abort("Abort quote manually"), r.current = new AbortController();
585
590
  }
586
591
  };
587
592
  }, qt = ({
@@ -591,37 +596,37 @@ const N = x.getStore(), pt = Ce({
591
596
  }) => {
592
597
  const { ctx: n } = _(), {
593
598
  isDirectTransfer: o,
594
- isDirectNonNearWithdrawal: a,
599
+ isDirectNonNearWithdrawal: r,
595
600
  isNearToIntentsSameAssetTransfer: u,
596
- isDirectNearDeposit: r
597
- } = Tt(), i = !n.walletAddress, l = e && !o && !a && !u && !r, { make: c, cancel: m } = Ct(), { make: A, cancel: D } = Dt(), T = () => {
598
- m(), D();
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();
599
604
  };
600
605
  h(() => {
601
606
  const k = S(n, ["input_valid_dry"]), f = S(n, ["input_valid_external"]), p = S(n, ["input_valid_internal"]);
602
- (i && !k || !i && n.targetToken?.isIntent && !p || !i && !n.targetToken?.isIntent && !f) && T();
603
- }, [T, i, n]), h(() => {
604
- if (!l || n.sourceToken?.assetId === U && n.targetToken?.assetId === V)
607
+ (c && !k || !c && n.targetToken?.isIntent && !p || !c && !n.targetToken?.isIntent && !f) && I();
608
+ }, [I, c, n]), h(() => {
609
+ if (!m || n.sourceToken?.assetId === L && n.targetToken?.assetId === V)
605
610
  return;
606
- const k = i ? n.state === "input_valid_dry" : n.state === "input_valid_external" && !n.targetToken?.isIntent || n.state === "input_valid_internal" && n.targetToken?.isIntent;
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;
607
612
  (async () => {
608
613
  try {
609
614
  if (k && n.quoteStatus === "idle") {
610
615
  d("quoteSetStatus", "pending");
611
616
  let f;
612
- if (n.sourceToken?.assetId === n.targetToken?.assetId ? f = await A() : f = await c({ message: t, quoteType: s }), !f)
617
+ if (n.sourceToken?.assetId === n.targetToken?.assetId ? f = await T() : f = await l({ message: t, quoteType: s }), !f)
613
618
  return;
614
619
  if (d("quoteSetStatus", "success"), d("quoteSet", f), d("errorSet", null), d("tokenSetAmount", {
615
620
  variant: "target",
616
621
  amount: f.amountOut
617
622
  }), n.state === "input_valid_dry") {
618
- w("quote_success_dry");
623
+ y("quote_success_dry");
619
624
  return;
620
625
  }
621
- n.targetToken?.isIntent ? w("quote_success_internal") : w("quote_success_external");
626
+ n.targetToken?.isIntent ? y("quote_success_internal") : y("quote_success_external");
622
627
  }
623
628
  } catch (f) {
624
- if (f instanceof g) {
629
+ if (f instanceof A) {
625
630
  if (f.data.code === "QUOTE_INVALID_INITIAL") {
626
631
  d("quoteSetStatus", "idle"), d("quoteSet", void 0), d("errorSet", null);
627
632
  return;
@@ -635,7 +640,7 @@ const N = x.getStore(), pt = Ce({
635
640
  });
636
641
  }
637
642
  })();
638
- }, [n, l, i, c]);
643
+ }, [n, m, c, l]);
639
644
  }, W = {
640
645
  sol: "sol",
641
646
  evm: "eth",
@@ -645,21 +650,21 @@ const N = x.getStore(), pt = Ce({
645
650
  skipIntents: t = !1,
646
651
  target: s = "none"
647
652
  }) => {
648
- const { tokens: n } = P(), { ctx: o, state: a } = _(), { intentBalances: u } = H(), {
649
- walletSupportedChains: r,
650
- chainsFilter: i,
651
- walletAddress: l,
652
- intentsAccountType: c
653
- } = v(), m = mt({
653
+ const { tokens: n } = P(), { ctx: o, state: r } = _(), { intentBalances: u } = H(), {
654
+ walletSupportedChains: i,
655
+ chainsFilter: c,
656
+ walletAddress: m,
657
+ intentsAccountType: l
658
+ } = v(), a = mt({
654
659
  tokens: n,
655
- walletSupportedChains: r,
660
+ walletSupportedChains: i,
656
661
  balances: u,
657
662
  across: "intents"
658
- }), [A, D] = C(() => !l && !t ? [
663
+ }), [T, D] = C(() => !m && !t ? [
659
664
  { token: ft({ tokens: n }), status: "loaded" },
660
665
  { token: void 0, status: "loaded" }
661
- ] : i.source.intents !== "none" && !t ? m ? [
662
- { token: m, status: "loaded" },
666
+ ] : c.source.intents !== "none" && !t ? a ? [
667
+ { token: a, status: "loaded" },
663
668
  { token: void 0, status: "loaded" }
664
669
  ] : [
665
670
  { token: void 0, status: "loading" },
@@ -667,28 +672,28 @@ const N = x.getStore(), pt = Ce({
667
672
  ] : [
668
673
  { token: ut({
669
674
  tokens: n,
670
- walletSupportedChains: r
675
+ walletSupportedChains: i
671
676
  }), status: "loaded" },
672
677
  { token: void 0, status: "loaded" }
673
678
  ], [
674
679
  n,
675
680
  t,
676
- i,
677
- l,
681
+ c,
678
682
  m,
679
- r,
680
- a
683
+ a,
684
+ i,
685
+ r
681
686
  ]);
682
687
  return h(() => {
683
688
  if (!e)
684
689
  return;
685
- if (S(o, ["initial_dry", "initial_wallet"]) && (A.status === "loaded" && !o.sourceToken && d("tokenSelect", {
690
+ if (S(o, ["initial_dry", "initial_wallet"]) && (T.status === "loaded" && !o.sourceToken && d("tokenSelect", {
686
691
  variant: "source",
687
- token: A.token
688
- }), D.status === "loaded" && A.status === "loaded" && !o.targetToken)) {
692
+ token: T.token
693
+ }), D.status === "loaded" && T.status === "loaded" && !o.targetToken)) {
689
694
  let k = D.token;
690
- s === "same-asset" && (A.token?.isIntent ? k = n.find(
691
- (f) => !f.isIntent && f.symbol === o.sourceToken?.symbol && f.blockchain === W[c]
695
+ s === "same-asset" && (T.token?.isIntent ? k = n.find(
696
+ (f) => !f.isIntent && f.symbol === o.sourceToken?.symbol && f.blockchain === W[l]
692
697
  ) : k = n.find(
693
698
  (f) => f.isIntent && f.symbol === o.sourceToken?.symbol
694
699
  )), d("tokenSelect", {
@@ -696,22 +701,22 @@ const N = x.getStore(), pt = Ce({
696
701
  token: k
697
702
  });
698
703
  }
699
- }, [o, A, D, e]), h(() => {
700
- const T = S(o, ["initial_dry", "initial_wallet"]);
701
- if (!e || !T)
704
+ }, [o, T, D, e]), h(() => {
705
+ const I = S(o, ["initial_dry", "initial_wallet"]);
706
+ if (!e || !I)
702
707
  return;
703
708
  const k = n.find(
704
709
  (p) => p.isIntent && p.symbol === "AURORA" && p.blockchain === "near"
705
710
  ), f = setTimeout(() => {
706
- if (!A.token)
707
- if (!t && m)
711
+ if (!T.token)
712
+ if (!t && a)
708
713
  d("tokenSelect", {
709
714
  variant: "source",
710
- token: m
715
+ token: a
711
716
  });
712
- else if (r.length) {
717
+ else if (i.length) {
713
718
  const p = n.find(
714
- (E) => !E.isIntent && E.blockchain === W[c] && E.symbol.toLowerCase() === Ee[W[c]]?.toLowerCase()
719
+ (E) => !E.isIntent && E.blockchain === W[l] && E.symbol.toLowerCase() === Ee[W[l]]?.toLowerCase()
715
720
  ) ?? k;
716
721
  d("tokenSelect", {
717
722
  variant: "source",
@@ -724,7 +729,7 @@ const N = x.getStore(), pt = Ce({
724
729
  });
725
730
  }, 3e3);
726
731
  return () => clearTimeout(f);
727
- }, [n, A, t]), { source: o.sourceToken, target: o.targetToken };
732
+ }, [n, T, t]), { source: o.sourceToken, target: o.targetToken };
728
733
  }, xt = ({
729
734
  isEnabled: e,
730
735
  alchemyApiKey: t
@@ -735,18 +740,18 @@ const N = x.getStore(), pt = Ce({
735
740
  walletAddress: s.walletAddress,
736
741
  alchemyApiKey: t ?? ""
737
742
  });
738
- }, Bt = Ue(({ debug: e }) => {
739
- e && b.debug("[WIDGET] Debug mode is enabled"), ht(), gt({ debug: e }), It({ debug: e });
743
+ }, Bt = Le(({ debug: e }) => {
744
+ e && b.debug("[WIDGET] Debug mode is enabled"), ht(), gt({ debug: e }), kt({ debug: e });
740
745
  }), Zn = ({ listenTo: e, debug: t = !1 }) => {
741
746
  h(() => {
742
747
  Bt({ debug: t });
743
748
  }, [t]);
744
749
  const s = e.find(
745
- (a) => Array.isArray(a) && a[0] === "setBalancesUsingAlchemyExt"
750
+ (r) => Array.isArray(r) && r[0] === "setBalancesUsingAlchemyExt"
746
751
  ), n = e.find(
747
- (a) => Array.isArray(a) && a[0] === "setDefaultSelectedTokens"
752
+ (r) => Array.isArray(r) && r[0] === "setDefaultSelectedTokens"
748
753
  ), o = e.find(
749
- (a) => Array.isArray(a) && a[0] === "makeQuote"
754
+ (r) => Array.isArray(r) && r[0] === "makeQuote"
750
755
  );
751
756
  xt({
752
757
  isEnabled: !!s,
@@ -769,21 +774,21 @@ const N = x.getStore(), pt = Ce({
769
774
  isEnabled: e.includes("updateBalances"),
770
775
  alchemyApiKey: s?.[1].alchemyApiKey
771
776
  });
772
- }, Ut = x.getStore();
773
- class L extends Error {
777
+ }, Lt = x.getStore();
778
+ class U extends Error {
774
779
  context;
775
780
  _is_widget_error = !0;
776
781
  constructor(t, s) {
777
- super(t), this.name = "WidgetError", this.cause = s?.cause, this.context = $(Ut).context;
782
+ super(t), this.name = "WidgetError", this.cause = s?.cause, this.context = $(Lt).context;
778
783
  }
779
784
  }
780
- class me extends L {
785
+ class me extends U {
781
786
  data;
782
787
  constructor(t) {
783
788
  super(t.code), this.data = t, this.name = "MachineError";
784
789
  }
785
790
  }
786
- class g extends me {
791
+ class A extends me {
787
792
  constructor(t) {
788
793
  super(t), this.name = "QuoteError";
789
794
  }
@@ -793,10 +798,10 @@ class Jn extends me {
793
798
  super(t), this.name = "TransferError";
794
799
  }
795
800
  }
796
- const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, Lt = (e) => null, Qt = (e) => (t) => {
797
- if (t instanceof L)
801
+ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e && !!e._is_widget_error, Ut = (e) => null, Qt = (e) => (t) => {
802
+ if (t instanceof U)
798
803
  throw t;
799
- const s = new L(
804
+ const s = new U(
800
805
  t instanceof Error ? t.message : "Unknown error",
801
806
  { cause: t }
802
807
  );
@@ -806,7 +811,7 @@ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
806
811
  return /* @__PURE__ */ q(
807
812
  Ne,
808
813
  {
809
- FallbackComponent: Lt,
814
+ FallbackComponent: Ut,
810
815
  onError: Qt(t),
811
816
  children: e
812
817
  }
@@ -856,12 +861,12 @@ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
856
861
  source: { external: "wallet-supported", intents: "with-balance" },
857
862
  target: { external: "all", intents: "all" }
858
863
  }
859
- }, pe = ke({
864
+ }, pe = Ie({
860
865
  config: j
861
866
  }), z = ne({
862
867
  config: j
863
868
  }), v = () => {
864
- const e = Ie(pe);
869
+ const e = ke(pe);
865
870
  return Q(e).config;
866
871
  }, Mt = (e) => {
867
872
  z.config = R(e);
@@ -874,7 +879,7 @@ const Yn = (e) => typeof e == "object" && e !== null && "_is_widget_error" in e
874
879
  return h(() => {
875
880
  const o = R(t);
876
881
  Object.assign(n.current.config, o), Mt(o);
877
- }, [t]), $e(s ?? {}), Fe("headlessui-portal-root", "sw"), /* @__PURE__ */ q(ye, { client: Wt, children: /* @__PURE__ */ q(we, { i18n: Te, children: /* @__PURE__ */ q(pe.Provider, { value: n.current, children: /* @__PURE__ */ q(Pt, { children: /* @__PURE__ */ q("div", { className: "sw", children: e }) }) }) }) });
882
+ }, [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 }) }) }) }) });
878
883
  };
879
884
  export {
880
885
  j as A,
@@ -883,9 +888,9 @@ export {
883
888
  es as D,
884
889
  Pt as E,
885
890
  me as M,
886
- g as Q,
891
+ A as Q,
887
892
  Jn as T,
888
- L as W,
893
+ U as W,
889
894
  Xn as a,
890
895
  _ as b,
891
896
  Zn as c,
@@ -896,8 +901,8 @@ export {
896
901
  fe as h,
897
902
  Yn as i,
898
903
  v as j,
899
- kt as k,
900
- It as l,
904
+ It as k,
905
+ kt as l,
901
906
  gt as m,
902
907
  ht as n,
903
908
  bt as o,
@@ -913,4 +918,4 @@ export {
913
918
  Ot as y,
914
919
  xt as z
915
920
  };
916
- //# sourceMappingURL=config-C3Ii_szE.js.map
921
+ //# sourceMappingURL=config-BhnkBtE4.js.map