tek-wallet 0.0.380 → 0.0.382

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.
@@ -44,17 +44,22 @@ function Fees(props) {
44
44
  backgroundColor: "transparent",
45
45
  margin: 0,
46
46
  borderRadius: theme.mixins.theBorderRadius.r12,
47
+ }, "&.MuiAccordion-root::before": {
48
+ display: "none",
47
49
  }, "& .MuiAccordionSummary-root": {
48
50
  paddingLeft: theme.mixins.customPadding.p12,
49
51
  paddingRight: theme.mixins.customPadding.p12,
50
52
  }, "& .MuiAccordionSummary-content": {
53
+ display: "inline-block",
54
+ width: "100%",
55
+ }, "& .MuiAccordionSummary-content.Mui-expanded": {
51
56
  marginTop: theme.mixins.customMargin.m12,
52
57
  marginBottom: theme.mixins.customMargin.m12,
53
58
  }, "& .MuiAccordionDetails-root": {
54
59
  paddingLeft: theme.mixins.customPadding.p12,
55
60
  paddingRight: theme.mixins.customPadding.p12,
56
- } }, 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: 20 }), children: (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign({}, theme.mixins.row), children: [(0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.fieldTitle), children: "Total fees" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign({}, theme.mixins.value), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1000 }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(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), { width: "fit-content", gap: 1 }), children: [1, 2, 3].map(function (item, index) { return ((0, jsx_runtime_1.jsxs)(jsx_runtime_2.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
57
- borderRight: "1px dashed ".concat(theme.palette.border.black16),
61
+ } }, 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: 20 }), 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: __assign({}, theme.mixins.fieldTitle), children: "Total fees" }), (0, jsx_runtime_1.jsx)(Text_1.default, { sx: __assign(__assign({}, theme.mixins.value), { ml: "auto" }), children: (0, jsx_runtime_1.jsx)(Formatter_1.default, { value: 1000 }) })] }) }), (0, jsx_runtime_1.jsx)(material_1.AccordionDetails, { children: (0, jsx_runtime_1.jsxs)(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), { width: "fit-content", gap: theme.mixins.gaps.g8, alignItems: "center" }), children: [1, 2, 3].map(function (item, index) { return ((0, jsx_runtime_1.jsxs)(jsx_runtime_2.Fragment, { children: [index !== 0 && ((0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
62
+ borderRight: "1px dashed ".concat(theme.palette.border.white24),
58
63
  flex: 1,
59
64
  } })), (0, jsx_runtime_1.jsx)(Icon_1.default, { src: (0, getIcon_1.default)("timeline_dot"), width: 16 })] }, item)); }) }), (0, jsx_runtime_1.jsxs)(material_1.Box, { sx: __assign(__assign({}, theme.mixins.column), { flex: 1 }), children: [(0, jsx_runtime_1.jsx)(FeeDetail, { feeName: "Fee 1", value: 1000 }), (0, jsx_runtime_1.jsx)(FeeDetail, { feeName: "Fee 2", value: 1000 }), (0, jsx_runtime_1.jsx)(FeeDetail, { feeName: "Fee 3", value: 1000 })] })] }) })] })));
60
65
  }
@@ -144,6 +144,7 @@ var AmountError;
144
144
  AmountError["MIN_LIMIT"] = "The minimum amount is";
145
145
  })(AmountError || (exports.AmountError = AmountError = {}));
146
146
  var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
147
+ var swiperKey = (0, react_1.useId)();
147
148
  var drawerRef = (0, react_1.useRef)(null);
148
149
  var swiperRef = (0, react_1.useRef)(null);
149
150
  var theme = (0, material_1.useTheme)();
@@ -151,7 +152,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
151
152
  var _b = (0, react_1.useState)(), selectedToken = _b[0], setSelectedToken = _b[1];
152
153
  var _c = (0, react_1.useState)(), selectedNetwork = _c[0], setSelectedNetwork = _c[1];
153
154
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
154
- var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken;
155
+ var _d = (0, useWithdrawData_1.default)(), withdrawTokens = _d.withdrawTokens, updateWithdrawToken = _d.updateWithdrawToken, updateSendInternalToken = _d.updateSendInternalToken;
155
156
  var _e = (0, react_1.useState)(), infoDialogContent = _e[0], setInfoDialogContent = _e[1];
156
157
  var _f = (0, react_1.useState)(""), amount = _f[0], setAmount = _f[1];
157
158
  var _g = (0, react_1.useState)(undefined), memo = _g[0], setMemo = _g[1];
@@ -467,7 +468,8 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
467
468
  }
468
469
  if (!!(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address)) {
469
470
  setRecipientAddressInternal(validateWalletAddress === null || validateWalletAddress === void 0 ? void 0 : validateWalletAddress.master_wallet_address);
470
- if (isReceiveInternal) {
471
+ if (isReceiveInternal ||
472
+ selectedMethod === SendMethods.TRANSFER_INTERNAL) {
471
473
  handleSelectTransferInternal(tonTransferParam);
472
474
  }
473
475
  else {
@@ -534,9 +536,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
534
536
  };
535
537
  (0, react_1.useEffect)(function () {
536
538
  if (isAuthenticated && !withdrawTokens) {
537
- console.warn("🚀 ~ updateWithdrawToken ~ isAuthenticated:", isAuthenticated);
538
539
  updateWithdrawToken();
539
540
  }
541
+ if (isAuthenticated && !withdrawTokens) {
542
+ updateSendInternalToken();
543
+ }
540
544
  }, [isAuthenticated]);
541
545
  (0, react_1.useEffect)(function () {
542
546
  validateAmount();
@@ -598,7 +602,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
598
602
  !!recipientAddressError ||
599
603
  isLoadingEstimateFee
600
604
  ? Button_1.BUTTON_STATUS.DISABLED
601
- : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] }) }, WithdrawStep.FORM)] }, withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.length), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!infoDialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
605
+ : Button_1.BUTTON_STATUS.ENABLED, children: "Continue" })] }) }, WithdrawStep.FORM)] }, swiperKey), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAllQrCodeRef, onResult: handleScanAllQrCode }), (0, jsx_runtime_1.jsx)(QrCodeReader_1.default, { ref: scannerAddressQrCodeRef, onResult: handleScanAddressQrCode }), (0, jsx_runtime_1.jsx)(AppBackDrop_1.default, { ref: backDropRef }), (0, jsx_runtime_1.jsx)(AppDialog_1.default, { overrideOpen: !!infoDialogContent, children: (0, jsx_runtime_1.jsx)(DialogContentLayout_1.default, { content: (0, jsx_runtime_1.jsx)(Text_1.default, { sx: {
602
606
  textAlign: "center",
603
607
  display: "inline-block",
604
608
  width: "100%",
@@ -82,6 +82,9 @@ exports.initialWithdraw = {
82
82
  isLoadingWithdrawToken: true,
83
83
  withdrawTokens: undefined,
84
84
  updateWithdrawToken: function () { },
85
+ isLoadingSendInternalToken: true,
86
+ sendInternalTokens: undefined,
87
+ updateSendInternalToken: function () { },
85
88
  };
86
89
  exports.WithdrawContext = react_1.default.createContext(exports.initialWithdraw);
87
90
  function WithdrawProvider(_a) {
@@ -90,6 +93,8 @@ function WithdrawProvider(_a) {
90
93
  var isAuthenticated = (0, useWalletData_1.default)().isAuthenticated;
91
94
  var _b = (0, react_1.useState)(true), isLoadingWithdrawToken = _b[0], setIsLoadingWithdrawToken = _b[1];
92
95
  var _c = react_1.default.useState(undefined), withdrawTokens = _c[0], setWithdrawTokens = _c[1];
96
+ var _d = (0, react_1.useState)(true), isLoadingSendInternalToken = _d[0], setIsLoadingSendInternalToken = _d[1];
97
+ var _e = react_1.default.useState(undefined), sendInternalTokens = _e[0], setSendInternalTokens = _e[1];
93
98
  var updateWithdrawToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
94
99
  var response, error_1;
95
100
  return __generator(this, function (_a) {
@@ -120,10 +125,43 @@ function WithdrawProvider(_a) {
120
125
  }
121
126
  });
122
127
  }); }, [isAuthenticated]);
128
+ var updateSendInternalToken = (0, react_1.useCallback)(function () { return __awaiter(_this, void 0, void 0, function () {
129
+ var response, error_2;
130
+ return __generator(this, function (_a) {
131
+ switch (_a.label) {
132
+ case 0:
133
+ console.warn("🚀 ~ updateWithdrawToken ~ updateWithdrawToken:", isAuthenticated);
134
+ _a.label = 1;
135
+ case 1:
136
+ _a.trys.push([1, 3, , 4]);
137
+ if (!isAuthenticated) {
138
+ throw new Error("Authenticate to get withdraw tokens");
139
+ }
140
+ setIsLoadingSendInternalToken(true);
141
+ return [4 /*yield*/, (0, get_withdraw_tokens_list_service_1.default)()];
142
+ case 2:
143
+ response = _a.sent();
144
+ console.warn("🚀 ~ getBalance getWithdrawTokenList ~ response:", response);
145
+ setSendInternalTokens(response === null || response === void 0 ? void 0 : response.supported_tokens);
146
+ setIsLoadingSendInternalToken(false);
147
+ return [3 /*break*/, 4];
148
+ case 3:
149
+ error_2 = _a.sent();
150
+ console.error("🚀 ~ getBalance ~ error getWithdrawTokenList:", error_2);
151
+ setSendInternalTokens(undefined);
152
+ setIsLoadingSendInternalToken(false);
153
+ return [3 /*break*/, 4];
154
+ case 4: return [2 /*return*/];
155
+ }
156
+ });
157
+ }); }, [isAuthenticated]);
123
158
  return ((0, jsx_runtime_1.jsx)(exports.WithdrawContext.Provider, { value: {
124
159
  isLoadingWithdrawToken: isLoadingWithdrawToken,
125
160
  withdrawTokens: withdrawTokens,
126
161
  updateWithdrawToken: updateWithdrawToken,
162
+ isLoadingSendInternalToken: isLoadingSendInternalToken,
163
+ sendInternalTokens: sendInternalTokens,
164
+ updateSendInternalToken: updateSendInternalToken,
127
165
  }, children: children }));
128
166
  }
129
167
  exports.default = WithdrawProvider;
@@ -77,6 +77,9 @@ export interface WithdrawProviderDataType {
77
77
  isLoadingWithdrawToken: boolean;
78
78
  withdrawTokens: WithdrawCurrency[] | undefined;
79
79
  updateWithdrawToken: () => void;
80
+ isLoadingSendInternalToken: boolean;
81
+ sendInternalTokens: WithdrawCurrency[] | undefined;
82
+ updateSendInternalToken: () => void;
80
83
  }
81
84
  export type Wallet = Omit<WalletProviderDataType, "session"> & ReceiveProviderDataType & LockTokensProviderDataType & WithdrawProviderDataType;
82
85
  export interface LoginInfo {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.380",
3
+ "version": "0.0.382",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",