{
  "openapi": "3.0.2",
  "info": {
    "title": "Minter Gate API",
    "description": "# Introduction\nMinter Gate is a service which provides to clients publish prepared transactions to Minter Network\n### Install from source\n- Download source from [GitHub](https://github.com/MinterTeam/explorer-gate)\n- Run `go mod download`\n- Run `go build -o ./build/gate ./cmd/gate.go`\n- Move `.env.prod` to `.env` and fill it or add this data to the OS environment\n- Run `./build/gate`\n\nYou can use SystemD to run the service. Example of systemd uint is [here](https://github.com/MinterTeam/explorer-gate/blob/master/explorer-gate.service)\n",
    "version": "2.13.0",
    "license": {
      "name": "MIT",
      "url": "https://github.com/MinterTeam/explorer-gate/blob/master/LICENSE"
    },
    "x-logo": {
      "url": "https://github.com/MinterTeam/minter-go-node/raw/master/minter-logo.svg?sanitize=true",
      "altText": "Minter logo"
    }
  },
  "servers": [
    {
      "url": "https://gate.minter.network/api",
      "description": "Main (production) server"
    }
  ],
  "paths": {
    "/v1/estimate/tx-commission": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Transaction commission.",
        "description": "Returns commission for transaction.",
        "parameters": [
          {
            "name": "transaction",
            "in": "query",
            "required": true,
            "description": "Transaction which have to be estimated",
            "schema": {
              "type": "string",
              "format": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/estimate/coin-sell": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Sell coins estimate.",
        "description": "Returns a number of coins you will get and commission for the transaction.",
        "parameters": [
          {
            "name": "coinToSell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to sell",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coinToBuy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "valueToSell",
            "in": "query",
            "required": true,
            "description": "Number of coins you sell (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinSellResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/estimate/coin-sell-all": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Sell all coins estimate.",
        "description": "Returns a number of coins you will get and commission for the transaction.",
        "parameters": [
          {
            "name": "coinToSell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to sell",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coinToBuy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "valueToSell",
            "in": "query",
            "required": true,
            "description": "Number of coins you sell (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          },
          {
            "name": "gasPrice",
            "in": "query",
            "required": true,
            "description": "Gas price (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 10000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinSellAllResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/estimate/coin-buy": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Buy coins estimate.",
        "description": "Returns a number of coins you have to pay and commission for the transaction.",
        "parameters": [
          {
            "name": "coinToSell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to pay",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coinToBuy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "valueToBuy",
            "in": "query",
            "required": true,
            "description": "Number of coins you going to buy (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinBuyResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/nonce/{address}": {
      "get": {
        "tags": [
          "Nonce"
        ],
        "summary": "Transactions count.",
        "description": "Returns a count of transactions for address.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "description": "Address",
            "schema": {
              "type": "string",
              "example": "Mx9bdd202c74f92ca4b6dc1090a0362afeed11d1f2"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetNonceResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/min-gas": {
      "get": {
        "tags": [
          "Gas"
        ],
        "summary": "Min gas.",
        "description": "Returns a minimun gas price.",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MinGasResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v1/transaction/push": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "summary": "Push transaction.",
        "description": "Send transaction to the network. Return hash of transactions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTransactionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/estimate_tx_commission/{transaction}": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Transaction commission.",
        "description": "Returns commission for transaction.",
        "parameters": [
          {
            "name": "transaction",
            "in": "path",
            "required": true,
            "description": "Transaction which have to be estimated",
            "schema": {
              "type": "string",
              "format": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateTransactionResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/estimate_coin_sell": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Sell coins estimate.",
        "description": "Returns a number of coins you will get and commission for the transaction.",
        "parameters": [
          {
            "name": "coin_to_sell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to sell",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coin_to_buy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "value_to_sell",
            "in": "query",
            "required": true,
            "description": "Number of coins you sell (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinSellResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/estimate_coin_sell_all": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Sell all coins estimate.",
        "description": "Returns a number of coins you will get and commission for the transaction.",
        "parameters": [
          {
            "name": "coin_to_sell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to sell",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coin_to_buy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "value_to_sell",
            "in": "query",
            "required": true,
            "description": "Number of coins you sell (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinSellAllResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/estimate_coin_buy": {
      "get": {
        "tags": [
          "Estimate"
        ],
        "summary": "Buy coins estimate.",
        "description": "Returns a number of coins you have to pay and commission for the transaction.",
        "parameters": [
          {
            "name": "coin_to_sell",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to pay",
            "schema": {
              "type": "string",
              "example": "BIP"
            }
          },
          {
            "name": "coin_to_buy",
            "in": "query",
            "required": true,
            "description": "Name of coin you going to buy",
            "schema": {
              "type": "string",
              "example": "SUPERCOIN"
            }
          },
          {
            "name": "value_to_buy",
            "in": "query",
            "required": true,
            "description": "Number of coins you have to pay (in PIP)",
            "schema": {
              "type": "integer",
              "format": "uint64",
              "example": 123456789000000000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/EstimateCoinBuyResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/nonce/{address}": {
      "get": {
        "tags": [
          "Nonce"
        ],
        "summary": "Transactions count.",
        "description": "Returns a count of transactions for address.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "description": "Address",
            "schema": {
              "type": "string",
              "example": "Mx9bdd202c74f92ca4b6dc1090a0362afeed11d1f2"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetNonceResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/min_gas_price": {
      "get": {
        "tags": [
          "Gas"
        ],
        "summary": "Min gas.",
        "description": "Returns a minimun gas price.",
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MinGasResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/send_transaction": {
      "post": {
        "tags": [
          "Transaction"
        ],
        "summary": "Push transaction.",
        "description": "Send transaction to the network. Return hash of transactions.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PushTransactionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTransactionResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/send_transaction/{tx}": {
      "get": {
        "tags": [
          "Transaction"
        ],
        "summary": "Push transaction.",
        "description": "Send transaction to the network. Return hash of transactions.",
        "parameters": [
          {
            "name": "tx",
            "in": "path",
            "required": true,
            "description": "Transaction",
            "schema": {
              "type": "string",
              "example": "f8820d018a4d4e540000000000000001a9e88a4d4e5400000000000000941b685a7c1e78726c48f619c497a07ed75fe00483872386f26fc10000808001b845f8431ca05ddcd3ffd2d5b21ffe4686cadbb462bad9facdd7ee0c2db31a7b6da6f06468b3a044df8fc8b4c4190ef352e0f70112527b6b25c4a22a67c9e9365ac7e511ac12f3"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PushTransactionResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/coin_info/{symbol}": {
      "get": {
        "tags": [
          "Coin"
        ],
        "summary": "Coin info.",
        "description": "Returns a coin data.",
        "parameters": [
          {
            "name": "symbol",
            "in": "path",
            "required": true,
            "description": "Coin ticker",
            "schema": {
              "type": "string",
              "example": "TESTCOIN"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoinInfoResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    },
    "/v2/coin_info_by_id/{id}": {
      "get": {
        "tags": [
          "Coin"
        ],
        "summary": "Coin info.",
        "description": "Returns a coin data.",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Coin id",
            "schema": {
              "type": "integer",
              "example": 1
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CoinInfoResponseV2"
                }
              }
            }
          },
          "400": {
            "description": "Bad request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/NodeErrorResponse"
                }
              }
            }
          },
          "default": {
            "description": "Unexpected error"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "NodeError": {
        "properties": {
          "code": {
            "type": "integer",
            "example": 1
          },
          "log": {
            "type": "string",
            "example": "Error explain"
          },
          "value": {
            "type": "integer",
            "example": 1000
          },
          "coin": {
            "type": "string",
            "example": "MNT"
          }
        },
        "required": [
          "code",
          "log"
        ]
      },
      "EstimateTransaction": {
        "properties": {
          "commission": {
            "type": "string",
            "example": "1000000000"
          }
        },
        "required": [
          "commission"
        ]
      },
      "EstimateCoinSell": {
        "properties": {
          "will_get": {
            "type": "string",
            "example": "100000"
          },
          "commission": {
            "type": "string",
            "example": "1000000000"
          }
        },
        "required": [
          "will_get",
          "commission"
        ]
      },
      "EstimateCoinSellAll": {
        "properties": {
          "will_get": {
            "type": "string",
            "example": "100000"
          }
        },
        "required": [
          "will_get",
          "commission"
        ]
      },
      "EstimateCoinBuy": {
        "properties": {
          "will_pay": {
            "type": "string",
            "example": "100000"
          },
          "commission": {
            "type": "string",
            "example": "1000000000"
          }
        },
        "required": [
          "will_pay",
          "commission"
        ]
      },
      "Nonce": {
        "properties": {
          "nonce": {
            "type": "string",
            "example": "1000"
          }
        },
        "required": [
          "nonce"
        ]
      },
      "MinGas": {
        "properties": {
          "gas": {
            "type": "string",
            "example": "1"
          }
        },
        "required": [
          "nonce"
        ]
      },
      "Transaction": {
        "properties": {
          "hash": {
            "type": "string",
            "example": "Mtd007083ed828a3c59040a66ae821d3cb3db9da2274f4d5a0f6d94db785229acf"
          }
        },
        "required": [
          "hash"
        ]
      },
      "CoinInfo": {
        "properties": {
          "id": {
            "type": "integer",
            "example": 123
          },
          "name": {
            "type": "string",
            "example": "Coin name"
          },
          "symbol": {
            "type": "string",
            "example": "TESTCOIN"
          },
          "volume": {
            "type": "string",
            "example": 3186177067737546000
          },
          "crr": {
            "type": "integer",
            "example": 10
          },
          "reserve_balance": {
            "type": "string",
            "example": 1.0698867807973617e+21
          },
          "max_supply": {
            "type": "string",
            "example": 1e+33
          },
          "owner_address": {
            "type": "string",
            "example": "Mx9bdd202c74f92ca4b6dc1090a0362afeed11d1f2"
          }
        }
      },
      "NodeErrorResponse": {
        "properties": {
          "error": {
            "$ref": "#/components/schemas/NodeError"
          }
        }
      },
      "EstimateTransactionResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/EstimateTransaction"
          }
        }
      },
      "EstimateCoinSellResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/EstimateCoinSell"
          }
        }
      },
      "EstimateCoinSellAllResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/EstimateCoinSellAll"
          }
        }
      },
      "EstimateCoinBuyResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/EstimateCoinBuy"
          }
        }
      },
      "GetNonceResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Nonce"
          }
        }
      },
      "MinGasResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/MinGas"
          }
        }
      },
      "PushTransactionResponse": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/Transaction"
          }
        }
      },
      "EstimateTransactionResponseV2": {
        "$ref": "#/components/schemas/EstimateTransaction"
      },
      "EstimateCoinSellResponseV2": {
        "$ref": "#/components/schemas/EstimateCoinSell"
      },
      "EstimateCoinSellAllResponseV2": {
        "$ref": "#/components/schemas/EstimateCoinSellAll"
      },
      "EstimateCoinBuyResponseV2": {
        "$ref": "#/components/schemas/EstimateCoinBuy"
      },
      "GetNonceResponseV2": {
        "$ref": "#/components/schemas/Nonce"
      },
      "MinGasResponseV2": {
        "$ref": "#/components/schemas/MinGas"
      },
      "PushTransactionResponseV2": {
        "$ref": "#/components/schemas/Transaction"
      },
      "CoinInfoResponseV2": {
        "$ref": "#/components/schemas/CoinInfo"
      },
      "PushTransactionRequest": {
        "properties": {
          "transaction": {
            "type": "string",
            "example": "f8820d018a4d4e540000000000000001a9e88a4d4e5400000000000000941b685a7c1e78726c48f619c497a07ed75fe00483872386f26fc10000808001b845f8431ca05ddcd3ffd2d5b21ffe4686cadbb462bad9facdd7ee0c2db31a7b6da6f06468b3a044df8fc8b4c4190ef352e0f70112527b6b25c4a22a67c9e9365ac7e511ac12f3"
          }
        }
      }
    }
  }
}
