@bze/bze-ui-kit 0.4.0 → 0.4.2
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 +24 -3
- package/dist/index.d.ts +24 -3
- package/dist/index.js +360 -195
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +206 -46
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -2602,6 +2602,7 @@ async function mapPendingUnlock(pending) {
|
|
|
2602
2602
|
// src/query/staking.ts
|
|
2603
2603
|
import { PageRequest as PageRequest5 } from "@bze/bzejs/cosmos/base/query/v1beta1/pagination";
|
|
2604
2604
|
import BigNumber7 from "bignumber.js";
|
|
2605
|
+
import { BondStatus } from "@bze/bzejs/cosmos/staking/v1beta1/staking";
|
|
2605
2606
|
var getAddressDelegations = async (address) => {
|
|
2606
2607
|
try {
|
|
2607
2608
|
const client = await getRestClient();
|
|
@@ -2768,6 +2769,65 @@ var getStakingPool = async () => {
|
|
|
2768
2769
|
};
|
|
2769
2770
|
}
|
|
2770
2771
|
};
|
|
2772
|
+
var getValidators = async (status = BondStatus.BOND_STATUS_BONDED) => {
|
|
2773
|
+
try {
|
|
2774
|
+
const client = await getRestClient();
|
|
2775
|
+
const statusStr = status === BondStatus.BOND_STATUS_BONDED ? "BOND_STATUS_BONDED" : status === BondStatus.BOND_STATUS_UNBONDING ? "BOND_STATUS_UNBONDING" : status === BondStatus.BOND_STATUS_UNBONDED ? "BOND_STATUS_UNBONDED" : "";
|
|
2776
|
+
const resp = await client.cosmos.staking.v1beta1.validators({
|
|
2777
|
+
status: statusStr,
|
|
2778
|
+
pagination: PageRequest5.fromPartial({
|
|
2779
|
+
limit: BigInt(500)
|
|
2780
|
+
})
|
|
2781
|
+
});
|
|
2782
|
+
return resp.validators;
|
|
2783
|
+
} catch (e) {
|
|
2784
|
+
console.error("failed to get validators", e);
|
|
2785
|
+
return [];
|
|
2786
|
+
}
|
|
2787
|
+
};
|
|
2788
|
+
var getDelegatorValidators = async (address) => {
|
|
2789
|
+
try {
|
|
2790
|
+
const client = await getRestClient();
|
|
2791
|
+
const resp = await client.cosmos.staking.v1beta1.delegatorValidators({
|
|
2792
|
+
delegatorAddr: address,
|
|
2793
|
+
pagination: PageRequest5.fromPartial({
|
|
2794
|
+
limit: BigInt(500)
|
|
2795
|
+
})
|
|
2796
|
+
});
|
|
2797
|
+
return resp.validators;
|
|
2798
|
+
} catch (e) {
|
|
2799
|
+
console.error("failed to get delegator validators", e);
|
|
2800
|
+
return [];
|
|
2801
|
+
}
|
|
2802
|
+
};
|
|
2803
|
+
var getDelegatorDelegations = async (address) => {
|
|
2804
|
+
try {
|
|
2805
|
+
const client = await getRestClient();
|
|
2806
|
+
const resp = await client.cosmos.staking.v1beta1.delegatorDelegations({
|
|
2807
|
+
delegatorAddr: address,
|
|
2808
|
+
pagination: PageRequest5.fromPartial({
|
|
2809
|
+
limit: BigInt(1e3)
|
|
2810
|
+
})
|
|
2811
|
+
});
|
|
2812
|
+
return resp.delegation_responses;
|
|
2813
|
+
} catch (e) {
|
|
2814
|
+
console.error("failed to get delegator delegations", e);
|
|
2815
|
+
return [];
|
|
2816
|
+
}
|
|
2817
|
+
};
|
|
2818
|
+
var getValidatorDelegatorRewards = async (address, validatorAddress) => {
|
|
2819
|
+
try {
|
|
2820
|
+
const client = await getRestClient();
|
|
2821
|
+
const resp = await client.cosmos.distribution.v1beta1.delegationRewards({
|
|
2822
|
+
delegatorAddress: address,
|
|
2823
|
+
validatorAddress
|
|
2824
|
+
});
|
|
2825
|
+
return resp.rewards;
|
|
2826
|
+
} catch (e) {
|
|
2827
|
+
console.error("failed to get validator delegator rewards", e);
|
|
2828
|
+
return [];
|
|
2829
|
+
}
|
|
2830
|
+
};
|
|
2771
2831
|
|
|
2772
2832
|
// src/query/aggregator.ts
|
|
2773
2833
|
var getAllTickersUrl = () => {
|
|
@@ -3853,9 +3913,104 @@ var useTx = (chainName, isCosmos, isIBC) => {
|
|
|
3853
3913
|
};
|
|
3854
3914
|
};
|
|
3855
3915
|
|
|
3916
|
+
// src/hooks/useValidatorLogos.ts
|
|
3917
|
+
import { useCallback as useCallback12, useEffect as useEffect3, useRef as useRef2, useState as useState4 } from "react";
|
|
3918
|
+
var KEYBASE_API_URL = "https://keybase.io/_/api/1.0/user/lookup.json";
|
|
3919
|
+
var LOGOS_STORAGE_KEY = "validator_logos";
|
|
3920
|
+
var LOGOS_TTL = 24 * 60 * 60 * 1e3;
|
|
3921
|
+
var useValidatorLogos = (validators) => {
|
|
3922
|
+
const [logos, setLogos] = useState4({});
|
|
3923
|
+
const [isLoading, setIsLoading] = useState4(false);
|
|
3924
|
+
const fetchedRef = useRef2(false);
|
|
3925
|
+
const validatorCountRef = useRef2(0);
|
|
3926
|
+
const fetchLogos = useCallback12(async (identities) => {
|
|
3927
|
+
if (identities.length === 0) return {};
|
|
3928
|
+
let cached = null;
|
|
3929
|
+
try {
|
|
3930
|
+
const raw = typeof window !== "undefined" ? localStorage.getItem(LOGOS_STORAGE_KEY) : null;
|
|
3931
|
+
if (raw) {
|
|
3932
|
+
const parsed = JSON.parse(raw);
|
|
3933
|
+
if (parsed && typeof parsed === "object" && parsed.data && (!parsed.expiry || Date.now() < parsed.expiry)) {
|
|
3934
|
+
cached = parsed.data;
|
|
3935
|
+
}
|
|
3936
|
+
}
|
|
3937
|
+
} catch (e) {
|
|
3938
|
+
}
|
|
3939
|
+
if (cached) {
|
|
3940
|
+
const allCached = identities.every(
|
|
3941
|
+
(v) => v.operatorAddress in cached
|
|
3942
|
+
);
|
|
3943
|
+
if (allCached) {
|
|
3944
|
+
return cached;
|
|
3945
|
+
}
|
|
3946
|
+
}
|
|
3947
|
+
const result = cached != null ? cached : {};
|
|
3948
|
+
const toFetch = identities.filter((v) => !(v.operatorAddress in result));
|
|
3949
|
+
if (toFetch.length === 0) return result;
|
|
3950
|
+
const chunkSize = 20;
|
|
3951
|
+
for (let i = 0; i < toFetch.length; i += chunkSize) {
|
|
3952
|
+
const chunk = toFetch.slice(i, i + chunkSize);
|
|
3953
|
+
const chunkResults = await Promise.all(
|
|
3954
|
+
chunk.map(async ({ operatorAddress, identity }) => {
|
|
3955
|
+
var _a2, _b2, _c, _d, _e;
|
|
3956
|
+
if (!identity) {
|
|
3957
|
+
return { operatorAddress, url: "" };
|
|
3958
|
+
}
|
|
3959
|
+
try {
|
|
3960
|
+
const resp = await fetch(
|
|
3961
|
+
`${KEYBASE_API_URL}?key_suffix=${encodeURIComponent(identity)}&fields=pictures`
|
|
3962
|
+
);
|
|
3963
|
+
const data = await resp.json();
|
|
3964
|
+
const url = (_e = (_d = (_c = (_b2 = (_a2 = data == null ? void 0 : data.them) == null ? void 0 : _a2[0]) == null ? void 0 : _b2.pictures) == null ? void 0 : _c.primary) == null ? void 0 : _d.url) != null ? _e : "";
|
|
3965
|
+
return { operatorAddress, url };
|
|
3966
|
+
} catch (e) {
|
|
3967
|
+
return { operatorAddress, url: "" };
|
|
3968
|
+
}
|
|
3969
|
+
})
|
|
3970
|
+
);
|
|
3971
|
+
for (const { operatorAddress, url } of chunkResults) {
|
|
3972
|
+
result[operatorAddress] = url;
|
|
3973
|
+
}
|
|
3974
|
+
if (i + chunkSize < toFetch.length) {
|
|
3975
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
3976
|
+
}
|
|
3977
|
+
}
|
|
3978
|
+
try {
|
|
3979
|
+
if (typeof window !== "undefined") {
|
|
3980
|
+
localStorage.setItem(LOGOS_STORAGE_KEY, JSON.stringify({
|
|
3981
|
+
data: result,
|
|
3982
|
+
expiry: Date.now() + LOGOS_TTL
|
|
3983
|
+
}));
|
|
3984
|
+
}
|
|
3985
|
+
} catch (e) {
|
|
3986
|
+
}
|
|
3987
|
+
return result;
|
|
3988
|
+
}, []);
|
|
3989
|
+
useEffect3(() => {
|
|
3990
|
+
if (!validators || validators.length === 0) return;
|
|
3991
|
+
if (fetchedRef.current && validatorCountRef.current === validators.length) return;
|
|
3992
|
+
const identities = validators.map((v) => {
|
|
3993
|
+
var _a2, _b2;
|
|
3994
|
+
return {
|
|
3995
|
+
operatorAddress: v.operator_address,
|
|
3996
|
+
identity: (_b2 = (_a2 = v.description) == null ? void 0 : _a2.identity) != null ? _b2 : ""
|
|
3997
|
+
};
|
|
3998
|
+
});
|
|
3999
|
+
setIsLoading(true);
|
|
4000
|
+
fetchedRef.current = true;
|
|
4001
|
+
validatorCountRef.current = validators.length;
|
|
4002
|
+
fetchLogos(identities).then((result) => {
|
|
4003
|
+
setLogos(result);
|
|
4004
|
+
}).catch(console.error).finally(() => {
|
|
4005
|
+
setIsLoading(false);
|
|
4006
|
+
});
|
|
4007
|
+
}, [validators, fetchLogos]);
|
|
4008
|
+
return { logos, isLoading };
|
|
4009
|
+
};
|
|
4010
|
+
|
|
3856
4011
|
// src/components/highlight.tsx
|
|
3857
4012
|
import { Text } from "@chakra-ui/react";
|
|
3858
|
-
import { useEffect as
|
|
4013
|
+
import { useEffect as useEffect4, useRef as useRef3, useState as useState5 } from "react";
|
|
3859
4014
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
3860
4015
|
var HighlightText = (_a2) => {
|
|
3861
4016
|
var _b2 = _a2, {
|
|
@@ -3871,14 +4026,14 @@ var HighlightText = (_a2) => {
|
|
|
3871
4026
|
"highlightIntensity",
|
|
3872
4027
|
"children"
|
|
3873
4028
|
]);
|
|
3874
|
-
const [isHighlighted, setIsHighlighted] =
|
|
3875
|
-
const isMountedRef =
|
|
3876
|
-
const timeoutRef =
|
|
4029
|
+
const [isHighlighted, setIsHighlighted] = useState5(false);
|
|
4030
|
+
const isMountedRef = useRef3(false);
|
|
4031
|
+
const timeoutRef = useRef3(void 0);
|
|
3877
4032
|
const childrenString = String(children);
|
|
3878
|
-
const previousValueRef =
|
|
4033
|
+
const previousValueRef = useRef3(childrenString);
|
|
3879
4034
|
const highlightOpacity = highlightIntensity === "subtle" ? "15" : "50";
|
|
3880
4035
|
const boxShadowStrength = highlightIntensity === "subtle" ? "10" : "25";
|
|
3881
|
-
|
|
4036
|
+
useEffect4(() => {
|
|
3882
4037
|
if (!isMountedRef.current) {
|
|
3883
4038
|
isMountedRef.current = true;
|
|
3884
4039
|
if (highlightOnMount) {
|
|
@@ -3924,10 +4079,10 @@ var HighlightText = (_a2) => {
|
|
|
3924
4079
|
// src/components/sidebar/sidebar.tsx
|
|
3925
4080
|
import { Icon, IconButton, Portal as Portal2 } from "@chakra-ui/react";
|
|
3926
4081
|
import { LuX } from "react-icons/lu";
|
|
3927
|
-
import { useState as
|
|
4082
|
+
import { useState as useState6 } from "react";
|
|
3928
4083
|
import { Fragment, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
3929
4084
|
var Sidebar = ({ children, trigger, ariaLabel }) => {
|
|
3930
|
-
const [isOpen, setIsOpen] =
|
|
4085
|
+
const [isOpen, setIsOpen] = useState6(false);
|
|
3931
4086
|
const handleTriggerClick = () => {
|
|
3932
4087
|
setIsOpen(true);
|
|
3933
4088
|
};
|
|
@@ -4051,7 +4206,7 @@ import {
|
|
|
4051
4206
|
} from "@chakra-ui/react";
|
|
4052
4207
|
import { Select, Portal as Portal3 } from "@chakra-ui/react";
|
|
4053
4208
|
import { useTheme } from "next-themes";
|
|
4054
|
-
import { useState as
|
|
4209
|
+
import { useState as useState7, useEffect as useEffect5, useMemo as useMemo13, useCallback as useCallback13 } from "react";
|
|
4055
4210
|
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
4056
4211
|
var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
4057
4212
|
const { setTheme, resolvedTheme } = useTheme();
|
|
@@ -4059,19 +4214,19 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4059
4214
|
const { settings, isLoaded, updateEndpoints, updatePreferredFeeDenom, defaultSettings } = useSettings();
|
|
4060
4215
|
const { connectionType } = useConnectionType();
|
|
4061
4216
|
const { feeTokens, isLoading: feeTokensLoading } = useFeeTokens();
|
|
4062
|
-
const [restEndpoint, setRestEndpoint] =
|
|
4063
|
-
const [rpcEndpoint, setRpcEndpoint] =
|
|
4064
|
-
const [isValidating, setIsValidating] =
|
|
4065
|
-
const [validationResults, setValidationResults] =
|
|
4066
|
-
const [preferredFeeDenom, setPreferredFeeDenom] =
|
|
4067
|
-
|
|
4217
|
+
const [restEndpoint, setRestEndpoint] = useState7("");
|
|
4218
|
+
const [rpcEndpoint, setRpcEndpoint] = useState7("");
|
|
4219
|
+
const [isValidating, setIsValidating] = useState7(false);
|
|
4220
|
+
const [validationResults, setValidationResults] = useState7({});
|
|
4221
|
+
const [preferredFeeDenom, setPreferredFeeDenom] = useState7(void 0);
|
|
4222
|
+
useEffect5(() => {
|
|
4068
4223
|
if (isLoaded) {
|
|
4069
4224
|
setRestEndpoint(settings.endpoints.restEndpoint);
|
|
4070
4225
|
setRpcEndpoint(settings.endpoints.rpcEndpoint);
|
|
4071
4226
|
setPreferredFeeDenom(settings.preferredFeeDenom || getChainNativeAssetDenom());
|
|
4072
4227
|
}
|
|
4073
4228
|
}, [isLoaded, settings]);
|
|
4074
|
-
const handleValidateEndpoints =
|
|
4229
|
+
const handleValidateEndpoints = useCallback13(async (rest, rpc) => {
|
|
4075
4230
|
setIsValidating(true);
|
|
4076
4231
|
setValidationResults({});
|
|
4077
4232
|
try {
|
|
@@ -4091,7 +4246,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4091
4246
|
setTimeout(() => setValidationResults({}), 1e4);
|
|
4092
4247
|
}
|
|
4093
4248
|
}, []);
|
|
4094
|
-
const handleSaveSettings =
|
|
4249
|
+
const handleSaveSettings = useCallback13(async (rest, rpc, feeDenom) => {
|
|
4095
4250
|
setValidationResults({});
|
|
4096
4251
|
const results = await validateEndpoints(rest, rpc);
|
|
4097
4252
|
if (!results.isValid) {
|
|
@@ -4111,7 +4266,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4111
4266
|
toast.success("Success!", "Settings have been saved.");
|
|
4112
4267
|
}
|
|
4113
4268
|
}, []);
|
|
4114
|
-
const handleResetToDefaults =
|
|
4269
|
+
const handleResetToDefaults = useCallback13(() => {
|
|
4115
4270
|
setRestEndpoint(defaultSettings.endpoints.restEndpoint);
|
|
4116
4271
|
setRpcEndpoint(defaultSettings.endpoints.rpcEndpoint);
|
|
4117
4272
|
setPreferredFeeDenom(defaultSettings.preferredFeeDenom);
|
|
@@ -4144,7 +4299,7 @@ var SettingsSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4144
4299
|
name: token.ticker || token.name
|
|
4145
4300
|
}))
|
|
4146
4301
|
}), [feeTokens]);
|
|
4147
|
-
const handleFeeTokenChange =
|
|
4302
|
+
const handleFeeTokenChange = useCallback13((denom) => {
|
|
4148
4303
|
setPreferredFeeDenom(denom || void 0);
|
|
4149
4304
|
}, []);
|
|
4150
4305
|
const hasUnsavedChanges = restEndpoint !== settings.endpoints.restEndpoint || rpcEndpoint !== settings.endpoints.rpcEndpoint || preferredFeeDenom !== settings.preferredFeeDenom;
|
|
@@ -4320,7 +4475,7 @@ import {
|
|
|
4320
4475
|
VStack as VStack2
|
|
4321
4476
|
} from "@chakra-ui/react";
|
|
4322
4477
|
import { LuCopy, LuExternalLink, LuX as LuX2 } from "react-icons/lu";
|
|
4323
|
-
import { useCallback as
|
|
4478
|
+
import { useCallback as useCallback14, useEffect as useEffect6, useMemo as useMemo14, useRef as useRef4, useState as useState8 } from "react";
|
|
4324
4479
|
import { WalletState } from "@interchain-kit/core";
|
|
4325
4480
|
import BigNumber14 from "bignumber.js";
|
|
4326
4481
|
import { cosmos } from "@bze/bzejs";
|
|
@@ -4341,7 +4496,7 @@ var validateAmount = (amount, coin, onError) => {
|
|
|
4341
4496
|
}
|
|
4342
4497
|
};
|
|
4343
4498
|
var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
4344
|
-
const [showSendButton, setShowSendButton] =
|
|
4499
|
+
const [showSendButton, setShowSendButton] = useState8(false);
|
|
4345
4500
|
const formattedBalanceAmount = useMemo14(() => {
|
|
4346
4501
|
var _a2;
|
|
4347
4502
|
return prettyAmount(uAmountToBigNumberAmount(asset.amount, (_a2 = asset.decimals) != null ? _a2 : 0));
|
|
@@ -4398,14 +4553,14 @@ var BalanceItem = ({ asset, onClick, accentColor }) => {
|
|
|
4398
4553
|
);
|
|
4399
4554
|
};
|
|
4400
4555
|
var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
4401
|
-
const [isLoading, setIsLoading] =
|
|
4402
|
-
const [selectedCoin, setSelectedCoin] =
|
|
4403
|
-
const [sendAmount, setSendAmount] =
|
|
4404
|
-
const [sendAmountError, setSendAmountError] =
|
|
4405
|
-
const [recipient, setRecipient] =
|
|
4406
|
-
const [recipientError, setRecipientError] =
|
|
4407
|
-
const [memo, setMemo] =
|
|
4408
|
-
const [memoError, setMemoError] =
|
|
4556
|
+
const [isLoading, setIsLoading] = useState8(false);
|
|
4557
|
+
const [selectedCoin, setSelectedCoin] = useState8();
|
|
4558
|
+
const [sendAmount, setSendAmount] = useState8("");
|
|
4559
|
+
const [sendAmountError, setSendAmountError] = useState8("");
|
|
4560
|
+
const [recipient, setRecipient] = useState8("");
|
|
4561
|
+
const [recipientError, setRecipientError] = useState8("");
|
|
4562
|
+
const [memo, setMemo] = useState8("");
|
|
4563
|
+
const [memoError, setMemoError] = useState8("");
|
|
4409
4564
|
const { toast } = useToast();
|
|
4410
4565
|
const { status, address } = useChain3(getChainName());
|
|
4411
4566
|
const { tx } = useSDKTx(getChainName());
|
|
@@ -4422,13 +4577,13 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4422
4577
|
const isValidForm = useMemo14(() => {
|
|
4423
4578
|
return selectedCoin && memoError === "" && recipientError === "" && sendAmountError === "" && sendAmount !== "" && recipient !== "";
|
|
4424
4579
|
}, [selectedCoin, memoError, recipientError, sendAmountError, sendAmount, recipient]);
|
|
4425
|
-
const resetSendForm =
|
|
4580
|
+
const resetSendForm = useCallback14(() => {
|
|
4426
4581
|
setSelectedCoin(void 0);
|
|
4427
4582
|
setSendAmount("");
|
|
4428
4583
|
setRecipient("");
|
|
4429
4584
|
setMemo("");
|
|
4430
4585
|
}, []);
|
|
4431
|
-
const handleSend =
|
|
4586
|
+
const handleSend = useCallback14(async () => {
|
|
4432
4587
|
var _a2, _b2;
|
|
4433
4588
|
if (!isValidForm) {
|
|
4434
4589
|
toast.error("Can not send coins!", "Please check the input data.");
|
|
@@ -4453,11 +4608,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4453
4608
|
setIsLoading(false);
|
|
4454
4609
|
onClose();
|
|
4455
4610
|
}, [address, memo, onClose, recipient, selectedCoin, sendAmount, status]);
|
|
4456
|
-
const handleCancel =
|
|
4611
|
+
const handleCancel = useCallback14(() => {
|
|
4457
4612
|
resetSendForm();
|
|
4458
4613
|
onClose();
|
|
4459
4614
|
}, [onClose, resetSendForm]);
|
|
4460
|
-
const onRecipientChange =
|
|
4615
|
+
const onRecipientChange = useCallback14((recipient2) => {
|
|
4461
4616
|
setRecipient(recipient2);
|
|
4462
4617
|
if (recipient2.length === 0) {
|
|
4463
4618
|
setRecipientError("");
|
|
@@ -4470,11 +4625,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4470
4625
|
setRecipientError(validate.message);
|
|
4471
4626
|
}
|
|
4472
4627
|
}, []);
|
|
4473
|
-
const onAmountChange =
|
|
4628
|
+
const onAmountChange = useCallback14((amount) => {
|
|
4474
4629
|
setSendAmount(sanitizeNumberInput(amount));
|
|
4475
4630
|
setSendAmountError("");
|
|
4476
4631
|
}, []);
|
|
4477
|
-
const onCoinSelectChange =
|
|
4632
|
+
const onCoinSelectChange = useCallback14((ticker) => {
|
|
4478
4633
|
if (ticker === "") return;
|
|
4479
4634
|
const selectedCoin2 = balances.find((item) => item.ticker === ticker);
|
|
4480
4635
|
if (selectedCoin2) {
|
|
@@ -4482,13 +4637,13 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4482
4637
|
validateAmount(sendAmount, selectedCoin2, setSendAmountError);
|
|
4483
4638
|
}
|
|
4484
4639
|
}, [sendAmount, balances]);
|
|
4485
|
-
const setMaxAmount =
|
|
4640
|
+
const setMaxAmount = useCallback14(() => {
|
|
4486
4641
|
if (!selectedCoin) return;
|
|
4487
4642
|
const maxAmount = uAmountToBigNumberAmount(selectedCoin.amount, selectedCoin.decimals);
|
|
4488
4643
|
onAmountChange(maxAmount.toString());
|
|
4489
4644
|
validateAmount(maxAmount.toString(), selectedCoin, setSendAmountError);
|
|
4490
4645
|
}, [selectedCoin, onAmountChange]);
|
|
4491
|
-
const onMemoChange =
|
|
4646
|
+
const onMemoChange = useCallback14((memo2) => {
|
|
4492
4647
|
setMemo(memo2);
|
|
4493
4648
|
if (memo2.length > 256) {
|
|
4494
4649
|
setMemoError("Memo must be less than or equal to 256 characters");
|
|
@@ -4496,7 +4651,7 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4496
4651
|
setMemoError("");
|
|
4497
4652
|
}
|
|
4498
4653
|
}, []);
|
|
4499
|
-
|
|
4654
|
+
useEffect6(() => {
|
|
4500
4655
|
if (selectedTicker !== "") {
|
|
4501
4656
|
onCoinSelectChange(selectedTicker);
|
|
4502
4657
|
}
|
|
@@ -4659,11 +4814,11 @@ var SendForm = ({ balances, onClose, selectedTicker, accentColor }) => {
|
|
|
4659
4814
|
] });
|
|
4660
4815
|
};
|
|
4661
4816
|
var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
4662
|
-
const [viewState, setViewState] =
|
|
4663
|
-
const [isDisconnecting, setIsDisconnecting] =
|
|
4664
|
-
const [showCopiedTooltip, setShowCopiedTooltip] =
|
|
4665
|
-
const [clickedBalance, setClickedBalance] =
|
|
4666
|
-
const copyButtonRef =
|
|
4817
|
+
const [viewState, setViewState] = useState8("balances");
|
|
4818
|
+
const [isDisconnecting, setIsDisconnecting] = useState8(false);
|
|
4819
|
+
const [showCopiedTooltip, setShowCopiedTooltip] = useState8(false);
|
|
4820
|
+
const [clickedBalance, setClickedBalance] = useState8("");
|
|
4821
|
+
const copyButtonRef = useRef4(null);
|
|
4667
4822
|
const {
|
|
4668
4823
|
status,
|
|
4669
4824
|
username,
|
|
@@ -4699,15 +4854,15 @@ var WalletSidebarContent = ({ accentColor = "blue" }) => {
|
|
|
4699
4854
|
setShowCopiedTooltip(true);
|
|
4700
4855
|
setTimeout(() => setShowCopiedTooltip(false), 2e3);
|
|
4701
4856
|
};
|
|
4702
|
-
const handleCancel =
|
|
4857
|
+
const handleCancel = useCallback14(() => {
|
|
4703
4858
|
setViewState("balances");
|
|
4704
4859
|
setClickedBalance("");
|
|
4705
4860
|
}, []);
|
|
4706
|
-
const onBalanceClick =
|
|
4861
|
+
const onBalanceClick = useCallback14((ticker) => {
|
|
4707
4862
|
setClickedBalance(ticker);
|
|
4708
4863
|
setViewState("send");
|
|
4709
4864
|
}, []);
|
|
4710
|
-
const handleDisconnectAll =
|
|
4865
|
+
const handleDisconnectAll = useCallback14(async () => {
|
|
4711
4866
|
setIsDisconnecting(true);
|
|
4712
4867
|
try {
|
|
4713
4868
|
console.log("Disconnected from all chains");
|
|
@@ -5032,6 +5187,8 @@ export {
|
|
|
5032
5187
|
getCurrentEpoch,
|
|
5033
5188
|
getCurrentWeekEpochEndTime,
|
|
5034
5189
|
getDefaultTxMemo,
|
|
5190
|
+
getDelegatorDelegations,
|
|
5191
|
+
getDelegatorValidators,
|
|
5035
5192
|
getDenomType,
|
|
5036
5193
|
getDistributionParams,
|
|
5037
5194
|
getEcosystemApps,
|
|
@@ -5088,8 +5245,10 @@ export {
|
|
|
5088
5245
|
getStakingRewards,
|
|
5089
5246
|
getTradingViewIntervals,
|
|
5090
5247
|
getUSDCDenom,
|
|
5248
|
+
getValidatorDelegatorRewards,
|
|
5091
5249
|
getValidatorPageUrl,
|
|
5092
5250
|
getValidatorSupportedDenoms,
|
|
5251
|
+
getValidators,
|
|
5093
5252
|
getWalletChainsNames,
|
|
5094
5253
|
getWeekEpochInfo,
|
|
5095
5254
|
intlDateFormat,
|
|
@@ -5155,6 +5314,7 @@ export {
|
|
|
5155
5314
|
useSettings,
|
|
5156
5315
|
useSigningClient,
|
|
5157
5316
|
useToast,
|
|
5317
|
+
useValidatorLogos,
|
|
5158
5318
|
validateBZEBech32Address,
|
|
5159
5319
|
validateBech32Address,
|
|
5160
5320
|
validateEndpoints,
|