@streamflow/common 7.4.14 → 7.4.16
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/cjs/solana/utils.js +21 -0
- package/dist/esm/solana/utils.d.ts +12 -1
- package/dist/esm/solana/utils.js +20 -0
- package/package.json +3 -3
package/dist/cjs/solana/utils.js
CHANGED
|
@@ -24,6 +24,7 @@ exports.createAtaBatch = createAtaBatch;
|
|
|
24
24
|
exports.checkOrCreateAtaBatch = checkOrCreateAtaBatch;
|
|
25
25
|
exports.prepareBaseInstructions = prepareBaseInstructions;
|
|
26
26
|
exports.getMintAndProgram = getMintAndProgram;
|
|
27
|
+
exports.getMultipleAccountsInfoBatched = getMultipleAccountsInfoBatched;
|
|
27
28
|
const spl_token_1 = require("@solana/spl-token");
|
|
28
29
|
const web3_js_1 = require("@solana/web3.js");
|
|
29
30
|
const bs58_1 = __importDefault(require("bs58"));
|
|
@@ -455,3 +456,23 @@ async function getMintAndProgram(connection, address, commitment) {
|
|
|
455
456
|
tokenProgramId: programId,
|
|
456
457
|
};
|
|
457
458
|
}
|
|
459
|
+
/**
|
|
460
|
+
* Split fetching of Multiple Accounts Info into batches of 100
|
|
461
|
+
* as the maximum number of accounts that can be fetched in a single call is 100
|
|
462
|
+
*
|
|
463
|
+
* @param connection Connection to use
|
|
464
|
+
* @param pubKeys Array of public keys to fetch account info for
|
|
465
|
+
* @param commitment Desired level of commitment for querying the state
|
|
466
|
+
*
|
|
467
|
+
* @return Array of AccountInfo objects
|
|
468
|
+
*/
|
|
469
|
+
async function getMultipleAccountsInfoBatched(connection, pubKeys, commitment) {
|
|
470
|
+
const batchSize = 99;
|
|
471
|
+
const batches = [];
|
|
472
|
+
for (let i = 0; i < pubKeys.length; i += batchSize) {
|
|
473
|
+
const batch = pubKeys.slice(i, i + batchSize);
|
|
474
|
+
batches.push(connection.getMultipleAccountsInfo(batch, commitment));
|
|
475
|
+
}
|
|
476
|
+
const results = await Promise.all(batches);
|
|
477
|
+
return results.flat();
|
|
478
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Mint } from "@solana/spl-token";
|
|
2
2
|
import { SignerWalletAdapter } from "@solana/wallet-adapter-base";
|
|
3
|
-
import { BlockhashWithExpiryBlockHeight, Commitment, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, SignatureStatus, VersionedTransaction, Context, RpcResponseAndContext, SimulatedTransactionResponse } from "@solana/web3.js";
|
|
3
|
+
import { BlockhashWithExpiryBlockHeight, Commitment, Connection, Keypair, PublicKey, Transaction, TransactionInstruction, SignatureStatus, VersionedTransaction, Context, RpcResponseAndContext, SimulatedTransactionResponse, AccountInfo } from "@solana/web3.js";
|
|
4
4
|
import PQueue from "p-queue";
|
|
5
5
|
import { Account, AtaParams, ConfirmationParams, ITransactionSolanaExt, ThrottleParams } from "./types.js";
|
|
6
6
|
export declare const buildSendThrottler: (sendRate: number, sendInterval?: number) => PQueue;
|
|
@@ -174,3 +174,14 @@ export declare function getMintAndProgram(connection: Connection, address: Publi
|
|
|
174
174
|
mint: Mint;
|
|
175
175
|
tokenProgramId: PublicKey;
|
|
176
176
|
}>;
|
|
177
|
+
/**
|
|
178
|
+
* Split fetching of Multiple Accounts Info into batches of 100
|
|
179
|
+
* as the maximum number of accounts that can be fetched in a single call is 100
|
|
180
|
+
*
|
|
181
|
+
* @param connection Connection to use
|
|
182
|
+
* @param pubKeys Array of public keys to fetch account info for
|
|
183
|
+
* @param commitment Desired level of commitment for querying the state
|
|
184
|
+
*
|
|
185
|
+
* @return Array of AccountInfo objects
|
|
186
|
+
*/
|
|
187
|
+
export declare function getMultipleAccountsInfoBatched(connection: Connection, pubKeys: PublicKey[], commitment?: Commitment): Promise<(AccountInfo<Buffer> | null)[]>;
|
package/dist/esm/solana/utils.js
CHANGED
|
@@ -428,3 +428,23 @@ export async function getMintAndProgram(connection, address, commitment) {
|
|
|
428
428
|
tokenProgramId: programId,
|
|
429
429
|
};
|
|
430
430
|
}
|
|
431
|
+
/**
|
|
432
|
+
* Split fetching of Multiple Accounts Info into batches of 100
|
|
433
|
+
* as the maximum number of accounts that can be fetched in a single call is 100
|
|
434
|
+
*
|
|
435
|
+
* @param connection Connection to use
|
|
436
|
+
* @param pubKeys Array of public keys to fetch account info for
|
|
437
|
+
* @param commitment Desired level of commitment for querying the state
|
|
438
|
+
*
|
|
439
|
+
* @return Array of AccountInfo objects
|
|
440
|
+
*/
|
|
441
|
+
export async function getMultipleAccountsInfoBatched(connection, pubKeys, commitment) {
|
|
442
|
+
const batchSize = 99;
|
|
443
|
+
const batches = [];
|
|
444
|
+
for (let i = 0; i < pubKeys.length; i += batchSize) {
|
|
445
|
+
const batch = pubKeys.slice(i, i + batchSize);
|
|
446
|
+
batches.push(connection.getMultipleAccountsInfo(batch, commitment));
|
|
447
|
+
}
|
|
448
|
+
const results = await Promise.all(batches);
|
|
449
|
+
return results.flat();
|
|
450
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@streamflow/common",
|
|
3
|
-
"version": "7.4.
|
|
3
|
+
"version": "7.4.16",
|
|
4
4
|
"description": "Common utilities and types used by streamflow packages.",
|
|
5
5
|
"homepage": "https://github.com/streamflow-finance/js-sdk/",
|
|
6
6
|
"main": "./dist/esm/index.js",
|
|
@@ -27,9 +27,9 @@
|
|
|
27
27
|
"lint-config": "eslint --print-config",
|
|
28
28
|
"prepublishOnly": "npm run lint && npm run build"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "5afc44bfc5971348a2fdc44c5399a85b45a3b18e",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@streamflow/eslint-config": "7.4.
|
|
32
|
+
"@streamflow/eslint-config": "7.4.16",
|
|
33
33
|
"@types/bn.js": "5.1.1",
|
|
34
34
|
"date-fns": "2.28.0",
|
|
35
35
|
"typescript": "^5.6.3"
|