Documentation
¶
Index ¶
- Variables
- type ChainsRes
- type Client
- func (c *Client) Chains(ctx context.Context) ([]string, error)
- func (c *Client) Quote(ctx context.Context, in *dexmodel.DexQuoteIn) (*dexmodel.DexQuoteOut, error)
- func (c *Client) Status(ctx context.Context, in *dexmodel.DexCheckTxIn) (*dexmodel.DexCheckTxOut, error)
- func (c *Client) Tokens(ctx context.Context) error
- type ClientOption
- type Error
- type QuoteReq
- type QuoteRes
- type StatusRes
- type Token
- type TokensRes
Constants ¶
This section is empty.
Variables ¶
View Source
var ChainMapper = map[string]string{
"eth": "ETH",
"arb": "ARB",
"bas": "BASE",
"hpl": "HYPE",
"hyp": "HYPEEVM",
"mon": "MON",
"bsc": "BNB",
"opt": "OP",
"pol": "POLYGON",
"ava": "AVAXC",
"lna": "LINEA",
"btc": "BTC",
"sol": "SOL",
"sui": "SUI",
}
View Source
var ChainMapperReverse = func() map[string]string { m := make(map[string]string, len(ChainMapper)) for k, v := range ChainMapper { m[v] = k } return m }()
View Source
var RateLimitFree = dex.RateLimit{QPS: 1, Burst: 2}
RateLimitFree is LiFi's public tier (no integrator key): 60 req/min (1 QPS, burst 2). Integrator keys can lift this — pass a custom dex.RateLimit if you have a higher-tier arrangement with LiFi.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(opts ...ClientOption) *Client
func (*Client) Quote ¶
func (c *Client) Quote(ctx context.Context, in *dexmodel.DexQuoteIn) (*dexmodel.DexQuoteOut, error)
func (*Client) Status ¶
func (c *Client) Status(ctx context.Context, in *dexmodel.DexCheckTxIn) (*dexmodel.DexCheckTxOut, error)
type ClientOption ¶
type ClientOption func(*clientConfig)
func WithIntegrator ¶
func WithIntegrator(name string) ClientOption
WithIntegrator overrides the integrator tag LiFi sees on the request. Defaults to "onerootapp"; consumers should pick their own unique string if they're deploying under a different brand.
func WithRateLimit ¶
func WithRateLimit(r dex.RateLimit) ClientOption
type QuoteReq ¶
type QuoteReq struct {
FromChain string
ToChain string
FromToken string
ToToken string
FromAmount string
FromAddress string
ToAddress string
Slippage string
Fee string
// FromAmountForGas — fraction of FromAmount (smallest unit) routed
// through LiFi's GasZip integration so the destination chain
// receives some native gas. Empty disables refuel.
FromAmountForGas string
}
type QuoteRes ¶
type QuoteRes struct {
Error
ID string `json:"id"`
Type string `json:"type"`
Tool string `json:"tool"`
TransactionId string `json:"transactionId"`
ToolDetails struct {
Key string `json:"key"`
Name string `json:"name"`
LogoURI string `json:"logoURI"`
} `json:"toolDetails"`
Action struct {
FromChainID int `json:"fromChainId"`
ToChainID int `json:"toChainId"`
FromAmount string `json:"fromAmount"`
Slippage float64 `json:"slippage"`
FromToken struct {
Address string `json:"address"`
Symbol string `json:"symbol"`
Decimals int `json:"decimals"`
} `json:"fromToken"`
ToToken struct {
Address string `json:"address"`
Symbol string `json:"symbol"`
Decimals int `json:"decimals"`
} `json:"toToken"`
} `json:"action"`
Estimate struct {
FromAmount string `json:"fromAmount"`
ToAmount string `json:"toAmount"`
ToAmountMin string `json:"toAmountMin"`
FromAmountUSD string `json:"fromAmountUSD"`
ToAmountUSD string `json:"toAmountUSD"`
ExecutionDuration int64 `json:"executionDuration"`
GasCosts []struct {
Type string `json:"type"`
Estimate string `json:"estimate"`
Amount string `json:"amount"`
AmountUSD string `json:"amountUSD"`
} `json:"gasCosts"`
FeeCosts []struct {
Name string `json:"name"`
Amount string `json:"amount"`
AmountUSD string `json:"amountUSD"`
} `json:"feeCosts"`
ApprovalAddress string `json:"approvalAddress"`
} `json:"estimate"`
TransactionRequest struct {
To string `json:"to"`
Data string `json:"data"`
Value string `json:"value"`
From string `json:"from,omitempty"`
ChainID int `json:"chainId,omitempty"`
GasPrice string `json:"gasPrice,omitempty"`
GasLimit string `json:"gasLimit,omitempty"`
} `json:"transactionRequest"`
}
type StatusRes ¶
type StatusRes struct {
Status string `json:"status"`
Substatus string `json:"substatus"`
SubstatusMsg string `json:"substatusMessage"`
Sending struct {
TxHash string `json:"txHash"`
ChainID int `json:"chainId"`
Amount string `json:"amount"`
} `json:"sending"`
Receiving struct {
TxHash string `json:"txHash"`
ChainID int `json:"chainId"`
Amount string `json:"amount"`
} `json:"receiving"`
}
Click to show internal directories.
Click to hide internal directories.