0xAdventure
  • Overview
  • Product
    • Floorswap
      • USER GUIDE
        • Trading Modes
        • How to Buy NFTs?
        • How to Sell NFTs?
        • How to Set Your Slippage Tolerance?
        • How to Add Liquidity?
        • How to Increase Liquidity?
        • How to Remove Liquidity?
        • How to Manage Liquidity Positions?
        • How to Deposit?
        • How to Withdraw?
        • Fees
      • RISKS
      • TECHNICAL REFERENCE
        • Swap Method
        • Bonding Curve
      • DEVELOPERS
        • APIs
          • FloorSwap API V1.0
            • API Overview
            • Pool List
            • Pool Detail
            • Swap Info
            • Position Info
            • Position List
            • Position History
        • SDKs
          • Foorswap SDK V1.0
            • Pool
            • Position
            • Swap
            • Account
    • Launchpad
    • GAME Swap
    • Cross-chain bridge
    • AI-specialized NFT
    • AI narrative engine
    • AI creative partners
  • Tokenomics
  • Media Kit
Powered by GitBook
On this page
  • positionInfo
  • positionHistory
  • increaseLiquidity
  • increaseLiquidityForFundingPool
  • decreaseLiquidity
  • decreaseLiquidityForFundingPool
  • removeLiquidity
  • removeLiquidityForFundingPool
  1. Product
  2. Floorswap
  3. DEVELOPERS
  4. SDKs
  5. Foorswap SDK V1.0

Position

From this section, you can have actions such as "getting infos of position", "add liquidity", "remove liquidity", "burn liquidity position".

positionInfo

Get informations of position

Copy

const res: IResType<IPositionInfo>= await floorswap.position.positionInfo({
    pairId: 1
}: IPositionInfoParams)

interface IPositionInfoParams {
  pairId: number;
}

interface IResType<T> {
  code: string;
  message: string;
  success: boolean;
  data: T;
}

interface IPositionInfo {
  collectionName: string;
  collectionAddress: string;
  feeMultiplier: string;
  feeAccumulation: string;
  delta: number;
  tokenReserve: string;
  nftReserve: number;
  virtualTokenReserve: string;
  virtualNftReserve: number;
  nftList: string[];
  offerPrice: string;
  floorPrice: string;
  status: number;
  minPrice: string;
  maxPrice: string;
}

IPositionInfoParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

IPositionInfo

Name
Type
Description
Example

collectionName

string

Collection name

Koda

collectionAddress

string

Collection address

0xe012baf811cf9c05c408e879c399960d1f305903

feeMultiplier

string

Transaction fee, and the unit is wei

50000000000000000 = 5%

feeAccumulation

string

claimable earnings, and the unit is wei

50000000000000000 wei = 5 eth

delta

number

Concentration

5

tokenReserve

string

Token reserve

50000000000000000 wei = 5 eth

nftReserve

number

NFT reserve

20

virtualTokenReserve

string

Virture token reserve

50000000000000000 wei = 5 eth

virtualNftReserve

number

Virture NFT reserve

20

nftList

string[]

List of NFTs

["5"]

offerPrice

string

Best ask price

50000000000000000 wei = 5 eth

floorPrice

string

Best bid price

50000000000000000 wei = 5 eth

status

number

Status of position

1: IN_RANGE

2: OUT_OF_RANGE 3: CLOSED

1

minPrice

string

The lowest price

50000000000000000 wei = 5 eth

maxPrice

string

The highest price

50000000000000000 wei = 5 eth

positionHistory

Get history of the position

Copy

const res: IResType<IPositionInfo>= await floorswap.position.positionHistory({
    pairId: 1,
    type: 1,
    page?: 1
}: IPositionInfoParams)

interface IPositionHistoryParams {
  pairId: number;
  type: number;
  page?: number;
}

interface IResType<T> {
  code: string;
  message: string;
  success: boolean;
  data: T;
}

interface IPositionHistory {
  type: number;
  txHash: string;
  fromAddress: string;
  toAddress: string;
  networkFee: string;
  detail: string;
  time: number;
}

IPositionHistoryParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

type

number

true

1: swap token to nft 2: swap nft to token 3: init liquidity 4: increase liquidity 5: decrease liquidity 6: remove liquidity 10: claim earnings

page

number

false

Page numbers

IPositionHistory

Name
Type
Description
Example

type

number

The types of the history

1: swap token to nft 2: swap nft to token 3: init liquidity 4: increase liquidity 5: decrease liquidity 6: remove liquidity 10: claim earnings

txHash

string

Transaction hash

0xa31c6040f576e56ed312fcb920afc0e1c0f1ec114eccc3c83a246fe0ba0c51fc

fromAddress

string

From address

0xe012baf811cf9c05c408e879c399960d1f305903

toAddress

string

To address

0xe012baf811cf9c05c408e879c399960d1f305903

networkFee

string

Gas fee

50000000000000000 wei = 5 eth

detail

string

more details

time

number

Timestamp

1681718076000

increaseLiquidity

Add liquidity

Copy

const txHash: string = await floorswap.position.increaseLiquidity({
    signer,
    pairId: 1,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IIncreaseLiquidityParams & { signer: ethers.Signer })

interface IIncreaseLiquidityParams {
  pairId: string;
  tokenIdList: string[];
  value: string;
}

IIncreaseLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position id

tokenIdList

string[]

true

List of token ids

value

number

false

Amount of $ETH, and the unit is wei

e.g. 50000000000000000 wei = 5 eth

increaseLiquidityForFundingPool

Copy

const txHash: string = await floorswap.position.increaseLiquidityForFundingPool({
    pairId: 1,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IIncreaseLiquidityParams

interface IIncreaseLiquidityParams {
  pairId: string;
  tokenIdList: string[];
  value: string;
}

IIncreaseLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position id

tokenIdList

string[]

true

List of token ids

value

number

false

Amount of $ETH, and the unit is wei

e.g. 50000000000000000 wei = 5 eth

decreaseLiquidity

Remove liquidity

Copy

const txHash: string = await floorswap.position.decreaseLiquidity({
    signer,
    pairId: 1,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IDecreaseLiquidityParams & { signer: ethers.Signer })

interface IDecreaseLiquidityParams {
  pairId: string;
  tokenIdList: string[];
  value: string;
}

IDecreaseLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

tokenIdList

string[]

true

List of token ids

value

number

false

Amount of $ETH, and the unit is wei

e.g. 50000000000000000 wei = 5 eth

decreaseLiquidityForFundingPool

Copy

const txHash: string = await floorswap.position.decreaseLiquidityForFundingPool({
    pairId: 1,
    tokenIdList: ['5'],
    value: '100000000000000000',
}: IDecreaseLiquidityParams

interface IDecreaseLiquidityParams {
  pairId: string;
  tokenIdList: string[];
  value: string;
}

IDecreaseLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

tokenIdList

string[]

true

List of token ids

value

number

false

Amount of $ETH, and the unit is wei

e.g. 50000000000000000 wei = 5 eth

removeLiquidity

Remove all liqudity you provided and it will burn the position

Copy

const txHash: string = await floorswap.position.removeLiquidity({
    signer,
    pairId: 1,
}: IRemoveLiquidityParams & { signer: ethers.Signer })

interface IRemoveLiquidityParams {
  pairId: string;
}

IRemoveLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

removeLiquidityForFundingPool

Copy

const txHash: string = await floorswap.position.removeLiquidityForFundingPool({
    pairId: 1
}: IRemoveLiquidityParams

interface IRemoveLiquidityParams {
  pairId: string;
}

IRemoveLiquidityParams

Name
Type
Required
Description

pairId

number

true

Position/Pair id

PreviousPoolNextSwap

Last updated 12 months ago

Add liquidity with Funding Pool. Please apply apiKey from first

Remove liquidity with Funding Pool. Please apply apiKey from first

Burn liquidity position with Funding Pool. Please apply apiKey from first

Chamcha platform
Chamcha platform
Chamcha platform