OpenAPI Specification
openapi: 3.0.0
info:
title: LI.FI Earn advanced Gas API
description: Enterprise DeFi yield discovery and tracking API
version: 0.1.0
contact: {}
servers:
- url: https://earn.li.fi
description: Production
security:
- x-lifi-api-key: []
tags:
- name: Gas
paths:
/v1/gas/status:
get:
parameters:
- example: '0x74546ce8aac58d33c212474293dcfeeadecef115847da75131a2ff6692e03b96'
name: txHash
description: The transaction hash that started the gas refilling process
schema:
type: string
in: query
required: true
- name: x-lifi-api-key
description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
schema:
type: string
in: header
responses:
'200':
$ref: '#/components/responses/LIFuelStatusResponse'
summary: Get status information about a lifuel transaction
tags:
- Gas
/v1/gas/refetch:
get:
parameters:
- example: '0x74546ce8aac58d33c212474293dcfeeadecef115847da75131a2ff6692e03b96'
name: txHash
description: The transaction hash that started the gas refilling process
schema:
type: string
in: query
required: true
- example: POL
name: chainId
description: The chain where the deposit was originally made
schema:
type: string
in: query
required: true
- name: x-lifi-api-key
description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
schema:
type: string
in: header
responses:
'200':
$ref: '#/components/responses/LIFuelStatusResponse'
deprecated: true
summary: In case a transaction was missed by a relayer, this endpoint can be used to force a tx to be re-fetched.
tags:
- Gas
/v1/gas/suggestion/{chain}:
get:
parameters:
- example: 137
name: chain
description: Chain from which gas prices should be shown (can be a chain id or a chain key)
schema:
type: string
in: path
required: true
- example: 100
name: fromChain
description: If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.
schema:
type: string
in: query
- example: xDai
name: fromToken
description: If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.
schema:
type: string
in: query
- name: x-lifi-api-key
description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
schema:
type: string
in: header
responses:
'200':
$ref: '#/components/responses/GasSuggestionResponse'
summary: Get a gas suggestion for the specified chain
description: 'Endpoint to retrieve a suggestion on how much gas is needed on the requested chain. The suggestion is based on the average price of 10 approvals and 10 uniswap based swaps via LI.FI on the specified chain.
If `fromChain` and `fromToken` are specified, the result will contain information about how much `fromToken` amount the user has to send to receive the suggested gas amount on the requested chain.'
tags:
- Gas
/v1/gas/prices:
get:
tags:
- Gas
parameters:
- name: x-lifi-api-key
description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
schema:
type: string
in: header
responses:
'200':
$ref: '#/components/responses/GasPricesResponse'
summary: Get gas prices for enabled chains
description: This endpoint can be used to get the most recent gas prices for the enabled chains in the server.
/v1/gas/prices/{chainId}:
get:
tags:
- Gas
parameters:
- example: 137
name: chainId
description: ChaindId from which gas prices should be shown
schema:
type: string
in: path
required: true
- name: x-lifi-api-key
description: Authentication header, register in the LI.FI Partner Portal (https://portal.li.fi/ ) to get your API Key.
schema:
type: string
in: header
responses:
'200':
$ref: '#/components/responses/GasPricesResponse'
'400':
$ref: '#/components/responses/InvalidRoutesRequest'
summary: Get gas price for the specified chainId
description: This endpoint can be used to get the most recent gas prices for the supplied chainId.
components:
schemas:
GasPrice:
type: object
properties:
standard:
type: number
fast:
type: number
fastest:
type: number
lastUpdated:
type: number
Token:
title: Root Type for Token
description: Representation of a Token
required:
- address
- chainId
- decimals
- name
- symbol
type: object
properties:
address:
description: Address of the token
type: string
decimals:
format: number
description: Number of decimals the token uses
type: number
symbol:
description: Symbol of the token
type: string
chainId:
format: number
description: Id of the token's chain
type: number
coinKey:
description: Identifier for the token
type: string
name:
description: Name of the token
type: string
logoURI:
description: Logo of the token
type: string
priceUSD:
description: Token price in USD
type: string
example:
address: '0x8f3cf7ad23cd3cadbd9735aff958023239c6a063'
symbol: DAI
decimals: 18
chainId: 137
name: (PoS) Dai Stablecoin
coinKey: DAI
priceUSD: '1'
logoURI: https://static.debank.com/image/matic_token/logo_url/0x8f3cf7ad23cd3cadbd9735aff958023239c6a063/549c4205dbb199f1b8b03af783f35e71.png
LIFuelStatus:
type: object
properties:
status:
$ref: '#/components/schemas/LIFuelStatusStateEnum'
sending:
$ref: '#/components/schemas/TxInfo'
receiving:
$ref: '#/components/schemas/TxInfo'
TxInfo:
type: object
properties:
txHash:
type: string
example: '0x74546ce8aac58d33c212474293dcfeeadecef115847da75131a2ff6692e03b96'
txLink:
type: string
example: https://polygonscan.com/tx/0x74546ce8aac58d33c212474293dcfeeadecef115847da75131a2ff6692e03b96
amount:
description: The amount of token that will be / has been relayed
type: string
example: '10000'
token:
$ref: '#/components/schemas/Token'
chainId:
type: number
example: 137
block:
type: number
example: 39397739
LIFuelStatusStateEnum:
enum:
- NOT_FOUND
- PENDING
- DONE
responses:
GasSuggestionResponse:
description: "{\n \"available\": true,\n \"recommended\": {\n \"token\": {\n \"address\": \"0x0000000000000000000000000000000000000000\",\n \"chainId\": 137,\n \"symbol\": \"MATIC\",\n \"decimals\": 18,\n \"name\": \"MATIC\",\n \"priceUSD\": \"1.219821\",\n \"logoURI\": \"https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png\",\n \"coinKey\": \"MATIC\"\n },\n \"amount\": \"190510922050970750\",\n \"amountUsd\": \"0.23\"\n },\n \"limit\": {\n \"token\": {\n \"address\": \"0x0000000000000000000000000000000000000000\",\n \"chainId\": 137,\n \"symbol\": \"MATIC\",\n \"decimals\": 18,\n \"name\": \"MATIC\",\n \"priceUSD\": \"1.219821\",\n \"logoURI\": \"https://static.debank.com/image/matic_token/logo_url/matic/6f5a6b6f0732a7a235131bd7804d357c.png\",\n \"coinKey\": \"MATIC\"\n },\n \"amount\": \"1639584824330782959\",\n \"amountUsd\": \"2\"\n },\n \"fromToken\": {\n \"address\": \"eth\",\n \"symbol\": \"ETH\",\n \"decimals\": 18,\n \"chainId\": 1,\n \"name\": \"ETH\",\n \"coinKey\": \"ETH\",\n \"priceUSD\": \"1622.39\",\n \"logoURI\": \"https://static.debank.com/image/token/logo_url/eth/935ae4e4d1d12d59a99717a24f2540b5.png\"\n },\n \"fromAmount\": \"141766159801281\"\n}"
GasPricesResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/GasPrice'
description: Gas Prices for the supplied chainID
InvalidRoutesRequest:
description: Invalid Routes Request
LIFuelStatusResponse:
content:
application/json:
schema:
$ref: '#/components/schemas/LIFuelStatus'
description: The status of a lifuel operation
securitySchemes:
x-lifi-api-key:
type: apiKey
in: header
name: x-lifi-api-key