tek-wallet 0.0.752 → 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/dist/components/TekWallet/components/index.d.ts +7 -0
- package/dist/components/TekWallet/components/index.js +7 -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 +6 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendExternal/index.js +92 -12
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.d.ts +4 -2
- package/dist/components/TekWallet/components/ui/ConfirmSendInternal/index.js +12 -4
- 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/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
|
@@ -0,0 +1,169 @@
|
|
|
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.ConfirmSwapToken = void 0;
|
|
88
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
89
|
+
var DrawerComponent_1 = __importStar(require("../DrawerComponent"));
|
|
90
|
+
var ConfirmByPasscode_1 = __importDefault(require("../ConfirmByPasscode"));
|
|
91
|
+
var react_1 = require("react");
|
|
92
|
+
var swap_service_1 = __importDefault(require("../../../services/axios/swap-service"));
|
|
93
|
+
var ChildPageLayout_1 = __importDefault(require("../../layouts/ChildPageLayout"));
|
|
94
|
+
var stop_1 = __importDefault(require("../../../utils/stop"));
|
|
95
|
+
var DefaultPageLayout_1 = __importDefault(require("../../layouts/DefaultPageLayout"));
|
|
96
|
+
var Result_1 = __importDefault(require("./Result"));
|
|
97
|
+
var useRealtime_1 = __importDefault(require("../../../hooks/useRealtime"));
|
|
98
|
+
var ConfirmSwapToken = function (props) {
|
|
99
|
+
var confirmLayoutDrawerRef = (0, react_1.useRef)(null);
|
|
100
|
+
var sx = props.sx, children = props.children, onSuccess = props.onSuccess, onStart = props.onStart, onFinally = props.onFinally, onError = props.onError, payload = props.payload, onDone = props.onDone;
|
|
101
|
+
var _a = (0, react_1.useState)(null), response = _a[0], setResponse = _a[1];
|
|
102
|
+
var pushNotification = (0, useRealtime_1.default)().pushNotification;
|
|
103
|
+
var openResult = function () {
|
|
104
|
+
var _a;
|
|
105
|
+
(_a = resultRef.current) === null || _a === void 0 ? void 0 : _a.open();
|
|
106
|
+
};
|
|
107
|
+
var closeResult = function () {
|
|
108
|
+
var _a;
|
|
109
|
+
(_a = resultRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
110
|
+
};
|
|
111
|
+
var handleConfirmSwapToken = function (passcode) { return __awaiter(void 0, void 0, void 0, function () {
|
|
112
|
+
var response_1, err_1, time;
|
|
113
|
+
var _a, _b;
|
|
114
|
+
return __generator(this, function (_c) {
|
|
115
|
+
switch (_c.label) {
|
|
116
|
+
case 0:
|
|
117
|
+
_c.trys.push([0, 2, 3, 4]);
|
|
118
|
+
onStart === null || onStart === void 0 ? void 0 : onStart();
|
|
119
|
+
return [4 /*yield*/, (0, swap_service_1.default)(__assign(__assign({}, payload), { passcode: passcode, await_completion: true }))];
|
|
120
|
+
case 1:
|
|
121
|
+
response_1 = _c.sent();
|
|
122
|
+
if (response_1.success) {
|
|
123
|
+
setResponse(response_1);
|
|
124
|
+
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(response_1);
|
|
125
|
+
(_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
|
|
126
|
+
openResult();
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
throw new Error("Swap internal failed");
|
|
130
|
+
}
|
|
131
|
+
return [3 /*break*/, 4];
|
|
132
|
+
case 2:
|
|
133
|
+
err_1 = _c.sent();
|
|
134
|
+
time = Date.now();
|
|
135
|
+
pushNotification({
|
|
136
|
+
id: "swap-failed-".concat(time),
|
|
137
|
+
message: "Something went wrong, please try again later",
|
|
138
|
+
type: "error",
|
|
139
|
+
});
|
|
140
|
+
onError === null || onError === void 0 ? void 0 : onError(err_1);
|
|
141
|
+
return [3 /*break*/, 4];
|
|
142
|
+
case 3:
|
|
143
|
+
onFinally === null || onFinally === void 0 ? void 0 : onFinally();
|
|
144
|
+
(_b = confirmLayoutDrawerRef.current) === null || _b === void 0 ? void 0 : _b.close();
|
|
145
|
+
return [7 /*endfinally*/];
|
|
146
|
+
case 4: return [2 /*return*/];
|
|
147
|
+
}
|
|
148
|
+
});
|
|
149
|
+
}); };
|
|
150
|
+
var resultRef = (0, react_1.useRef)(null);
|
|
151
|
+
var handleCloseResult = function (e) {
|
|
152
|
+
closeResult();
|
|
153
|
+
onDone === null || onDone === void 0 ? void 0 : onDone(e);
|
|
154
|
+
};
|
|
155
|
+
return ((0, jsx_runtime_1.jsxs)(ConfirmByPasscode_1.default, { sx: sx, onConfirmSuccess: handleConfirmSwapToken, children: [children, (0, jsx_runtime_1.jsx)(DrawerComponent_1.default, { ref: resultRef, sx: {
|
|
156
|
+
width: 0,
|
|
157
|
+
height: 0,
|
|
158
|
+
position: "absolute",
|
|
159
|
+
top: 0,
|
|
160
|
+
left: 0,
|
|
161
|
+
}, direction: DrawerComponent_1.DRAWER_DIRECTION.RIGHT, children: (0, jsx_runtime_1.jsx)(ChildPageLayout_1.default, { sx: {
|
|
162
|
+
height: "100dvh",
|
|
163
|
+
width: "100dvw",
|
|
164
|
+
}, onClick: stop_1.default, children: (0, jsx_runtime_1.jsx)(DefaultPageLayout_1.default, { sx: {
|
|
165
|
+
height: "100%",
|
|
166
|
+
}, children: (0, jsx_runtime_1.jsx)(Result_1.default, { transaction: response === null || response === void 0 ? void 0 : response.data, onDone: handleCloseResult }) }) }) })] }));
|
|
167
|
+
};
|
|
168
|
+
exports.ConfirmSwapToken = ConfirmSwapToken;
|
|
169
|
+
exports.default = exports.ConfirmSwapToken;
|
|
@@ -80,6 +80,6 @@ var CopyableText = function (_a) {
|
|
|
80
80
|
}
|
|
81
81
|
return function () { return clearTimeout(timer); };
|
|
82
82
|
}, [copied]);
|
|
83
|
-
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", gap: 0.5, sx: sx === null || sx === void 0 ? void 0 : sx.container, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: copied ? "success.main" : "text.primary", sx: sx === null || sx === void 0 ? void 0 : sx.text, children: copied ? "Copied!" : displayText || copyText }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleCopy, size: "small", sx: __assign({ padding: 0.5 }, sx === null || sx === void 0 ? void 0 : sx.button), children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [(0, jsx_runtime_1.jsx)("mask", { id: "mask0_860_5627", maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "20", height: "20", children: (0, jsx_runtime_1.jsx)("rect", { width: "20", height: "20", fill: "#D9D9D9" }) }), (0, jsx_runtime_1.jsx)("g", { mask: "url(#mask0_860_5627)", children: (0, jsx_runtime_1.jsx)("path", { d: "M7.54804 14.5826C7.17293 14.5826 6.85587 14.4531 6.59685 14.1941C6.33783 13.9351 6.20831 13.618 6.20831 13.2429V3.75577C6.20831 3.38066 6.33783 3.06359 6.59685 2.80456C6.85587 2.54553 7.17293 2.41602 7.54804 2.41602H15.0352C15.4103 2.41602 15.7273 2.54553 15.9864 2.80456C16.2454 3.06359 16.3749 3.38066 16.3749 3.75577V13.2429C16.3749 13.618 16.2454 13.9351 15.9864 14.1941C15.7273 14.4531 15.4103 14.5826 15.0352 14.5826H7.54804ZM7.54804 13.4993H15.0352C15.0993 13.4993 15.158 13.4726 15.2115 13.4192C15.2649 13.3658 15.2916 13.307 15.2916 13.2429V3.75577C15.2916 3.69166 15.2649 3.63288 15.2115 3.57945C15.158 3.52604 15.0993 3.49933 15.0352 3.49933H7.54804C7.48393 3.49933 7.42517 3.52604 7.37175 3.57945C7.31832 3.63288 7.2916 3.69166 7.2916 3.75577V13.2429C7.2916 13.307 7.31832 13.3658 7.37175 13.4192C7.42517 13.4726 7.48393 13.4993 7.54804 13.4993ZM4.96473 17.1659C4.58963 17.1659 4.27257 17.0364 4.01354 16.7774C3.75451 16.5184 3.625 16.2013 3.625 15.8262V5.25577H4.70831V15.8262C4.70831 15.8903 4.73502 15.9491 4.78844 16.0025C4.84187 16.0559 4.90063 16.0826 4.96473 16.0826H13.5352V17.1659H4.96473Z", fill: "#
|
|
83
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { display: "flex", alignItems: "center", gap: 0.5, sx: sx === null || sx === void 0 ? void 0 : sx.container, children: [(0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body2", color: copied ? "success.main" : "text.primary", sx: sx === null || sx === void 0 ? void 0 : sx.text, children: copied ? "Copied!" : displayText || copyText }), (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: handleCopy, size: "small", sx: __assign({ padding: 0.5 }, sx === null || sx === void 0 ? void 0 : sx.button), children: (0, jsx_runtime_1.jsx)("span", { children: (0, jsx_runtime_1.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "20", height: "20", viewBox: "0 0 20 20", fill: "none", children: [(0, jsx_runtime_1.jsx)("mask", { id: "mask0_860_5627", maskUnits: "userSpaceOnUse", x: "0", y: "0", width: "20", height: "20", children: (0, jsx_runtime_1.jsx)("rect", { width: "20", height: "20", fill: "#D9D9D9" }) }), (0, jsx_runtime_1.jsx)("g", { mask: "url(#mask0_860_5627)", children: (0, jsx_runtime_1.jsx)("path", { d: "M7.54804 14.5826C7.17293 14.5826 6.85587 14.4531 6.59685 14.1941C6.33783 13.9351 6.20831 13.618 6.20831 13.2429V3.75577C6.20831 3.38066 6.33783 3.06359 6.59685 2.80456C6.85587 2.54553 7.17293 2.41602 7.54804 2.41602H15.0352C15.4103 2.41602 15.7273 2.54553 15.9864 2.80456C16.2454 3.06359 16.3749 3.38066 16.3749 3.75577V13.2429C16.3749 13.618 16.2454 13.9351 15.9864 14.1941C15.7273 14.4531 15.4103 14.5826 15.0352 14.5826H7.54804ZM7.54804 13.4993H15.0352C15.0993 13.4993 15.158 13.4726 15.2115 13.4192C15.2649 13.3658 15.2916 13.307 15.2916 13.2429V3.75577C15.2916 3.69166 15.2649 3.63288 15.2115 3.57945C15.158 3.52604 15.0993 3.49933 15.0352 3.49933H7.54804C7.48393 3.49933 7.42517 3.52604 7.37175 3.57945C7.31832 3.63288 7.2916 3.69166 7.2916 3.75577V13.2429C7.2916 13.307 7.31832 13.3658 7.37175 13.4192C7.42517 13.4726 7.48393 13.4993 7.54804 13.4993ZM4.96473 17.1659C4.58963 17.1659 4.27257 17.0364 4.01354 16.7774C3.75451 16.5184 3.625 16.2013 3.625 15.8262V5.25577H4.70831V15.8262C4.70831 15.8903 4.73502 15.9491 4.78844 16.0025C4.84187 16.0559 4.90063 16.0826 4.96473 16.0826H13.5352V17.1659H4.96473Z", fill: "#1C461D" }) })] }) }) })] }));
|
|
84
84
|
};
|
|
85
85
|
exports.default = CopyableText;
|
|
@@ -32,7 +32,7 @@ var DetailSwap = function (props) {
|
|
|
32
32
|
color: theme.palette.text.accent,
|
|
33
33
|
fontSize: theme.typography.fontSize12,
|
|
34
34
|
fontWeight: theme.typography.fontWeight400,
|
|
35
|
-
}, children: "Best Price" }), value: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: (0, jsx_runtime_1.jsxs)(Text_1.default, {
|
|
35
|
+
}, children: "Best Price" }), value: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4 }), children: (0, jsx_runtime_1.jsxs)(Text_1.default, { sx: {
|
|
36
36
|
color: theme.palette.text.blackContrast,
|
|
37
37
|
fontSize: theme.typography.fontSize12,
|
|
38
38
|
fontWeight: theme.typography.fontWeight500,
|
|
@@ -14,5 +14,5 @@ export interface FeesProps extends Omit<AccordionProps, "children"> {
|
|
|
14
14
|
feesStyle?: FeesStyle;
|
|
15
15
|
estimateReceive?: string | number;
|
|
16
16
|
}
|
|
17
|
-
declare function Fees(props: FeesProps): import("react/jsx-runtime").JSX.Element
|
|
17
|
+
declare function Fees(props: FeesProps): import("react/jsx-runtime").JSX.Element;
|
|
18
18
|
export default Fees;
|
|
@@ -60,7 +60,7 @@ function Fees(props) {
|
|
|
60
60
|
var fee_detail = (_a = feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail) !== null && _a !== void 0 ? _a : [];
|
|
61
61
|
return ((_b = fee_detail === null || fee_detail === void 0 ? void 0 : fee_detail.map(function (fee, index, array) {
|
|
62
62
|
var _a, _b;
|
|
63
|
-
var
|
|
63
|
+
var totalFeeInCurrency = array === null || array === void 0 ? void 0 : array.reduce(function (acc, fee_detail) {
|
|
64
64
|
var _a, _b;
|
|
65
65
|
if (((_a = fee_detail.currency) === null || _a === void 0 ? void 0 : _a.slug) === ((_b = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _b === void 0 ? void 0 : _b.slug)) {
|
|
66
66
|
return acc + fee_detail.fee_in_currency;
|
|
@@ -68,7 +68,7 @@ function Fees(props) {
|
|
|
68
68
|
return acc;
|
|
69
69
|
}, 0);
|
|
70
70
|
var balanceUseToPaidFee = getBalanceUseToPaidFee((_b = (_a = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : "");
|
|
71
|
-
var payable = balanceUseToPaidFee >=
|
|
71
|
+
var payable = balanceUseToPaidFee >= totalFeeInCurrency;
|
|
72
72
|
return __assign(__assign({}, fee), { isEnoughBalanceToPay: payable });
|
|
73
73
|
})) !== null && _b !== void 0 ? _b : []);
|
|
74
74
|
}, [feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail, getBalanceUseToPaidFee]);
|
|
@@ -78,48 +78,58 @@ function Fees(props) {
|
|
|
78
78
|
}, [feeCheckedBalance]);
|
|
79
79
|
(0, react_1.useEffect)(function () {
|
|
80
80
|
if (!isNotEnoughBalanceToPayFee) {
|
|
81
|
-
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(
|
|
81
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(true);
|
|
82
|
+
return;
|
|
82
83
|
}
|
|
83
|
-
|
|
84
|
-
|
|
84
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(false);
|
|
85
|
+
});
|
|
86
|
+
var isChargeFee = (0, react_1.useMemo)(function () {
|
|
87
|
+
return (feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd) && +(feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd) === 0;
|
|
88
|
+
}, [feesData]);
|
|
89
|
+
(0, react_1.useEffect)(function () {
|
|
90
|
+
if (!isChargeFee) {
|
|
91
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(true);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
var totalFeeInCurrency = (0, react_1.useMemo)(function () {
|
|
85
95
|
return feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_currency;
|
|
86
96
|
}, [feesData]);
|
|
87
|
-
return
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!isChargeFee && ((0, jsx_runtime_1.jsxs)(material_1.Accordion, __assign({ defaultExpanded: true }, rest, { disableGutters: true, sx: __assign(__assign({}, getStyled(feesStyle !== null && feesStyle !== void 0 ? feesStyle : FeesStyle.DEFAULT, theme)), sx), children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, { expandIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("arrow_down"), width: 8, height: 8 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
98
|
+
fontSize: theme.typography.fontSize11,
|
|
99
|
+
fontWeight: theme.typography.fontWeight500,
|
|
100
|
+
color: theme.palette.text.black,
|
|
101
|
+
}, children: "Total fees" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
102
|
+
borderTop: "1px dashed",
|
|
103
|
+
borderColor: theme.palette.border.accent,
|
|
104
|
+
flex: 1,
|
|
105
|
+
height: "1px",
|
|
106
|
+
width: "100%",
|
|
107
|
+
ml: theme.mixins.gaps.g8,
|
|
108
|
+
mr: theme.mixins.gaps.g8,
|
|
109
|
+
} }), (0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
110
|
+
fontSize: theme.typography.fontSize13,
|
|
111
|
+
fontWeight: theme.typography.fontWeight500,
|
|
112
|
+
color: theme.palette.text.black,
|
|
113
|
+
}, value: totalFeeInCurrency, unit: " ".concat(tokenSlug.toUpperCase()), disableTooltip: true }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "0.5rem" }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8, pt: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { alignItems: "stretch" }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, gap: theme.mixins.gaps.g8 }), children: feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.map(function (item, index) {
|
|
114
|
+
var _a, _b, _c, _d;
|
|
115
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
116
|
+
borderRight: "1px dashed ".concat(theme.palette.border.accent),
|
|
117
|
+
width: "1px",
|
|
118
|
+
height: "1rem",
|
|
119
|
+
pr: theme.mixins.gaps.g6,
|
|
120
|
+
} })), (0, jsx_runtime_1.jsx)(FeeDetails, { feeName: (_a = item.fee_type) === null || _a === void 0 ? void 0 : _a.name, fee_in_currency: item.fee_in_currency, fee_in_usd: item.fee_in_usd, currencyName: (_b = item.currency) === null || _b === void 0 ? void 0 : _b.name }, (_c = item.fee_type) === null || _c === void 0 ? void 0 : _c.name)] }, (_d = item.fee_type) === null || _d === void 0 ? void 0 : _d.name));
|
|
121
|
+
}) }) }), isNotEnoughBalanceToPayFee && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: "ⓘ Insufficient transaction fee!" })), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
122
|
+
borderColor: theme.palette.border.black16,
|
|
123
|
+
my: theme.mixins.gaps.g4,
|
|
124
|
+
} }), estimateReceive !== undefined && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
125
|
+
fontSize: theme.typography.fontSize11,
|
|
126
|
+
fontWeight: theme.typography.fontWeight500,
|
|
127
|
+
lineHeight: theme.typography.leading160,
|
|
128
|
+
}, children: "Receive amount estimated" }), (0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
129
|
+
fontSize: theme.typography.fontSize16,
|
|
130
|
+
fontWeight: theme.typography.fontWeight700,
|
|
131
|
+
color: theme.palette.text.black,
|
|
132
|
+
}, unit: " ".concat(tokenSlug.toUpperCase()), value: estimateReceive })] }))] }) })] }))) }));
|
|
123
133
|
}
|
|
124
134
|
exports.default = Fees;
|
|
125
135
|
var FeeDetails = function (_a) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { FeesProps } from "../Fees";
|
|
2
|
+
export declare enum FeesStyle {
|
|
3
|
+
DEFAULT = "default",
|
|
4
|
+
WITH_BACKGROUND = "withBackground"
|
|
5
|
+
}
|
|
6
|
+
export interface FeesAutoDebounceProps extends FeesProps {
|
|
7
|
+
setIsLoadingFee?: (isLoading: boolean) => void;
|
|
8
|
+
}
|
|
9
|
+
declare function Fees(props: FeesProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export default Fees;
|
|
@@ -0,0 +1,223 @@
|
|
|
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 __rest = (this && this.__rest) || function (s, e) {
|
|
15
|
+
var t = {};
|
|
16
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
17
|
+
t[p] = s[p];
|
|
18
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
19
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
20
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
21
|
+
t[p[i]] = s[p[i]];
|
|
22
|
+
}
|
|
23
|
+
return t;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.FeesStyle = void 0;
|
|
30
|
+
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
31
|
+
var material_1 = require("@mui/material");
|
|
32
|
+
var ThemeProvider_1 = require("../../../providers/ThemeProvider");
|
|
33
|
+
var Icon_1 = __importDefault(require("../Icon"));
|
|
34
|
+
var Text_1 = __importDefault(require("../Text"));
|
|
35
|
+
var Formatter_1 = __importDefault(require("../Formatter"));
|
|
36
|
+
var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
|
|
37
|
+
var react_1 = require("react");
|
|
38
|
+
var getIcon_1 = __importDefault(require("../../../utils/getIcon"));
|
|
39
|
+
var SvgPath_1 = require("../SvgPath");
|
|
40
|
+
var FeesStyle;
|
|
41
|
+
(function (FeesStyle) {
|
|
42
|
+
FeesStyle["DEFAULT"] = "default";
|
|
43
|
+
FeesStyle["WITH_BACKGROUND"] = "withBackground";
|
|
44
|
+
})(FeesStyle || (exports.FeesStyle = FeesStyle = {}));
|
|
45
|
+
function Fees(props) {
|
|
46
|
+
var sx = props.sx, amount = props.amount, feesData = props.feesData, isFeePaidByAmount = props.isFeePaidByAmount, tokenSlug = props.tokenSlug, setIsEnoughBalanceToPayFee = props.setIsEnoughBalanceToPayFee, feesStyle = props.feesStyle, estimateReceive = props.estimateReceive, rest = __rest(props, ["sx", "amount", "feesData", "isFeePaidByAmount", "tokenSlug", "setIsEnoughBalanceToPayFee", "feesStyle", "estimateReceive"]);
|
|
47
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
48
|
+
// const feesData = parsePropsData<FeesDataType>(feesDataString);
|
|
49
|
+
var tokens = (0, useWalletData_1.default)().tokens;
|
|
50
|
+
var getBalanceUseToPaidFee = (0, react_1.useCallback)(function (tokenSlugMustBePaidFee) {
|
|
51
|
+
var _a;
|
|
52
|
+
if (isFeePaidByAmount && tokenSlugMustBePaidFee === tokenSlug) {
|
|
53
|
+
return amount;
|
|
54
|
+
}
|
|
55
|
+
var tokenMustBePaidFee = tokens === null || tokens === void 0 ? void 0 : tokens.find(function (token) { return token.currency_slug === tokenSlugMustBePaidFee; });
|
|
56
|
+
return +((_a = tokenMustBePaidFee === null || tokenMustBePaidFee === void 0 ? void 0 : tokenMustBePaidFee.current_value) !== null && _a !== void 0 ? _a : 0);
|
|
57
|
+
}, [isFeePaidByAmount, amount, tokenSlug, tokens]);
|
|
58
|
+
var feeCheckedBalance = (0, react_1.useMemo)(function () {
|
|
59
|
+
var _a, _b;
|
|
60
|
+
var fee_detail = (_a = feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail) !== null && _a !== void 0 ? _a : [];
|
|
61
|
+
return ((_b = fee_detail === null || fee_detail === void 0 ? void 0 : fee_detail.map(function (fee, index, array) {
|
|
62
|
+
var _a, _b;
|
|
63
|
+
var totalFeeInCurrency = array === null || array === void 0 ? void 0 : array.reduce(function (acc, fee_detail) {
|
|
64
|
+
var _a, _b;
|
|
65
|
+
if (((_a = fee_detail.currency) === null || _a === void 0 ? void 0 : _a.slug) === ((_b = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _b === void 0 ? void 0 : _b.slug)) {
|
|
66
|
+
return acc + fee_detail.fee_in_currency;
|
|
67
|
+
}
|
|
68
|
+
return acc;
|
|
69
|
+
}, 0);
|
|
70
|
+
var balanceUseToPaidFee = getBalanceUseToPaidFee((_b = (_a = fee === null || fee === void 0 ? void 0 : fee.currency) === null || _a === void 0 ? void 0 : _a.slug) !== null && _b !== void 0 ? _b : "");
|
|
71
|
+
var payable = balanceUseToPaidFee >= totalFeeInCurrency;
|
|
72
|
+
return __assign(__assign({}, fee), { isEnoughBalanceToPay: payable });
|
|
73
|
+
})) !== null && _b !== void 0 ? _b : []);
|
|
74
|
+
}, [feesData === null || feesData === void 0 ? void 0 : feesData.fee_detail, getBalanceUseToPaidFee]);
|
|
75
|
+
var isNotEnoughBalanceToPayFee = (0, react_1.useMemo)(function () {
|
|
76
|
+
var isNotEnoughBalanceToPay = feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.some(function (fee) { return !fee.isEnoughBalanceToPay; });
|
|
77
|
+
return isNotEnoughBalanceToPay;
|
|
78
|
+
}, [feeCheckedBalance]);
|
|
79
|
+
(0, react_1.useEffect)(function () {
|
|
80
|
+
if (!isNotEnoughBalanceToPayFee) {
|
|
81
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(true);
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(false);
|
|
85
|
+
});
|
|
86
|
+
var isChargeFee = (0, react_1.useMemo)(function () {
|
|
87
|
+
return (feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd) && +(feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_usd) === 0;
|
|
88
|
+
}, [feesData]);
|
|
89
|
+
(0, react_1.useEffect)(function () {
|
|
90
|
+
if (!isChargeFee) {
|
|
91
|
+
setIsEnoughBalanceToPayFee === null || setIsEnoughBalanceToPayFee === void 0 ? void 0 : setIsEnoughBalanceToPayFee(true);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
var totalFeeInCurrency = (0, react_1.useMemo)(function () {
|
|
95
|
+
return feesData === null || feesData === void 0 ? void 0 : feesData.fee_in_currency;
|
|
96
|
+
}, [feesData]);
|
|
97
|
+
return ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: !!isChargeFee && ((0, jsx_runtime_1.jsxs)(material_1.Accordion, __assign({ defaultExpanded: true }, rest, { disableGutters: true, sx: __assign(__assign({}, getStyled(feesStyle !== null && feesStyle !== void 0 ? feesStyle : FeesStyle.DEFAULT, theme)), sx), children: [(0, jsx_runtime_1.jsx)(material_1.AccordionSummary, { expandIcon: (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("arrow_down"), width: 8, height: 8 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "100%" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
98
|
+
fontSize: theme.typography.fontSize11,
|
|
99
|
+
fontWeight: theme.typography.fontWeight500,
|
|
100
|
+
color: theme.palette.text.black,
|
|
101
|
+
}, children: "Total fees" }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
102
|
+
borderTop: "1px dashed",
|
|
103
|
+
borderColor: theme.palette.border.accent,
|
|
104
|
+
flex: 1,
|
|
105
|
+
height: "1px",
|
|
106
|
+
width: "100%",
|
|
107
|
+
ml: theme.mixins.gaps.g8,
|
|
108
|
+
mr: theme.mixins.gaps.g8,
|
|
109
|
+
} }), (0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
110
|
+
fontSize: theme.typography.fontSize13,
|
|
111
|
+
fontWeight: theme.typography.fontWeight500,
|
|
112
|
+
color: theme.palette.text.black,
|
|
113
|
+
}, value: totalFeeInCurrency, unit: " ".concat(tokenSlug.toUpperCase()), disableTooltip: true }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { width: "0.5rem" }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g8, pt: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { alignItems: "stretch" }), children: (0, jsx_runtime_1.jsx)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1, gap: theme.mixins.gaps.g8 }), children: feeCheckedBalance === null || feeCheckedBalance === void 0 ? void 0 : feeCheckedBalance.map(function (item, index) {
|
|
114
|
+
var _a, _b, _c, _d;
|
|
115
|
+
return ((0, jsx_runtime_1.jsxs)(react_1.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
|
|
116
|
+
borderRight: "1px dashed ".concat(theme.palette.border.accent),
|
|
117
|
+
width: "1px",
|
|
118
|
+
height: "1rem",
|
|
119
|
+
pr: theme.mixins.gaps.g6,
|
|
120
|
+
} })), (0, jsx_runtime_1.jsx)(FeeDetails, { feeName: (_a = item.fee_type) === null || _a === void 0 ? void 0 : _a.name, fee_in_currency: item.fee_in_currency, fee_in_usd: item.fee_in_usd, currencyName: (_b = item.currency) === null || _b === void 0 ? void 0 : _b.name }, (_c = item.fee_type) === null || _c === void 0 ? void 0 : _c.name)] }, (_d = item.fee_type) === null || _d === void 0 ? void 0 : _d.name));
|
|
121
|
+
}) }) }), isNotEnoughBalanceToPayFee && ((0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: "ⓘ Insufficient transaction fee!" })), (0, jsx_runtime_1.jsx)(material_1.Divider, { sx: {
|
|
122
|
+
borderColor: theme.palette.border.black16,
|
|
123
|
+
my: theme.mixins.gaps.g4,
|
|
124
|
+
} }), estimateReceive !== undefined && ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
125
|
+
fontSize: theme.typography.fontSize11,
|
|
126
|
+
fontWeight: theme.typography.fontWeight500,
|
|
127
|
+
lineHeight: theme.typography.leading160,
|
|
128
|
+
}, children: "Receive amount estimated" }), (0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
129
|
+
fontSize: theme.typography.fontSize16,
|
|
130
|
+
fontWeight: theme.typography.fontWeight700,
|
|
131
|
+
color: theme.palette.text.black,
|
|
132
|
+
}, unit: " ".concat(tokenSlug.toUpperCase()), value: estimateReceive })] }))] }) })] }))) }));
|
|
133
|
+
}
|
|
134
|
+
exports.default = Fees;
|
|
135
|
+
var FeeDetails = function (_a) {
|
|
136
|
+
var feeName = _a.feeName, fee_in_currency = _a.fee_in_currency, fee_in_usd = _a.fee_in_usd, currencyName = _a.currencyName;
|
|
137
|
+
var theme = (0, ThemeProvider_1.useTheme)();
|
|
138
|
+
return ((0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g4, alignItems: "center", justifyContent: "space-between" }), children: [(0, jsx_runtime_1.jsx)(material_1.SvgIcon, { sx: { width: 14, height: 14 }, children: SvgPath_1.IC_TIMELINE_DOT }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
|
|
139
|
+
fontSize: theme.typography.fontSize11,
|
|
140
|
+
fontWeight: theme.typography.fontWeight500,
|
|
141
|
+
lineHeight: theme.typography.leading160,
|
|
142
|
+
color: theme.palette.text.accent,
|
|
143
|
+
pl: theme.mixins.gaps.g12,
|
|
144
|
+
whiteSpace: "nowrap",
|
|
145
|
+
flex: 1,
|
|
146
|
+
}, children: feeName }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { width: "fit-content", alignItems: "flex-end" }), children: [(0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
147
|
+
fontSize: theme.typography.fontSize13,
|
|
148
|
+
fontWeight: theme.typography.fontWeight500,
|
|
149
|
+
color: theme.palette.text.black,
|
|
150
|
+
}, value: fee_in_currency, unit: " ".concat(currencyName), disableTooltip: true }), (0, jsx_runtime_1.jsx)(Formatter_1.default, { sx: {
|
|
151
|
+
fontSize: theme.typography.fontSize11,
|
|
152
|
+
fontWeight: theme.typography.fontWeight500,
|
|
153
|
+
color: theme.palette.text.black,
|
|
154
|
+
}, value: fee_in_usd, unit: " $" })] })] }));
|
|
155
|
+
};
|
|
156
|
+
var getStyled = function (style, theme) {
|
|
157
|
+
switch (style) {
|
|
158
|
+
case FeesStyle.DEFAULT:
|
|
159
|
+
return {
|
|
160
|
+
"&.MuiAccordion-root": {
|
|
161
|
+
backgroundColor: "transparent",
|
|
162
|
+
margin: 0,
|
|
163
|
+
padding: 0,
|
|
164
|
+
borderRadius: 0,
|
|
165
|
+
border: "none",
|
|
166
|
+
boxShadow: "none",
|
|
167
|
+
},
|
|
168
|
+
"&.MuiAccordion-root::before": {
|
|
169
|
+
display: "none",
|
|
170
|
+
},
|
|
171
|
+
"& .MuiAccordionSummary-root": {
|
|
172
|
+
margin: 0,
|
|
173
|
+
padding: 0,
|
|
174
|
+
minHeight: 0,
|
|
175
|
+
},
|
|
176
|
+
"& .MuiAccordionSummary-content": {
|
|
177
|
+
margin: 0,
|
|
178
|
+
padding: 0,
|
|
179
|
+
display: "inline-block",
|
|
180
|
+
width: "100%",
|
|
181
|
+
},
|
|
182
|
+
"& .MuiAccordionSummary-content.Mui-expanded": {
|
|
183
|
+
margin: 0,
|
|
184
|
+
},
|
|
185
|
+
"& .MuiAccordionDetails-root": {
|
|
186
|
+
margin: 0,
|
|
187
|
+
padding: 0,
|
|
188
|
+
},
|
|
189
|
+
};
|
|
190
|
+
case FeesStyle.WITH_BACKGROUND:
|
|
191
|
+
return {
|
|
192
|
+
"&.MuiAccordion-root": {
|
|
193
|
+
backgroundColor: theme.palette.background.tertiary,
|
|
194
|
+
margin: 0,
|
|
195
|
+
padding: theme.mixins.customPadding.p16,
|
|
196
|
+
borderRadius: theme.mixins.customRadius.r16,
|
|
197
|
+
border: "none",
|
|
198
|
+
boxShadow: "none",
|
|
199
|
+
},
|
|
200
|
+
"&.MuiAccordion-root::before": {
|
|
201
|
+
display: "none",
|
|
202
|
+
},
|
|
203
|
+
"& .MuiAccordionSummary-root": {
|
|
204
|
+
margin: 0,
|
|
205
|
+
padding: 0,
|
|
206
|
+
minHeight: 0,
|
|
207
|
+
},
|
|
208
|
+
"& .MuiAccordionSummary-content": {
|
|
209
|
+
margin: 0,
|
|
210
|
+
padding: 0,
|
|
211
|
+
display: "inline-block",
|
|
212
|
+
width: "100%",
|
|
213
|
+
},
|
|
214
|
+
"& .MuiAccordionSummary-content.Mui-expanded": {
|
|
215
|
+
margin: 0,
|
|
216
|
+
},
|
|
217
|
+
"& .MuiAccordionDetails-root": {
|
|
218
|
+
margin: 0,
|
|
219
|
+
padding: 0,
|
|
220
|
+
},
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
};
|
|
@@ -156,7 +156,7 @@ exports.default = (0, react_1.memo)(function ShareAction(_a) {
|
|
|
156
156
|
display: "flex",
|
|
157
157
|
color: "#fff",
|
|
158
158
|
aspectRatio: "1 / 1",
|
|
159
|
-
background: "#
|
|
159
|
+
background: "#1C461D",
|
|
160
160
|
}, children: (0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "20", viewBox: "0 0 21 20", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M3.375 13.75V15.625C3.375 16.1223 3.57254 16.5992 3.92417 16.9508C4.27581 17.3025 4.75272 17.5 5.25 17.5H16.5C16.9973 17.5 17.4742 17.3025 17.8258 16.9508C18.1775 16.5992 18.375 16.1223 18.375 15.625V13.75M14.625 10L10.875 13.75M10.875 13.75L7.125 10M10.875 13.75V2.5", stroke: "white", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) }) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, style_1.content02), color: (_b = palette_1.palette.positive) === null || _b === void 0 ? void 0 : _b.main, children: "Save photo" })] }), (0, jsx_runtime_1.jsxs)(material_1.Grid2, { display: "flex", flexDirection: "column", gap: "0.375rem", alignItems: "center", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { color: "primary", onClick: handleCopyLink, sx: {
|
|
161
161
|
borderRadius: "0.75rem",
|
|
162
162
|
justifyContent: "center",
|
|
@@ -166,6 +166,6 @@ exports.default = (0, react_1.memo)(function ShareAction(_a) {
|
|
|
166
166
|
display: "flex",
|
|
167
167
|
color: "#fff",
|
|
168
168
|
aspectRatio: "1 / 1",
|
|
169
|
-
background: "#
|
|
169
|
+
background: "#1C461D",
|
|
170
170
|
}, children: copySuccess ? ((0, jsx_runtime_1.jsx)(exports.SuccessAnimation, {})) : ((0, jsx_runtime_1.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "21", height: "20", viewBox: "0 0 21 20", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M11.6167 7.24002C12.1582 7.49857 12.6298 7.8833 12.9918 8.36189C13.3538 8.84048 13.5956 9.39895 13.697 9.9904C13.7985 10.5818 13.7564 11.189 13.5745 11.7608C13.3926 12.3327 13.0762 12.8525 12.6517 13.2767L8.90169 17.0267C8.19842 17.73 7.24459 18.125 6.25002 18.125C5.25546 18.125 4.30162 17.73 3.59836 17.0267C2.89509 16.3234 2.5 15.3696 2.5 14.375C2.5 13.3805 2.89509 12.4266 3.59836 11.7234L5.06252 10.2592M16.1875 9.74086L17.6517 8.27669C18.355 7.57342 18.75 6.61959 18.75 5.62502C18.75 4.63046 18.355 3.67662 17.6517 2.97336C16.9484 2.27009 15.9946 1.875 15 1.875C14.0055 1.875 13.0516 2.27009 12.3484 2.97336L8.59836 6.72336C8.17389 7.14752 7.85741 7.66736 7.67551 8.23921C7.49361 8.81105 7.45159 9.4182 7.553 10.0096C7.6544 10.6011 7.89626 11.1596 8.25827 11.6382C8.62027 12.1167 9.09183 12.5015 9.63336 12.76", stroke: "white", strokeWidth: "1.25", strokeLinecap: "round", strokeLinejoin: "round" }) })) }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, style_1.content02), color: (_c = palette_1.palette.positive) === null || _c === void 0 ? void 0 : _c.main, children: copySuccess ? "Copied!" : "Copy link" })] })] }));
|
|
171
171
|
});
|