tek-wallet 0.0.533 → 0.0.535

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.
@@ -102,7 +102,6 @@ var Icon_1 = __importDefault(require("../Icon"));
102
102
  var Fees_1 = __importDefault(require("../Fees"));
103
103
  var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
104
104
  var type_1 = require("../../../services/axios/get-activities-service/type");
105
- var Activities_1 = __importDefault(require("../Activities"));
106
105
  var validate_wallet_address_service_1 = __importDefault(require("../../../services/axios/validate-wallet-address-service"));
107
106
  var type_2 = require("../../../services/axios/validate-wallet-address-service/type");
108
107
  var SendExternalTokenError;
@@ -127,7 +126,6 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
127
126
  var _f = (0, react_1.useState)(false), isValidatingAddress = _f[0], setIsValidatingAddress = _f[1];
128
127
  var _g = (0, react_1.useState)(props.initFeeData), estimateFee = _g[0], setEstimateFee = _g[1];
129
128
  var _h = (0, react_1.useState)(false), isLoadingEstimateFee = _h[0], setIsLoadingEstimateFee = _h[1];
130
- var activitiesRef = (0, react_1.useRef)(null);
131
129
  var amount = props.sendExternalData.amount;
132
130
  var network = props.sendExternalData.network;
133
131
  var memo = props.sendExternalData.memo;
@@ -229,10 +227,6 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
229
227
  (_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
230
228
  setButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
231
229
  (_b = props.onSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
232
- setTimeout(function () {
233
- var _a;
234
- (_a = activitiesRef.current) === null || _a === void 0 ? void 0 : _a.openTab(0);
235
- }, 200);
236
230
  }
237
231
  else {
238
232
  throw new Error("Send external failed");
@@ -272,14 +266,14 @@ var SendExternalToken = (0, react_1.forwardRef)(function (props, ref) {
272
266
  return undefined;
273
267
  return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
274
268
  }, [estimateFee, amount]);
275
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
276
- wordBreak: "break-all",
277
- }, children: toAddress }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
278
- fontWeight: theme.typography.fontWeight600,
279
- fontSize: theme.typography.fontSize16,
280
- }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress
281
- ? Button_1.BUTTON_STATUS.DISABLED
282
- : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }), (0, jsx_runtime_1.jsx)(Activities_1.default, { ref: activitiesRef })] }) }));
269
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
270
+ wordBreak: "break-all",
271
+ }, children: toAddress }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Network", value: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6, ml: "auto" }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { width: 20, src: network === null || network === void 0 ? void 0 : network.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: network === null || network === void 0 ? void 0 : network.name })] }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), !!memo && (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Memo", value: memo }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
272
+ fontWeight: theme.typography.fontWeight600,
273
+ fontSize: theme.typography.fontSize16,
274
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendExternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress
275
+ ? Button_1.BUTTON_STATUS.DISABLED
276
+ : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
283
277
  });
284
278
  SendExternalToken.displayName = "SendExternalToken";
285
279
  exports.default = SendExternalToken;
@@ -101,7 +101,6 @@ var send_internal_service_1 = __importDefault(require("../../../services/axios/s
101
101
  var Fees_1 = __importDefault(require("../Fees"));
102
102
  var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
103
103
  var type_1 = require("../../../services/axios/get-activities-service/type");
104
- var Activities_1 = __importDefault(require("../Activities"));
105
104
  var validate_wallet_address_service_1 = __importDefault(require("../../../services/axios/validate-wallet-address-service"));
106
105
  var type_2 = require("../../../services/axios/validate-wallet-address-service/type");
107
106
  var CopyTextComponent_1 = __importDefault(require("../CopyTextComponent"));
@@ -127,7 +126,6 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
127
126
  var _f = (0, react_1.useState)(false), isValidatingAddress = _f[0], setIsValidatingAddress = _f[1];
128
127
  var _g = (0, react_1.useState)(props.initFeeData), estimateFee = _g[0], setEstimateFee = _g[1];
129
128
  var _h = (0, react_1.useState)(false), isLoadingEstimateFee = _h[0], setIsLoadingEstimateFee = _h[1];
130
- var activitiesRef = (0, react_1.useRef)(null);
131
129
  var amount = props.sendInternalData.amount;
132
130
  var toAddress = props.sendInternalData.to_address;
133
131
  var tokenSlug = props.sendInternalData.currency_slug;
@@ -227,10 +225,6 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
227
225
  (_a = confirmLayoutDrawerRef.current) === null || _a === void 0 ? void 0 : _a.close();
228
226
  setButtonStatus(Button_1.BUTTON_STATUS.ENABLED);
229
227
  (_b = props.onSuccess) === null || _b === void 0 ? void 0 : _b.call(props, response);
230
- setTimeout(function () {
231
- var _a;
232
- (_a = activitiesRef.current) === null || _a === void 0 ? void 0 : _a.openTab(0);
233
- }, 200);
234
228
  }
235
229
  else {
236
230
  throw new Error("Send internal failed");
@@ -270,14 +264,14 @@ var SendInternalToken = (0, react_1.forwardRef)(function (props, ref) {
270
264
  return undefined;
271
265
  return +amount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
272
266
  }, [estimateFee, amount]);
273
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: toAddress, children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
274
- wordBreak: "break-all",
275
- }, children: toAddress }) }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
276
- fontWeight: theme.typography.fontWeight600,
277
- fontSize: theme.typography.fontSize16,
278
- }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress
279
- ? Button_1.BUTTON_STATUS.DISABLED
280
- : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }), (0, jsx_runtime_1.jsx)(Activities_1.default, { ref: activitiesRef })] }) }));
267
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Recipient address", value: (0, jsx_runtime_1.jsx)(CopyTextComponent_1.default, { value: toAddress, children: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
268
+ wordBreak: "break-all",
269
+ }, children: toAddress }) }), valueDescription: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.validationError), children: errorAddress }) }), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Amount", value: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: tokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
270
+ fontWeight: theme.typography.fontWeight600,
271
+ fontSize: theme.typography.fontSize16,
272
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSendInternalToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee || isValidatingAddress || errorAddress
273
+ ? Button_1.BUTTON_STATUS.DISABLED
274
+ : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
281
275
  });
282
276
  SendInternalToken.displayName = "SendInternalToken";
283
277
  exports.default = SendInternalToken;
@@ -99,7 +99,6 @@ var useWalletData_1 = __importDefault(require("../../../hooks/useWalletData"));
99
99
  var Fees_1 = __importDefault(require("../Fees"));
100
100
  var get_est_fee_service_1 = __importDefault(require("../../../services/axios/get-est-fee-service"));
101
101
  var type_1 = require("../../../services/axios/get-activities-service/type");
102
- var Activities_1 = __importDefault(require("../Activities"));
103
102
  var useSwapData_1 = __importDefault(require("../../../hooks/useSwapData"));
104
103
  var swap_service_1 = __importDefault(require("../../../services/axios/swap-service"));
105
104
  var Icon_1 = __importDefault(require("../Icon"));
@@ -133,9 +132,10 @@ var SwapToken = (0, react_1.forwardRef)(function (props, ref) {
133
132
  return fromTokens === null || fromTokens === void 0 ? void 0 : fromTokens.find(function (token) { return token.slug === fromTokenSlug; });
134
133
  }, [fromTokenSlug, fromTokens]);
135
134
  var toToken = (0, react_1.useMemo)(function () {
135
+ var _a;
136
136
  if (!fromToken)
137
137
  return undefined;
138
- return fromToken.outputs.find(function (token) { return token.slug === toTokenSlug; });
138
+ return (_a = fromToken.outputs) === null || _a === void 0 ? void 0 : _a.find(function (token) { return token.slug === toTokenSlug; });
139
139
  }, [toTokenSlug, fromToken]);
140
140
  var toAmount = (0, react_1.useMemo)(function () {
141
141
  if (!toToken)
@@ -258,10 +258,10 @@ var SwapToken = (0, react_1.forwardRef)(function (props, ref) {
258
258
  return undefined;
259
259
  return +toAmount - +(estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeInCurrency);
260
260
  }, [estimateFee, toAmount]);
261
- return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsxs)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { alignItems: "center", gap: 0 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: fromToken === null || fromToken === void 0 ? void 0 : fromToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: fromToken === null || fromToken === void 0 ? void 0 : fromToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) })] }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("swap-one-direction"), width: 32 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: toToken === null || toToken === void 0 ? void 0 : toToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: toToken === null || toToken === void 0 ? void 0 : toToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toAmount, unit: " ".concat(toToken === null || toToken === void 0 ? void 0 : toToken.name) }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12 }), theme.mixins.valueDescription), { width: "100%", justifyContent: "center" }), children: ["1 ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.name, " ~ ", toToken === null || toToken === void 0 ? void 0 : toToken.rate, " ", toToken === null || toToken === void 0 ? void 0 : toToken.name] }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: fromTokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
262
- fontWeight: theme.typography.fontWeight600,
263
- fontSize: theme.typography.fontSize16,
264
- }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSwapToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }), (0, jsx_runtime_1.jsx)(Activities_1.default, { ref: activitiesRef })] }) }));
261
+ return ((0, jsx_runtime_1.jsx)(RequireConnect_1.default, { children: (0, jsx_runtime_1.jsx)(ConfirmLayout_1.default, { onOpen: validateAll, ref: confirmLayoutDrawerRef, action: transactionSlug, trigger: props.children, children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { gap: theme.mixins.gaps.g12 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.paper), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.paper), { alignItems: "center", gap: 0 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: fromToken === null || fromToken === void 0 ? void 0 : fromToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: fromToken === null || fromToken === void 0 ? void 0 : fromToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) })] }), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("swap-one-direction"), width: 32 }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g16 }), children: [(0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g6 }), children: [(0, jsx_runtime_1.jsx)(Icon_1.default, { src: toToken === null || toToken === void 0 ? void 0 : toToken.icon }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: toToken === null || toToken === void 0 ? void 0 : toToken.name })] }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.bigValue), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: toAmount, unit: " ".concat(toToken === null || toToken === void 0 ? void 0 : toToken.name) }) })] })] }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign(__assign(__assign({}, theme.mixins.row), { gap: theme.mixins.gaps.g12 }), theme.mixins.valueDescription), { width: "100%", justifyContent: "center" }), children: ["1 ", fromToken === null || fromToken === void 0 ? void 0 : fromToken.name, " ~ ", toToken === null || toToken === void 0 ? void 0 : toToken.rate, " ", toToken === null || toToken === void 0 ? void 0 : toToken.name] }), ((_a = estimateFee === null || estimateFee === void 0 ? void 0 : estimateFee.feeDetail) === null || _a === void 0 ? void 0 : _a.length) && !!amount && ((0, jsx_runtime_1.jsx)(Fees_1.default, { isFeePaidByAmount: true, feesData: JSON.stringify(estimateFee), amount: +amount, tokenSlug: fromTokenSlug })), (0, jsx_runtime_1.jsx)(LineValue_1.default, { field: "Receive amount estimated", value: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
262
+ fontWeight: theme.typography.fontWeight600,
263
+ fontSize: theme.typography.fontSize16,
264
+ }, children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: estimateReceive, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) }) }) }), !!error && ((0, jsx_runtime_1.jsxs)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.validationError), { mt: theme.mixins.customMargin.m6 }), children: [error, " ", !!errorAmount && (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: errorAmount, unit: " ".concat(token === null || token === void 0 ? void 0 : token.name) })] }))] }), (0, jsx_runtime_1.jsx)(ConfirmByPasscode_1.default, { action: transactionSlug, onConfirmSuccess: handleSwapToken, children: (0, jsx_runtime_1.jsx)(Button_1.default.Primary, { status: !!error || isLoadingEstimateFee ? Button_1.BUTTON_STATUS.DISABLED : buttonStatus, sx: { width: "100%" }, children: "Confirm" }) })] }) }) }));
265
265
  });
266
266
  SwapToken.displayName = "SwapToken";
267
267
  exports.default = SwapToken;
@@ -1,7 +1,9 @@
1
1
  import { NotificationType } from "../providers/RealtimeProvider/type";
2
2
  import { Transaction } from "../services/axios/get-activities-service/type";
3
- export type EventHandler = (messageEvent: Transaction) => NotificationType | undefined;
3
+ type ShowActivities = () => void;
4
+ export type EventHandler = (messageEvent: Transaction, showActivities?: ShowActivities) => NotificationType | undefined;
4
5
  export type EventHandlerHookType = {
5
6
  eventHandler: EventHandler;
6
7
  };
7
8
  export declare const useEventHandler: () => EventHandlerHookType;
9
+ export {};
@@ -16,7 +16,7 @@ var useEventHandler = function () {
16
16
  var updateActivities = (0, useActivities_1.default)().updateActivities;
17
17
  var updateWalletDetail = (0, useWalletData_1.default)().updateWalletDetail;
18
18
  var _a = (0, useWithdrawData_1.default)(), updateWithdrawToken = _a.updateWithdrawToken, updateSendInternalToken = _a.updateSendInternalToken;
19
- var updateData = (0, react_1.useCallback)(function (transactionType) {
19
+ var updateData = (0, react_1.useCallback)(function (transactionType, showActivities) {
20
20
  var typeSlug = transactionType.slug;
21
21
  console.warn("🚀 ~ updateData ~ typeSlug:", typeSlug);
22
22
  switch (typeSlug) {
@@ -29,6 +29,7 @@ var useEventHandler = function () {
29
29
  });
30
30
  updateWalletDetail();
31
31
  updateWithdrawToken();
32
+ showActivities === null || showActivities === void 0 ? void 0 : showActivities();
32
33
  break;
33
34
  case type_1.TransactionSlug.TransferInternal:
34
35
  updateActivities({
@@ -38,12 +39,13 @@ var useEventHandler = function () {
38
39
  });
39
40
  updateWalletDetail();
40
41
  updateSendInternalToken();
42
+ showActivities === null || showActivities === void 0 ? void 0 : showActivities();
41
43
  break;
42
44
  default:
43
45
  break;
44
46
  }
45
47
  }, [updateActivities, updateWalletDetail, updateWithdrawToken, updateSendInternalToken]);
46
- var handler = function (messageEvent) {
48
+ var handler = function (messageEvent, showActivities) {
47
49
  if (!messageEvent)
48
50
  return undefined;
49
51
  var type = messageEvent.transaction_type;
@@ -65,7 +67,7 @@ var useEventHandler = function () {
65
67
  default:
66
68
  notificationType = "info";
67
69
  }
68
- updateData(type);
70
+ updateData(type, showActivities);
69
71
  return {
70
72
  message: ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: { textTransform: "capitalize" }, children: type === null || type === void 0 ? void 0 : type.name }), " ", (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: amount, unit: " ".concat(currency) }), " is ", status] })),
71
73
  type: notificationType,
@@ -7,17 +7,23 @@ var jsx_runtime_1 = require("react/jsx-runtime");
7
7
  var react_1 = require("react");
8
8
  var useEventHandler_1 = require("../../hooks/useEventHandler");
9
9
  var useRealtime_1 = __importDefault(require("../../hooks/useRealtime"));
10
+ var Activities_1 = __importDefault(require("../../components/ui/Activities"));
10
11
  function EventHandlerProvider(props) {
11
12
  var eventHandler = (0, useEventHandler_1.useEventHandler)().eventHandler;
12
13
  var _a = (0, useRealtime_1.default)(), pushNotification = _a.pushNotification, transaction = _a.transaction;
14
+ var activitiesRef = (0, react_1.useRef)(null);
15
+ var showActivities = (0, react_1.useCallback)(function () {
16
+ var _a;
17
+ (_a = activitiesRef.current) === null || _a === void 0 ? void 0 : _a.openTab(0);
18
+ }, []);
13
19
  (0, react_1.useEffect)(function () {
14
20
  if (!eventHandler || !transaction)
15
21
  return;
16
- var theMessage = eventHandler(transaction);
22
+ var theMessage = eventHandler(transaction, showActivities);
17
23
  if (theMessage) {
18
24
  pushNotification(theMessage);
19
25
  }
20
- }, [transaction]);
21
- return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: props.children });
26
+ }, [eventHandler, pushNotification, showActivities, transaction]);
27
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [props.children, (0, jsx_runtime_1.jsx)(Activities_1.default, { ref: activitiesRef })] }));
22
28
  }
23
29
  exports.default = EventHandlerProvider;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.533",
3
+ "version": "0.0.535",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -80,4 +80,4 @@
80
80
  "type": "git",
81
81
  "url": "https://github.com/TheHappyLife/tek-wallet"
82
82
  }
83
- }
83
+ }