@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.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +20 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2322,6 +2322,7 @@ declare class HistoryManager {
|
|
|
2322
2322
|
get connection(): _solana_web3_js.Connection;
|
|
2323
2323
|
debug(...args: any[]): void;
|
|
2324
2324
|
getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
|
|
2325
|
+
private instructionReferencesBondAccount;
|
|
2325
2326
|
private fetchSignaturesForAddress;
|
|
2326
2327
|
private fetchParsedTransactions;
|
|
2327
2328
|
private getInstructionDiscriminator;
|
package/dist/index.d.ts
CHANGED
|
@@ -2322,6 +2322,7 @@ declare class HistoryManager {
|
|
|
2322
2322
|
get connection(): _solana_web3_js.Connection;
|
|
2323
2323
|
debug(...args: any[]): void;
|
|
2324
2324
|
getHistory(bondType: BondType, bondName: string, vote: PublicKeyInitData, opts?: GetHistoryOpts): Promise<TransactionHistoryItem[]>;
|
|
2325
|
+
private instructionReferencesBondAccount;
|
|
2325
2326
|
private fetchSignaturesForAddress;
|
|
2326
2327
|
private fetchParsedTransactions;
|
|
2327
2328
|
private getInstructionDiscriminator;
|
package/dist/index.js
CHANGED
|
@@ -4633,7 +4633,8 @@ var HistoryManager = class {
|
|
|
4633
4633
|
}
|
|
4634
4634
|
async getHistory(bondType, bondName, vote, opts) {
|
|
4635
4635
|
const [validatorBondAccount] = this.client.pda.validatorBond(bondType, bondName, vote);
|
|
4636
|
-
|
|
4636
|
+
const validatorBondAccount58 = validatorBondAccount.toBase58();
|
|
4637
|
+
this.debug(`Fetching history for validator bond account: ${validatorBondAccount58}`);
|
|
4637
4638
|
const signatures = await this.fetchSignaturesForAddress(validatorBondAccount, {
|
|
4638
4639
|
limit: opts?.limit,
|
|
4639
4640
|
before: opts?.before,
|
|
@@ -4674,6 +4675,9 @@ var HistoryManager = class {
|
|
|
4674
4675
|
if (ix.parsed) {
|
|
4675
4676
|
continue;
|
|
4676
4677
|
}
|
|
4678
|
+
if (!this.instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58)) {
|
|
4679
|
+
continue;
|
|
4680
|
+
}
|
|
4677
4681
|
const { type, amount } = this.decodeInstructionData(ix.data);
|
|
4678
4682
|
if (!type || amount <= 0 && type !== "registered" /* Registered */) {
|
|
4679
4683
|
continue;
|
|
@@ -4689,6 +4693,21 @@ var HistoryManager = class {
|
|
|
4689
4693
|
}
|
|
4690
4694
|
return history.sort((a, b) => b.slot - a.slot);
|
|
4691
4695
|
}
|
|
4696
|
+
instructionReferencesBondAccount(ix, validatorBondAccount, validatorBondAccount58) {
|
|
4697
|
+
if (!Array.isArray(ix.accounts) || ix.accounts.length === 0) {
|
|
4698
|
+
return false;
|
|
4699
|
+
}
|
|
4700
|
+
return ix.accounts.some((account) => {
|
|
4701
|
+
if (typeof account === "string") {
|
|
4702
|
+
return account === validatorBondAccount58;
|
|
4703
|
+
}
|
|
4704
|
+
if (account instanceof web3_js.PublicKey) {
|
|
4705
|
+
return account.equals(validatorBondAccount);
|
|
4706
|
+
}
|
|
4707
|
+
const account58 = account?.toBase58?.();
|
|
4708
|
+
return typeof account58 === "string" && account58 === validatorBondAccount58;
|
|
4709
|
+
});
|
|
4710
|
+
}
|
|
4692
4711
|
async fetchSignaturesForAddress(address, options) {
|
|
4693
4712
|
const sigs = await this.connection.getSignaturesForAddress(address, {
|
|
4694
4713
|
limit: options?.limit || 1e3,
|