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
pairId
number
true
Position/Pair id
IPositionInfo
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
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
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
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
Add liquidity with Funding Pool. Please apply apiKey from Chamcha platform first
Copy
const txHash: string = await floorswap.position.increaseLiquidityForFundingPool({
pairId: 1,
tokenIdList: ['5'],
value: '100000000000000000',
}: IIncreaseLiquidityParams
interface IIncreaseLiquidityParams {
pairId: string;
tokenIdList: string[];
value: string;
}
IIncreaseLiquidityParams
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
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
Remove liquidity with Funding Pool. Please apply apiKey from Chamcha platform first
Copy
const txHash: string = await floorswap.position.decreaseLiquidityForFundingPool({
pairId: 1,
tokenIdList: ['5'],
value: '100000000000000000',
}: IDecreaseLiquidityParams
interface IDecreaseLiquidityParams {
pairId: string;
tokenIdList: string[];
value: string;
}
IDecreaseLiquidityParams
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
pairId
number
true
Position/Pair id
removeLiquidityForFundingPool
Burn liquidity position with Funding Pool. Please apply apiKey from Chamcha platform first
Copy
const txHash: string = await floorswap.position.removeLiquidityForFundingPool({
pairId: 1
}: IRemoveLiquidityParams
interface IRemoveLiquidityParams {
pairId: string;
}
IRemoveLiquidityParams
pairId
number
true
Position/Pair id
Last updated