@aintivirus-ai/mixer-sdk 1.0.10 → 1.0.11

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.
@@ -77,6 +77,17 @@ export declare class AintiVirusEVMSubgraph {
77
77
  skip?: number;
78
78
  orderDirection?: OrderDirection;
79
79
  }): Promise<StakedEntity[]>;
80
+ /**
81
+ * Fetch staked events for multiple season assets in a single subgraph call.
82
+ * Use instead of looping over assets with getStakedEvents to reduce API calls.
83
+ */
84
+ getStakedEventsBulk(params: {
85
+ seasonAssetIds: string[];
86
+ staker?: string;
87
+ first?: number;
88
+ skip?: number;
89
+ orderDirection?: OrderDirection;
90
+ }): Promise<StakedEntity[]>;
80
91
  getUnstakedEvents(params?: {
81
92
  staker?: string;
82
93
  seasonAssetId?: string;
@@ -84,6 +95,17 @@ export declare class AintiVirusEVMSubgraph {
84
95
  skip?: number;
85
96
  orderDirection?: OrderDirection;
86
97
  }): Promise<UnstakedEntity[]>;
98
+ /**
99
+ * Fetch unstaked events for multiple season assets in a single subgraph call.
100
+ * Use instead of looping over assets with getUnstakedEvents to reduce API calls.
101
+ */
102
+ getUnstakedEventsBulk(params: {
103
+ seasonAssetIds: string[];
104
+ staker?: string;
105
+ first?: number;
106
+ skip?: number;
107
+ orderDirection?: OrderDirection;
108
+ }): Promise<UnstakedEntity[]>;
87
109
  getClaimedEvents(params?: {
88
110
  staker?: string;
89
111
  seasonAssetId?: string;
@@ -91,6 +113,17 @@ export declare class AintiVirusEVMSubgraph {
91
113
  skip?: number;
92
114
  orderDirection?: OrderDirection;
93
115
  }): Promise<ClaimedEntity[]>;
116
+ /**
117
+ * Fetch claimed events for multiple season assets in a single subgraph call.
118
+ * Use instead of looping over assets with getClaimedEvents to reduce API calls.
119
+ */
120
+ getClaimedEventsBulk(params: {
121
+ seasonAssetIds: string[];
122
+ staker?: string;
123
+ first?: number;
124
+ skip?: number;
125
+ orderDirection?: OrderDirection;
126
+ }): Promise<ClaimedEntity[]>;
94
127
  /**
95
128
  * Get payment stats by payment contract address (id = contract address hex).
96
129
  */
@@ -319,6 +319,33 @@ class AintiVirusEVMSubgraph {
319
319
  transactionHash: e.transactionHash,
320
320
  }));
321
321
  }
322
+ /**
323
+ * Fetch staked events for multiple season assets in a single subgraph call.
324
+ * Use instead of looping over assets with getStakedEvents to reduce API calls.
325
+ */
326
+ async getStakedEventsBulk(params) {
327
+ const { seasonAssetIds, staker, first = 500, skip = 0, orderDirection = "desc", } = params;
328
+ if (seasonAssetIds.length === 0)
329
+ return [];
330
+ const where = { seasonAsset_in: seasonAssetIds };
331
+ if (staker)
332
+ where.staker = staker.toLowerCase();
333
+ const data = await this.request(queries_1.QUERIES.stakedEvents, {
334
+ first,
335
+ skip,
336
+ where,
337
+ orderDirection,
338
+ });
339
+ return (data.stakeds ?? []).map((e) => ({
340
+ id: e.id,
341
+ staker: e.staker,
342
+ seasonAsset: { id: e.seasonAsset?.id },
343
+ amount: (0, utils_1.asBigint)(e.amount),
344
+ blockNumber: (0, utils_1.asBigint)(e.blockNumber),
345
+ blockTimestamp: (0, utils_1.asBigint)(e.blockTimestamp),
346
+ transactionHash: e.transactionHash,
347
+ }));
348
+ }
322
349
  async getUnstakedEvents(params) {
323
350
  const { staker, seasonAssetId, first = 50, skip = 0, orderDirection = "desc", } = params ?? {};
324
351
  const where = {};
@@ -342,6 +369,33 @@ class AintiVirusEVMSubgraph {
342
369
  transactionHash: e.transactionHash,
343
370
  }));
344
371
  }
372
+ /**
373
+ * Fetch unstaked events for multiple season assets in a single subgraph call.
374
+ * Use instead of looping over assets with getUnstakedEvents to reduce API calls.
375
+ */
376
+ async getUnstakedEventsBulk(params) {
377
+ const { seasonAssetIds, staker, first = 500, skip = 0, orderDirection = "desc", } = params;
378
+ if (seasonAssetIds.length === 0)
379
+ return [];
380
+ const where = { seasonAsset_in: seasonAssetIds };
381
+ if (staker)
382
+ where.staker = staker.toLowerCase();
383
+ const data = await this.request(queries_1.QUERIES.unstakedEvents, {
384
+ first,
385
+ skip,
386
+ where,
387
+ orderDirection,
388
+ });
389
+ return (data.unstakeds ?? []).map((e) => ({
390
+ id: e.id,
391
+ staker: e.staker,
392
+ seasonAsset: { id: e.seasonAsset?.id },
393
+ amount: (0, utils_1.asBigint)(e.amount),
394
+ blockNumber: (0, utils_1.asBigint)(e.blockNumber),
395
+ blockTimestamp: (0, utils_1.asBigint)(e.blockTimestamp),
396
+ transactionHash: e.transactionHash,
397
+ }));
398
+ }
345
399
  async getClaimedEvents(params) {
346
400
  const { staker, seasonAssetId, first = 50, skip = 0, orderDirection = "desc", } = params ?? {};
347
401
  const where = {};
@@ -365,6 +419,33 @@ class AintiVirusEVMSubgraph {
365
419
  transactionHash: e.transactionHash,
366
420
  }));
367
421
  }
422
+ /**
423
+ * Fetch claimed events for multiple season assets in a single subgraph call.
424
+ * Use instead of looping over assets with getClaimedEvents to reduce API calls.
425
+ */
426
+ async getClaimedEventsBulk(params) {
427
+ const { seasonAssetIds, staker, first = 500, skip = 0, orderDirection = "desc", } = params;
428
+ if (seasonAssetIds.length === 0)
429
+ return [];
430
+ const where = { seasonAsset_in: seasonAssetIds };
431
+ if (staker)
432
+ where.staker = staker.toLowerCase();
433
+ const data = await this.request(queries_1.QUERIES.claimedEvents, {
434
+ first,
435
+ skip,
436
+ where,
437
+ orderDirection,
438
+ });
439
+ return (data.claimeds ?? []).map((e) => ({
440
+ id: e.id,
441
+ staker: e.staker,
442
+ seasonAsset: { id: e.seasonAsset?.id },
443
+ amount: (0, utils_1.asBigint)(e.amount),
444
+ blockNumber: (0, utils_1.asBigint)(e.blockNumber),
445
+ blockTimestamp: (0, utils_1.asBigint)(e.blockTimestamp),
446
+ transactionHash: e.transactionHash,
447
+ }));
448
+ }
368
449
  /**
369
450
  * Get payment stats by payment contract address (id = contract address hex).
370
451
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintivirus-ai/mixer-sdk",
3
- "version": "1.0.10",
3
+ "version": "1.0.11",
4
4
  "description": "TypeScript SDK for AintiVirus Mixer - Easy web3 integration for privacy-preserving transactions",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",