@jpool/bond-sdk 0.11.0-next.8 → 0.11.0-next.9

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
@@ -2103,6 +2103,10 @@ declare class JBondClient {
2103
2103
  * Build release funds instruction
2104
2104
  */
2105
2105
  getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
2106
+ /**
2107
+ * Get available collateral for withdrawal (taking into account locked funds)
2108
+ */
2109
+ getAvailableCollateral(bondType: BondType, bondName: string, voteAccount: PublicKeyInitData): Promise<number>;
2106
2110
  /**
2107
2111
  * Get all bond states with total collected collateral
2108
2112
  */
package/dist/index.d.ts CHANGED
@@ -2103,6 +2103,10 @@ declare class JBondClient {
2103
2103
  * Build release funds instruction
2104
2104
  */
2105
2105
  getReleaseFundsIx(props: BondReleaseFunds): Promise<TransactionInstruction>;
2106
+ /**
2107
+ * Get available collateral for withdrawal (taking into account locked funds)
2108
+ */
2109
+ getAvailableCollateral(bondType: BondType, bondName: string, voteAccount: PublicKeyInitData): Promise<number>;
2106
2110
  /**
2107
2111
  * Get all bond states with total collected collateral
2108
2112
  */
package/dist/index.js CHANGED
@@ -7127,6 +7127,13 @@ var JBondClient = class _JBondClient {
7127
7127
  };
7128
7128
  return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
7129
7129
  }
7130
+ /**
7131
+ * Get available collateral for withdrawal (taking into account locked funds)
7132
+ */
7133
+ async getAvailableCollateral(bondType, bondName, voteAccount) {
7134
+ const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
7135
+ return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.currentEpochLocked.toNumber();
7136
+ }
7130
7137
  /**
7131
7138
  * Get all bond states with total collected collateral
7132
7139
  */