@aintivirus-ai/mixer-sdk 1.0.0 → 1.0.1
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/evm/index.d.ts +7 -3
- package/dist/evm/index.js +38 -16
- package/dist/hooks/useAdmin.d.ts +0 -2
- package/dist/hooks/useAdmin.js +11 -51
- package/dist/hooks/useAintiVirus.js +1 -1
- package/dist/hooks/useClaim.js +1 -1
- package/dist/hooks/useDeploy.js +1 -1
- package/dist/hooks/useDeposit.js +1 -1
- package/dist/hooks/useStake.js +1 -1
- package/dist/hooks/useView.js +1 -1
- package/dist/hooks/useWithdraw.js +1 -1
- package/dist/solana/idl/aintivirus_factory.json +2951 -0
- package/dist/solana/idl/aintivirus_mixer.json +615 -0
- package/dist/solana/idl/aintivirus_staking.json +989 -0
- package/dist/solana/index.d.ts +60 -14
- package/dist/solana/index.js +310 -235
- package/dist/solana/types/aintivirus_factory.d.ts +2957 -0
- package/dist/solana/types/aintivirus_factory.js +2 -0
- package/dist/solana/types/aintivirus_mixer.d.ts +621 -0
- package/dist/solana/types/aintivirus_mixer.js +2 -0
- package/dist/solana/types/aintivirus_staking.d.ts +995 -0
- package/dist/solana/types/aintivirus_staking.js +2 -0
- package/dist/types/index.d.ts +43 -5
- package/dist/types/index.js +1 -0
- package/dist/utils/proof.js +35 -10
- package/package.json +9 -5
package/dist/solana/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as anchor from "@coral-xyz/anchor";
|
|
2
2
|
import { PublicKey, Connection } from "@solana/web3.js";
|
|
3
|
-
import { AssetMode, TransactionResult,
|
|
3
|
+
import { AssetMode, TransactionResult, SolanaStakeSeason, SolanaStakerRecord } from "../types";
|
|
4
4
|
/**
|
|
5
5
|
* Solana SDK for AintiVirus Mixer
|
|
6
6
|
*/
|
|
@@ -11,7 +11,15 @@ export declare class AintiVirusSolana {
|
|
|
11
11
|
private connection;
|
|
12
12
|
private wallet;
|
|
13
13
|
private tokenMint?;
|
|
14
|
-
constructor(
|
|
14
|
+
constructor(wallet: anchor.Wallet, connection: Connection, tokenMint?: string);
|
|
15
|
+
/**
|
|
16
|
+
* Ensure IDL has address in metadata.address for Anchor 0.32.1
|
|
17
|
+
*/
|
|
18
|
+
private ensureIdlAddress;
|
|
19
|
+
/**
|
|
20
|
+
* Set token mint address (can be called after initialization)
|
|
21
|
+
*/
|
|
22
|
+
setTokenMint(tokenMint: PublicKey): void;
|
|
15
23
|
/**
|
|
16
24
|
* Get factory PDA
|
|
17
25
|
*/
|
|
@@ -28,6 +36,42 @@ export declare class AintiVirusSolana {
|
|
|
28
36
|
* Get merkle tree PDA
|
|
29
37
|
*/
|
|
30
38
|
private getMerkleTreePda;
|
|
39
|
+
/**
|
|
40
|
+
* Get vault SOL PDA
|
|
41
|
+
*/
|
|
42
|
+
private getVaultSolPda;
|
|
43
|
+
/**
|
|
44
|
+
* Get staking PDA
|
|
45
|
+
*/
|
|
46
|
+
private getStakingPda;
|
|
47
|
+
/**
|
|
48
|
+
* Get stake season PDA
|
|
49
|
+
*/
|
|
50
|
+
private getStakeSeasonPda;
|
|
51
|
+
/**
|
|
52
|
+
* Get staker record PDA
|
|
53
|
+
*/
|
|
54
|
+
private getStakerRecordPda;
|
|
55
|
+
/**
|
|
56
|
+
* Get season claimed PDA
|
|
57
|
+
*/
|
|
58
|
+
private getSeasonClaimedPda;
|
|
59
|
+
/**
|
|
60
|
+
* Check if an address has claimed rewards for a season
|
|
61
|
+
* @param address - Staker's public key
|
|
62
|
+
* @param seasonId - Season ID to check
|
|
63
|
+
* @param mode - Asset mode (SOL or TOKEN)
|
|
64
|
+
* @returns true if the address has claimed rewards for the season
|
|
65
|
+
*/
|
|
66
|
+
private hasClaimed;
|
|
67
|
+
/**
|
|
68
|
+
* Get commitment checker PDA
|
|
69
|
+
*/
|
|
70
|
+
private getCommitmentCheckerPda;
|
|
71
|
+
/**
|
|
72
|
+
* Get nullifier hash checker PDA
|
|
73
|
+
*/
|
|
74
|
+
private getNullifierHashCheckerPda;
|
|
31
75
|
/**
|
|
32
76
|
* Get mixer address for a specific mode and amount
|
|
33
77
|
*/
|
|
@@ -47,7 +91,7 @@ export declare class AintiVirusSolana {
|
|
|
47
91
|
/**
|
|
48
92
|
* Withdraw from the mixer
|
|
49
93
|
*/
|
|
50
|
-
withdraw(instructionData: Buffer, nullifierHash: bigint, amount: bigint, mode: AssetMode): Promise<TransactionResult>;
|
|
94
|
+
withdraw(instructionData: Buffer, nullifierHash: bigint, amount: bigint, mode: AssetMode, recipient?: PublicKey): Promise<TransactionResult>;
|
|
51
95
|
/**
|
|
52
96
|
* Stake SOL
|
|
53
97
|
*/
|
|
@@ -84,6 +128,12 @@ export declare class AintiVirusSolana {
|
|
|
84
128
|
* Get token balance
|
|
85
129
|
*/
|
|
86
130
|
getTokenBalance(address: PublicKey): Promise<bigint>;
|
|
131
|
+
/**
|
|
132
|
+
* Initialize factory account
|
|
133
|
+
* @param feeRate Fee rate in basis points (e.g., 250 = 0.25%)
|
|
134
|
+
* @param tokenMint Token mint address (required for vault_token_account)
|
|
135
|
+
*/
|
|
136
|
+
initializeFactory(feeRate: bigint, tokenMint: PublicKey): Promise<TransactionResult>;
|
|
87
137
|
/**
|
|
88
138
|
* Deploy mixer instance
|
|
89
139
|
*/
|
|
@@ -99,15 +149,7 @@ export declare class AintiVirusSolana {
|
|
|
99
149
|
/**
|
|
100
150
|
* Start stake season (admin function)
|
|
101
151
|
*/
|
|
102
|
-
startStakeSeason(): Promise<TransactionResult>;
|
|
103
|
-
/**
|
|
104
|
-
* Set verifier address (admin function)
|
|
105
|
-
*/
|
|
106
|
-
setVerifier(verifierAddress: string): Promise<TransactionResult>;
|
|
107
|
-
/**
|
|
108
|
-
* Set hasher address (admin function)
|
|
109
|
-
*/
|
|
110
|
-
setHasher(hasherAddress: string): Promise<TransactionResult>;
|
|
152
|
+
startStakeSeason(nextSeasonId: bigint): Promise<TransactionResult>;
|
|
111
153
|
/**
|
|
112
154
|
* Calculate deposit amount including fees
|
|
113
155
|
*/
|
|
@@ -116,14 +158,18 @@ export declare class AintiVirusSolana {
|
|
|
116
158
|
* Get fee rate
|
|
117
159
|
*/
|
|
118
160
|
getFeeRate(): Promise<bigint>;
|
|
161
|
+
/**
|
|
162
|
+
* Get factory account (includes mint address)
|
|
163
|
+
*/
|
|
164
|
+
getFactoryAccount(): Promise<any>;
|
|
119
165
|
/**
|
|
120
166
|
* Get stake season information
|
|
121
167
|
*/
|
|
122
|
-
getStakeSeason(seasonId: bigint): Promise<
|
|
168
|
+
getStakeSeason(seasonId: bigint): Promise<SolanaStakeSeason>;
|
|
123
169
|
/**
|
|
124
170
|
* Get staker record
|
|
125
171
|
*/
|
|
126
|
-
getStakerRecord(address: string): Promise<
|
|
172
|
+
getStakerRecord(address: string): Promise<SolanaStakerRecord>;
|
|
127
173
|
/**
|
|
128
174
|
* Check if address has claimed SOL for a season
|
|
129
175
|
*/
|