This guide provides instructions on how to get started with the DAMM v1 TypeScript SDK.
Before you begin, here are some important resources:
Installation
To use the SDK in your project, install it using your preferred package manager:
npm install @meteora-ag/dynamic-amm-sdk @solana/web3.js
# or
pnpm install @meteora-ag/dynamic-amm-sdk @solana/web3.js
# or
yarn add @meteora-ag/dynamic-amm-sdk @solana/web3.js
Initialization
Once installed, you can initialize the SDK in your TypeScript/JavaScript project like this:
import AmmImpl, { MAINNET_POOL } from '@meteora-ag/dynamic-amm-sdk';
import { Connection, PublicKey } from '@solana/web3.js';
const mainnetConnection = new Connection('https://api.mainnet-beta.solana.com');
// Create pool instances
// e.g. creating a constant product pool
const constantProductPool = await AmmImpl.create(mainnetConnection, MAINNET_POOL.USDC_SOL);
// e.g. creating a stable pool
const stablePool = await AmmImpl.create(mainnetConnection, MAINNET_POOL.USDT_USDC);
// e.g. creating a pool with an existing pool address
const pool = await AmmImpl.create(mainnetConnection, new PublicKey('...'));
// e.g. creating multiple pools
const pools = [MAINNET_POOL.USDC_SOL, MAINNET_POOL.USDT_USDC];
const [constantProductPool, stablePool] = await AmmImpl.createMultiple(mainnetConnection, pools);
Testing the SDK (for contributors)
If you have cloned the SDK repository and want to run the built-in tests:
# Install dependencies
cd ts-client
bun install
# Run tests
bun test
Development Resources
Faucets