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

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
@@ -7047,11 +7047,19 @@ var JBondClient = class _JBondClient {
7047
7047
  const authority = this.provider.wallet?.publicKey;
7048
7048
  return this.program.methods.sessionStart(new import_bn.BN(props.duration)).accountsPartial({ bondState, authority }).instruction();
7049
7049
  }
7050
+ async lockFunds(props) {
7051
+ const ix = await this.getLockFundsIx(props);
7052
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7053
+ }
7054
+ async releaseFunds(props) {
7055
+ const ix = await this.getReleaseFundsIx(props);
7056
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
7057
+ }
7050
7058
  /**
7051
7059
  * Build lock funds instruction
7052
7060
  */
7053
7061
  async getLockFundsIx(props) {
7054
- const { bondType, name, voteAccount, amount } = props;
7062
+ const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
7055
7063
  const [bondState] = this.pda.bondState(bondType, name);
7056
7064
  let collateralType = props.collateralType;
7057
7065
  if (!collateralType) {
@@ -7059,11 +7067,10 @@ var JBondClient = class _JBondClient {
7059
7067
  collateralType = bondState2.collateralType;
7060
7068
  }
7061
7069
  const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
7062
- const authority = this.provider.wallet?.publicKey;
7063
7070
  const accounts = {
7064
7071
  bondState,
7065
7072
  validatorBond,
7066
- payer: authority,
7073
+ payer: withdrawAuthority,
7067
7074
  bondTokenAccount: null
7068
7075
  };
7069
7076
  matchVariant(collateralType, {
@@ -7080,12 +7087,11 @@ var JBondClient = class _JBondClient {
7080
7087
  * Build release funds instruction
7081
7088
  */
7082
7089
  async getReleaseFundsIx(props) {
7083
- const { bondType, name, voteAccount, amount } = props;
7090
+ const { bondType, name, voteAccount, amount, withdrawAuthority } = props;
7084
7091
  const [validatorBond] = this.pda.validatorBond(bondType, name, voteAccount);
7085
- const authority = this.provider.wallet?.publicKey;
7086
7092
  const accounts = {
7087
7093
  validatorBond,
7088
- payer: authority
7094
+ payer: withdrawAuthority
7089
7095
  };
7090
7096
  return this.program.methods.bondReleaseFunds(solToLamports(amount)).accountsPartial(accounts).instruction();
7091
7097
  }