Meteora 백서

Meteora

원문

bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 40쪽

erview"> Returns aggregated protocol-level metrics across all pools using `GET` `/stats/protocol_metrics` </Card> </CardGroup> ## Limit Orders <CardGroup> <Card title="Open Limit Order Pools" icon="file-code" href="/api-reference/dlmm/limit-orders/get-open-limit-order-pools"> Returns open limit order pools for a wallet using `GET` `/wallets/{wallet}/limit_orders/open/pools` </Card> <Card title="Open Limit Orders For Pool" icon="file-code" href="/api-reference/dlmm/limit-orders/get-open-limit-orders-for-pool"> Returns open limit orders for a wallet and pool using `GET` `/wallets/{wallet}/limit_orders/open/pools/{pool_address}` </Card> <Card title="Closed Limit Order Pools" icon="file-code" href="/api-reference/dlmm/limit-orders/get-closed-limit-order-pools"> Returns closed limit order pools for a wallet using `GET` `/wallets/{wallet}/limit_orders/closed/pools` </Card> <Card title="Closed Limit Orders For Pool" icon="file-code" href="/api-reference/dlmm/limit-orders/get-closed-limit-orders-for-pool"> Returns closed limit orders for a wallet and pool using `GET` `/wallets/{wallet}/limit_orders/closed/pools/{pool_address}` </Card> <Card title="Limit Order Summary" icon="file-code" href="/api-reference/dlmm/limit-orders/get-limit-order-summary"> Returns wallet limit order summary using `GET` `/wallets/{wallet}/limit_orders/summary` </Card> <Card title="Bonus Claimed For Pool" icon="file-code" href="/api-reference/dlmm/limit-orders/get-bonus-claimed-for-pool"> Returns bonus claimed data using `GET` `/wallets/{wallet}/limit_orders/pools/{pool_address}/bonus_claimed` </Card> </CardGroup> ## Wallets <CardGroup> <Card title="Wallet Pool Total Claims" icon="file-code" href="/api-reference/dlmm/wallets/get-wallet-pool-total-claims"> Returns accumulated fee/reward claims for a wallet and pool using `GET` `/wallets/{wallet}/pools/{pool_address}/total_claims` </Card> </CardGroup> ## Query Syntax List endpoints use common query parameters: | Parameter | Use | | - | - | | `page` | 1-based page number. | | `page_size` | Page size. Pool lists support up to `1000`; group lists support up to `100`. | | `query` | Search by name, tokens, or address. | | `sort_by` | Format: `<field>:<direction>` or `<metric>_<window>:<direction>`. | | `filter_by` | Format: `<field><op><value> [&& <field><op><value> ...]`. | Supported time windows include `5m`, `30m`, `1h`, `2h`, `4h`, `12h`, and `24h`. # DLMM Changelog Source: https://docs.meteora.ag/developer-guides/dlmm/changelog Track DLMM release notes, breaking changes, and upgrade guidance for lb_clmm, SDKs, commons, and CLI tooling. <Tip> Track DLMM releases here. </Tip> <Update label="lb_clmm 0.12.0" description="Limit Orders and Quote Token Fee"> <Info> Mainnet deployment for Release 0.12.0 is planned for May 21, 2026, at 11:00 AM UTC+8 (Wednesday). </Info> <Warning> **Breaking release.** If you build swap instructions manually, run DLMM swap quotes, or index certain DLMM events, please plan an upgrade before mainnet deployment. </Warning> ## Release summary | Component | Version | PR | | - | - | - | | Program | `0.12.0` | — | | TypeScript SDK | `1.9.8` | [dlmm-sdk #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) | | CLI | `0.6.3` | [dlmm-sdk #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) | | Commons | `0.3.3` | [dlmm-sdk #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) | ## What We Shipped * Limit Orders * Quote Token Fee ## What To Do <div> <table> <thead> <tr> <th>Integrators</th> <th>What Changed</th> <th>What To Do</th> </tr> </thead> <tbody> <tr> <td><strong>Swap Routers</strong></td> <td> <ul> <li>Swap quote computation</li> <li><code>swap</code> and <code>swap2</code> bitmap extension mutability</li> <li>Remaining-accounts layout changed</li> </ul> </td> <td> <ul> <li>If you are using the Typescript SDK, upgrade to <code>@meteora-ag/dlmm\@1.9.5-rc.4</code> to test.</li> <li>If you are using Rust, update your quote logic based on the new quote math in <code>commons\@0.3.3</code></li> <li>Mark bitmap extension <strong>writable</strong> on <code>swap</code> / <code>swap2</code></li> <li>If you are using <code>host\_fee\_in</code> account that is Token-2022 mint with Transfer Hook, add <code>TransferHookReferral</code> and any transfer-hook accounts</li> </ul> </td> </tr> <tr> <td><strong>Trading Terminals</strong></td> <td> <ul> <li><code>FeeParameterUpdate</code> event parsing</li> <li><code>Swap2Evt</code> event parsing</li> </ul> </td> <td> <ul> <li>Update your event parsing logic to decode the updated events</li> </ul> </td> </tr> <tr> <td><strong>Partners</strong></td> <td> <ul> <li>New limit order functions</li> <li>Breaking changes to <code>createCustomizablePermissionlessLbPair</code> and <code>getPairPubkeyIfExists</code></li> <li>Swap quote computation</li> </ul> </td> <td> <ul> <li>Bump your SDK version to <code>@meteora-ag/dlmm\@1.9.5-rc.4</code> to start testing.</li> </ul> </td> </tr> </tbody> </table> </div> ## Program: `lb_clmm` `0.12.0` Program ID (mainnet and devnet): `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` ### Added * New endpoint `add_liquidity_by_weight2`, that is same as `add_liquidity_by_weight` but supports token2022 * New endpoint `set_permissionless_operation_bits` to allow position owner to enable permissionless authorization on some operations such as `claim_fee` * New endpoint `place_limit_order` to allow user to place limit orders for either bid or ask side. * New endpoint `cancel_limit_order` to cancel limit order. * New endpoint `close_limit_order_if_empty` to close a limit order if it's empty. * New endpoint `close_bin_array` to close an invalid bin array. * Account `PresetParameter` added new `collect_fee_mode` field. All the existing `PresetParameter` account will have default `CollectFeeMode::OnlyInput`. * Account `LbPair::StaticParameters` added new `collect_fee_mode` field. All existing LbPair account will have default `CollectFeeMode::OnlyInput`. ### Changed * Allow permissionless claim\_fee if position owner enabled it * All the existing `LbPair` accounts without any liquidity mining rewards will be defaulted to limit order supported pool and doesn't support LM anymore. This is not revert-able. * Updated `initialize_permissioned_lb_pair` parameter `InitPermissionPairIx` field `protocol_share` to `padding0` because it was no longer in use * Endpoint `go_to_a_bin` will revert if the pool is disabled / before activation. The restriction can be bypassed by operator by passing operator associated accounts through remaining accounts. ### Removed * Remove endpoint `reset_pool_tombstone_fields`, `reset_bin_array_tombstone_fields`, `reset_position_tombstone_fields` ### Breaking Changes * Endpoint `initialize_preset_parameter` added new `collect_fee_mode` field. * Endpoint `initialize_preset_parameter` field function\_type enum type has been changed to concrete\_function\_type. * Enum `FunctionType` no longer defaulted to `FunctionType::LiquidityMining`. All existing on chain `LbPair` account will defaulted to `FunctionType::Undetermined`. With `FunctionType::Undetermined`, if there's liquidity reward initialized, it will be `FunctionType::LiquidityMining`, else will be `FunctionType::LimitOrder` * Swap quote mechanism due to introducing of collect fee mode on in/out side, and limit order mechanism. Affected endpoints are `swap`, `swap_exact_out`, `swap_with_price_impact`, `swap2`, `swap_exact_out2` and `swap_with_price_impact2`. * Due to new limit order logic (consuming more CU), max bins to swap in 1 instruction changes from 280 bins to 260 bins * Endpoint `swap` and `swap2` bitmap extension account will be `mutable` due to limit order logic require flipping of liquidity tracking bits. * Event `FeeParameterUpdate` added new field `base_fee_power_factor` * `AccountsType` enum variants introduces `TransferHookReferral`. Clients building `swap2`, `swap_exact_out2` and `swap_with_price_impact2` instructions must update their `RemainingAccountsInfo` slices to include `AccountsType::TransferHookReferral` when the swap has `host_fee_in` account. Additionally, any required transfer hook accounts for the referral mint must also be provided in the instruction. ```rust theme={"system"} pub enum ConcreteFunctionType { LimitOrder = 0, LiquidityMining = 1, } pub enum CollectFeeMode { InputOnly = 0, OnlyY = 1, } ``` ## TypeScript SDK: `@meteora-ag/dlmm` `1.9.8` [SDK PR #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) <Tip> Early testing: [`@meteora-ag/dlmm@1.9.5-rc.4`](https://www.npmjs.com/package/@meteora-ag/dlmm/v/1.9.5-rc.4).<br /> Production: [`@meteora-ag/dlmm@1.9.8`](https://www.npmjs.com/package/@meteora-ag/dlmm/v/1.9.8). </Tip> ### Added * Added function `placeLimitOrder` to place a new limit order. Only applicable for pair with function type of LimitOrder. * Added function `cancelLimitOrder` to cancel an existing limit order. * Added function `closeLimitOrderIfEmpty` to close a limit order if it's empty. * Added function `enablePositionPermissionlessClaimFee`. This allow non position owner to invoke claim fee instruction for other's position. * Added function `getLimitOrderByUserAndLbPair` to get all limit orders of a user for a given pair. * Added function `getLimitOrder` to get limit order data by limit order pubkey. * Added function `addLiquidityByWeight2` which support token 2022 add liquidity by weight. * Added function `quoteCreateLimitOrder` which returns the cost for creating a Limit Order ### Breaking Changes * Added `concreteFunctionType`, `collectFeeMode` parameters in `createCustomizablePermissionlessLbPair` function. This allow user to create pair with function of LimitOrder or LiquidityMining and collect fee in InputToken, or TokenY (single sided fee). * Added `concreteFunctionType`, `collectFeeMode` parameters in `getPairPubkeyIfExists` function. This allow user to query existing pair with addition filter of function type and collect fee mode. ### Removed * `Position` type (v1) removed, there's no more v1 position on chain anymore. * `updateBinArray` function removed since it's not used anywhere. ### Changes * Update logic of `swapQuote` and `swapQuoteExactOut` to limit order and collect fee mode. * `swapExactOutQuoteAtBin` function's 'amountIn\` now include fee. ## CLI: `0.6.3` [CLI PR #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) ### Added * Added `place_limit_order` command to place limit orders * Added `cancel_limit_order` command to cancel existing limit orders * Added `close_limit_order_if_empty` command to close empty limit order account * Added `get_limit_orders` command to query limit orders for a user on a specific pair * Added `set_permissionless_operation_bits` command to set operation bits on a position ## Commons: `0.3.3` [Commons PR #273](https://github.com/MeteoraAg/dlmm-sdk/pull/273) ### Added * Added `DynamicPosition` in `dynamic_position.rs` to support parsing on position account * Added `LimitOrder` in `limit_order.rs` to support parsing on limit order account ### Changed * `quote_exact_in()` and `quote_exact_out()` now support limit order liquidity </Update> # DLMM Developer Guide Source: https://docs.meteora.ag/developer-guides/dlmm/index Learn how to build DLMM integrations with the lb_clmm program, TypeScript SDK, Rust guides, Data API, commands, and release notes. DLMM is Meteora's high-performance concentrated liquidity product on Solana. To learn more about DLMM such as LP strategy concepts, and economic explanations, you can read the following documentations. <CardGroup> <Card title="Learn more about DLMM" icon="book-open" href="/core-products/dlmm/what-is-dlmm"> Overview of DLMM, strategies, dynamic positions, limit orders, rewards, and fee concepts. </Card> <Card title="DLMM Formulas" icon="calculator" href="/core-products/dlmm/formulas"> Formulas and definitions for price, liquidity, fee, and impermanent loss concepts. </Card> </CardGroup> ## Integration <CardGroup> <Card title="Program Accounts" icon="table-cells" href="/developer-guides/dlmm/program/accounts"> Account model for pools, bin arrays, positions, limit orders, oracles, presets, and operators. </Card> <Card title="Program Instructions" icon="list" href="/developer-guides/dlmm/program/instructions"> Instruction families for pool creation, liquidity, swaps, rewards, limit orders, and admin flows. </Card> <Card title="Program Events" icon="list" href="/developer-guides/dlmm/program/events"> Event-CPI payloads for pools, positions, liquidity, swaps, fees, rewards, rebalance, and limit order flows. </Card> <Card title="Program Errors" icon="triangle-exclamation" href="/developer-guides/dlmm/program/errors"> Anchor custom error codes, enum names, messages, and instruction error mapping. </Card> <Card title="TypeScript SDK" icon="code" href="/developer-guides/dlmm/typescript-sdk/getting-started"> TypeScript SDK for interacting with all instructions on DLMM. </Card> <Card title="Rust Integration" icon="terminal" href="/developer-guides/dlmm/rust-integration/library"> Rust integration with DLMM through CPI and the commons library. </Card> </CardGroup> <CardGroup> <Card title="DLMM APIs" icon="database" href="/developer-guides/dlmm/api-reference/overview"> Indexed read-only pool, portfolio, wallet, position, OHLCV, stats, and limit order data. </Card> </CardGroup> ## Program IDs The `lb_clmm` program ID is the same on mainnet and devnet: | Network | Program ID | | - | - | | Mainnet Beta | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` | | Devnet | `LBUZKhRxPF3XUpBCjp4YzTKgLccjZhTSDM9YuVaPwxo` | <CardGroup> <Card title="DLMM IDL" icon="file-code" href="https://github.com/MeteoraAg/dlmm-sdk/blob/main/idls/dlmm.json"> Anchor IDL for the deployed `lb_clmm` program. </Card> <Card title="DLMM SDK" icon="github" href="https://github.com/MeteoraAg/dlmm-sdk"> SDK for interacting with all instructions on DLMM. </Card> </CardGroup> <Note> The `lb_clmm` on-chain program source is not open sourced. Public developer integration should rely on the published IDL, the official TypeScript SDK, on-chain account data, and the DLMM Data API. If you have any questions, please reach out to us on [Discord](https://discord.gg/meteora). </Note> ## Commands | Task | Command | | - | - | | Build SDK | `cd ts-client && pnpm install && pnpm run build` | | Run SDK unit tests | `cd ts-client && pnpm run unit-test` | | Run commons quote tests | `cargo t -p commons --test '*'` | | Inspect CLI commands | `cargo build && target/debug/cli --help` | Some end-to-end SDK tests may depend on local validator fixtures or program builds that are not part of the public `lb_clmm` source release. Prefer devnet scripts and transaction simulation for public integration testing. ## Stay Updated <CardGroup> <Card title="DLMM Changelog" icon="newspaper" href="/developer-guides/dlmm/changelog"> Program, SDK, CLI, and commons changes for integration planning. </Card> </CardGroup> # DLMM Program Accounts Source: https://docs.meteora.ag/developer-guides/dlmm/program/accounts Understand DLMM lb_clmm accounts, including pools, bin arrays, positions, limit orders, oracles, presets, and PDA seeds. <Note> This page summarizes the account model used by `lb_clmm`. For exact layouts, use the IDL and generated TypeScript types exported by `@meteora-ag/dlmm`. </Note> ## PDA Map Pool and reserve PDAs sort the two mint public keys lexicographically. | Account | SDK helper | Seeds | | - | - | - | | Permissionless `LbPair` (v1) | `deriveLbPair` | sorted mints, `bin_step` | | Permissionless `LbPair` (v2) | `deriveLbPair2` | sorted mints, `bin_step`, `base_factor` | | `LbPair` from `PresetParameter2` | `deriveLbPairWithPresetParamWithIndexKey` | `preset_parameter` pubkey, sorted mints | | Customizable permissionless `LbPair` | `deriveCustomizablePermissionlessLbPair` | `ILM_BASE`, sorted mints | | Permission `LbPair` | `derivePermissionLbPair` | `base_key`, sorted mints, `bin_step` | | Reserve vault | `deriveReserve` | `lb_pair`, mint | | `BinArray` | `deriveBinArray` | `bin_array`, `lb_pair`, bin array index | | `BinArrayBitmapExtension` | `deriveBinArrayBitmapExtension` | `bitmap`, `lb_pair` | | `Oracle` | `deriveOracle` | `oracle`, `lb_pair` | | `Position` / `PositionV2` | `derivePosition` | `position`, `lb_pair`, base pubkey, `lower_bin_id`, `width` | | Reward vault | `deriveRewardVault` | `lb_pair`, reward index | | `PresetParameter` (legacy) | `derivePresetParameter` | `preset_parameter`, `bin_step` | | `PresetParameter2` | `derivePresetParameterWithIndex` | `preset_parameter2`, index | | `TokenBadge` | `deriveTokenBadge` | `token_badge`, mint | ## Constants | Constant | Value | Use | | - | - | - | | `MAX_BIN_PER_ARRAY` | 70 | Bins per `BinArray` | | `DEFAULT_BIN_PER_POSITION` | 70 | Bins stored inline in `PositionV2` before extension | | `MAX_BIN_PER_LIMIT_ORDER` | 50 | Max bins per limit order account | | `BIN_ARRAY_BITMAP_SIZE` | 512 | Default bitmap covers bin array indexes −512…511 | | `DEFAULT_OBSERVATION_LENGTH` | 100 | Default oracle sample capacity | | `NUM_REWARDS` | 2 | Reward slots per pool and position | Bin array index for a bin ID: `floor(bin_id / 70)`, with extra adjustment for negative remainders. Each bin array covers 70 consecutive bin IDs. ## LbPair `LbPair` is the root pool account. ### Fee parameters | Field | Type | Meaning | | - | - | - | | `parameters` | `StaticParameters` | Base fee, dynamic fee config, bin ID bounds, protocol share, function type, collect fee mode | | `v_parameters` | `VariableParameters` | Runtime volatility accumulator, reference bin, last update timestamp | | `protocol_fee` | `ProtocolFee` | Uncollected protocol fees (`amount_x`, `amount_y`) | | `last_updated_at` | | Last fee-parameter update (rate-limited) | `StaticParameters` fields: | Field | Meaning | | - | - | | `base_factor`, `base_fee_power_factor`, `bin_step` | Base fee rate = `base_factor × bin_step × 10 × 10^base_fee_power_factor` (1e9 units) | | `filter_period`, `decay_period`, `reduction_factor` | Dynamic fee time windows and decay | | `variable_fee_control`, `max_volatility_accumulator` | Variable fee scaling and cap | | `min_bin_id`, `max_bin_id` | Supported bin ID range for this pool | | `protocol_share` | Protocol portion of swap fees (basis points) | | `function_type` | `0` undetermined, `1` liquidity mining, `2` limit order | | `collect_fee_mode` | `0` input only, `1` only token Y | `VariableParameters` tracks `volatility_accumulator`, `volatility_reference`, `index_reference`, and `last_update_timestamp` for dynamic fees. ### Pool identity and reserves | Field | Meaning | | - | - | | `token_x_mint`, `token_y_mint` | Pool token mints | | `reserve_x`, `reserve_y` | Program-controlled vault token accounts | | `active_id` | Current active bin ID (price bin) | | `bin_step` | Price increment per bin (basis-point style spacing) | | `bump_seed`, `bin_step_seed`, `base_factor_seed` | PDA derivation seeds stored on-chain | | `require_base_factor_seed` | Whether `base_factor` is included in permissionless pool seeds | ### Status, type, and activation | Field | Meaning | | - | - | | `pair_type` | `0` permissionless, `1` permission, `2` customizable permissionless, `3` permissionless v2 (Token-2022) | | `status` | `0` enabled, `1` disabled (withdraw-only except whitelisted wallets) | | `activation_type` | Slot or timestamp activation unit for permission pools | | `activation_point` | Time point when a permission pool enables trading | | `pre_activation_duration` | Window before activation for pre-activation swap address | | `pre_activation_swap_address` | Wallet allowed to swap before activation | | `creator` | Pool creator | | `creator_pool_on_off_control` | Creator can toggle
프로젝트로 돌아가기