customvirtualcurve
v1.0.0
Published
<p align="center"> A TypeScript client implementation for interacting with Virtual Curve on Solana </p>
Readme
Virtual Curve TypeScript Client
Note: There is a "Critics and Development Process" section at the end of this document where I discuss my critics about the assignment and my development process.
Overview
The Virtual Curve TypeScript Client provides a seamless interface for interacting with Virtual Curve pools on the Solana blockchain. It offers functionality for creating and managing virtual AMM configurations and pools with customizable parameters.
Installation
pnpm install @solana/web3.js @coral-xyz/anchor bn.jsKey Features
- Create and manage Virtual Curve configurations
- Create and manage Virtual Curve pools
- Customizable fee structures
- Support for different token types and decimals
- Flexible liquidity curve configurations
Usage
Initialize Client
import { Connection } from "@solana/web3.js";
import { VirtualCurveClient } from "./virtual-curve";
const connection = new Connection("YOUR_RPC_URL", "confirmed");
const vcClient = await VirtualCurveClient.create(connection, {
cluster: "mainnet" // or "devnet", "localhost"
});Create Configuration
const configKeypair = Keypair.generate();
const createConfigParams = {
configPubkey: configKeypair.publicKey,
feeClaimer: userPublicKey,
owner: userPublicKey,
quoteMint: quoteMintPublicKey,
payer: userPublicKey,
poolFees: {
baseFee: {
cliffFeeNumerator: new BN(2_500_000),
numberOfPeriod: 0,
reductionFactor: new BN(0),
periodFrequency: new BN(0),
feeSchedulerMode: 0,
},
dynamicFee: null,
},
// ... other configuration parameters
};
const createConfigIx = await vcClient.createConfig(createConfigParams);Create Pool
const createPoolParams = {
payer: userPublicKey,
baseMint: baseMintPublicKey,
quoteMint: quoteMintPublicKey,
config: configPubkey,
instructionParams: {
name: "Pool Name",
symbol: "POOL",
uri: "metadata-uri.com",
},
};
const { transaction, pool } = await vcClient.createPool(createPoolParams);Examples
You can find complete working examples in the src/examples directory. The examples demonstrate:
- Creating a Virtual Curve configuration
- Setting up custom fee structures
- Creating a pool with specific parameters
- Handling transactions and confirmations
Check out src/examples/example.ts for a comprehensive example that shows how to:
- Initialize the client
- Create a configuration with custom curves
- Create a pool with the specified configuration
- Handle transaction confirmations and errors
API Reference
VirtualCurveClient
The main client class for interacting with Virtual Curve.
Methods
create(connection: Connection, options: ClientOptions): Creates a new client instancecreateConfig(params: CreateConfigParams): Creates a new Virtual Curve configurationcreatePool(params: CreatePoolParams): Creates a new pool with specified parameters
Critics and Development Process
Development Challenges
Documentation and Example Inconsistencies
- The example flow referenced account data structures (e.g.,
poolConfig.baseMint) that don't exist in the current program and IDL - This created additional complexity in implementing the client correctly
- The example flow referenced account data structures (e.g.,
Program Understanding
- The process of understanding the program independently was time-consuming and challenging
- In a real DevRel role, there would typically be access to the development team for clarifications and quick questions
- This made the task more challenging than it would be in an actual work environment
Implementation Notes
- I didn't have the time to implement unit tests, so I focused on creating a functional example (
src/examples/example.ts) to demonstrate the SDK's capabilities - Successfully tested the implementation using a local Solana validator with the Metaplex program deployed
Task Alignment Concerns
- Previous interviews emphasized this role's focus on community developer support and documentation
- The technical complexity of this assignment seems misaligned with the described role requirements
- A documentation or developer support-focused task might have been more appropriate for evaluating relevant skills
