swagger.json

Overview

[swagger.json](/projects/291/68851) is an OpenAPI 3.0 specification document that defines the REST API for the [@shapeshiftoss/arbitrum-api](/projects/291/69034) project, version 10.0.0. This API primarily exposes endpoints to interact with an Arbitrum-based EVM-compatible blockchain node, enabling clients to:

This specification serves as a contract for client-server communication, detailing request formats, response schemas, error handling, and endpoint paths. It is used to generate client SDKs, API documentation, and server stubs, facilitating integration with the Arbitrum blockchain services.


Detailed Explanation of Components

Components

The file defines reusable **schemas** (data models) that describe the structure of API request and response payloads. These schemas ensure consistency across endpoints.

Schemas


1. BaseInfo


2. TokenBalance


3. Account


4. Transaction Related Schemas

**Key properties of `Tx`:**

**Usage:**


5. Error Schemas


6. SendTxBody


7. RPCRequest and RPCResponse

**Usage:** Used by `POST /api/v1/jsonrpc` to make arbitrary JSON-RPC calls or batch calls to the node.


8. TokenMetadata and TokenType

**Usage:** Returned by `GET /api/v1/metadata/token`.


9. GasEstimate and EstimateGasBody

**Usage:** Request/response for `POST /api/v1/gas/estimate`.


10. Fees and GasFees

**Usage:** Returned by `GET /api/v1/gas/fees`.


Paths (Endpoints)

Each path defines HTTP methods, parameters, request bodies, responses, and descriptions.

1. /api/v1/info [GET]

2. /api/v1/account/{pubkey} [GET]

3. /api/v1/account/{pubkey}/txs [GET]

4. /api/v1/tx/{txid} [GET]

5. /api/v1/send [POST]

6. /api/v1/jsonrpc [POST]

7. /api/v1/metadata/token [GET]

8. /api/v1/gas/estimate [POST]

9. /api/v1/gas/fees [GET]


Important Implementation Details and Algorithms


Interaction with Other Parts of the System


Usage Examples

Get Account Details

Request:

GET /api/v1/account/0xFFfFfFffFFfffFFfFFfFFFFFffFFFffffFfFFFfF

Response:

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

Send Raw Transaction

Request:

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

{
  "hex": "0xf86c808504a817c80082520894..."
}

Response:

"0x123abc..."  // Transaction hash string

Visual Diagram

Below is a Mermaid class diagram representing the key schemas and their relationships in this API specification:

classDiagram
    class BaseInfo {
        +string network
    }

    class TokenBalance {
        +string contract
        +number decimals
        +string name
        +string symbol
        +string type
        +string id
        +string balance
    }

    class Account {
        +string balance
        +string unconfirmedBalance
        +string pubkey
        +number nonce
        +TokenBalance[] tokens
    }

    class TokenTransfer {
        +string contract
        +number decimals
        +string name
        +string symbol
        +string type
        +string id
        +string from
        +string to
        +string value
    }

    class InternalTx {
        +string from
        +string to
        +string value
    }

    class Tx {
        +string txid
        +string blockHash
        +number blockHeight
        +number timestamp
        +string from
        +string to
        +number confirmations
        +string value
        +string fee
        +string gasLimit
        +string gasUsed
        +string gasPrice
        +number status
        +string inputData
        +TokenTransfer[] tokenTransfers
        +InternalTx[] internalTxs
    }

    class BaseTxHistory_Tx_ {
        +string cursor
        +string pubkey
        +Tx[] txs
    }

    class SendTxBody {
        +string hex
    }

    class RPCRequest {
        +string jsonrpc
        +string id
        +string method
        +any[] params
    }

    class RPCResponse {
        +string jsonrpc
        +string id
        +any result
        +Error error
    }

    class TokenMetadata {
        +string name
        +string description
        +Media media
    }

    class Media {
        +string type
        +string url
    }

    class GasEstimate {
        +string gasLimit
    }

    class EstimateGasBody {
        +string data
        +string from
        +string to
        +string value
    }

    class Fees {
        +string gasPrice
        +string maxFeePerGas
        +string maxPriorityFeePerGas
    }

    class GasFees {
        +string baseFeePerGas
        +Fees slow
        +Fees average
        +Fees fast
    }

    Account --> "tokens" TokenBalance
    Tx --> "tokenTransfers" TokenTransfer
    Tx --> "internalTxs" InternalTx
    BaseTxHistory_Tx_ --> "txs" Tx
    RPCResponse --> Error
    TokenMetadata --> Media
    GasFees --> Fees

Summary

This [swagger.json](/projects/291/68851) file is a comprehensive OpenAPI specification for the Arbitrum blockchain API provided by ShapeShift. It enables standardized access to blockchain data, transactions, tokens, and gas fee information, supporting both REST and JSON-RPC paradigms. The detailed schemas, error models, and path definitions facilitate reliable client integration and streamline blockchain interactions.