@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.mjs CHANGED
@@ -5043,8 +5043,7 @@ var jbond_default = {
5043
5043
  ],
5044
5044
  accounts: [
5045
5045
  {
5046
- name: "global_state",
5047
- writable: true
5046
+ name: "global_state"
5048
5047
  },
5049
5048
  {
5050
5049
  name: "bond_state",
@@ -5080,7 +5079,10 @@ var jbond_default = {
5080
5079
  {
5081
5080
  name: "authority",
5082
5081
  writable: true,
5083
- signer: true
5082
+ signer: true,
5083
+ relations: [
5084
+ "global_state"
5085
+ ]
5084
5086
  },
5085
5087
  {
5086
5088
  name: "reserve"
@@ -6869,6 +6871,7 @@ var JBondClient = class _JBondClient {
6869
6871
  * Fetch bond state with stats
6870
6872
  * @param bondType - Type of the bond
6871
6873
  * @param bondName - Name of the bond
6874
+ * @param withStats
6872
6875
  */
6873
6876
  async getBondState(bondType, bondName, withStats = false) {
6874
6877
  const bondState = await this.program.account.bondState.fetch(this.pda.bondState(bondType, bondName)[0]);
@@ -6903,7 +6906,9 @@ var JBondClient = class _JBondClient {
6903
6906
  return 1 /* Finished */;
6904
6907
  }
6905
6908
  }
6906
- /** Get all validator bonds for a given bond state */
6909
+ /**
6910
+ * Get all validator bonds for a given bond state
6911
+ */
6907
6912
  async getValidatorBondsByState(bondType, bondName) {
6908
6913
  const validatorBonds = [];
6909
6914
  const bondStatePda = this.pda.bondState(bondType, bondName)[0];
@@ -6922,9 +6927,6 @@ var JBondClient = class _JBondClient {
6922
6927
  }
6923
6928
  /**
6924
6929
  * Fetch validator bond data or null if not found
6925
- * @param bondType
6926
- * @param bondName
6927
- * @param vote
6928
6930
  */
6929
6931
  async getValidatorBond(bondType, bondName, vote) {
6930
6932
  const [address] = this.pda.validatorBond(bondType, bondName, new PublicKey(vote));
@@ -6973,7 +6975,9 @@ var JBondClient = class _JBondClient {
6973
6975
  }
6974
6976
  });
6975
6977
  }
6976
- // Get total collected collateral for a bond state
6978
+ /**
6979
+ * Get total collected collateral for a bond state
6980
+ */
6977
6981
  async getBondStateTotalCollected(bondType, bondName, votes) {
6978
6982
  const bondStateData = await this.getBondState(bondType, bondName);
6979
6983
  const bondStateCollateralType = bondStateData[0].collateralType;
@@ -7034,6 +7038,11 @@ var JBondClient = class _JBondClient {
7034
7038
  }
7035
7039
  });
7036
7040
  }
7041
+ /**
7042
+ * Get bond state stats
7043
+ * @param state
7044
+ * @private
7045
+ */
7037
7046
  async getBondStateStats(state) {
7038
7047
  const validatorBonds = await this.getValidatorBondsByState(state.bondType, state.name);
7039
7048
  const totalCollected = await this.getBondStateTotalCollected(
@@ -7041,11 +7050,10 @@ var JBondClient = class _JBondClient {
7041
7050
  state.name,
7042
7051
  validatorBonds.map((vb) => vb.voteAccount)
7043
7052
  );
7044
- const bondStateStats = {
7053
+ return {
7045
7054
  totalCollected,
7046
- status: await this.getBondStateSessionStatus(state)
7055
+ status: this.getBondStateSessionStatus(state)
7047
7056
  };
7048
- return bondStateStats;
7049
7057
  }
7050
7058
  /**
7051
7059
  * Load stake pool account and cache it if not already cached