@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/types/index.d.ts
CHANGED
|
@@ -9,7 +9,8 @@ export declare enum ChainType {
|
|
|
9
9
|
* Asset modes for deposits and withdrawals
|
|
10
10
|
*/
|
|
11
11
|
export declare enum AssetMode {
|
|
12
|
-
|
|
12
|
+
SOL = 0,
|
|
13
|
+
ETH = 0,
|
|
13
14
|
TOKEN = 1
|
|
14
15
|
}
|
|
15
16
|
/**
|
|
@@ -32,9 +33,36 @@ export interface DepositData {
|
|
|
32
33
|
mode: AssetMode;
|
|
33
34
|
}
|
|
34
35
|
/**
|
|
35
|
-
* Staking season information
|
|
36
|
+
* Staking season information for Solana
|
|
36
37
|
*/
|
|
37
|
-
export interface
|
|
38
|
+
export interface SolanaStakeSeason {
|
|
39
|
+
seasonId: bigint;
|
|
40
|
+
startTimestamp: bigint;
|
|
41
|
+
endTimestamp: bigint;
|
|
42
|
+
totalStakedSolAmount: bigint;
|
|
43
|
+
totalStakedTokenAmount: bigint;
|
|
44
|
+
totalRewardSolAmount: bigint;
|
|
45
|
+
totalRewardTokenAmount: bigint;
|
|
46
|
+
totalSolWeightValue: bigint;
|
|
47
|
+
totalTokenWeightValue: bigint;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Staker record information for Solana
|
|
51
|
+
*/
|
|
52
|
+
export interface SolanaStakerRecord {
|
|
53
|
+
solStakedSeasonId: bigint;
|
|
54
|
+
tokenStakedSeasonId: bigint;
|
|
55
|
+
solStakedTimestamp: bigint;
|
|
56
|
+
tokenStakedTimestamp: bigint;
|
|
57
|
+
stakedSolAmount: bigint;
|
|
58
|
+
stakedTokenAmount: bigint;
|
|
59
|
+
solWeightValue: bigint;
|
|
60
|
+
tokenWeightValue: bigint;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Staking season information for EVM
|
|
64
|
+
*/
|
|
65
|
+
export interface EVMStakeSeason {
|
|
38
66
|
seasonId: bigint;
|
|
39
67
|
startTimestamp: bigint;
|
|
40
68
|
endTimestamp: bigint;
|
|
@@ -46,9 +74,9 @@ export interface StakeSeason {
|
|
|
46
74
|
totalTokenWeightValue: bigint;
|
|
47
75
|
}
|
|
48
76
|
/**
|
|
49
|
-
* Staker record information
|
|
77
|
+
* Staker record information for EVM
|
|
50
78
|
*/
|
|
51
|
-
export interface
|
|
79
|
+
export interface EVMStakerRecord {
|
|
52
80
|
ethStakedSeasonId: bigint;
|
|
53
81
|
tokenStakedSeasonId: bigint;
|
|
54
82
|
ethStakedTimestamp: bigint;
|
|
@@ -58,6 +86,16 @@ export interface StakerRecord {
|
|
|
58
86
|
ethWeightValue: bigint;
|
|
59
87
|
tokenWeightValue: bigint;
|
|
60
88
|
}
|
|
89
|
+
/**
|
|
90
|
+
* Staking season information (union type for backward compatibility)
|
|
91
|
+
* @deprecated Use SolanaStakeSeason or EVMStakeSeason instead
|
|
92
|
+
*/
|
|
93
|
+
export type StakeSeason = SolanaStakeSeason | EVMStakeSeason;
|
|
94
|
+
/**
|
|
95
|
+
* Staker record information (union type for backward compatibility)
|
|
96
|
+
* @deprecated Use SolanaStakerRecord or EVMStakerRecord instead
|
|
97
|
+
*/
|
|
98
|
+
export type StakerRecord = SolanaStakerRecord | EVMStakerRecord;
|
|
61
99
|
/**
|
|
62
100
|
* Configuration for SDK initialization
|
|
63
101
|
*/
|
package/dist/types/index.js
CHANGED
package/dist/utils/proof.js
CHANGED
|
@@ -1,4 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
@@ -10,7 +43,7 @@ exports.generateWithdrawalProofFromData = generateWithdrawalProofFromData;
|
|
|
10
43
|
const poseidon_lite_1 = require("poseidon-lite");
|
|
11
44
|
const fixed_merkle_tree_1 = __importDefault(require("fixed-merkle-tree"));
|
|
12
45
|
const crypto_1 = require("./crypto");
|
|
13
|
-
const
|
|
46
|
+
const snarkjs = __importStar(require("snarkjs"));
|
|
14
47
|
/**
|
|
15
48
|
* Build merkle tree from commitments
|
|
16
49
|
*/
|
|
@@ -71,19 +104,11 @@ async function generateWithdrawalProof(secret, nullifier, root, recipient, pathE
|
|
|
71
104
|
pathElements: pathElements.map((e) => e.toString()),
|
|
72
105
|
pathIndices: pathIndices.map((i) => i.toString()),
|
|
73
106
|
};
|
|
74
|
-
// Generate witness (requires witness calculator)
|
|
75
|
-
// Note: This is a simplified version. In production, you need to:
|
|
76
|
-
// 1. Load the witness calculator from your compiled circuit
|
|
77
|
-
// 2. Calculate witness using the calculator
|
|
78
|
-
// 3. Generate proof using snarkjs.groth16.prove()
|
|
79
|
-
// For now, return placeholder
|
|
80
|
-
// TODO: Implement full proof generation with witness calculator
|
|
81
107
|
const nullifierHash = (0, crypto_1.computeNullifierHash)(nullifier);
|
|
82
108
|
const recipientBigInt = BigInt(recipient);
|
|
83
109
|
try {
|
|
84
|
-
// Attempt to generate proof if witness calculator is available
|
|
85
110
|
// This would require loading the witness calculator from your build
|
|
86
|
-
const { proof, publicSignals } = await
|
|
111
|
+
const { proof, publicSignals } = await snarkjs.groth16.fullProve(input, circuitWasm, circuitZkey);
|
|
87
112
|
return {
|
|
88
113
|
pA: [BigInt(proof.pi_a[0]), BigInt(proof.pi_a[1])],
|
|
89
114
|
pB: [
|
package/package.json
CHANGED
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aintivirus-ai/mixer-sdk",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
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",
|
|
7
7
|
"scripts": {
|
|
8
8
|
"build": "npx tsc",
|
|
9
9
|
"dev": "npx tsc --watch",
|
|
10
|
-
"prepublishOnly": "npm run build"
|
|
10
|
+
"prepublishOnly": "npm run build",
|
|
11
|
+
"test:devnet": "tsx test/test-devnet.ts",
|
|
12
|
+
"test:solana": "tsx test/test-solana-devnet.ts"
|
|
11
13
|
},
|
|
12
14
|
"keywords": [
|
|
13
15
|
"web3",
|
|
@@ -21,9 +23,9 @@
|
|
|
21
23
|
"author": "",
|
|
22
24
|
"license": "MIT",
|
|
23
25
|
"dependencies": {
|
|
24
|
-
"@coral-xyz/anchor": "^0.
|
|
25
|
-
"@solana/spl-token": "^0.
|
|
26
|
-
"@solana/web3.js": "^1.
|
|
26
|
+
"@coral-xyz/anchor": "^0.32.1",
|
|
27
|
+
"@solana/spl-token": "^0.4.14",
|
|
28
|
+
"@solana/web3.js": "^1.98.4",
|
|
27
29
|
"ethers": "^6.9.0",
|
|
28
30
|
"fixed-merkle-tree": "^0.7.0",
|
|
29
31
|
"poseidon-lite": "^0.3.0",
|
|
@@ -35,7 +37,9 @@
|
|
|
35
37
|
"@types/react": "^18.2.0",
|
|
36
38
|
"@types/react-dom": "^18.2.0",
|
|
37
39
|
"@types/snarkjs": "^0.7.9",
|
|
40
|
+
"dotenv": "^16.6.1",
|
|
38
41
|
"react": "^18.2.0",
|
|
42
|
+
"tsx": "^4.7.0",
|
|
39
43
|
"typescript": "^5.3.3",
|
|
40
44
|
"viem": "^2.0.0",
|
|
41
45
|
"wagmi": "^2.0.0"
|