tek-wallet 0.0.312 → 0.0.314

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.
@@ -156,27 +156,68 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
156
156
  var handleChangeMemo = function (e) {
157
157
  setMemo(e.target.value);
158
158
  };
159
+ var clearValues = function () {
160
+ setSelectedToken(undefined);
161
+ setSelectedNetwork(undefined);
162
+ setAmount("");
163
+ setMemo("");
164
+ setRecipientAddress("");
165
+ setSelectedMethod(undefined);
166
+ setSendInfoGet(undefined);
167
+ setRecipientAddressInternal(undefined);
168
+ };
159
169
  var gotoStep = function (step) {
160
170
  var _a;
171
+ if (step === WithdrawStep.SELECT_METHOD) {
172
+ clearValues();
173
+ }
161
174
  setCurrentStep(step);
162
175
  (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.slideTo(step);
163
176
  };
164
177
  var handleReSelectNetwork = function () {
165
178
  gotoStep(WithdrawStep.SELECT_NETWORK);
166
179
  };
167
- var clearValues = function () {
168
- setSelectedToken(undefined);
169
- setSelectedNetwork(undefined);
170
- setAmount("");
171
- setMemo("");
172
- setRecipientAddress("");
173
- gotoStep(WithdrawStep.SELECT_METHOD);
174
- };
175
180
  var handleOnClose = function (e) {
176
181
  var _a;
177
182
  clearValues();
178
183
  (_a = props.onClose) === null || _a === void 0 ? void 0 : _a.call(props, e);
179
184
  };
185
+ var findWithdrawToken = function (contract_address) {
186
+ return withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.find(function (item) { return (item === null || item === void 0 ? void 0 : item.address) === contract_address; });
187
+ };
188
+ var handleSelectTransferInternal = function () {
189
+ var _a;
190
+ (_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
191
+ var tokenSet = findWithdrawToken((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.jetton) || "");
192
+ if (!tokenSet) {
193
+ gotoStep(WithdrawStep.SELECT_TOKEN);
194
+ }
195
+ else {
196
+ setSelectedToken(tokenSet);
197
+ setSelectedNetwork(tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.network_data);
198
+ gotoStep(WithdrawStep.CONFIRM);
199
+ }
200
+ setSelectedMethod(SendMethods.TRANSFER_INTERNAL);
201
+ setRecipientAddress(recipientAddressInternal);
202
+ setAmount((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.amount) || "");
203
+ };
204
+ var handleSelectContinueTransferExternal = function () {
205
+ var _a;
206
+ (_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
207
+ var tokenSet = findWithdrawToken((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.jetton) || "");
208
+ if (!tokenSet) {
209
+ gotoStep(WithdrawStep.SELECT_TOKEN);
210
+ }
211
+ else {
212
+ setSelectedToken(tokenSet);
213
+ setSelectedNetwork(tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.network_data);
214
+ gotoStep(WithdrawStep.CONFIRM);
215
+ }
216
+ setSelectedMethod(SendMethods.TRANSFER_EXTERNAL);
217
+ setRecipientAddress(sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.address);
218
+ setAmount((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.amount) || "");
219
+ setMemo(sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.text);
220
+ };
180
221
  var handleSelectMethod = function (method) {
181
222
  var _a;
182
223
  console.warn("🚀 ~ handleSelectMethod ~ method:", method);
@@ -199,6 +240,7 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
199
240
  (_a = scannerAllQrCodeRef.current) === null || _a === void 0 ? void 0 : _a.open();
200
241
  break;
201
242
  case SendMethods.TRANSFER_INTERNAL:
243
+ handleSelectTransferInternal();
202
244
  break;
203
245
  case SendMethods.TRANSFER_EXTERNAL:
204
246
  gotoStep(WithdrawStep.SELECT_TOKEN);
@@ -208,14 +250,12 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
208
250
  }
209
251
  };
210
252
  var handleBack = function () {
211
- var _a;
212
253
  if (currentStep === WithdrawStep.CONFIRM &&
213
254
  selectedMethod === SendMethods.TRANSFER_INTERNAL) {
214
255
  gotoStep(WithdrawStep.SELECT_TOKEN);
215
256
  return;
216
257
  }
217
- (_a = swiperRef.current) === null || _a === void 0 ? void 0 : _a.prev();
218
- setCurrentStep(function (prev) { return prev - 1; });
258
+ gotoStep(currentStep - 1);
219
259
  };
220
260
  var handleSelectToken = function (token) {
221
261
  console.warn("🚀 ~ handleSelectToken ~ token:", token);
@@ -242,9 +282,6 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
242
282
  // network: data?.network,
243
283
  // });
244
284
  // };
245
- var findWithdrawToken = function (contract_address) {
246
- return withdrawTokens === null || withdrawTokens === void 0 ? void 0 : withdrawTokens.find(function (item) { return (item === null || item === void 0 ? void 0 : item.address) === contract_address; });
247
- };
248
285
  var handleScanAllQrCode = function (result) { return __awaiter(void 0, void 0, void 0, function () {
249
286
  var text, tonTransferParam, validateWalletAddress;
250
287
  var _a, _b, _c, _d, _e;
@@ -295,39 +332,6 @@ var WithdrawFunction = (0, react_1.forwardRef)(function (props, ref) {
295
332
  });
296
333
  }); };
297
334
  var handleScanAddressQrCode = function () { };
298
- var handleSelectTransferInternal = function () {
299
- var _a;
300
- (_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
301
- var tokenSet = findWithdrawToken((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.jetton) || "");
302
- if (!tokenSet) {
303
- gotoStep(WithdrawStep.SELECT_TOKEN);
304
- }
305
- else {
306
- setSelectedToken(tokenSet);
307
- setSelectedNetwork(tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.network_data);
308
- gotoStep(WithdrawStep.CONFIRM);
309
- }
310
- setSelectedMethod(SendMethods.TRANSFER_INTERNAL);
311
- setRecipientAddress(recipientAddressInternal);
312
- setAmount((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.amount) || "");
313
- };
314
- var handleSelectContinueTransferExternal = function () {
315
- var _a;
316
- (_a = suggestUseTransferInternalDialogRef.current) === null || _a === void 0 ? void 0 : _a.close();
317
- var tokenSet = findWithdrawToken((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.jetton) || "");
318
- if (!tokenSet) {
319
- gotoStep(WithdrawStep.SELECT_TOKEN);
320
- }
321
- else {
322
- setSelectedToken(tokenSet);
323
- setSelectedNetwork(tokenSet === null || tokenSet === void 0 ? void 0 : tokenSet.network_data);
324
- gotoStep(WithdrawStep.CONFIRM);
325
- }
326
- setSelectedMethod(SendMethods.TRANSFER_EXTERNAL);
327
- setRecipientAddress(sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.address);
328
- setAmount((sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.amount) || "");
329
- setMemo(sendInfoGet === null || sendInfoGet === void 0 ? void 0 : sendInfoGet.text);
330
- };
331
335
  (0, react_1.useEffect)(function () {
332
336
  if (isAuthenticated && !withdrawTokens) {
333
337
  console.warn("🚀 ~ updateWithdrawToken ~ isAuthenticated:", isAuthenticated);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tek-wallet",
3
- "version": "0.0.312",
3
+ "version": "0.0.314",
4
4
  "description": "A custom React provider with TypeScript support",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",