tek-wallet 0.0.381 → 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.
@@ -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];
@@ -535,9 +536,11 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
535
536
  };
536
537
  (0, react_1.useEffect)(function () {
537
538
  if (isAuthenticated && !withdrawTokens) {
538
- console.warn("🚀 ~ updateWithdrawToken ~ isAuthenticated:", isAuthenticated);
539
539
  updateWithdrawToken();
540
540
  }
541
+ if (isAuthenticated && !withdrawTokens) {
542
+ updateSendInternalToken();
543
+ }
541
544
  }, [isAuthenticated]);
542
545
  (0, react_1.useEffect)(function () {
543
546
  validateAmount();
@@ -599,7 +602,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
599
602
  !!recipientAddressError ||
600
603
  isLoadingEstimateFee
601
604
  ? Button_1.BUTTON_STATUS.DISABLED
602
- : 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: {
603
606
  textAlign: "center",
604
607
  display: "inline-block",
605
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.381",
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",