@jpool/bond-sdk 0.11.0-next.16 → 0.11.0-next.18

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
@@ -4554,7 +4554,7 @@ var VALIDATOR_BOND_SEED = "validator_bond";
4554
4554
  var STANDARD_BOND_SEED = "standard";
4555
4555
  var CROWDFUNDING_BOND_SEED = "crowdfunding";
4556
4556
  var ENV_PROGRAM_ID = {
4557
- // [BondClientEnv.DEV]: new PublicKey('...'),
4557
+ // [JBondClientEnv.DEV]: new PublicKey('...'),
4558
4558
  };
4559
4559
 
4560
4560
  // src/types/index.ts
@@ -4988,8 +4988,8 @@ var jbond_default = {
4988
4988
  name: "bond_lock_funds",
4989
4989
  docs: [
4990
4990
  "Locks funds for both the current and upcoming epoch.",
4991
- "Moves collateral from available to locked state, making it unavailable for withdrawal for the current and next epoch.",
4992
- "# Errors",
4991
+ "Moves collateral from available to locked state, making it unavailable for withdrawal for",
4992
+ "the current and next epoch. # Errors",
4993
4993
  "Fails if the validator is not active, or if there are insufficient available funds."
4994
4994
  ],
4995
4995
  discriminator: [
@@ -5244,6 +5244,37 @@ var jbond_default = {
5244
5244
  }
5245
5245
  ]
5246
5246
  },
5247
+ {
5248
+ name: "bond_remove",
5249
+ docs: [
5250
+ "Removes bond state"
5251
+ ],
5252
+ discriminator: [
5253
+ 121,
5254
+ 112,
5255
+ 246,
5256
+ 177,
5257
+ 181,
5258
+ 8,
5259
+ 18,
5260
+ 220
5261
+ ],
5262
+ accounts: [
5263
+ {
5264
+ name: "bond_state",
5265
+ writable: true
5266
+ },
5267
+ {
5268
+ name: "authority",
5269
+ writable: true,
5270
+ signer: true,
5271
+ relations: [
5272
+ "bond_state"
5273
+ ]
5274
+ }
5275
+ ],
5276
+ args: []
5277
+ },
5247
5278
  {
5248
5279
  name: "bond_set_withdraw_authority",
5249
5280
  docs: [
@@ -5430,7 +5461,7 @@ var jbond_default = {
5430
5461
  "",
5431
5462
  "This function should be called at epoch boundaries to update the bond's",
5432
5463
  "`last_update_epoch` and move the `next_epoch_locked` amount into",
5433
- "`current_epoch_locked`. It ensures that the update only occurs once per epoch.",
5464
+ "`locked`. It ensures that the update only occurs once per epoch.",
5434
5465
  "",
5435
5466
  "# Errors",
5436
5467
  "Returns [`BondError::InvalidEpoch`] if called more than once in the same epoch,",
@@ -6458,16 +6489,16 @@ var jbond_default = {
6458
6489
  type: "u8"
6459
6490
  },
6460
6491
  {
6461
- name: "next_epoch_locked",
6492
+ name: "locked",
6462
6493
  docs: [
6463
- "Amount of collateral locked for the next epoch"
6494
+ "Amount of collateral currently locked"
6464
6495
  ],
6465
6496
  type: "u64"
6466
6497
  },
6467
6498
  {
6468
- name: "current_epoch_locked",
6499
+ name: "next_epoch_locked",
6469
6500
  docs: [
6470
- "Amount of collateral locked for the current epoch"
6501
+ "Amount of collateral locked for the next epoch"
6471
6502
  ],
6472
6503
  type: "u64"
6473
6504
  },
@@ -6799,6 +6830,10 @@ var JBondClient = class _JBondClient {
6799
6830
  const ix = await this.getBondSessionFinishIx(props);
6800
6831
  return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6801
6832
  }
6833
+ async bondRemove(props) {
6834
+ const ix = await this.getBondRemoveIx(props);
6835
+ return this.provider.sendAndConfirm?.(new Transaction().add(ix));
6836
+ }
6802
6837
  /**
6803
6838
  * Build global state initialize instruction
6804
6839
  */
@@ -7100,6 +7135,15 @@ var JBondClient = class _JBondClient {
7100
7135
  const [validatorBond, _] = this.pda.validatorBond(bondType, bondName, voteAccount);
7101
7136
  return this.program.methods.bondUpdate().accountsPartial({ validatorBond, payer }).instruction();
7102
7137
  }
7138
+ /**
7139
+ * Build bond remove instruction
7140
+ */
7141
+ async getBondRemoveIx(props) {
7142
+ const { bondType, name } = props;
7143
+ const [bondState] = this.pda.bondState(bondType, name);
7144
+ const authority = props.authority ?? this.provider.wallet?.publicKey;
7145
+ return this.program.methods.bondRemove().accountsPartial({ bondState, authority }).instruction();
7146
+ }
7103
7147
  /**
7104
7148
  * Build test set last update epoch instruction
7105
7149
  * NOTE!: This instruction is for testing purposes only.
@@ -7158,7 +7202,7 @@ var JBondClient = class _JBondClient {
7158
7202
  */
7159
7203
  async getAvailableCollateral(bondType, bondName, voteAccount) {
7160
7204
  const validatorBond = await this.getValidatorBond(bondType, bondName, voteAccount);
7161
- return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.currentEpochLocked.toNumber();
7205
+ return await this.getValidatorBondBalance(bondType, bondName, voteAccount) - validatorBond.locked.toNumber();
7162
7206
  }
7163
7207
  /**
7164
7208
  * Get all bond states with total collected collateral