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
IPositionInfo
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
IPositionHistory
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
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
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
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
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
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
Last updated