tek-wallet 0.0.636 → 0.0.637
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/TekWallet/components/ui/Fees/index.js +1 -1
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferAmount.d.ts +0 -8
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferAmount.js +57 -36
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferInfo.d.ts +0 -11
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferInfo.js +151 -80
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferTarget.d.ts +0 -6
- package/dist/components/TekWallet/components/ui/TransferInternal/components/transferTarget.js +64 -38
- package/dist/components/TekWallet/components/ui/TransferInternal/index.d.ts +2 -4
- package/dist/components/TekWallet/components/ui/TransferInternal/index.js +6 -42
- package/dist/components/TekWallet/components/ui/UserInfo/index.js +3 -4
- package/package.json +1 -1
|
@@ -75,7 +75,7 @@ function Fees(props) {
|
|
|
75
75
|
if (!isNotEnoughBalanceToPayFee) {
|
|
76
76
|
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(!isNotEnoughBalanceToPayFee);
|
|
77
77
|
}
|
|
78
|
-
}, [isNotEnoughBalanceToPayFee]);
|
|
78
|
+
}, [isNotEnoughBalanceToPayFee, setIsEnoughBalanceToPayFee]);
|
|
79
79
|
var totalfee_in_usd = (0, react_1.useMemo)(function () {
|
|
80
80
|
return feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd;
|
|
81
81
|
}, [feesData]);
|
package/dist/components/TekWallet/components/ui/TransferInternal/components/transferAmount.js
CHANGED
|
@@ -1,37 +1,58 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
2
|
+
// import { Stack } from "@mui/material";
|
|
3
|
+
// import { Box } from "@mui/material";
|
|
4
|
+
// import Icon from "../../Icon";
|
|
5
|
+
// import { useTheme } from "../../../../providers/ThemeProvider";
|
|
6
|
+
// import Formatter from "../../Formatter";
|
|
7
|
+
// import Text from "../../Text";
|
|
8
|
+
// interface TransferAmountProps {
|
|
9
|
+
// title?: string;
|
|
10
|
+
// amount?: number;
|
|
11
|
+
// link?: string;
|
|
12
|
+
// currency?: string;
|
|
13
|
+
// }
|
|
14
|
+
// export default function TransferAmount(props: TransferAmountProps) {
|
|
15
|
+
// const theme = useTheme();
|
|
16
|
+
// const { title, amount, currency } = props;
|
|
17
|
+
// return (
|
|
18
|
+
// <Box
|
|
19
|
+
// sx={{
|
|
20
|
+
// ...theme.mixins.column,
|
|
21
|
+
// alignItems: "center",
|
|
22
|
+
// marginTop: theme.mixins.customMargin.m16,
|
|
23
|
+
// marginBottom: theme.mixins.customMargin.m12,
|
|
24
|
+
// gap: theme.mixins.gaps.g4,
|
|
25
|
+
// }}
|
|
26
|
+
// >
|
|
27
|
+
// <Text
|
|
28
|
+
// sx={{
|
|
29
|
+
// ...theme.mixins.sessionDescription,
|
|
30
|
+
// textTransform: "capitalize",
|
|
31
|
+
// }}
|
|
32
|
+
// >
|
|
33
|
+
// {title}
|
|
34
|
+
// </Text>
|
|
35
|
+
// <Formatter
|
|
36
|
+
// value={amount}
|
|
37
|
+
// sx={{
|
|
38
|
+
// color: theme.palette.text.primary,
|
|
39
|
+
// fontSize: theme.typography.fontSize24,
|
|
40
|
+
// fontWeight: theme.typography.fontWeight600,
|
|
41
|
+
// }}
|
|
42
|
+
// />
|
|
43
|
+
// <Stack direction={"row"} alignItems={"center"} gap={0.5}>
|
|
44
|
+
// <Icon src={props.link} width={16} height={16} />
|
|
45
|
+
// <Text
|
|
46
|
+
// sx={{
|
|
47
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
48
|
+
// fontSize: theme.typography.fontSize15,
|
|
49
|
+
// color: theme.palette.text.accent2,
|
|
50
|
+
// }}
|
|
51
|
+
// >
|
|
52
|
+
// {currency}
|
|
53
|
+
// </Text>
|
|
54
|
+
// </Stack>
|
|
55
|
+
// </Box>
|
|
56
|
+
// );
|
|
57
|
+
// }
|
|
58
|
+
// export type { TransferAmountProps };
|
package/dist/components/TekWallet/components/ui/TransferInternal/components/transferInfo.d.ts
CHANGED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { TransferInternalData } from "..";
|
|
2
|
-
import { FeesDataType } from "../../../../services/axios/get-est-fee-service/type";
|
|
3
|
-
interface TransferInfoProps {
|
|
4
|
-
transferData: TransferInternalData;
|
|
5
|
-
estimateFee?: FeesDataType;
|
|
6
|
-
amount?: number;
|
|
7
|
-
tokenSlug?: string;
|
|
8
|
-
setIsEnoughBalanceToPayFee: (isEnough: boolean) => void;
|
|
9
|
-
}
|
|
10
|
-
export default function TransferInfo(props: TransferInfoProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
-
export type { TransferInfoProps };
|
|
@@ -1,81 +1,152 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
2
|
+
// import IconText from "../../../ui/IconText";
|
|
3
|
+
// import LineValue from "../../LineValue";
|
|
4
|
+
// import { Box } from "@mui/material";
|
|
5
|
+
// import { TransferInternalData } from "..";
|
|
6
|
+
// import { FeesDataType } from "../../../../services/axios/get-est-fee-service/type";
|
|
7
|
+
// import Text from "../../Text";
|
|
8
|
+
// import { safeDateTimeText, safeText } from "../../../../utils/safeText";
|
|
9
|
+
// import Icon from "../../Icon";
|
|
10
|
+
// import CopyTextComponent from "../../CopyTextComponent";
|
|
11
|
+
// import getIcon from "../../../../utils/getIcon";
|
|
12
|
+
// import { useTheme } from "../../../../providers";
|
|
13
|
+
// interface TransferInfoProps {
|
|
14
|
+
// transferData: TransferInternalData;
|
|
15
|
+
// estimateFee?: FeesDataType;
|
|
16
|
+
// amount?: number;
|
|
17
|
+
// tokenSlug?: string;
|
|
18
|
+
// }
|
|
19
|
+
// export default function TransferInfo(props: TransferInfoProps) {
|
|
20
|
+
// const { transferData, } = props;
|
|
21
|
+
// const theme = useTheme();
|
|
22
|
+
// return (
|
|
23
|
+
// <Box sx={{ ...theme.mixins.column, gap: theme.mixins.gaps?.g12 }}>
|
|
24
|
+
// <Text
|
|
25
|
+
// sx={{
|
|
26
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
27
|
+
// color: theme.palette.primary.contrastText,
|
|
28
|
+
// fontSize: theme.typography.fontSize18,
|
|
29
|
+
// marginTop: theme.mixins.customMargin?.m12,
|
|
30
|
+
// }}
|
|
31
|
+
// >
|
|
32
|
+
// {"transferSummary"}
|
|
33
|
+
// </Text>
|
|
34
|
+
// <Box sx={{ ...theme.mixins.column, gap: theme.mixins.gaps?.g12 }}>
|
|
35
|
+
// <LineValue
|
|
36
|
+
// field={"transferTo"}
|
|
37
|
+
// sxField={{
|
|
38
|
+
// fontSize: theme.typography.fontSize11,
|
|
39
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
40
|
+
// color: theme.palette.text.darkContrast,
|
|
41
|
+
// }}
|
|
42
|
+
// value={
|
|
43
|
+
// <IconText
|
|
44
|
+
// title={safeText(transferData.receiver?.nick_name)}
|
|
45
|
+
// sx={{
|
|
46
|
+
// fontSize: theme.typography.fontSize14,
|
|
47
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
48
|
+
// }}
|
|
49
|
+
// beforeIcon={<Icon src={transferData.receiver?.avatar} width={16} height={16} />}
|
|
50
|
+
// />
|
|
51
|
+
// }
|
|
52
|
+
// />
|
|
53
|
+
// <LineValue
|
|
54
|
+
// field={"network"}
|
|
55
|
+
// sxField={{
|
|
56
|
+
// fontSize: theme.typography.fontSize11,
|
|
57
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
58
|
+
// color: theme.palette.text.darkContrast,
|
|
59
|
+
// }}
|
|
60
|
+
// value={
|
|
61
|
+
// <IconText
|
|
62
|
+
// title={safeText(transferData.network)}
|
|
63
|
+
// sx={{
|
|
64
|
+
// fontSize: theme.typography.fontSize14,
|
|
65
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
66
|
+
// }}
|
|
67
|
+
// beforeIcon={<Icon src={transferData.link} width={16} height={16} isRounded={true} />}
|
|
68
|
+
// />
|
|
69
|
+
// }
|
|
70
|
+
// />
|
|
71
|
+
// <LineValue
|
|
72
|
+
// field={"address"}
|
|
73
|
+
// sxField={{
|
|
74
|
+
// fontSize: theme.typography.fontSize11,
|
|
75
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
76
|
+
// color: theme.palette.text.darkContrast,
|
|
77
|
+
// }}
|
|
78
|
+
// value={
|
|
79
|
+
// <CopyTextComponent value={transferData.to_address}>
|
|
80
|
+
// <Box sx={{ ...theme.mixins.row, gap: theme.mixins.gaps?.g8 }}>
|
|
81
|
+
// <Text
|
|
82
|
+
// sx={{
|
|
83
|
+
// fontSize: theme.typography.fontSize14,
|
|
84
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
85
|
+
// }}
|
|
86
|
+
// >
|
|
87
|
+
// {safeText(transferData.to_address, { isShort: true })}
|
|
88
|
+
// </Text>
|
|
89
|
+
// <Icon src={getIcon("ic_copy")} />
|
|
90
|
+
// </Box>
|
|
91
|
+
// </CopyTextComponent>
|
|
92
|
+
// }
|
|
93
|
+
// />
|
|
94
|
+
// <LineValue
|
|
95
|
+
// field={"type"}
|
|
96
|
+
// sxField={{
|
|
97
|
+
// fontSize: theme.typography.fontSize11,
|
|
98
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
99
|
+
// color: theme.palette.text.darkContrast,
|
|
100
|
+
// }}
|
|
101
|
+
// value={
|
|
102
|
+
// <Text
|
|
103
|
+
// sx={{
|
|
104
|
+
// fontSize: theme.typography.fontSize14,
|
|
105
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
106
|
+
// }}
|
|
107
|
+
// >
|
|
108
|
+
// {safeText(transferData.type)}
|
|
109
|
+
// </Text>
|
|
110
|
+
// }
|
|
111
|
+
// />
|
|
112
|
+
// <LineValue
|
|
113
|
+
// field={"message"}
|
|
114
|
+
// sxField={{
|
|
115
|
+
// fontSize: theme.typography.fontSize11,
|
|
116
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
117
|
+
// color: theme.palette.text.darkContrast,
|
|
118
|
+
// }}
|
|
119
|
+
// value={
|
|
120
|
+
// <Text
|
|
121
|
+
// sx={{
|
|
122
|
+
// fontSize: theme.typography.fontSize14,
|
|
123
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
124
|
+
// }}
|
|
125
|
+
// >
|
|
126
|
+
// {safeText(transferData.message)}
|
|
127
|
+
// </Text>
|
|
128
|
+
// }
|
|
129
|
+
// />
|
|
130
|
+
// <LineValue
|
|
131
|
+
// field={"datetime"}
|
|
132
|
+
// sxField={{
|
|
133
|
+
// fontSize: theme.typography.fontSize11,
|
|
134
|
+
// fontWeight: theme.typography.fontWeight500,
|
|
135
|
+
// color: theme.palette.text.darkContrast,
|
|
136
|
+
// }}
|
|
137
|
+
// value={
|
|
138
|
+
// <Text
|
|
139
|
+
// sx={{
|
|
140
|
+
// fontSize: theme.typography.fontSize14,
|
|
141
|
+
// fontWeight: theme.typography.fontWeight700,
|
|
142
|
+
// }}
|
|
143
|
+
// >
|
|
144
|
+
// {safeDateTimeText(transferData.datetime)}
|
|
145
|
+
// </Text>
|
|
146
|
+
// }
|
|
147
|
+
// />
|
|
148
|
+
// </Box>
|
|
149
|
+
// </Box>
|
|
150
|
+
// );
|
|
151
|
+
// }
|
|
152
|
+
// export type { TransferInfoProps };
|
package/dist/components/TekWallet/components/ui/TransferInternal/components/transferTarget.js
CHANGED
|
@@ -1,39 +1,65 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
2
|
+
// import { Box } from "@mui/material";
|
|
3
|
+
// import { TransferInternalData } from "..";
|
|
4
|
+
// import getImage from "../../../../utils/getImage";
|
|
5
|
+
// import UserInfo from "../../UserInfo";
|
|
6
|
+
// import Text from "../../Text";
|
|
7
|
+
// import Icon from "../../Icon";
|
|
8
|
+
// import getIcon from "../../../../utils/getIcon";
|
|
9
|
+
// import { useTheme } from "../../../../providers";
|
|
10
|
+
// interface TransferTargetProps {
|
|
11
|
+
// transferData: TransferInternalData;
|
|
12
|
+
// }
|
|
13
|
+
// export default function TransferTarget(props: TransferTargetProps) {
|
|
14
|
+
// const { transferData } = props;
|
|
15
|
+
// const theme = useTheme();
|
|
16
|
+
// return (
|
|
17
|
+
// <Box
|
|
18
|
+
// sx={{
|
|
19
|
+
// ...theme.mixins.column,
|
|
20
|
+
// gap: theme.mixins.gaps?.g12,
|
|
21
|
+
// padding: theme.mixins.customPadding?.p12,
|
|
22
|
+
// borderRadius: theme.mixins.customRadius?.r16,
|
|
23
|
+
// backgroundColor: theme.palette.background?.primary,
|
|
24
|
+
// backgroundImage: `url(${getImage("logo_transfer", "png")})`,
|
|
25
|
+
// backgroundPosition: "right",
|
|
26
|
+
// backgroundRepeat: "no-repeat",
|
|
27
|
+
// }}
|
|
28
|
+
// >
|
|
29
|
+
// <UserInfo
|
|
30
|
+
// user={transferData.user}
|
|
31
|
+
// variant="multiple"
|
|
32
|
+
// rightPart={
|
|
33
|
+
// <Text
|
|
34
|
+
// sx={{
|
|
35
|
+
// color: theme.palette.text?.secondary,
|
|
36
|
+
// fontWeight: theme.typography?.fontWeight500,
|
|
37
|
+
// fontSize: theme.typography?.fontSize13,
|
|
38
|
+
// }}
|
|
39
|
+
// >
|
|
40
|
+
// From
|
|
41
|
+
// </Text>
|
|
42
|
+
// }
|
|
43
|
+
// />
|
|
44
|
+
// <div className="flex gap-1.5 items-center">
|
|
45
|
+
// <Icon src={getIcon("ic_transfer")} />
|
|
46
|
+
// <div className="w-full h-px border-t-[1px] border-t-accent opacity-25 border-dashed" />
|
|
47
|
+
// </div>
|
|
48
|
+
// <UserInfo
|
|
49
|
+
// user={transferData.receiver}
|
|
50
|
+
// variant="multiple"
|
|
51
|
+
// rightPart={
|
|
52
|
+
// <Text
|
|
53
|
+
// sx={{
|
|
54
|
+
// color: theme.palette.text?.secondary,
|
|
55
|
+
// fontWeight: theme.typography?.fontWeight500,
|
|
56
|
+
// fontSize: theme.typography?.fontSize13,
|
|
57
|
+
// }}
|
|
58
|
+
// >
|
|
59
|
+
// To
|
|
60
|
+
// </Text>
|
|
61
|
+
// }
|
|
62
|
+
// />
|
|
63
|
+
// </Box>
|
|
64
|
+
// );
|
|
65
|
+
// }
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { ConfirmLayoutProps } from "../../ui/ConfirmLayout";
|
|
2
2
|
import { SendInternalBody, SendInternalResponse } from "../../../services/axios/send-internal-service/type";
|
|
3
|
-
|
|
4
|
-
import { FeesDataType } from "../../../services/axios/get-est-fee-service/type";
|
|
5
|
-
export type TransferInternalData = Omit<SendInternalBody, "passcode"> & TransferInfoDto;
|
|
3
|
+
export type TransferInternalData = Omit<SendInternalBody, "passcode">;
|
|
6
4
|
interface TransferTokenProps extends Omit<ConfirmLayoutProps, "action"> {
|
|
7
5
|
transferData: TransferInternalData;
|
|
8
|
-
|
|
6
|
+
transferContent: React.ReactNode;
|
|
9
7
|
onTransferSuccess?: (data: SendInternalResponse) => any;
|
|
10
8
|
}
|
|
11
9
|
export interface TransferTokenRef {
|
|
@@ -98,13 +98,9 @@ var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
|
98
98
|
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
99
99
|
var useWithdrawData_1 = __importDefault(require("../../../hooks/useWithdrawData"));
|
|
100
100
|
var send_internal_service_1 = __importDefault(require("../../../services/axios/send-internal-service"));
|
|
101
|
-
var transferTarget_1 = __importDefault(require("./components/transferTarget"));
|
|
102
|
-
var transferInfo_1 = __importDefault(require("./components/transferInfo"));
|
|
103
|
-
var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
|
|
104
101
|
var validate_wallet_address_service_1 = __importDefault(require("../../../services/axios/validate-wallet-address-service"));
|
|
105
102
|
var type_2 = require("../../../services/axios/validate-wallet-address-service/type");
|
|
106
103
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
107
|
-
var transferAmount_1 = __importDefault(require("./components/transferAmount"));
|
|
108
104
|
var TransferError;
|
|
109
105
|
(function (TransferError) {
|
|
110
106
|
TransferError["TOKEN_NOT_FOUND"] = "Token not found";
|
|
@@ -113,11 +109,10 @@ var TransferError;
|
|
|
113
109
|
TransferError["MIN_AMOUNT"] = "Min amount";
|
|
114
110
|
TransferError["FAILED"] = "Failed";
|
|
115
111
|
})(TransferError || (exports.TransferError = TransferError = {}));
|
|
116
|
-
var transactionSlug = type_1.TransactionSlug.TransferInternal;
|
|
117
112
|
exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
118
113
|
var _a, _b, _c;
|
|
119
114
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
120
|
-
var transferData = props.transferData;
|
|
115
|
+
var transferData = props.transferData, transferContent = props.transferContent;
|
|
121
116
|
var _d = (0, useWithdrawData_1.default)(), sendInternalTokens = _d.sendInternalTokens, updateSendInternalToken = _d.updateSendInternalToken;
|
|
122
117
|
var isInitPasscode = (0, useWalletData_1.default)().isInitPasscode;
|
|
123
118
|
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
@@ -126,33 +121,8 @@ exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
126
121
|
var _g = (0, react_1.useState)(Button_1.BUTTON_STATUS.ENABLED), buttonStatus = _g[0], setButtonStatus = _g[1];
|
|
127
122
|
var _h = (0, react_1.useState)(false), isValidatingAddress = _h[0], setIsValidatingAddress = _h[1];
|
|
128
123
|
var _j = (0, react_1.useState)(undefined), errorAddress = _j[0], setErrorAddress = _j[1];
|
|
129
|
-
var _k = (0, react_1.useState)(props.initFeeData), estimateFee = _k[0], setEstimateFee = _k[1];
|
|
130
|
-
var _l = (0, react_1.useState)(false), isLoadingEstimateFee = _l[0], setIsLoadingEstimateFee = _l[1];
|
|
131
|
-
var _m = (0, react_1.useState)(false), isEnoughBalanceToPayFee = _m[0], setIsEnoughBalanceToPayFee = _m[1];
|
|
132
|
-
var amount = transferData.amount;
|
|
133
124
|
var toAddress = transferData.to_address;
|
|
134
125
|
var tokenSlug = transferData.currency_slug;
|
|
135
|
-
var getEstimateFee = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
136
|
-
var response;
|
|
137
|
-
return __generator(this, function (_a) {
|
|
138
|
-
switch (_a.label) {
|
|
139
|
-
case 0:
|
|
140
|
-
if (!tokenSlug)
|
|
141
|
-
return [2 /*return*/];
|
|
142
|
-
setIsLoadingEstimateFee(true);
|
|
143
|
-
return [4 /*yield*/, (0, get_est_fee_service_1.default)({
|
|
144
|
-
amount: "".concat(amount),
|
|
145
|
-
transaction_type: transactionSlug,
|
|
146
|
-
currency: tokenSlug || "",
|
|
147
|
-
})];
|
|
148
|
-
case 1:
|
|
149
|
-
response = _a.sent();
|
|
150
|
-
setIsLoadingEstimateFee(false);
|
|
151
|
-
setEstimateFee(response === null || response === void 0 ? void 0 : response.data);
|
|
152
|
-
return [2 /*return*/, true];
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
}); }, [amount, tokenSlug]);
|
|
156
126
|
var token = (0, react_1.useMemo)(function () {
|
|
157
127
|
return sendInternalTokens === null || sendInternalTokens === void 0 ? void 0 : sendInternalTokens.find(function (token) { return token.slug === tokenSlug; });
|
|
158
128
|
}, [tokenSlug, sendInternalTokens]);
|
|
@@ -179,7 +149,7 @@ exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
179
149
|
setError(undefined);
|
|
180
150
|
setErrorAmount(undefined);
|
|
181
151
|
return true;
|
|
182
|
-
}, [
|
|
152
|
+
}, [token, transferData.amount]);
|
|
183
153
|
var validateAddress = (0, react_1.useCallback)(function () { return __awaiter(void 0, void 0, void 0, function () {
|
|
184
154
|
var message;
|
|
185
155
|
return __generator(this, function (_a) {
|
|
@@ -209,10 +179,9 @@ exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
209
179
|
if (!isAmountValid)
|
|
210
180
|
return [2 /*return*/, false];
|
|
211
181
|
validateAddress();
|
|
212
|
-
getEstimateFee();
|
|
213
182
|
return [2 /*return*/];
|
|
214
183
|
});
|
|
215
|
-
}); }, [validateAmount, validateAddress
|
|
184
|
+
}); }, [validateAmount, validateAddress]);
|
|
216
185
|
var handleSendInternalToken = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
217
186
|
var response, err_1;
|
|
218
187
|
var _a, _b;
|
|
@@ -267,18 +236,13 @@ exports.TransferInternal = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
267
236
|
updateSendInternalToken();
|
|
268
237
|
}
|
|
269
238
|
}, [sendInternalTokens, updateSendInternalToken, isInitPasscode]);
|
|
270
|
-
|
|
271
|
-
// if (!estimateFee || !amount) return undefined;
|
|
272
|
-
// return +amount - +estimateFee?.fee_in_currency;
|
|
273
|
-
// }, [estimateFee, amount]);
|
|
274
|
-
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.TransferInternal, trigger: props.children, onOpen: validateAll, children: [(0, jsx_runtime_1.jsx)(transferAmount_1.default, { title: "Transfer Amount", amount: amount, link: token === null || token === void 0 ? void 0 : token.link, currency: token === null || token === void 0 ? void 0 : token.name }), (0, jsx_runtime_1.jsx)(transferTarget_1.default, { transferData: transferData }), (0, jsx_runtime_1.jsx)(transferInfo_1.default, { transferData: transferData, estimateFee: estimateFee, amount: amount, tokenSlug: tokenSlug, setIsEnoughBalanceToPayFee: setIsEnoughBalanceToPayFee }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: (_a = theme.mixins.gaps) === null || _a === void 0 ? void 0 : _a.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "center", mt: (_b = theme.mixins.customMargin) === null || _b === void 0 ? void 0 : _b.m12, mb: (_c = theme.mixins.customMargin) === null || _c === void 0 ? void 0 : _c.m16, position: "absolute", bottom: 0, left: 0, right: 0 }), children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
|
|
239
|
+
return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { ref: confirmLayoutDrawerRef, action: type_1.TransactionSlug.TransferInternal, trigger: props.children, onOpen: validateAll, children: [transferContent, !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: (_a = theme.mixins.gaps) === null || _a === void 0 ? void 0 : _a.g6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] })), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "center", mt: (_b = theme.mixins.customMargin) === null || _b === void 0 ? void 0 : _b.m12, mb: (_c = theme.mixins.customMargin) === null || _c === void 0 ? void 0 : _c.m16, position: "absolute", bottom: 0, left: 0, right: 0 }), children: (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: type_1.TransactionSlug.TransferInternal, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { sx: {
|
|
275
240
|
width: "100%",
|
|
241
|
+
minHeight: "50px",
|
|
276
242
|
backgroundColor: theme.palette.background.primary,
|
|
277
243
|
color: theme.palette.text.secondary,
|
|
278
244
|
borderRadius: theme.mixins.customRadius.r12,
|
|
279
|
-
}, status: !!error ||
|
|
280
|
-
? Button_1.BUTTON_STATUS.DISABLED
|
|
281
|
-
: buttonStatus, fullWidth: true, children: "Confirm" }) }) })] }) }));
|
|
245
|
+
}, status: !!error || isValidatingAddress || errorAddress ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, fullWidth: true, children: "Confirm" }) }) })] }) }));
|
|
282
246
|
});
|
|
283
247
|
exports.TransferInternal.displayName = "TransferInternal";
|
|
284
248
|
exports.default = exports.TransferInternal;
|
|
@@ -6,7 +6,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.default = UserInfo;
|
|
7
7
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
8
|
var getImage_1 = __importDefault(require("../../../utils/getImage"));
|
|
9
|
-
var Icon_1 = __importDefault(require("../Icon"));
|
|
10
9
|
var Text_1 = __importDefault(require("../Text"));
|
|
11
10
|
var material_1 = require("@mui/material");
|
|
12
11
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
@@ -16,9 +15,9 @@ function UserInfo(_a) {
|
|
|
16
15
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
17
16
|
if (!user)
|
|
18
17
|
return "loading...";
|
|
19
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex gap-3 items-center", children: [(0, jsx_runtime_1.jsx)(
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex gap-3 items-center", children: [(0, jsx_runtime_1.jsx)(material_1.Avatar, { src: (_b = user.avatar) !== null && _b !== void 0 ? _b : (0, getImage_1.default)("default-ava", "png"), sx: {
|
|
19
|
+
width: 24,
|
|
20
|
+
height: 24,
|
|
22
21
|
} }), (0, jsx_runtime_1.jsxs)(material_1.Box, { className: "flex flex-col", children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
23
22
|
color: theme.palette.background.white,
|
|
24
23
|
fontWeight: theme.typography.fontWeight500,
|