@jpool/bond-sdk 0.11.7 → 0.11.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 +5 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +6 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -2312,6 +2312,11 @@ type GetHistoryOpts = {
|
|
|
2312
2312
|
limit?: number;
|
|
2313
2313
|
before?: string;
|
|
2314
2314
|
until?: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Number of transactions fetched per JSON-RPC batch request.
|
|
2317
|
+
* @default 50
|
|
2318
|
+
*/
|
|
2319
|
+
batchSize?: number;
|
|
2315
2320
|
};
|
|
2316
2321
|
declare class HistoryManager {
|
|
2317
2322
|
readonly client: JBondClient;
|
package/dist/index.d.ts
CHANGED
|
@@ -2312,6 +2312,11 @@ type GetHistoryOpts = {
|
|
|
2312
2312
|
limit?: number;
|
|
2313
2313
|
before?: string;
|
|
2314
2314
|
until?: string;
|
|
2315
|
+
/**
|
|
2316
|
+
* Number of transactions fetched per JSON-RPC batch request.
|
|
2317
|
+
* @default 50
|
|
2318
|
+
*/
|
|
2319
|
+
batchSize?: number;
|
|
2315
2320
|
};
|
|
2316
2321
|
declare class HistoryManager {
|
|
2317
2322
|
readonly client: JBondClient;
|
package/dist/index.js
CHANGED
|
@@ -4613,6 +4613,7 @@ var JPOOL_POOL_ADDRESS = new web3_js.PublicKey("CtMyWsrUtAwXWiGr9WjHT5fC3p3fgV8c
|
|
|
4613
4613
|
// src/history.ts
|
|
4614
4614
|
init_cjs_shims();
|
|
4615
4615
|
var { bs58 } = anchor.utils.bytes;
|
|
4616
|
+
var DEFAULT_TX_BATCH_SIZE = 50;
|
|
4616
4617
|
var HistoryManager = class {
|
|
4617
4618
|
constructor(client) {
|
|
4618
4619
|
this.client = client;
|
|
@@ -4644,7 +4645,7 @@ var HistoryManager = class {
|
|
|
4644
4645
|
return [];
|
|
4645
4646
|
}
|
|
4646
4647
|
const sigs = signatures.map((s) => s.signature);
|
|
4647
|
-
const parsed = await this.fetchParsedTransactions(sigs);
|
|
4648
|
+
const parsed = await this.fetchParsedTransactions(sigs, opts?.batchSize);
|
|
4648
4649
|
const txBySig = /* @__PURE__ */ new Map();
|
|
4649
4650
|
for (let i = 0; i < sigs.length; i++) {
|
|
4650
4651
|
const want = sigs[i];
|
|
@@ -4716,10 +4717,11 @@ var HistoryManager = class {
|
|
|
4716
4717
|
}, "confirmed");
|
|
4717
4718
|
return sigs.filter((s) => !s.err);
|
|
4718
4719
|
}
|
|
4719
|
-
async fetchParsedTransactions(sigs, batchSize =
|
|
4720
|
+
async fetchParsedTransactions(sigs, batchSize = DEFAULT_TX_BATCH_SIZE) {
|
|
4721
|
+
const size = Math.max(1, Math.floor(batchSize) || DEFAULT_TX_BATCH_SIZE);
|
|
4720
4722
|
const all = [];
|
|
4721
|
-
for (let i = 0; i < sigs.length; i +=
|
|
4722
|
-
const batch = sigs.slice(i, i +
|
|
4723
|
+
for (let i = 0; i < sigs.length; i += size) {
|
|
4724
|
+
const batch = sigs.slice(i, i + size);
|
|
4723
4725
|
const txs = await this.connection.getParsedTransactions(batch, {
|
|
4724
4726
|
commitment: "confirmed",
|
|
4725
4727
|
maxSupportedTransactionVersion: 0
|