@aurora-is-near/intents-swap-widget 3.21.0 → 3.22.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/components/WidgetContainer.js +23 -14
- package/dist/components/WidgetContainer.js.map +1 -1
- package/dist/components/WidgetTabs.d.ts +8 -0
- package/dist/components/WidgetTabs.js +20 -0
- package/dist/components/WidgetTabs.js.map +1 -0
- package/dist/{config-CyBNYvb1.js → config-Opy5ppbU.js} +2 -2
- package/dist/{config-CyBNYvb1.js.map → config-Opy5ppbU.js.map} +1 -1
- package/dist/config.d.ts +1 -0
- 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.d.ts +1 -5
- package/dist/features/SwapDirectionSwitcher.js +10 -10
- package/dist/features/SwapDirectionSwitcher.js.map +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 +21 -19
- package/dist/index.js.map +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/styles.css +1 -1
- package/dist/theme/ThemeProvider.js +1 -1
- package/dist/types/config.d.ts +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 +10 -0
- package/dist/widgets/Widget/WidgetContent.js +56 -0
- package/dist/widgets/Widget/WidgetContent.js.map +1 -0
- package/dist/widgets/Widget/index.d.ts +4 -0
- package/dist/widgets/Widget/index.js +23 -0
- package/dist/widgets/Widget/index.js.map +1 -0
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.d.ts +1 -2
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositContent.js.map +1 -1
- package/dist/widgets/WidgetDeposit/WidgetDepositSkeleton.js +1 -1
- package/dist/widgets/WidgetDeposit/index.js +14 -15
- package/dist/widgets/WidgetDeposit/index.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapContent.d.ts +3 -6
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js +43 -44
- package/dist/widgets/WidgetSwap/WidgetSwapContent.js.map +1 -1
- package/dist/widgets/WidgetSwap/WidgetSwapSkeleton.js +1 -1
- package/dist/widgets/WidgetSwap/index.js +14 -15
- package/dist/widgets/WidgetSwap/index.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.d.ts +1 -2
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawContent.js.map +1 -1
- package/dist/widgets/WidgetWithdraw/WidgetWithdrawSkeleton.js +1 -1
- package/dist/widgets/WidgetWithdraw/index.js +12 -13
- package/dist/widgets/WidgetWithdraw/index.js.map +1 -1
- package/dist/widgets/index.d.ts +1 -0
- package/dist/widgets/index.js +8 -6
- package/dist/widgets/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/WidgetContainer.tsx +11 -1
- package/src/components/WidgetTabs.tsx +33 -0
- package/src/features/SwapDirectionSwitcher.tsx +4 -6
- package/src/types/config.ts +1 -0
- package/src/widgets/Widget/WidgetContent.tsx +99 -0
- package/src/widgets/Widget/index.tsx +23 -0
- package/src/widgets/WidgetDeposit/WidgetDepositContent.tsx +1 -1
- package/src/widgets/WidgetDeposit/index.tsx +7 -10
- package/src/widgets/WidgetSwap/WidgetSwapContent.tsx +3 -6
- package/src/widgets/WidgetSwap/index.tsx +7 -10
- package/src/widgets/WidgetWithdraw/WidgetWithdrawContent.tsx +1 -1
- package/src/widgets/WidgetWithdraw/index.tsx +7 -10
- package/src/widgets/index.ts +1 -0
- package/dist/components/BaseContainer.d.ts +0 -2
- package/dist/components/BaseContainer.js +0 -23
- package/dist/components/BaseContainer.js.map +0 -1
- package/src/components/BaseContainer.tsx +0 -19
|
@@ -1,24 +1,23 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
HeaderComponent: t,
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { WidgetContainer as m } from "../../components/WidgetContainer.js";
|
|
3
|
+
import { WidgetWithdrawContent as n } from "./WidgetWithdrawContent.js";
|
|
4
|
+
const f = ({
|
|
5
|
+
HeaderComponent: r,
|
|
7
6
|
FooterComponent: i,
|
|
8
7
|
isFullPage: o,
|
|
9
8
|
className: e,
|
|
10
|
-
...
|
|
11
|
-
}) => /* @__PURE__ */
|
|
12
|
-
|
|
9
|
+
...d
|
|
10
|
+
}) => /* @__PURE__ */ t(
|
|
11
|
+
m,
|
|
13
12
|
{
|
|
14
13
|
className: e,
|
|
15
14
|
isFullPage: o,
|
|
16
|
-
HeaderComponent:
|
|
15
|
+
HeaderComponent: r,
|
|
17
16
|
FooterComponent: i,
|
|
18
|
-
children: /* @__PURE__ */
|
|
17
|
+
children: /* @__PURE__ */ t(n, { ...d })
|
|
19
18
|
}
|
|
20
|
-
)
|
|
19
|
+
);
|
|
21
20
|
export {
|
|
22
|
-
|
|
21
|
+
f as WidgetWithdraw
|
|
23
22
|
};
|
|
24
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/widgets/WidgetWithdraw/index.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/widgets/WidgetWithdraw/index.tsx"],"sourcesContent":["import {\n WidgetContainer,\n WidgetContainerProps,\n} from '../../components/WidgetContainer';\nimport { Props, WidgetWithdrawContent } from './WidgetWithdrawContent';\n\nexport type WidgetWithdrawProps = Props &\n Omit<WidgetContainerProps, 'children'>;\n\nexport const WidgetWithdraw = ({\n HeaderComponent,\n FooterComponent,\n isFullPage,\n className,\n ...widgetProps\n}: WidgetWithdrawProps) => (\n <WidgetContainer\n className={className}\n isFullPage={isFullPage}\n HeaderComponent={HeaderComponent}\n FooterComponent={FooterComponent}>\n <WidgetWithdrawContent {...widgetProps} />\n </WidgetContainer>\n);\n"],"names":["WidgetWithdraw","HeaderComponent","FooterComponent","isFullPage","className","widgetProps","jsx","WidgetContainer","WidgetWithdrawContent"],"mappings":";;;AASO,MAAMA,IAAiB,CAAC;AAAA,EAC7B,iBAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,GAAGC;AACL,MACE,gBAAAC;AAAA,EAACC;AAAA,EAAA;AAAA,IACC,WAAAH;AAAA,IACA,YAAAD;AAAA,IACA,iBAAAF;AAAA,IACA,iBAAAC;AAAA,IACA,UAAA,gBAAAI,EAACE,GAAA,EAAuB,GAAGH,EAAA,CAAa;AAAA,EAAA;AAC1C;"}
|
package/dist/widgets/index.d.ts
CHANGED
package/dist/widgets/index.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { Widget as o } from "./Widget/index.js";
|
|
2
|
+
import { WidgetSwap as i } from "./WidgetSwap/index.js";
|
|
3
|
+
import { WidgetDeposit as d } from "./WidgetDeposit/index.js";
|
|
4
|
+
import { WidgetWithdraw as f } from "./WidgetWithdraw/index.js";
|
|
4
5
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
o as Widget,
|
|
7
|
+
d as WidgetDeposit,
|
|
8
|
+
i as WidgetSwap,
|
|
9
|
+
f as WidgetWithdraw
|
|
8
10
|
};
|
|
9
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/package.json
CHANGED
|
@@ -45,7 +45,17 @@ export const WidgetContainer = ({
|
|
|
45
45
|
);
|
|
46
46
|
|
|
47
47
|
if (!isFullPage) {
|
|
48
|
-
return
|
|
48
|
+
return (
|
|
49
|
+
<div
|
|
50
|
+
className={cn(
|
|
51
|
+
'relative w-auto mx-auto',
|
|
52
|
+
theme?.showContainer
|
|
53
|
+
? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'
|
|
54
|
+
: 'max-w-[456px] sm:w-[456px]',
|
|
55
|
+
)}>
|
|
56
|
+
{jsx}
|
|
57
|
+
</div>
|
|
58
|
+
);
|
|
49
59
|
}
|
|
50
60
|
|
|
51
61
|
return (
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { cn } from '../utils';
|
|
2
|
+
|
|
3
|
+
const TABS = ['swap', 'deposit', 'withdraw'] as const;
|
|
4
|
+
|
|
5
|
+
export type WidgetTab = (typeof TABS)[number];
|
|
6
|
+
|
|
7
|
+
type Props = {
|
|
8
|
+
activeTab: WidgetTab;
|
|
9
|
+
onSelect: (tab: WidgetTab) => void;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const WidgetTabs = ({ activeTab, onSelect }: Props) => {
|
|
13
|
+
return (
|
|
14
|
+
<nav className="space-x-[10px] mb-sw-2xl w-full">
|
|
15
|
+
{TABS.map((tab) => {
|
|
16
|
+
const isActive = activeTab === tab;
|
|
17
|
+
|
|
18
|
+
return (
|
|
19
|
+
<button
|
|
20
|
+
onClick={() => onSelect(tab)}
|
|
21
|
+
className={cn(
|
|
22
|
+
'rounded-sw-md text-sw-label-md cursor-pointer py-[10px] px-sw-lg',
|
|
23
|
+
isActive
|
|
24
|
+
? 'bg-sw-gray-50 text-sw-gray-950'
|
|
25
|
+
: 'bg-transparent text-sw-gray-200',
|
|
26
|
+
)}>
|
|
27
|
+
{tab.charAt(0).toUpperCase() + tab.slice(1)}
|
|
28
|
+
</button>
|
|
29
|
+
);
|
|
30
|
+
})}
|
|
31
|
+
</nav>
|
|
32
|
+
);
|
|
33
|
+
};
|
|
@@ -1,18 +1,16 @@
|
|
|
1
|
+
import { useConfig } from '../config';
|
|
1
2
|
import { DirectionSwitcher } from '@/components/DirectionSwitcher';
|
|
2
3
|
import { useUnsafeSnapshot } from '@/machine/snap';
|
|
3
4
|
import { fireEvent } from '@/machine';
|
|
4
5
|
|
|
5
|
-
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export const SwapDirectionSwitcher = ({ disabled }: Props) => {
|
|
6
|
+
export const SwapDirectionSwitcher = () => {
|
|
10
7
|
const { ctx } = useUnsafeSnapshot();
|
|
8
|
+
const { lockSwapDirection } = useConfig();
|
|
11
9
|
|
|
12
10
|
return (
|
|
13
11
|
<DirectionSwitcher
|
|
14
12
|
isLoading={ctx.quoteStatus === 'pending'}
|
|
15
|
-
isEnabled={!
|
|
13
|
+
isEnabled={!lockSwapDirection && !!(ctx.sourceToken && ctx.targetToken)}
|
|
16
14
|
onClick={() => fireEvent('tokenSelectRotate', null)}
|
|
17
15
|
/>
|
|
18
16
|
);
|
package/src/types/config.ts
CHANGED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { WidgetTab, WidgetTabs } from '../../components/WidgetTabs';
|
|
5
|
+
import {
|
|
6
|
+
Msg as SwapMsg,
|
|
7
|
+
WidgetSwapContent,
|
|
8
|
+
Props as WidgetSwapProps,
|
|
9
|
+
} from '../WidgetSwap/WidgetSwapContent';
|
|
10
|
+
import {
|
|
11
|
+
Msg as DepositMsg,
|
|
12
|
+
WidgetDepositContent,
|
|
13
|
+
Props as WidgetDepositProps,
|
|
14
|
+
} from '../WidgetDeposit/WidgetDepositContent';
|
|
15
|
+
import {
|
|
16
|
+
WidgetWithdrawContent,
|
|
17
|
+
Props as WidgetWithdrawProps,
|
|
18
|
+
Msg as WithdrawMsg,
|
|
19
|
+
} from '../WidgetWithdraw/WidgetWithdrawContent';
|
|
20
|
+
|
|
21
|
+
type WidgetType = 'swap' | 'deposit' | 'withdraw';
|
|
22
|
+
|
|
23
|
+
export type Props = Omit<
|
|
24
|
+
WidgetSwapProps | WidgetDepositProps | WidgetWithdrawProps,
|
|
25
|
+
'onMsg'
|
|
26
|
+
> & {
|
|
27
|
+
onMsg?: (msg: Msg, widget: WidgetType) => void;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
type Msg = SwapMsg | DepositMsg | WithdrawMsg;
|
|
31
|
+
|
|
32
|
+
export const WidgetContent = ({ onMsg, ...restProps }: Props) => {
|
|
33
|
+
const [isTabsVisible, setIsTabsVisible] = useState(true);
|
|
34
|
+
const [activeTab, setActiveTab] = useState<WidgetTab>('swap');
|
|
35
|
+
|
|
36
|
+
const switchTab = (tab: WidgetTab) => {
|
|
37
|
+
setActiveTab(tab);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const handleMsg = <T extends Msg>(msg: T, widgetType: WidgetType) => {
|
|
41
|
+
if (msg.type === 'on_tokens_modal_toggled') {
|
|
42
|
+
setIsTabsVisible(!msg.isOpen);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (msg.type === 'on_select_token') {
|
|
46
|
+
setIsTabsVisible(true);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
onMsg?.(msg, widgetType);
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
return (
|
|
53
|
+
<>
|
|
54
|
+
{isTabsVisible && (
|
|
55
|
+
<WidgetTabs activeTab={activeTab} onSelect={switchTab} />
|
|
56
|
+
)}
|
|
57
|
+
|
|
58
|
+
{(() => {
|
|
59
|
+
switch (activeTab) {
|
|
60
|
+
case 'swap': {
|
|
61
|
+
return (
|
|
62
|
+
<WidgetSwapContent
|
|
63
|
+
{...restProps}
|
|
64
|
+
onMsg={(msg) => {
|
|
65
|
+
handleMsg(msg, 'swap');
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
case 'deposit': {
|
|
72
|
+
return (
|
|
73
|
+
<WidgetDepositContent
|
|
74
|
+
{...restProps}
|
|
75
|
+
onMsg={(msg) => {
|
|
76
|
+
handleMsg(msg, 'deposit');
|
|
77
|
+
}}
|
|
78
|
+
/>
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
case 'withdraw': {
|
|
83
|
+
return (
|
|
84
|
+
<WidgetWithdrawContent
|
|
85
|
+
{...restProps}
|
|
86
|
+
onMsg={(msg) => {
|
|
87
|
+
handleMsg(msg, 'withdraw');
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
default:
|
|
94
|
+
return null;
|
|
95
|
+
}
|
|
96
|
+
})()}
|
|
97
|
+
</>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import {
|
|
2
|
+
WidgetContainer,
|
|
3
|
+
WidgetContainerProps,
|
|
4
|
+
} from '../../components/WidgetContainer';
|
|
5
|
+
import { Props, WidgetContent } from './WidgetContent';
|
|
6
|
+
|
|
7
|
+
export type WidgetProps = Props & Omit<WidgetContainerProps, 'children'>;
|
|
8
|
+
|
|
9
|
+
export const Widget = ({
|
|
10
|
+
HeaderComponent,
|
|
11
|
+
FooterComponent,
|
|
12
|
+
isFullPage,
|
|
13
|
+
className,
|
|
14
|
+
...widgetProps
|
|
15
|
+
}: WidgetProps) => (
|
|
16
|
+
<WidgetContainer
|
|
17
|
+
className={className}
|
|
18
|
+
isFullPage={isFullPage}
|
|
19
|
+
HeaderComponent={HeaderComponent}
|
|
20
|
+
FooterComponent={FooterComponent}>
|
|
21
|
+
<WidgetContent {...widgetProps} />
|
|
22
|
+
</WidgetContainer>
|
|
23
|
+
);
|
|
@@ -32,7 +32,7 @@ import { isDebug, notReachable } from '@/utils';
|
|
|
32
32
|
|
|
33
33
|
import type { Token, TransferResult } from '@/types';
|
|
34
34
|
|
|
35
|
-
type Msg =
|
|
35
|
+
export type Msg =
|
|
36
36
|
| { type: 'on_select_token'; token: Token; variant: TokenInputType }
|
|
37
37
|
| { type: 'on_change_deposit_type'; isExternal: boolean }
|
|
38
38
|
| { type: 'on_transfer_success' }
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BaseContainer } from '../../components/BaseContainer';
|
|
2
1
|
import {
|
|
3
2
|
WidgetContainer,
|
|
4
3
|
WidgetContainerProps,
|
|
@@ -14,13 +13,11 @@ export const WidgetDeposit = ({
|
|
|
14
13
|
className,
|
|
15
14
|
...widgetProps
|
|
16
15
|
}: WidgetDepositProps) => (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</WidgetContainer>
|
|
25
|
-
</BaseContainer>
|
|
16
|
+
<WidgetContainer
|
|
17
|
+
className={className}
|
|
18
|
+
isFullPage={isFullPage}
|
|
19
|
+
HeaderComponent={HeaderComponent}
|
|
20
|
+
FooterComponent={FooterComponent}>
|
|
21
|
+
<WidgetDepositContent {...widgetProps} />
|
|
22
|
+
</WidgetContainer>
|
|
26
23
|
);
|
|
@@ -32,21 +32,18 @@ import { isDebug, notReachable } from '@/utils';
|
|
|
32
32
|
|
|
33
33
|
import type { Token, TransferResult } from '@/types';
|
|
34
34
|
|
|
35
|
-
type Msg =
|
|
35
|
+
export type Msg =
|
|
36
36
|
| { type: 'on_tokens_modal_toggled'; isOpen: boolean }
|
|
37
37
|
| { type: 'on_select_token'; token: Token; variant: TokenInputType }
|
|
38
38
|
| { type: 'on_transfer_success' };
|
|
39
39
|
|
|
40
|
-
export type Props = CommonWidgetProps<Msg
|
|
41
|
-
isOneWay?: boolean;
|
|
42
|
-
};
|
|
40
|
+
export type Props = CommonWidgetProps<Msg>;
|
|
43
41
|
|
|
44
42
|
export const WidgetSwapContent = ({
|
|
45
43
|
providers,
|
|
46
44
|
makeTransfer,
|
|
47
45
|
onMsg,
|
|
48
46
|
isLoading,
|
|
49
|
-
isOneWay,
|
|
50
47
|
}: Props) => {
|
|
51
48
|
const { ctx } = useUnsafeSnapshot();
|
|
52
49
|
const { isDirectNearTokenWithdrawal } = useComputedSnapshot();
|
|
@@ -217,7 +214,7 @@ export const WidgetSwapContent = ({
|
|
|
217
214
|
}}
|
|
218
215
|
/>
|
|
219
216
|
|
|
220
|
-
<SwapDirectionSwitcher
|
|
217
|
+
<SwapDirectionSwitcher />
|
|
221
218
|
|
|
222
219
|
<TokenInput.Target
|
|
223
220
|
heading={t('tokenInput.heading.target.swap', 'Buy')}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BaseContainer } from '../../components/BaseContainer';
|
|
2
1
|
import {
|
|
3
2
|
WidgetContainer,
|
|
4
3
|
WidgetContainerProps,
|
|
@@ -14,13 +13,11 @@ export const WidgetSwap = ({
|
|
|
14
13
|
className,
|
|
15
14
|
...widgetProps
|
|
16
15
|
}: WidgetSwapProps) => (
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
</WidgetContainer>
|
|
25
|
-
</BaseContainer>
|
|
16
|
+
<WidgetContainer
|
|
17
|
+
className={className}
|
|
18
|
+
isFullPage={isFullPage}
|
|
19
|
+
HeaderComponent={HeaderComponent}
|
|
20
|
+
FooterComponent={FooterComponent}>
|
|
21
|
+
<WidgetSwapContent {...widgetProps} />
|
|
22
|
+
</WidgetContainer>
|
|
26
23
|
);
|
|
@@ -31,7 +31,7 @@ import { isDebug, notReachable } from '@/utils';
|
|
|
31
31
|
|
|
32
32
|
import type { Token, TransferResult } from '@/types';
|
|
33
33
|
|
|
34
|
-
type Msg =
|
|
34
|
+
export type Msg =
|
|
35
35
|
| { type: 'on_select_token'; token: Token; variant: TokenInputType }
|
|
36
36
|
| { type: 'on_transfer_success' }
|
|
37
37
|
| { type: 'on_tokens_modal_toggled'; isOpen: boolean };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { BaseContainer } from '../../components/BaseContainer';
|
|
2
1
|
import {
|
|
3
2
|
WidgetContainer,
|
|
4
3
|
WidgetContainerProps,
|
|
@@ -15,13 +14,11 @@ export const WidgetWithdraw = ({
|
|
|
15
14
|
className,
|
|
16
15
|
...widgetProps
|
|
17
16
|
}: WidgetWithdrawProps) => (
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
</WidgetContainer>
|
|
26
|
-
</BaseContainer>
|
|
17
|
+
<WidgetContainer
|
|
18
|
+
className={className}
|
|
19
|
+
isFullPage={isFullPage}
|
|
20
|
+
HeaderComponent={HeaderComponent}
|
|
21
|
+
FooterComponent={FooterComponent}>
|
|
22
|
+
<WidgetWithdrawContent {...widgetProps} />
|
|
23
|
+
</WidgetContainer>
|
|
27
24
|
);
|
package/src/widgets/index.ts
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
-
import { useTheme as t } from "../hooks/useTheme.js";
|
|
3
|
-
import "../constants/chains.js";
|
|
4
|
-
import "viem";
|
|
5
|
-
import "ethers";
|
|
6
|
-
import { cn as e } from "../utils/cn.js";
|
|
7
|
-
const w = ({ children: o }) => {
|
|
8
|
-
const m = t();
|
|
9
|
-
return /* @__PURE__ */ r(
|
|
10
|
-
"div",
|
|
11
|
-
{
|
|
12
|
-
className: e(
|
|
13
|
-
"relative w-auto mx-auto",
|
|
14
|
-
m?.showContainer ? "max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg" : "max-w-[456px] sm:w-[456px]"
|
|
15
|
-
),
|
|
16
|
-
children: o
|
|
17
|
-
}
|
|
18
|
-
);
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
w as BaseContainer
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=BaseContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BaseContainer.js","sources":["../../src/components/BaseContainer.tsx"],"sourcesContent":["import { PropsWithChildren } from 'react';\nimport { useTheme } from '../hooks/useTheme';\nimport { cn } from '../utils';\n\nexport const BaseContainer = ({ children }: PropsWithChildren) => {\n const theme = useTheme();\n\n return (\n <div\n className={cn(\n 'relative w-auto mx-auto',\n theme?.showContainer\n ? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'\n : 'max-w-[456px] sm:w-[456px]',\n )}>\n {children}\n </div>\n );\n};\n"],"names":["BaseContainer","children","theme","useTheme","jsx","cn"],"mappings":";;;;;;AAIO,MAAMA,IAAgB,CAAC,EAAE,UAAAC,QAAkC;AAChE,QAAMC,IAAQC,EAAA;AAEd,SACE,gBAAAC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAH,GAAO,gBACH,uEACA;AAAA,MAAA;AAAA,MAEL,UAAAD;AAAA,IAAA;AAAA,EAAA;AAGP;"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { PropsWithChildren } from 'react';
|
|
2
|
-
import { useTheme } from '../hooks/useTheme';
|
|
3
|
-
import { cn } from '../utils';
|
|
4
|
-
|
|
5
|
-
export const BaseContainer = ({ children }: PropsWithChildren) => {
|
|
6
|
-
const theme = useTheme();
|
|
7
|
-
|
|
8
|
-
return (
|
|
9
|
-
<div
|
|
10
|
-
className={cn(
|
|
11
|
-
'relative w-auto mx-auto',
|
|
12
|
-
theme?.showContainer
|
|
13
|
-
? 'max-w-[496px] sm:w-[496px] p-csw-2xl bg-sw-container rounded-sw-lg'
|
|
14
|
-
: 'max-w-[456px] sm:w-[456px]',
|
|
15
|
-
)}>
|
|
16
|
-
{children}
|
|
17
|
-
</div>
|
|
18
|
-
);
|
|
19
|
-
};
|