@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.
- package/README.md +711 -0
- package/dist/evm/index.d.ts +117 -0
- package/dist/evm/index.js +377 -0
- package/dist/hooks/index.d.ts +29 -0
- package/dist/hooks/index.js +36 -0
- package/dist/hooks/useAdmin.d.ts +35 -0
- package/dist/hooks/useAdmin.js +195 -0
- package/dist/hooks/useAintiVirus.d.ts +48 -0
- package/dist/hooks/useAintiVirus.js +238 -0
- package/dist/hooks/useClaim.d.ts +31 -0
- package/dist/hooks/useClaim.js +110 -0
- package/dist/hooks/useDeploy.d.ts +32 -0
- package/dist/hooks/useDeploy.js +96 -0
- package/dist/hooks/useDeposit.d.ts +30 -0
- package/dist/hooks/useDeposit.js +96 -0
- package/dist/hooks/useStake.d.ts +31 -0
- package/dist/hooks/useStake.js +112 -0
- package/dist/hooks/useView.d.ts +40 -0
- package/dist/hooks/useView.js +255 -0
- package/dist/hooks/useWithdraw.d.ts +30 -0
- package/dist/hooks/useWithdraw.js +98 -0
- package/dist/hooks/utils.d.ts +11 -0
- package/dist/hooks/utils.js +65 -0
- package/dist/index.d.ts +32 -0
- package/dist/index.js +97 -0
- package/dist/solana/index.d.ts +139 -0
- package/dist/solana/index.js +694 -0
- package/dist/types/index.d.ts +103 -0
- package/dist/types/index.js +19 -0
- package/dist/utils/crypto.d.ts +23 -0
- package/dist/utils/crypto.js +43 -0
- package/dist/utils/proof.d.ts +34 -0
- package/dist/utils/proof.js +120 -0
- package/package.json +63 -0
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Hook for withdrawing (EVM or Solana)
|
|
4
|
+
* Use this hook when you only need withdraw functionality
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.useWithdraw = useWithdraw;
|
|
8
|
+
const react_1 = require("react");
|
|
9
|
+
const types_1 = require("../types");
|
|
10
|
+
const evm_1 = require("../evm");
|
|
11
|
+
const solana_1 = require("../solana");
|
|
12
|
+
const wagmi_1 = require("wagmi");
|
|
13
|
+
const utils_1 = require("./utils");
|
|
14
|
+
/**
|
|
15
|
+
* Hook for withdrawing funds
|
|
16
|
+
* Only initializes what's needed for withdrawals
|
|
17
|
+
*/
|
|
18
|
+
function useWithdraw(config) {
|
|
19
|
+
// EVM setup
|
|
20
|
+
const { isConnected: evmConnected } = (0, wagmi_1.useAccount)();
|
|
21
|
+
const { data: walletClient } = (0, wagmi_1.useWalletClient)();
|
|
22
|
+
const publicClient = (0, wagmi_1.usePublicClient)();
|
|
23
|
+
const evmSDK = (0, react_1.useMemo)(() => {
|
|
24
|
+
if (!config.evm?.factoryAddress) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
if (!publicClient) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
30
|
+
try {
|
|
31
|
+
const provider = (0, utils_1.createEthersProviderFromViem)(publicClient);
|
|
32
|
+
const signerOrProvider = walletClient
|
|
33
|
+
? (0, utils_1.createEthersSignerFromViem)(walletClient, publicClient)
|
|
34
|
+
: provider;
|
|
35
|
+
return new evm_1.AintiVirusEVM(config.evm.factoryAddress, config.evm.tokenAddress || "0x0000000000000000000000000000000000000000", signerOrProvider);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
console.error("Failed to initialize AintiVirusEVM:", error);
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
}, [
|
|
42
|
+
config.evm?.factoryAddress,
|
|
43
|
+
config.evm?.tokenAddress,
|
|
44
|
+
walletClient,
|
|
45
|
+
publicClient,
|
|
46
|
+
]);
|
|
47
|
+
const isEVMReady = !!evmSDK && evmConnected;
|
|
48
|
+
// Solana setup
|
|
49
|
+
const solanaSDK = (0, react_1.useMemo)(() => {
|
|
50
|
+
if (!config.solana?.factoryProgramId ||
|
|
51
|
+
!config.solana?.mixerProgramId ||
|
|
52
|
+
!config.solana?.stakingProgramId) {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
if (!config.solanaWallet || !config.solanaConnection) {
|
|
56
|
+
return null;
|
|
57
|
+
}
|
|
58
|
+
try {
|
|
59
|
+
return new solana_1.AintiVirusSolana(config.solana.factoryProgramId, config.solana.mixerProgramId, config.solana.stakingProgramId, config.solanaWallet, config.solanaConnection, config.solana.tokenMint);
|
|
60
|
+
}
|
|
61
|
+
catch (error) {
|
|
62
|
+
console.error("Failed to initialize AintiVirusSolana:", error);
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}, [
|
|
66
|
+
config.solana?.factoryProgramId,
|
|
67
|
+
config.solana?.mixerProgramId,
|
|
68
|
+
config.solana?.stakingProgramId,
|
|
69
|
+
config.solana?.tokenMint,
|
|
70
|
+
config.solanaWallet,
|
|
71
|
+
config.solanaConnection,
|
|
72
|
+
]);
|
|
73
|
+
const isSolanaReady = !!solanaSDK && !!config.solanaWallet?.publicKey;
|
|
74
|
+
// Withdraw function
|
|
75
|
+
const withdraw = (0, react_1.useCallback)(async (chainType, proof, amount, mode) => {
|
|
76
|
+
if (chainType === types_1.ChainType.EVM) {
|
|
77
|
+
if (!evmSDK) {
|
|
78
|
+
throw new Error("EVM SDK not initialized");
|
|
79
|
+
}
|
|
80
|
+
return evmSDK.withdraw(proof, amount, mode);
|
|
81
|
+
}
|
|
82
|
+
else if (chainType === types_1.ChainType.SOLANA) {
|
|
83
|
+
if (!solanaSDK) {
|
|
84
|
+
throw new Error("Solana SDK not initialized");
|
|
85
|
+
}
|
|
86
|
+
// Solana withdraw needs instruction data and nullifier hash
|
|
87
|
+
const nullifierHash = proof.pubSignals[0];
|
|
88
|
+
const instructionData = new Uint8Array(0);
|
|
89
|
+
return solanaSDK.withdraw(instructionData, nullifierHash, amount, mode);
|
|
90
|
+
}
|
|
91
|
+
throw new Error(`Unsupported chain type: ${chainType}`);
|
|
92
|
+
}, [evmSDK, solanaSDK]);
|
|
93
|
+
return {
|
|
94
|
+
withdraw,
|
|
95
|
+
isEVMReady,
|
|
96
|
+
isSolanaReady,
|
|
97
|
+
};
|
|
98
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared utility functions for hooks
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Create ethers provider from viem public client
|
|
6
|
+
*/
|
|
7
|
+
export declare function createEthersProviderFromViem(publicClient: any): any;
|
|
8
|
+
/**
|
|
9
|
+
* Create ethers signer from viem wallet client
|
|
10
|
+
*/
|
|
11
|
+
export declare function createEthersSignerFromViem(walletClient: any, publicClient: any): any;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Shared utility functions for hooks
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.createEthersProviderFromViem = createEthersProviderFromViem;
|
|
7
|
+
exports.createEthersSignerFromViem = createEthersSignerFromViem;
|
|
8
|
+
/**
|
|
9
|
+
* Create ethers provider from viem public client
|
|
10
|
+
*/
|
|
11
|
+
function createEthersProviderFromViem(publicClient) {
|
|
12
|
+
if (!publicClient)
|
|
13
|
+
return null;
|
|
14
|
+
return {
|
|
15
|
+
getBalance: async (address) => {
|
|
16
|
+
const balance = await publicClient.getBalance({ address });
|
|
17
|
+
return BigInt(balance.toString());
|
|
18
|
+
},
|
|
19
|
+
getTransaction: async (hash) => {
|
|
20
|
+
return publicClient.getTransaction({ hash });
|
|
21
|
+
},
|
|
22
|
+
getTransactionReceipt: async (hash) => {
|
|
23
|
+
return publicClient.getTransactionReceipt({ hash });
|
|
24
|
+
},
|
|
25
|
+
waitForTransaction: async (hash) => {
|
|
26
|
+
return publicClient.waitForTransactionReceipt({ hash });
|
|
27
|
+
},
|
|
28
|
+
call: async (params) => {
|
|
29
|
+
return publicClient.call(params);
|
|
30
|
+
},
|
|
31
|
+
estimateGas: async (params) => {
|
|
32
|
+
return publicClient.estimateGas(params);
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Create ethers signer from viem wallet client
|
|
38
|
+
*/
|
|
39
|
+
function createEthersSignerFromViem(walletClient, publicClient) {
|
|
40
|
+
if (!walletClient)
|
|
41
|
+
return null;
|
|
42
|
+
const provider = createEthersProviderFromViem(publicClient);
|
|
43
|
+
return {
|
|
44
|
+
...walletClient,
|
|
45
|
+
provider,
|
|
46
|
+
getAddress: async () => walletClient.account.address,
|
|
47
|
+
signMessage: async (message) => {
|
|
48
|
+
const msg = typeof message === "string"
|
|
49
|
+
? message
|
|
50
|
+
: new TextDecoder().decode(message);
|
|
51
|
+
return walletClient.signMessage({ message: msg });
|
|
52
|
+
},
|
|
53
|
+
sendTransaction: async (tx) => {
|
|
54
|
+
const viemTx = {
|
|
55
|
+
to: tx.to,
|
|
56
|
+
value: tx.value ? BigInt(tx.value.toString()) : undefined,
|
|
57
|
+
data: tx.data,
|
|
58
|
+
gas: tx.gasLimit ? BigInt(tx.gasLimit.toString()) : undefined,
|
|
59
|
+
gasPrice: tx.gasPrice ? BigInt(tx.gasPrice.toString()) : undefined,
|
|
60
|
+
};
|
|
61
|
+
const hash = await walletClient.sendTransaction(viemTx);
|
|
62
|
+
return { hash };
|
|
63
|
+
},
|
|
64
|
+
};
|
|
65
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AintiVirus Mixer SDK
|
|
3
|
+
* Easy-to-use TypeScript SDK for privacy-preserving transactions on EVM and Solana
|
|
4
|
+
*/
|
|
5
|
+
import { SDKConfig } from "./types";
|
|
6
|
+
import { AintiVirusEVM } from "./evm";
|
|
7
|
+
import { AintiVirusSolana } from "./solana";
|
|
8
|
+
export * from "./types";
|
|
9
|
+
export { AintiVirusEVM };
|
|
10
|
+
export { AintiVirusSolana };
|
|
11
|
+
export * from "./utils/crypto";
|
|
12
|
+
export * from "./utils/proof";
|
|
13
|
+
export { AssetMode } from "./types";
|
|
14
|
+
export type { DepositData, WithdrawalProof, TransactionResult } from "./types";
|
|
15
|
+
export type { SDKConfig } from "./types";
|
|
16
|
+
/**
|
|
17
|
+
* Main SDK class that provides a unified interface
|
|
18
|
+
* Can be initialized for either EVM or Solana (or both)
|
|
19
|
+
*/
|
|
20
|
+
export declare class AintiVirusSDK {
|
|
21
|
+
evm?: AintiVirusEVM;
|
|
22
|
+
solana?: AintiVirusSolana;
|
|
23
|
+
/**
|
|
24
|
+
* Initialize SDK with configuration
|
|
25
|
+
*/
|
|
26
|
+
constructor(config: SDKConfig);
|
|
27
|
+
/**
|
|
28
|
+
* Set Solana wallet (required for Solana transactions)
|
|
29
|
+
*/
|
|
30
|
+
setSolanaWallet(wallet: any): void;
|
|
31
|
+
}
|
|
32
|
+
export default AintiVirusSDK;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AintiVirus Mixer SDK
|
|
4
|
+
* Easy-to-use TypeScript SDK for privacy-preserving transactions on EVM and Solana
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.AintiVirusSDK = exports.AssetMode = exports.AintiVirusSolana = exports.AintiVirusEVM = void 0;
|
|
22
|
+
const evm_1 = require("./evm");
|
|
23
|
+
Object.defineProperty(exports, "AintiVirusEVM", { enumerable: true, get: function () { return evm_1.AintiVirusEVM; } });
|
|
24
|
+
const solana_1 = require("./solana");
|
|
25
|
+
Object.defineProperty(exports, "AintiVirusSolana", { enumerable: true, get: function () { return solana_1.AintiVirusSolana; } });
|
|
26
|
+
// Export types
|
|
27
|
+
__exportStar(require("./types"), exports);
|
|
28
|
+
// Export utilities
|
|
29
|
+
__exportStar(require("./utils/crypto"), exports);
|
|
30
|
+
__exportStar(require("./utils/proof"), exports);
|
|
31
|
+
// Re-export commonly used types for convenience
|
|
32
|
+
var types_1 = require("./types");
|
|
33
|
+
Object.defineProperty(exports, "AssetMode", { enumerable: true, get: function () { return types_1.AssetMode; } });
|
|
34
|
+
/**
|
|
35
|
+
* Main SDK class that provides a unified interface
|
|
36
|
+
* Can be initialized for either EVM or Solana (or both)
|
|
37
|
+
*/
|
|
38
|
+
class AintiVirusSDK {
|
|
39
|
+
/**
|
|
40
|
+
* Initialize SDK with configuration
|
|
41
|
+
*/
|
|
42
|
+
constructor(config) {
|
|
43
|
+
if (config.evm) {
|
|
44
|
+
// Import ethers dynamically to avoid issues if not using EVM
|
|
45
|
+
try {
|
|
46
|
+
const ethers = require("ethers");
|
|
47
|
+
const provider = config.evm.provider ||
|
|
48
|
+
(config.evm.rpcUrl
|
|
49
|
+
? new ethers.JsonRpcProvider(config.evm.rpcUrl)
|
|
50
|
+
: null);
|
|
51
|
+
if (!provider) {
|
|
52
|
+
throw new Error("EVM provider or rpcUrl required");
|
|
53
|
+
}
|
|
54
|
+
const signer = provider instanceof ethers.Signer ? provider : null;
|
|
55
|
+
const { AintiVirusEVM } = require("./evm");
|
|
56
|
+
this.evm = new AintiVirusEVM(config.evm.factoryAddress, config.evm.tokenAddress, signer || provider);
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
throw new Error(`Failed to initialize EVM SDK: ${error}`);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
if (config.solana) {
|
|
63
|
+
// Import Solana dependencies dynamically
|
|
64
|
+
try {
|
|
65
|
+
const { Connection } = require("@solana/web3.js");
|
|
66
|
+
const connection = config.solana.connection ||
|
|
67
|
+
(config.solana.rpcUrl ? new Connection(config.solana.rpcUrl) : null);
|
|
68
|
+
if (!connection) {
|
|
69
|
+
throw new Error("Solana connection or rpcUrl required");
|
|
70
|
+
}
|
|
71
|
+
// Note: Wallet must be provided when creating AintiVirusSolana instance
|
|
72
|
+
// This unified SDK class is mainly for convenience - use individual SDKs directly for better control
|
|
73
|
+
throw new Error("Solana SDK should be initialized directly. Use AintiVirusSolana class.");
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
if (error instanceof Error &&
|
|
77
|
+
error.message.includes("Solana SDK should be initialized")) {
|
|
78
|
+
throw error;
|
|
79
|
+
}
|
|
80
|
+
throw new Error(`Failed to initialize Solana SDK: ${error}`);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Set Solana wallet (required for Solana transactions)
|
|
86
|
+
*/
|
|
87
|
+
setSolanaWallet(wallet) {
|
|
88
|
+
if (!this.solana) {
|
|
89
|
+
throw new Error("Solana SDK not initialized");
|
|
90
|
+
}
|
|
91
|
+
// Note: This would require modifying AintiVirusSolana to accept wallet updates
|
|
92
|
+
// For now, wallet should be provided during initialization
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.AintiVirusSDK = AintiVirusSDK;
|
|
96
|
+
// Default export
|
|
97
|
+
exports.default = AintiVirusSDK;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import * as anchor from "@coral-xyz/anchor";
|
|
2
|
+
import { PublicKey, Connection } from "@solana/web3.js";
|
|
3
|
+
import { AssetMode, TransactionResult, StakeSeason, StakerRecord } from "../types";
|
|
4
|
+
/**
|
|
5
|
+
* Solana SDK for AintiVirus Mixer
|
|
6
|
+
*/
|
|
7
|
+
export declare class AintiVirusSolana {
|
|
8
|
+
private factoryProgram;
|
|
9
|
+
private mixerProgram;
|
|
10
|
+
private stakingProgram;
|
|
11
|
+
private connection;
|
|
12
|
+
private wallet;
|
|
13
|
+
private tokenMint?;
|
|
14
|
+
constructor(factoryProgramId: string, mixerProgramId: string, stakingProgramId: string, wallet: anchor.Wallet, connection: Connection, tokenMint?: string);
|
|
15
|
+
/**
|
|
16
|
+
* Get factory PDA
|
|
17
|
+
*/
|
|
18
|
+
private getFactoryPda;
|
|
19
|
+
/**
|
|
20
|
+
* Get mixer pool PDA
|
|
21
|
+
*/
|
|
22
|
+
private getMixerPoolPda;
|
|
23
|
+
/**
|
|
24
|
+
* Get mixer config PDA
|
|
25
|
+
*/
|
|
26
|
+
private getMixerConfigPda;
|
|
27
|
+
/**
|
|
28
|
+
* Get merkle tree PDA
|
|
29
|
+
*/
|
|
30
|
+
private getMerkleTreePda;
|
|
31
|
+
/**
|
|
32
|
+
* Get mixer address for a specific mode and amount
|
|
33
|
+
*/
|
|
34
|
+
getMixer(mode: AssetMode, amount: bigint): Promise<PublicKey>;
|
|
35
|
+
/**
|
|
36
|
+
* Check if mixer exists
|
|
37
|
+
*/
|
|
38
|
+
mixerExists(mode: AssetMode, amount: bigint): Promise<boolean>;
|
|
39
|
+
/**
|
|
40
|
+
* Deposit SOL into the mixer
|
|
41
|
+
*/
|
|
42
|
+
depositSol(amount: bigint, commitment: bigint): Promise<TransactionResult>;
|
|
43
|
+
/**
|
|
44
|
+
* Deposit tokens into the mixer
|
|
45
|
+
*/
|
|
46
|
+
depositToken(amount: bigint, commitment: bigint): Promise<TransactionResult>;
|
|
47
|
+
/**
|
|
48
|
+
* Withdraw from the mixer
|
|
49
|
+
*/
|
|
50
|
+
withdraw(instructionData: Buffer, nullifierHash: bigint, amount: bigint, mode: AssetMode): Promise<TransactionResult>;
|
|
51
|
+
/**
|
|
52
|
+
* Stake SOL
|
|
53
|
+
*/
|
|
54
|
+
stakeSol(amount: bigint): Promise<TransactionResult>;
|
|
55
|
+
/**
|
|
56
|
+
* Stake tokens
|
|
57
|
+
*/
|
|
58
|
+
stakeToken(amount: bigint): Promise<TransactionResult>;
|
|
59
|
+
/**
|
|
60
|
+
* Claim SOL rewards
|
|
61
|
+
*/
|
|
62
|
+
claimSol(seasonId: bigint): Promise<TransactionResult>;
|
|
63
|
+
/**
|
|
64
|
+
* Claim token rewards
|
|
65
|
+
*/
|
|
66
|
+
claimToken(seasonId: bigint): Promise<TransactionResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Unstake SOL
|
|
69
|
+
*/
|
|
70
|
+
unstakeSol(): Promise<TransactionResult>;
|
|
71
|
+
/**
|
|
72
|
+
* Unstake tokens
|
|
73
|
+
*/
|
|
74
|
+
unstakeToken(): Promise<TransactionResult>;
|
|
75
|
+
/**
|
|
76
|
+
* Get current stake season
|
|
77
|
+
*/
|
|
78
|
+
getCurrentStakeSeason(): Promise<bigint>;
|
|
79
|
+
/**
|
|
80
|
+
* Get SOL balance
|
|
81
|
+
*/
|
|
82
|
+
getSolBalance(address: PublicKey): Promise<bigint>;
|
|
83
|
+
/**
|
|
84
|
+
* Get token balance
|
|
85
|
+
*/
|
|
86
|
+
getTokenBalance(address: PublicKey): Promise<bigint>;
|
|
87
|
+
/**
|
|
88
|
+
* Deploy mixer instance
|
|
89
|
+
*/
|
|
90
|
+
deployMixer(mode: AssetMode, amount: bigint): Promise<TransactionResult>;
|
|
91
|
+
/**
|
|
92
|
+
* Set fee rate (admin function)
|
|
93
|
+
*/
|
|
94
|
+
setFeeRate(feeRate: bigint): Promise<TransactionResult>;
|
|
95
|
+
/**
|
|
96
|
+
* Set staking season period (admin function)
|
|
97
|
+
*/
|
|
98
|
+
setStakingSeasonPeriod(period: bigint): Promise<TransactionResult>;
|
|
99
|
+
/**
|
|
100
|
+
* Start stake season (admin function)
|
|
101
|
+
*/
|
|
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>;
|
|
111
|
+
/**
|
|
112
|
+
* Calculate deposit amount including fees
|
|
113
|
+
*/
|
|
114
|
+
calculateDepositAmount(amount: bigint): Promise<bigint>;
|
|
115
|
+
/**
|
|
116
|
+
* Get fee rate
|
|
117
|
+
*/
|
|
118
|
+
getFeeRate(): Promise<bigint>;
|
|
119
|
+
/**
|
|
120
|
+
* Get stake season information
|
|
121
|
+
*/
|
|
122
|
+
getStakeSeason(seasonId: bigint): Promise<StakeSeason>;
|
|
123
|
+
/**
|
|
124
|
+
* Get staker record
|
|
125
|
+
*/
|
|
126
|
+
getStakerRecord(address: string): Promise<StakerRecord>;
|
|
127
|
+
/**
|
|
128
|
+
* Check if address has claimed SOL for a season
|
|
129
|
+
*/
|
|
130
|
+
hasClaimedSol(address: string, seasonId: bigint): Promise<boolean>;
|
|
131
|
+
/**
|
|
132
|
+
* Check if address has claimed tokens for a season
|
|
133
|
+
*/
|
|
134
|
+
hasClaimedToken(address: string, seasonId: bigint): Promise<boolean>;
|
|
135
|
+
/**
|
|
136
|
+
* Get staking address (PDA)
|
|
137
|
+
*/
|
|
138
|
+
getStakingAddress(): Promise<PublicKey>;
|
|
139
|
+
}
|