@xfai-labs/sdk
Enumerations
AddressType
Enumeration Members
Member | Value |
---|---|
|
|
|
|
|
|
|
|
TradeType
Enumeration Members
Member | Value |
---|---|
|
|
|
|
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 |
---|---|---|---|
|
|
| The provider to use for interacting with the Ethereum network. |
|
|
| The chain config to use for interacting with the network. |
|
|
| The swap fee |
Returns
Xfai
Source
Properties
Property | Type | Description |
---|---|---|
|
| The chain config to use for interacting with the network. |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| The provider to use for interacting with the Ethereum network. |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
Type Aliases
AccountAddress
AccountAddress:
Address
<Account
>
Source
Address
Address: <
T
>object
Type parameters
Parameter |
---|
|
Type declaration
Member | Type |
---|---|
|
|
|
|
Source
BoostOptions
BoostOptions:
Omit
<TransactionOptions
,"slippage"
>
Source
libs/sdk/src/lib/periphery/inft/boost.ts:7
Chain
Chain: <
T
>object
Type parameters
Parameter | Default |
---|---|
|
|
Type declaration
Member | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| readonly |
|
|
Source
INFT
INFT:
object
Type declaration
Member | Type |
---|---|
|
|
|
|
Source
libs/sdk/src/lib/inft/core.ts:5
libs/sdk/src/lib/inft/core.ts:10
INFTBalance
INFTBalance:
object
Type declaration
Member | Type |
---|---|
|
|
|
|
|
|
Source
libs/sdk/src/lib/inft/balance.ts:8
INFTState
INFTState:
object
Type declaration
Member | Type |
---|---|
|
|
|
|
|
|
Source
libs/sdk/src/lib/inft/core.ts:26
LiquidityInAmount
LiquidityInAmount: <
P
>object
Type parameters
Parameter | Default |
---|---|
|
|
Type declaration
Member | Type |
---|---|
|
|
|
|
Source
libs/sdk/src/lib/periphery/liquidity/add.ts:7
ParsedEthersError
ParsedEthersError:
object
Type declaration
Member | Type |
---|---|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
Source
libs/sdk/src/lib/pool/core.ts:18
Quote
Quote: <
T
>object
Type parameters
Parameter |
---|
|
Type declaration
Member | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
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 |
---|
|
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 |
---|---|
|
|
|
|
Source
libs/sdk/src/lib/pool/swap-amounts.ts:14
TargetTokenAmount
TargetTokenAmount:
object
Type declaration
Member | Type |
---|---|
|
|
|
|
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 |
---|---|
|
|
|
|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
|
|
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
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 |
---|---|
|
|
Returns
AccountAddress
Source
Address()
Address<
T
>(type
,address
):Address
<T
>
Type parameters
Parameter |
---|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Address
< T
>
Source
INFT()
INFT(
id
):INFT
Parameters
Parameter | Type |
---|---|
|
|
Returns
INFT
Source
libs/sdk/src/lib/inft/core.ts:10
Pool()
Pool(
address
):Pool
Parameters
Parameter | Type |
---|---|
|
|
Returns
Pool
Source
libs/sdk/src/lib/pool/core.ts:11
Token()
Token(
address
):Token
Parameters
Parameter | Type |
---|---|
|
|
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 |
---|---|
|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/liquidity/add.ts:15
addSwapFee()
addSwapFee(
xfai
,amount
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
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 |
---|---|---|
|
| 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 |
---|---|
|
|
|
|
|
|
|
|
|
|
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 |
---|---|---|
|
| |
|
| - |
Returns
string
unix timestamp
Source
libs/sdk/src/lib/xfai-utils.ts:62
calculatePriceImpact()
calculatePriceImpact(
input
,output
):number
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
number
Source
libs/sdk/src/lib/xfai-utils.ts:217
calculateShare()
calculateShare(
inftState
,input
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
BigNumber
Source
libs/sdk/src/lib/inft/core.ts:60
calculateSwapFee()
calculateSwapFee(
xfai
,amount
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
BigNumber
Source
libs/sdk/src/lib/pool/core.ts:85
delayMs()
delayMs(
ms
):Promise
<unknown
>
Parameters
Parameter | Type |
---|---|
|
|
Returns
Promise
< unknown
>
Source
libs/sdk/src/lib/xfai-utils.ts:166
deriveToAddress()
deriveToAddress(
__namedParameters
):Promise
<string
>
Parameters
Parameter | Type |
---|---|
|
|
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 |
---|---|---|
|
| |
|
|
Returns
BigNumber
amountIn
Source
libs/sdk/src/lib/xfai-utils.ts:102
getAdjustedAmountOutput()
getAdjustedAmountOutput(
pool
,ethIn
):BigNumber
Parameters
Parameter | Type | Description |
---|---|---|
|
| |
|
| - |
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 |
---|---|---|
|
| |
|
|
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 |
---|---|---|
|
| |
|
|
Returns
BigNumber
xfOut
Source
libs/sdk/src/lib/xfai-utils.ts:133
getCore()
getCore(
xfai
):IXfaiV0Core
Parameters
Parameter | Type |
---|---|
|
|
Returns
IXfaiV0Core
Source
libs/sdk/src/lib/xfai-core.ts:10
getFactory()
getFactory(
xfai
):IXfaiFactory
Parameters
Parameter | Type |
---|---|
|
|
Returns
IXfaiFactory
Source
getINFT()
getINFT(
xfai
,signer
=false
):IXfaiINFT
Parameters
Parameter | Type | Default value |
---|---|---|
|
|
|
|
|
|
Returns
IXfaiINFT
Source
libs/sdk/src/lib/inft/core.ts:32
getINFTBalance()
getINFTBalance(
xfai
,account
):Promise
<number
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< number
>
Source
libs/sdk/src/lib/inft/balance.ts:14
getINFTOwnership()
getINFTOwnership(
xfai
,inft
):Promise
< {owner
:string
;} >
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< {owner
: string
;} >
Source
libs/sdk/src/lib/inft/core.ts:39
getINFTPeriphery()
getINFTPeriphery(
xfai
,signer
):IInfinityNFTPeriphery
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
IInfinityNFTPeriphery
Source
libs/sdk/src/lib/periphery/core.ts:8
getINFTPeripheryAllowance()
getINFTPeripheryAllowance(
xfai
,wallet
,token
):BigNumber
|Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
Returns
BigNumber
| Promise
< BigNumber
>
Source
libs/sdk/src/lib/xfai-token.ts:94
getINFTState()
getINFTState(
xfai
,options
):Promise
<INFTState
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< INFTState
>
Source
libs/sdk/src/lib/inft/core.ts:50
getINFTTokenBalance()
getINFTTokenBalance(
xfai
,inft
,token
):Promise
<INFTBalance
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
Returns
Promise
< INFTBalance
>
Source
libs/sdk/src/lib/inft/balance.ts:18
getINFTTokenBalanceMulticall()
getINFTTokenBalanceMulticall<
T
>(xfai
,inft
,tokens
,allowFailure
):Promise
<Record
<Token
["address"
],T
extendstrue
?undefined
|INFTBalance
:INFTBalance
> >
Type parameters
Parameter |
---|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
|
|
Returns
Promise
< Record
< string
| number
, BigNumber
> >
Source
libs/sdk/src/lib/inft/balance.ts:67
getInftImage()
getInftImage(
inft
,quality
?):string
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
string
Source
libs/sdk/src/lib/inft/core.ts:17
getOraclePrice()
getOraclePrice(
xfai
,token
):Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< BigNumber
>
Source
libs/sdk/src/lib/xfai-token.ts:150
getPeriphery()
getPeriphery(
xfai
,signer
):IXfaiV0Periphery03
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
IXfaiV0Periphery03
Source
libs/sdk/src/lib/periphery/core.ts:4
getPeripheryAllowance()
getPeripheryAllowance(
xfai
,wallet
,token
):BigNumber
|Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
Returns
BigNumber
| Promise
< BigNumber
>
Source
libs/sdk/src/lib/xfai-token.ts:84
getPool()
getPool(
xfai
,pool
):IXfaiPool
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
IXfaiPool
Source
libs/sdk/src/lib/pool/core.ts:23
getPoolBalance()
getPoolBalance(
xfai
,wallet
,token
):Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
|
|
Returns
Promise
< Record
< string
, BigNumber
| undefined
> >
Source
libs/sdk/src/lib/pool/multicall.ts:8
getPoolFromToken()
getPoolFromToken(
xfai
,token
):Pool
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Pool
Source
libs/sdk/src/lib/pool/core.ts:35
getPoolFromTokenAddress()
getPoolFromTokenAddress(
xfai
,token
):IXfaiPool
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
IXfaiPool
Source
libs/sdk/src/lib/pool/core.ts:27
getPoolLiquidityMulticall()
getPoolLiquidityMulticall(
xfai
,tokens
):Promise
<Record
<string
|number
,undefined
|BigNumber
> >
Parameters
Parameter | Type |
---|---|
|
|
|
|
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 |
---|---|
|
|
|
|
Returns
Promise
< string
>
Source
libs/sdk/src/lib/pool/core.ts:31
getPoolState()
getPoolState(
xfai
,pool
,options
={}
):Promise
<PoolState
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
Returns
Promise
< PoolState
>
Source
libs/sdk/src/lib/pool/core.ts:45
getPoolStateMulticall()
getPoolStateMulticall(
xfai
,poolsOrTokens
):Promise
< {} >
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< {} >
Source
libs/sdk/src/lib/pool/core.ts:53
getPoolSupply()
getPoolSupply(
xfai
,token
):Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< BigNumber
>
Source
libs/sdk/src/lib/pool/balance.ts:18
getPoolTokenBalance()
getPoolTokenBalance(
xfai
,token
):Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
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 |
---|---|
|
|
|
|
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 |
---|---|---|
|
| |
|
|
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 |
---|---|---|
|
| |
|
|
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 |
---|---|
| - |
|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
---|---|
|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 |
---|---|
|
|
Parameters
Parameter | Type | Description |
---|---|---|
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
| - |
|
|
Returns
SwapAmount
tokenOutAmount
Source
libs/sdk/src/lib/pool/swap-amounts.ts:26
getToken()
getToken(
xfai
,token
):IERC20Metadata
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
IERC20Metadata
Source
libs/sdk/src/lib/xfai-token.ts:25
getTokenBalance()
getTokenBalance(
xfai
,wallet
,token
):Promise
<BigNumber
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
|
|
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 |
---|---|
|
|
|
|
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 |
---|---|---|
|
| 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 |
---|---|
|
|
|
|
Returns
Token
| Pool
Source
libs/sdk/src/lib/xfai-token.ts:143
harvestINFT()
harvestINFT(
xfai
,inft
,token
,amountOut
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/inft/harvest.ts:6
harvestInftErc20()
harvestInftErc20(
xfai
,inft
,token
,amountOut
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/inft/harvest.ts:23
harvestInftEth()
harvestInftEth(
xfai
,inft
,amountOut
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/inft/harvest.ts:18
isNativeToken()
isNativeToken(
token
):boolean
Parameters
Parameter | Type |
---|---|
|
|
Returns
boolean
Source
libs/sdk/src/lib/xfai-token.ts:22
isParsedEthersError()
isParsedEthersError(
error
):error is ParsedEthersError
Parameters
Parameter | Type |
---|---|
|
|
Returns
error is ParsedEthersError
Source
libs/sdk/src/lib/xfai-core.ts:14
isSharedToken()
isSharedToken(
xfai
,token
):boolean
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
boolean
Source
libs/sdk/src/lib/xfai-token.ts:19
isUnderlyingToken()
isUnderlyingToken(
xfai
,token
):boolean
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
boolean
Source
libs/sdk/src/lib/xfai-token.ts:13
isWrappedNativeToken()
isWrappedNativeToken(
xfai
,token
):boolean
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
boolean
Source
libs/sdk/src/lib/xfai-token.ts:16
max()
max(
a
,b
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
BigNumber
Source
libs/sdk/src/lib/xfai-utils.ts:69
min()
min(
a
,b
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
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
extendstrue
?undefined
|Awaited
<ReturnType
<ReturnType
<T
["connect"
] >["callStatic"
][F
] > > :Awaited
<ReturnType
<ReturnType
<T
["connect"
] >["callStatic"
][F
] > > > >
Type parameters
Parameter |
---|
|
|
|
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
|
|
|
|
|
|
| ( |
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 |
---|---|---|
|
| |
|
|
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 |
---|---|---|
|
| |
|
|
Returns
BigNumber
amount with positive slippage
Source
libs/sdk/src/lib/xfai-utils.ts:162
quote()
quote<
T
>(__namedParameters
):QuoteResult
<T
>
Type parameters
Parameter |
---|
|
Parameters
Parameter | Type |
---|---|
|
|
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 |
---|---|
|
|
|
|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/liquidity/remove.ts:14
requestAllowance()
requestAllowance(
xfai
,token
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/xfai-token.ts:66
requestINFTAllowance()
requestINFTAllowance(
xfai
,token
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
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 |
---|---|---|
|
| |
|
|
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 |
---|---|
|
|
|
|
|
|
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/inft/stake.ts:15
subtractSwapFee()
subtractSwapFee(
xfai
,amount
):BigNumber
Parameters
Parameter | Type |
---|---|
|
|
|
|
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 |
---|---|
|
|
Parameters
Parameter | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| |
|
| - |
|
|
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 |
---|---|
|
|
Parameters
Parameter | Type | Description |
---|---|---|
|
| |
|
| |
|
| |
|
| |
|
| - |
|
| |
|
|
Returns
Promise
< PopulatedTransaction
>
Source
libs/sdk/src/lib/periphery/swap/index.ts:19
transfer()
transfer(
xfai
,inft
,newOwner
):Promise
<PopulatedTransaction
>
Parameters
Parameter | Type |
---|---|
|
|
|
|
|
|
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 |
---|---|---|
|
| 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 |
---|---|---|
|
| 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
Last updated