@cardano-sdk/cardano-services 0.5.0-nightly.3 → 0.5.0-nightly.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +96 -0
- package/dist/cjs/cli.js +0 -0
- package/dist/cjs/original-package.json +3 -3
- package/dist/cjs/run.js +0 -0
- package/dist/cjs/startWorker.js +0 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,103 @@
|
|
|
1
1
|
# Cardano JS SDK | Cardano GraphQL Services
|
|
2
|
+
Libraries and program entrypoints for services to facilitate remote data and submit access using
|
|
3
|
+
[Provider] interfaces over HTTP, with _optional_ queue-based transaction submission; The
|
|
4
|
+
[TxSubmitHttpService] can be configured to submit directly via [Ogmios], or via a [RabbitMQ] broker,
|
|
5
|
+
with one or more workers handling submission and response job creation. Data is sourced from
|
|
6
|
+
[Cardano DB Sync], the local [Cardano Node] via [Ogmios] Local State Queries, genesis files, and
|
|
7
|
+
remote sources.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
- [CLI] or run scripts for the [HTTP server](./src/run.ts) and [worker](./src/startWorker.ts) with
|
|
11
|
+
configuration via environment variables and _optional_ loading of secrets from disk.
|
|
12
|
+
- Service port discovery via DNS resolution, or static configuration.
|
|
13
|
+
- Fault-tolerant transaction submission via persistent queue, or direct submission.
|
|
14
|
+
- _Optional_ [Prometheus] metrics available at `/metrics`
|
|
15
|
+
- Data sourced from Cardano DB Sync PostgreSQL, Local State Queries, genesis files, and remote
|
|
16
|
+
sources.
|
|
17
|
+
|
|
18
|
+
## Services
|
|
19
|
+
|
|
20
|
+
The services require instances of [Cardano Node] and [Ogmios] as a minimum, with
|
|
21
|
+
[Cardano DB Sync] and [RabbitMQ] dependent on the run command. Please refer to
|
|
22
|
+
[docker-compose.json](./docker-compose.yml) for the current supported version of each service
|
|
23
|
+
dependency.
|
|
24
|
+
|
|
25
|
+
### HTTP Server
|
|
26
|
+
The HTTP server can be started with one or more provider modules by name, segmented by URL path.
|
|
27
|
+
Run the [CLI] with `start-server --help` to see the full list of options, or inspect the
|
|
28
|
+
environment variables within [./src/run.ts](./src/run.ts).
|
|
29
|
+
|
|
30
|
+
### Worker
|
|
31
|
+
A worker must be started when opting for queue-based transaction submission.
|
|
32
|
+
Run the [CLI] with `start-worker --help` to see the full list of options, or inspect the
|
|
33
|
+
environment variables within [./src/startWorker.ts](./src/startWorker.ts).
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
## Examples
|
|
37
|
+
|
|
38
|
+
_The following examples require the [install and build] steps to be completed._
|
|
39
|
+
|
|
40
|
+
#### All Providers | Static Service Config | Direct Tx Submission
|
|
41
|
+
|
|
42
|
+
- The server will expose all [Provider] HTTP services
|
|
43
|
+
- Transactions will be submitted directly via [Ogmios], running at `ws://localhost:1338`.
|
|
44
|
+
- Connects to [PostgreSQL] service running at `localhost:5432`
|
|
45
|
+
- HTTP API exposed using a custom API URL
|
|
46
|
+
|
|
47
|
+
``` console
|
|
48
|
+
./dist/cjs/cli.js \
|
|
49
|
+
start-server \
|
|
50
|
+
--api-url http://localhost:6000 \
|
|
51
|
+
--cardano-node-config-path ./config/cardano-node/config.json \
|
|
52
|
+
--ogmios-url ws://localhost:1338 \
|
|
53
|
+
--db-connection-string postgresql://somePgUser:somePassword@localhost:5432/someDbName \
|
|
54
|
+
asset,chain-history,stake-pool,tx-submit,network-info,utxo
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
#### All Providers | Service Discovery | Queued Tx Submission | Metrics
|
|
58
|
+
|
|
59
|
+
- The server will expose all [Provider] HTTP services
|
|
60
|
+
- Transactions will be queued by the HTTP service, with the worker completing the
|
|
61
|
+
submission. The HTTP service receives the submission result via a dedicated channel to
|
|
62
|
+
complete the HTTP request.
|
|
63
|
+
- Ports for [Ogmios], [PostgreSQL], and [RabbitMQ], discovered using DNS resolution.
|
|
64
|
+
- HTTP API exposed using a custom API URL
|
|
65
|
+
- Prometheus metrics exporter enabled at http://localhost:6000/metrics
|
|
66
|
+
|
|
67
|
+
``` console
|
|
68
|
+
./dist/cjs/cli.js \
|
|
69
|
+
start-server \
|
|
70
|
+
--api-url http://localhost:6000 \
|
|
71
|
+
--cardano-node-config-path ./config/cardano-node/config.json \
|
|
72
|
+
--enable-metrics true \
|
|
73
|
+
--ogmios-srv-service-name some-domain-for-ogmios \
|
|
74
|
+
--postgres-db someDbName \
|
|
75
|
+
--postgres-password somePassword \
|
|
76
|
+
--postgres-srv-service-name \
|
|
77
|
+
--postgres-user somePgUser \
|
|
78
|
+
--rabbitmq-srv-service-name some-domain-for-rabbitmq \
|
|
79
|
+
--use-queue \
|
|
80
|
+
asset,chain-history,stake-pool,tx-submit,network-info,utxo
|
|
81
|
+
```
|
|
82
|
+
``` console
|
|
83
|
+
./dist/cjs/cli.js \
|
|
84
|
+
start-worker \
|
|
85
|
+
--ogmios-srv-service-name some-domain-for-ogmios \
|
|
86
|
+
--rabbitmq-srv-service-name some-domain-for-rabbitmq
|
|
87
|
+
```
|
|
2
88
|
|
|
3
89
|
## Tests
|
|
4
90
|
|
|
5
91
|
See [code coverage report]
|
|
6
92
|
|
|
93
|
+
[Cardano DB Sync]: https://github.com/input-output-hk/cardano-db-sync
|
|
94
|
+
[Cardano Node]: https://github.com/input-output-hk/cardano-node
|
|
7
95
|
[code coverage report]: https://input-output-hk.github.io/cardano-js-sdk/coverage/cardano-services
|
|
96
|
+
[CLI]: ./src/cli.ts
|
|
97
|
+
[Ogmios]: https://ogmios.dev/
|
|
98
|
+
[install and build]: ../../README.md#install-and-build
|
|
99
|
+
[PostgreSQL]: https://www.postgresql.org/
|
|
100
|
+
[Prometheus]: https://prometheus.io/
|
|
101
|
+
[Provider]: ../core/src/Provider
|
|
102
|
+
[RabbitMQ]: https://www.rabbitmq.com/
|
|
103
|
+
[TxSubmitHttpService]: ./src/TxSubmit/TxSubmitHttpService.ts
|
package/dist/cjs/cli.js
CHANGED
|
File without changes
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/cardano-services",
|
|
3
|
-
"version": "0.5.0-nightly.
|
|
3
|
+
"version": "0.5.0-nightly.4",
|
|
4
4
|
"description": "Cardano GraphQL Services",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^14"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build:cjs": "tsc --build src",
|
|
37
|
+
"build:cjs": "tsc --build src && shx chmod +x ./dist/cjs/cli.js ./dist/cjs/run.js ./dist/cjs/startWorker.js",
|
|
38
38
|
"build:copy-assets": "bash ./copy-assets.sh",
|
|
39
39
|
"build": "run-s build:cjs build:copy-assets",
|
|
40
40
|
"cleanup:dist": "shx rm -rf dist",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"LICENSE",
|
|
123
123
|
"NOTICE"
|
|
124
124
|
],
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "b8c345f92470830ea5d0560689ec5641d8cabca5"
|
|
126
126
|
}
|
package/dist/cjs/run.js
CHANGED
|
File without changes
|
package/dist/cjs/startWorker.js
CHANGED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cardano-sdk/cardano-services",
|
|
3
|
-
"version": "0.5.0-nightly.
|
|
3
|
+
"version": "0.5.0-nightly.4",
|
|
4
4
|
"description": "Cardano GraphQL Services",
|
|
5
5
|
"engines": {
|
|
6
6
|
"node": "^14"
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
],
|
|
35
35
|
"license": "Apache-2.0",
|
|
36
36
|
"scripts": {
|
|
37
|
-
"build:cjs": "tsc --build src",
|
|
37
|
+
"build:cjs": "tsc --build src && shx chmod +x ./dist/cjs/cli.js ./dist/cjs/run.js ./dist/cjs/startWorker.js",
|
|
38
38
|
"build:copy-assets": "bash ./copy-assets.sh",
|
|
39
39
|
"build": "run-s build:cjs build:copy-assets",
|
|
40
40
|
"cleanup:dist": "shx rm -rf dist",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"LICENSE",
|
|
123
123
|
"NOTICE"
|
|
124
124
|
],
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "b8c345f92470830ea5d0560689ec5641d8cabca5"
|
|
126
126
|
}
|