Test the commons package
mainTo run quote testing for the commons package, use the following cargo command:
cargo t -p commons --test '*'repository·main·Indexed 43 days ago
https://github.com/meteoraag/dlmm-sdkSDK and CLI tools for interacting with Meteora's Dynamic Liquidity Market Maker (DLMM) concentrated liquidity market maker. Provides implementations in TypeScript, Python, and Rust for liquidity management, market making, and performing swaps. Includes a comprehensive CLI for liquidity management, trading, limit orders, and protocol administration.
To run quote testing for the commons package, use the following cargo command:
cargo t -p commons --test '*'To use the DLMM SDK, install the @meteora-ag/dlmm package along with its required dependencies: @coral-xyz/anchor and @solana/web3.js.
npm i @meteora-ag/dlmm @coral-xyz/anchor @solana/web3.jsAfter building, you can run the market making executable. Use the --help flag to view available command-line arguments and options.
target/debug/market_making --helpIf you are contributing to or developing the SDK locally, follow these steps to set up the environment:
python-client/dlmm and run poetry install to install dependencies.ts-client, run npm install, and then npm start-server to start the local server.API_URL in dlmm.py is set to localhost:3000 if you are using the local server.poetry add package_name.dlmm/tests directory, use poetry run pytest.# Install python dependencies
cd python-client/dlmm
poetry install
# Setup TS server
cd ts-client
npm install
npm start-server
# Run tests
poetry run pytestTo compile the market making example project, use the standard Cargo build command. Ensure you have the correct Rust toolchain installed as specified in the toolchain requirements.
cargo buildTo use the DLMM Python SDK in your project, install the dlmm package along with solders using pip:
pip install dlmm soldersTo run tests for the TypeScript SDK (ts-client), follow these steps to set up a local network and execute the test suite:
cd ts-clientanchor localnet -- --features localnetpnpm run testcd ts-client
anchor localnet -- --features localnet
pnpm run testThe market making example requires specific Rust toolchain versions.
1.76.01.76.0-x86_64-apple-darwin.The DLMM CLI requires specific Rust toolchain configurations depending on your hardware architecture.
For standard environments, use channel 1.76.0.
If you are using an Apple M1 chip, you may need to specify the target triple as x86_64-apple-darwin (e.g., 1.76.0-x86_64-apple-darwin).
To build the DLMM command line utility from source, use the Cargo build command. Ensure you have the appropriate Rust toolchain installed.
cargo buildThe LimitOrderStatus enum represents the current state of a specific bin within a limit order:
NotFilled: The order has not been matched against any swaps.PartialFilled: Part of the order has been matched, but some amount remains unfilled.Fulfilled: The entire order amount for that bin has been matched/processed.The SDK uses several interfaces to describe liquidity positions and their data.
LbPosition: A high-level representation of a position containing its publicKey, positionData, and version (PositionVersion).PositionInfo: A comprehensive view of a user's position, including the lbPair, tokenX and tokenY reserves, and an array of lbPairPositionsData.PositionData: Detailed state of a position, including total amounts, bin data, fees, rewards, and owner information.PositionBinData: Granular data for a specific bin within a position, including prices, amounts, and liquidity.PositionVersion is an enum with values:
V1V2