swagger.json


Overview

The **swagger.json** file is an OpenAPI 3.0 specification document describing the REST API for the [@shapeshiftoss/gnosis-api](/projects/291/69075) project (version 10.0.0). This API exposes endpoints to interact with an Ethereum Virtual Machine (EVM)-compatible blockchain node, providing features such as querying account data, transaction history, transaction details, sending transactions, JSON-RPC calls, token metadata, and gas fee estimations.

It defines the API's paths, HTTP methods, request/response schemas, parameters, and error responses in a machine-readable format. This specification is useful for generating client SDKs, API documentation, and automated testing tools.


Detailed Explanation of Components

1. Schemas (Components > Schemas)

Schemas define the structure of request and response payloads used throughout the API.

BaseInfo

TokenBalance

Account

BadRequestError

ValidationError

InternalServerError

TokenTransfer

InternalTx

Tx (Transaction)

BaseTxHistory_Tx_ / TxHistory

SendTxBody

RPCRequest

RPCResponse

TokenMetadata

TokenType

GasEstimate

EstimateGasBody

Fees

GasFees


2. API Paths and Operations

Path

HTTP Method

OperationId

Description

`/api/v1/info`

GET

GetInfo

Retrieve basic info about the running coinstack.

`/api/v1/account/{pubkey}`

GET

GetAccount

Get account details by pubkey (address).

`/api/v1/account/{pubkey}/txs`

GET

GetTxHistory

Get paginated transaction history by pubkey.

`/api/v1/tx/{txid}`

GET

GetTransaction

Get detailed info about a specific transaction.

`/api/v1/send`

POST

SendTx

Broadcast a raw serialized transaction hex.

`/api/v1/jsonrpc`

POST

DoRpcRequest

Make a JSON-RPC call(s) to the node.

`/api/v1/metadata/token`

GET

GetTokenMetadata

Retrieve metadata for a specific token (NFT).

`/api/v1/gas/estimate`

POST

EstimateGas

Estimate gas cost for a transaction.

`/api/v1/gas/fees`

GET

GetGasFees

Get current recommended gas fees for transactions.


3. Important Implementation Details


4. Interaction with Other System Components


Usage Examples

Example: Get Account Details

**Request:**

GET /api/v1/account/0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF HTTP/1.1
Accept: application/json

**Response (200 OK):**

{
  "balance": "0",
  "unconfirmedBalance": "0",
  "nonce": 0,
  "pubkey": "0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF",
  "tokens": [
    {
      "balance": "1337",
      "contract": "0xc770EEfAd204B5180dF6a14Ee197D99d808ee52d",
      "decimals": 18,
      "name": "FOX",
      "symbol": "FOX",
      "type": "ERC20"
    }
  ]
}

Example: Send Raw Transaction

**Request:**

POST /api/v1/send HTTP/1.1
Content-Type: application/json

{
  "hex": "0xf86c808504a817c80082520894f6...b844a9059cbb000000000000000..."
}

**Response (200 OK):**

"0x6850c6f3af68eb60a211af8f07f5b305375d0c94786b79a48371f5143953cb26"

Example: JSON-RPC Request (eth_blockNumber)

**Request:**

POST /api/v1/jsonrpc HTTP/1.1
Content-Type: application/json

{
  "jsonrpc": "2.0",
  "id": "test",
  "method": "eth_blockNumber",
  "params": []
}

**Response:**

{
  "jsonrpc": "2.0",
  "id": "test",
  "result": "0x1a4"
}

Visual Diagram: API Path and Schema Relationships

flowchart TD
    subgraph Paths
        Info[/GET /api/v1/info/]
        Account[/GET /api/v1/account/{pubkey}/]
        TxHistory[/GET /api/v1/account/{pubkey}/txs/]
        Transaction[/GET /api/v1/tx/{txid}/]
        SendTx[/POST /api/v1/send/]
        JsonRpc[/POST /api/v1/jsonrpc/]
        TokenMeta[/GET /api/v1/metadata/token/]
        GasEstimate[/POST /api/v1/gas/estimate/]
        GasFees[/GET /api/v1/gas/fees/]
    end

    subgraph Schemas
        BaseInfo[BaseInfo]
        AccountSchema[Account]
        TxHistorySchema[TxHistory]
        Tx[Tx]
        SendTxBody[SendTxBody]
        RPCRequest[RPCRequest]
        RPCResponse[RPCResponse]
        TokenMetadata[TokenMetadata]
        GasEstimateSchema[GasEstimate]
        GasFeesSchema[GasFees]
        ErrorSchemas[BadRequestError, ValidationError, InternalServerError]
    end

    Info -->|returns| BaseInfo
    Account -->|returns| AccountSchema
    TxHistory -->|returns| TxHistorySchema
    Transaction -->|returns| Tx
    SendTx -->|accepts| SendTxBody
    SendTx -->|returns| string
    JsonRpc -->|accepts| RPCRequest
    JsonRpc -->|returns| RPCResponse
    TokenMeta -->|returns| TokenMetadata
    GasEstimate -->|accepts| EstimateGasBody[EstimateGasBody]
    GasEstimate -->|returns| GasEstimateSchema
    GasFees -->|returns| GasFeesSchema

    AccountSchema -->|has| TokenBalance[TokenBalance]
    TxHistorySchema -->|contains| Tx
    Tx -->|contains| TokenTransfer[TokenTransfer]
    Tx -->|contains| InternalTx[InternalTx]
    RPCResponse -->|may contain| ErrorSchemas

Summary


This documentation provides a full understanding of the API described in the [swagger.json](/projects/291/68851) file and can serve as a reference for developers implementing clients or servers based on this specification.