@suilend/sui-fe-next 0.1.83 → 0.4.0

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.
@@ -62,16 +62,17 @@ export default function useFetchBalances() {
62
62
  case 0:
63
63
  balancesMap = {};
64
64
  if (!address) return [3 /*break*/, 2];
65
- return [4 /*yield*/, suiClient.getAllBalances({
65
+ return [4 /*yield*/, suiClient.listBalances({
66
66
  owner: address,
67
67
  })];
68
68
  case 1:
69
- rawBalances = (_a.sent())
70
- .map(function (cb) { return (__assign(__assign({}, cb), { coinType: normalizeStructTag(cb.coinType) })); })
69
+ rawBalances = (_a.sent()).balances
70
+ .map(function (balance) { return (__assign(__assign({}, balance), { coinType: normalizeStructTag(balance.coinType) })); })
71
71
  .sort(function (a, b) { return (a.coinType < b.coinType ? -1 : 1); });
72
+ console.log("XXXX rawBalances", rawBalances);
72
73
  for (_i = 0, rawBalances_1 = rawBalances; _i < rawBalances_1.length; _i++) {
73
74
  rawBalance = rawBalances_1[_i];
74
- totalBalance = new BigNumber(rawBalance.totalBalance);
75
+ totalBalance = new BigNumber(rawBalance.balance);
75
76
  if (totalBalance.gt(0))
76
77
  balancesMap[rawBalance.coinType] = totalBalance;
77
78
  }
@@ -1,3 +1,3 @@
1
- import { CoinMetadata } from "@mysten/sui/client";
1
+ import { CoinMetadata } from "@mysten/sui/jsonRpc";
2
2
  declare const useCoinMetadataMap: (coinTypes: string[]) => Record<string, CoinMetadata> | undefined;
3
3
  export default useCoinMetadataMap;
@@ -46,24 +46,24 @@ var useRefreshOnBalancesChange = function (refresh) {
46
46
  return;
47
47
  previousBalancesRef.current = undefined;
48
48
  var interval = setInterval(function () { return __awaiter(void 0, void 0, void 0, function () {
49
- var balances, err_1;
49
+ var res, err_1;
50
50
  return __generator(this, function (_a) {
51
51
  switch (_a.label) {
52
52
  case 0:
53
53
  _a.trys.push([0, 4, , 5]);
54
- return [4 /*yield*/, suiClient.getAllBalances({
54
+ return [4 /*yield*/, suiClient.listBalances({
55
55
  owner: address,
56
56
  })];
57
57
  case 1:
58
- balances = _a.sent();
58
+ res = _a.sent();
59
59
  if (!(previousBalancesRef.current !== undefined &&
60
- !isEqual(balances, previousBalancesRef.current))) return [3 /*break*/, 3];
60
+ !isEqual(res.balances, previousBalancesRef.current))) return [3 /*break*/, 3];
61
61
  return [4 /*yield*/, refresh()];
62
62
  case 2:
63
63
  _a.sent();
64
64
  _a.label = 3;
65
65
  case 3:
66
- previousBalancesRef.current = balances;
66
+ previousBalancesRef.current = res.balances;
67
67
  return [3 /*break*/, 5];
68
68
  case 4:
69
69
  err_1 = _a.sent();
package/lib/index.d.ts CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./router";
2
2
  export * from "./toasts";
3
+ export * from "./track";
package/lib/index.js CHANGED
@@ -1,2 +1,3 @@
1
1
  export * from "./router";
2
2
  export * from "./toasts";
3
+ export * from "./track";
package/lib/track.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ declare const track: (eventName: string, properties?: Record<string, string | number>) => void;
2
+ export default track;
package/lib/track.js ADDED
@@ -0,0 +1,15 @@
1
+ import mixpanel from "mixpanel-browser";
2
+ var track = function (eventName, properties) {
3
+ var projectToken = process.env.NEXT_PUBLIC_MIXPANEL_PROJECT_TOKEN;
4
+ if (!projectToken)
5
+ return;
6
+ try {
7
+ setTimeout(function () {
8
+ mixpanel.track(eventName, properties);
9
+ }, 250);
10
+ }
11
+ catch (err) {
12
+ console.error(err);
13
+ }
14
+ };
15
+ export default track;
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name":"@suilend/sui-fe-next","version":"0.1.83","private":false,"description":"A collection of TypeScript frontend components and hooks","author":"Suilend","license":"MIT","main":"./index.js","exports":{".":"./index.js","./contexts/SettingsContext":"./contexts/SettingsContext.jsx","./contexts/WalletContext":"./contexts/WalletContext.jsx","./contexts":"./contexts/index.js","./fetchers":"./fetchers/index.js","./fetchers/useFetchBalances":"./fetchers/useFetchBalances.js","./hooks":"./hooks/index.js","./hooks/keypair":"./hooks/keypair.js","./hooks/useCoinMetadataMap":"./hooks/useCoinMetadataMap.js","./hooks/useIsAndroid":"./hooks/useIsAndroid.jsx","./hooks/useIsTouchscreen":"./hooks/useIsTouchscreen.jsx","./hooks/useIsiOS":"./hooks/useIsiOS.jsx","./hooks/useLedgerHashDialog":"./hooks/useLedgerHashDialog.js","./hooks/useRefreshOnBalancesChange":"./hooks/useRefreshOnBalancesChange.js","./lib/connector":"./lib/connector.js","./lib":"./lib/index.js","./lib/router":"./lib/router.js","./lib/toasts":"./lib/toasts.jsx"},"types":"./index.js","scripts":{"build":"rm -rf ./dist && bun tsc","eslint":"eslint --fix \"./src/**/*.ts\"","prettier":"prettier --write \"./src/**/*\"","lint":"bun eslint && bun prettier && bun tsc --noEmit","release":"bun run build && bun ts-node ./release.ts && 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.10","@reown/appkit-common":"^1.8.10","@reown/appkit-universal-connector":"^1.8.10","@tanstack/react-query":"^5.60.2","bignumber.js":"^9.1.2","launchdarkly-react-client-sdk":"^3.6.0","lodash":"^4.17.21","next":"^15.0.3","react":"18.3.1","react-dom":"18.3.1","react-responsive":"^10.0.0","shio-sdk":"^1.0.8","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":"0.19.4","@mysten/sui":"1.42.0","@mysten/wallet-standard":"0.19.2","@suilend/sui-fe":"^0.3.42"}}
1
+ {"name":"@suilend/sui-fe-next","version":"0.4.0","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/**/*.ts\"","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.10","@reown/appkit-common":"^1.8.10","@reown/appkit-universal-connector":"^1.8.10","@tanstack/react-query":"^5.60.2","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","shio-sdk":"^1.0.8","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.2","@mysten/dapp-kit-react":"1.0.1","@mysten/sui":"2.1.0","@mysten/wallet-standard":"0.20.0","@suilend/sui-fe":"^0.4.4"}}