@aintivirus-ai/mixer-sdk 1.0.0

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.
@@ -0,0 +1,117 @@
1
+ import { Contract, Signer, Provider } from "ethers";
2
+ import { AssetMode, WithdrawalProof, TransactionResult, StakeSeason, StakerRecord } from "../types";
3
+ /**
4
+ * EVM SDK for AintiVirus Mixer
5
+ */
6
+ export declare class AintiVirusEVM {
7
+ private factory;
8
+ private token;
9
+ private signer;
10
+ private provider;
11
+ private static readonly FACTORY_ABI;
12
+ private static readonly ERC20_ABI;
13
+ private static readonly STAKING_ABI;
14
+ constructor(factoryAddress: string, tokenAddress: string, signerOrProvider: Signer | Provider);
15
+ /**
16
+ * Get the factory contract instance
17
+ */
18
+ getFactory(): Contract;
19
+ /**
20
+ * Get the token contract instance
21
+ */
22
+ getToken(): Contract;
23
+ /**
24
+ * Get the provider instance
25
+ */
26
+ getProvider(): Provider;
27
+ /**
28
+ * Calculate total deposit amount including fees
29
+ */
30
+ calculateDepositAmount(amount: bigint): Promise<bigint>;
31
+ /**
32
+ * Get fee rate
33
+ */
34
+ getFeeRate(): Promise<bigint>;
35
+ /**
36
+ * Get mixer address for a specific mode and amount
37
+ */
38
+ getMixer(mode: AssetMode, amount: bigint): Promise<string>;
39
+ /**
40
+ * Check if mixer exists for a specific mode and amount
41
+ */
42
+ mixerExists(mode: AssetMode, amount: bigint): Promise<boolean>;
43
+ /**
44
+ * Deposit ETH into the mixer
45
+ */
46
+ depositEth(amount: bigint, commitment: bigint): Promise<TransactionResult>;
47
+ /**
48
+ * Deposit tokens into the mixer
49
+ */
50
+ depositToken(amount: bigint, commitment: bigint): Promise<TransactionResult>;
51
+ /**
52
+ * Withdraw from the mixer
53
+ */
54
+ withdraw(proof: WithdrawalProof, amount: bigint, mode: AssetMode): Promise<TransactionResult>;
55
+ /**
56
+ * Stake ETH
57
+ */
58
+ stakeEther(amount: bigint): Promise<TransactionResult>;
59
+ /**
60
+ * Stake tokens
61
+ */
62
+ stakeToken(amount: bigint): Promise<TransactionResult>;
63
+ /**
64
+ * Claim ETH rewards
65
+ */
66
+ claimEth(seasonId: bigint): Promise<TransactionResult>;
67
+ /**
68
+ * Claim token rewards
69
+ */
70
+ claimToken(seasonId: bigint): Promise<TransactionResult>;
71
+ /**
72
+ * Unstake ETH
73
+ */
74
+ unstakeEth(): Promise<TransactionResult>;
75
+ /**
76
+ * Unstake tokens
77
+ */
78
+ unstakeToken(): Promise<TransactionResult>;
79
+ /**
80
+ * Get current stake season
81
+ */
82
+ getCurrentStakeSeason(): Promise<bigint>;
83
+ /**
84
+ * Get staking contract address
85
+ */
86
+ getStakingAddress(): Promise<string>;
87
+ /**
88
+ * Get stake season information
89
+ */
90
+ getStakeSeason(seasonId: bigint): Promise<StakeSeason>;
91
+ /**
92
+ * Get staker record
93
+ */
94
+ getStakerRecord(address: string): Promise<StakerRecord>;
95
+ /**
96
+ * Check if user has claimed rewards for a season
97
+ */
98
+ hasClaimedEth(address: string, seasonId: bigint): Promise<boolean>;
99
+ /**
100
+ * Check if user has claimed token rewards for a season
101
+ */
102
+ hasClaimedToken(address: string, seasonId: bigint): Promise<boolean>;
103
+ /**
104
+ * Get token balance of an address
105
+ */
106
+ getTokenBalance(address: string): Promise<bigint>;
107
+ /**
108
+ * Get ETH balance of an address
109
+ */
110
+ getEthBalance(address: string): Promise<bigint>;
111
+ /**
112
+ * Deploy a new mixer instance
113
+ */
114
+ deployMixer(mode: AssetMode, amount: bigint): Promise<TransactionResult & {
115
+ mixerAddress: string;
116
+ }>;
117
+ }
@@ -0,0 +1,377 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AintiVirusEVM = void 0;
4
+ const ethers_1 = require("ethers");
5
+ const types_1 = require("../types");
6
+ const crypto_1 = require("../utils/crypto");
7
+ /**
8
+ * EVM SDK for AintiVirus Mixer
9
+ */
10
+ class AintiVirusEVM {
11
+ constructor(factoryAddress, tokenAddress, signerOrProvider) {
12
+ // Check if it's a Signer by checking for provider property
13
+ // In ethers v6, Signer has a provider property, Provider doesn't
14
+ const isSigner = signerOrProvider && "provider" in signerOrProvider && signerOrProvider.provider !== null;
15
+ this.provider = isSigner
16
+ ? signerOrProvider.provider
17
+ : signerOrProvider;
18
+ this.signer = isSigner ? signerOrProvider : null;
19
+ this.factory = new ethers_1.Contract(factoryAddress, AintiVirusEVM.FACTORY_ABI, signerOrProvider);
20
+ this.token = new ethers_1.Contract(tokenAddress, AintiVirusEVM.ERC20_ABI, signerOrProvider);
21
+ }
22
+ /**
23
+ * Get the factory contract instance
24
+ */
25
+ getFactory() {
26
+ return this.factory;
27
+ }
28
+ /**
29
+ * Get the token contract instance
30
+ */
31
+ getToken() {
32
+ return this.token;
33
+ }
34
+ /**
35
+ * Get the provider instance
36
+ */
37
+ getProvider() {
38
+ return this.provider;
39
+ }
40
+ /**
41
+ * Calculate total deposit amount including fees
42
+ */
43
+ async calculateDepositAmount(amount) {
44
+ return await this.factory.calculateDepositAmount(amount);
45
+ }
46
+ /**
47
+ * Get fee rate
48
+ */
49
+ async getFeeRate() {
50
+ return await this.factory.feeRate();
51
+ }
52
+ /**
53
+ * Get mixer address for a specific mode and amount
54
+ */
55
+ async getMixer(mode, amount) {
56
+ return await this.factory.getMixer(mode, amount);
57
+ }
58
+ /**
59
+ * Check if mixer exists for a specific mode and amount
60
+ */
61
+ async mixerExists(mode, amount) {
62
+ const mixerAddress = await this.getMixer(mode, amount);
63
+ return mixerAddress !== "0x0000000000000000000000000000000000000000";
64
+ }
65
+ /**
66
+ * Deposit ETH into the mixer
67
+ */
68
+ async depositEth(amount, commitment) {
69
+ if (!this.signer) {
70
+ throw new Error("Signer required for transactions");
71
+ }
72
+ const totalAmount = await this.calculateDepositAmount(amount);
73
+ const tx = await this.factory.deposit(types_1.AssetMode.ETH, amount, (0, crypto_1.bigIntToBytes32)(commitment), { value: totalAmount });
74
+ const receipt = await tx.wait();
75
+ return {
76
+ txHash: receipt.hash,
77
+ blockNumber: receipt.blockNumber,
78
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
79
+ };
80
+ }
81
+ /**
82
+ * Deposit tokens into the mixer
83
+ */
84
+ async depositToken(amount, commitment) {
85
+ if (!this.signer) {
86
+ throw new Error("Signer required for transactions");
87
+ }
88
+ const totalAmount = await this.calculateDepositAmount(amount);
89
+ const factoryAddress = await this.factory.getAddress();
90
+ // Check and approve if needed
91
+ const allowance = await this.token.allowance(await this.signer.getAddress(), factoryAddress);
92
+ if (allowance < totalAmount) {
93
+ const approveTx = await this.token.approve(factoryAddress, totalAmount);
94
+ await approveTx.wait();
95
+ }
96
+ const tx = await this.factory.deposit(types_1.AssetMode.TOKEN, amount, (0, crypto_1.bigIntToBytes32)(commitment));
97
+ const receipt = await tx.wait();
98
+ return {
99
+ txHash: receipt.hash,
100
+ blockNumber: receipt.blockNumber,
101
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
102
+ };
103
+ }
104
+ /**
105
+ * Withdraw from the mixer
106
+ */
107
+ async withdraw(proof, amount, mode) {
108
+ if (!this.signer) {
109
+ throw new Error("Signer required for transactions");
110
+ }
111
+ // Format proof for contract
112
+ const formattedProof = {
113
+ pA: [proof.pA[0].toString(), proof.pA[1].toString()],
114
+ pB: [
115
+ [proof.pB[0][0].toString(), proof.pB[0][1].toString()],
116
+ [proof.pB[1][0].toString(), proof.pB[1][1].toString()],
117
+ ],
118
+ pC: [proof.pC[0].toString(), proof.pC[1].toString()],
119
+ pubSignals: proof.pubSignals.map((s) => s.toString()),
120
+ };
121
+ const tx = await this.factory.withdraw(formattedProof, amount, mode);
122
+ const receipt = await tx.wait();
123
+ return {
124
+ txHash: receipt.hash,
125
+ blockNumber: receipt.blockNumber,
126
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
127
+ };
128
+ }
129
+ /**
130
+ * Stake ETH
131
+ */
132
+ async stakeEther(amount) {
133
+ if (!this.signer) {
134
+ throw new Error("Signer required for transactions");
135
+ }
136
+ const tx = await this.factory.stakeEther(amount, { value: amount });
137
+ const receipt = await tx.wait();
138
+ return {
139
+ txHash: receipt.hash,
140
+ blockNumber: receipt.blockNumber,
141
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
142
+ };
143
+ }
144
+ /**
145
+ * Stake tokens
146
+ */
147
+ async stakeToken(amount) {
148
+ if (!this.signer) {
149
+ throw new Error("Signer required for transactions");
150
+ }
151
+ const factoryAddress = await this.factory.getAddress();
152
+ const allowance = await this.token.allowance(await this.signer.getAddress(), factoryAddress);
153
+ if (allowance < amount) {
154
+ const approveTx = await this.token.approve(factoryAddress, amount);
155
+ await approveTx.wait();
156
+ }
157
+ const tx = await this.factory.stakeToken(amount);
158
+ const receipt = await tx.wait();
159
+ return {
160
+ txHash: receipt.hash,
161
+ blockNumber: receipt.blockNumber,
162
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
163
+ };
164
+ }
165
+ /**
166
+ * Claim ETH rewards
167
+ */
168
+ async claimEth(seasonId) {
169
+ if (!this.signer) {
170
+ throw new Error("Signer required for transactions");
171
+ }
172
+ const tx = await this.factory.claimEth(seasonId);
173
+ const receipt = await tx.wait();
174
+ return {
175
+ txHash: receipt.hash,
176
+ blockNumber: receipt.blockNumber,
177
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
178
+ };
179
+ }
180
+ /**
181
+ * Claim token rewards
182
+ */
183
+ async claimToken(seasonId) {
184
+ if (!this.signer) {
185
+ throw new Error("Signer required for transactions");
186
+ }
187
+ const tx = await this.factory.claimToken(seasonId);
188
+ const receipt = await tx.wait();
189
+ return {
190
+ txHash: receipt.hash,
191
+ blockNumber: receipt.blockNumber,
192
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
193
+ };
194
+ }
195
+ /**
196
+ * Unstake ETH
197
+ */
198
+ async unstakeEth() {
199
+ if (!this.signer) {
200
+ throw new Error("Signer required for transactions");
201
+ }
202
+ const tx = await this.factory.unstakeEth();
203
+ const receipt = await tx.wait();
204
+ return {
205
+ txHash: receipt.hash,
206
+ blockNumber: receipt.blockNumber,
207
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
208
+ };
209
+ }
210
+ /**
211
+ * Unstake tokens
212
+ */
213
+ async unstakeToken() {
214
+ if (!this.signer) {
215
+ throw new Error("Signer required for transactions");
216
+ }
217
+ const tx = await this.factory.unstakeToken();
218
+ const receipt = await tx.wait();
219
+ return {
220
+ txHash: receipt.hash,
221
+ blockNumber: receipt.blockNumber,
222
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
223
+ };
224
+ }
225
+ /**
226
+ * Get current stake season
227
+ */
228
+ async getCurrentStakeSeason() {
229
+ return await this.factory.getCurrentStakeSeason();
230
+ }
231
+ /**
232
+ * Get staking contract address
233
+ */
234
+ async getStakingAddress() {
235
+ return await this.factory.staking();
236
+ }
237
+ /**
238
+ * Get stake season information
239
+ */
240
+ async getStakeSeason(seasonId) {
241
+ const stakingAddress = await this.getStakingAddress();
242
+ const staking = new ethers_1.Contract(stakingAddress, AintiVirusEVM.STAKING_ABI, this.provider);
243
+ const season = await staking.stakeSeasons(seasonId);
244
+ return {
245
+ seasonId: season.seasonId,
246
+ startTimestamp: season.startTimestamp,
247
+ endTimestamp: season.endTimestamp,
248
+ totalStakedEthAmount: season.totalStakedEthAmount,
249
+ totalStakedTokenAmount: season.totalStakedTokenAmount,
250
+ totalRewardEthAmount: season.totalRewardEthAmount,
251
+ totalRewardTokenAmount: season.totalRewardTokenAmount,
252
+ totalEthWeightValue: season.totalEthWeightValue,
253
+ totalTokenWeightValue: season.totalTokenWeightValue,
254
+ };
255
+ }
256
+ /**
257
+ * Get staker record
258
+ */
259
+ async getStakerRecord(address) {
260
+ const stakingAddress = await this.getStakingAddress();
261
+ const staking = new ethers_1.Contract(stakingAddress, AintiVirusEVM.STAKING_ABI, this.provider);
262
+ const record = await staking.stakeRecords(address);
263
+ return {
264
+ ethStakedSeasonId: record.ethStakedSeasonId,
265
+ tokenStakedSeasonId: record.tokenStakedSeasonId,
266
+ ethStakedTimestamp: record.ethStakedTimestamp,
267
+ tokenStakedTimestamp: record.tokenStakedTimestamp,
268
+ stakedEthAmount: record.stakedEthAmount,
269
+ stakedTokenAmount: record.stakedTokenAmount,
270
+ ethWeightValue: record.ethWeightValue,
271
+ tokenWeightValue: record.tokenWeightValue,
272
+ };
273
+ }
274
+ /**
275
+ * Check if user has claimed rewards for a season
276
+ */
277
+ async hasClaimedEth(address, seasonId) {
278
+ const stakingAddress = await this.getStakingAddress();
279
+ const staking = new ethers_1.Contract(stakingAddress, AintiVirusEVM.STAKING_ABI, this.provider);
280
+ return await staking.addressToSeasonClaimedEth(address, seasonId);
281
+ }
282
+ /**
283
+ * Check if user has claimed token rewards for a season
284
+ */
285
+ async hasClaimedToken(address, seasonId) {
286
+ const stakingAddress = await this.getStakingAddress();
287
+ const staking = new ethers_1.Contract(stakingAddress, AintiVirusEVM.STAKING_ABI, this.provider);
288
+ return await staking.addressToSeasonClaimedToken(address, seasonId);
289
+ }
290
+ /**
291
+ * Get token balance of an address
292
+ */
293
+ async getTokenBalance(address) {
294
+ return await this.token.balanceOf(address);
295
+ }
296
+ /**
297
+ * Get ETH balance of an address
298
+ */
299
+ async getEthBalance(address) {
300
+ return await this.provider.getBalance(address);
301
+ }
302
+ /**
303
+ * Deploy a new mixer instance
304
+ */
305
+ async deployMixer(mode, amount) {
306
+ if (!this.signer) {
307
+ throw new Error("Signer required for transactions");
308
+ }
309
+ const tx = await this.factory.deployMixer(mode, amount);
310
+ const receipt = await tx.wait();
311
+ // Extract mixer address from event
312
+ const event = receipt.logs.find((log) => {
313
+ try {
314
+ const parsed = this.factory.interface.parseLog(log);
315
+ return parsed?.name === "MixerDeployed";
316
+ }
317
+ catch {
318
+ return false;
319
+ }
320
+ });
321
+ let mixerAddress = "";
322
+ if (event) {
323
+ const parsed = this.factory.interface.parseLog(event);
324
+ mixerAddress = parsed?.args.mixer;
325
+ }
326
+ return {
327
+ txHash: receipt.hash,
328
+ blockNumber: receipt.blockNumber,
329
+ blockTime: (await this.provider.getBlock(receipt.blockNumber))?.timestamp,
330
+ mixerAddress,
331
+ };
332
+ }
333
+ }
334
+ exports.AintiVirusEVM = AintiVirusEVM;
335
+ // Factory ABI (minimal for main functions)
336
+ AintiVirusEVM.FACTORY_ABI = [
337
+ "function deposit(uint256 _mode, uint256 _amount, bytes32 _commitment) payable",
338
+ "function withdraw(tuple(uint256[2] pA, uint256[2][2] pB, uint256[2] pC, uint256[3] pubSignals) _proof, uint256 _amount, uint256 _mode)",
339
+ "function deployMixer(uint256 _mode, uint256 _amount) returns (address)",
340
+ "function getMixer(uint256 _mode, uint256 _amount) view returns (address)",
341
+ "function calculateDepositAmount(uint256 _amount) view returns (uint256)",
342
+ "function feeRate() view returns (uint256)",
343
+ "function staking() view returns (address)",
344
+ "function mixToken() view returns (address)",
345
+ "function stakeEther(uint256 amount) payable",
346
+ "function stakeToken(uint256 amount)",
347
+ "function claimEth(uint256 seasonId)",
348
+ "function claimToken(uint256 seasonId)",
349
+ "function unstakeEth()",
350
+ "function unstakeToken()",
351
+ "function getCurrentStakeSeason() view returns (uint256)",
352
+ "function setFeeRate(uint256 _feeRate)",
353
+ "function setStakingSeasonPeriod(uint256 _period)",
354
+ "function startStakeSeason()",
355
+ "function setVerifier(address _verifier)",
356
+ "function setHasher(address _hasher)",
357
+ "event MixerDeployed(address indexed mixer, uint256 indexed mode, uint256 indexed amount)",
358
+ "event Deposit(bytes32 indexed commitment, uint32 leafIndex, uint256 timestamp)",
359
+ "event Withdrawal(address to, bytes32 nullifierHash)",
360
+ "event FeeRateUpdated(uint256 oldFeeRate, uint256 newFeeRate)",
361
+ ];
362
+ // ERC20 ABI
363
+ AintiVirusEVM.ERC20_ABI = [
364
+ "function approve(address spender, uint256 amount) returns (bool)",
365
+ "function allowance(address owner, address spender) view returns (uint256)",
366
+ "function balanceOf(address account) view returns (uint256)",
367
+ "function decimals() view returns (uint8)",
368
+ ];
369
+ // Staking ABI
370
+ AintiVirusEVM.STAKING_ABI = [
371
+ "function stakeSeasons(uint256) view returns (uint256 seasonId, uint256 startTimestamp, uint256 endTimestamp, uint256 totalStakedEthAmount, uint256 totalStakedTokenAmount, uint256 totalRewardEthAmount, uint256 totalRewardTokenAmount, uint256 totalEthWeightValue, uint256 totalTokenWeightValue)",
372
+ "function stakeRecords(address) view returns (uint256 ethStakedSeasonId, uint256 tokenStakedSeasonId, uint256 ethStakedTimestamp, uint256 tokenStakedTimestamp, uint256 stakedEthAmount, uint256 stakedTokenAmount, uint256 ethWeightValue, uint256 tokenWeightValue)",
373
+ "function addressToSeasonClaimedEth(address, uint256) view returns (bool)",
374
+ "function addressToSeasonClaimedToken(address, uint256) view returns (bool)",
375
+ "function stakingSeasonPeriod() view returns (uint256)",
376
+ "function currentStakeSeason() view returns (uint256)",
377
+ ];
@@ -0,0 +1,29 @@
1
+ /**
2
+ * React hooks for AintiVirus Mixer SDK
3
+ * Optimized for Next.js integration with EVM and Solana support
4
+ *
5
+ * Use individual hooks for better code splitting:
6
+ * - useDeposit: Only for deposits
7
+ * - useStake: Only for staking/unstaking
8
+ * - useClaim: Only for claiming rewards
9
+ * - useWithdraw: Only for withdrawals
10
+ * - useAintiVirus: All-in-one hook (if you need everything)
11
+ */
12
+ export { useDeposit } from "./useDeposit";
13
+ export type { DepositHookConfig, UseDepositReturn } from "./useDeposit";
14
+ export { useStake } from "./useStake";
15
+ export type { StakeHookConfig, UseStakeReturn } from "./useStake";
16
+ export { useClaim } from "./useClaim";
17
+ export type { ClaimHookConfig, UseClaimReturn } from "./useClaim";
18
+ export { useWithdraw } from "./useWithdraw";
19
+ export type { WithdrawHookConfig, UseWithdrawReturn } from "./useWithdraw";
20
+ export { useView } from "./useView";
21
+ export type { ViewHookConfig, UseViewReturn } from "./useView";
22
+ export { useDeploy } from "./useDeploy";
23
+ export type { DeployHookConfig, UseDeployReturn } from "./useDeploy";
24
+ export { useAdmin } from "./useAdmin";
25
+ export type { AdminHookConfig, UseAdminReturn } from "./useAdmin";
26
+ export { useAintiVirus } from "./useAintiVirus";
27
+ export type { UnifiedHookConfig, UseAintiVirusReturn } from "./useAintiVirus";
28
+ export { ChainType, AssetMode } from "../types";
29
+ export type { EVMHookConfig, SolanaHookConfig } from "../types";
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ /**
3
+ * React hooks for AintiVirus Mixer SDK
4
+ * Optimized for Next.js integration with EVM and Solana support
5
+ *
6
+ * Use individual hooks for better code splitting:
7
+ * - useDeposit: Only for deposits
8
+ * - useStake: Only for staking/unstaking
9
+ * - useClaim: Only for claiming rewards
10
+ * - useWithdraw: Only for withdrawals
11
+ * - useAintiVirus: All-in-one hook (if you need everything)
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ exports.AssetMode = exports.ChainType = exports.useAintiVirus = exports.useAdmin = exports.useDeploy = exports.useView = exports.useWithdraw = exports.useClaim = exports.useStake = exports.useDeposit = void 0;
15
+ // Individual hooks (recommended for code splitting)
16
+ var useDeposit_1 = require("./useDeposit");
17
+ Object.defineProperty(exports, "useDeposit", { enumerable: true, get: function () { return useDeposit_1.useDeposit; } });
18
+ var useStake_1 = require("./useStake");
19
+ Object.defineProperty(exports, "useStake", { enumerable: true, get: function () { return useStake_1.useStake; } });
20
+ var useClaim_1 = require("./useClaim");
21
+ Object.defineProperty(exports, "useClaim", { enumerable: true, get: function () { return useClaim_1.useClaim; } });
22
+ var useWithdraw_1 = require("./useWithdraw");
23
+ Object.defineProperty(exports, "useWithdraw", { enumerable: true, get: function () { return useWithdraw_1.useWithdraw; } });
24
+ var useView_1 = require("./useView");
25
+ Object.defineProperty(exports, "useView", { enumerable: true, get: function () { return useView_1.useView; } });
26
+ var useDeploy_1 = require("./useDeploy");
27
+ Object.defineProperty(exports, "useDeploy", { enumerable: true, get: function () { return useDeploy_1.useDeploy; } });
28
+ var useAdmin_1 = require("./useAdmin");
29
+ Object.defineProperty(exports, "useAdmin", { enumerable: true, get: function () { return useAdmin_1.useAdmin; } });
30
+ // Unified hook (supports both EVM and Solana - use if you need all functions)
31
+ var useAintiVirus_1 = require("./useAintiVirus");
32
+ Object.defineProperty(exports, "useAintiVirus", { enumerable: true, get: function () { return useAintiVirus_1.useAintiVirus; } });
33
+ // Re-export types
34
+ var types_1 = require("../types");
35
+ Object.defineProperty(exports, "ChainType", { enumerable: true, get: function () { return types_1.ChainType; } });
36
+ Object.defineProperty(exports, "AssetMode", { enumerable: true, get: function () { return types_1.AssetMode; } });
@@ -0,0 +1,35 @@
1
+ /**
2
+ * Hook for admin functions (EVM or Solana)
3
+ * Use this hook when you need to perform admin operations
4
+ * Requires OPERATOR_ROLE or ADMIN_ROLE
5
+ */
6
+ import { ChainType, EVMHookConfig, SolanaHookConfig } from "../types";
7
+ import { Wallet } from "@coral-xyz/anchor";
8
+ import { Connection } from "@solana/web3.js";
9
+ import { TransactionResult } from "../types";
10
+ /**
11
+ * Hook configuration for admin functions
12
+ */
13
+ export interface AdminHookConfig {
14
+ evm?: EVMHookConfig;
15
+ solana?: SolanaHookConfig;
16
+ solanaWallet?: Wallet;
17
+ solanaConnection?: Connection;
18
+ }
19
+ /**
20
+ * Admin hook return type
21
+ */
22
+ export interface UseAdminReturn {
23
+ setFeeRate: (chainType: ChainType, feeRate: bigint) => Promise<TransactionResult>;
24
+ setStakingSeasonPeriod: (chainType: ChainType, period: bigint) => Promise<TransactionResult>;
25
+ startStakeSeason: (chainType: ChainType) => Promise<TransactionResult>;
26
+ setVerifier: (chainType: ChainType, verifierAddress: string) => Promise<TransactionResult>;
27
+ setHasher: (chainType: ChainType, hasherAddress: string) => Promise<TransactionResult>;
28
+ isEVMReady: boolean;
29
+ isSolanaReady: boolean;
30
+ }
31
+ /**
32
+ * Hook for admin functions
33
+ * Only initializes what's needed for admin operations
34
+ */
35
+ export declare function useAdmin(config: AdminHookConfig): UseAdminReturn;