packages feed

haskoin-store 1.10.0 → 1.10.1

raw patch · 6 files changed

+60/−36 lines, 6 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

CHANGELOG.md view
@@ -6,6 +6,22 @@  ## [Unreleased] +## [1.10.1] - 2026-11-12++### Changed+- `swagger.yaml` names one server, `./`: the server that served it,+  wherever it is mounted. It no longer lists the servers of api.haskoin.com,+  which describe whatever version those run, not the server in front of+  you. The server serves the file as it is, instead of adding itself to+  that list.+- The reference page at `/` has no list of servers to choose from and no+  bar to load another description: it shows the reference of the server+  that serves it, and nothing else.++### Fixed+- The licence links of `swagger.yaml` and `README.md` pointed to a file+  that does not exist, and the version in `swagger.yaml` said 1.9.1.+ ## [1.10.0] - 2026-11-12  The API speaks JSON only. Its binary format is gone, from the server and
README.md view
@@ -3,7 +3,7 @@ [![CI](https://github.com/jprupp/haskoin-store/actions/workflows/ci.yml/badge.svg)](https://github.com/jprupp/haskoin-store/actions/workflows/ci.yml) [![Hackage haskoin-store](https://img.shields.io/hackage/v/haskoin-store.svg?label=haskoin-store)](https://hackage.haskell.org/package/haskoin-store) [![Hackage haskoin-store-data](https://img.shields.io/hackage/v/haskoin-store-data.svg?label=haskoin-store-data)](https://hackage.haskell.org/package/haskoin-store-data)-[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jprupp/haskoin-store/blob/master/haskoin-store/LICENSE)+[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/jprupp/haskoin-store/blob/master/LICENSE)  A Bitcoin (BTC) and Bitcoin Cash (BCH) block chain indexer with a REST API, written in Haskell. It connects to the peer-to-peer network directly, so it@@ -468,8 +468,8 @@  ## API -Full reference: [`swagger.yaml`](swagger.yaml), also served at-[api.haskoin.com](https://api.haskoin.com/). It explains the conventions of+Full reference: [`swagger.yaml`](swagger.yaml), also served by every+server about itself (below). It explains the conventions of the API (amounts, ordering, paging, formats, errors, unconfirmed transactions and reorganisations) and the reasons for them, as well as every endpoint. @@ -481,7 +481,10 @@ ```  - The root of the server, `/`, is the reference of its API as a page that-  can try requests, and `/swagger.yaml` the file behind it.+  can try requests, and `/swagger.yaml` the file behind it. The file names+  one server, `./`, so requests tried from the page go to the server that+  served it, also behind a proxy that mounts it under a path such as+  `/btc/`. The reference always matches the version that is running. - Answers are JSON. Add `?pretty=true` for indented JSON. - Lists are paged with `limit` and `offset`, newest first. `height` begins   a page at a transaction hash, a block hash, a block height or a Unix time
haskoin-store.cabal view
@@ -5,7 +5,7 @@ -- see: https://github.com/sol/hpack  name:           haskoin-store-version:        1.10.0+version:        1.10.1 synopsis:       Storage and index for Bitcoin and Bitcoin Cash description:    An indexer for Bitcoin and Bitcoin Cash. It downloads blocks and mempool                 transactions from the peer-to-peer network, indexes them in RocksDB, and
src/Haskoin/Store/Web/Docs.hs view
@@ -17,16 +17,22 @@ -- describes whatever version that site was last given, and someone who -- runs a server wants the reference of the server in front of them. So the -- file is compiled into the program ('swaggerYaml'), and the root of the--- server answers with a page that shows it ('swaggerPage'), with the--- server itself first in its list of servers, so that requests tried from--- the page go to it.+-- server answers with a page that shows it ('swaggerPage'). --+-- The file names one server, @.\/@, a relative address that a reader+-- resolves against the address it read the file from. Requests tried from+-- the page go to the server that served it, whether it answers at the root+-- of a host or behind a proxy under a path such as @\/btc\/@. The file+-- names no public servers: those would describe someone else's servers,+-- at whatever version they run. The page has no list of servers to choose+-- from and no box to load another description, for the same reason.+-- -- = What the page needs ----- The page is Swagger UI, loaded from a public CDN at a fixed version, as--- the page of api.haskoin.com does. A browser without access to the--- Internet shows an empty page; @\/swagger.yaml@ is served either way. The--- program is not made a megabyte and a half larger to carry a copy of it.+-- The page is Swagger UI, loaded from a public CDN at a fixed version. A+-- browser without access to the Internet shows an empty page;+-- @\/swagger.yaml@ is served either way. The program is not made a+-- megabyte and a half larger to carry a copy of it. module Haskoin.Store.Web.Docs   ( swaggerYaml,     swaggerPage,@@ -37,20 +43,14 @@ import Data.ByteString qualified as B import Data.FileEmbed (embedFile, makeRelativeToProject) --- | @swagger.yaml@ as it was when the program was built, with this server--- at the head of its list of servers: a relative address, which a reader of--- the description resolves against where it found the description.+-- | @swagger.yaml@ as it was when the program was built. swaggerYaml :: ByteString-swaggerYaml = case B.breakSubstring marker file of-  (before, rest)-    | B.null rest -> file-    | otherwise -> before <> marker <> "  - url: './'\n    description: This server\n" <> B.drop (B.length marker) rest-  where-    marker = "servers:\n"-    file = $(makeRelativeToProject "swagger.yaml" >>= embedFile)+swaggerYaml = $(makeRelativeToProject "swagger.yaml" >>= embedFile)  -- | The page at the root of the server: Swagger UI, showing 'swaggerYaml',--- which it asks this server for, next to wherever the page itself is.+-- which it asks this server for, next to wherever the page itself is. It+-- leaves out the bar of Swagger UI that loads another description, and the+-- list of servers, which holds only this one. swaggerPage :: ByteString swaggerPage =   B.intercalate@@ -62,11 +62,14 @@       "  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">",       "  <title>Haskoin Store API</title>",       "  <link rel=\"stylesheet\" href=\"" <> cdn <> "/swagger-ui.css\">",+      "  <style>",+      "    /* the list of servers, which holds only this one */",+      "    .swagger-ui .scheme-container { display: none; }",+      "  </style>",       "</head>",       "<body>",       "  <div id=\"swagger-ui\"></div>",       "  <noscript>The reference of this API is at <a href=\"swagger.yaml\">swagger.yaml</a>.</noscript>",-      "  <script src=\"" <> cdn <> "/swagger-ui-standalone-preset.js\"></script>",       "  <script src=\"" <> cdn <> "/swagger-ui-bundle.js\" charset=\"UTF-8\"></script>",       "  <script>",       "    window.onload = function () {",@@ -75,8 +78,8 @@       "      window.ui = SwaggerUIBundle({",       "        url: new URL('swagger.yaml', here).href,",       "        dom_id: '#swagger-ui',",-      "        presets: [SwaggerUIBundle.presets.apis, SwaggerUIStandalonePreset],",-      "        layout: 'StandaloneLayout'",+      "        presets: [SwaggerUIBundle.presets.apis],",+      "        layout: 'BaseLayout'",       "      });",       "    };",       "  </script>",
swagger.yaml view
@@ -5,14 +5,13 @@ # same way, as an explicit key ("? "). openapi: 3.0.0 +# One server, relative: the server that served this file, wherever it is+# mounted. A reader resolves it against the address it read the file from. servers:-  - url: 'https://api.haskoin.com/bch/'-  - url: 'https://api.haskoin.com/btc/'-  - url: 'https://api.haskoin.com/bchtest4/'-  - url: 'https://api.haskoin.com/btctest4/'+  - url: './'  info:-  version: &version 1.9.1+  version: &version 1.10.1   title: Haskoin   contact:     name: JP Rupp@@ -20,7 +19,7 @@     email: jprupp@protonmail.ch   license:     name: MIT-    url: https://github.com/jprupp/haskoin-store/blob/master/haskoin-store/LICENSE+    url: https://github.com/jprupp/haskoin-store/blob/master/LICENSE   description: |     Haskoin Store indexes the Bitcoin (BTC) and Bitcoin Cash (BCH) block chains     and answers the questions that a node cannot answer on its own: what is the@@ -29,9 +28,9 @@     its indices up to date with every block and every unconfirmed transaction,     and serves them here. -    The servers of this reference are the public instance at api.haskoin.com, one per-    network: `btc`, `bch`, and their test networks `btctest4` and `bchtest4`. The-    same API is served by any Haskoin Store you run yourself.+    Every Haskoin Store serves this reference about itself, at its root, and+    the requests it describes go to the server that served it: the reference+    always matches the version of the server in front of you.      ## The basics 
test/Haskoin/Store/IntegrationSpec.hs view
@@ -1693,7 +1693,10 @@   BL.toStrict (page ^. Wreq.responseBody) `shouldSatisfy` C8.isInfixOf "swagger-ui"   reference <- Wreq.getWith quiet (env.plain <> "/swagger.yaml")   statusOf reference `shouldBe` 200-  BL.toStrict (reference ^. Wreq.responseBody) `shouldSatisfy` C8.isInfixOf "description: This server"+  -- one server, the one that served it, wherever it is mounted+  let described = BL.toStrict (reference ^. Wreq.responseBody)+  described `shouldSatisfy` C8.isInfixOf "servers:\n  - url: './'\n"+  described `shouldNotSatisfy` C8.isInfixOf "api.haskoin.com"  -- | The events of the server over a WebSocket. A client that says nothing -- hears of every transaction; one that names an extended public key, an