Create LB Pair
Deploy new liquidity book trading pairs with custom configurations for any token combination.
Prerequisites
Before creating a pair:
Initialize the SDK with valid configuration
Have wallet connected with sufficient gas
Ensure both token types are valid on Sui
Choose appropriate bin step for your pair type
Calculate initial active bin ID for starting price
Basic Usage
const tx = await sdk.Factory.createLBPair({
tokenXType: "0x2::sui::SUI",
tokenYType: "0x...::usdc::USDC",
binStep: 20, // 20 basis points
activeId: 8388608 // Starting price = 1.0
});
await sdk.fullClient.signAndExecuteTransaction({
transaction: tx,
signer: keypair
});
Parameters
tokenXType & tokenYType
Full type strings of both tokens
Order doesn't matter (SDK auto-sorts)
Must be different tokens
binStep
Price increment in basis points (1-10000)
Cannot be changed after creation
activeId
Starting bin ID (sets initial price)
Use 8388608 for 1:1 price ratio
Advanced Example
// Create ETH/USDC pair starting at $3,500
const targetPrice = 3500;
const binStep = 20;
// Calculate starting bin ID
const activeId = getBinIdFromPrice(targetPrice, binStep);
const tx = await sdk.Factory.createLBPair({
tokenXType: SUI_TYPE,
tokenYType: USDC_TYPE,
binStep: binStep,
activeId: activeId // ~8394879 for $3,500
});
Token Ordering
DLMM requires tokenX < tokenY (by address). The SDK handles this automatically:
// Both orders work - SDK will sort
await createLBPair({
tokenXType: USDC,
tokenYType: SUI,
...
});
await createLBPair({
tokenXType: SUI, // Will be swapped to Y
tokenYType: USDC, // Will be swapped to X
...
});
After Creation
Pair is deployed but has no liquidity
Use Add to New Position to provide initial liquidity
Find your pair with Get Single Pair
Related Topics
Add to New Position - Add initial liquidity
Get All Pairs - Find existing pairs first
Last updated