LogoLogo
  • Welcome to FlowX Finance
    • ๐Ÿ”ฎProtocol Overview
    • ๐Ÿ•ถ๏ธOur Advantages
    • ๐ŸšฉGetting Started
    • ๐Ÿ—บ๏ธRoadmap
  • PROTOCOL
    • โš–๏ธSwap
    • ๐Ÿ›žDEX Aggregator
    • ๐ŸŽฐLucky Swap
    • โš—๏ธLiquidity Pools
    • ๐ŸŽš๏ธPosition Management
    • ๐ŸชฃFarming as a Service
    • ๐Ÿ’ฐEarning Protocol Fee
    • ๐ŸTrading Competition
    • ๐Ÿ’ฌReferral
  • Tokenomics
    • ๐Ÿš‡FLX Token
    • ๐ŸšŠxFLX Governance Token
  • CONTRACT
    • ๐Ÿ“„GenesiX Farming
    • ๐Ÿ“„Swap
  • ๐Ÿ”ฆGuide
    • How to add Liquidity V3
  • REFERENCES
    • ๐Ÿ›ก๏ธAudit
    • ๐Ÿ–ผ๏ธMedia Kit
    • ๐ŸคPartners
    • ๐ŸงฐSDK
    • ๐Ÿ–ฅ๏ธAggregator Widget
  • ARCHIVED
    • Claim Token
    • ๐ŸงชGenesiX Farming
  • Developer
    • Overview
    • FlowX SDK
      • Getting Started
      • Retrieve coin
      • Swap Aggregator
      • AMM Management
        • Pool Management
        • Position Management
      • CLMM Management
        • Pool Management
        • Position Management
      • Auto Invest
      • Limit Order
  • FlowX Widget
  • Privacy & Terms
    • Risk Disclaimer
    • Terms of Service
  • Social
    • Website
    • Twitter
    • Telegram Channel
    • Discord
Powered by GitBook
On this page
  • Get user position detail
  • Create Position
  • Increase Position

Was this helpful?

  1. Developer
  2. FlowX SDK
  3. AMM Management

Position Management

Get user position detail

const positionManager = new AmmPositionManager('mainnet');
const positions = await positionManager.getUserPositions('userAddress');

Create Position

const pool = new AmmPool({
      objectId: '',
      coins: [
        new Coin(
          '0xd1b72982e40348d069bb1ff701e634c117bb5f741f44dff91e472d3b01461e55::stsui::STSUI'
        ),
        new Coin(
          '0xdeeb7a4662eec9f2f3def03fb937a663dddaa2e215b8078a284d026b7946c270::deep::DEEP'
        ),
      ],
      reserves: [0, 0],
      feeRate: 0,
      liquiditySupply: 0,
      kLast: 0,
    });

    const position = Position.fromAmounts({
      owner:
        '0xUserAddress',
      pool: pool,
      amountX: 0,
      amountY: 0,
    });

    const mintAmounts = position.mintAmountsWithSlippage(new Percent(0.0001));

Increase Position

const poolManager = new AmmPoolManager('mainnet');

    const pool = await poolManager.getPool({
      coinX: new Coin('0x2::sui::SUI'),
      coinY: new Coin(
        '0xdba34672e30cb065b1f93e3ab55318768fd6fef66c15942c9f7cb846e2f900e7::usdc::USDC'
      ),
    });

    const position = Position.fromAmounts({
      owner:
        '0xUserAddrexx',
      pool: pool,
      amountX: 1e9,
      amountY: 1e5,
    });

    const mintAmounts = position.mintAmountsWithSlippage(new Percent(0.0001));
PreviousPool ManagementNextCLMM Management

Last updated 1 month ago

Was this helpful?