@bze/bze-ui-kit 1.0.14 → 1.0.15
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.
- package/dist/index.d.mts +10 -9
- package/dist/index.d.ts +10 -9
- package/dist/index.js +15 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3388,7 +3388,7 @@ var useSigningClient = ({ chainName }) => {
|
|
|
3388
3388
|
};
|
|
3389
3389
|
|
|
3390
3390
|
// src/hooks/useWalletHealthCheck.ts
|
|
3391
|
-
import { useEffect as useEffect2 } from "react";
|
|
3391
|
+
import { useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
3392
3392
|
import { useChain as useChain2 } from "@interchain-kit/react";
|
|
3393
3393
|
import { WalletState } from "@interchain-kit/core";
|
|
3394
3394
|
|
|
@@ -3421,21 +3421,23 @@ var Toaster = () => {
|
|
|
3421
3421
|
// src/hooks/useWalletHealthCheck.ts
|
|
3422
3422
|
var SIGNING_CLIENT_TIMEOUT_MS = 5e3;
|
|
3423
3423
|
var useWalletHealthCheck = (chainName) => {
|
|
3424
|
-
const { status,
|
|
3424
|
+
const { status, disconnect, address, wallet } = useChain2(chainName != null ? chainName : getChainName());
|
|
3425
|
+
const hasValidated = useRef2(false);
|
|
3425
3426
|
useEffect2(() => {
|
|
3426
3427
|
if (status !== WalletState.Connected) return;
|
|
3428
|
+
if (hasValidated.current) return;
|
|
3429
|
+
hasValidated.current = true;
|
|
3427
3430
|
const validate = async () => {
|
|
3428
|
-
var _a2;
|
|
3431
|
+
var _a2, _b2;
|
|
3429
3432
|
try {
|
|
3430
|
-
const
|
|
3431
|
-
|
|
3433
|
+
const refreshed = await Promise.race([
|
|
3434
|
+
(_a2 = wallet == null ? void 0 : wallet.refreshAccount) == null ? void 0 : _a2.call(wallet).then(() => true),
|
|
3432
3435
|
new Promise(
|
|
3433
|
-
(resolve) => setTimeout(() => resolve(
|
|
3436
|
+
(resolve) => setTimeout(() => resolve(false), SIGNING_CLIENT_TIMEOUT_MS)
|
|
3434
3437
|
)
|
|
3435
3438
|
]);
|
|
3436
|
-
if (!
|
|
3437
|
-
|
|
3438
|
-
console.error(msg);
|
|
3439
|
+
if (!refreshed) {
|
|
3440
|
+
console.error("[useWalletHealthCheck] refreshAccount timed out \u2014 wallet may be locked. Disconnecting.");
|
|
3439
3441
|
toaster.create({
|
|
3440
3442
|
title: "Wallet disconnected",
|
|
3441
3443
|
description: "Could not reach your wallet extension. Please reconnect.",
|
|
@@ -3446,10 +3448,10 @@ var useWalletHealthCheck = (chainName) => {
|
|
|
3446
3448
|
disconnect();
|
|
3447
3449
|
return;
|
|
3448
3450
|
}
|
|
3449
|
-
const
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
console.error(
|
|
3451
|
+
const freshAccount = await ((_b2 = wallet == null ? void 0 : wallet.getAccount) == null ? void 0 : _b2.call(wallet));
|
|
3452
|
+
const freshAddress = freshAccount == null ? void 0 : freshAccount.address;
|
|
3453
|
+
if (freshAddress && freshAddress !== address) {
|
|
3454
|
+
console.error(`[useWalletHealthCheck] Address mismatch \u2014 interchain-kit cached "${address}" but extension reports "${freshAddress}". Wallet was switched outside the UI. Disconnecting.`);
|
|
3453
3455
|
toaster.create({
|
|
3454
3456
|
title: "Wallet account changed",
|
|
3455
3457
|
description: "Your wallet account changed since your last visit. Please reconnect.",
|
|
@@ -3472,7 +3474,7 @@ var useWalletHealthCheck = (chainName) => {
|
|
|
3472
3474
|
}
|
|
3473
3475
|
};
|
|
3474
3476
|
validate();
|
|
3475
|
-
}, []);
|
|
3477
|
+
}, [status]);
|
|
3476
3478
|
};
|
|
3477
3479
|
|
|
3478
3480
|
// src/hooks/usePrices.ts
|
|
@@ -4298,15 +4300,15 @@ var useTx = (chainName) => {
|
|
|
4298
4300
|
};
|
|
4299
4301
|
|
|
4300
4302
|
// src/hooks/useValidatorLogos.ts
|
|
4301
|
-
import { useCallback as useCallback12, useEffect as useEffect4, useRef as
|
|
4303
|
+
import { useCallback as useCallback12, useEffect as useEffect4, useRef as useRef3, useState as useState4 } from "react";
|
|
4302
4304
|
var KEYBASE_API_URL = "https://keybase.io/_/api/1.0/user/lookup.json";
|
|
4303
4305
|
var LOGOS_STORAGE_KEY = "validator_logos";
|
|
4304
4306
|
var LOGOS_TTL = 24 * 60 * 60 * 1e3;
|
|
4305
4307
|
var useValidatorLogos = (validators) => {
|
|
4306
4308
|
const [logos, setLogos] = useState4({});
|
|
4307
4309
|
const [isLoading, setIsLoading] = useState4(false);
|
|
4308
|
-
const fetchedRef =
|
|
4309
|
-
const validatorCountRef =
|
|
4310
|
+
const fetchedRef = useRef3(false);
|
|
4311
|
+
const validatorCountRef = useRef3(0);
|
|
4310
4312
|
const fetchLogos = useCallback12(async (identities) => {
|
|
4311
4313
|
if (identities.length === 0) return {};
|
|
4312
4314
|
let cached = null;
|
|
@@ -4394,7 +4396,7 @@ var useValidatorLogos = (validators) => {
|
|
|
4394
4396
|
|
|
4395
4397
|
// src/components/highlight.tsx
|
|
4396
4398
|
import { Text } from "@chakra-ui/react";
|
|
4397
|
-
import { useEffect as useEffect5, useRef as
|
|
4399
|
+
import { useEffect as useEffect5, useRef as useRef4, useState as useState5 } from "react";
|
|
4398
4400
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
4399
4401
|
var HighlightText = (_a2) => {
|
|
4400
4402
|
var _b2 = _a2, {
|
|
@@ -4411,10 +4413,10 @@ var HighlightText = (_a2) => {
|
|
|
4411
4413
|
"children"
|
|
4412
4414
|
]);
|
|
4413
4415
|
const [isHighlighted, setIsHighlighted] = useState5(false);
|
|
4414
|
-
const isMountedRef =
|
|
4415
|
-
const timeoutRef =
|
|
4416
|
+
const isMountedRef = useRef4(false);
|
|
4417
|
+
const timeoutRef = useRef4(void 0);
|
|
4416
4418
|
const childrenString = String(children);
|
|
4417
|
-
const previousValueRef =
|
|
4419
|
+
const previousValueRef = useRef4(childrenString);
|
|
4418
4420
|
const highlightOpacity = highlightIntensity === "subtle" ? "15" : "50";
|
|
4419
4421
|
const boxShadowStrength = highlightIntensity === "subtle" ? "10" : "25";
|
|
4420
4422
|
useEffect5(() => {
|
|
@@ -4859,7 +4861,7 @@ import {
|
|
|
4859
4861
|
VStack as VStack2
|
|
4860
4862
|
} from "@chakra-ui/react";
|
|
4861
4863
|
import { LuCopy, LuExternalLink, LuX as LuX2 } from "react-icons/lu";
|
|
4862
|
-
import { useCallback as useCallback14, useEffect as useEffect7, useMemo as useMemo13, useRef as
|
|
4864
|
+
import { useCallback as useCallback14, useEffect as useEffect7, useMemo as useMemo13, useRef as useRef5, useState as useState8 } from "react";
|
|
4863
4865
|
import { WalletState as WalletState2 } from "@interchain-kit/core";
|
|
4864
4866
|
import BigNumber14 from "bignumber.js";
|
|
4865
4867
|
import { cosmos } from "@bze/bzejs";
|
|
@@ -5202,7 +5204,7 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
5202
5204
|
const [isDisconnecting, setIsDisconnecting] = useState8(false);
|
|
5203
5205
|
const [showCopiedTooltip, setShowCopiedTooltip] = useState8(false);
|
|
5204
5206
|
const [clickedBalance, setClickedBalance] = useState8("");
|
|
5205
|
-
const copyButtonRef =
|
|
5207
|
+
const copyButtonRef = useRef5(null);
|
|
5206
5208
|
const {
|
|
5207
5209
|
status,
|
|
5208
5210
|
username,
|