@jpool/bond-sdk 0.9.0-next.4 → 0.9.0-next.5

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 CHANGED
@@ -1835,6 +1835,7 @@ declare class JBondClient {
1835
1835
  */
1836
1836
  getGlobalState(): Promise<GlobalState>;
1837
1837
  getBondState(bondType: BondType, bondName: string): Promise<BondState>;
1838
+ getAllBondStates(_bondType: BondType): Promise<BondState[]>;
1838
1839
  getBondStateSessionStatus(bondType: BondType, bondName: string): Promise<SessionStatus>;
1839
1840
  /**
1840
1841
  * Fetch validator bond data or null if not found
package/dist/index.d.ts CHANGED
@@ -1835,6 +1835,7 @@ declare class JBondClient {
1835
1835
  */
1836
1836
  getGlobalState(): Promise<GlobalState>;
1837
1837
  getBondState(bondType: BondType, bondName: string): Promise<BondState>;
1838
+ getAllBondStates(_bondType: BondType): Promise<BondState[]>;
1838
1839
  getBondStateSessionStatus(bondType: BondType, bondName: string): Promise<SessionStatus>;
1839
1840
  /**
1840
1841
  * Fetch validator bond data or null if not found
package/dist/index.js CHANGED
@@ -7047,6 +7047,15 @@ var JBondClient = class _JBondClient {
7047
7047
  const [bondState] = this.pda.bondState(bondType, bondName);
7048
7048
  return await this.program.account.bondState.fetch(bondState);
7049
7049
  }
7050
+ /// Fetch all bond states by type
7051
+ async getAllBondStates(_bondType) {
7052
+ const bondStates = [];
7053
+ const bondStateAccounts = await this.program.account.bondState.all();
7054
+ for (const { account } of bondStateAccounts) {
7055
+ bondStates.push(account);
7056
+ }
7057
+ return bondStates;
7058
+ }
7050
7059
  async getBondStateSessionStatus(bondType, bondName) {
7051
7060
  const bondState = await this.getBondState(bondType, bondName);
7052
7061
  const now = Math.floor(Date.now() / 1e3);