@aintivirus-ai/mixer-sdk 1.0.7 → 1.0.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.
@@ -96,29 +96,54 @@ export declare class AintiVirusEVM {
96
96
  * Withdraw via relayer (fee from proof).
97
97
  */
98
98
  withdrawRelayed(proof: WithdrawalProof, amount: bigint, assetAddress: string): Promise<TransactionResult>;
99
+ /**
100
+ * Stake any asset deployed as a mixer pool.
101
+ * For WETH with gateway configured: uses native ETH (msg.value).
102
+ * For ERC20: approves factory and calls factory.stake(asset, amount).
103
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
104
+ * @param amount Amount in asset's smallest unit
105
+ */
106
+ stake(assetAddress: string, amount: bigint): Promise<TransactionResult>;
107
+ /**
108
+ * Unstake any asset.
109
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
110
+ */
111
+ unstake(assetAddress: string): Promise<TransactionResult>;
112
+ /**
113
+ * Claim rewards for any asset and season.
114
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
115
+ * @param seasonId Season ID to claim
116
+ */
117
+ claim(assetAddress: string, seasonId: bigint): Promise<TransactionResult>;
99
118
  /**
100
119
  * Stake native ETH via WETHGateway. Requires wethGatewayAddress in config.
101
- * Falls back to stakeToken (config token) if no gateway.
120
+ * Falls back to stake(config token) if no gateway.
121
+ * @deprecated Use stake(wethAddress, amount) instead.
102
122
  */
103
123
  stakeEther(amount: bigint): Promise<TransactionResult>;
104
124
  /**
105
- * Stake tokens
125
+ * Stake config token.
126
+ * @deprecated Use stake(tokenAddress, amount) instead.
106
127
  */
107
128
  stakeToken(amount: bigint): Promise<TransactionResult>;
108
129
  /**
109
- * Claim ETH rewards (WETH asset)
130
+ * Claim ETH rewards (WETH asset).
131
+ * @deprecated Use claim(wethAddress, seasonId) instead.
110
132
  */
111
133
  claimEth(seasonId: bigint): Promise<TransactionResult>;
112
134
  /**
113
- * Claim token rewards
135
+ * Claim config token rewards.
136
+ * @deprecated Use claim(tokenAddress, seasonId) instead.
114
137
  */
115
138
  claimToken(seasonId: bigint): Promise<TransactionResult>;
116
139
  /**
117
- * Unstake ETH (WETH asset)
140
+ * Unstake ETH (WETH asset).
141
+ * @deprecated Use unstake(wethAddress) instead.
118
142
  */
119
143
  unstakeEth(): Promise<TransactionResult>;
120
144
  /**
121
- * Unstake tokens
145
+ * Unstake config token.
146
+ * @deprecated Use unstake(tokenAddress) instead.
122
147
  */
123
148
  unstakeToken(): Promise<TransactionResult>;
124
149
  /**
@@ -276,11 +301,45 @@ export declare class AintiVirusEVM {
276
301
  */
277
302
  getStakerRecord(address: string): Promise<EVMStakerRecord>;
278
303
  /**
279
- * Check if user has claimed rewards for a season
304
+ * Check if user has claimed rewards for a season and asset.
305
+ * @param address Staker address
306
+ * @param seasonId Season ID
307
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
308
+ */
309
+ hasClaimed(address: string, seasonId: bigint, assetAddress: string): Promise<boolean>;
310
+ /**
311
+ * Get staker record for a specific asset.
312
+ * @param address Staker address
313
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
314
+ */
315
+ getStakerRecordForAsset(address: string, assetAddress: string): Promise<{
316
+ seasonId: bigint;
317
+ stakedAt: bigint;
318
+ staked: bigint;
319
+ weight: bigint;
320
+ }>;
321
+ /**
322
+ * Get stake season totals for a specific asset.
323
+ * @param seasonId Season ID
324
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
325
+ */
326
+ getStakeSeasonForAsset(seasonId: bigint, assetAddress: string): Promise<{
327
+ seasonId: bigint;
328
+ start: bigint;
329
+ end: bigint;
330
+ duration: bigint;
331
+ totalStaked: bigint;
332
+ totalReward: bigint;
333
+ totalWeight: bigint;
334
+ }>;
335
+ /**
336
+ * Check if user has claimed ETH rewards for a season.
337
+ * @deprecated Use hasClaimed(address, seasonId, wethAddress) instead.
280
338
  */
281
339
  hasClaimedEth(address: string, seasonId: bigint): Promise<boolean>;
282
340
  /**
283
- * Check if user has claimed token rewards for a season
341
+ * Check if user has claimed token rewards for a season.
342
+ * @deprecated Use hasClaimed(address, seasonId, tokenAddress) instead.
284
343
  */
285
344
  hasClaimedToken(address: string, seasonId: bigint): Promise<boolean>;
286
345
  /**
package/dist/evm/index.js CHANGED
@@ -299,72 +299,116 @@ class AintiVirusEVM {
299
299
  return this.withdraw(proof, fee, amount, assetAddress);
300
300
  }
301
301
  /**
302
- * Stake native ETH via WETHGateway. Requires wethGatewayAddress in config.
303
- * Falls back to stakeToken (config token) if no gateway.
302
+ * Stake any asset deployed as a mixer pool.
303
+ * For WETH with gateway configured: uses native ETH (msg.value).
304
+ * For ERC20: approves factory and calls factory.stake(asset, amount).
305
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
306
+ * @param amount Amount in asset's smallest unit
304
307
  */
305
- async stakeEther(amount) {
308
+ async stake(assetAddress, amount) {
306
309
  this.assertSigner();
307
- if (this.wethGateway) {
308
- const tx = await this.wethGateway.stake({ value: amount });
310
+ const asset = assetAddress.toLowerCase().startsWith("0x")
311
+ ? assetAddress
312
+ : assetAddress;
313
+ const gateway = this.wethGateway;
314
+ const isWeth = gateway && (await this.isWethAsset(asset));
315
+ if (isWeth && gateway) {
316
+ const tx = await gateway.stake({ value: amount });
309
317
  return this.sendAndWait(tx);
310
318
  }
311
- return this.stakeToken(amount);
312
- }
313
- /**
314
- * Stake tokens
315
- */
316
- async stakeToken(amount) {
317
- this.assertSigner();
318
319
  const factoryAddress = await this.factory.getAddress();
319
- const allowance = await this.token.allowance(await this.signer.getAddress(), factoryAddress);
320
+ const assetContract = asset.toLowerCase() === this.token.target.toLowerCase()
321
+ ? this.token
322
+ : new ethers_1.Contract(asset, ERC20_ABI, this.signer);
323
+ const allowanceRaw = await assetContract.allowance(await this.signer.getAddress(), factoryAddress);
324
+ const allowance = toBigint(allowanceRaw);
320
325
  if (allowance < amount) {
321
- const approveTx = await this.token.approve(factoryAddress, amount);
326
+ const approveTx = await assetContract.approve(factoryAddress, amount);
322
327
  const approveHash = typeof approveTx.hash === "string"
323
328
  ? approveTx.hash
324
329
  : approveTx.hash;
325
330
  if (approveHash)
326
- await this.sendAndWait(approveTx);
331
+ await this.waitForTransactionReceipt(approveHash);
327
332
  }
328
- const tx = await this.factory.stake(this.token.target, amount);
333
+ const tx = await this.factory.stake(asset, amount);
329
334
  return this.sendAndWait(tx);
330
335
  }
331
336
  /**
332
- * Claim ETH rewards (WETH asset)
337
+ * Unstake any asset.
338
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
333
339
  */
334
- async claimEth(seasonId) {
340
+ async unstake(assetAddress) {
335
341
  this.assertSigner();
342
+ const asset = assetAddress.toLowerCase().startsWith("0x")
343
+ ? assetAddress
344
+ : assetAddress;
345
+ const tx = await this.factory.unstake(asset);
346
+ return this.sendAndWait(tx);
347
+ }
348
+ /**
349
+ * Claim rewards for any asset and season.
350
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
351
+ * @param seasonId Season ID to claim
352
+ */
353
+ async claim(assetAddress, seasonId) {
354
+ this.assertSigner();
355
+ const asset = assetAddress.toLowerCase().startsWith("0x")
356
+ ? assetAddress
357
+ : assetAddress;
358
+ const tx = await this.factory.claim(asset, seasonId);
359
+ return this.sendAndWait(tx);
360
+ }
361
+ /**
362
+ * Stake native ETH via WETHGateway. Requires wethGatewayAddress in config.
363
+ * Falls back to stake(config token) if no gateway.
364
+ * @deprecated Use stake(wethAddress, amount) instead.
365
+ */
366
+ async stakeEther(amount) {
367
+ const weth = await this.getWethAddress();
368
+ if (weth)
369
+ return this.stake(weth, amount);
370
+ return this.stake(this.token.target, amount);
371
+ }
372
+ /**
373
+ * Stake config token.
374
+ * @deprecated Use stake(tokenAddress, amount) instead.
375
+ */
376
+ async stakeToken(amount) {
377
+ return this.stake(this.token.target, amount);
378
+ }
379
+ /**
380
+ * Claim ETH rewards (WETH asset).
381
+ * @deprecated Use claim(wethAddress, seasonId) instead.
382
+ */
383
+ async claimEth(seasonId) {
336
384
  const weth = await this.getWethAddress();
337
385
  if (!weth)
338
386
  throw new Error("WETH address not available (config or factory.weth())");
339
- const tx = await this.factory.claim(weth, seasonId);
340
- return this.sendAndWait(tx);
387
+ return this.claim(weth, seasonId);
341
388
  }
342
389
  /**
343
- * Claim token rewards
390
+ * Claim config token rewards.
391
+ * @deprecated Use claim(tokenAddress, seasonId) instead.
344
392
  */
345
393
  async claimToken(seasonId) {
346
- this.assertSigner();
347
- const tx = await this.factory.claim(this.token.target, seasonId);
348
- return this.sendAndWait(tx);
394
+ return this.claim(this.token.target, seasonId);
349
395
  }
350
396
  /**
351
- * Unstake ETH (WETH asset)
397
+ * Unstake ETH (WETH asset).
398
+ * @deprecated Use unstake(wethAddress) instead.
352
399
  */
353
400
  async unstakeEth() {
354
- this.assertSigner();
355
401
  const weth = await this.getWethAddress();
356
402
  if (!weth)
357
403
  throw new Error("WETH address not available (config or factory.weth())");
358
- const tx = await this.factory.unstake(weth);
359
- return this.sendAndWait(tx);
404
+ return this.unstake(weth);
360
405
  }
361
406
  /**
362
- * Unstake tokens
407
+ * Unstake config token.
408
+ * @deprecated Use unstake(tokenAddress) instead.
363
409
  */
364
410
  async unstakeToken() {
365
- this.assertSigner();
366
- const tx = await this.factory.unstake(this.token.target);
367
- return this.sendAndWait(tx);
411
+ return this.unstake(this.token.target);
368
412
  }
369
413
  /**
370
414
  * Get current stake season
@@ -722,22 +766,75 @@ class AintiVirusEVM {
722
766
  };
723
767
  }
724
768
  /**
725
- * Check if user has claimed rewards for a season
769
+ * Check if user has claimed rewards for a season and asset.
770
+ * @param address Staker address
771
+ * @param seasonId Season ID
772
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
726
773
  */
727
- async hasClaimedEth(address, seasonId) {
774
+ async hasClaimed(address, seasonId, assetAddress) {
775
+ const stakingAddress = await this.getStakingAddress();
776
+ const staking = new ethers_1.Contract(stakingAddress, STAKING_ABI, this.provider);
777
+ const asset = assetAddress.toLowerCase().startsWith("0x")
778
+ ? assetAddress
779
+ : assetAddress;
780
+ return await staking.wasSeasonClaimed(address, seasonId, asset);
781
+ }
782
+ /**
783
+ * Get staker record for a specific asset.
784
+ * @param address Staker address
785
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
786
+ */
787
+ async getStakerRecordForAsset(address, assetAddress) {
788
+ const stakingAddress = await this.getStakingAddress();
789
+ const staking = new ethers_1.Contract(stakingAddress, STAKING_ABI, this.provider);
790
+ const asset = assetAddress.toLowerCase().startsWith("0x")
791
+ ? assetAddress
792
+ : assetAddress;
793
+ const r = await staking.records(address, asset);
794
+ return {
795
+ seasonId: BigInt(r.seasonId.toString()),
796
+ stakedAt: BigInt(r.stakedAt.toString()),
797
+ staked: BigInt(r.staked.toString()),
798
+ weight: BigInt(r.weight.toString()),
799
+ };
800
+ }
801
+ /**
802
+ * Get stake season totals for a specific asset.
803
+ * @param seasonId Season ID
804
+ * @param assetAddress Asset address (WETH or any ERC20 deployed as mixer)
805
+ */
806
+ async getStakeSeasonForAsset(seasonId, assetAddress) {
728
807
  const stakingAddress = await this.getStakingAddress();
729
808
  const staking = new ethers_1.Contract(stakingAddress, STAKING_ABI, this.provider);
809
+ const asset = assetAddress.toLowerCase().startsWith("0x")
810
+ ? assetAddress
811
+ : assetAddress;
812
+ const s = await staking.seasonAndTotals(seasonId, asset);
813
+ return {
814
+ seasonId: BigInt(s.seasonId.toString()),
815
+ start: BigInt(s.start.toString()),
816
+ end: BigInt(s.end.toString()),
817
+ duration: BigInt(s.duration.toString()),
818
+ totalStaked: BigInt(s.totalStaked.toString()),
819
+ totalReward: BigInt(s.totalReward.toString()),
820
+ totalWeight: BigInt(s.totalWeight.toString()),
821
+ };
822
+ }
823
+ /**
824
+ * Check if user has claimed ETH rewards for a season.
825
+ * @deprecated Use hasClaimed(address, seasonId, wethAddress) instead.
826
+ */
827
+ async hasClaimedEth(address, seasonId) {
730
828
  const weth = await this.getWethAddress();
731
829
  const ethAsset = weth ?? this.token.target;
732
- return await staking.wasSeasonClaimed(address, seasonId, ethAsset);
830
+ return this.hasClaimed(address, seasonId, ethAsset);
733
831
  }
734
832
  /**
735
- * Check if user has claimed token rewards for a season
833
+ * Check if user has claimed token rewards for a season.
834
+ * @deprecated Use hasClaimed(address, seasonId, tokenAddress) instead.
736
835
  */
737
836
  async hasClaimedToken(address, seasonId) {
738
- const stakingAddress = await this.getStakingAddress();
739
- const staking = new ethers_1.Contract(stakingAddress, STAKING_ABI, this.provider);
740
- return await staking.wasSeasonClaimed(address, seasonId, this.token.target);
837
+ return this.hasClaimed(address, seasonId, this.token.target);
741
838
  }
742
839
  /**
743
840
  * Get token balance of an address
@@ -1,5 +1,5 @@
1
1
  import type { AssetMode } from "../../types";
2
- import { type ClaimedEntity, type DepositEntity, type DepositOrderBy, type MixerPool, type MixerPoolOrderBy, type OrderDirection, type PaymentProcessedEntity, type PaymentStats, type ProtocolState, type TokenUpdatedEntity, type SeasonAssetEntity, type SeasonEntity, type StakedEntity, type SubgraphClientConfig, type UnstakedEntity, type WithdrawalEntity, type WithdrawalOrderBy } from "./types";
2
+ import { type ClaimedEntity, type DepositEntity, type DepositOrderBy, type MixerPool, type MixerPoolOrderBy, type OrderDirection, type PaymentProcessedEntity, type PaymentStats, type ProtocolState, type TokenUpdatedEntity, type SeasonAssetEntity, type SeasonEntity, type SeasonSummary, type SeasonWithParticipants, type StakedEntity, type SubgraphClientConfig, type UnstakedEntity, type WithdrawalEntity, type WithdrawalOrderBy } from "./types";
3
3
  export declare class AintiVirusEVMSubgraph {
4
4
  private readonly endpoint;
5
5
  private readonly fetch;
@@ -51,6 +51,18 @@ export declare class AintiVirusEVMSubgraph {
51
51
  orderDirection?: OrderDirection;
52
52
  }): Promise<WithdrawalEntity[]>;
53
53
  getSeason(seasonId: bigint): Promise<SeasonEntity | null>;
54
+ /**
55
+ * Get all seasons with TVL and rewards.
56
+ */
57
+ getAllSeasons(): Promise<SeasonSummary[]>;
58
+ /**
59
+ * Get season with participants (staker addresses and staked amounts).
60
+ */
61
+ getSeasonWithParticipants(seasonId: bigint): Promise<SeasonWithParticipants | null>;
62
+ /**
63
+ * Get protocol lifetime stats (id = "protocol").
64
+ */
65
+ getProtocolLifetimeStats(): Promise<ProtocolState | null>;
54
66
  getSeasonAssets(params?: {
55
67
  seasonId?: bigint;
56
68
  asset?: string;
@@ -58,6 +58,8 @@ class AintiVirusEVMSubgraph {
58
58
  withdrawalCount: (0, utils_1.asBigint)(p.withdrawalCount),
59
59
  totalStaked: (0, utils_1.asBigint)(p.totalStaked),
60
60
  totalClaimed: (0, utils_1.asBigint)(p.totalClaimed),
61
+ totalStakedAllTime: p.totalStakedAllTime != null ? (0, utils_1.asBigint)(p.totalStakedAllTime) : undefined,
62
+ totalRewardsAddedAllTime: p.totalRewardsAddedAllTime != null ? (0, utils_1.asBigint)(p.totalRewardsAddedAllTime) : undefined,
61
63
  updatedBlockNumber: p.updatedBlockNumber ? (0, utils_1.asBigint)(p.updatedBlockNumber) : null,
62
64
  updatedBlockTimestamp: p.updatedBlockTimestamp
63
65
  ? (0, utils_1.asBigint)(p.updatedBlockTimestamp)
@@ -89,6 +91,8 @@ class AintiVirusEVMSubgraph {
89
91
  withdrawalCount: (0, utils_1.asBigint)(p.withdrawalCount),
90
92
  totalStaked: (0, utils_1.asBigint)(p.totalStaked),
91
93
  totalClaimed: (0, utils_1.asBigint)(p.totalClaimed),
94
+ totalStakedAllTime: p.totalStakedAllTime != null ? (0, utils_1.asBigint)(p.totalStakedAllTime) : undefined,
95
+ totalRewardsAddedAllTime: p.totalRewardsAddedAllTime != null ? (0, utils_1.asBigint)(p.totalRewardsAddedAllTime) : undefined,
92
96
  updatedBlockNumber: p.updatedBlockNumber ? (0, utils_1.asBigint)(p.updatedBlockNumber) : null,
93
97
  updatedBlockTimestamp: p.updatedBlockTimestamp
94
98
  ? (0, utils_1.asBigint)(p.updatedBlockTimestamp)
@@ -218,6 +222,8 @@ class AintiVirusEVMSubgraph {
218
222
  start: (0, utils_1.asBigint)(s.start),
219
223
  end: (0, utils_1.asBigint)(s.end),
220
224
  duration: (0, utils_1.asBigint)(s.duration),
225
+ totalStaked: s.totalStaked != null ? (0, utils_1.asBigint)(s.totalStaked) : undefined,
226
+ totalReward: s.totalReward != null ? (0, utils_1.asBigint)(s.totalReward) : undefined,
221
227
  assets: (s.assets ?? []).map((a) => ({
222
228
  id: a.id,
223
229
  asset: typeof a.asset === "string" ? a.asset : String(a.asset),
@@ -228,6 +234,51 @@ class AintiVirusEVMSubgraph {
228
234
  })),
229
235
  };
230
236
  }
237
+ /**
238
+ * Get all seasons with TVL and rewards.
239
+ */
240
+ async getAllSeasons() {
241
+ const data = await this.request(queries_1.QUERIES.allSeasons);
242
+ return (data.seasons ?? []).map((s) => ({
243
+ id: s.id,
244
+ seasonId: (0, utils_1.asBigint)(s.seasonId),
245
+ totalStaked: (0, utils_1.asBigint)(s.totalStaked ?? 0),
246
+ totalReward: (0, utils_1.asBigint)(s.totalReward ?? 0),
247
+ start: (0, utils_1.asBigint)(s.start ?? 0),
248
+ end: (0, utils_1.asBigint)(s.end ?? 0),
249
+ }));
250
+ }
251
+ /**
252
+ * Get season with participants (staker addresses and staked amounts).
253
+ */
254
+ async getSeasonWithParticipants(seasonId) {
255
+ const id = seasonId.toString();
256
+ const data = await this.request(queries_1.QUERIES.seasonWithParticipants, {
257
+ seasonId: id,
258
+ });
259
+ const s = data.season;
260
+ if (!s)
261
+ return null;
262
+ return {
263
+ id: s.id,
264
+ seasonId: (0, utils_1.asBigint)(s.seasonId),
265
+ start: (0, utils_1.asBigint)(s.start),
266
+ end: (0, utils_1.asBigint)(s.end),
267
+ duration: 0n,
268
+ totalStaked: s.totalStaked != null ? (0, utils_1.asBigint)(s.totalStaked) : 0n,
269
+ totalReward: s.totalReward != null ? (0, utils_1.asBigint)(s.totalReward) : 0n,
270
+ participants: (s.participants ?? []).map((p) => ({
271
+ staker: typeof p.staker === "string" ? p.staker : String(p.staker),
272
+ totalStaked: (0, utils_1.asBigint)(p.totalStaked ?? 0),
273
+ })),
274
+ };
275
+ }
276
+ /**
277
+ * Get protocol lifetime stats (id = "protocol").
278
+ */
279
+ async getProtocolLifetimeStats() {
280
+ return this.getProtocol("protocol");
281
+ }
231
282
  async getSeasonAssets(params) {
232
283
  const { seasonId, asset, first = 50, skip = 0, orderDirection = "desc", } = params ?? {};
233
284
  const where = {};
@@ -1,11 +1,14 @@
1
1
  export declare const QUERIES: {
2
- readonly protocol: "\n query GetProtocol($id: ID!) {\n protocol(id: $id) {\n id\n feeRate\n factoryAddress\n stakingAddress\n feeCollector\n rewardPoolShareBps\n nextSeasonDuration\n currentSeasonId\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n totalStaked\n totalClaimed\n updatedBlockNumber\n updatedBlockTimestamp\n updatedTransactionHash\n }\n }\n ";
3
- readonly protocolData: "\n query GetProtocolData {\n protocols(first: 1, orderBy: updatedBlockTimestamp, orderDirection: desc) {\n id\n feeRate\n factoryAddress\n stakingAddress\n feeCollector\n rewardPoolShareBps\n nextSeasonDuration\n currentSeasonId\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n totalStaked\n totalClaimed\n updatedBlockNumber\n updatedBlockTimestamp\n updatedTransactionHash\n }\n }\n ";
2
+ readonly protocol: "\n query GetProtocol($id: ID!) {\n protocol(id: $id) {\n id\n feeRate\n factoryAddress\n stakingAddress\n feeCollector\n rewardPoolShareBps\n nextSeasonDuration\n currentSeasonId\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n totalStaked\n totalClaimed\n totalStakedAllTime\n totalRewardsAddedAllTime\n updatedBlockNumber\n updatedBlockTimestamp\n updatedTransactionHash\n }\n }\n ";
3
+ readonly protocolData: "\n query GetProtocolData {\n protocols(first: 1, orderBy: updatedBlockTimestamp, orderDirection: desc) {\n id\n feeRate\n factoryAddress\n stakingAddress\n feeCollector\n rewardPoolShareBps\n nextSeasonDuration\n currentSeasonId\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n totalStaked\n totalClaimed\n totalStakedAllTime\n totalRewardsAddedAllTime\n updatedBlockNumber\n updatedBlockTimestamp\n updatedTransactionHash\n }\n }\n ";
4
4
  readonly mixerPools: "\n query GetMixerPools(\n $first: Int!,\n $skip: Int!,\n $where: MixerPool_filter,\n $orderBy: MixerPool_orderBy!,\n $orderDirection: OrderDirection!\n ) {\n mixerPools(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: $orderBy,\n orderDirection: $orderDirection\n ) {\n id\n asset\n amount\n address\n deployedBlockNumber\n deployedBlockTimestamp\n deployedTransactionHash\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n }\n }\n ";
5
5
  readonly mixerPoolById: "\n query GetMixerPool($id: ID!) {\n mixerPool(id: $id) {\n id\n asset\n amount\n address\n deployedBlockNumber\n deployedBlockTimestamp\n deployedTransactionHash\n totalDeposited\n totalWithdrawn\n depositCount\n withdrawalCount\n }\n }\n ";
6
6
  readonly deposits: "\n query GetDeposits(\n $first: Int!,\n $skip: Int!,\n $where: Deposit_filter,\n $orderBy: Deposit_orderBy!,\n $orderDirection: OrderDirection!\n ) {\n deposits(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: $orderBy,\n orderDirection: $orderDirection\n ) {\n id\n pool { id }\n commitment\n protocolFee\n extraFee\n partnerAddress\n blockNumber\n blockTimestamp\n transactionHash\n }\n }\n ";
7
7
  readonly withdrawals: "\n query GetWithdrawals(\n $first: Int!,\n $skip: Int!,\n $where: Withdrawal_filter,\n $orderBy: Withdrawal_orderBy!,\n $orderDirection: OrderDirection!\n ) {\n withdrawals(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: $orderBy,\n orderDirection: $orderDirection\n ) {\n id\n pool { id }\n to\n nullifierHash\n blockNumber\n blockTimestamp\n transactionHash\n }\n }\n ";
8
- readonly season: "\n query GetSeason($id: ID!) {\n season(id: $id) {\n id\n seasonId\n start\n end\n duration\n assets {\n id\n asset\n duration\n totalStaked\n totalReward\n totalWeight\n }\n }\n }\n ";
8
+ readonly season: "\n query GetSeason($id: ID!) {\n season(id: $id) {\n id\n seasonId\n start\n end\n duration\n totalStaked\n totalReward\n assets {\n id\n asset\n duration\n totalStaked\n totalReward\n totalWeight\n }\n }\n }\n ";
9
+ readonly seasonWithParticipants: "\n query GetSeasonParticipants($seasonId: ID!) {\n season(id: $seasonId) {\n id\n seasonId\n totalStaked\n totalReward\n start\n end\n participants {\n staker\n totalStaked\n }\n }\n }\n ";
10
+ readonly allSeasons: "\n query GetAllSeasons {\n seasons(first: 100, orderBy: seasonId, orderDirection: desc) {\n id\n seasonId\n totalStaked\n totalReward\n start\n end\n }\n }\n ";
11
+ readonly seasonByAsset: "\n query GetSeasonByAsset($seasonId: ID!) {\n season(id: $seasonId) {\n id\n seasonId\n totalStaked\n totalReward\n assets {\n asset\n totalStaked\n totalReward\n }\n }\n }\n ";
9
12
  readonly seasonAssets: "\n query GetSeasonAssets(\n $first: Int!,\n $skip: Int!,\n $where: SeasonAsset_filter,\n $orderDirection: OrderDirection!\n ) {\n seasonAssets(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: id,\n orderDirection: $orderDirection\n ) {\n id\n asset\n duration\n totalStaked\n totalReward\n totalWeight\n }\n }\n ";
10
13
  readonly stakedEvents: "\n query GetStakedEvents(\n $first: Int!,\n $skip: Int!,\n $where: Staked_filter,\n $orderDirection: OrderDirection!\n ) {\n stakeds(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: blockTimestamp,\n orderDirection: $orderDirection\n ) {\n id\n staker\n seasonAsset { id }\n amount\n blockNumber\n blockTimestamp\n transactionHash\n }\n }\n ";
11
14
  readonly unstakedEvents: "\n query GetUnstakedEvents(\n $first: Int!,\n $skip: Int!,\n $where: Unstaked_filter,\n $orderDirection: OrderDirection!\n ) {\n unstakeds(\n first: $first,\n skip: $skip,\n where: $where,\n orderBy: blockTimestamp,\n orderDirection: $orderDirection\n ) {\n id\n staker\n seasonAsset { id }\n amount\n blockNumber\n blockTimestamp\n transactionHash\n }\n }\n ";
@@ -19,6 +19,8 @@ exports.QUERIES = {
19
19
  withdrawalCount
20
20
  totalStaked
21
21
  totalClaimed
22
+ totalStakedAllTime
23
+ totalRewardsAddedAllTime
22
24
  updatedBlockNumber
23
25
  updatedBlockTimestamp
24
26
  updatedTransactionHash
@@ -42,6 +44,8 @@ exports.QUERIES = {
42
44
  withdrawalCount
43
45
  totalStaked
44
46
  totalClaimed
47
+ totalStakedAllTime
48
+ totalRewardsAddedAllTime
45
49
  updatedBlockNumber
46
50
  updatedBlockTimestamp
47
51
  updatedTransactionHash
@@ -154,6 +158,8 @@ exports.QUERIES = {
154
158
  start
155
159
  end
156
160
  duration
161
+ totalStaked
162
+ totalReward
157
163
  assets {
158
164
  id
159
165
  asset
@@ -164,6 +170,49 @@ exports.QUERIES = {
164
170
  }
165
171
  }
166
172
  }
173
+ `,
174
+ seasonWithParticipants: `
175
+ query GetSeasonParticipants($seasonId: ID!) {
176
+ season(id: $seasonId) {
177
+ id
178
+ seasonId
179
+ totalStaked
180
+ totalReward
181
+ start
182
+ end
183
+ participants {
184
+ staker
185
+ totalStaked
186
+ }
187
+ }
188
+ }
189
+ `,
190
+ allSeasons: `
191
+ query GetAllSeasons {
192
+ seasons(first: 100, orderBy: seasonId, orderDirection: desc) {
193
+ id
194
+ seasonId
195
+ totalStaked
196
+ totalReward
197
+ start
198
+ end
199
+ }
200
+ }
201
+ `,
202
+ seasonByAsset: `
203
+ query GetSeasonByAsset($seasonId: ID!) {
204
+ season(id: $seasonId) {
205
+ id
206
+ seasonId
207
+ totalStaked
208
+ totalReward
209
+ assets {
210
+ asset
211
+ totalStaked
212
+ totalReward
213
+ }
214
+ }
215
+ }
167
216
  `,
168
217
  seasonAssets: `
169
218
  query GetSeasonAssets(
@@ -30,6 +30,10 @@ export interface ProtocolState {
30
30
  withdrawalCount: bigint;
31
31
  totalStaked: bigint;
32
32
  totalClaimed: bigint;
33
+ /** Cumulative staked amount across all seasons */
34
+ totalStakedAllTime?: bigint;
35
+ /** Cumulative rewards added across all seasons */
36
+ totalRewardsAddedAllTime?: bigint;
33
37
  updatedBlockNumber?: bigint | null;
34
38
  updatedBlockTimestamp?: bigint | null;
35
39
  updatedTransactionHash?: string | null;
@@ -119,8 +123,30 @@ export interface SeasonEntity {
119
123
  start: bigint;
120
124
  end: bigint;
121
125
  duration: bigint;
126
+ /** TVL for the season (sum across assets) */
127
+ totalStaked?: bigint;
128
+ /** Total rewards for the season */
129
+ totalReward?: bigint;
122
130
  assets: SeasonAssetEntity[];
123
131
  }
132
+ /** Per-staker participation in a season */
133
+ export interface StakerSeasonParticipant {
134
+ staker: string;
135
+ totalStaked: bigint;
136
+ }
137
+ /** Season with participants list (from participants relation) */
138
+ export interface SeasonWithParticipants extends Omit<SeasonEntity, "assets"> {
139
+ participants: StakerSeasonParticipant[];
140
+ }
141
+ /** Season summary for list views */
142
+ export interface SeasonSummary {
143
+ id: string;
144
+ seasonId: bigint;
145
+ totalStaked: bigint;
146
+ totalReward: bigint;
147
+ start: bigint;
148
+ end: bigint;
149
+ }
124
150
  export interface PaymentStats {
125
151
  id: string;
126
152
  contractAddress: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aintivirus-ai/mixer-sdk",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
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",