@aurora-is-near/intents-swap-widget 3.22.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-Opy5ppbU.js → config-Bg5hUlJL.js} +183 -183
- package/dist/config-Bg5hUlJL.js.map +1 -0
- package/dist/config.d.ts +1 -10
- 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/chain.d.ts +4 -0
- package/dist/types/config.d.ts +2 -5
- 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 +30 -24
- package/dist/widgets/Widget/WidgetContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +65 -63
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +59 -53
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +79 -77
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/package.json +1 -1
- package/src/config.tsx +0 -5
- package/src/machine/effects/useSelectedTokensEffect.ts +7 -4
- package/src/types/chain.ts +5 -0
- package/src/types/config.ts +3 -4
- package/src/types/widget.ts +1 -0
- package/src/widgets/Widget/WidgetContent.tsx +19 -7
- package/src/widgets/WidgetDeposit/WidgetDeposit.test.tsx +0 -4
- package/src/widgets/WidgetDeposit/WidgetDepositContent.tsx +7 -3
- package/src/widgets/WidgetSwap/WidgetSwapContent.tsx +19 -4
- package/src/widgets/WidgetWithdraw/WidgetWithdrawContent.tsx +5 -3
- package/dist/config-Opy5ppbU.js.map +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import "react";
|
|
2
2
|
import "../../hooks/useWalletAddressForToken.js";
|
|
3
|
-
import { I as f } from "../../config-
|
|
3
|
+
import { I as f } from "../../config-Bg5hUlJL.js";
|
|
4
4
|
import "../guards/index.js";
|
|
5
5
|
import "../machine.js";
|
|
6
6
|
import "../events/utils/fireEvent.js";
|
|
@@ -3,7 +3,7 @@ import "./tokenSelectRotate.js";
|
|
|
3
3
|
import "./errorSet.js";
|
|
4
4
|
import "./quoteSet.js";
|
|
5
5
|
import "./addressSet.js";
|
|
6
|
-
import { _ as b } from "../../config-
|
|
6
|
+
import { _ as b } from "../../config-Bg5hUlJL.js";
|
|
7
7
|
import "./tokenSetAmount.js";
|
|
8
8
|
import "./quoteSetStatus.js";
|
|
9
9
|
import "./depositTypeSet.js";
|
|
@@ -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";
|
package/dist/types/chain.d.ts
CHANGED
|
@@ -9,4 +9,8 @@ export type ChainsFilter = {
|
|
|
9
9
|
intents: 'none' | 'all' | 'with-balance';
|
|
10
10
|
external: 'none' | 'all' | 'wallet-supported';
|
|
11
11
|
};
|
|
12
|
+
export type ChainsFilters = {
|
|
13
|
+
target: ChainsFilter;
|
|
14
|
+
source: ChainsFilter;
|
|
15
|
+
};
|
|
12
16
|
export type ChainRpcUrls = Partial<Record<Chains, string[]>>;
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Quote, QuoteRequest } from '@defuse-protocol/one-click-sdk-typescript';
|
|
2
|
-
import { Chains
|
|
2
|
+
import { Chains } from './chain';
|
|
3
3
|
import { SimpleToken, Token } from './token';
|
|
4
4
|
import { FetchQuoteOptions } from './quote';
|
|
5
5
|
export type WalletAddresses = Partial<Record<Chains | 'default', string | null>>;
|
|
@@ -8,6 +8,7 @@ export type PriorityAssets = ReadonlyArray<string> | ReadonlyArray<readonly [Cha
|
|
|
8
8
|
export type WidgetConfig = {
|
|
9
9
|
appName: string;
|
|
10
10
|
appIcon?: string;
|
|
11
|
+
enableAccountAbstraction?: boolean;
|
|
11
12
|
intentsAccountType?: IntentsAccountType;
|
|
12
13
|
walletSupportedChains: ReadonlyArray<Chains>;
|
|
13
14
|
connectedWallets: WalletAddresses;
|
|
@@ -32,10 +33,6 @@ export type WidgetConfig = {
|
|
|
32
33
|
allowedSourceChainsList?: Chains[];
|
|
33
34
|
allowedTargetChainsList?: Chains[];
|
|
34
35
|
topChainShortcuts?: (intentsAccountType?: IntentsAccountType) => [Chains, Chains, Chains, Chains];
|
|
35
|
-
chainsFilter: {
|
|
36
|
-
source: ChainsFilter;
|
|
37
|
-
target: ChainsFilter;
|
|
38
|
-
};
|
|
39
36
|
fetchQuote?: (data: QuoteRequest, options: FetchQuoteOptions) => Promise<Quote>;
|
|
40
37
|
fetchSourceTokens?: () => Promise<SimpleToken[]>;
|
|
41
38
|
fetchTargetTokens?: () => Promise<SimpleToken[]>;
|
|
@@ -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,46 +1,52 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { WidgetTabs as
|
|
4
|
-
import { WidgetSwapContent as
|
|
5
|
-
import { WidgetDepositContent as
|
|
6
|
-
import { WidgetWithdrawContent as
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { jsxs as u, Fragment as l, jsx as e } from "react/jsx-runtime";
|
|
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);
|
|
12
13
|
};
|
|
13
|
-
return
|
|
14
|
-
|
|
14
|
+
return b(() => {
|
|
15
|
+
n || c("swap");
|
|
16
|
+
}, [n]), /* @__PURE__ */ u(l, { children: [
|
|
17
|
+
n && f && /* @__PURE__ */ e(g, { activeTab: a, onSelect: w }),
|
|
15
18
|
(() => {
|
|
16
|
-
switch (
|
|
19
|
+
switch (a) {
|
|
17
20
|
case "swap":
|
|
18
21
|
return /* @__PURE__ */ e(
|
|
19
|
-
|
|
22
|
+
h,
|
|
20
23
|
{
|
|
21
|
-
...
|
|
24
|
+
...s,
|
|
25
|
+
makeTransfer: (t) => o?.(t, "swap"),
|
|
22
26
|
onMsg: (t) => {
|
|
23
|
-
|
|
27
|
+
i(t, "swap");
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
);
|
|
27
31
|
case "deposit":
|
|
28
32
|
return /* @__PURE__ */ e(
|
|
29
|
-
|
|
33
|
+
T,
|
|
30
34
|
{
|
|
31
|
-
...
|
|
35
|
+
...s,
|
|
36
|
+
makeTransfer: (t) => o?.(t, "deposit"),
|
|
32
37
|
onMsg: (t) => {
|
|
33
|
-
|
|
38
|
+
i(t, "deposit");
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
);
|
|
37
42
|
case "withdraw":
|
|
38
43
|
return /* @__PURE__ */ e(
|
|
39
|
-
|
|
44
|
+
W,
|
|
40
45
|
{
|
|
41
|
-
...
|
|
46
|
+
...s,
|
|
47
|
+
makeTransfer: (t) => o?.(t, "withdraw"),
|
|
42
48
|
onMsg: (t) => {
|
|
43
|
-
|
|
49
|
+
i(t, "withdraw");
|
|
44
50
|
}
|
|
45
51
|
}
|
|
46
52
|
);
|
|
@@ -51,6 +57,6 @@ const x = ({ onMsg: a, ...o }) => {
|
|
|
51
57
|
] });
|
|
52
58
|
};
|
|
53
59
|
export {
|
|
54
|
-
|
|
60
|
+
j as WidgetContent
|
|
55
61
|
};
|
|
56
62
|
//# sourceMappingURL=WidgetContent.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"WidgetContent.js","sources":["../../../src/widgets/Widget/WidgetContent.tsx"],"sourcesContent":["'use client';\n\nimport { 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';\
|
|
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;"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
2
|
-
import { useState as
|
|
3
|
-
import { useTokenModal as
|
|
4
|
-
import { useTypedTranslation as
|
|
5
|
-
import { WidgetDepositSkeleton as
|
|
6
|
-
import { b as
|
|
1
|
+
import { jsx as t, jsxs as _ } from "react/jsx-runtime";
|
|
2
|
+
import { useState as y, useEffect as p, useCallback as B } from "react";
|
|
3
|
+
import { useTokenModal as R } from "../../hooks/useTokenModal.js";
|
|
4
|
+
import { useTypedTranslation as A } from "../../localisation.js";
|
|
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-Bg5hUlJL.js";
|
|
7
7
|
import "@tanstack/react-query";
|
|
8
8
|
import "@headlessui/react";
|
|
9
9
|
import "@material-symbols-svg/react-rounded/icons/chevron-left";
|
|
@@ -15,20 +15,20 @@ import { notReachable as r } from "../../utils/notReachable.js";
|
|
|
15
15
|
import "use-debounce";
|
|
16
16
|
import "@material-symbols-svg/react-rounded/icons/wand-shine";
|
|
17
17
|
import "../../components/Input.js";
|
|
18
|
-
import { Banner as
|
|
19
|
-
import { isDebug as
|
|
18
|
+
import { Banner as P } from "../../components/Banner.js";
|
|
19
|
+
import { isDebug as z } from "../../utils/checkers/isDebug.js";
|
|
20
20
|
import "viem";
|
|
21
21
|
import "ethers";
|
|
22
22
|
import "../../machine/machine.js";
|
|
23
23
|
import { fireEvent as u } from "../../machine/events/utils/fireEvent.js";
|
|
24
|
-
import { SuccessScreen as
|
|
25
|
-
import { TokensModal as
|
|
24
|
+
import { SuccessScreen as G } from "../../features/SuccessScreen/index.js";
|
|
25
|
+
import { TokensModal as H } from "../../features/TokensModal.js";
|
|
26
26
|
import "@material-symbols-svg/react-rounded/icons/arrow-downward";
|
|
27
27
|
import "@material-symbols-svg/react-rounded/icons/progress-activity";
|
|
28
|
-
import { ExternalDeposit as
|
|
29
|
-
import { DepositMethodSwitcher as
|
|
30
|
-
import { WalletCompatibilityCheck as
|
|
31
|
-
import { BlockingError as
|
|
28
|
+
import { ExternalDeposit as J } from "../../features/ExternalDeposit.js";
|
|
29
|
+
import { DepositMethodSwitcher as L } from "../../features/DepositMethodSwitcher.js";
|
|
30
|
+
import { WalletCompatibilityCheck as V } from "../../features/WalletCompatibilityCheck/index.js";
|
|
31
|
+
import { BlockingError as X } from "../../components/BlockingError.js";
|
|
32
32
|
import "copy-text-to-clipboard";
|
|
33
33
|
import "@material-symbols-svg/react-rounded/icons/content-copy";
|
|
34
34
|
import "../../components/InputAmount.js";
|
|
@@ -48,30 +48,29 @@ import "@defuse-protocol/one-click-sdk-typescript";
|
|
|
48
48
|
import "axios";
|
|
49
49
|
import "../../network.js";
|
|
50
50
|
import "viem/chains";
|
|
51
|
-
import { useTokenInputPair as
|
|
52
|
-
import { useIsCompatibilityCheckRequired as
|
|
51
|
+
import { useTokenInputPair as Y } from "../../hooks/useTokenInputPair.js";
|
|
52
|
+
import { useIsCompatibilityCheckRequired as Z } from "../../hooks/useIsCompatibilityCheckRequired.js";
|
|
53
53
|
import "browser-or-node";
|
|
54
|
-
const
|
|
54
|
+
const Ze = ({
|
|
55
55
|
providers: m,
|
|
56
56
|
onMsg: n,
|
|
57
|
-
makeTransfer:
|
|
58
|
-
isLoading:
|
|
57
|
+
makeTransfer: S,
|
|
58
|
+
isLoading: T
|
|
59
59
|
}) => {
|
|
60
|
-
const { ctx: o } =
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
} = N(), { onChangeAmount: E, onChangeToken: d } = Z(), { status: k, refetch: W } = O(), { tokenModalOpen: s, updateTokenModalState: a } = A({ onMsg: n }), h = $(), [I, c] = b(!1);
|
|
60
|
+
const { ctx: o } = F(), { t: i } = A(), { isDirectNearTokenWithdrawal: w } = q(), {
|
|
61
|
+
alchemyApiKey: x,
|
|
62
|
+
refetchQuoteInterval: C,
|
|
63
|
+
intentsAccountType: g,
|
|
64
|
+
onWalletSignout: D
|
|
65
|
+
} = j(), { onChangeAmount: E, onChangeToken: f } = Y(), { status: d, refetch: v } = N(), { tokenModalOpen: s, updateTokenModalState: a } = R({ onMsg: n }), k = Z(), [W, l] = y(!1);
|
|
67
66
|
p(() => {
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
const [
|
|
67
|
+
k && l(!0);
|
|
68
|
+
}, [k]);
|
|
69
|
+
const [h, c] = y(), I = B(
|
|
71
70
|
(e) => {
|
|
72
71
|
switch (e.type) {
|
|
73
72
|
case "on_successful_transfer":
|
|
74
|
-
|
|
73
|
+
c(e.transferResult);
|
|
75
74
|
break;
|
|
76
75
|
case "on_transaction_received":
|
|
77
76
|
break;
|
|
@@ -83,15 +82,15 @@ const $e = ({
|
|
|
83
82
|
);
|
|
84
83
|
p(() => (u("reset", { clearWalletAddress: !0 }), () => {
|
|
85
84
|
u("depositTypeSet", { isExternal: !1 });
|
|
86
|
-
}), []),
|
|
87
|
-
debug:
|
|
85
|
+
}), []), O({
|
|
86
|
+
debug: z(),
|
|
88
87
|
listenTo: [
|
|
89
88
|
"checkWalletConnection",
|
|
90
89
|
"setSourceTokenBalance",
|
|
91
90
|
"setSourceTokenIntentsTarget",
|
|
92
91
|
["setDefaultSelectedTokens", { skipIntents: !0 }],
|
|
93
|
-
["makeQuote", { message: void 0, refetchQuoteInterval:
|
|
94
|
-
["setBalancesUsingAlchemyExt", { alchemyApiKey:
|
|
92
|
+
["makeQuote", { message: void 0, refetchQuoteInterval: C }],
|
|
93
|
+
["setBalancesUsingAlchemyExt", { alchemyApiKey: x }]
|
|
95
94
|
]
|
|
96
95
|
}), p(() => {
|
|
97
96
|
n?.({
|
|
@@ -99,23 +98,23 @@ const $e = ({
|
|
|
99
98
|
isExternal: o.isDepositFromExternalWallet
|
|
100
99
|
});
|
|
101
100
|
}, [o.isDepositFromExternalWallet]);
|
|
102
|
-
const
|
|
101
|
+
const M = () => {
|
|
103
102
|
u("reset", { clearWalletAddress: !1, keepSelectedTokens: !0 });
|
|
104
103
|
};
|
|
105
|
-
if (
|
|
106
|
-
return /* @__PURE__ */ t(
|
|
107
|
-
if (
|
|
104
|
+
if (T || d !== "error" && !o.sourceToken)
|
|
105
|
+
return /* @__PURE__ */ t(b, {});
|
|
106
|
+
if (W)
|
|
108
107
|
return /* @__PURE__ */ t(
|
|
109
|
-
|
|
108
|
+
V,
|
|
110
109
|
{
|
|
111
110
|
providers: m,
|
|
112
111
|
onMsg: (e) => {
|
|
113
112
|
switch (e.type) {
|
|
114
113
|
case "on_sign_out":
|
|
115
|
-
|
|
114
|
+
D?.(g), l(!1);
|
|
116
115
|
break;
|
|
117
116
|
case "on_close":
|
|
118
|
-
|
|
117
|
+
l(!1);
|
|
119
118
|
break;
|
|
120
119
|
default:
|
|
121
120
|
r(e.type);
|
|
@@ -123,16 +122,16 @@ const $e = ({
|
|
|
123
122
|
}
|
|
124
123
|
}
|
|
125
124
|
);
|
|
126
|
-
if (o.state === "transfer_success" &&
|
|
125
|
+
if (o.state === "transfer_success" && h)
|
|
127
126
|
return /* @__PURE__ */ t(
|
|
128
|
-
|
|
127
|
+
G,
|
|
129
128
|
{
|
|
130
|
-
...
|
|
129
|
+
...h,
|
|
131
130
|
title: i("transfer.success.deposit.title", "Deposit successful"),
|
|
132
131
|
onMsg: (e) => {
|
|
133
132
|
switch (e.type) {
|
|
134
133
|
case "on_dismiss_success":
|
|
135
|
-
|
|
134
|
+
c(void 0), M();
|
|
136
135
|
break;
|
|
137
136
|
default:
|
|
138
137
|
r(e.type);
|
|
@@ -140,28 +139,31 @@ const $e = ({
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
);
|
|
143
|
-
switch (
|
|
142
|
+
switch (d) {
|
|
144
143
|
case "error":
|
|
145
144
|
return /* @__PURE__ */ t(
|
|
146
|
-
|
|
145
|
+
X,
|
|
147
146
|
{
|
|
148
147
|
message: "Couldn't load tokens list.",
|
|
149
|
-
onClickRetry:
|
|
148
|
+
onClickRetry: v
|
|
150
149
|
}
|
|
151
150
|
);
|
|
152
151
|
case "success":
|
|
153
152
|
return s !== "none" ? /* @__PURE__ */ t(
|
|
154
|
-
|
|
153
|
+
H,
|
|
155
154
|
{
|
|
156
155
|
showBalances: !0,
|
|
157
156
|
showChainsSelector: !0,
|
|
158
157
|
variant: s,
|
|
159
158
|
groupTokens: s === "source",
|
|
160
|
-
chainsFilter: s === "source" ?
|
|
159
|
+
chainsFilter: s === "source" ? {
|
|
160
|
+
intents: "none",
|
|
161
|
+
external: o.isDepositFromExternalWallet ? "all" : "wallet-supported"
|
|
162
|
+
} : { intents: "all", external: "none" },
|
|
161
163
|
onMsg: (e) => {
|
|
162
164
|
switch (e.type) {
|
|
163
165
|
case "on_select_token":
|
|
164
|
-
|
|
166
|
+
f(s, e.token), a("none"), n?.({
|
|
165
167
|
type: e.type,
|
|
166
168
|
token: e.token,
|
|
167
169
|
variant: s
|
|
@@ -175,16 +177,16 @@ const $e = ({
|
|
|
175
177
|
}
|
|
176
178
|
}
|
|
177
179
|
}
|
|
178
|
-
) : /* @__PURE__ */
|
|
180
|
+
) : /* @__PURE__ */ _("div", { className: "gap-sw-2xl flex flex-col", children: [
|
|
179
181
|
/* @__PURE__ */ t(
|
|
180
|
-
|
|
182
|
+
Q.Source,
|
|
181
183
|
{
|
|
182
184
|
showBalance: !o.isDepositFromExternalWallet,
|
|
183
185
|
heading: i("tokenInput.heading.source.deposit", "Sell"),
|
|
184
186
|
onMsg: (e) => {
|
|
185
187
|
switch (e.type) {
|
|
186
188
|
case "on_select_token":
|
|
187
|
-
|
|
189
|
+
f("source", e.token);
|
|
188
190
|
break;
|
|
189
191
|
case "on_change_amount":
|
|
190
192
|
E("source", e.amount);
|
|
@@ -198,10 +200,10 @@ const $e = ({
|
|
|
198
200
|
}
|
|
199
201
|
}
|
|
200
202
|
),
|
|
201
|
-
/* @__PURE__ */ t(
|
|
202
|
-
/* @__PURE__ */ t(
|
|
203
|
+
/* @__PURE__ */ t(L, { children: ({ isExternal: e }) => e ? /* @__PURE__ */ _("div", { className: "gap-sw-2xl flex flex-col justify-between", children: [
|
|
204
|
+
/* @__PURE__ */ t(J, { onMsg: I }),
|
|
203
205
|
(o.state === "quote_success_internal" || o.state === "quote_success_external") && /* @__PURE__ */ t(
|
|
204
|
-
|
|
206
|
+
P,
|
|
205
207
|
{
|
|
206
208
|
multiline: !0,
|
|
207
209
|
variant: "warn",
|
|
@@ -209,25 +211,25 @@ const $e = ({
|
|
|
209
211
|
}
|
|
210
212
|
)
|
|
211
213
|
] }) : null }),
|
|
212
|
-
!
|
|
214
|
+
!w && /* @__PURE__ */ t(U, {}),
|
|
213
215
|
/* @__PURE__ */ t(
|
|
214
|
-
|
|
216
|
+
K,
|
|
215
217
|
{
|
|
216
218
|
providers: m,
|
|
217
|
-
makeTransfer:
|
|
219
|
+
makeTransfer: S,
|
|
218
220
|
label: i("submit.active.deposit", "Deposit now"),
|
|
219
221
|
onSuccess: (e) => {
|
|
220
|
-
|
|
222
|
+
c(e), n?.({ type: "on_transfer_success" });
|
|
221
223
|
}
|
|
222
224
|
}
|
|
223
225
|
)
|
|
224
226
|
] });
|
|
225
227
|
case "pending":
|
|
226
228
|
default:
|
|
227
|
-
return /* @__PURE__ */ t(
|
|
229
|
+
return /* @__PURE__ */ t(b, {});
|
|
228
230
|
}
|
|
229
231
|
};
|
|
230
232
|
export {
|
|
231
|
-
|
|
233
|
+
Ze as WidgetDepositContent
|
|
232
234
|
};
|
|
233
235
|
//# sourceMappingURL=WidgetDepositContent.js.map
|