@suilend/sui-fe-next 2.0.21 → 2.0.22

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.
@@ -682,10 +682,10 @@ function Inner(_a) {
682
682
  });
683
683
  }); }, [suiClient]);
684
684
  var signExecuteAndWaitForTransaction = useCallback(function (transaction, onSetGasBudget, onSign, onExecute) { return __awaiter(_this, void 0, void 0, function () {
685
- var _address, provider, txBytes, txBase64, params, topic_1, signClient_1, wcRequest, methods, signRes, execDigest, _i, methods_1, method, res_1, err_5, execRes, msafeWallet, msafeFeature, msafeAccount, usedSignOnly, signedTransaction, res1, err_6, message, res, digest, err_7;
686
- var _a, _b, _c, _d;
687
- return __generator(this, function (_e) {
688
- switch (_e.label) {
685
+ var _address, provider, txBytes, txBase64, params, topic_1, signClient_1, debugHandler, pendingBefore, wcRequest, methods, signRes, execDigest, _i, methods_1, method, res_1, err_5, execRes, msafeWallet, msafeFeature, msafeAccount, usedSignOnly, signedTransaction, res1, err_6, message, res, digest, err_7;
686
+ var _a, _b, _c, _d, _e, _f, _g;
687
+ return __generator(this, function (_h) {
688
+ switch (_h.label) {
689
689
  case 0:
690
690
  _address = impersonatedAddress !== null && impersonatedAddress !== void 0 ? impersonatedAddress : account === null || account === void 0 ? void 0 : account.address;
691
691
  if (_address) {
@@ -694,9 +694,9 @@ function Inner(_a) {
694
694
  }
695
695
  catch (err) { }
696
696
  }
697
- _e.label = 1;
697
+ _h.label = 1;
698
698
  case 1:
699
- _e.trys.push([1, 29, , 30]);
699
+ _h.trys.push([1, 29, , 30]);
700
700
  // Gas budget
701
701
  if (gasBudget !== "")
702
702
  transaction.setGasBudget(+new BigNumber(gasBudget)
@@ -708,11 +708,11 @@ function Inner(_a) {
708
708
  if (!sessionAddress) return [3 /*break*/, 17];
709
709
  return [4 /*yield*/, getWalletConnectProvider()];
710
710
  case 2:
711
- provider = _e.sent();
711
+ provider = _h.sent();
712
712
  transaction.setSender(sessionAddress);
713
713
  return [4 /*yield*/, transaction.build({ client: suiClient })];
714
714
  case 3:
715
- txBytes = _e.sent();
715
+ txBytes = _h.sent();
716
716
  txBase64 = toBase64(txBytes);
717
717
  params = {
718
718
  transaction: txBase64,
@@ -730,8 +730,14 @@ function Inner(_a) {
730
730
  console.log("[WalletContext] WalletConnect — session expiry:", (_c = provider.session) === null || _c === void 0 ? void 0 : _c.expiry, "now:", Math.floor(Date.now() / 1000), "expired:", ((_d = provider.session) === null || _d === void 0 ? void 0 : _d.expiry)
731
731
  ? provider.session.expiry < Math.floor(Date.now() / 1000)
732
732
  : "unknown");
733
+ debugHandler = function (event) {
734
+ console.log("[WalletContext] WalletConnect — relay message received:", event);
735
+ };
736
+ signClient_1.core.relayer.on("message", debugHandler);
737
+ pendingBefore = (_g = (_f = (_e = signClient_1.pendingRequest).getAll) === null || _f === void 0 ? void 0 : _f.call(_e)) !== null && _g !== void 0 ? _g : [];
738
+ console.log("[WalletContext] WalletConnect — pending requests before:", Array.isArray(pendingBefore) ? pendingBefore.length : pendingBefore);
733
739
  wcRequest = function (method, requestParams, timeoutMs) {
734
- if (timeoutMs === void 0) { timeoutMs = 120000; }
740
+ if (timeoutMs === void 0) { timeoutMs = 15000; }
735
741
  return new Promise(function (resolve, reject) {
736
742
  var timer = setTimeout(function () {
737
743
  reject(new Error("WalletConnect request \"".concat(method, "\" timed out after ").concat(timeoutMs / 1000, "s \u2014 the wallet did not respond. ") +
@@ -760,38 +766,40 @@ function Inner(_a) {
760
766
  signRes = null;
761
767
  execDigest = null;
762
768
  _i = 0, methods_1 = methods;
763
- _e.label = 4;
769
+ _h.label = 4;
764
770
  case 4:
765
771
  if (!(_i < methods_1.length)) return [3 /*break*/, 12];
766
772
  method = methods_1[_i];
767
- _e.label = 5;
773
+ _h.label = 5;
768
774
  case 5:
769
- _e.trys.push([5, 10, , 11]);
775
+ _h.trys.push([5, 10, , 11]);
770
776
  console.log("[WalletContext] WalletConnect \u2014 trying ".concat(method));
771
777
  if (!(method === WC_SUI_METHODS.SIGN_TRANSACTION)) return [3 /*break*/, 7];
772
778
  return [4 /*yield*/, wcRequest(method, params)];
773
779
  case 6:
774
- signRes = _e.sent();
780
+ signRes = _h.sent();
775
781
  console.log("[WalletContext] WalletConnect \u2014 ".concat(method, " succeeded"));
776
782
  return [3 /*break*/, 12];
777
783
  case 7: return [4 /*yield*/, wcRequest(method, params)];
778
784
  case 8:
779
- res_1 = _e.sent();
785
+ res_1 = _h.sent();
780
786
  console.log("[WalletContext] WalletConnect \u2014 ".concat(method, " succeeded, digest:"), res_1.digest);
781
787
  execDigest = res_1.digest;
782
788
  return [3 /*break*/, 12];
783
789
  case 9: return [3 /*break*/, 11];
784
790
  case 10:
785
- err_5 = _e.sent();
791
+ err_5 = _h.sent();
786
792
  console.warn("[WalletContext] WalletConnect \u2014 ".concat(method, " failed:"), err_5);
787
793
  return [3 /*break*/, 11];
788
794
  case 11:
789
795
  _i++;
790
796
  return [3 /*break*/, 4];
791
797
  case 12:
798
+ // Cleanup debug listener
799
+ signClient_1.core.relayer.off("message", debugHandler);
792
800
  if (!execDigest) return [3 /*break*/, 14];
793
801
  return [4 /*yield*/, waitForTransactionWithCheck(execDigest)];
794
- case 13: return [2 /*return*/, _e.sent()];
802
+ case 13: return [2 /*return*/, _h.sent()];
795
803
  case 14:
796
804
  if (!signRes) {
797
805
  throw new Error("WalletConnect: wallet did not respond to any signing method. " +
@@ -803,9 +811,9 @@ function Inner(_a) {
803
811
  signature: signRes.signature,
804
812
  })];
805
813
  case 15:
806
- execRes = _e.sent();
814
+ execRes = _h.sent();
807
815
  return [4 /*yield*/, waitForTransactionWithCheck(execRes.digest)];
808
- case 16: return [2 /*return*/, _e.sent()];
816
+ case 16: return [2 /*return*/, _h.sent()];
809
817
  case 17:
810
818
  if (!isInMsafeApp()) return [3 /*break*/, 20];
811
819
  msafeWallet = getWallets()
@@ -822,7 +830,7 @@ function Inner(_a) {
822
830
  chain: "sui:mainnet",
823
831
  })];
824
832
  case 18:
825
- _e.sent();
833
+ _h.sent();
826
834
  // MSafe proposes the transaction to the multisig queue;
827
835
  // the promise never resolves (only rejects on cancel).
828
836
  // If we reach here the proposal was accepted.
@@ -830,14 +838,14 @@ function Inner(_a) {
830
838
  case 19: throw new Error("MSafe wallet not found. Please reload the page inside MSafe.");
831
839
  case 20:
832
840
  usedSignOnly = false;
833
- _e.label = 21;
841
+ _h.label = 21;
834
842
  case 21:
835
- _e.trys.push([21, 25, , 26]);
843
+ _h.trys.push([21, 25, , 26]);
836
844
  return [4 /*yield*/, dAppKit.signTransaction({
837
845
  transaction: transaction,
838
846
  })];
839
847
  case 22:
840
- signedTransaction = _e.sent();
848
+ signedTransaction = _h.sent();
841
849
  usedSignOnly = true;
842
850
  onSign === null || onSign === void 0 ? void 0 : onSign(signedTransaction);
843
851
  return [4 /*yield*/, suiClient.executeTransactionBlock({
@@ -845,12 +853,12 @@ function Inner(_a) {
845
853
  signature: signedTransaction.signature,
846
854
  })];
847
855
  case 23:
848
- res1 = _e.sent();
856
+ res1 = _h.sent();
849
857
  onExecute === null || onExecute === void 0 ? void 0 : onExecute(res1);
850
858
  return [4 /*yield*/, waitForTransactionWithCheck(res1.digest)];
851
- case 24: return [2 /*return*/, _e.sent()];
859
+ case 24: return [2 /*return*/, _h.sent()];
852
860
  case 25:
853
- err_6 = _e.sent();
861
+ err_6 = _h.sent();
854
862
  if (usedSignOnly)
855
863
  throw err_6;
856
864
  message = err_6 instanceof Error ? err_6.message : String(err_6);
@@ -862,14 +870,14 @@ function Inner(_a) {
862
870
  transaction: transaction,
863
871
  })];
864
872
  case 27:
865
- res = _e.sent();
873
+ res = _h.sent();
866
874
  digest = res.$kind === "Transaction"
867
875
  ? res.Transaction.digest
868
876
  : res.FailedTransaction.digest;
869
877
  return [4 /*yield*/, waitForTransactionWithCheck(digest)];
870
- case 28: return [2 /*return*/, _e.sent()];
878
+ case 28: return [2 /*return*/, _h.sent()];
871
879
  case 29:
872
- err_7 = _e.sent();
880
+ err_7 = _h.sent();
873
881
  console.error(err_7);
874
882
  throw err_7;
875
883
  case 30: return [2 /*return*/];
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe-next","version":"2.0.21","private":false,"description":"A collection of TypeScript frontend components and hooks","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./contexts/WalletContext":"./contexts/WalletContext.jsx","./contexts/SettingsContext":"./contexts/SettingsContext.jsx","./contexts":"./contexts/index.js","./fetchers":"./fetchers/index.js","./fetchers/useFetchBalances":"./fetchers/useFetchBalances.js","./hooks/useRefreshOnBalancesChange":"./hooks/useRefreshOnBalancesChange.js","./hooks/useLedgerHashDialog":"./hooks/useLedgerHashDialog.js","./hooks/useIsAndroid":"./hooks/useIsAndroid.jsx","./hooks/useCoinMetadataMap":"./hooks/useCoinMetadataMap.js","./hooks":"./hooks/index.js","./hooks/useIsTouchscreen":"./hooks/useIsTouchscreen.jsx","./hooks/useIsiOS":"./hooks/useIsiOS.jsx","./hooks/keypair":"./hooks/keypair.js","./lib/track":"./lib/track.js","./lib":"./lib/index.js","./lib/router":"./lib/router.js","./lib/toasts":"./lib/toasts.jsx","./lib/connector":"./lib/connector.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix src/","prettier":"prettier --write src/","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ./release.js && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/sui-fe.git"},"bugs":{"url":"https://github.com/suilend/sui-fe/issues"},"dependencies":{"@reown/appkit":"1.8.2","@tanstack/react-query":"^5.60.2","@wallet-standard/app":"^1.1.0","@walletconnect/universal-provider":"2.21.1","bignumber.js":"^9.1.2","launchdarkly-react-client-sdk":"^3.6.0","lodash":"^4.17.21","mixpanel-browser":"^2.72.0","next":"^15.0.3","react":"18.3.1","react-dom":"18.3.1","react-responsive":"^10.0.0","sonner":"1.4.41","swr":"^2.2.5","tailwind-merge":"^2.5.4","usehooks-ts":"^3.1.1"},"devDependencies":{"@tsconfig/next":"^2.0.3","@types/lodash":"^4.17.13","@types/node":"^22.9.0","@types/react":"^18.3.12","@types/react-dom":"^18.3.1","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","eslint-config-next":"^15.0.3","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.1","prettier":"^3.3.3","ts-node":"^10.9.2","typescript":"^5.6.3"},"peerDependencies":{"@mysten/dapp-kit-core":"1.0.3","@mysten/dapp-kit-react":"1.0.1","@mysten/sui":"2.3.1","@mysten/wallet-standard":"0.20.0","@suilend/sui-fe":"^2.0.10"}}
1
+ {"name":"@suilend/sui-fe-next","version":"2.0.22","private":false,"description":"A collection of TypeScript frontend components and hooks","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./contexts/WalletContext":"./contexts/WalletContext.jsx","./contexts/SettingsContext":"./contexts/SettingsContext.jsx","./contexts":"./contexts/index.js","./fetchers":"./fetchers/index.js","./fetchers/useFetchBalances":"./fetchers/useFetchBalances.js","./hooks/useRefreshOnBalancesChange":"./hooks/useRefreshOnBalancesChange.js","./hooks/useLedgerHashDialog":"./hooks/useLedgerHashDialog.js","./hooks/useIsAndroid":"./hooks/useIsAndroid.jsx","./hooks/useCoinMetadataMap":"./hooks/useCoinMetadataMap.js","./hooks":"./hooks/index.js","./hooks/useIsTouchscreen":"./hooks/useIsTouchscreen.jsx","./hooks/useIsiOS":"./hooks/useIsiOS.jsx","./hooks/keypair":"./hooks/keypair.js","./lib/track":"./lib/track.js","./lib":"./lib/index.js","./lib/router":"./lib/router.js","./lib/toasts":"./lib/toasts.jsx","./lib/connector":"./lib/connector.js"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix src/","prettier":"prettier --write src/","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ./release.js && cd ./dist && npm publish --access public"},"repository":{"type":"git","url":"git+https://github.com/suilend/sui-fe.git"},"bugs":{"url":"https://github.com/suilend/sui-fe/issues"},"dependencies":{"@reown/appkit":"1.8.2","@tanstack/react-query":"^5.60.2","@wallet-standard/app":"^1.1.0","@walletconnect/universal-provider":"2.21.1","bignumber.js":"^9.1.2","launchdarkly-react-client-sdk":"^3.6.0","lodash":"^4.17.21","mixpanel-browser":"^2.72.0","next":"^15.0.3","react":"18.3.1","react-dom":"18.3.1","react-responsive":"^10.0.0","sonner":"1.4.41","swr":"^2.2.5","tailwind-merge":"^2.5.4","usehooks-ts":"^3.1.1"},"devDependencies":{"@tsconfig/next":"^2.0.3","@types/lodash":"^4.17.13","@types/node":"^22.9.0","@types/react":"^18.3.12","@types/react-dom":"^18.3.1","@typescript-eslint/eslint-plugin":"^8.14.0","@typescript-eslint/parser":"^8.14.0","eslint":"^9.14.0","eslint-config-next":"^15.0.3","eslint-config-prettier":"^9.1.0","eslint-plugin-import":"^2.31.0","eslint-plugin-prettier":"^5.2.1","prettier":"^3.3.3","ts-node":"^10.9.2","typescript":"^5.6.3"},"peerDependencies":{"@mysten/dapp-kit-core":"1.0.3","@mysten/dapp-kit-react":"1.0.1","@mysten/sui":"2.3.1","@mysten/wallet-standard":"0.20.0","@suilend/sui-fe":"^2.0.10"}}