Skip to content

Commit a65e156

Browse files
committed
Merge branch 'release/v2.12'
2 parents 2c45f3b + 491918a commit a65e156

3 files changed

Lines changed: 183 additions & 20 deletions

File tree

Lines changed: 181 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ servers:
55

66
info:
77
title: Kupo
8-
version: v2.10.0
8+
version: v2.12.0
99
license:
1010
name: MPL-2.0
1111
url: https://raw.githubusercontent.com/cardanosolutions/kupo/master/LICENSE
@@ -81,8 +81,8 @@ info:
8181
Make sure to have [nix](https://nixos.org/download.html#nix-install-linux) installed with a cache:
8282
8383
```
84-
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= loony-tools:pr9m4BkM/5/eSTZlkQyRt57Jz7OMBxNSUiMC4FkcNfk=
85-
substituters = https://cache.zw3rk.com/ https://cache.nixos.org/
84+
trusted-public-keys = cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= hydra.iohk.io:f/Ea+s+dFdN+3Y/G+FDgSq+a5NEWhJGzdjvKNGv0/EQ=
85+
substituters = https://cache.iog.io/ https://cache.nixos.org/
8686
```
8787
8888
On MacOS, you'll need to install `libffi` and `bzip2` if they aren't already installed.
@@ -273,6 +273,25 @@ info:
273273
$ man kupo
274274
```
275275
276+
# Custom database indexes
277+
278+
Kupo supports custom database indexes, provided by environment variable.
279+
Hence, any environment variable prefixed with `KUPO_INDEX_` will be parsed
280+
and interpreted as a custom database index, managed with the pre-defined
281+
indexes.
282+
283+
For example, you can add a custom index `inputsByPaymentCredentialUnspent`
284+
for matching unspent inputs by payment cred by setting the following
285+
environment variable:
286+
287+
```env
288+
KUPO_INDEX_inputsByPaymentCredentialUnspent="inputs(payment_credential COLLATE NOCASE) WHERE spent_at IS NULL"
289+
```
290+
291+
Use this carefully, as too many indexes may greatly impact the database sync performances and also other queries.
292+
293+
Existing indexes and the overall database internal schema is [available here](https://github.com/CardanoSolutions/kupo/tree/master/db#overview).
294+
276295
# Patterns
277296
278297
## Overview
@@ -569,7 +588,7 @@ info:
569588
| Last Allegra block | N/A | N/A |
570589
| Last Mary block | N/A | N/A |
571590
| Last Alonzo block | 259180 | 0ad91d3bbe350b1cfa05b13dba5263c47c5eca4f97b3a3105eba96416785a487 |
572-
| Last Conway block | 55814394 | bdd4baa2c81d0500a695f836332193ea06c2ce364e585057142220fc0782144c |
591+
| Last Babbage block | 55814394 | bdd4baa2c81d0500a695f836332193ea06c2ce364e585057142220fc0782144c |
573592
| Last Conway block | N/A | N/A |
574593
575594
See <a target="_blank" href="https://github.com/input-output-hk/cardano-configurations/tree/master/network/preview">configuration files for <strong>Preview</strong></a>.
@@ -1260,6 +1279,31 @@ components:
12601279
1220099e5e430475c219518179efc7e6c8289db028904834025d5b086: 231
12611280
289db028904834025d5b085d5b08661220099e5e430475c2195181796.08661220099e: 1
12621281

1282+
ValueAsString:
1283+
type: object
1284+
description: A (multi-asset) value of a transaction's output.
1285+
additionalProperties: false
1286+
required:
1287+
- coins
1288+
properties:
1289+
coins:
1290+
type: string
1291+
description: A quantity of Lovelace, encoded as string when 'asset-quantity=string' is specified as media-type parameter.
1292+
example: "42"
1293+
assets:
1294+
type: object
1295+
description: A _key:value_ map of asset identifier → quantity.
1296+
propertyNames:
1297+
type: string
1298+
pattern: ^[a-f0-9]{56}(.[a-f0-9]{2,64})?$
1299+
additionalProperties:
1300+
x-additionalPropertiesName: "{policy-id}.{asset-name}"
1301+
type: string
1302+
description: A quantity of some asset, encoded as string when 'asset-quantity=string' is specified as media-type parameter.
1303+
example:
1304+
1220099e5e430475c219518179efc7e6c8289db028904834025d5b086: "231"
1305+
289db028904834025d5b085d5b08661220099e5e430475c2195181796.08661220099e: "1"
1306+
12631307
Wildcard:
12641308
type: string
12651309
title: Wildcard
@@ -1317,6 +1361,58 @@ components:
13171361
- $ref: "#/components/schemas/SpentAt"
13181362
- type: "null"
13191363

1364+
MatchQuantityAsString:
1365+
type: object
1366+
additionalProperties: false
1367+
required:
1368+
- transaction_index
1369+
- transaction_id
1370+
- output_index
1371+
- address
1372+
- value
1373+
- datum_hash
1374+
- script_hash
1375+
- created_at
1376+
- spent_at
1377+
properties:
1378+
transaction_index:
1379+
$ref: "#/components/schemas/TransactionIndex"
1380+
transaction_id:
1381+
$ref: "#/components/schemas/TransactionId"
1382+
output_index:
1383+
$ref: "#/components/schemas/OutputIndex"
1384+
address:
1385+
$ref: "#/components/schemas/Address"
1386+
value:
1387+
$ref: "#/components/schemas/ValueAsString"
1388+
datum_hash:
1389+
$ref: "#/components/schemas/DatumHash"
1390+
datum:
1391+
description: The resolved datum, if available. The field is only and always present (yet may be `null`) if `?resolve_hashes` was set.
1392+
oneOf:
1393+
- <<: *BinaryData
1394+
description: A serialized Plutus' Data.
1395+
- type: "null"
1396+
description: None or unknown datum.
1397+
datum_type:
1398+
$ref: "#/components/schemas/DatumType"
1399+
script_hash:
1400+
$ref: "#/components/schemas/ScriptHash"
1401+
script:
1402+
description: The resolved script, if available. The field is only and always present (yet may be `null`) if `?resolve_hashes` was set.
1403+
oneOf:
1404+
- $ref: "#/components/schemas/Script"
1405+
- type: "null"
1406+
description: None or unknown script.
1407+
created_at:
1408+
<<: *Point
1409+
description: Block reference at which this transaction was included in the ledger.
1410+
spent_at:
1411+
description: Block reference at which this transaction input was spent, if any.
1412+
oneOf:
1413+
- $ref: "#/components/schemas/SpentAt"
1414+
- type: "null"
1415+
13201416
Health:
13211417
type: object
13221418
description: An overview of the server & connection status. Note that, when `most_recent_checkpoint` and `most_recent_node_tip` are equal, the index is fully synchronized.
@@ -1325,6 +1421,8 @@ components:
13251421
- connection_status
13261422
- most_recent_checkpoint
13271423
- most_recent_node_tip
1424+
- seconds_since_last_block
1425+
- network_synchronization
13281426
- configuration
13291427
- version
13301428
properties:
@@ -1346,6 +1444,20 @@ components:
13461444
description: Absolute slot number of the current tip of the node.
13471445
- type: "null"
13481446
description: Absolute slot number of the current tip of the node.
1447+
seconds_since_last_block:
1448+
oneOf:
1449+
- type: integer
1450+
description: Number of seconds elapsed since the last block was ingested by Kupo.
1451+
- type: "null"
1452+
description: Number of seconds elapsed since the last block was ingested by Kupo.
1453+
network_synchronization:
1454+
oneOf:
1455+
- type: number
1456+
minimum: 0
1457+
maximum: 1
1458+
description: A progress percentage of the synchronization towards the node tip.
1459+
- type: "null"
1460+
description: A progress percentage of the synchronization towards the node tip.
13491461
configuration:
13501462
type: object
13511463
description: A summary of hand-picked configuration parameters.
@@ -1371,20 +1483,6 @@ components:
13711483
- `connected` and `disconnected` (from `connection_status`) are encoded as `1.0` and `0.0` respectively.
13721484
- `installed` and `deferred` (from `configuration.indexes`) are encoded as `1.0` and `0.0` respectively.
13731485
- `version` is not present in the Prometheus metrics.
1374-
examples:
1375-
response:
1376-
value: |
1377-
# TYPE kupo_connection_status gauge
1378-
kupo_connection_status 1.0
1379-
1380-
# TYPE kupo_most_recent_checkpoint counter
1381-
kupo_most_recent_checkpoint 294998
1382-
1383-
# TYPE kupo_most_recent_node_tip counter
1384-
kupo_most_recent_node_tip 71753381
1385-
1386-
# TYPE kupo_configuration_indexes gauge
1387-
kupo_configuration_indexes 1.0
13881486
13891487
parameters:
13901488
asset-name:
@@ -1778,6 +1876,13 @@ paths:
17781876
Optionally, use `?resolve_hashes` to automatically resolve and include `datum` and `script` associated with hash references, if available. Datums and scripts can otherwise be fetched using the [_Get Datum by Hash_](#tag/Datums/paths/~1datums~1{datum-hash}/get) and [_Get Script by Hash_](#tag/Scripts/paths/~1scripts~1{script-hash}/get) endpoints respectively.
17791877
17801878
Note that it is generally a bad idea to fetch **ALL matches** for indexes built off permissive patterns (e.g. `*`), for the server will yield a large response.
1879+
1880+
> <sup><strong>TIP</strong></sup> <br/>
1881+
>
1882+
> You can customize coins and assets quantities encoding to always be strings instead of integers through the
1883+
> `Accept` header media-type as such:
1884+
>
1885+
> `Accept: application/json;asset-quantity=string`
17811886
parameters:
17821887
- $ref: "#/components/parameters/resolve-hashes"
17831888
- $ref: "#/components/parameters/spent"
@@ -1801,6 +1906,11 @@ paths:
18011906
type: array
18021907
items:
18031908
$ref: "#/components/schemas/Match"
1909+
"application/json;charset=utf-8;asset-quantity=string":
1910+
schema:
1911+
type: array
1912+
items:
1913+
$ref: "#/components/schemas/MatchQuantityAsString"
18041914
304:
18051915
$ref: "#/components/responses/304"
18061916

@@ -1812,6 +1922,13 @@ paths:
18121922
description: |
18131923
Retrieve matches from the database matching the given pattern, in descending `slot_no` order. Results are streamed to the client for more efficiency.
18141924
See [Patterns](#section/Patterns) for more information about constructing patterns.
1925+
1926+
> <sup><strong>TIP</strong></sup> <br/>
1927+
>
1928+
> You can customize coins and assets quantities encoding to always be strings instead of integers through the
1929+
> `Accept` header media-type as such:
1930+
>
1931+
> `Accept: application/json;asset-quantity=string`
18151932
parameters:
18161933
- $ref: "#/components/parameters/pattern"
18171934
- $ref: "#/components/parameters/resolve-hashes"
@@ -1836,6 +1953,11 @@ paths:
18361953
type: array
18371954
items:
18381955
$ref: "#/components/schemas/Match"
1956+
"application/json;charset=utf-8;asset-quantity=string":
1957+
schema:
1958+
type: array
1959+
items:
1960+
$ref: "#/components/schemas/MatchQuantityAsString"
18391961
304:
18401962
$ref: "#/components/responses/304"
18411963
400:
@@ -2197,6 +2319,24 @@ paths:
21972319
"text/plain;charset=utf-8":
21982320
schema:
21992321
$ref: "#/components/schemas/HealthPrometheus"
2322+
example: &HealthPrometheusExample |
2323+
# TYPE kupo_configuration_indexes gauge
2324+
kupo_configuration_indexes 1.0
2325+
2326+
# TYPE kupo_connection_status gauge
2327+
kupo_connection_status 1.0
2328+
2329+
# TYPE kupo_most_recent_checkpoint counter
2330+
kupo_most_recent_checkpoint 61264845
2331+
2332+
# TYPE kupo_most_recent_node_tip counter
2333+
kupo_most_recent_node_tip 82838775
2334+
2335+
# TYPE kupo_network_synchronization gauge
2336+
kupo_network_synchronization 0.73956
2337+
2338+
# TYPE kupo_seconds_since_last_block gauge
2339+
kupo_seconds_since_last_block 2.0
22002340

22012341
202:
22022342
description: Syncing
@@ -2207,6 +2347,7 @@ paths:
22072347
$ref: "#/components/schemas/Health"
22082348

22092349
"text/plain;charset=utf-8":
2350+
example: *HealthPrometheusExample
22102351
schema:
22112352
$ref: "#/components/schemas/HealthPrometheus"
22122353

@@ -2219,5 +2360,27 @@ paths:
22192360
$ref: "#/components/schemas/Health"
22202361

22212362
"text/plain;charset=utf-8":
2363+
example: *HealthPrometheusExample
22222364
schema:
22232365
$ref: "#/components/schemas/HealthPrometheus"
2366+
2367+
/metrics:
2368+
get:
2369+
operationId: getMetrics
2370+
tags: ["Health"]
2371+
summary: Get Metrics
2372+
description: |
2373+
Like [`/health`](#operation/getHealth), but always return `200 OK` as a status.
2374+
responses:
2375+
200:
2376+
description: Metrics
2377+
headers: *default-headers
2378+
content:
2379+
"text/plain;charset=utf-8":
2380+
example: *HealthPrometheusExample
2381+
schema:
2382+
$ref: "#/components/schemas/HealthPrometheus"
2383+
2384+
"application/json;charset=utf-8":
2385+
schema:
2386+
$ref: "#/components/schemas/Health"

docs/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,8 @@
126126
</script>
127127

128128
<div id="versions">
129-
<a href="#">v2.10.0</a>
130129
<a href="#">v2.11.0</a>
130+
<a href="#">v2.12.0</a>
131131
<a href="#">nightly</a>
132132
<script>
133133
;[1,2,3].forEach(ix => {

kupo.cabal

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)