@bze/bze-ui-kit 0.4.0 → 0.4.1

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.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 = () => {
@@ -5032,6 +5092,8 @@ export {
5032
5092
  getCurrentEpoch,
5033
5093
  getCurrentWeekEpochEndTime,
5034
5094
  getDefaultTxMemo,
5095
+ getDelegatorDelegations,
5096
+ getDelegatorValidators,
5035
5097
  getDenomType,
5036
5098
  getDistributionParams,
5037
5099
  getEcosystemApps,
@@ -5088,8 +5150,10 @@ export {
5088
5150
  getStakingRewards,
5089
5151
  getTradingViewIntervals,
5090
5152
  getUSDCDenom,
5153
+ getValidatorDelegatorRewards,
5091
5154
  getValidatorPageUrl,
5092
5155
  getValidatorSupportedDenoms,
5156
+ getValidators,
5093
5157
  getWalletChainsNames,
5094
5158
  getWeekEpochInfo,
5095
5159
  intlDateFormat,