LogoLogo
App
  • Overview
  • Partner Fees
  • Base URL
  • Quoting
    • Native Quote
    • Token to Token Quote
  • Swaps
    • Native Swaps
    • Token to Token Swaps
Powered by GitBook
On this page
  1. Quoting

Native Quote

PreviousBase URLNextToken to Token Quote

Last updated 3 months ago

Get quotes for swapping between native currency and tokens

get

Returns the best quote for buying or selling tokens with native currency. Token decimals are automatically detected using ERC20 standard calls.

Query parameters
actionstring · enumRequired

The swap direction - either buy tokens with native currency, or sell tokens for native currency

Example: buyPossible values:
tokenAddressstringRequired

The token address to buy or sell

Example: 0x1234567890123456789012345678901234567890Pattern: ^0x[a-fA-F0-9]{40}$
amountstringRequired

The amount as a BigInt string. For buy - This is the amount of native currency to spend. For sell - This is the amount of tokens to sell.

Example: 1000000000000000000
feeBpsinteger · max: 10000Optional

Partner fee in basis points (0-10000)

Example: 25
feeRecipientstringOptional

Address to receive the partner fee

Example: 0xabcdef1234567890abcdef1234567890abcdef12Pattern: ^0x[a-fA-F0-9]{40}$
Responses
200
Successful quote response
application/json
400
Invalid request parameters
application/json
404
No quotes found
application/json
500
Internal server error
application/json
get
GET /api/v1/quotes/native HTTP/1.1
Host: api.coal.ag
Accept: */*
{
  "amountOutNative": "985000000000000000",
  "quoteData": "eyJ0b2tlbk91dCI6IjB4MTIzNDU2Nzg5MDEyMzQ1Njc4OTAxMjM0NTY3ODkwMTIzNDU2Nzg5MCIsImFtb3VudEluTmF0aXZlIjoiMTAwMDAwMDAwMDAwMDAwMDAwMCIsImFtb3VudE91dEluVG9rZW5zIjoiOTg1MDAwMDAwMDAwMDAwMDAwIiwidG9rZW5PdXREZWNpbWFscyI6MTgsImV4Y2hhbmdlIjowLCJwYXJhbXMiOnsic3RhYmxlIjpmYWxzZSwidGlja1NwYWNpbmciOjAsImZlZSI6MCwiYmluU3RlcCI6IjAiLCJyZXZlcnNlZCI6ZmFsc2V9fQ=="
}