@suilend/sui-fe-next 2.0.18 → 2.0.19

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.
@@ -222,17 +222,24 @@ function Inner(_a) {
222
222
  // WalletConnect via @walletconnect/universal-provider
223
223
  // Matches the reference implementation: https://github.com/WalletConnect/react-core-up-sui
224
224
  var _g = useState(), wcSession = _g[0], setWcSession = _g[1];
225
- var sessionAddress = useMemo(function () {
225
+ // Raw address as returned by the wallet (e.g. Fireblocks returns an
226
+ // EVM-length address). We must send this back in WalletConnect request
227
+ // params so the wallet recognises it as its own account.
228
+ var wcRawAddress = useMemo(function () {
226
229
  var _a, _b, _c;
227
230
  var raw = (_c = (_b = (_a = wcSession === null || wcSession === void 0 ? void 0 : wcSession.namespaces) === null || _a === void 0 ? void 0 : _a.sui) === null || _b === void 0 ? void 0 : _b.accounts) === null || _c === void 0 ? void 0 : _c[0];
228
231
  if (!raw)
229
232
  return undefined;
230
- var addr = raw.split(":").pop();
231
- if (!addr)
233
+ return raw.split(":").pop();
234
+ }, [wcSession]);
235
+ // Normalised Sui address (zero-padded to 32 bytes) for on-chain use:
236
+ // transaction sender, RPC queries, etc.
237
+ var sessionAddress = useMemo(function () {
238
+ if (!wcRawAddress)
232
239
  return undefined;
233
- var normalized = normalizeSuiAddress(addr);
240
+ var normalized = normalizeSuiAddress(wcRawAddress);
234
241
  return isValidSuiAddress(normalized) ? normalized : undefined;
235
- }, [wcSession]);
242
+ }, [wcRawAddress]);
236
243
  useEffect(function () {
237
244
  (function () { return __awaiter(_this, void 0, void 0, function () {
238
245
  var provider;
@@ -387,7 +394,10 @@ function Inner(_a) {
387
394
  provider = _a.sent();
388
395
  return [4 /*yield*/, provider.request({
389
396
  method: WC_SUI_METHODS.SIGN_PERSONAL_MESSAGE,
390
- params: { message: message.toString(), address: sessionAddress },
397
+ params: {
398
+ message: message.toString(),
399
+ address: wcRawAddress !== null && wcRawAddress !== void 0 ? wcRawAddress : sessionAddress,
400
+ },
391
401
  }, "sui:mainnet")];
392
402
  case 2:
393
403
  res = _a.sent();
@@ -397,7 +407,7 @@ function Inner(_a) {
397
407
  }];
398
408
  }
399
409
  });
400
- }); }, [sessionAddress]);
410
+ }); }, [sessionAddress, wcRawAddress]);
401
411
  var connectWalletWrapper = useCallback(function (_wallet) { return __awaiter(_this, void 0, void 0, function () {
402
412
  var provider, modal, _a, provider, _b, err_1;
403
413
  return __generator(this, function (_c) {
@@ -706,7 +716,7 @@ function Inner(_a) {
706
716
  txBase64 = toBase64(txBytes);
707
717
  params = {
708
718
  transaction: txBase64,
709
- address: sessionAddress,
719
+ address: wcRawAddress !== null && wcRawAddress !== void 0 ? wcRawAddress : sessionAddress,
710
720
  };
711
721
  console.log("[WalletContext] WalletConnect — session topic:", (_a = provider.session) === null || _a === void 0 ? void 0 : _a.topic);
712
722
  console.log("[WalletContext] WalletConnect — session namespaces:", JSON.stringify((_b = provider.session) === null || _b === void 0 ? void 0 : _b.namespaces));
@@ -814,6 +824,7 @@ function Inner(_a) {
814
824
  });
815
825
  }); }, [
816
826
  sessionAddress,
827
+ wcRawAddress,
817
828
  gasBudget,
818
829
  impersonatedAddress,
819
830
  account,
@@ -837,13 +848,7 @@ function Inner(_a) {
837
848
  accounts: accounts,
838
849
  account: account,
839
850
  switchAccount: switchAccountWrapper,
840
- address: (function () {
841
- var raw = impersonatedAddress !== null && impersonatedAddress !== void 0 ? impersonatedAddress : account === null || account === void 0 ? void 0 : account.address;
842
- if (!raw)
843
- return undefined;
844
- var normalized = normalizeSuiAddress(raw);
845
- return isValidSuiAddress(normalized) ? normalized : undefined;
846
- })(),
851
+ address: impersonatedAddress !== null && impersonatedAddress !== void 0 ? impersonatedAddress : account === null || account === void 0 ? void 0 : account.address,
847
852
  dryRunTransaction: dryRunTransaction,
848
853
  signExecuteAndWaitForTransaction: signExecuteAndWaitForTransaction,
849
854
  isUsingLedger: isUsingLedger,
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe-next","version":"2.0.18","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.19","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"}}