@aurora-is-near/intents-swap-widget 3.23.0 → 3.24.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.
- package/dist/{config-0TjbjBo5.js → config-Bg5hUlJL.js} +2 -2
- package/dist/{config-0TjbjBo5.js.map → config-Bg5hUlJL.js.map} +1 -1
- package/dist/config.js +1 -1
- package/dist/errors.js +1 -1
- package/dist/ext/alchemy/index.js +1 -1
- package/dist/ext/index.js +1 -1
- package/dist/features/BalanceRpcLoader/TokenBalanceLoader.js +1 -1
- package/dist/features/BalanceRpcLoader/index.js +1 -1
- package/dist/features/BalanceRpcLoader/useTokenBalanceRpc.js +1 -1
- package/dist/features/ChainsDropdown/index.js +1 -1
- package/dist/features/ChainsSelector/index.js +1 -1
- package/dist/features/DepositMethodSwitcher.js +1 -1
- package/dist/features/ErrorBoundary.js +1 -1
- package/dist/features/ExternalDeposit.js +1 -1
- package/dist/features/SendAddress/index.js +1 -1
- package/dist/features/SendAddress/useNotification.js +1 -1
- package/dist/features/SubmitButton/index.js +1 -1
- package/dist/features/SuccessScreen/index.js +1 -1
- package/dist/features/SuccessScreen/useSummaryItemsCount.js +1 -1
- package/dist/features/SwapDirectionSwitcher.js +1 -1
- package/dist/features/SwapQuote/SwapQuote.js +1 -1
- package/dist/features/SwapQuote/index.js +1 -1
- package/dist/features/TokenInput/TokenInput.js +1 -1
- package/dist/features/TokenInput/TokenInputEmpty.js +1 -1
- package/dist/features/TokenInput/TokenInputSource.js +1 -1
- package/dist/features/TokenInput/TokenInputTarget.js +1 -1
- package/dist/features/TokenInput/WalletBalance.js +1 -1
- package/dist/features/TokenInput/hooks/index.js +1 -1
- package/dist/features/TokenInput/hooks/useTokenInputBalance.js +1 -1
- package/dist/features/TokenInput/index.js +1 -1
- package/dist/features/TokensList/TokenItem.js +1 -1
- package/dist/features/TokensList/TokensList.js +1 -1
- package/dist/features/TokensList/index.js +1 -1
- package/dist/features/TokensModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/WalletCompatibilityModal.js +1 -1
- package/dist/features/WalletCompatibilityCheck/index.js +1 -1
- package/dist/features/index.js +1 -1
- package/dist/hooks/index.js +1 -1
- package/dist/hooks/useAllTokens.js +1 -1
- package/dist/hooks/useChains.js +1 -1
- package/dist/hooks/useCompatibilityCheck.js +1 -1
- package/dist/hooks/useDefaultToken.js +1 -1
- package/dist/hooks/useExternalDepositStatus/index.js +1 -1
- package/dist/hooks/useExternalDepositStatus/usePoaExternalDepositStatus.js +1 -1
- package/dist/hooks/useIntentsBalance.js +1 -1
- package/dist/hooks/useIsCompatibilityCheckRequired.js +1 -1
- package/dist/hooks/useMakeDepositAddress.js +1 -1
- package/dist/hooks/useMakeIntentsTransfer.js +1 -1
- package/dist/hooks/useMakeNEARFtTransferCall.js +1 -1
- package/dist/hooks/useMakeQuote.js +1 -1
- package/dist/hooks/useMakeQuoteTransfer.js +1 -1
- package/dist/hooks/useMakeTransfer.js +1 -1
- package/dist/hooks/useMergedBalance.js +1 -1
- package/dist/hooks/useSwitchChain.js +1 -1
- package/dist/hooks/useTheme.js +1 -1
- package/dist/hooks/useTokenInputPair.js +1 -1
- package/dist/hooks/useTokens.js +1 -1
- package/dist/hooks/useTokensFiltered.js +1 -1
- package/dist/hooks/useTokensIntentsUnique.js +1 -1
- package/dist/index.js +1 -1
- package/dist/machine/effects/index.js +1 -1
- package/dist/machine/effects/useAlchemyBalanceEffect.js +1 -1
- package/dist/machine/effects/useBalancesUpdateEffect.js +1 -1
- package/dist/machine/effects/useMakeQuoteEffect.js +1 -1
- package/dist/machine/effects/useSelectedTokensEffect.js +1 -1
- package/dist/machine/effects/useSetTokenBalanceEffect.js +1 -1
- package/dist/machine/effects/useSetTokenIntentsTargetEffect.js +1 -1
- package/dist/machine/effects/useWalletConnEffect.js +1 -1
- package/dist/machine/events/index.js +1 -1
- package/dist/machine/events/tokenSelect.js +1 -1
- package/dist/machine/events/validateInputAndMoveTo.js +1 -1
- package/dist/machine/events/validateInputs.js +1 -1
- package/dist/machine/index.js +1 -1
- package/dist/machine/snap.js +1 -1
- package/dist/machine/subscriptions/checkers/isSendAddressAsConnected.js +1 -1
- package/dist/machine/subscriptions/index.js +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/types/widget.d.ts +1 -0
- package/dist/types/widget.js +2 -0
- package/dist/types/widget.js.map +1 -0
- package/dist/utils/intents/signers/near.js +1 -1
- package/dist/utils/intents/signers/privy.js +1 -1
- package/dist/utils/near/getNearNep141StorageBalance.js +1 -1
- package/dist/widgets/Widget/WidgetContent.d.ts +6 -4
- package/dist/widgets/Widget/WidgetContent.js +27 -24
- package/dist/widgets/Widget/WidgetContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +1 -1
- package/src/types/widget.ts +1 -0
- package/src/widgets/Widget/WidgetContent.tsx +9 -5
|
@@ -3,7 +3,7 @@ import "../../utils/near/checkNearAccountExists.js";
|
|
|
3
3
|
import "../../utils/checkers/isNotEmptyAmount.js";
|
|
4
4
|
import "../../utils/checkers/isValidBigint.js";
|
|
5
5
|
import "../../utils/near/isNearAddress.js";
|
|
6
|
-
import { K as I, L as d, N as u } from "../../config-
|
|
6
|
+
import { K as I, L as d, N as u } from "../../config-Bg5hUlJL.js";
|
|
7
7
|
import "../guards/index.js";
|
|
8
8
|
import "../machine.js";
|
|
9
9
|
import "../guards/checks/isBalanceSufficient.js";
|
package/dist/machine/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as o, u as t, a as r, c as a, b as f } from "../config-
|
|
1
|
+
import { r as o, u as t, a as r, c as a, b as f } from "../config-Bg5hUlJL.js";
|
|
2
2
|
import { guardStates as S } from "./guards/index.js";
|
|
3
3
|
import { machine as n, moveTo as u } from "./machine.js";
|
|
4
4
|
import { fireEvent as i } from "./events/utils/fireEvent.js";
|
package/dist/machine/snap.js
CHANGED
|
@@ -2,7 +2,7 @@ import "valtio";
|
|
|
2
2
|
import "derive-valtio";
|
|
3
3
|
import "./computed/getIsNativeNearDeposit.js";
|
|
4
4
|
import "./computed/getIsDirectTokenOnNearDeposit.js";
|
|
5
|
-
import { u as h, a as b, b as d } from "../config-
|
|
5
|
+
import { u as h, a as b, b as d } from "../config-Bg5hUlJL.js";
|
|
6
6
|
import "./machine.js";
|
|
7
7
|
import "./guards/index.js";
|
|
8
8
|
import "./computed/getUsdTradeDelta.js";
|
|
@@ -5,7 +5,7 @@ import "./checkers/isOnlyErrorChanged.js";
|
|
|
5
5
|
import "./checkers/isValidInitialState.js";
|
|
6
6
|
import "./checkers/isWalletDisconnected.js";
|
|
7
7
|
import "./checkers/isSendAddressForbidden.js";
|
|
8
|
-
import { X as g, Y as u } from "../../config-
|
|
8
|
+
import { X as g, Y as u } from "../../config-Bg5hUlJL.js";
|
|
9
9
|
import "./checkers/isAmountChangedFromQuote.js";
|
|
10
10
|
import "ethers";
|
|
11
11
|
import "../machine.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type WidgetType = 'swap' | 'deposit' | 'withdraw';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"widget.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { Msg as SwapMsg, Props as WidgetSwapProps } from '../WidgetSwap/WidgetSwapContent';
|
|
2
2
|
import { Msg as DepositMsg, Props as WidgetDepositProps } from '../WidgetDeposit/WidgetDepositContent';
|
|
3
3
|
import { Props as WidgetWithdrawProps, Msg as WithdrawMsg } from '../WidgetWithdraw/WidgetWithdrawContent';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
import { MakeTransferArgs } from '../../types';
|
|
5
|
+
import { WidgetType } from '../../types/widget';
|
|
6
|
+
export type Props = Omit<WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps, 'onMsg' | 'makeTransfer'> & {
|
|
7
|
+
onMsg?: (msg: Msg, widgetType: WidgetType) => void;
|
|
8
|
+
makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;
|
|
7
9
|
};
|
|
8
10
|
type Msg = SwapMsg | DepositMsg | WithdrawMsg;
|
|
9
|
-
export declare const WidgetContent: ({ onMsg, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export declare const WidgetContent: ({ onMsg, makeTransfer, ...restProps }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
12
|
export {};
|
|
@@ -1,49 +1,52 @@
|
|
|
1
1
|
import { jsxs as u, Fragment as l, jsx as e } from "react/jsx-runtime";
|
|
2
|
-
import { useState as
|
|
3
|
-
import { WidgetTabs as
|
|
4
|
-
import { WidgetSwapContent as
|
|
5
|
-
import { WidgetDepositContent as
|
|
6
|
-
import { WidgetWithdrawContent as
|
|
7
|
-
import { y as
|
|
8
|
-
const j = ({ onMsg:
|
|
9
|
-
const [
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
t.type === "on_tokens_modal_toggled" &&
|
|
2
|
+
import { useState as p, useEffect as b } from "react";
|
|
3
|
+
import { WidgetTabs as g } from "../../components/WidgetTabs.js";
|
|
4
|
+
import { WidgetSwapContent as h } from "../WidgetSwap/WidgetSwapContent.js";
|
|
5
|
+
import { WidgetDepositContent as T } from "../WidgetDeposit/WidgetDepositContent.js";
|
|
6
|
+
import { WidgetWithdrawContent as W } from "../WidgetWithdraw/WidgetWithdrawContent.js";
|
|
7
|
+
import { y as C } from "../../config-Bg5hUlJL.js";
|
|
8
|
+
const j = ({ onMsg: d, makeTransfer: o, ...s }) => {
|
|
9
|
+
const [f, r] = p(!0), [a, c] = p("swap"), { enableAccountAbstraction: n } = C(), w = (t) => {
|
|
10
|
+
c(t);
|
|
11
|
+
}, i = (t, m) => {
|
|
12
|
+
t.type === "on_tokens_modal_toggled" && r(!t.isOpen), t.type === "on_select_token" && r(!0), d?.(t, m);
|
|
13
13
|
};
|
|
14
|
-
return
|
|
15
|
-
n ||
|
|
14
|
+
return b(() => {
|
|
15
|
+
n || c("swap");
|
|
16
16
|
}, [n]), /* @__PURE__ */ u(l, { children: [
|
|
17
|
-
n &&
|
|
17
|
+
n && f && /* @__PURE__ */ e(g, { activeTab: a, onSelect: w }),
|
|
18
18
|
(() => {
|
|
19
|
-
switch (
|
|
19
|
+
switch (a) {
|
|
20
20
|
case "swap":
|
|
21
21
|
return /* @__PURE__ */ e(
|
|
22
|
-
|
|
22
|
+
h,
|
|
23
23
|
{
|
|
24
|
-
...
|
|
24
|
+
...s,
|
|
25
|
+
makeTransfer: (t) => o?.(t, "swap"),
|
|
25
26
|
onMsg: (t) => {
|
|
26
|
-
|
|
27
|
+
i(t, "swap");
|
|
27
28
|
}
|
|
28
29
|
}
|
|
29
30
|
);
|
|
30
31
|
case "deposit":
|
|
31
32
|
return /* @__PURE__ */ e(
|
|
32
|
-
|
|
33
|
+
T,
|
|
33
34
|
{
|
|
34
|
-
...
|
|
35
|
+
...s,
|
|
36
|
+
makeTransfer: (t) => o?.(t, "deposit"),
|
|
35
37
|
onMsg: (t) => {
|
|
36
|
-
|
|
38
|
+
i(t, "deposit");
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
);
|
|
40
42
|
case "withdraw":
|
|
41
43
|
return /* @__PURE__ */ e(
|
|
42
|
-
|
|
44
|
+
W,
|
|
43
45
|
{
|
|
44
|
-
...
|
|
46
|
+
...s,
|
|
47
|
+
makeTransfer: (t) => o?.(t, "withdraw"),
|
|
45
48
|
onMsg: (t) => {
|
|
46
|
-
|
|
49
|
+
i(t, "withdraw");
|
|
47
50
|
}
|
|
48
51
|
}
|
|
49
52
|
);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetContent.js","sources":["../../../src/widgets/Widget/WidgetContent.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';\nimport {\n Msg as SwapMsg,\n WidgetSwapContent,\n Props as WidgetSwapProps,\n} from '../WidgetSwap/WidgetSwapContent';\nimport {\n Msg as DepositMsg,\n WidgetDepositContent,\n Props as WidgetDepositProps,\n} from '../WidgetDeposit/WidgetDepositContent';\nimport {\n WidgetWithdrawContent,\n Props as WidgetWithdrawProps,\n Msg as WithdrawMsg,\n} from '../WidgetWithdraw/WidgetWithdrawContent';\nimport { useConfig } from '../../config';\
|
|
1
|
+
{"version":3,"file":"WidgetContent.js","sources":["../../../src/widgets/Widget/WidgetContent.tsx"],"sourcesContent":["'use client';\n\nimport { useEffect, useState } from 'react';\nimport { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';\nimport {\n Msg as SwapMsg,\n WidgetSwapContent,\n Props as WidgetSwapProps,\n} from '../WidgetSwap/WidgetSwapContent';\nimport {\n Msg as DepositMsg,\n WidgetDepositContent,\n Props as WidgetDepositProps,\n} from '../WidgetDeposit/WidgetDepositContent';\nimport {\n WidgetWithdrawContent,\n Props as WidgetWithdrawProps,\n Msg as WithdrawMsg,\n} from '../WidgetWithdraw/WidgetWithdrawContent';\nimport { useConfig } from '../../config';\nimport { MakeTransferArgs } from '../../types';\nimport { WidgetType } from '../../types/widget';\n\nexport type Props = Omit<\n WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,\n 'onMsg' | 'makeTransfer'\n> & {\n onMsg?: (msg: Msg, widgetType: WidgetType) => void;\n makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;\n};\n\ntype Msg = SwapMsg | DepositMsg | WithdrawMsg;\n\nexport const WidgetContent = ({ onMsg, makeTransfer, ...restProps }: Props) => {\n const [isTabsVisible, setIsTabsVisible] = useState(true);\n const [activeTab, setActiveTab] = useState<WidgetTab>('swap');\n const { enableAccountAbstraction } = useConfig();\n\n const switchTab = (tab: WidgetTab) => {\n setActiveTab(tab);\n };\n\n const handleMsg = <T extends Msg>(msg: T, widgetType: WidgetType) => {\n if (msg.type === 'on_tokens_modal_toggled') {\n setIsTabsVisible(!msg.isOpen);\n }\n\n if (msg.type === 'on_select_token') {\n setIsTabsVisible(true);\n }\n\n onMsg?.(msg, widgetType);\n };\n\n useEffect(() => {\n if (!enableAccountAbstraction) {\n setActiveTab('swap');\n }\n }, [enableAccountAbstraction]);\n\n return (\n <>\n {enableAccountAbstraction && isTabsVisible && (\n <WidgetTabs activeTab={activeTab} onSelect={switchTab} />\n )}\n\n {(() => {\n switch (activeTab) {\n case 'swap': {\n return (\n <WidgetSwapContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'swap')}\n onMsg={(msg) => {\n handleMsg(msg, 'swap');\n }}\n />\n );\n }\n\n case 'deposit': {\n return (\n <WidgetDepositContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'deposit')}\n onMsg={(msg) => {\n handleMsg(msg, 'deposit');\n }}\n />\n );\n }\n\n case 'withdraw': {\n return (\n <WidgetWithdrawContent\n {...restProps}\n makeTransfer={(args) => makeTransfer?.(args, 'withdraw')}\n onMsg={(msg) => {\n handleMsg(msg, 'withdraw');\n }}\n />\n );\n }\n\n default:\n return null;\n }\n })()}\n </>\n );\n};\n"],"names":["WidgetContent","onMsg","makeTransfer","restProps","isTabsVisible","setIsTabsVisible","useState","activeTab","setActiveTab","enableAccountAbstraction","useConfig","switchTab","tab","handleMsg","msg","widgetType","useEffect","jsxs","Fragment","jsx","WidgetTabs","WidgetSwapContent","args","WidgetDepositContent","WidgetWithdrawContent"],"mappings":";;;;;;;AAiCO,MAAMA,IAAgB,CAAC,EAAE,OAAAC,GAAO,cAAAC,GAAc,GAAGC,QAAuB;AAC7E,QAAM,CAACC,GAAeC,CAAgB,IAAIC,EAAS,EAAI,GACjD,CAACC,GAAWC,CAAY,IAAIF,EAAoB,MAAM,GACtD,EAAE,0BAAAG,EAAA,IAA6BC,EAAA,GAE/BC,IAAY,CAACC,MAAmB;AACpC,IAAAJ,EAAaI,CAAG;AAAA,EAClB,GAEMC,IAAY,CAAgBC,GAAQC,MAA2B;AACnE,IAAID,EAAI,SAAS,6BACfT,EAAiB,CAACS,EAAI,MAAM,GAG1BA,EAAI,SAAS,qBACfT,EAAiB,EAAI,GAGvBJ,IAAQa,GAAKC,CAAU;AAAA,EACzB;AAEA,SAAAC,EAAU,MAAM;AACd,IAAKP,KACHD,EAAa,MAAM;AAAA,EAEvB,GAAG,CAACC,CAAwB,CAAC,GAG3B,gBAAAQ,EAAAC,GAAA,EACG,UAAA;AAAA,IAAAT,KAA4BL,KAC3B,gBAAAe,EAACC,GAAA,EAAW,WAAAb,GAAsB,UAAUI,GAAW;AAAA,KAGvD,MAAM;AACN,cAAQJ,GAAA;AAAA,QACN,KAAK;AACH,iBACE,gBAAAY;AAAA,YAACE;AAAA,YAAA;AAAA,cACE,GAAGlB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,MAAM;AAAA,cACnD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,MAAM;AAAA,cACvB;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACI;AAAA,YAAA;AAAA,cACE,GAAGpB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,SAAS;AAAA,cACtD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,SAAS;AAAA,cAC1B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN,KAAK;AACH,iBACE,gBAAAK;AAAA,YAACK;AAAA,YAAA;AAAA,cACE,GAAGrB;AAAA,cACJ,cAAc,CAACmB,MAASpB,IAAeoB,GAAM,UAAU;AAAA,cACvD,OAAO,CAACR,MAAQ;AACd,gBAAAD,EAAUC,GAAK,UAAU;AAAA,cAC3B;AAAA,YAAA;AAAA,UAAA;AAAA,QAKN;AACE,iBAAO;AAAA,MAAA;AAAA,IAEb,GAAA;AAAA,EAAG,GACL;AAEJ;"}
|
|
@@ -3,7 +3,7 @@ import { useState as y, useEffect as p, useCallback as B } from "react";
|
|
|
3
3
|
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { useTypedTranslation as A } from "../../localisation.js";
|
|
5
5
|
import { WidgetDepositSkeleton as b } from "./WidgetDepositSkeleton.js";
|
|
6
|
-
import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-
|
|
6
|
+
import { b as F, u as q, y as j, n as N, c as O, p as Q, o as U, S as K } from "../../config-Bg5hUlJL.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "@material-symbols-svg/react-rounded/icons/chevron-left";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import a from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-Bg5hUlJL.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: l } = i();
|
|
7
7
|
return /* @__PURE__ */ o("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as b, useEffect as w } from "react";
|
|
|
3
3
|
import { useTokenModal as D } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetSwapSkeleton as T } from "./WidgetSwapSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as F } from "../../localisation.js";
|
|
6
|
-
import { b as N, u as O, y as Q, n as j, c as q, p as y, o as U, S as K } from "../../config-
|
|
6
|
+
import { b as N, u as O, y as Q, n as j, c as q, p as y, o as U, S as K } from "../../config-Bg5hUlJL.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "@material-symbols-svg/react-rounded/icons/chevron-left";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as l } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as s } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as i } from "../../config-
|
|
4
|
+
import { y as i } from "../../config-Bg5hUlJL.js";
|
|
5
5
|
const m = () => {
|
|
6
6
|
const { hideTokenInputHeadings: e } = i();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-lg relative flex flex-col", children: [
|
|
@@ -3,7 +3,7 @@ import { useState as w, useEffect as _ } from "react";
|
|
|
3
3
|
import { useTokenModal as D } from "../../hooks/useTokenModal.js";
|
|
4
4
|
import { WidgetWithdrawSkeleton as b } from "./WidgetWithdrawSkeleton.js";
|
|
5
5
|
import { useTypedTranslation as N } from "../../localisation.js";
|
|
6
|
-
import { b as O, u as Q, y as j, n as q, c as U, p as y, o as F, S as K } from "../../config-
|
|
6
|
+
import { b as O, u as Q, y as j, n as q, c as U, p as y, o as F, S as K } from "../../config-Bg5hUlJL.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "@material-symbols-svg/react-rounded/icons/chevron-left";
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as a, jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import o from "clsx";
|
|
3
3
|
import { SkeletonBox as l } from "../../components/SkeletonBox.js";
|
|
4
|
-
import { y as x } from "../../config-
|
|
4
|
+
import { y as x } from "../../config-Bg5hUlJL.js";
|
|
5
5
|
const p = () => {
|
|
6
6
|
const { hideTokenInputHeadings: s } = x();
|
|
7
7
|
return /* @__PURE__ */ a("div", { className: "w-full gap-sw-xl relative flex flex-col", children: [
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type WidgetType = 'swap' | 'deposit' | 'withdraw';
|
|
@@ -18,19 +18,20 @@ import {
|
|
|
18
18
|
Msg as WithdrawMsg,
|
|
19
19
|
} from '../WidgetWithdraw/WidgetWithdrawContent';
|
|
20
20
|
import { useConfig } from '../../config';
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
import { MakeTransferArgs } from '../../types';
|
|
22
|
+
import { WidgetType } from '../../types/widget';
|
|
23
23
|
|
|
24
24
|
export type Props = Omit<
|
|
25
25
|
WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,
|
|
26
|
-
'onMsg'
|
|
26
|
+
'onMsg' | 'makeTransfer'
|
|
27
27
|
> & {
|
|
28
|
-
onMsg?: (msg: Msg,
|
|
28
|
+
onMsg?: (msg: Msg, widgetType: WidgetType) => void;
|
|
29
|
+
makeTransfer?: (args: MakeTransferArgs, widgetType: WidgetType) => void;
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
type Msg = SwapMsg | DepositMsg | WithdrawMsg;
|
|
32
33
|
|
|
33
|
-
export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
|
|
34
|
+
export const WidgetContent = ({ onMsg, makeTransfer, ...restProps }: Props) => {
|
|
34
35
|
const [isTabsVisible, setIsTabsVisible] = useState(true);
|
|
35
36
|
const [activeTab, setActiveTab] = useState<WidgetTab>('swap');
|
|
36
37
|
const { enableAccountAbstraction } = useConfig();
|
|
@@ -69,6 +70,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
|
|
|
69
70
|
return (
|
|
70
71
|
<WidgetSwapContent
|
|
71
72
|
{...restProps}
|
|
73
|
+
makeTransfer={(args) => makeTransfer?.(args, 'swap')}
|
|
72
74
|
onMsg={(msg) => {
|
|
73
75
|
handleMsg(msg, 'swap');
|
|
74
76
|
}}
|
|
@@ -80,6 +82,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
|
|
|
80
82
|
return (
|
|
81
83
|
<WidgetDepositContent
|
|
82
84
|
{...restProps}
|
|
85
|
+
makeTransfer={(args) => makeTransfer?.(args, 'deposit')}
|
|
83
86
|
onMsg={(msg) => {
|
|
84
87
|
handleMsg(msg, 'deposit');
|
|
85
88
|
}}
|
|
@@ -91,6 +94,7 @@ export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
|
|
|
91
94
|
return (
|
|
92
95
|
<WidgetWithdrawContent
|
|
93
96
|
{...restProps}
|
|
97
|
+
makeTransfer={(args) => makeTransfer?.(args, 'withdraw')}
|
|
94
98
|
onMsg={(msg) => {
|
|
95
99
|
handleMsg(msg, 'withdraw');
|
|
96
100
|
}}
|