New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

customvirtualcurve

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

customvirtualcurve

A TypeScript client implementation for interacting with Virtual Curve on Solana

latest
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

Virtual Curve TypeScript Client

A TypeScript client implementation for interacting with Virtual Curve on Solana

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.js

Key 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 instance
  • createConfig(params: CreateConfigParams): Creates a new Virtual Curve configuration
  • createPool(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
  • 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

FAQs

Package last updated on 04 Apr 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts