@fairmint/canton-node-sdk 0.0.222 → 0.0.223

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.
Files changed (67) hide show
  1. package/build/src/generated/apps/common/src/main/openapi/common-external.d.ts +295 -0
  2. package/build/src/generated/apps/common/src/main/openapi/common-external.d.ts.map +1 -0
  3. package/build/src/generated/apps/common/src/main/openapi/common-external.js +7 -0
  4. package/build/src/generated/apps/common/src/main/openapi/common-external.js.map +1 -0
  5. package/build/src/generated/apps/common/src/main/openapi/common-internal.d.ts +204 -0
  6. package/build/src/generated/apps/common/src/main/openapi/common-internal.d.ts.map +1 -0
  7. package/build/src/generated/apps/common/src/main/openapi/common-internal.js +7 -0
  8. package/build/src/generated/apps/common/src/main/openapi/common-internal.js.map +1 -0
  9. package/build/src/generated/apps/scan/src/main/openapi/scan-stream-server.d.ts +73 -0
  10. package/build/src/generated/apps/scan/src/main/openapi/scan-stream-server.d.ts.map +1 -0
  11. package/build/src/generated/apps/scan/src/main/openapi/scan-stream-server.js +7 -0
  12. package/build/src/generated/apps/scan/src/main/openapi/scan-stream-server.js.map +1 -0
  13. package/build/src/generated/apps/scan/src/main/openapi/scan.d.ts +4969 -0
  14. package/build/src/generated/apps/scan/src/main/openapi/scan.d.ts.map +1 -0
  15. package/build/src/generated/apps/scan/src/main/openapi/scan.js +7 -0
  16. package/build/src/generated/apps/scan/src/main/openapi/scan.js.map +1 -0
  17. package/build/src/generated/apps/splitwell/src/main/openapi/splitwell-internal.d.ts +636 -0
  18. package/build/src/generated/apps/splitwell/src/main/openapi/splitwell-internal.d.ts.map +1 -0
  19. package/build/src/generated/apps/splitwell/src/main/openapi/splitwell-internal.js +7 -0
  20. package/build/src/generated/apps/splitwell/src/main/openapi/splitwell-internal.js.map +1 -0
  21. package/build/src/generated/apps/sv/src/main/openapi/sv-internal.d.ts +2024 -0
  22. package/build/src/generated/apps/sv/src/main/openapi/sv-internal.d.ts.map +1 -0
  23. package/build/src/generated/apps/sv/src/main/openapi/sv-internal.js +7 -0
  24. package/build/src/generated/apps/sv/src/main/openapi/sv-internal.js.map +1 -0
  25. package/build/src/generated/apps/validator/src/main/openapi/ans-external.d.ts +189 -0
  26. package/build/src/generated/apps/validator/src/main/openapi/ans-external.d.ts.map +1 -0
  27. package/build/src/generated/apps/validator/src/main/openapi/ans-external.js +7 -0
  28. package/build/src/generated/apps/validator/src/main/openapi/ans-external.js.map +1 -0
  29. package/build/src/generated/apps/validator/src/main/openapi/scan-proxy.d.ts +969 -0
  30. package/build/src/generated/apps/validator/src/main/openapi/scan-proxy.d.ts.map +1 -0
  31. package/build/src/generated/apps/validator/src/main/openapi/scan-proxy.js +7 -0
  32. package/build/src/generated/apps/validator/src/main/openapi/scan-proxy.js.map +1 -0
  33. package/build/src/generated/apps/validator/src/main/openapi/validator-internal.d.ts +1230 -0
  34. package/build/src/generated/apps/validator/src/main/openapi/validator-internal.d.ts.map +1 -0
  35. package/build/src/generated/apps/validator/src/main/openapi/validator-internal.js +7 -0
  36. package/build/src/generated/apps/validator/src/main/openapi/validator-internal.js.map +1 -0
  37. package/build/src/generated/apps/wallet/src/main/openapi/wallet-external.d.ts +535 -0
  38. package/build/src/generated/apps/wallet/src/main/openapi/wallet-external.d.ts.map +1 -0
  39. package/build/src/generated/apps/wallet/src/main/openapi/wallet-external.js +7 -0
  40. package/build/src/generated/apps/wallet/src/main/openapi/wallet-external.js.map +1 -0
  41. package/build/src/generated/apps/wallet/src/main/openapi/wallet-internal.d.ts +2521 -0
  42. package/build/src/generated/apps/wallet/src/main/openapi/wallet-internal.d.ts.map +1 -0
  43. package/build/src/generated/apps/wallet/src/main/openapi/wallet-internal.js +7 -0
  44. package/build/src/generated/apps/wallet/src/main/openapi/wallet-internal.js.map +1 -0
  45. package/package.json +5 -1
  46. package/.gitmodules +0 -6
  47. package/.nvmrc +0 -1
  48. package/scripts/collapse-manifest.ts +0 -66
  49. package/scripts/generate-all-client-methods.ts +0 -332
  50. package/scripts/generate-openapi-types.ts +0 -46
  51. package/scripts/generate-operation-tests.ts +0 -198
  52. package/scripts/grant-user-rights.ts +0 -213
  53. package/scripts/list-identity-providers.ts +0 -46
  54. package/scripts/localnet/localnet-cloud.sh +0 -5
  55. package/scripts/localnet/localnet-status.sh +0 -5
  56. package/scripts/localnet/setup-localnet.sh +0 -5
  57. package/scripts/localnet/setup-quickstart-localnet.sh +0 -5
  58. package/scripts/localnet/start-localnet.sh +0 -5
  59. package/scripts/localnet/stop-localnet.sh +0 -5
  60. package/scripts/localnet-cloud.sh +0 -653
  61. package/scripts/localnet-status.sh +0 -5
  62. package/scripts/prepare-release.ts +0 -222
  63. package/scripts/revoke-user-rights.ts +0 -219
  64. package/scripts/setup-localnet.sh +0 -5
  65. package/scripts/setup-quickstart-localnet.sh +0 -5
  66. package/scripts/start-localnet.sh +0 -5
  67. package/scripts/stop-localnet.sh +0 -5
@@ -1,653 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
- REPO_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
6
- PROJECT_ROOT="${CANTON_LOCALNET_PROJECT_ROOT:-$(pwd)}"
7
- QUICKSTART_DIR="${REPO_ROOT}/libs/cn-quickstart/quickstart"
8
- DOCKERD_PID_FILE="/tmp/localnet-dockerd.pid"
9
- DOCKERD_LOG_FILE="/tmp/localnet-dockerd.log"
10
- HOSTS_ENTRY="127.0.0.1 scan.localhost sv.localhost wallet.localhost"
11
- CURL_CONNECT_TIMEOUT=2
12
- CURL_MAX_TIME=5
13
-
14
- log() {
15
- printf '[localnet] %s\n' "$*"
16
- }
17
-
18
- is_truthy() {
19
- case "${1,,}" in
20
- 1 | true | yes | on)
21
- return 0
22
- ;;
23
- *)
24
- return 1
25
- ;;
26
- esac
27
- }
28
-
29
- require_command() {
30
- local cmd="$1"
31
- if ! command -v "${cmd}" >/dev/null 2>&1; then
32
- log "Missing required command: ${cmd}"
33
- exit 1
34
- fi
35
- }
36
-
37
- ensure_sudo() {
38
- if ! sudo -n true >/dev/null 2>&1; then
39
- log "Passwordless sudo is required in this cloud environment."
40
- exit 1
41
- fi
42
- }
43
-
44
- ensure_docker_packages() {
45
- if command -v docker >/dev/null 2>&1 \
46
- && docker compose version >/dev/null 2>&1; then
47
- return
48
- fi
49
-
50
- log "Installing Docker packages..."
51
- sudo apt-get update
52
- sudo apt-get install -y docker.io docker-compose docker-compose-v2
53
- }
54
-
55
- ensure_legacy_iptables() {
56
- if ! command -v update-alternatives >/dev/null 2>&1 \
57
- || [[ ! -x /usr/sbin/iptables-legacy || ! -x /usr/sbin/ip6tables-legacy ]]; then
58
- log "iptables legacy binaries unavailable; skipping backend switch."
59
- return
60
- fi
61
-
62
- if ! iptables --version 2>/dev/null | grep -q 'legacy'; then
63
- log "Switching iptables to legacy backend..."
64
- sudo update-alternatives --set iptables /usr/sbin/iptables-legacy
65
- fi
66
-
67
- if ! ip6tables --version 2>/dev/null | grep -q 'legacy'; then
68
- log "Switching ip6tables to legacy backend..."
69
- sudo update-alternatives --set ip6tables /usr/sbin/ip6tables-legacy
70
- fi
71
- }
72
-
73
- docker_ready() {
74
- docker info >/dev/null 2>&1 || sudo docker info >/dev/null 2>&1
75
- }
76
-
77
- configure_docker_socket_permissions() {
78
- if [[ ! -S /var/run/docker.sock ]]; then
79
- return
80
- fi
81
-
82
- sudo groupadd -f docker >/dev/null 2>&1 || true
83
- sudo chown root:docker /var/run/docker.sock >/dev/null 2>&1 || true
84
- sudo chmod 660 /var/run/docker.sock || true
85
- }
86
-
87
- run_docker() {
88
- if docker info >/dev/null 2>&1; then
89
- docker "$@"
90
- return
91
- fi
92
- sudo docker "$@"
93
- }
94
-
95
- resolve_quickstart_image_tag() {
96
- local env_file=""
97
- local splice_version=""
98
- local parsed_value=""
99
-
100
- for env_file in "${QUICKSTART_DIR}/.env" "${QUICKSTART_DIR}/.env.local"; do
101
- if [[ ! -f "${env_file}" ]]; then
102
- continue
103
- fi
104
-
105
- parsed_value="$(awk -F= -v key="SPLICE_VERSION" '
106
- $0 ~ /^[[:space:]]*#/ { next }
107
- $1 == key {
108
- value = substr($0, index($0, "=") + 1)
109
- gsub(/^[[:space:]]+|[[:space:]]+$/, "", value)
110
- gsub(/^"|"$/, "", value)
111
- gsub(/^'\''|'\''$/, "", value)
112
- parsed = value
113
- }
114
- END {
115
- if (parsed != "") {
116
- print parsed
117
- }
118
- }
119
- ' "${env_file}")"
120
-
121
- if [[ -n "${parsed_value}" ]]; then
122
- splice_version="${parsed_value}"
123
- fi
124
- done
125
-
126
- printf '%s' "${splice_version}"
127
- }
128
-
129
- run_quickstart_command() {
130
- local command="$1"
131
- local docker_shim_dir=""
132
- local quickstart_image_tag=""
133
- local status=0
134
-
135
- quickstart_image_tag="$(resolve_quickstart_image_tag)"
136
-
137
- if ! docker info >/dev/null 2>&1 && sudo docker info >/dev/null 2>&1; then
138
- docker_shim_dir="$(mktemp -d "/tmp/canton-localnet-docker-shim.XXXXXX")"
139
- cat >"${docker_shim_dir}/docker" <<'EOF'
140
- #!/usr/bin/env bash
141
- exec sudo -E docker "$@"
142
- EOF
143
- chmod +x "${docker_shim_dir}/docker"
144
- log "Using sudo docker shim for quickstart command."
145
- fi
146
-
147
- set +e
148
- if [[ -n "${docker_shim_dir}" ]]; then
149
- (
150
- cd "${QUICKSTART_DIR}"
151
- MODULES_DIR="${QUICKSTART_DIR}/docker/modules" \
152
- LOCALNET_DIR="${QUICKSTART_DIR}/docker/modules/localnet" \
153
- IMAGE_TAG="${quickstart_image_tag}" \
154
- PATH="${docker_shim_dir}:${HOME}/.daml/bin:${PATH}" \
155
- bash -lc "${command}"
156
- )
157
- status=$?
158
- else
159
- (
160
- cd "${QUICKSTART_DIR}"
161
- MODULES_DIR="${QUICKSTART_DIR}/docker/modules" \
162
- LOCALNET_DIR="${QUICKSTART_DIR}/docker/modules/localnet" \
163
- IMAGE_TAG="${quickstart_image_tag}" \
164
- PATH="${HOME}/.daml/bin:${PATH}" \
165
- bash -lc "${command}"
166
- )
167
- status=$?
168
- fi
169
- set -e
170
-
171
- if [[ -n "${docker_shim_dir}" ]]; then
172
- rm -rf "${docker_shim_dir}"
173
- fi
174
-
175
- return "${status}"
176
- }
177
-
178
- run_quickstart_make() {
179
- local target="$1"
180
- run_quickstart_command "make ${target}"
181
- }
182
-
183
- start_docker_daemon() {
184
- local dockerd_pid=""
185
-
186
- if docker_ready; then
187
- configure_docker_socket_permissions
188
- return
189
- fi
190
-
191
- ensure_legacy_iptables
192
-
193
- log "Starting Docker daemon with vfs storage driver..."
194
- sudo nohup dockerd --host=unix:///var/run/docker.sock --pidfile="${DOCKERD_PID_FILE}" --storage-driver=vfs >"${DOCKERD_LOG_FILE}" 2>&1 &
195
-
196
- for _ in $(seq 1 60); do
197
- if sudo docker info >/dev/null 2>&1; then
198
- configure_docker_socket_permissions
199
- return
200
- fi
201
- if [[ -f "${DOCKERD_PID_FILE}" ]]; then
202
- dockerd_pid="$(cat "${DOCKERD_PID_FILE}" 2>/dev/null || true)"
203
- if [[ -n "${dockerd_pid}" ]] && ! ps -p "${dockerd_pid}" >/dev/null 2>&1; then
204
- log "Docker daemon exited before becoming ready."
205
- log "Inspect ${DOCKERD_LOG_FILE}."
206
- exit 1
207
- fi
208
- fi
209
- sleep 1
210
- done
211
-
212
- log "Docker failed to start. Inspect ${DOCKERD_LOG_FILE}."
213
- exit 1
214
- }
215
-
216
- ensure_submodules() {
217
- if [[ -d "${REPO_ROOT}/libs/splice" && -d "${QUICKSTART_DIR}" ]]; then
218
- return
219
- fi
220
-
221
- require_command git
222
-
223
- if ! git -C "${REPO_ROOT}" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
224
- log "Missing localnet assets and not in a git checkout. Install from npm with bundled assets or clone SDK with submodules."
225
- exit 1
226
- fi
227
-
228
- if [[ ! -d "${REPO_ROOT}/libs/splice" ]]; then
229
- log "Initializing libs/splice submodule..."
230
- git -C "${REPO_ROOT}" submodule update --init --depth 1 libs/splice
231
- fi
232
-
233
- if [[ ! -d "${REPO_ROOT}/libs/cn-quickstart" ]]; then
234
- log "Initializing libs/cn-quickstart submodule..."
235
- git -C "${REPO_ROOT}" submodule update --init --recursive libs/cn-quickstart
236
- fi
237
-
238
- if [[ ! -d "${QUICKSTART_DIR}" ]]; then
239
- log "cn-quickstart directory not found after submodule init."
240
- exit 1
241
- fi
242
- }
243
-
244
- ensure_hosts_entries() {
245
- if ! grep -Eq '(^|[[:space:]])scan\.localhost([[:space:]]|$)' /etc/hosts \
246
- || ! grep -Eq '(^|[[:space:]])sv\.localhost([[:space:]]|$)' /etc/hosts \
247
- || ! grep -Eq '(^|[[:space:]])wallet\.localhost([[:space:]]|$)' /etc/hosts; then
248
- log "Adding localnet host aliases to /etc/hosts..."
249
- echo "${HOSTS_ENTRY}" | sudo tee -a /etc/hosts >/dev/null
250
- fi
251
- }
252
-
253
- quickstart_setup() {
254
- if [[ ! -f "${QUICKSTART_DIR}/.env.local" ]]; then
255
- log "Running cn-quickstart setup (OAuth2 enabled)..."
256
- (
257
- cd "${QUICKSTART_DIR}"
258
- # Match CI behavior first, then fall back to prompt-based answers for newer setup flows.
259
- echo "2" | make setup || true
260
- if ! grep -Eq '^AUTH_MODE=oauth2$' "${QUICKSTART_DIR}/.env.local" 2>/dev/null; then
261
- printf 'y\ny\n\nn\n' | make setup
262
- fi
263
- )
264
- else
265
- log "Reusing existing ${QUICKSTART_DIR}/.env.local."
266
- fi
267
-
268
- if [[ ! -x "${HOME}/.daml/bin/daml" ]]; then
269
- log "Installing Daml SDK..."
270
- (
271
- cd "${QUICKSTART_DIR}"
272
- make install-daml-sdk
273
- )
274
- else
275
- log "Reusing existing Daml SDK at ${HOME}/.daml/bin/daml."
276
- fi
277
- }
278
-
279
- quickstart_fast_start_enabled() {
280
- is_truthy "${CANTON_LOCALNET_FAST_START:-true}"
281
- }
282
-
283
- quickstart_force_full_start() {
284
- is_truthy "${CANTON_LOCALNET_FORCE_FULL_START:-false}"
285
- }
286
-
287
- quickstart_build_artifacts_ready() {
288
- local missing_paths=()
289
-
290
- if [[ ! -f "${QUICKSTART_DIR}/backend/build/distributions/backend.tar" ]]; then
291
- missing_paths+=("backend/build/distributions/backend.tar")
292
- fi
293
-
294
- if [[ ! -d "${QUICKSTART_DIR}/frontend/dist" ]]; then
295
- missing_paths+=("frontend/dist")
296
- fi
297
-
298
- if ! compgen -G "${QUICKSTART_DIR}/daml/licensing/.daml/dist/*.dar" >/dev/null; then
299
- missing_paths+=("daml/licensing/.daml/dist/*.dar")
300
- fi
301
-
302
- if ! compgen -G "${QUICKSTART_DIR}/backend/build/otel-agent/opentelemetry-javaagent-*.jar" >/dev/null; then
303
- missing_paths+=("backend/build/otel-agent/opentelemetry-javaagent-*.jar")
304
- fi
305
-
306
- if [[ ${#missing_paths[@]} -gt 0 ]]; then
307
- log "Fast start unavailable; missing quickstart build artifacts: ${missing_paths[*]}"
308
- return 1
309
- fi
310
-
311
- return 0
312
- }
313
-
314
- extract_quickstart_compose_up_command() {
315
- (
316
- cd "${QUICKSTART_DIR}"
317
- make -n start 2>/dev/null | awk '/docker compose .* up -d --no-recreate/{line=$0} END{print line}'
318
- )
319
- }
320
-
321
- try_fast_start_localnet() {
322
- local compose_up_command=""
323
-
324
- compose_up_command="$(extract_quickstart_compose_up_command)"
325
- if [[ -z "${compose_up_command}" ]]; then
326
- log "Unable to determine quickstart compose startup command."
327
- return 1
328
- fi
329
-
330
- log "Starting cn-quickstart with fast path (skip quickstart rebuild)..."
331
- run_quickstart_command "${compose_up_command}"
332
- }
333
-
334
- wait_for_services() {
335
- log "Waiting for Keycloak..."
336
- for _ in $(seq 1 30); do
337
- if curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://localhost:8082/realms/AppProvider >/dev/null 2>&1; then
338
- break
339
- fi
340
- sleep 2
341
- done
342
- if ! curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://localhost:8082/realms/AppProvider >/dev/null 2>&1; then
343
- log "Keycloak did not become ready."
344
- exit 1
345
- fi
346
-
347
- log "Waiting for Validator API..."
348
- for _ in $(seq 1 30); do
349
- code="$(curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -sS -o /dev/null -w '%{http_code}' http://localhost:3903/api/validator/v0/wallet/user-status || true)"
350
- if [[ "${code}" == "200" || "${code}" == "401" ]]; then
351
- break
352
- fi
353
- sleep 2
354
- done
355
- code="$(curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -sS -o /dev/null -w '%{http_code}' http://localhost:3903/api/validator/v0/wallet/user-status || true)"
356
- if [[ "${code}" != "200" && "${code}" != "401" ]]; then
357
- log "Validator API did not become ready."
358
- exit 1
359
- fi
360
-
361
- log "Waiting for Scan API..."
362
- for _ in $(seq 1 30); do
363
- if curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://scan.localhost:4000/api/scan/v0/dso-party-id >/dev/null 2>&1; then
364
- break
365
- fi
366
- sleep 2
367
- done
368
- if ! curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://scan.localhost:4000/api/scan/v0/dso-party-id >/dev/null 2>&1; then
369
- log "Scan API did not become ready."
370
- exit 1
371
- fi
372
-
373
- log "All localnet services are ready."
374
- }
375
-
376
- start_localnet() {
377
- if quickstart_force_full_start; then
378
- log "Forcing full cn-quickstart start (CANTON_LOCALNET_FORCE_FULL_START=true)."
379
- run_quickstart_make start
380
- wait_for_services
381
- return
382
- fi
383
-
384
- if quickstart_fast_start_enabled && quickstart_build_artifacts_ready; then
385
- if try_fast_start_localnet; then
386
- wait_for_services
387
- return
388
- fi
389
- log "Fast start failed; falling back to full cn-quickstart start."
390
- fi
391
-
392
- log "Starting cn-quickstart with full build..."
393
- run_quickstart_make start
394
- wait_for_services
395
- }
396
-
397
- stop_localnet() {
398
- if [[ ! -d "${QUICKSTART_DIR}" ]]; then
399
- log "cn-quickstart directory not found; nothing to stop."
400
- stop_managed_dockerd
401
- return
402
- fi
403
-
404
- log "Stopping cn-quickstart..."
405
- run_quickstart_make stop || true
406
- stop_managed_dockerd
407
- }
408
-
409
- stop_managed_dockerd() {
410
- local pid=""
411
- local cmd=""
412
-
413
- if [[ ! -f "${DOCKERD_PID_FILE}" ]]; then
414
- return
415
- fi
416
-
417
- pid="$(cat "${DOCKERD_PID_FILE}" 2>/dev/null || true)"
418
- if [[ -z "${pid}" ]]; then
419
- rm -f "${DOCKERD_PID_FILE}" "${DOCKERD_LOG_FILE}"
420
- return
421
- fi
422
-
423
- if ! ps -p "${pid}" >/dev/null 2>&1; then
424
- rm -f "${DOCKERD_PID_FILE}" "${DOCKERD_LOG_FILE}"
425
- return
426
- fi
427
-
428
- cmd="$(ps -p "${pid}" -o comm= 2>/dev/null | tr -d '[:space:]')"
429
- if [[ "${cmd}" != "dockerd" ]]; then
430
- log "PID ${pid} is not dockerd; skipping daemon cleanup."
431
- rm -f "${DOCKERD_PID_FILE}"
432
- return
433
- fi
434
-
435
- if ! sudo -n true >/dev/null 2>&1; then
436
- log "Cannot stop managed dockerd without passwordless sudo."
437
- return
438
- fi
439
-
440
- log "Stopping managed dockerd (pid ${pid})..."
441
- sudo kill -TERM "${pid}" >/dev/null 2>&1 || true
442
- for _ in $(seq 1 10); do
443
- if ! ps -p "${pid}" >/dev/null 2>&1; then
444
- break
445
- fi
446
- sleep 1
447
- done
448
- if ps -p "${pid}" >/dev/null 2>&1; then
449
- sudo kill -KILL "${pid}" >/dev/null 2>&1 || true
450
- fi
451
- rm -f "${DOCKERD_PID_FILE}" "${DOCKERD_LOG_FILE}"
452
- }
453
-
454
- status_localnet() {
455
- if docker_ready; then
456
- log "Docker daemon is running."
457
- else
458
- log "Docker daemon is not running."
459
- exit 1
460
- fi
461
-
462
- run_docker ps --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}'
463
- echo
464
-
465
- keycloak_ok="no"
466
- validator_ok="no"
467
- scan_ok="no"
468
- if curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://localhost:8082/realms/AppProvider >/dev/null 2>&1; then
469
- keycloak_ok="yes"
470
- fi
471
- validator_code="$(curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -sS -o /dev/null -w '%{http_code}' http://localhost:3903/api/validator/v0/wallet/user-status || true)"
472
- if [[ "${validator_code}" == "200" || "${validator_code}" == "401" ]]; then
473
- validator_ok="yes"
474
- fi
475
- if curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://scan.localhost:4000/api/scan/v0/dso-party-id >/dev/null 2>&1; then
476
- scan_ok="yes"
477
- fi
478
-
479
- printf 'Keycloak ready: %s\n' "${keycloak_ok}"
480
- printf 'Validator ready: %s (HTTP %s)\n' "${validator_ok}" "${validator_code:-n/a}"
481
- printf 'Scan ready: %s\n' "${scan_ok}"
482
- }
483
-
484
- run_smoke() {
485
- local validator_code=""
486
-
487
- log "Running localnet smoke checks..."
488
-
489
- if ! curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://localhost:8082/realms/AppProvider >/dev/null 2>&1; then
490
- log "Keycloak is not reachable."
491
- exit 1
492
- fi
493
-
494
- validator_code="$(curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -sS -o /dev/null -w '%{http_code}' http://localhost:3903/api/validator/v0/wallet/user-status || true)"
495
- if [[ "${validator_code}" != "200" && "${validator_code}" != "401" ]]; then
496
- log "Validator API is not reachable (HTTP ${validator_code})."
497
- exit 1
498
- fi
499
-
500
- if ! curl --connect-timeout "${CURL_CONNECT_TIMEOUT}" --max-time "${CURL_MAX_TIME}" -fsS http://scan.localhost:4000/api/scan/v0/dso-party-id >/dev/null 2>&1; then
501
- log "Scan API is not reachable."
502
- exit 1
503
- fi
504
-
505
- log "Smoke checks passed."
506
- }
507
-
508
- read_npm_script() {
509
- local target_dir="$1"
510
- local script_name="$2"
511
-
512
- if [[ ! -f "${target_dir}/package.json" ]]; then
513
- return
514
- fi
515
-
516
- node -e 'const fs=require("fs"); const pkgPath=process.argv[1]; const scriptName=process.argv[2]; try { const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8")); const script = pkg?.scripts?.[scriptName]; if (typeof script === "string") process.stdout.write(script); } catch {}' "${target_dir}/package.json" "${script_name}"
517
- }
518
-
519
- script_is_recursive_localnet_test() {
520
- local script_value="$1"
521
- echo "${script_value}" | grep -Eq '(^|[[:space:]])(canton-localnet[[:space:]]+test|[^[:space:]]*localnet-cloud\.sh[[:space:]]+test)([[:space:]]|$)'
522
- }
523
-
524
- run_integration_tests() {
525
- local script_value=""
526
-
527
- if [[ -n "${CANTON_LOCALNET_TEST_CMD:-}" ]]; then
528
- log "Running custom integration command from CANTON_LOCALNET_TEST_CMD..."
529
- (
530
- cd "${PROJECT_ROOT}"
531
- bash -lc "${CANTON_LOCALNET_TEST_CMD}"
532
- )
533
- return
534
- fi
535
-
536
- script_value="$(read_npm_script "${PROJECT_ROOT}" "test:integration")"
537
- if [[ -n "${script_value}" ]]; then
538
- if script_is_recursive_localnet_test "${script_value}"; then
539
- log "Skipping recursive test:integration script."
540
- else
541
- log "Running project integration tests: npm run test:integration"
542
- (
543
- cd "${PROJECT_ROOT}"
544
- npm run test:integration
545
- )
546
- return
547
- fi
548
- fi
549
-
550
- script_value="$(read_npm_script "${PROJECT_ROOT}" "test:localnet")"
551
- if [[ -n "${script_value}" ]]; then
552
- if script_is_recursive_localnet_test "${script_value}"; then
553
- log "Skipping recursive test:localnet script."
554
- else
555
- log "Running project integration tests: npm run test:localnet"
556
- (
557
- cd "${PROJECT_ROOT}"
558
- npm run test:localnet
559
- )
560
- return
561
- fi
562
- fi
563
-
564
- if [[ "${PROJECT_ROOT}" == "${REPO_ROOT}" && -d "${REPO_ROOT}/test/integration/localnet" && -d "${REPO_ROOT}/node_modules" ]]; then
565
- log "Running bundled SDK localnet integration tests..."
566
- (
567
- cd "${REPO_ROOT}"
568
- npm test -- test/integration/localnet
569
- )
570
- return
571
- fi
572
-
573
- log "No integration test command configured; skipping test step."
574
- }
575
-
576
- usage() {
577
- cat <<'USAGE'
578
- Usage: scripts/localnet/localnet-cloud.sh <command>
579
-
580
- Commands:
581
- setup Install prerequisites, init submodules, configure quickstart
582
- start Start localnet and wait for ready endpoints
583
- stop Stop localnet services
584
- status Show docker + endpoint status
585
- smoke Run endpoint smoke checks
586
- test Run project integration tests (if configured)
587
- verify Run setup + start + smoke + test
588
-
589
- Environment:
590
- CANTON_LOCALNET_FAST_START=true|false Enable fast startup path (default: true)
591
- CANTON_LOCALNET_FORCE_FULL_START=true|false Force full startup with rebuild
592
- USAGE
593
- }
594
-
595
- main() {
596
- if [[ "${1:-}" == "" ]]; then
597
- usage
598
- exit 1
599
- fi
600
-
601
- case "$1" in
602
- setup)
603
- ensure_sudo
604
- ensure_docker_packages
605
- start_docker_daemon
606
- ensure_submodules
607
- ensure_hosts_entries
608
- quickstart_setup
609
- ;;
610
- start)
611
- require_command curl
612
- ensure_sudo
613
- ensure_docker_packages
614
- start_docker_daemon
615
- ensure_submodules
616
- ensure_hosts_entries
617
- quickstart_setup
618
- start_localnet
619
- ;;
620
- stop)
621
- stop_localnet
622
- ;;
623
- status)
624
- require_command curl
625
- status_localnet
626
- ;;
627
- smoke)
628
- require_command curl
629
- run_smoke
630
- ;;
631
- test)
632
- run_integration_tests
633
- ;;
634
- verify)
635
- require_command curl
636
- ensure_sudo
637
- ensure_docker_packages
638
- start_docker_daemon
639
- ensure_submodules
640
- ensure_hosts_entries
641
- quickstart_setup
642
- start_localnet
643
- run_smoke
644
- run_integration_tests
645
- ;;
646
- *)
647
- usage
648
- exit 1
649
- ;;
650
- esac
651
- }
652
-
653
- main "$@"
@@ -1,5 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
-
4
- SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5
- bash "${SCRIPT_DIR}/localnet-cloud.sh" status