### Setup Environment Variables Source: https://docs.meteora.ag/invent/actions Copy the example environment file and configure your private key for deployment. ```bash cp studio/.env.example studio/.env ``` -------------------------------- ### Meteora Invent Studio Setup Source: https://docs.meteora.ag/invent/launch-pools Clone the Meteora Invent repository, install dependencies, copy the environment file, and generate a keypair. This setup is common for all launch pool guides. ```bash git clone https://github.com/MeteoraAg/meteora-invent.git cd meteora-invent pnpm install cp studio/.env.example studio/.env pnpm studio generate-keypair ``` -------------------------------- ### Clone DAMM v2 Go Repository and Setup Source: https://docs.meteora.ag/developer-guides/damm-v2/go-integration/reference Clone the repository, navigate to the directory, and run `go mod tidy` to set up the Go environment for DAMM v2 examples. ```bash git clone https://github.com/MeteoraAg/damm-v2-go.git cd damm-v2-go go mod tidy ``` -------------------------------- ### Install Dynamic Fee Sharing SDK with npm Source: https://docs.meteora.ag/developer-guides/dynamic-fee-sharing/typescript-sdk/getting-started Install the SDK and its dependencies using npm. Ensure you have Node.js and npm installed. ```bash npm install @meteora-ag/dynamic-fee-sharing-sdk @solana/web3.js @solana/spl-token bn.js ``` -------------------------------- ### Install Project Dependencies Source: https://docs.meteora.ag/invent/actions Navigate into the cloned directory and install the project dependencies using pnpm. ```bash cd meteora-invent pnpm install ``` -------------------------------- ### Copy Environment Example Source: https://docs.meteora.ag/invent/scaffold/fun-launch Copy the example environment file to create your own .env file for configuration. ```bash cp scaffolds/fun-launch/.env.example scaffolds/fun-launch/.env ``` -------------------------------- ### Install Presale Vault SDK with npm Source: https://docs.meteora.ag/developer-guides/presale-vault/typescript-sdk/getting-started Install the SDK and Solana web3.js using npm. ```bash npm install @meteora-ag/presale @solana/web3.js ``` -------------------------------- ### Install Presale Vault SDK with yarn Source: https://docs.meteora.ag/developer-guides/presale-vault/typescript-sdk/getting-started Install the SDK and Solana web3.js using yarn. ```bash yarn add @meteora-ag/presale @solana/web3.js ``` -------------------------------- ### Run Go Examples Source: https://docs.meteora.ag/developer-guides/damm-v2 Tidies Go modules and runs a Go example, such as 'get_pool.go'. Requires being in the 'damm-v2-go' directory. ```bash cd damm-v2-go && go mod tidy && go run examples/get_pool.go ``` -------------------------------- ### Install DBC SDK and Solana Dependencies (bun) Source: https://docs.meteora.ag/llms-full.txt Installs the Dynamic Bonding Curve SDK and essential Solana libraries using bun. Ensure you have Node.js and bun installed. ```bash bun add @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` -------------------------------- ### Install Presale Vault SDK with pnpm Source: https://docs.meteora.ag/developer-guides/presale-vault/typescript-sdk/getting-started Install the SDK and Solana web3.js using pnpm. ```bash pnpm install @meteora-ag/presale @solana/web3.js ``` -------------------------------- ### Install TypeScript SDK Dependencies Source: https://docs.meteora.ag/developer-guides/presale-vault Navigate to the presale-sdk directory and install its dependencies using pnpm. ```bash cd presale-sdk && pnpm install ``` -------------------------------- ### Install DLMM TypeScript SDK with npm Source: https://docs.meteora.ag/developer-guides/dlmm/typescript-sdk/getting-started Install the SDK and Solana web3.js using npm. ```bash npm install @meteora-ag/dlmm @solana/web3.js ``` -------------------------------- ### Install DBC SDK and Solana Dependencies Source: https://docs.meteora.ag/developer-guides/dbc/typescript-sdk/getting-started Install the SDK and its required Solana dependencies using your preferred package manager. ```bash npm install @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` ```bash pnpm install @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` ```bash yarn add @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` ```bash bun add @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` -------------------------------- ### Install, Build, and Test SDK Locally Source: https://docs.meteora.ag/developer-guides/alpha-vault/typescript-sdk/getting-started Use these commands to set up the local SDK package, build it, and run tests. Ensure you are in the correct directory before executing. ```bash cd alpha-vault-sdk/ts-client npm install npm run build npm test ``` -------------------------------- ### System Prompt for Docs MCP and SDK Guide Source: https://docs.meteora.ag/agents/overview Use this prompt starter to ask an agent to find a specific SDK guide using the Docs MCP and then outline an integration plan. ```text Use the Meteora Docs MCP to find the current DAMM v2 TypeScript SDK guide, then draft the smallest safe integration plan for adding liquidity. ``` -------------------------------- ### Get Virtual Price Response (JSON) Source: https://docs.meteora.ag/api-reference/dynamic-vault/virtual-price/get_virtual_price This is an example of a successful JSON response when fetching virtual price data. It includes the virtual price and the timestamp of the recording. ```json [ { "price": "1.05234", "timestamp": 1640995200 } ] ``` -------------------------------- ### Start Development Server Source: https://docs.meteora.ag/invent/scaffold/fun-launch Run the development server for the Fun Launch scaffold using pnpm. ```bash pnpm --filter @meteora-invent/scaffold/fun-launch dev ``` -------------------------------- ### Run dbc-go Examples Source: https://docs.meteora.ag/developer-guides/dbc/go-integration/reference Execute Go examples from the dbc-go SDK. Ensure that keypairs, RPC endpoints, and public keys are configured before running. ```bash go run examples/.go ``` -------------------------------- ### Quote and Build a `swap2` Transaction Source: https://docs.meteora.ag/developer-guides/dbc/typescript-sdk/reference This example shows how to first quote a swap transaction to get the minimum amount out, and then build the actual swap transaction using the quoted details. It supports exact-in swap mode. ```typescript const quote = client.pool.swapQuote2({ virtualPool, config, swapBaseForQuote: false, hasReferral: false, eligibleForFirstSwapWithMinFee: false, currentPoint, slippageBps, swapMode: SwapMode.ExactIn, amountIn, }); const tx = await client.pool.swap2({ owner, pool, swapBaseForQuote: false, amountIn, minimumAmountOut: quote.minimumAmountOut, swapMode: SwapMode.ExactIn, referralTokenAccount: null, }); ``` -------------------------------- ### Configure Environment Variables Source: https://docs.meteora.ag/llms-full.txt Copy the example environment file and populate it with your specific credentials and configuration details for Cloudflare R2, Solana RPC, and pool settings. ```bash cp scaffolds/fun-launch/.env.example scaffolds/fun-launch/.env ``` ```env # Cloudflare R2 Storage R2_ACCESS_KEY_ID=your_r2_access_key_id R2_SECRET_ACCESS_KEY=your_r2_secret_access_key R2_ACCOUNT_ID=your_r2_account_id R2_BUCKET=your_r2_bucket_name # Solana RPC URL RPC_URL=your_rpc_url # Pool Configuration POOL_CONFIG_KEY=your_pool_config_key ``` -------------------------------- ### Get OHLCV Data Source: https://docs.meteora.ag/api-reference/dlmm/pools/ohlcv Retrieves OHLCV candles for a specific pool. You can specify a start and end time, or let the API infer them based on the selected timeframe. If no time parameters are provided, a default range is used. ```APIDOC ## GET /pools/{address}/ohlcv ### Description Returns OHLCV candles for a single pool over a time range. **Notes** - If both `start_time` and `end_time` are provided, candles are returned in the range `[start_time, end_time]` - If only one of `start_time` or `end_time` is provided, the missing bound is inferred using the selected `timeframe` - If neither is provided, a default range is used based on `timeframe` ### Method GET ### Endpoint /pools/{address}/ohlcv ### Parameters #### Path Parameters - **address** (string) - Required - Base58-encoded pool address #### Query Parameters - **timeframe** (string) - Optional - Candle interval. Allowed values `5m` `30m` `1h` `2h` `4h` `12h` `24h`. If omitted, the API uses `24h`. - **start_time** (integer) - Optional - Unix timestamp in seconds (inclusive). If omitted, the API uses a default range based on `timeframe`. - **end_time** (integer) - Optional - Unix timestamp in seconds (inclusive). If omitted, the API uses "now" as the end. ### Response #### Success Response (200) - **start_time** (integer) - The start timestamp of the returned data. - **end_time** (integer) - The end timestamp of the returned data. - **timeframe** (string | null) - The timeframe of the candles returned. - **data** (array) - An array of OHLCV candle objects. - **timestamp** (integer) - The timestamp of the candle. - **timestamp_str** (string) - The string representation of the timestamp. - **open** (number) - The opening price for the candle. - **high** (number) - The highest price during the candle. - **low** (number) - The lowest price during the candle. - **close** (number) - The closing price for the candle. - **volume** (number) - The trading volume during the candle. #### Response Example { "start_time": 1678886400, "end_time": 1678972799, "timeframe": "24h", "data": [ { "timestamp": 1678886400, "timestamp_str": "2023-03-15T00:00:00.000Z", "open": 100.50, "high": 105.20, "low": 99.80, "close": 104.00, "volume": 1500.75 } ] } #### Error Response (400) - **message** (string) - Description of the error. ``` -------------------------------- ### Install and Test SDK Packages Source: https://docs.meteora.ag/developer-guides/dynamic-fee-sharing/typescript-sdk/getting-started Run these commands after cloning the SDK repository to install dependencies, build the project, and execute tests. ```bash pnpm install pnpm run build bun test ``` -------------------------------- ### Get APY by Time Range OpenAPI Specification Source: https://docs.meteora.ag/api-reference/dynamic-vault/apy/get_apy_by_time_range This OpenAPI 3.0.3 specification defines the `get /apy_filter/{token_mint}/{start_timestamp}/{end_timestamp}` endpoint. It details the required path parameters: `token_mint`, `start_timestamp`, and `end_timestamp`, along with their expected formats and example values. The response schema for a successful request (`200 OK`) and potential error responses (`400 Bad Request`) are also described. ```yaml openapi: 3.0.3 info: title: Vault Keeper API description: >- API for Vault Keeper - A DeFi vault management system that monitors and optimizes vault strategies across multiple protocols version: 0.6.0 contact: name: Vault Keeper API Support servers: - url: https://merv2-api.meteora.ag description: Dynamic Vault Mainnet API security: [] tags: - name: System description: System information and health endpoints - name: Vaults description: Vault state and information endpoints - name: APY description: Annual Percentage Yield calculations and historical data - name: Virtual Price description: Virtual price tracking for vault strategies paths: /apy_filter/{token_mint}/{start_timestamp}/{end_timestamp}: get: tags: - APY summary: get_apy_by_time_range description: >- Returns APY information for a specific token mint within a given time range operationId: getFilterApyByTimeRange parameters: - name: token_mint in: path required: true description: The token mint address (Solana public key) schema: type: string pattern: ^[1-9A-HJ-NP-Za-km-z]{32,44}$ example: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v - name: start_timestamp in: path required: true description: Start timestamp (Unix timestamp in seconds) schema: type: string pattern: ^[0-9]+$ example: '1640995200' - name: end_timestamp in: path required: true description: >- End timestamp (Unix timestamp in seconds). Must be greater than start_timestamp schema: type: string pattern: ^[0-9]+$ example: '1641081600' responses: '200': description: Filtered APY state information content: application/json: schema: $ref: '#/components/schemas/ApyState' '400': description: Bad request - invalid parameters or start timestamp >= end timestamp content: text/plain: schema: type: string example: 'Error: start timestamp cannot be smaller than end timestamp' components: schemas: ApyState: type: object description: APY state information for different time periods properties: closest_apy: type: array description: Most recent APY calculations for each strategy items: $ref: '#/components/schemas/ProtocolApy' average_apy: type: array description: Moving average APY calculations for each strategy items: $ref: '#/components/schemas/ProtocolApy' long_apy: type: array description: Long-term APY calculations for each strategy items: $ref: '#/components/schemas/ProtocolApy' required: - closest_apy - average_apy - long_apy ProtocolApy: type: object description: APY information for a specific protocol strategy properties: strategy_name: type: string description: Human-readable strategy name example: Solend USDC Main Pool strategy: type: string description: Strategy address example: 9WzDXwBbmkg8ZTbNMqUxvQRAyrZzDsGYdLVL9zYtAWWM apy: type: number format: double description: APY percentage (e.g., 5.0 for 5%) example: 5 required: - strategy_name - strategy - apy ``` -------------------------------- ### Get Historical Volume for a Pool Source: https://docs.meteora.ag/api-reference/damm-v2/pools/historical-volume Retrieve historical volume data for a given pool address. You can specify a time range using start and end times, or rely on the timeframe parameter for default ranges. The API aggregates data into time buckets. ```yaml openapi: 3.1.0 info: title: DAMM V2 API description: '' license: name: '' version: 0.1.0 servers: - url: https://damm-v2.datapi.meteora.ag description: DAMM v2 Mainnet API - url: https://damm-v2-api.dev.metdev.io description: DAMM v2 Development API security: [] paths: /pools/{address}/volume/history: get: tags: - Pools summary: Historical Volume description: >- Returns historical volume for a pool aggregated into time buckets **Notes** - If both `start_time` and `end_time` are provided, the result covers the range `[start_time, end_time]` - If only one of `start_time` or `end_time` is provided, the missing bound is inferred using the selected `timeframe` - If neither is provided, a default range is used based on `timeframe` operationId: Get Historical Volume parameters: - name: address in: path description: Base58-encoded pool address required: true schema: type: string example: 8X5yDboAEtV1SeoZoG3issAc9zB6qGSe5ZCtJyUz2S5W - name: timeframe in: query description: |- Timeframe Allowed values `5m` `30m` `1h` `2h` `4h` `12h` `24h` If omitted, the API uses `24h` required: false schema: oneOf: - type: 'null' - $ref: '#/components/schemas/TimeFrame' default: 24h - name: start_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses a default range based on `timeframe` required: false schema: type: integer minimum: 0 - name: end_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses "now" as the end required: false schema: type: integer minimum: 0 responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/TimeseriesResponse_VolumeHistoryResponse' '400': description: '' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: schemas: TimeFrame: type: string enum: - 5m - 30m - 1h - 2h - 4h - 12h - 24h TimeseriesResponse_VolumeHistoryResponse: type: object required: - start_time - end_time - data properties: data: type: array items: type: object required: - timestamp - timestamp_str - volume - fees - protocol_fees properties: fees: type: number format: double protocol_fees: type: number format: double timestamp: type: integer format: int64 minimum: 0 timestamp_str: type: string volume: type: number format: double end_time: type: integer format: int64 minimum: 0 start_time: type: integer format: int64 minimum: 0 timeframe: type: - string - 'null' ErrorResponse: type: object required: - message properties: message: type: string ``` -------------------------------- ### Get Pool Historical Volume - OpenAPI Specification Source: https://docs.meteora.ag/api-reference/dlmm/pools/historical-volume This OpenAPI specification defines the endpoint for fetching historical volume data for a DLMM pool. It includes details on request parameters such as pool address, timeframe, start time, and end time, as well as the structure of the response. ```yaml openapi: 3.1.0 info: title: DLMM API description: >- Indexed DLMM data for pools, portfolios, positions, limit orders, wallets, and protocol stats. license: name: '' version: 0.1.0 servers: - url: https://dlmm.datapi.meteora.ag description: Production - url: https://dlmm.dev.metdev.io description: Development security: [] paths: /pools/{address}/volume/history: get: tags: - Pools summary: Historical Volume description: >- Returns historical volume for a pool aggregated into time buckets **Notes** - If both `start_time` and `end_time` are provided, the result covers the range `[start_time, end_time]` - If only one of `start_time` or `end_time` is provided, the missing bound is inferred using the selected `timeframe` - If neither is provided, a default range is used based on `timeframe` operationId: Get Historical Volume parameters: - name: address in: path description: Base58-encoded pool address required: true schema: type: string example: 5hbf9JP8k5zdrZp9pokPypFQoBse5mGCmW6nqodurGcd - name: timeframe in: query description: |- Timeframe Allowed values `5m` `30m` `1h` `2h` `4h` `12h` `24h` If omitted, the API uses `24h` required: false schema: oneOf: - type: 'null' - $ref: '#/components/schemas/TimeFrame' default: 24h - name: start_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses a default range based on `timeframe` required: false schema: type: integer minimum: 0 - name: end_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses "now" as the end required: false schema: type: integer minimum: 0 responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/TimeseriesResponse_VolumeHistoryResponse' '400': description: '' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: schemas: TimeFrame: type: string enum: - 5m - 30m - 1h - 2h - 4h - 12h - 24h TimeseriesResponse_VolumeHistoryResponse: type: object required: - start_time - end_time - data properties: data: type: array items: type: object required: - timestamp - timestamp_str - volume - fees - protocol_fees properties: fees: type: number format: double protocol_fees: type: number format: double timestamp: type: integer format: int64 minimum: 0 timestamp_str: type: string volume: type: number format: double end_time: type: integer format: int64 minimum: 0 start_time: type: integer format: int64 minimum: 0 timeframe: type: - string - 'null' ErrorResponse: type: object required: - message properties: message: type: string ``` -------------------------------- ### Build the Project Source: https://docs.meteora.ag/invent/scaffold/fun-launch Build the Fun Launch project for production deployment using pnpm. ```bash pnpm --filter @meteora-invent/scaffold/fun-launch build ``` -------------------------------- ### OHLCV Endpoint Definition Source: https://docs.meteora.ag/api-reference/damm-v2/pools/ohlcv This OpenAPI 3.1.0 definition specifies the GET request for the /pools/{address}/ohlcv endpoint. It includes parameters for pool address, timeframe, start time, and end time, along with response schemas for successful data retrieval and error handling. ```yaml openapi: 3.1.0 info: title: DAMM V2 API description: '' license: name: '' version: 0.1.0 servers: - url: https://damm-v2.datapi.meteora.ag description: DAMM v2 Mainnet API - url: https://damm-v2-api.dev.metdev.io description: DAMM v2 Development API security: [] paths: /pools/{address}/ohlcv: get: tags: - Pools summary: OHLCV description: >- Returns OHLCV candles for a single pool over a time range **Notes** - If both `start_time` and `end_time` are provided, candles are returned in the range `[start_time, end_time]` - If only one of `start_time` or `end_time` is provided, the missing bound is inferred using the selected `timeframe` - If neither is provided, a default range is used based on `timeframe` operationId: Get OHLCV parameters: - name: address in: path description: Base58-encoded pool address required: true schema: type: string example: 8X5yDboAEtV1SeoZoG3issAc9zB6qGSe5ZCtJyUz2S5W - name: timeframe in: query description: |- Candle interval Allowed values `5m` `30m` `1h` `2h` `4h` `12h` `24h` If omitted, the API uses `24h` required: false schema: type: string default: 24h - name: start_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses a default range based on `timeframe` required: false schema: type: integer minimum: 0 - name: end_time in: query description: |- Unix timestamp in seconds (inclusive) If omitted, the API uses "now" as the end required: false schema: type: integer minimum: 0 responses: '200': description: '' content: application/json: schema: $ref: '#/components/schemas/TimeseriesResponse_OHLCVResponse' '400': description: '' content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' components: schemas: TimeseriesResponse_OHLCVResponse: type: object required: - start_time - end_time - data properties: data: type: array items: type: object required: - timestamp - timestamp_str - open - high - low - close - volume properties: close: type: number format: double high: type: number format: double low: type: number format: double open: type: number format: double timestamp: type: integer format: int64 minimum: 0 timestamp_str: type: string volume: type: number format: double end_time: type: integer format: int64 minimum: 0 start_time: type: integer format: int64 minimum: 0 timeframe: type: - string - 'null' ErrorResponse: type: object required: - message properties: message: type: string ``` -------------------------------- ### Install pnpm Source: https://docs.meteora.ag/invent/actions Install pnpm globally if it is not already installed. This is a prerequisite for using Meteora Invent. ```bash npm install -g pnpm ``` -------------------------------- ### Install Vault SDK with npm Source: https://docs.meteora.ag/developer-guides/dynamic-vault/typescript-sdk/getting-started Install the @meteora-ag/vault-sdk along with its dependencies using npm. This command installs the SDK and necessary Solana and Anchor packages. ```bash npm install @meteora-ag/vault-sdk @coral-xyz/anchor @solana/web3.js@1 @solana/spl-token bn.js ``` -------------------------------- ### Install DBC SDK and Solana Dependencies Source: https://docs.meteora.ag/llms-full.txt Installs the Dynamic Bonding Curve SDK and essential Solana libraries using npm. Ensure you have Node.js and npm installed. ```bash npm install @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` -------------------------------- ### Run a DAMM v2 Go Example Source: https://docs.meteora.ag/developer-guides/damm-v2/go-integration/reference Execute a Go example script after setting the RPC endpoint and addresses, and uncommenting the local `main()` function if necessary. ```bash go run examples/get_pool.go ``` -------------------------------- ### Install DAMM v1 SDK Source: https://docs.meteora.ag/developer-guides/damm-v1/typescript-sdk/getting-started Install the SDK with Solana Web3 and bn.js. The package uses bn.js amounts for token units. ```bash npm install @meteora-ag/dynamic-amm-sdk @solana/web3.js bn.js ``` ```bash pnpm install @meteora-ag/dynamic-amm-sdk @solana/web3.js bn.js ``` ```bash yarn add @meteora-ag/dynamic-amm-sdk @solana/web3.js bn.js ``` -------------------------------- ### Install DBC SDK and Solana Dependencies (yarn) Source: https://docs.meteora.ag/llms-full.txt Installs the Dynamic Bonding Curve SDK and essential Solana libraries using yarn. Ensure you have Node.js and yarn installed. ```bash yarn add @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ``` -------------------------------- ### Install DBC SDK and Solana Dependencies (pnpm) Source: https://docs.meteora.ag/llms-full.txt Installs the Dynamic Bonding Curve SDK and essential Solana libraries using pnpm. Ensure you have Node.js and pnpm installed. ```bash pnpm install @meteora-ag/dynamic-bonding-curve-sdk @solana/web3.js @solana/spl-token bn.js ```