🤹‍♂️Swap

Gets the tokens available for swapping.

get

This route gets all the tokens available for swapping.The route first queries and finds the all the projects in our database.The route then returns an array of token objects.

Query parameters
limitnumberOptionalDefault: 10
offsetnumberOptionalDefault: 0
sortstring · enumOptionalDefault: networkPossible values:
directionstring · enumOptionalDefault: DESCPossible values:
Responses
200
Successful
application/json
get
GET /api/v1/swap/tokens HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "tokens": [
      {
        "id": "11839fbd-0b72-4704-86cb-04db0ca40a13",
        "name": "Hello World.",
        "address": "0xfec8d8ad28af2b66c6b9b03977eee7056338bfe4",
        "symbol": "ETH",
        "decimals": 18,
        "network": "ethereum"
      }
    ]
  }
}

Gets an exact quote on a binance token.

get

This route gets the exact quote on a given binance token.The route first gets the input amount and then calculates the exact quote of a token against another token.The route then returns the quote price.

Query parameters
amountstringRequired
address0stringRequired
decimals0stringRequired
address1stringRequired
decimals1stringRequired
Responses
200
Successful
application/json
get
GET /api/v1/swap/quote/binance HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "quote": 768,
    "amount": 768,
    "decimal": 18,
    "amountOutMin": "0x00",
    "path": [
      "0xfec8d8ad28af2b66c6b9b03977eee7056338bfe4"
    ],
    "gasPriceWei": 1500014394
  }
}

Gets an exact quote on an ethereum token.

get

This route gets the exact quote on a given ethereum token.The route first gets the input amount and then calculates the exact quote of a token against another token.The route then returns the quote price.

Query parameters
amountstringRequired
address0stringRequired
decimals0stringRequired
address1stringRequired
decimals1stringRequired
Responses
200
Successful
application/json
get
GET /api/v1/swap/quote/ethereum HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "quote": 768,
    "amount": 768,
    "decimal": 18,
    "calldata": "0x5ae401dc0000000000000000000000000000000000000000000000000000000062b9601c0000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000",
    "path": [
      "0xfec8d8ad28af2b66c6b9b03977eee7056338bfe4"
    ],
    "value": "0x00",
    "gasPriceWei": 1500014394
  }
}

Swap native BNB with token on the Binance blockchain.

post

This route swaps native BNB with token or vice versa on the Binance blockchain.The contract first wraps the BNB internally and then swaps it.The route then creates and broadcasts the transaction to the Binance blockchain. found.

body
Path parameters
keystringRequired
Responses
200
Successful
application/json
post
POST /api/v1/swap/native/binance/{key} HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "txId": "0xc3e88985615871b642b47dee03e26a1704543a93456afa1f2fe029ca75b8404c"
  }
}

Swap tokens on the Binance blockchain.

post

This route swaps tokens on the Binance blockchain.The route first creates a transaction from the payload provided and then approves the funds by calling the contract.The route then broadcasts the transaction to the Binance blockchain

body
Path parameters
keystringRequired
Responses
200
Successful
application/json
post
POST /api/v1/swap/tokens/binance/{key} HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "txId": "0xc3e88985615871b642b47dee03e26a1704543a93456afa1f2fe029ca75b8404c"
  }
}

Swap tokens on the Ethereum blockchain.

post

This route swaps tokens on the Ethereum blockchain.The route first creates a transaction from the payload provided and then approves the funds by calling the contract.The route then broadcasts the transaction to the Ethereum blockchain.

body
Path parameters
keystringRequired
Responses
200
Successful
application/json
post
POST /api/v1/swap/tokens/ethereum/{key} HTTP/1.1
Host: www.dyorbackend.tk
Accept: */*
{
  "ok": true,
  "result": {
    "txId": "0xc3e88985615871b642b47dee03e26a1704543a93456afa1f2fe029ca75b8404c"
  }
}

Last updated