Account

In this section, we provide interfaces related to your account.

getNFTIds

Get token IDs held by the owner

Copy

const { balance, tokenIds } = await floorswapSDK.account.getNFTIds(
    signer,
    collection,
    owner,
    amount
);

interface IGetNFTIdsResponse {
    balance: number;
    tokenIds: string[];
}

IGetNFTIdsParams

NameTypeRequiredDescription

collection

string

true

collection address

owner

string

true

owner address

limit

number

true

up limit of tokenIds we returned to

balanceForFundingPool

View balance of tokens and NFTs in Funding Pool

Copy

const res: IResType<IBalance>= await floorswap.account.balanceForFundingPool()

interface ISwapInfoParams {
  collection: string;
  swapType: number;
  slippage?: number;
  count?: number;
  nftList?: string[];
}

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

interface IBalance {
  token: string;
  nft: string[];
}

IBalance

NameTypeDescriptionExample

token

string

The amount of token

5

nft

string[]

The list of NFTs

["5"]

depositTokenForFundingPool

Deposit funds into Funding Pool

Copy

const txHash: string = await floorswap.swap.depositTokenForFundingPool({
  tokenAmount: '100000000000000000'
}: IDepositTokenParams & { signer: ethers.Signer })

interface IDepositTokenParams {
  tokenAmount: string;
}

IDepositTokenParams

NameTypeRequiredDescription

tokenAmount

string

true

The amount of token, and the unit is wei

withdrawTokenForFundingPool

Withdraw funds from Funding Pool

Copy

const txHash: string = await floorswap.swap.withdrawTokenForFundingPool({
  tokenAmount: '100000000000000000',
  lastFee: '50000000000000000'
}: IWithdrawTokenParams & { signer: ethers.Signer })

interface IWithdrawTokenParams {
  tokenAmount: string;
  lastFee: string;
}

IWithdrawTokenParams

NameTypeRequiredDescription

tokenAmount

string

true

The amount of token, and the unit is wei

lastFee

string

true

The network fee you need to pay on last transaction, and the unit is wei

depositNFTForFundingPool

Deposit NFTs into Funding Pool and cross multiple collections supported.

Copy

const txHash: string = await floorswap.swap.depositNFTForFundingPool({
  collectionAddressList: ['...', '...'],
  tokenIdsList: [['5'], ['10']]
}: IDepositNFTParams & { signer: ethers.Signer })

interface IDepositNFTParams {
  collectionAddressList: string[];
  tokenIdsList: string[][];
}

IDepositNFTParams

NameTypeRequiredDescription

collectionAddressList

string[]

true

The list of Collections

tokenIdsList

string[]

true

The list of NFTs

withdrawNFTForFundingPool

Withdraw NFTs from Funding Pool and cross multiple collections supported.

Copy

const txHash: string = await floorswap.swap.withdrawNFTForFundingPool({
  collectionAddressList: ['...', '...'],
  tokenIdsList: [['5'], ['10']]
}: IWithdrawNFTParams & { signer: ethers.Signer })

interface IWithdrawNFTParams {
  collectionAddressList: string[];
  tokenIdsList: string[][];
}

IWithdrawNFTParams

NameTypeRequiredDescription

collectionAddressList

string[]

true

The list of collections

tokenIdsList

string[]

true

The list of NFTs

Last updated