@jpool/bond-sdk 0.11.6 → 0.11.7

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
@@ -4607,7 +4607,8 @@ var HistoryManager = class {
4607
4607
  }
4608
4608
  async getHistory(bondType, bondName, vote, opts) {
4609
4609
  const [validatorBondAccount] = this.client.pda.validatorBond(bondType, bondName, vote);
4610
- this.debug(`Fetching history for validator bond account: ${validatorBondAccount.toBase58()}`);
4610
+ const validatorBondAccount58 = validatorBondAccount.toBase58();
4611
+ this.debug(`Fetching history for validator bond account: ${validatorBondAccount58}`);
4611
4612
  const signatures = await this.fetchSignaturesForAddress(validatorBondAccount, {
4612
4613
  limit: opts?.limit,
4613
4614
  before: opts?.before,
@@ -4648,6 +4649,9 @@ var HistoryManager = class {
4648
4649
  if (ix.parsed) {
4649
4650
  continue;
4650
4651
  }
4652
+ if (!this.instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58)) {
4653
+ continue;
4654
+ }
4651
4655
  const { type, amount } = this.decodeInstructionData(ix.data);
4652
4656
  if (!type || amount <= 0 && type !== "registered" /* Registered */) {
4653
4657
  continue;
@@ -4663,6 +4667,21 @@ var HistoryManager = class {
4663
4667
  }
4664
4668
  return history.sort((a, b) => b.slot - a.slot);
4665
4669
  }
4670
+ instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58) {
4671
+ if (!Array.isArray(ix.accounts) || ix.accounts.length === 0) {
4672
+ return false;
4673
+ }
4674
+ return ix.accounts.some((account) => {
4675
+ if (typeof account === "string") {
4676
+ return account === validatorBondAccount58;
4677
+ }
4678
+ if (account instanceof PublicKey) {
4679
+ return account.equals(validatorBondAccount);
4680
+ }
4681
+ const account58 = account?.toBase58?.();
4682
+ return typeof account58 === "string" && account58 === validatorBondAccount58;
4683
+ });
4684
+ }
4666
4685
  async fetchSignaturesForAddress(address, options) {
4667
4686
  const sigs = await this.connection.getSignaturesForAddress(address, {
4668
4687
  limit: options?.limit || 1e3,