@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.
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -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
- ETH = 0,// For EVM: ETH, For Solana: SOL
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 StakeSeason {
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 StakerRecord {
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
  */
@@ -14,6 +14,7 @@ var ChainType;
14
14
  */
15
15
  var AssetMode;
16
16
  (function (AssetMode) {
17
+ AssetMode[AssetMode["SOL"] = 0] = "SOL";
17
18
  AssetMode[AssetMode["ETH"] = 0] = "ETH";
18
19
  AssetMode[AssetMode["TOKEN"] = 1] = "TOKEN";
19
20
  })(AssetMode || (exports.AssetMode = AssetMode = {}));
@@ -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 snarkjs_1 = __importDefault(require("snarkjs"));
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 snarkjs_1.default.groth16.fullProve(input, circuitWasm, circuitZkey);
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.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.29.0",
25
- "@solana/spl-token": "^0.3.9",
26
- "@solana/web3.js": "^1.87.6",
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"