Aggregator API(V3)
Price Quote
Quote the price of a specific trading pair
GET
https://open-api.openocean.finance/v3/:chain/quote
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
inTokenAddress* | string | in token address |
outTokenAddress* | string | out token address |
amount* | string | Please set token amount without decimals.
e.g.
1.00 ETH set as 1.23 USDC set as |
gasPrice* | string | Please set the gas price in GWEI without decimals
e.g. 14 GWEI set as |
slippage | string | Define the acceptable slippage level by inputting a percentage value within the range of 0.05 to 50. e.g. 1% slippage set as 1 default value 1 |
disabledDexIds | string | ID of dexes could be access through dexList endpoint |
enabledDexIds | string | ID of dexes could be access through dexList endpoint
P.S. |
Building Transaction
To obtain a more accurate gas limit, we suggest calling the ‘’est_gas‘’ function from a reliable RPC before submitting the transaction on chain.
Also, try to call 'eth.estamiteGas()' before sendTransaction and renew the estimatedGas to ensure the transaction can be done successfully.
Note that, 'estimatedGas' is only a reference provided, please adjust by your need.
Building Transaction
GET
https://open-api.openocean.finance/v3/:chain/swap_quote
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
inTokenAddress* | string | in token address |
outTokenAddress* | string | out token address |
disabledDexIds | string? | ID of dexes could be access through dexList endpoint |
slippage* | number | Define the acceptable slippage level by inputting a percentage value within the range of 0.05 to 50. e.g. 1% slippage set as |
gasPrice* | string | Please set the gas price in GWEI without decimals
e.g. 14 GWEI set as |
amount* | string | Please set token amount without decimals.
e.g.
1.00 ETH set as 1.23 USDC set as |
account* | string | seller's address, please ensure that it has been approved to spend the necessary amount of inTokenAddress |
referrer | string? | The wallet address used to be mark as partners and receive an extra referrerFee from user. |
referrerFee | number? | Specify the percentage of in-token you wish to receive from the transaction, within the range of 0% to 3%, with 1% represented as '1', in the range of 0.01 to 3. e.g. 1.2% fee set as |
enabledDexIds | string | ID of dexes could be access through dexList endpoint
P.S. |
sender | string | The caller address.
Token Delivery Logic
If a |
Get Transaction
Get Transaction
GET
https://open-api.openocean.finance/v3/:chain/getTransaction
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
hash* | string | transaction hash |
Get Token Lists
Get Tokens Lists
GET
https://open-api.openocean.finance/v3/:chain/tokenList
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
Get Dexes List
Get Dexes List
GET
https://open-api.openocean.finance/v3/:chain/dexList
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
Get Transaction Hash
Get Transaction Hash
GET
https://open-api.openocean.finance/v3/:chain/getTxs
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
account* | string | user's wallet address |
pageSize* | number | The amount of tx hash you wish to receive |
Get Balance
Get Balance from wallet
GET
https://open-api.openocean.finance/v3/:chain/getBalance
Query Parameters
Name | Type | Description |
---|---|---|
inTokenAddress* | string | Please enter the token addresses, separating each address with a comma. You may enter up to five tokens. |
account* | string | user's wallet address |
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
Create Wallet
Create Wallet
GET
https://open-api.openocean.finance/v3/:chain/createWallet
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
Get gasPrice
Get gasPrice
GET
https://open-api.openocean.finance/v3/:chain/gasPrice
Query Parameters
Name | Type | Description |
---|---|---|
chain* | string | Please refer to "supported chains" for the corresponding chain codes/chain ID |
Last updated