tek-wallet 0.0.750 → 0.0.753
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/README.md +18 -10
- package/dist/components/TekWallet/components/index.d.ts +8 -0
- package/dist/components/TekWallet/components/index.js +8 -0
- package/dist/components/TekWallet/components/layouts/ChildPageLayout/index.js +14 -3
- package/dist/components/TekWallet/components/ui/BackHeader/index.js +5 -1
- package/dist/components/TekWallet/components/ui/BottomActionLayout/index.d.ts +3 -3
- package/dist/components/TekWallet/components/ui/BottomActionLayout/index.js +24 -6
- package/dist/components/TekWallet/components/ui/Button/index.js +2 -2
- package/dist/components/TekWallet/components/ui/ConfirmByPasscode/index.js +2 -6
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.d.ts +20 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +173 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.d.ts +17 -0
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.js +100 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/Result.d.ts +8 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/Result.js +112 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.d.ts +18 -0
- package/dist/components/TekWallet/components/ui/ConfirmSwapToken/index.js +169 -0
- package/dist/components/TekWallet/components/ui/ConfirmTransaction/index.d.ts +6 -2
- package/dist/components/TekWallet/components/ui/ConfirmTransaction/index.js +11 -6
- package/dist/components/TekWallet/components/ui/ConfirmTransfer/index.d.ts +28 -0
- package/dist/components/TekWallet/components/ui/ConfirmTransfer/index.js +253 -0
- package/dist/components/TekWallet/components/ui/ConfirmTransfer/type.d.ts +16 -0
- package/dist/components/TekWallet/components/ui/ConfirmTransfer/type.js +2 -0
- package/dist/components/TekWallet/components/ui/CopyableText/index.js +1 -1
- package/dist/components/TekWallet/components/ui/DetailSwap/index.js +1 -1
- package/dist/components/TekWallet/components/ui/Fees/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/Fees/index.js +51 -41
- package/dist/components/TekWallet/components/ui/FeesAutoDebounce/index.d.ts +10 -0
- package/dist/components/TekWallet/components/ui/FeesAutoDebounce/index.js +223 -0
- package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareAction.js +2 -2
- package/dist/components/TekWallet/components/ui/FiatDeposit/components/shareImage.js +13 -13
- package/dist/components/TekWallet/components/ui/FiatDeposit/index.js +6 -4
- package/dist/components/TekWallet/components/ui/Formatter/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/Formatter/index.js +4 -2
- package/dist/components/TekWallet/components/ui/FunctionItem/index.js +5 -4
- package/dist/components/TekWallet/components/ui/Icon/index.d.ts +4 -2
- package/dist/components/TekWallet/components/ui/Icon/index.js +44 -3
- package/dist/components/TekWallet/components/ui/Input/index.js +3 -3
- package/dist/components/TekWallet/components/ui/ListItemCustom/index.d.ts +2 -1
- package/dist/components/TekWallet/components/ui/ListItemCustom/index.js +3 -3
- package/dist/components/TekWallet/components/ui/QRCode/index.js +1 -1
- package/dist/components/TekWallet/components/ui/SendExternalToken/index.js +1 -1
- package/dist/components/TekWallet/components/ui/SendExternalTokenWithdrawn/index.d.ts +2 -5
- package/dist/components/TekWallet/components/ui/SvgPath/index.d.ts +12 -0
- package/dist/components/TekWallet/components/ui/SvgPath/index.js +27 -15
- package/dist/components/TekWallet/components/ui/SwapFunction/index.js +4 -4
- package/dist/components/TekWallet/components/ui/SwapToken/index.d.ts +2 -3
- package/dist/components/TekWallet/components/ui/TokensBoard/index.js +1 -3
- package/dist/components/TekWallet/components/ui/ValidateWalletAddress/index.d.ts +5 -0
- package/dist/components/TekWallet/components/ui/ValidateWalletAddress/index.js +67 -0
- package/dist/components/TekWallet/components/ui/WaitingData/index.d.ts +1 -0
- package/dist/components/TekWallet/components/ui/WaitingData/index.js +10 -6
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.d.ts +1 -1
- package/dist/components/TekWallet/components/ui/WithdrawFunction/index.js +70 -32
- package/dist/components/TekWallet/components/views/AssetView/Menu.d.ts +7 -0
- package/dist/components/TekWallet/components/views/AssetView/Menu.js +25 -0
- package/dist/components/TekWallet/components/views/AssetView/index.js +25 -26
- package/dist/components/TekWallet/components/views/NotFoundView/index.d.ts +2 -0
- package/dist/components/TekWallet/components/views/NotFoundView/index.js +7 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Form.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Form.js +450 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Result.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Result.js +140 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectNetwork.d.ts +10 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectNetwork.js +34 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectToken.d.ts +8 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Summary.d.ts +12 -0
- package/dist/components/TekWallet/components/views/SendExternalView/components/Summary.js +131 -0
- package/dist/components/TekWallet/components/views/SendExternalView/index.d.ts +23 -0
- package/dist/components/TekWallet/components/views/SendExternalView/index.js +143 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/AmountForm.js +380 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Form.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Form.js +381 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Result.d.ts +13 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Result.js +128 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/SelectToken.d.ts +8 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Summary.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SendInternalView/components/Summary.js +126 -0
- package/dist/components/TekWallet/components/views/SendInternalView/index.d.ts +24 -0
- package/dist/components/TekWallet/components/views/SendInternalView/index.js +155 -0
- package/dist/components/TekWallet/components/views/SwapView/components/CardTo/index.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SwapView/components/CardTo/index.js +111 -0
- package/dist/components/TekWallet/components/views/SwapView/components/FromCard/index.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SwapView/components/FromCard/index.js +180 -0
- package/dist/components/TekWallet/components/views/SwapView/components/SelectToken.d.ts +9 -0
- package/dist/components/TekWallet/components/views/SwapView/components/SelectToken.js +173 -0
- package/dist/components/TekWallet/components/views/SwapView/components/Summary.d.ts +14 -0
- package/dist/components/TekWallet/components/views/SwapView/components/Summary.js +239 -0
- package/dist/components/TekWallet/components/views/SwapView/functions/convertTokensRate.d.ts +3 -0
- package/dist/components/TekWallet/components/views/SwapView/functions/convertTokensRate.js +14 -0
- package/dist/components/TekWallet/components/views/SwapView/index.d.ts +11 -0
- package/dist/components/TekWallet/components/views/SwapView/index.js +218 -0
- package/dist/components/TekWallet/components/views/TekWalletView/expose.d.ts +2 -0
- package/dist/components/TekWallet/components/views/TekWalletView/expose.js +18 -0
- package/dist/components/TekWallet/components/views/TekWalletView/index.d.ts +3 -0
- package/dist/components/TekWallet/components/views/TekWalletView/index.js +16 -0
- package/dist/components/TekWallet/components/views/TekWalletView/routes.d.ts +9 -0
- package/dist/components/TekWallet/components/views/TekWalletView/routes.js +74 -0
- package/dist/components/TekWallet/hooks/useValidateAmount.d.ts +26 -0
- package/dist/components/TekWallet/hooks/useValidateAmount.js +103 -0
- package/dist/components/TekWallet/providers/EventHandlerProvider/index.js +5 -0
- package/dist/components/TekWallet/providers/RealtimeProvider/index.js +2 -2
- package/dist/components/TekWallet/providers/TekWalletProvider/index.d.ts +3 -0
- package/dist/components/TekWallet/providers/TekWalletProvider/index.js +8 -2
- package/dist/components/TekWallet/providers/WithdrawProvider/index.js +36 -0
- package/dist/components/TekWallet/services/axios/get-est-fee-service/type.d.ts +5 -4
- package/dist/components/TekWallet/services/axios/send-external-service/type.d.ts +5 -30
- package/dist/components/TekWallet/services/axios/swap-service/type.d.ts +4 -0
- package/dist/components/TekWallet/services/axios/transfer-internal-service/type.d.ts +4 -32
- package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/components.js +3 -3
- package/dist/components/TekWallet/theme/mui/deposit-fiat-theme/palette.js +3 -3
- package/dist/components/TekWallet/theme/mui/theme.js +9 -9
- package/dist/components/TekWallet/utils/stop.d.ts +3 -0
- package/dist/components/TekWallet/utils/stop.js +6 -0
- package/package.json +2 -2
- package/dist/components/TekWallet/components/ui/CardFrom/index.d.ts +0 -10
- package/dist/components/TekWallet/components/ui/CardFrom/index.js +0 -91
- package/dist/components/TekWallet/components/ui/CardTo/index.d.ts +0 -10
- package/dist/components/TekWallet/components/ui/CardTo/index.js +0 -39
- package/dist/components/TekWallet/components/ui/ConfirmLayout copy/index.d.ts +0 -7
- package/dist/components/TekWallet/components/ui/ConfirmLayout copy/index.js +0 -67
- package/dist/components/TekWallet/components/views/HelpView/index.d.ts +0 -2
- package/dist/components/TekWallet/components/views/HelpView/index.js +0 -7
package/README.md
CHANGED
|
@@ -18,14 +18,7 @@ import { TekWalletProvider } from "tek-wallet";
|
|
|
18
18
|
<YourApp />
|
|
19
19
|
</TekWalletProvider>;
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
import theme from "path-to-your-theme";
|
|
23
|
-
|
|
24
|
-
<TekWalletProvider
|
|
25
|
-
isSSO
|
|
26
|
-
accessToken={accessToken}
|
|
27
|
-
theme={theme} // Truyền theme nếu sử dụng MUI
|
|
28
|
-
>
|
|
21
|
+
<TekWalletProvider isSSO accessToken={accessToken}>
|
|
29
22
|
<YourApp />
|
|
30
23
|
</TekWalletProvider>;
|
|
31
24
|
```
|
|
@@ -50,7 +43,9 @@ NEXT_PUBLIC_TEK_WALLET_ABLY_API_KEY=your_ably_api_key
|
|
|
50
43
|
Component này được sử dụng để kiểm tra trạng thái kết nối ví trước khi thực hiện các hành động yêu cầu ví phải được kết nối.
|
|
51
44
|
|
|
52
45
|
```jsx
|
|
53
|
-
import { RequiredConnect } from "tek
|
|
46
|
+
import { RequiredConnect, useWallet } from "tek-wallet";
|
|
47
|
+
|
|
48
|
+
const { tokens } = useWallet();
|
|
54
49
|
|
|
55
50
|
<RequiredConnect>
|
|
56
51
|
<Button.Primary onClick={() => console.log(tokens)}>Log balances</Button.Primary>
|
|
@@ -81,6 +76,14 @@ Component hiển thị tài sản trong ví.
|
|
|
81
76
|
|
|
82
77
|
Component xử lý chức năng rút token.
|
|
83
78
|
|
|
79
|
+
### ConfirmSendExternal
|
|
80
|
+
|
|
81
|
+
Component xử lý chức năng rút token bản đơn giản (khả năng custom cao).
|
|
82
|
+
|
|
83
|
+
### ConfirmSendInternal
|
|
84
|
+
|
|
85
|
+
Component xử lý chức năng chuyển nội bộ bản đơn giản (khả năng custom cao).
|
|
86
|
+
|
|
84
87
|
## States
|
|
85
88
|
|
|
86
89
|
### Wallet States
|
|
@@ -133,6 +136,12 @@ Component xử lý chức năng rút token.
|
|
|
133
136
|
| `updateReceiveExternalToken()` | Cập nhật danh sách các token được phép nhận từ bên ngoài |
|
|
134
137
|
| `updateReceiveInternalToken()` | Cập nhật danh sách các token được phép nhận nội bộ |
|
|
135
138
|
|
|
139
|
+
### Validation
|
|
140
|
+
|
|
141
|
+
| Method | Description |
|
|
142
|
+
| -------------------------------- | ------------------------------------ |
|
|
143
|
+
| `validateWalletAddressService()` | Validate địa chỉ ví nội bộ / Onchain |
|
|
144
|
+
|
|
136
145
|
### Notification
|
|
137
146
|
|
|
138
147
|
| Method | Description |
|
|
@@ -150,7 +159,6 @@ Component xử lý chức năng rút token.
|
|
|
150
159
|
|
|
151
160
|
## Lưu ý
|
|
152
161
|
|
|
153
|
-
- Khi sử dụng MUI, hãy truyền theme vào TekWalletProvider để giữ nguyên các cấu hình theme của bạn
|
|
154
162
|
- Đảm bảo luôn sử dụng RequiredConnect cho các hành động yêu cầu ví phải được kết nối
|
|
155
163
|
- Các biến môi trường phải được cấu hình đúng để đảm bảo ứng dụng hoạt động chính xác
|
|
156
164
|
|
|
@@ -13,3 +13,11 @@ export * from "./ui/TransferConfirmation";
|
|
|
13
13
|
export * from "./ui/Formatter";
|
|
14
14
|
export * from "./ui/TokenItem";
|
|
15
15
|
export * from "./ui/ConfirmTransferInternal";
|
|
16
|
+
export * from "./ui/Button";
|
|
17
|
+
export * from "./ui/ConfirmSendInternal";
|
|
18
|
+
export * from "./ui/ConfirmSendExternal";
|
|
19
|
+
export * from "./ui/ConfirmSwapToken";
|
|
20
|
+
export * from "./views/TekWalletView/expose";
|
|
21
|
+
export * from "./views/SendInternalView";
|
|
22
|
+
export * from "./views/SendExternalView";
|
|
23
|
+
export * from "./views/SwapView";
|
|
@@ -29,3 +29,11 @@ __exportStar(require("./ui/TransferConfirmation"), exports);
|
|
|
29
29
|
__exportStar(require("./ui/Formatter"), exports);
|
|
30
30
|
__exportStar(require("./ui/TokenItem"), exports);
|
|
31
31
|
__exportStar(require("./ui/ConfirmTransferInternal"), exports);
|
|
32
|
+
__exportStar(require("./ui/Button"), exports);
|
|
33
|
+
__exportStar(require("./ui/ConfirmSendInternal"), exports);
|
|
34
|
+
__exportStar(require("./ui/ConfirmSendExternal"), exports);
|
|
35
|
+
__exportStar(require("./ui/ConfirmSwapToken"), exports);
|
|
36
|
+
__exportStar(require("./views/TekWalletView/expose"), exports);
|
|
37
|
+
__exportStar(require("./views/SendInternalView"), exports);
|
|
38
|
+
__exportStar(require("./views/SendExternalView"), exports);
|
|
39
|
+
__exportStar(require("./views/SwapView"), exports);
|
|
@@ -10,6 +10,17 @@ var __assign = (this && this.__assign) || function () {
|
|
|
10
10
|
};
|
|
11
11
|
return __assign.apply(this, arguments);
|
|
12
12
|
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
13
24
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
25
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
26
|
};
|
|
@@ -21,7 +32,7 @@ var StatusDisplay_2 = __importDefault(require("../../ui/StatusDisplay"));
|
|
|
21
32
|
var material_1 = require("@mui/material");
|
|
22
33
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
23
34
|
var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
|
|
24
|
-
var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames, statusMessage = props.statusMessage;
|
|
35
|
+
var header = props.header, footer = props.footer, children = props.children, sx = props.sx, className = props.className, classNames = props.classNames, statusMessage = props.statusMessage, rest = __rest(props, ["header", "footer", "children", "sx", "className", "classNames", "statusMessage"]);
|
|
25
36
|
var _a = (0, react_1.useState)(StatusDisplay_1.StatusDisplayType.Normal), status = _a[0], setStatus = _a[1];
|
|
26
37
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
27
38
|
(0, react_1.useImperativeHandle)(ref, function () {
|
|
@@ -40,7 +51,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
40
51
|
},
|
|
41
52
|
};
|
|
42
53
|
});
|
|
43
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", backgroundColor: theme.palette.background.white }, sx), className: className, children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: children }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
54
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, __assign({ ref: ref, sx: __assign({ height: "100%", width: "100%", display: "grid", gridTemplateRows: "auto 1fr auto", position: "relative", backgroundColor: theme.palette.background.white }, sx), className: className }, rest, { children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.header, children: header }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { height: "100%", width: "100%", overflowX: "hidden", overflowY: "auto" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.body, children: children }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { width: "100%" }, className: classNames === null || classNames === void 0 ? void 0 : classNames.footer, children: footer }), status !== StatusDisplay_1.StatusDisplayType.Normal && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
44
55
|
position: "absolute",
|
|
45
56
|
inset: 0,
|
|
46
57
|
display: "flex",
|
|
@@ -49,7 +60,7 @@ var ChildPageLayout = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
49
60
|
backgroundColor: "blackBackground.16",
|
|
50
61
|
backdropFilter: "blur(4px)",
|
|
51
62
|
zIndex: 50,
|
|
52
|
-
}, children: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] }));
|
|
63
|
+
}, children: (0, jsx_runtime_1.jsx)(StatusDisplay_2.default, { status: status, statusMessage: statusMessage === null || statusMessage === void 0 ? void 0 : statusMessage[status] }) }))] })));
|
|
53
64
|
});
|
|
54
65
|
ChildPageLayout.displayName = "ChildPageLayout";
|
|
55
66
|
exports.default = ChildPageLayout;
|
|
@@ -20,6 +20,7 @@ var BackArrow_1 = __importDefault(require("../BackArrow"));
|
|
|
20
20
|
var useCustomRouter_1 = __importDefault(require("../../../hooks/useCustomRouter"));
|
|
21
21
|
var material_1 = require("@mui/material");
|
|
22
22
|
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
23
|
+
var Text_1 = __importDefault(require("../Text"));
|
|
23
24
|
var BackHeader = function (props) {
|
|
24
25
|
var router = (0, useCustomRouter_1.default)();
|
|
25
26
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
@@ -41,6 +42,9 @@ var BackHeader = function (props) {
|
|
|
41
42
|
transform: "translateX(-0.25rem)",
|
|
42
43
|
transition: "transform 0.2s ease-in-out",
|
|
43
44
|
},
|
|
44
|
-
}, onClick: back, children: [(0, jsx_runtime_1.jsx)(BackArrow_1.default, {}), " "
|
|
45
|
+
}, onClick: back, children: [(0, jsx_runtime_1.jsx)(BackArrow_1.default, {}), " ", (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
46
|
+
color: theme.palette.text.black,
|
|
47
|
+
fontSize: theme.typography.fontSize12,
|
|
48
|
+
}, children: "Back" })] })), !!center && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.center), theme.mixins.headerTitle), children: center })), children, right && (0, jsx_runtime_1.jsx)(material_1.Box, { sx: { marginLeft: "auto" }, children: right })] }));
|
|
45
49
|
};
|
|
46
50
|
exports.default = BackHeader;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
interface BottomActionLayoutProps extends
|
|
1
|
+
import { BoxProps } from "@mui/material";
|
|
2
|
+
interface BottomActionLayoutProps extends BoxProps {
|
|
3
3
|
}
|
|
4
|
-
declare function BottomActionLayout({ children }: BottomActionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
declare function BottomActionLayout({ children, sx, ...rest }: BottomActionLayoutProps): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export default BottomActionLayout;
|
|
@@ -1,15 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
14
|
+
var t = {};
|
|
15
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
16
|
+
t[p] = s[p];
|
|
17
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
18
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
19
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
20
|
+
t[p[i]] = s[p[i]];
|
|
21
|
+
}
|
|
22
|
+
return t;
|
|
23
|
+
};
|
|
2
24
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
25
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
4
26
|
var material_1 = require("@mui/material");
|
|
5
27
|
var providers_1 = require("../../../providers");
|
|
6
28
|
function BottomActionLayout(_a) {
|
|
7
|
-
var children = _a.children;
|
|
29
|
+
var children = _a.children, sx = _a.sx, rest = __rest(_a, ["children", "sx"]);
|
|
8
30
|
var theme = (0, providers_1.useTheme)();
|
|
9
|
-
return ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
10
|
-
width: "100%",
|
|
11
|
-
px: theme.mixins.pagePadding,
|
|
12
|
-
pb: theme.mixins.customPadding.p24,
|
|
13
|
-
}, children: children }));
|
|
31
|
+
return ((0, jsx_runtime_1.jsx)(material_1.Box, __assign({ sx: __assign({ width: "100%", paddingLeft: theme.mixins.pagePadding, paddingRight: theme.mixins.pagePadding, paddingBottom: theme.mixins.customPadding.p24 }, sx) }, rest, { children: children })));
|
|
14
32
|
}
|
|
15
33
|
exports.default = BottomActionLayout;
|
|
@@ -56,7 +56,7 @@ Button.Primary = function (props) {
|
|
|
56
56
|
// color: theme.palette.text.white24,
|
|
57
57
|
// },
|
|
58
58
|
// };
|
|
59
|
-
return ((0, jsx_runtime_1.jsxs)(Button, __assign({}, rest, { variant: "contained", status: status, sx: __assign({ backgroundColor: theme.palette.background.primary, color: theme.palette.text.secondary, borderRadius: theme.mixins.customRadius.r12, textTransform: "capitalize", position: "relative", px: theme.mixins.customPadding.p16, py: theme.mixins.customPadding.
|
|
59
|
+
return ((0, jsx_runtime_1.jsxs)(Button, __assign({}, rest, { variant: "contained", status: status, sx: __assign({ backgroundColor: theme.palette.background.primary, color: theme.palette.text.secondary, borderRadius: theme.mixins.customRadius.r12, textTransform: "capitalize", position: "relative", px: theme.mixins.customPadding.p16, py: theme.mixins.customPadding.p12, fontWeight: theme.typography.fontWeight500, fontSize: theme.typography.fontSize14, lineHeight: theme.typography.leading100 }, sx), disabled: status !== BUTTON_STATUS.ENABLED, children: [status === BUTTON_STATUS.LOADING && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
60
60
|
position: "absolute",
|
|
61
61
|
inset: 0,
|
|
62
62
|
display: "flex",
|
|
@@ -70,7 +70,7 @@ Button.Primary.displayName = "Button.Primary";
|
|
|
70
70
|
Button.Secondary = function (props) {
|
|
71
71
|
var sx = props.sx, _a = props.status, status = _a === void 0 ? BUTTON_STATUS.ENABLED : _a, rest = __rest(props, ["sx", "status"]);
|
|
72
72
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
73
|
-
return ((0, jsx_runtime_1.jsx)(Button, __assign({}, rest, { variant: "outlined", sx: __assign({ color: theme.palette.text.primary, borderRadius: theme.mixins.customRadius.r12, borderColor: "currentcolor", textTransform: "capitalize", position: "relative"
|
|
73
|
+
return ((0, jsx_runtime_1.jsx)(Button, __assign({}, rest, { variant: "outlined", sx: __assign({ color: theme.palette.text.primary, borderRadius: theme.mixins.customRadius.r12, borderColor: "currentcolor", textTransform: "capitalize", position: "relative" }, sx), disabled: status !== BUTTON_STATUS.ENABLED })));
|
|
74
74
|
};
|
|
75
75
|
Button.Secondary.displayName = "Button.Secondary";
|
|
76
76
|
Button.Text = function (props) {
|
|
@@ -99,7 +99,7 @@ var useWarningWrongPasscode_1 = require("../../../hooks/useWarningWrongPasscode"
|
|
|
99
99
|
var clsx_1 = __importDefault(require("clsx"));
|
|
100
100
|
var passcodeLength = 6;
|
|
101
101
|
var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
102
|
-
var onConfirmSuccess = props.onConfirmSuccess;
|
|
102
|
+
var onConfirmSuccess = props.onConfirmSuccess, sx = props.sx;
|
|
103
103
|
var theme = (0, ThemeProvider_1.useTheme)();
|
|
104
104
|
var _a = (0, react_1.useState)(""), passcode = _a[0], setPasscode = _a[1];
|
|
105
105
|
var loadingRef = (0, react_1.useRef)(null);
|
|
@@ -190,11 +190,7 @@ var ConfirmByPasscode = (0, react_1.forwardRef)(function (props, ref) {
|
|
|
190
190
|
}); }, [handleClose, onConfirmSuccess, passcode]);
|
|
191
191
|
return ((0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: drawerRef, trigger: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Label, { style: {
|
|
192
192
|
width: "100%",
|
|
193
|
-
}, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, triggerStatus: props.triggerStatus, sx: {
|
|
194
|
-
width: "100%",
|
|
195
|
-
maxWidth: "calc(100dvw - 2rem)",
|
|
196
|
-
display: "flex",
|
|
197
|
-
}, children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { ref: keyboardRef, id: keyboardId, value: passcode, onChange: handlePasscodeChange, keyboardType: xhub_keyboard_1.KeyboardType.Text, layoutType: xhub_keyboard_1.LayoutType.Integer, classNames: {
|
|
193
|
+
}, useBrowserInput: false, htmlFor: keyboardId, children: props.children }), onOpen: handleOnOpen, onClose: handleOnClose, triggerStatus: props.triggerStatus, sx: __assign({ width: "100%", maxWidth: "calc(100dvw - 2rem)", display: "flex" }, sx), children: (0, jsx_runtime_1.jsx)(xhub_keyboard_1.Keyboard, { ref: keyboardRef, id: keyboardId, value: passcode, onChange: handlePasscodeChange, keyboardType: xhub_keyboard_1.KeyboardType.Text, layoutType: xhub_keyboard_1.LayoutType.Integer, classNames: {
|
|
198
194
|
keyboardContainer: (0, clsx_1.default)({
|
|
199
195
|
"!hidden": isLocked,
|
|
200
196
|
}),
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ConfirmLayoutProps } from "../ConfirmLayout";
|
|
2
|
+
import { SendExternalBody, SendExternalResponse } from "../../../services/axios/send-external-service/type";
|
|
3
|
+
import { NetworkData } from "../../../services/axios/type";
|
|
4
|
+
import { SxProps } from "@mui/material";
|
|
5
|
+
import { ReactEventHandler } from "react";
|
|
6
|
+
export interface SendExternalDataType extends Omit<SendExternalBody, "network" | "passcode"> {
|
|
7
|
+
network: NetworkData;
|
|
8
|
+
}
|
|
9
|
+
export interface ConfirmSendExternalProps extends Omit<ConfirmLayoutProps, "action"> {
|
|
10
|
+
payload: SendExternalDataType;
|
|
11
|
+
onSuccess?: (data: SendExternalResponse) => unknown;
|
|
12
|
+
onStart?: () => void;
|
|
13
|
+
onFinally?: () => void;
|
|
14
|
+
onError?: (error: Error | unknown) => void;
|
|
15
|
+
children?: React.ReactNode;
|
|
16
|
+
sx?: SxProps;
|
|
17
|
+
onClose?: ReactEventHandler;
|
|
18
|
+
}
|
|
19
|
+
export declare const ConfirmSendExternal: ({ payload, onSuccess, onStart, onFinally, onError, children, sx, onClose: onDone, }: ConfirmSendExternalProps) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
export default ConfirmSendExternal;
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
17
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
18
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
19
|
+
}
|
|
20
|
+
Object.defineProperty(o, k2, desc);
|
|
21
|
+
}) : (function(o, m, k, k2) {
|
|
22
|
+
if (k2 === undefined) k2 = k;
|
|
23
|
+
o[k2] = m[k];
|
|
24
|
+
}));
|
|
25
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
26
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
27
|
+
}) : function(o, v) {
|
|
28
|
+
o["default"] = v;
|
|
29
|
+
});
|
|
30
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
31
|
+
var ownKeys = function(o) {
|
|
32
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
33
|
+
var ar = [];
|
|
34
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
35
|
+
return ar;
|
|
36
|
+
};
|
|
37
|
+
return ownKeys(o);
|
|
38
|
+
};
|
|
39
|
+
return function (mod) {
|
|
40
|
+
if (mod && mod.__esModule) return mod;
|
|
41
|
+
var result = {};
|
|
42
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
43
|
+
__setModuleDefault(result, mod);
|
|
44
|
+
return result;
|
|
45
|
+
};
|
|
46
|
+
})();
|
|
47
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
48
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
49
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
50
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
51
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
52
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
53
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
57
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
58
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
59
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
60
|
+
function step(op) {
|
|
61
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
62
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
63
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
64
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
65
|
+
switch (op[0]) {
|
|
66
|
+
case 0: case 1: t = op; break;
|
|
67
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
68
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
69
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
70
|
+
default:
|
|
71
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
72
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
73
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
74
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
75
|
+
if (t[2]) _.ops.pop();
|
|
76
|
+
_.trys.pop(); continue;
|
|
77
|
+
}
|
|
78
|
+
op = body.call(thisArg, _);
|
|
79
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
80
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
84
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
85
|
+
};
|
|
86
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
87
|
+
exports.ConfirmSendExternal = void 0;
|
|
88
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
89
|
+
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
90
|
+
var send_external_service_1 = __importDefault(require("../../../services/axios/send-external-service"));
|
|
91
|
+
var DrawerComponent_1 = __importStar(require("../DrawerComponent"));
|
|
92
|
+
var react_1 = require("react");
|
|
93
|
+
var Result_1 = __importDefault(require("../../views/SendExternalView/components/Result"));
|
|
94
|
+
var DefaultPageLayout_1 = __importDefault(require("../../layouts/DefaultPageLayout"));
|
|
95
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
96
|
+
var stop_1 = __importDefault(require("../../../utils/stop"));
|
|
97
|
+
var useWallet_1 = __importDefault(require("../../../hooks/useWallet"));
|
|
98
|
+
var type_1 = require("../../../services/axios/get-activities-service/type");
|
|
99
|
+
var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
|
|
100
|
+
var ConfirmSendExternal = function (_a) {
|
|
101
|
+
var payload = _a.payload, onSuccess = _a.onSuccess, onStart = _a.onStart, onFinally = _a.onFinally, onError = _a.onError, children = _a.children, sx = _a.sx, onDone = _a.onClose;
|
|
102
|
+
var network = payload.network;
|
|
103
|
+
var _b = (0, react_1.useState)(), response = _b[0], setResponse = _b[1];
|
|
104
|
+
var thisTransactionId = (0, react_1.useRef)("");
|
|
105
|
+
var transaction = (0, useWallet_1.default)().transaction;
|
|
106
|
+
var pushNotification = (0, useRealtime_1.default)().pushNotification;
|
|
107
|
+
var handleConfirmSendExternal = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
108
|
+
var response_1, err_1, time;
|
|
109
|
+
var _a;
|
|
110
|
+
return __generator(this, function (_b) {
|
|
111
|
+
switch (_b.label) {
|
|
112
|
+
case 0:
|
|
113
|
+
_b.trys.push([0, 2, 3, 4]);
|
|
114
|
+
onStart === null || onStart === void 0 ? void 0 : onStart();
|
|
115
|
+
return [4 /*yield*/, (0, send_external_service_1.default)(__assign(__assign({}, payload), { network: network.slug, passcode: passcode, await_completion: false }))];
|
|
116
|
+
case 1:
|
|
117
|
+
response_1 = _b.sent();
|
|
118
|
+
setResponse(response_1.data);
|
|
119
|
+
thisTransactionId.current = response_1.data.id;
|
|
120
|
+
(_a = resultRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
121
|
+
if (response_1.success) {
|
|
122
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response_1);
|
|
123
|
+
}
|
|
124
|
+
else {
|
|
125
|
+
throw new Error("Send external failed", { cause: response_1 });
|
|
126
|
+
}
|
|
127
|
+
return [3 /*break*/, 4];
|
|
128
|
+
case 2:
|
|
129
|
+
err_1 = _b.sent();
|
|
130
|
+
console.error(err_1);
|
|
131
|
+
time = Date.now();
|
|
132
|
+
pushNotification({
|
|
133
|
+
id: "send-external-failed-".concat(time),
|
|
134
|
+
message: "Something went wrong, please try again later",
|
|
135
|
+
type: "error",
|
|
136
|
+
});
|
|
137
|
+
onError === null || onError === void 0 ? void 0 : onError(err_1);
|
|
138
|
+
return [3 /*break*/, 4];
|
|
139
|
+
case 3:
|
|
140
|
+
onFinally === null || onFinally === void 0 ? void 0 : onFinally();
|
|
141
|
+
return [7 /*endfinally*/];
|
|
142
|
+
case 4: return [2 /*return*/];
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
}); };
|
|
146
|
+
var resultRef = (0, react_1.useRef)(null);
|
|
147
|
+
var handleCloseResult = function (e) {
|
|
148
|
+
var _a;
|
|
149
|
+
(_a = resultRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
150
|
+
onDone === null || onDone === void 0 ? void 0 : onDone(e);
|
|
151
|
+
};
|
|
152
|
+
(0, react_1.useEffect)(function () {
|
|
153
|
+
if (transaction &&
|
|
154
|
+
transaction.id === thisTransactionId.current &&
|
|
155
|
+
transaction.status !== type_1.TransactionStatus.Processing) {
|
|
156
|
+
setResponse(transaction);
|
|
157
|
+
}
|
|
158
|
+
}, [transaction]);
|
|
159
|
+
return ((0, jsx_runtime_1.jsxs)(ConfirmByPasscode_1.default, { sx: sx, onConfirmSuccess: handleConfirmSendExternal, children: [children, (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: resultRef, sx: {
|
|
160
|
+
width: 0,
|
|
161
|
+
height: 0,
|
|
162
|
+
position: "absolute",
|
|
163
|
+
top: 0,
|
|
164
|
+
left: 0,
|
|
165
|
+
}, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
|
|
166
|
+
height: "100dvh",
|
|
167
|
+
width: "100dvw",
|
|
168
|
+
}, onClick: stop_1.default, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
|
|
169
|
+
height: "100%",
|
|
170
|
+
}, children: (0, jsx_runtime_1.jsx)(Result_1.default, { transaction: response, payload: payload, onDone: handleCloseResult }) }) }) })] }));
|
|
171
|
+
};
|
|
172
|
+
exports.ConfirmSendExternal = ConfirmSendExternal;
|
|
173
|
+
exports.default = exports.ConfirmSendExternal;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { TransferInternalBody, TransferInternalResponse } from "../../../services/axios/transfer-internal-service/type";
|
|
2
|
+
import { SxProps } from "@mui/material";
|
|
3
|
+
export interface SendInternalDataType extends Omit<TransferInternalBody, "passcode"> {
|
|
4
|
+
}
|
|
5
|
+
export interface SendInternalResponse extends TransferInternalResponse {
|
|
6
|
+
}
|
|
7
|
+
export interface ConfirmSendInternalProps {
|
|
8
|
+
payload: SendInternalDataType;
|
|
9
|
+
onSuccess?: (data: SendInternalResponse) => unknown;
|
|
10
|
+
onStart?: () => void;
|
|
11
|
+
onFinally?: () => void;
|
|
12
|
+
onError?: (error: Error | unknown) => void;
|
|
13
|
+
children?: React.ReactNode;
|
|
14
|
+
sx?: SxProps;
|
|
15
|
+
}
|
|
16
|
+
export declare function ConfirmSendInternal({ payload, onSuccess, onStart, onFinally, onError, children, sx, }: ConfirmSendInternalProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export default ConfirmSendInternal;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __assign = (this && this.__assign) || function () {
|
|
4
|
+
__assign = Object.assign || function(t) {
|
|
5
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
6
|
+
s = arguments[i];
|
|
7
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
8
|
+
t[p] = s[p];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
return __assign.apply(this, arguments);
|
|
13
|
+
};
|
|
14
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
15
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
16
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
17
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
18
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
19
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
20
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
24
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
25
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
26
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
27
|
+
function step(op) {
|
|
28
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
29
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
30
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
31
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
32
|
+
switch (op[0]) {
|
|
33
|
+
case 0: case 1: t = op; break;
|
|
34
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
35
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
36
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
37
|
+
default:
|
|
38
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
39
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
40
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
41
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
42
|
+
if (t[2]) _.ops.pop();
|
|
43
|
+
_.trys.pop(); continue;
|
|
44
|
+
}
|
|
45
|
+
op = body.call(thisArg, _);
|
|
46
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
47
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
51
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
52
|
+
};
|
|
53
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
54
|
+
exports.ConfirmSendInternal = ConfirmSendInternal;
|
|
55
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
56
|
+
var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
|
|
57
|
+
var transfer_internal_service_1 = __importDefault(require("../../../services/axios/transfer-internal-service"));
|
|
58
|
+
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
59
|
+
function ConfirmSendInternal(_a) {
|
|
60
|
+
var _this = this;
|
|
61
|
+
var payload = _a.payload, onSuccess = _a.onSuccess, onStart = _a.onStart, onFinally = _a.onFinally, onError = _a.onError, children = _a.children, sx = _a.sx;
|
|
62
|
+
var pushNotification = (0, useRealtime_1.default)().pushNotification;
|
|
63
|
+
var handleConfirmSendInternal = function (passcode) { return __awaiter(_this, void 0, void 0, function () {
|
|
64
|
+
var response, err_1, time;
|
|
65
|
+
return __generator(this, function (_a) {
|
|
66
|
+
switch (_a.label) {
|
|
67
|
+
case 0:
|
|
68
|
+
_a.trys.push([0, 2, 3, 4]);
|
|
69
|
+
onStart === null || onStart === void 0 ? void 0 : onStart();
|
|
70
|
+
return [4 /*yield*/, (0, transfer_internal_service_1.default)(__assign(__assign({}, payload), { passcode: passcode, await_completion: true }))];
|
|
71
|
+
case 1:
|
|
72
|
+
response = _a.sent();
|
|
73
|
+
if (response.success) {
|
|
74
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
throw new Error("Send internal failed", { cause: response });
|
|
78
|
+
}
|
|
79
|
+
return [3 /*break*/, 4];
|
|
80
|
+
case 2:
|
|
81
|
+
err_1 = _a.sent();
|
|
82
|
+
console.error(err_1);
|
|
83
|
+
time = Date.now();
|
|
84
|
+
pushNotification({
|
|
85
|
+
id: "send-internal-failed-".concat(time),
|
|
86
|
+
message: "Something went wrong, please try again later",
|
|
87
|
+
type: "error",
|
|
88
|
+
});
|
|
89
|
+
onError === null || onError === void 0 ? void 0 : onError(err_1);
|
|
90
|
+
return [3 /*break*/, 4];
|
|
91
|
+
case 3:
|
|
92
|
+
onFinally === null || onFinally === void 0 ? void 0 : onFinally();
|
|
93
|
+
return [7 /*endfinally*/];
|
|
94
|
+
case 4: return [2 /*return*/];
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}); };
|
|
98
|
+
return ((0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { sx: sx, onConfirmSuccess: handleConfirmSendInternal, children: children }));
|
|
99
|
+
}
|
|
100
|
+
exports.default = ConfirmSendInternal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactEventHandler } from "react";
|
|
2
|
+
import { SwapResponse } from "../../../services/axios/swap-service/type";
|
|
3
|
+
interface ResultProps {
|
|
4
|
+
transaction?: SwapResponse["data"];
|
|
5
|
+
onDone?: ReactEventHandler;
|
|
6
|
+
}
|
|
7
|
+
export default function Result(props: ResultProps): import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export type { ResultProps };
|