@xfai-labs/sdk

Enumerations

AddressType

Enumeration Members

Member
Value

Account

"account"

INFT

"inft"

Pool

"pool"

Token

"token"


TradeType

Enumeration Members

Member
Value

EXACT_INPUT

0

EXACT_OUTPUT

1

Classes

Xfai

This class contains all the information needed to interact with the Xfai protocol. The provider parameter is used to interact with the Ethereum network using ethers.js.

Constructors

constructor()

new Xfai( provider, chain, swapFee = 2): Xfai

Parameters

Parameter
Type
Default value
Description

provider

StaticJsonRpcProvider & {_hasWallet: false;} | Web3Provider

undefined

The provider to use for interacting with the Ethereum network.

chain

Chain< number >

undefined

The chain config to use for interacting with the network.

swapFee

number

2

The swap fee

Returns

Xfai

Source

libs/sdk/src/lib/xfai.ts:76

Properties

Property
Type
Description

chain

Chain< number >

The chain config to use for interacting with the network.

readonly coreAddress

string

-

readonly factoryAddress

string

-

readonly hasWallet

boolean

-

readonly inftAddress

string

-

readonly inftPeripheryAddress

string

-

readonly multicallAddress

string

-

readonly nativeToken

TokenInfo

-

readonly peripheryAddress

string

-

readonly poolInitCodeHash

string

-

readonly provider

StaticJsonRpcProvider & {_hasWallet: false;} | Web3Provider

The provider to use for interacting with the Ethereum network.

readonly swapFee

BigNumberish

-

readonly topTokenAddresses

string[]

-

readonly underlyingToken

TokenInfo

-

readonly usdc

undefined | TokenInfo

-

readonly wrappedNativeToken

TokenInfo

-

Type Aliases

AccountAddress

AccountAddress: Address< Account >

Source

libs/sdk/src/lib/xfai.ts:48

libs/sdk/src/lib/xfai.ts:49


Address

Address: <T> object

Type parameters

Parameter

T extends AddressType

Type declaration

Member
Type

address

string

type

T

Source

libs/sdk/src/lib/xfai.ts:39

libs/sdk/src/lib/xfai.ts:43


BoostOptions

BoostOptions: Omit< TransactionOptions, "slippage" >

Source

libs/sdk/src/lib/periphery/inft/boost.ts:7


Chain

Chain: <T> object

Type parameters

Parameter
Default

T extends number

number

Type declaration

Member
Type

readonly addresses

object

addresses.core

string

addresses.factory

string

addresses.inft

string

addresses.inft_periphery

string

addresses.multicall

string

addresses.periphery

string

addresses.pool_hash

string

addresses.token_usdc?

string

addresses.underlying_token

string

backendApi?

string

blockExplorerUrl?

string

readonly chainId

T

cloudflareApiKey?

string

readonly defaultTokenList

TokenList

readonly development

boolean

etherscanApi?

string

readonly label

string

readonly logoUri

string

readonly nativeToken

Omit< TokenInfo, "chainId" | "address" >

readonly rpcUrl

string

topTokenAddresses?

readonly string[]

readonly wrappedNativeToken

Omit< TokenInfo, "chainId" >

Source

libs/sdk/src/lib/xfai.ts:6


INFT

INFT: object

Type declaration

Member
Type

id

number

type

"inft_id"

Source

libs/sdk/src/lib/inft/core.ts:5

libs/sdk/src/lib/inft/core.ts:10


INFTBalance

INFTBalance: object

Type declaration

Member
Type

amount

BigNumber

harvestedShares

BigNumber

totalShares

BigNumber

Source

libs/sdk/src/lib/inft/balance.ts:8


INFTState

INFTState: object

Type declaration

Member
Type

initialReserve

BigNumber

reserve

BigNumber

shares

BigNumber

Source

libs/sdk/src/lib/inft/core.ts:26


LiquidityInAmount

LiquidityInAmount: <P> object

Type parameters

Parameter
Default

P extends Token

Token

Type declaration

Member
Type

amount

BigNumber

token

P

Source

libs/sdk/src/lib/periphery/liquidity/add.ts:7


ParsedEthersError

ParsedEthersError: object

Type declaration

Member
Type

context

ReturnValue

error

Error

type

"ParsedEthersError"

Source

libs/sdk/src/lib/xfai-core.ts:4


Pool

Pool: Address< Pool >

Source

libs/sdk/src/lib/pool/core.ts:10

libs/sdk/src/lib/pool/core.ts:11


PoolState

PoolState: object

Type declaration

Member
Type

ethReserve

BigNumber

reserve

BigNumber

Source

libs/sdk/src/lib/pool/core.ts:18


Quote

Quote: <T> object

Type parameters

Parameter

T extends QuoteBase

Type declaration

Member
Type

amount

BigNumber

token

object

token.state

PoolState

token.token

Token

type

T

Source

libs/sdk/src/lib/pool/quote.ts:20


QuoteBase

QuoteBase: "ETH" | "Token"

Source

libs/sdk/src/lib/pool/quote.ts:6


QuoteResult

QuoteResult: <T> T extends "Token" ? {ethIn: BigNumber; tokenIn: BigNumber | undefined; xfAmount: BigNumber;} : {ethIn: BigNumber | undefined; tokenIn: BigNumber; xfAmount: BigNumber;}

Type parameters

Parameter

T extends QuoteBase

Source

libs/sdk/src/lib/pool/quote.ts:8


StakeOptions

StakeOptions: Omit< TransactionOptions, "slippage" >

Source

libs/sdk/src/lib/periphery/inft/stake.ts:8


SupportedChainIds

SupportedChainIds: keyof typeof Chains

Source

libs/sdk/src/chains/index.ts:11

libs/sdk/src/chains/index.ts:12


SwapAmount

SwapAmount: object

Type declaration

Member
Type

amount

BigNumber

priceImpact

number

Source

libs/sdk/src/lib/pool/swap-amounts.ts:14


TargetTokenAmount

TargetTokenAmount: object

Type declaration

Member
Type

desiredAmount

BigNumber

token

Token

Source

libs/sdk/src/lib/periphery/liquidity/remove.ts:7


Token

Token: Address< Token > | Pick< TokenInfo, "address" | "decimals" >

Source

libs/sdk/src/lib/xfai-token.ts:9

libs/sdk/src/lib/xfai-token.ts:11


TransactionOptions

TransactionOptions: object

Type declaration

Member
Type

deadline

Date

from

Signer

gasLimit?

BigNumber

slippage

BigNumberish

to?

Signer | string

Source

libs/sdk/src/lib/periphery/core.ts:12

Variables

BASISPOINT_MAX

const BASISPOINT_MAX: BigNumber

A utility module for handling basis points and converting them to percentages.

Source

libs/sdk/src/lib/xfai-utils.ts:13


Chains

const Chains: object

Type declaration

Member
Type

readonly 5777

Chain< 5777 >

readonly 59140

Chain< 59140 >

readonly 59144

Chain< 59144 >

Source

libs/sdk/src/chains/index.ts:6


Mainnet

const Mainnet: Chain< 59144 > = LINEA_NETWORK

Source

libs/sdk/src/chains/index.ts:5


NATIVE_TOKEN_ADDRESS

const NATIVE_TOKEN_ADDRESS: "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee" = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee'

Source

libs/sdk/src/chains/core.ts:1


PERMILLE_MAX

const PERMILLE_MAX: BigNumber

A utility module for working with permille values, which represent one-tenth of a percentage point.

Source

libs/sdk/src/lib/xfai-utils.ts:41


SupportedChainIds

const SupportedChainIds: (5777 | 59144 | 59140)[]

Source

libs/sdk/src/chains/index.ts:11

libs/sdk/src/chains/index.ts:12

Functions

AccountAddress()

AccountAddress(address): AccountAddress

Parameters

Parameter
Type

address

string

Returns

AccountAddress

Source

libs/sdk/src/lib/xfai.ts:49


Address()

Address<T>(type, address): Address< T >

Type parameters

Parameter

T extends AddressType

Parameters

Parameter
Type

type

T

address

string

Returns

Address< T >

Source

libs/sdk/src/lib/xfai.ts:43


INFT()

INFT(id): INFT

Parameters

Parameter
Type

id

number

Returns

INFT

Source

libs/sdk/src/lib/inft/core.ts:10


Pool()

Pool(address): Pool

Parameters

Parameter
Type

address

string

Returns

Pool

Source

libs/sdk/src/lib/pool/core.ts:11


Token()

Token(address): Token

Parameters

Parameter
Type

address

string

Returns

Token

Source

libs/sdk/src/lib/xfai-token.ts:11


addLiquidity()

addLiquidity<P>( xfai, ethAmount, target, options): Promise< PopulatedTransaction >

Add liquidity to a pool, in case you're providing single sided ETH, supplementary should be undefined

Type parameters

Parameter
Default

P extends Token

Token

Parameters

Parameter
Type

xfai

Xfai

ethAmount

BigNumber

target

LiquidityInAmount< P >

options

TransactionOptions

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/liquidity/add.ts:15


addSwapFee()

addSwapFee(xfai, amount): BigNumber

Parameters

Parameter
Type

xfai

number | Xfai

amount

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/pool/core.ts:94


basisPointToPercent()

basisPointToPercent(value): number

Converts a basis point value to its equivalent percentage value.

Parameters

Parameter
Type
Description

value

BigNumber

The basis point value to be converted, as a BigNumber.

Returns

number

The equivalent percentage value.

Source

libs/sdk/src/lib/xfai-utils.ts:20


boostToken()

boostToken( xfai, inft, amountIn, minShare, options): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

amountIn

BigNumber

minShare

BigNumber

options

BoostOptions

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/inft/boost.ts:9


calculateDeadline()

calculateDeadline(param0): string

Convert the date object to unix timestamp

Parameters

Parameter
Type
Description

param0

object

param0.deadline

Date

-

Returns

string

unix timestamp

Source

libs/sdk/src/lib/xfai-utils.ts:62


calculatePriceImpact()

calculatePriceImpact(input, output): number

Parameters

Parameter
Type

input

BigNumber

output

BigNumber

Returns

number

Source

libs/sdk/src/lib/xfai-utils.ts:217


calculateShare()

calculateShare(inftState, input): BigNumber

Parameters

Parameter
Type

inftState

INFTState

input

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/inft/core.ts:60


calculateSwapFee()

calculateSwapFee(xfai, amount): BigNumber

Parameters

Parameter
Type

xfai

number | Xfai

amount

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/pool/core.ts:85


delayMs()

delayMs(ms): Promise< unknown >

Parameters

Parameter
Type

ms

number

Returns

Promise< unknown >

Source

libs/sdk/src/lib/xfai-utils.ts:166


deriveToAddress()

deriveToAddress(__namedParameters): Promise< string >

Parameters

Parameter
Type

__namedParameters

Pick< TransactionOptions, "from" | "to" >

Returns

Promise< string >

Source

libs/sdk/src/lib/periphery/core.ts:20


getAdjustedAmountInput()

getAdjustedAmountInput(pool, ethOut): BigNumber

Returns the amount of token that's needed to get the desired eth reserve out

Parameters

Parameter
Type
Description

pool

PoolState

ethOut

BigNumber

Returns

BigNumber

amountIn

Source

libs/sdk/src/lib/xfai-utils.ts:102


getAdjustedAmountOutput()

getAdjustedAmountOutput(pool, ethIn): BigNumber

Parameters

Parameter
Type
Description

pool

PoolState

ethIn

BigNumber

-

Returns

BigNumber

amountOut

Source

libs/sdk/src/lib/xfai-utils.ts:143


getAdjustedEthInput()

getAdjustedEthInput(pool, amountOut): BigNumber

Returns the xf that's needed to get the desired token amount out

Parameters

Parameter
Type
Description

pool

PoolState

amountOut

BigNumber

Returns

BigNumber

xfIn

Source

libs/sdk/src/lib/xfai-utils.ts:118


getAdjustedEthOutput()

getAdjustedEthOutput(pool, amountIn): BigNumber

Returns the eth reserve out for the token amount in

Parameters

Parameter
Type
Description

pool

PoolState

amountIn

BigNumber

Returns

BigNumber

xfOut

Source

libs/sdk/src/lib/xfai-utils.ts:133


getCore()

getCore(xfai): IXfaiV0Core

Parameters

Parameter
Type

xfai

Xfai

Returns

IXfaiV0Core

Source

libs/sdk/src/lib/xfai-core.ts:10


getFactory()

getFactory(xfai): IXfaiFactory

Parameters

Parameter
Type

xfai

Xfai

Returns

IXfaiFactory

Source

libs/sdk/src/lib/factory.ts:4


getINFT()

getINFT(xfai, signer = false): IXfaiINFT

Parameters

Parameter
Type
Default value

xfai

Xfai

undefined

signer

boolean

false

Returns

IXfaiINFT

Source

libs/sdk/src/lib/inft/core.ts:32


getINFTBalance()

getINFTBalance(xfai, account): Promise< number >

Parameters

Parameter
Type

xfai

Xfai

account

AccountAddress

Returns

Promise< number >

Source

libs/sdk/src/lib/inft/balance.ts:14


getINFTOwnership()

getINFTOwnership(xfai, inft): Promise< {owner: string;} >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

Returns

Promise< {owner: string;} >

Source

libs/sdk/src/lib/inft/core.ts:39


getINFTPeriphery()

getINFTPeriphery(xfai, signer): IInfinityNFTPeriphery

Parameters

Parameter
Type

xfai

Xfai

signer

Signer

Returns

IInfinityNFTPeriphery

Source

libs/sdk/src/lib/periphery/core.ts:8


getINFTPeripheryAllowance()

getINFTPeripheryAllowance( xfai, wallet, token): BigNumber | Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | AccountAddress

token

Token | Pool

Returns

BigNumber | Promise< BigNumber >

Source

libs/sdk/src/lib/xfai-token.ts:94


getINFTState()

getINFTState(xfai, options): Promise< INFTState >

Parameters

Parameter
Type

xfai

Xfai

options

CallOverrides

Returns

Promise< INFTState >

Source

libs/sdk/src/lib/inft/core.ts:50


getINFTTokenBalance()

getINFTTokenBalance( xfai, inft, token): Promise< INFTBalance >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

token

Token

Returns

Promise< INFTBalance >

Source

libs/sdk/src/lib/inft/balance.ts:18


getINFTTokenBalanceMulticall()

getINFTTokenBalanceMulticall<T>( xfai, inft, tokens, allowFailure): Promise< Record< Token["address"], T extends true ? undefined | INFTBalance : INFTBalance > >

Type parameters

Parameter

T extends boolean

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

tokens

Token[]

allowFailure

T

Returns

Promise< Record< Token["address"], T extends true ? undefined | INFTBalance : INFTBalance > >

Source

libs/sdk/src/lib/inft/balance.ts:31


getINFTsForOwner()

getINFTsForOwner( xfai, owner, balance): Promise< Record< string | number, BigNumber > >

Parameters

Parameter
Type

xfai

Xfai

owner

AccountAddress

balance

number

Returns

Promise< Record< string | number, BigNumber > >

Source

libs/sdk/src/lib/inft/balance.ts:67


getInftImage()

getInftImage(inft, quality?): string

Parameters

Parameter
Type

inft

INFT

quality?

"md" | "sm" | "lg"

Returns

string

Source

libs/sdk/src/lib/inft/core.ts:17


getOraclePrice()

getOraclePrice(xfai, token): Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

token

TokenInfo

Returns

Promise< BigNumber >

Source

libs/sdk/src/lib/xfai-token.ts:150


getPeriphery()

getPeriphery(xfai, signer): IXfaiV0Periphery03

Parameters

Parameter
Type

xfai

Xfai

signer

Signer

Returns

IXfaiV0Periphery03

Source

libs/sdk/src/lib/periphery/core.ts:4


getPeripheryAllowance()

getPeripheryAllowance( xfai, wallet, token): BigNumber | Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | AccountAddress

token

Token | Pool

Returns

BigNumber | Promise< BigNumber >

Source

libs/sdk/src/lib/xfai-token.ts:84


getPool()

getPool(xfai, pool): IXfaiPool

Parameters

Parameter
Type

xfai

Xfai

pool

Pool

Returns

IXfaiPool

Source

libs/sdk/src/lib/pool/core.ts:23


getPoolBalance()

getPoolBalance( xfai, wallet, token): Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | {address: string;}

token

Token

Returns

Promise< BigNumber >

Source

libs/sdk/src/lib/pool/balance.ts:6


getPoolBalanceMulticall()

getPoolBalanceMulticall( xfai, wallet, tokens): Promise< Record< string, BigNumber | undefined > >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | {address: string;}

tokens

Token[]

Returns

Promise< Record< string, BigNumber | undefined > >

Source

libs/sdk/src/lib/pool/multicall.ts:8


getPoolFromToken()

getPoolFromToken(xfai, token): Pool

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

Pool

Source

libs/sdk/src/lib/pool/core.ts:35


getPoolFromTokenAddress()

getPoolFromTokenAddress(xfai, token): IXfaiPool

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

IXfaiPool

Source

libs/sdk/src/lib/pool/core.ts:27


getPoolLiquidityMulticall()

getPoolLiquidityMulticall(xfai, tokens): Promise< Record< string | number, undefined | BigNumber > >

Parameters

Parameter
Type

xfai

Xfai

tokens

Token[]

Returns

Promise< Record< string | number, undefined | BigNumber > >

Source

libs/sdk/src/lib/pool/multicall.ts:42


getPoolNameForTokenAddress()

getPoolNameForTokenAddress(xfai, token): Promise< string >

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

Promise< string >

Source

libs/sdk/src/lib/pool/core.ts:31


getPoolState()

getPoolState( xfai, pool, options = {}): Promise< PoolState >

Parameters

Parameter
Type

xfai

Xfai

pool

Pool

options

CallOverrides

Returns

Promise< PoolState >

Source

libs/sdk/src/lib/pool/core.ts:45


getPoolStateMulticall()

getPoolStateMulticall(xfai, poolsOrTokens): Promise< {} >

Parameters

Parameter
Type

xfai

Xfai

poolsOrTokens

Token[] | Pool[]

Returns

Promise< {} >

Source

libs/sdk/src/lib/pool/core.ts:53


getPoolSupply()

getPoolSupply(xfai, token): Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

Promise< BigNumber >

Source

libs/sdk/src/lib/pool/balance.ts:18


getPoolTokenBalance()

getPoolTokenBalance(xfai, token): Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

Promise< BigNumber >

Source

libs/sdk/src/lib/pool/balance.ts:14


getPoolTokenBalanceMulticall()

getPoolTokenBalanceMulticall(xfai, tokens): Promise< Record< string | number, undefined | BigNumber > >

Parameters

Parameter
Type

xfai

Xfai

tokens

Token[]

Returns

Promise< Record< string | number, undefined | BigNumber > >

Source

libs/sdk/src/lib/pool/multicall.ts:27


getSpotAmount()

getSpotAmount(pool, ethIn): BigNumber

Return the amount out for a given xf In

Parameters

Parameter
Type
Description

pool

PoolState

ethIn

BigNumber

Returns

BigNumber

amountIn

Source

libs/sdk/src/lib/xfai-utils.ts:79


getSpotEth()

getSpotEth(pool, amountIn): BigNumber

Return the xf out for a given amount in

Parameters

Parameter
Type
Description

pool

PoolState

amountIn

BigNumber

Returns

BigNumber

xfOut

Source

libs/sdk/src/lib/xfai-utils.ts:92


getSwapAmounts()

getSwapAmounts<T, P>( xfai, tradeType, tokenIn, tokenOut, amount): SwapAmount

Type parameters

Parameter
Default

T extends TradeType

-

P extends undefined | PoolState

undefined | PoolState

Parameters

Parameter
Type

xfai

Xfai

tradeType

T

tokenIn

object

tokenIn.state

P

tokenIn.token

Token

tokenOut

object

tokenOut.state

P extends undefined ? PoolState : undefined | PoolState

tokenOut.token

Token

amount

BigNumber

Returns

SwapAmount

Source

libs/sdk/src/lib/pool/swap-amounts.ts:126


getSwapInputAmount()

getSwapInputAmount<P>( xfai, tokenIn, tokenOut, outputAmount): SwapAmount

Returns the amount of tokenIn needed for swapping tokenOutAmount of tokenIn

Type parameters

Parameter
Default

P extends undefined | PoolState

undefined | PoolState

Parameters

Parameter
Type

xfai

Xfai

tokenIn

object

tokenIn.state

P

tokenIn.token

Token

tokenOut

object

tokenOut.state

P extends undefined ? PoolState : undefined | PoolState

tokenOut.token

Token

outputAmount

BigNumber

Returns

SwapAmount

tokenInInput

Source

libs/sdk/src/lib/pool/swap-amounts.ts:79


getSwapOutputAmount()

getSwapOutputAmount<P>( xfai, tokenIn, tokenOut, inputAmount): SwapAmount

Returns the amount of tokenOut after swapping tokenInAmount of tokenIn

Type parameters

Parameter
Default

P extends undefined | PoolState

undefined | PoolState

Parameters

Parameter
Type
Description

xfai

Xfai

-

tokenIn

object

-

tokenIn.state

P

-

tokenIn.token

Token

-

tokenOut

object

-

tokenOut.state

P extends undefined ? PoolState : undefined | PoolState

-

tokenOut.token

Token

-

inputAmount

BigNumber

Returns

SwapAmount

tokenOutAmount

Source

libs/sdk/src/lib/pool/swap-amounts.ts:26


getToken()

getToken(xfai, token): IERC20Metadata

Parameters

Parameter
Type

xfai

Xfai

token

Token | Pool

Returns

IERC20Metadata

Source

libs/sdk/src/lib/xfai-token.ts:25


getTokenBalance()

getTokenBalance( xfai, wallet, token): Promise< BigNumber >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | AccountAddress

token

Token

Returns

Promise< BigNumber >

Source

libs/sdk/src/lib/xfai-token.ts:28


getTokenBalanceMulticall()

getTokenBalanceMulticall( xfai, wallet, tokens): Promise< Record< Token["address"], BigNumber | undefined > >

Parameters

Parameter
Type

xfai

Xfai

wallet

Wallet | {address: string;}

tokens

Token[]

Returns

Promise< Record< Token["address"], BigNumber | undefined > >

Source

libs/sdk/src/lib/xfai-token.ts:39


getTokenDetails()

getTokenDetails(xfai, token): Promise< TokenInfo >

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

Promise< TokenInfo >

Source

libs/sdk/src/lib/xfai-token.ts:105


getTransactionGasCost()

getTransactionGasCost(tx): undefined | BigNumber

Tries to estimate the gas limit for a TransactionReceipt or ContractTransaction

Parameters

Parameter
Type
Description

tx

ContractTransaction | TransactionReceipt

TransactionReceipt | ContractTransaction

Returns

undefined | BigNumber

BigNumber | undefined

Source

libs/sdk/src/lib/xfai-utils.ts:201


handleNativeToken()

handleNativeToken(xfai, token): Token | Pool

Parameters

Parameter
Type

xfai

Xfai

token

Token | Pool

Returns

Token | Pool

Source

libs/sdk/src/lib/xfai-token.ts:143


harvestINFT()

harvestINFT( xfai, inft, token, amountOut): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

token

Token

amountOut

BigNumber

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/inft/harvest.ts:6


harvestInftErc20()

harvestInftErc20( xfai, inft, token, amountOut): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

token

Token

amountOut

BigNumber

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/inft/harvest.ts:23


harvestInftEth()

harvestInftEth( xfai, inft, amountOut): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

amountOut

BigNumber

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/inft/harvest.ts:18


isNativeToken()

isNativeToken(token): boolean

Parameters

Parameter
Type

token

undefined | Token | Pool

Returns

boolean

Source

libs/sdk/src/lib/xfai-token.ts:22


isParsedEthersError()

isParsedEthersError(error): error is ParsedEthersError

Parameters

Parameter
Type

error

unknown

Returns

error is ParsedEthersError

Source

libs/sdk/src/lib/xfai-core.ts:14


isSharedToken()

isSharedToken(xfai, token): boolean

Parameters

Parameter
Type

xfai

Xfai

token

undefined | Token | Pool

Returns

boolean

Source

libs/sdk/src/lib/xfai-token.ts:19


isUnderlyingToken()

isUnderlyingToken(xfai, token): boolean

Parameters

Parameter
Type

xfai

Xfai

token

Token

Returns

boolean

Source

libs/sdk/src/lib/xfai-token.ts:13


isWrappedNativeToken()

isWrappedNativeToken(xfai, token): boolean

Parameters

Parameter
Type

xfai

Xfai

token

undefined | Token | Pool

Returns

boolean

Source

libs/sdk/src/lib/xfai-token.ts:16


max()

max(a, b): BigNumber

Parameters

Parameter
Type

a

BigNumber

b

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/xfai-utils.ts:69


min()

min(a, b): BigNumber

Parameters

Parameter
Type

a

BigNumber

b

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/xfai-utils.ts:65


multicall()

multicall<T, B, F>( xfai, contract, calls, options?): Promise< Record< string | number, B extends true ? undefined | Awaited< ReturnType< ReturnType< T["connect"] >["callStatic"][F] > > : Awaited< ReturnType< ReturnType< T["connect"] >["callStatic"][F] > > > >

Type parameters

Parameter

T extends Factory< BaseContract >

B extends boolean

F extends string

Parameters

Parameter
Type

xfai

Xfai

contract

T

calls

CallArg< T, F >[]

options?

object

options.allowFailure?

B

options.callOverrides?

Overrides

options.key?

(arg, index) => string | number | Promise< string | number >

Returns

Promise< Record< string | number, B extends true ? undefined | Awaited< ReturnType< ReturnType< T["connect"] >["callStatic"][F] > > : Awaited< ReturnType< ReturnType< T["connect"] >["callStatic"][F] > > > >

Source

libs/sdk/src/lib/multicall.ts:19


negativeSlippage()

negativeSlippage(amount, slippage): BigNumber

Decreases the amount by the provided slippage (100 - 1% slippage) = (99)

Parameters

Parameter
Type
Description

amount

BigNumber

slippage

BigNumberish

Returns

BigNumber

amount with negative slippage

Source

libs/sdk/src/lib/xfai-utils.ts:152


positiveSlippage()

positiveSlippage(amount, slippage): BigNumber

Increases the amount by the provided slippage (100 + 1% slippage) = (101)

Parameters

Parameter
Type
Description

amount

BigNumber

slippage

BigNumberish

Returns

BigNumber

amount with positive slippage

Source

libs/sdk/src/lib/xfai-utils.ts:162


quote()

quote<T>(__namedParameters): QuoteResult< T >

Type parameters

Parameter

T extends QuoteBase

Parameters

Parameter
Type

__namedParameters

Quote< T >

Returns

QuoteResult< T >

Source

libs/sdk/src/lib/pool/quote.ts:29


removeLiquidity()

removeLiquidity( xfai, lpTokenAmount, target, supplementary, options): Promise< PopulatedTransaction >

Remove liquidity from a pool,

Parameters

Parameter
Type

xfai

Xfai

lpTokenAmount

BigNumber

target

TargetTokenAmount

supplementary

TargetTokenAmount

options

TransactionOptions

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/liquidity/remove.ts:14


requestAllowance()

requestAllowance(xfai, token): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

token

Token | Pool

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/xfai-token.ts:66


requestINFTAllowance()

requestINFTAllowance(xfai, token): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

token

Token | Pool

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/xfai-token.ts:75


sendPopulatedTx()

sendPopulatedTx(xfai, populatedTx): Promise< TransactionResponse >

Send a populated transaction

Parameters

Parameter
Type
Description

xfai

Xfai

populatedTx

PopulatedTransaction | Promise< PopulatedTransaction >

Returns

Promise< TransactionResponse >

PopulatedTransaction

Source

libs/sdk/src/lib/xfai-utils.ts:176


stakeToken()

stakeToken( xfai, amountIn, minShare, options): Promise< PopulatedTransaction >

Stake xfit to get an INFT. If INFT is specified in options, the INFT will be boosted instead. Takes a token and an amount in and min share out.

Parameters

Parameter
Type

xfai

Xfai

amountIn

BigNumber

minShare

BigNumber

options

StakeOptions & {inft: undefined | INFT;}

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/inft/stake.ts:15


subtractSwapFee()

subtractSwapFee(xfai, amount): BigNumber

Parameters

Parameter
Type

xfai

number | Xfai

amount

BigNumber

Returns

BigNumber

Source

libs/sdk/src/lib/pool/core.ts:91


swapTokens()

swapTokens<T>( xfai, tradeType, tokenIn, tokenOut, amountIn, desiredAmountOut, options): Promise< PopulatedTransaction >

Swap tokens.

Type parameters

Parameter
Default

T

EXACT_INPUT

Parameters

Parameter
Type
Description

xfai

Xfai

tradeType

T

tokenIn

Token

tokenOut

Token

amountIn

BigNumber

desiredAmountOut

BigNumber

-

options

TransactionOptions

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/swap/index.ts:10

swapTokens<T>( xfai, tradeType, tokenIn, tokenOut, desiredAmountIn, amountOut, options): Promise< PopulatedTransaction >

Swap tokens.

Type parameters

Parameter
Default

T

EXACT_OUTPUT

Parameters

Parameter
Type
Description

xfai

Xfai

tradeType

T

tokenIn

Token

tokenOut

Token

desiredAmountIn

BigNumber

-

amountOut

BigNumber

options

TransactionOptions

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/periphery/swap/index.ts:19


transfer()

transfer( xfai, inft, newOwner): Promise< PopulatedTransaction >

Parameters

Parameter
Type

xfai

Xfai

inft

INFT

newOwner

AccountAddress

Returns

Promise< PopulatedTransaction >

Source

libs/sdk/src/lib/inft/transfer.ts:4


validateBasisPoint()

validateBasisPoint(number): BigNumber

Validates a basis point value to ensure it falls within the acceptable range of 0 to 10000.

Throws

An error if the provided basis point value is outside the valid range.

Parameters

Parameter
Type
Description

number

BigNumberish

The basis point value to be validated, as a BigNumberish or a compatible numeric type.

Returns

BigNumber

The valid basis point value if it falls within the acceptable range.

Source

libs/sdk/src/lib/xfai-utils.ts:30


validatePermille()

validatePermille(number): BigNumber

Validates a permille value to ensure it falls within the acceptable range of 0 to 1000.

Throws

An error if the provided permille value is outside the valid range.

Parameters

Parameter
Type
Description

number

BigNumberish

The permille value to be validated, as a BigNumberish or a compatible numeric type.

Returns

BigNumber

The valid permille value if it falls within the acceptable range.

Source

libs/sdk/src/lib/xfai-utils.ts:49

Last updated