@jpool/bond-sdk 0.9.0-next.16 → 0.9.0-next.17

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.js CHANGED
@@ -5078,8 +5078,7 @@ var jbond_default = {
5078
5078
  ],
5079
5079
  accounts: [
5080
5080
  {
5081
- name: "global_state",
5082
- writable: true
5081
+ name: "global_state"
5083
5082
  },
5084
5083
  {
5085
5084
  name: "bond_state",
@@ -5115,7 +5114,10 @@ var jbond_default = {
5115
5114
  {
5116
5115
  name: "authority",
5117
5116
  writable: true,
5118
- signer: true
5117
+ signer: true,
5118
+ relations: [
5119
+ "global_state"
5120
+ ]
5119
5121
  },
5120
5122
  {
5121
5123
  name: "reserve"
@@ -6905,6 +6907,7 @@ var JBondClient = class _JBondClient {
6905
6907
  * Fetch bond state with stats
6906
6908
  * @param bondType - Type of the bond
6907
6909
  * @param bondName - Name of the bond
6910
+ * @param withStats
6908
6911
  */
6909
6912
  async getBondState(bondType, bondName, withStats = false) {
6910
6913
  const bondState = await this.program.account.bondState.fetch(this.pda.bondState(bondType, bondName)[0]);
@@ -6939,7 +6942,9 @@ var JBondClient = class _JBondClient {
6939
6942
  return 1 /* Finished */;
6940
6943
  }
6941
6944
  }
6942
- /** Get all validator bonds for a given bond state */
6945
+ /**
6946
+ * Get all validator bonds for a given bond state
6947
+ */
6943
6948
  async getValidatorBondsByState(bondType, bondName) {
6944
6949
  const validatorBonds = [];
6945
6950
  const bondStatePda = this.pda.bondState(bondType, bondName)[0];
@@ -6958,9 +6963,6 @@ var JBondClient = class _JBondClient {
6958
6963
  }
6959
6964
  /**
6960
6965
  * Fetch validator bond data or null if not found
6961
- * @param bondType
6962
- * @param bondName
6963
- * @param vote
6964
6966
  */
6965
6967
  async getValidatorBond(bondType, bondName, vote) {
6966
6968
  const [address] = this.pda.validatorBond(bondType, bondName, new web3_js.PublicKey(vote));
@@ -7009,7 +7011,9 @@ var JBondClient = class _JBondClient {
7009
7011
  }
7010
7012
  });
7011
7013
  }
7012
- // Get total collected collateral for a bond state
7014
+ /**
7015
+ * Get total collected collateral for a bond state
7016
+ */
7013
7017
  async getBondStateTotalCollected(bondType, bondName, votes) {
7014
7018
  const bondStateData = await this.getBondState(bondType, bondName);
7015
7019
  const bondStateCollateralType = bondStateData[0].collateralType;
@@ -7070,6 +7074,11 @@ var JBondClient = class _JBondClient {
7070
7074
  }
7071
7075
  });
7072
7076
  }
7077
+ /**
7078
+ * Get bond state stats
7079
+ * @param state
7080
+ * @private
7081
+ */
7073
7082
  async getBondStateStats(state) {
7074
7083
  const validatorBonds = await this.getValidatorBondsByState(state.bondType, state.name);
7075
7084
  const totalCollected = await this.getBondStateTotalCollected(
@@ -7077,11 +7086,10 @@ var JBondClient = class _JBondClient {
7077
7086
  state.name,
7078
7087
  validatorBonds.map((vb) => vb.voteAccount)
7079
7088
  );
7080
- const bondStateStats = {
7089
+ return {
7081
7090
  totalCollected,
7082
- status: await this.getBondStateSessionStatus(state)
7091
+ status: this.getBondStateSessionStatus(state)
7083
7092
  };
7084
- return bondStateStats;
7085
7093
  }
7086
7094
  /**
7087
7095
  * Load stake pool account and cache it if not already cached