IDL Overview
Overview of the zklsol program interface
IDL Overview
Section titled “IDL Overview”The zklsol program is an Anchor program deployed on Solana mainnet and devnet.
Program Information
Section titled “Program Information”| Field | Value |
|---|---|
| Program ID | FGKoWNsvTTDCGW9JyR2DJWNzSXpejWk7yXcKsFFj9GQp |
| Name | zklsol |
| Version | 0.1.0 |
| Framework | Anchor |
IDL File
Section titled “IDL File”The full IDL is available at:
Loading the IDL
Section titled “Loading the IDL”import { Program, AnchorProvider } from '@coral-xyz/anchor';import { Connection, PublicKey } from '@solana/web3.js';
// Import the IDLimport idl from './zklsol-idl.json';
const PROGRAM_ID = new PublicKey('FGKoWNsvTTDCGW9JyR2DJWNzSXpejWk7yXcKsFFj9GQp');
// Create providerconst connection = new Connection('https://api.mainnet-beta.solana.com');const provider = new AnchorProvider(connection, wallet, {});
// Create program instanceconst program = new Program(idl as any, provider);Instruction Categories
Section titled “Instruction Categories”The program provides instructions in these categories:
Core Operations
Section titled “Core Operations”| Instruction | Purpose |
|---|---|
deposit | Deposit tokens with commitment |
withdraw | Withdraw tokens with ZK proof |
revert | Recover failed deposits |
Swap Operations
Section titled “Swap Operations”| Instruction | Purpose |
|---|---|
withdraw_swap | Withdraw with Jupiter swap |
withdraw_swap_pre | Prepare swap buffer |
withdraw_swap_raw | Execute raw swap |
withdraw_swap_post | Finalize swap |
Setup/Admin
Section titled “Setup/Admin”| Instruction | Purpose |
|---|---|
create_merkle | Create Merkle tree for token |
create_merkle_node | Initialize tree nodes |
create_merkle_token_account | Create pool token account |
update_merkle_fees | Update fee configuration |
create_settings | Initialize program settings |
Address Lookup Tables
Section titled “Address Lookup Tables”| Instruction | Purpose |
|---|---|
create_address_lookup_table | Create user LUT |
extend_address_lookup_table | Add addresses to LUT |
deactivate_address_lookup_table | Deactivate LUT |
close_address_lookup_table | Close and reclaim rent |
Affiliate Program
Section titled “Affiliate Program”| Instruction | Purpose |
|---|---|
create_affiliate | Register affiliate |
create_affiliate_token_account | Create affiliate token account |
withdraw_affiliate | Withdraw affiliate earnings |
Fee Collection
Section titled “Fee Collection”| Instruction | Purpose |
|---|---|
create_fee_collector | Create fee collector |
create_fee_collector_token_account | Create fee token account |
withdraw_fee_collector | Withdraw collected fees |
Account Types
Section titled “Account Types”| Account | Description |
|---|---|
Settings | Global program settings |
MerkleState | Merkle tree state |
MerkleZeros | Zero values for tree |
MerkleNode | Individual tree node |
NullifierHash | Spent nullifier record |
Affiliate | Affiliate information |
FeeCollector | Fee collector state |
UserAddressLookupTable | User’s LUT reference |
Next Steps
Section titled “Next Steps”- Instructions Reference - Detailed instruction docs
- Accounts Reference - Account structure details
- Types Reference - Type definitions