bitpro가 원문에서 글자만 모은 내용이에요. 표·그림·수식은 빠지거나 깨질 수 있어요. 전체 75쪽 중 39쪽
onfig`, `MigratedPoolMarketCapFeeSchedulerParams`, `LiquidityDistributionConfig`, `LockedVestingParams`. |
| Curve builder params | `BuildCurveBaseParams`, `BuildCurveParams`, `BuildCurveWithMarketCapParams`, `BuildCurveWithTwoSegmentsParams`, `BuildCurveWithMidPriceParams`, `BuildCurveWithLiquidityWeightsParams`, `BuildCurveWithCustomSqrtPricesParams`. |
| Pool and swap params | `CreatePoolParams`, `CreatePoolWithTransferHookParams`, `CreateConfigAndPoolParams`, `CreateConfigAndPoolWithFirstBuyParams`, `CreateConfigAndPoolWithTransferHookParams`, `CreateConfigAndPoolWithFirstBuyWithTransferHookParams`, `CreatePoolWithFirstBuyParams`, `CreatePoolWithFirstBuyWithTransferHookParams`, `CreatePoolWithPartnerAndCreatorFirstBuyParams`, `CreatePoolWithPartnerAndCreatorFirstBuyWithTransferHookParams`, `FirstBuyWithTransferHookParams`, `PartnerFirstBuyWithTransferHookParams`, `CreatorFirstBuyWithTransferHookParams`, `SwapParams`, `Swap2Params`, `SwapQuoteParams`, `SwapQuote2Params`. |
| Migration params | `MigrateToDammV1Params`, `MigrateToDammV2Params`, `MigrateToDammV2Response`, `DammLpTokenParams`, `CreateLockerParams`, `CreateDammV1MigrationMetadataParams`. |
| Claim and withdraw params | `ClaimPartnerTradingFeeParams`, `ClaimPartnerTradingFeeToReceiverParams`, `ClaimCreatorTradingFeeParams`, `ClaimCreatorTradingFeeToReceiverParams`, `PartnerWithdrawSurplusParams`, `CreatorWithdrawSurplusParams`, `WithdrawMigrationFeeParams`, `ClaimPartnerPoolCreationFeeParams`. |
| Quote and fee results | `SwapResult`, `SwapResult2`, `SwapQuoteResult`, `SwapQuote2Result`, `VolatilityTracker`, `MigratedPoolFee`. |
## Config Creation Types
`client.partner.createConfig` accepts `CreateConfigParams`. The type combines the accounts required by the `create_config` instruction with the SDK's computed `ConfigParameters`.
`client.partner.createConfigWithTransferHook` accepts `CreateConfigWithTransferHookParams`, which adds `transferHookProgram`.
| Account field | Type | Use |
| - | - | - |
| `config` | `PublicKey` | Config account address to initialize. |
| `feeClaimer` | `PublicKey` | Partner authority that can claim partner fees. |
| `leftoverReceiver` | `PublicKey` | Receiver for leftover base tokens after migration. |
| `quoteMint` | `PublicKey` | Quote token mint used by pools created from the config. |
| `payer` | `PublicKey` | Transaction fee payer and account initializer. |
| `tokenBadge` | optional `PublicKey` | Token badge PDA required when the quote mint is not permissionless-supported. |
| `transferHookProgram` | `PublicKey` | Transfer-hook program for `createConfigWithTransferHook`; it must be executable and cannot be DBC, SPL Token, Token 2022, or the default pubkey. |
`ConfigParameters` is usually produced by one of the curve builders. Pass the returned object directly into `createConfig`, `createConfigWithTransferHook`, `createConfigAndPool`, or `createConfigAndPoolWithFirstBuy`.
| Field | Meaning |
| - | - |
| `poolFees` | Base-fee and optional dynamic-fee parameters for DBC swaps. |
| `collectFeeMode` | Whether trading fees are collected in quote token or output token. |
| `migrationOption` | Destination AMM family. New configs must use `MET_DAMM_V2`. `MET_DAMM` is rejected. |
| `activationType` | Activation point unit, either slot or timestamp. |
| `tokenType` | SPL Token or Token-2022 base mint handling. |
| `tokenDecimal` | Base token decimal enum encoded into the config. |
| `partnerLiquidityPercentage`, `creatorLiquidityPercentage` | Migrated-pool liquidity share for partner and creator. |
| `partnerPermanentLockedLiquidityPercentage`, `creatorPermanentLockedLiquidityPercentage` | Migrated-pool liquidity share permanently locked for each party. |
| `migrationQuoteThreshold` | Quote amount threshold that completes the bonding curve. |
| `sqrtStartPrice` | Initial square-root price for the virtual curve. |
| `lockedVesting` | Locked base-token vesting schedule after migration. |
| `migrationFeeOption`, `migrationFee` | Fixed or customizable migration fee settings. |
| `tokenSupply` | Total base-token supply for the launch. |
| `creatorTradingFeePercentage` | Creator share of trading fees. |
| `tokenAuthorityOption` | Base mint update-authority and mint-authority behavior. Mint-authority options are only valid for transfer-hook configs. |
| `migratedPoolFee` | Fee settings applied to the migrated DAMM pool. |
| `poolCreationFee` | Pool creation fee in lamports. |
| `partnerLiquidityVestingInfo`, `creatorLiquidityVestingInfo` | Optional vesting schedule for migrated liquidity shares. |
| `migratedPoolBaseFeeMode` | Optional DAMM v2 base-fee mode for graduated pools. |
| `migratedPoolMarketCapFeeSchedulerParams` | Optional market-cap fee scheduler for DAMM v2 migration. Current helper inputs use `priceMultiple`. |
| `enableFirstSwapWithMinFee` | Allows the first eligible swap to use the configured minimum-fee path. |
| `compoundingFeeBps` | DAMM v2 compounding fee bps when migrated collect-fee mode is compounding. |
| `curve` | Up to `MAX_CURVE_POINT` curve checkpoints. |
## Builder Input Groups
All curve builders share `BuildCurveBaseParams`, then add builder-specific target fields.
| Group | Fields |
| - | - |
| `token` | `tokenType`, `tokenBaseDecimal`, `tokenQuoteDecimal`, `tokenAuthorityOption`, `totalTokenSupply`, `leftover`. |
| `fee` | `baseFeeParams`, `dynamicFeeEnabled`, `collectFeeMode`, `creatorTradingFeePercentage`, `poolCreationFee`, `enableFirstSwapWithMinFee`. |
| `migration` | `migrationOption`, `migrationFeeOption`, `migrationFee`, optional `migratedPoolFee`. |
| `liquidityDistribution` | Partner and creator migrated-liquidity percentages, permanent-lock percentages, and optional vesting info for each side. |
| `lockedVesting` | `totalLockedVestingAmount`, `numberOfVestingPeriod`, `cliffUnlockAmount`, `totalVestingDuration`, `cliffDurationFromMigrationTime`. |
| `activationType` | Slot-based or timestamp-based activation. |
| Nested type | Key fields | Notes |
| - | - | - |
| `BaseFeeParams` | Fee scheduler params | Use `getFeeSchedulerParams` for linear or exponential fee decay. `createConfig`, `createPool`, and `buildCurve*` reject `BaseFeeMode.RateLimiter`. |
| `FeeSchedulerParams` | `startingFeeBps`, `endingFeeBps`, `numberOfPeriod`, `totalDuration` | Used with `FeeSchedulerLinear` or `FeeSchedulerExponential`. |
| `RateLimiterParams` | `baseFeeBps`, `feeIncrementBps`, `referenceAmount`, `maxLimiterDuration` | Kept for quoting existing rate-limiter pools. `getRateLimiterParams` still encodes these fields. New config and pool builders reject the mode. |
| `MigrationFee` | `feePercentage`, `creatorFeePercentage` | Required only when `migrationFeeOption` is `Customizable`. |
| `MigratedPoolFeeConfig` | `collectFeeMode`, `dynamicFee`, `poolFeeBps`, optional `compoundingFeeBps`, optional graduated fee fields | Applies to the migrated DAMM pool, not to the DBC virtual pool. |
| `MigratedPoolMarketCapFeeSchedulerParams` | `endingBaseFeeBps`, `numberOfPeriod`, `priceMultiple`, `schedulerExpirationDuration` | Applies when using a DAMM v2 migrated-pool market-cap fee scheduler. |
| `LiquidityVestingInfoParams` | `vestingPercentage`, `bpsPerPeriod`, `numberOfPeriods`, `cliffDurationFromMigrationTime`, `totalDuration` | Optional migrated-liquidity vesting schedule. |
| `LockedVestingParams` | `totalLockedVestingAmount`, `numberOfVestingPeriod`, `cliffUnlockAmount`, `totalVestingDuration`, `cliffDurationFromMigrationTime` | Base-token vesting locked during migration. |
## Common Workflows
### Create A Config From A Builder
```typescript theme={"system"}
const configParams = buildCurveWithMarketCap({
token,
fee,
migration,
liquidityDistribution,
lockedVesting,
activationType: ActivationType.Timestamp,
initialMarketCap,
migrationMarketCap,
});
const tx = await client.partner.createConfig({
...configParams,
config,
feeClaimer,
leftoverReceiver,
quoteMint,
payer,
});
```
### Create A Pool From An Existing Config
```typescript theme={"system"}
const tx = await client.creator.createPool({
baseMint,
config,
name,
symbol,
uri,
payer,
poolCreator,
});
```
For transfer-hook configs, use `client.creator.createPoolWithTransferHook`.
### Quote And Build A `swap2` Transaction
```typescript theme={"system"}
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,
});
```
## Integration Notes
| Gotcha | Guidance |
| - | - |
| `swap2` modes | Use `SwapMode.ExactIn`, `PartialFill`, or `ExactOut` and pass the matching amount fields. |
| Rate limiter pools | The SDK adds the instructions sysvar when the current fee mode requires single-swap validation. |
| First-swap minimum fee | Set `eligibleForFirstSwapWithMinFee` only when quoting a transaction that satisfies the program's first-swap validation path. |
| Token-2022 pools | Use SDK builders so the correct token program, metadata, and ATA handling are included. |
| Transfer-hook pools | Use `createConfigWithTransferHook`, `createPoolWithTransferHook`, `swap2WithTransferHook`, and transfer-hook fee claim methods. Standard swap and claim paths reject transfer-hook pools. |
| DAMM v2 compounding | `MigratedCollectFeeMode.Compounding` requires `compoundingFeeBps`; non-compounding modes require it to be zero. |
| Market-cap scheduler | Market-cap scheduler params use `priceMultiple` in current SDK helpers. |
# DBC TS SDK Transfer Hooks
Source: https://docs.meteora.ag/developer-guides/dbc/typescript-sdk/transfer-hooks
Build Token 2022 transfer-hook DBC integrations with @meteora-ag/dynamic-bonding-curve-sdk.
The SDK supports Token 2022 transfer-hook DBC pools through dedicated config, pool, swap, and fee-claim builders.
Use this page for the TypeScript integration surface. For product behavior, see [DBC Transfer Hook Pools](/core-products/dbc/transfer-hook-pools).
## Method Map
| Flow | SDK Method |
| - | - |
| Create transfer-hook config | `client.partner.createConfigWithTransferHook` |
| Create transfer-hook config and pool | `client.partner.createConfigAndPoolWithTransferHook` |
| Create transfer-hook config and pool with first buy | `client.partner.createConfigAndPoolWithFirstBuyWithTransferHook` |
| Create pool from transfer-hook config | `client.creator.createPoolWithTransferHook` |
| Create pool with first buy | `client.creator.createPoolWithFirstBuyWithTransferHook` |
| Create pool with partner and creator first buys | `client.creator.createPoolWithPartnerAndCreatorFirstBuyWithTransferHook` |
| Swap | `client.pool.swap2WithTransferHook` |
| Claim partner trading fee | `client.partner.claimPartnerTradingFee2` |
| Claim creator trading fee | `client.creator.claimCreatorTradingFee2` |
<Note>
In SDK `1.5.8+`, `claimPartnerTradingFee2` and `claimCreatorTradingFee2` are transfer-hook fee claim builders. For standard pools with explicit receivers, use `claimPartnerTradingFeeToReceiver` and `claimCreatorTradingFeeToReceiver`.
</Note>
## State Reads
SDK `1.5.9` fetches both standard and transfer-hook account variants through the same state methods.
```typescript theme={"system"}
const configState = await client.state.getPoolConfig(config);
const poolState = await client.state.getPool(pool);
if (!configState || !poolState) {
throw new Error("DBC account not found");
}
const configAddress = poolState.poolState.config;
const baseMint = poolState.poolState.baseMint;
```
Raw Anchor account fetchers still use different account names: `poolConfig` versus `configWithTransferHook`, and `virtualPool` versus `transferHookPool`.
## Create A Transfer-Hook Config
Transfer-hook configs require `TokenType.Token2022` and a valid executable transfer-hook program.
```typescript theme={"system"}
import {
buildCurveWithMarketCap,
DynamicBondingCurveClient,
SwapMode,
TokenAuthorityOption,
TokenDecimal,
TokenType,
} from "@meteora-ag/dynamic-bonding-curve-sdk";
import { Connection, Keypair, PublicKey } from "@solana/web3.js";
import { NATIVE_MINT } from "@solana/spl-token";
const connection = new Connection(process.env.RPC_URL!, "confirmed");
const client = DynamicBondingCurveClient.create(connection, "confirmed");
const payer = Keypair.generate();
const config = Keypair.generate();
const configParams = buildCurveWithMarketCap({
token: {
tokenType: TokenType.Token2022,
tokenBaseDecimal: TokenDecimal.SIX,
tokenQuoteDecimal: TokenDecimal.NINE,
tokenAuthorityOption: TokenAuthorityOption.CreatorUpdateAndMintAuthority,
totalTokenSupply: 1_000_000_000,
leftover: 0,
},
fee,
migration,
liquidityDistribution,
lockedVesting,
activationType,
initialMarketCap,
migrationMarketCap,
});
const createConfigTx = await client.partner.createConfigWithTransferHook({
...configParams,
config: config.publicKey,
feeClaimer: payer.publicKey,
leftoverReceiver: payer.publicKey,
payer: payer.publicKey,
quoteMint: NATIVE_MINT,
transferHookProgram: new PublicKey("TRANSFER_HOOK_PROGRAM"),
});
```
`CreatorUpdateAndMintAuthority` and `PartnerUpdateAndMintAuthority` are only valid for transfer-hook configs. Standard configs reject mint-authority options.
## Create A Transfer-Hook Pool
```typescript theme={"system"}
const baseMint = Keypair.generate();
const createPoolTx = await client.creator.createPoolWithTransferHook({
baseMint: baseMint.publicKey,
config: config.publicKey,
name: "TEST",
symbol: "TEST",
uri: "https://example.com/token.json",
payer: payer.publicKey,
poolCreator: payer.publicKey,
transferHookProgram: new PublicKey("TRANSFER_HOOK_PROGRAM"),
});
```
The SDK derives the pool and vault accounts inside the transaction builder. If you need the pool address, use `deriveDbcPoolAddress(quoteMint, baseMint, config)`.
Transfer-hook first-buy builders also use the transfer-hook swap path. They attempt to resolve the base mint's hook remaining accounts automatically. If the hook cannot be resolved while bundling pool initialization with the first buy, pass `transferHookAccountsInfo` and `transferHookAccounts` on the first-buy params.
## Swap A Transfer-Hook Pool
`swap2WithTransferHook` uses the same `SwapMode` variants as `swap2`. The SDK resolves transfer-hook extra accounts from the base mint and passes `TransferHookAccountsInfo` for you.
```typescript theme={"system"}
const quote = client.pool.swapQuote2({
virtualPool: poolState,
config: configState,
swapBaseForQuote: false,
hasReferral: false,
eligibleForFirstSwapWithMinFee: false,
currentPoint,
swapMode: SwapMode.ExactIn,
amountIn,
slippageBps: 100,
});
const swapTx = await client.pool.swap2WithTransferHook({
owner,
payer,
pool,
swapBaseForQuote: false,
referralTokenAccount: null,
swapMode: SwapMode.ExactIn,
amountIn,
minimumAmountOut: quote.minimumAmountOut!,
});
```
When a referral account is present and the referral fee is paid in base tokens, the SDK includes both `AccountsType.TransferHookBase` and `AccountsType.TransferHookBaseReferral` slices.
## Claim Trading Fees
```typescript theme={"system"}
const partnerClaimTx = await client.partner.claimPartnerTradingFee2({
feeClaimer,
payer,
pool,
receiver: feeReceiver,
maxBaseAmount,
maxQuoteAmount,
});
const creatorClaimTx = await client.creator.claimCreatorTradingFee2({
creator,
payer,
pool,
receiver: creatorReceiver,
maxBaseAmount,
maxQuoteAmount,
});
```
For standard pools, use the non-transfer-hook claim methods:
| Standard Pool Claim | SDK Method |
| - | - |
| Partner claim with optional receiver and temporary wSOL account | `client.partner.claimPartnerTradingFee` |
| Partner claim to explicit receiver | `client.partner.claimPartnerTradingFeeToReceiver` |
| Creator claim with optional receiver and temporary wSOL account | `client.creator.claimCreatorTradingFee` |
| Creator claim to explicit receiver | `client.creator.claimCreatorTradingFeeToReceiver` |
## Completion
When the transfer-hook pool completes its bonding curve, DBC revokes the base mint's transfer-hook program id and transfer-hook authority. After completion, use the normal DAMM v2 migration methods:
```typescript theme={"system"}
const { transaction, firstPositionNftKeypair, secondPositionNftKeypair } =
await client.migration.migrateToDammV2({
payer,
pool,
dammConfig,
});
```
# DLMM Data API Overview
Source: https://docs.meteora.ag/developer-guides/dlmm/api-reference/overview
Learn how the DLMM Data API exposes indexed pools, portfolios, positions, stats, limit orders, wallets, and query filters.
<Tip>
**All DLMM APIs have a rate limit of 30 requests per second (30 RPS).** Explore the production spec at the [Prod Swagger UI](https://dlmm.datapi.meteora.ag/swagger-ui/) or the development spec at the [Dev Swagger UI](https://dlmm.dev.metdev.io/swagger-ui/).
</Tip>
## Base URLs
| Environment | Base URL | Swagger UI |
| - | - | - |
| Production | `https://dlmm.datapi.meteora.ag` | [Open](https://dlmm.datapi.meteora.ag/swagger-ui/) |
| Development | `https://dlmm.dev.metdev.io` | [Open](https://dlmm.dev.metdev.io/swagger-ui/) |
The checked-in OpenAPI file uses the same endpoint schema for both environments. Use the server dropdown in the API playground to switch between production and development.
## Pools
<CardGroup>
<Card title="Pools" icon="file-code" href="/api-reference/dlmm/pools/pools">
Returns a paginated list of pools using `GET` `/pools`
</Card>
<Card title="Groups" icon="file-code" href="/api-reference/dlmm/pools/groups">
Returns a paginated list of pool groups using `GET` `/pools/groups`
</Card>
<Card title="Group" icon="file-code" href="/api-reference/dlmm/pools/group">
Returns pools that belong to a specific pool group using `GET` `/pools/groups/{lexical_order_mints}`
</Card>
<Card title="Pool" icon="file-code" href="/api-reference/dlmm/pools/pool">
Returns metadata and current state for a single pool using `GET` `/pools/{address}`
</Card>
<Card title="OHLCV" icon="file-code" href="/api-reference/dlmm/pools/ohlcv">
Returns OHLCV candles for a single pool over a time range using `GET` `/pools/{address}/ohlcv`
</Card>
<Card title="Historical Volume" icon="file-code" href="/api-reference/dlmm/pools/historical-volume">
Returns historical volume for a pool aggregated into time buckets using `GET` `/pools/{address}/volume/history`
</Card>
</CardGroup>
## Portfolio
<CardGroup>
<Card title="Closed Portfolio" icon="file-code" href="/api-reference/dlmm/portfolio/get-user-portfolio-with-all-pools-containing-closed-positions">
Returns user portfolio data with pools containing closed positions using `GET` `/portfolio`
</Card>
<Card title="Open Portfolio" icon="file-code" href="/api-reference/dlmm/portfolio/get-user-portfolio-with-all-pools-containing-open-positions">
Returns user portfolio data with pools containing open positions using `GET` `/portfolio/open`
</Card>
<Card title="Portfolio Total" icon="file-code" href="/api-reference/dlmm/portfolio/get-total-portfolio-pnl-across-all-pools">
Returns total portfolio PnL across pools using `GET` `/portfolio/total`
</Card>
</CardGroup>
## Positions
<CardGroup>
<Card title="Historical Events" icon="file-code" href="/api-reference/dlmm/positions/get-the-historical-events-for-a-position">
Returns add, remove, claim fee, and claim reward events using `GET` `/positions/{address}/historical`
</Card>
<Card title="Position PnL" icon="file-code" href="/api-reference/dlmm/positions/get-position-pnl-data-open-and-closed-positions-with-on-the-fly-calculation">
Returns position PnL for open and closed positions using `GET` `/positions/{pool_address}/pnl`
</Card>
</CardGroup>
## Stats
<CardGroup>
<Card title="Protocol Overview" icon="file-code" href="/api-reference/dlmm/stats/protocol-ov프로젝트로 돌아가기