@cartesi/cli 2.0.0-alpha.1 → 2.0.0-alpha.12
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/dist/base.d.ts +18 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +99 -0
- package/dist/builder/directory.d.ts +2 -2
- package/dist/builder/directory.d.ts.map +1 -1
- package/dist/builder/directory.js +1 -1
- package/dist/builder/docker.d.ts +1 -1
- package/dist/builder/docker.d.ts.map +1 -1
- package/dist/builder/docker.js +8 -8
- package/dist/builder/empty.d.ts +2 -2
- package/dist/builder/empty.d.ts.map +1 -1
- package/dist/builder/empty.js +1 -1
- package/dist/builder/none.d.ts +2 -2
- package/dist/builder/none.d.ts.map +1 -1
- package/dist/builder/none.js +1 -1
- package/dist/builder/tar.d.ts +2 -2
- package/dist/builder/tar.d.ts.map +1 -1
- package/dist/builder/tar.js +1 -1
- package/dist/commands/address-book.d.ts +4 -8
- package/dist/commands/address-book.d.ts.map +1 -1
- package/dist/commands/address-book.js +15 -14
- package/dist/commands/build.d.ts +5 -11
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +18 -30
- package/dist/commands/clean.d.ts +2 -7
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +9 -10
- package/dist/commands/create.d.ts +6 -15
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +24 -54
- package/dist/commands/deploy/build.d.ts +2 -14
- package/dist/commands/deploy/build.d.ts.map +1 -1
- package/dist/commands/deploy/build.js +8 -61
- package/dist/commands/deploy.d.ts +18 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +271 -0
- package/dist/commands/doctor.d.ts +2 -12
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +90 -91
- package/dist/commands/hash.d.ts +4 -9
- package/dist/commands/hash.d.ts.map +1 -1
- package/dist/commands/hash.js +14 -14
- package/dist/commands/logs.d.ts +10 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +33 -0
- package/dist/commands/run.d.ts +2 -20
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +9 -190
- package/dist/commands/send/eip712.d.ts +34 -0
- package/dist/commands/send/eip712.d.ts.map +1 -0
- package/dist/commands/send/eip712.js +81 -0
- package/dist/commands/send/erc20.d.ts +11 -13
- package/dist/commands/send/erc20.d.ts.map +1 -1
- package/dist/commands/send/erc20.js +57 -52
- package/dist/commands/send/erc721.d.ts +11 -13
- package/dist/commands/send/erc721.d.ts.map +1 -1
- package/dist/commands/send/erc721.js +51 -46
- package/dist/commands/send/ether.d.ts +11 -12
- package/dist/commands/send/ether.d.ts.map +1 -1
- package/dist/commands/send/ether.js +25 -21
- package/dist/commands/send/generic.d.ts +14 -14
- package/dist/commands/send/generic.d.ts.map +1 -1
- package/dist/commands/send/generic.js +102 -99
- package/dist/commands/send.d.ts +21 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +67 -0
- package/dist/commands/shell.d.ts +6 -14
- package/dist/commands/shell.d.ts.map +1 -1
- package/dist/commands/shell.js +22 -44
- package/dist/commands/start.d.ts +14 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +220 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +47 -0
- package/dist/commands/stop.d.ts +5 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +27 -0
- package/dist/compose/default.env +35 -0
- package/dist/compose/docker-compose-anvil.yaml +17 -0
- package/dist/compose/docker-compose-bundler.yaml +37 -0
- package/dist/{node → compose}/docker-compose-database.yaml +4 -2
- package/dist/compose/docker-compose-espresso.yaml +59 -0
- package/dist/compose/docker-compose-explorer.yaml +57 -0
- package/dist/compose/docker-compose-graphql.yaml +23 -0
- package/dist/compose/docker-compose-node-cpus.yaml +6 -0
- package/dist/compose/docker-compose-node-memory.yaml +6 -0
- package/dist/compose/docker-compose-node.yaml +31 -0
- package/dist/compose/docker-compose-passkey-server.yaml +15 -0
- package/dist/compose/docker-compose-paymaster.yaml +18 -0
- package/dist/compose/docker-compose-proxy.yaml +24 -0
- package/dist/compose/proxy/anvil.yaml +17 -0
- package/dist/compose/proxy/bundler.yaml +29 -0
- package/dist/compose/proxy/espresso.yaml +17 -0
- package/dist/compose/proxy/explorer-api.yaml +17 -0
- package/dist/compose/proxy/explorer.yaml +10 -0
- package/dist/compose/proxy/graphql.yaml +10 -0
- package/dist/compose/proxy/passkey-server.yaml +17 -0
- package/dist/compose/proxy/paymaster.yaml +17 -0
- package/dist/compose/proxy/rollups-node.yaml +17 -0
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +26 -35
- package/dist/contracts.d.ts +1695 -1636
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +632 -592
- package/dist/exec/cartesi-machine.d.ts +2 -2
- package/dist/exec/cartesi-machine.d.ts.map +1 -1
- package/dist/exec/cartesi-machine.js +1 -1
- package/dist/exec/crane.d.ts +4 -4
- package/dist/exec/crane.d.ts.map +1 -1
- package/dist/exec/crane.js +1 -1
- package/dist/exec/genext2fs.d.ts +2 -2
- package/dist/exec/genext2fs.d.ts.map +1 -1
- package/dist/exec/genext2fs.js +2 -2
- package/dist/exec/mksquashfs.d.ts +2 -2
- package/dist/exec/mksquashfs.d.ts.map +1 -1
- package/dist/exec/mksquashfs.js +2 -2
- package/dist/exec/rollups.d.ts +16 -0
- package/dist/exec/rollups.d.ts.map +1 -0
- package/dist/exec/rollups.js +39 -0
- package/dist/exec/util.d.ts +3 -3
- package/dist/exec/util.d.ts.map +1 -1
- package/dist/exec/util.js +8 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -1
- package/dist/machine.d.ts +1 -1
- package/dist/machine.d.ts.map +1 -1
- package/dist/prompts.d.ts +3 -3
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/template.d.ts +3 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +16 -0
- package/dist/wallet.d.ts +1 -1
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +109 -84
- package/package.json +32 -50
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -25
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -8
- package/dist/baseCommand.d.ts +0 -22
- package/dist/baseCommand.d.ts.map +0 -1
- package/dist/baseCommand.js +0 -92
- package/dist/commands/deploy/index.d.ts +0 -12
- package/dist/commands/deploy/index.d.ts.map +0 -1
- package/dist/commands/deploy/index.js +0 -78
- package/dist/commands/send/index.d.ts +0 -28
- package/dist/commands/send/index.d.ts.map +0 -1
- package/dist/commands/send/index.js +0 -102
- package/dist/flags.d.ts +0 -17
- package/dist/flags.d.ts.map +0 -1
- package/dist/flags.js +0 -28
- package/dist/node/DockerfileDeploy.txt +0 -4
- package/dist/node/default.env +0 -27
- package/dist/node/docker-compose-anvil.yaml +0 -50
- package/dist/node/docker-compose-bundler.yaml +0 -57
- package/dist/node/docker-compose-envfile.yaml +0 -4
- package/dist/node/docker-compose-explorer.yaml +0 -88
- package/dist/node/docker-compose-host.yaml +0 -30
- package/dist/node/docker-compose-paymaster.yaml +0 -33
- package/dist/node/docker-compose-prompt.yaml +0 -17
- package/dist/node/docker-compose-proxy.yaml +0 -48
- package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
- package/dist/node/docker-compose-validator-cpus.yaml +0 -6
- package/dist/node/docker-compose-validator-memory.yaml +0 -6
- package/dist/node/docker-compose-validator.yaml +0 -59
- package/oclif.manifest.json +0 -876
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
services:
|
|
2
|
+
graphql:
|
|
3
|
+
image: ${CARTESI_SDK_IMAGE}
|
|
4
|
+
environment:
|
|
5
|
+
CARTESI_GRAPHQL_DATABASE_CONNECTION: postgres://postgres:password@database:5432/graphql?sslmode=disable
|
|
6
|
+
CARTESI_DATABASE_CONNECTION: postgres://postgres:password@database:5432/rollupsdb?sslmode=disable
|
|
7
|
+
expose:
|
|
8
|
+
- 8080
|
|
9
|
+
command: ["cartesi-rollups-graphql"]
|
|
10
|
+
healthcheck:
|
|
11
|
+
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:8080/health"]
|
|
12
|
+
start_period: 10s
|
|
13
|
+
start_interval: 200ms
|
|
14
|
+
interval: 10s
|
|
15
|
+
timeout: 1s
|
|
16
|
+
retries: 5
|
|
17
|
+
depends_on:
|
|
18
|
+
database:
|
|
19
|
+
condition: service_healthy
|
|
20
|
+
|
|
21
|
+
proxy:
|
|
22
|
+
volumes:
|
|
23
|
+
- ./proxy/graphql.yaml:/etc/traefik/conf.d/graphql.yaml
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
services:
|
|
2
|
+
rollups-node:
|
|
3
|
+
image: cartesi/rollups-runtime:${CARTESI_SDK_VERSION}
|
|
4
|
+
depends_on:
|
|
5
|
+
database:
|
|
6
|
+
condition: service_healthy
|
|
7
|
+
anvil:
|
|
8
|
+
condition: service_healthy
|
|
9
|
+
expose:
|
|
10
|
+
- "10000"
|
|
11
|
+
- "10011"
|
|
12
|
+
- "10012"
|
|
13
|
+
healthcheck:
|
|
14
|
+
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:10000/livez"]
|
|
15
|
+
start_period: 10s
|
|
16
|
+
start_interval: 200ms
|
|
17
|
+
interval: 10s
|
|
18
|
+
timeout: 1s
|
|
19
|
+
retries: 5
|
|
20
|
+
command: ["cartesi-rollups-node"]
|
|
21
|
+
env_file:
|
|
22
|
+
- ${CARTESI_BIN_PATH}/compose/default.env
|
|
23
|
+
volumes:
|
|
24
|
+
- snapshots:/var/lib/cartesi-rollups-node/snapshots
|
|
25
|
+
|
|
26
|
+
proxy:
|
|
27
|
+
volumes:
|
|
28
|
+
- ./proxy/rollups-node.yaml:/etc/traefik/conf.d/rollups-node.yaml
|
|
29
|
+
|
|
30
|
+
volumes:
|
|
31
|
+
snapshots:
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
services:
|
|
2
|
+
passkey-server:
|
|
3
|
+
image: ${CARTESI_SDK_IMAGE}
|
|
4
|
+
command: ["passkey-server"]
|
|
5
|
+
healthcheck:
|
|
6
|
+
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3000/health"]
|
|
7
|
+
start_period: 10s
|
|
8
|
+
start_interval: 200ms
|
|
9
|
+
interval: 10s
|
|
10
|
+
timeout: 1s
|
|
11
|
+
retries: 5
|
|
12
|
+
|
|
13
|
+
proxy:
|
|
14
|
+
volumes:
|
|
15
|
+
- ./proxy/passkey-server.yaml:/etc/traefik/conf.d/passkey-server.yaml
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
services:
|
|
2
|
+
paymaster:
|
|
3
|
+
image: ${CARTESI_SDK_IMAGE}
|
|
4
|
+
command: "mock-verifying-paymaster"
|
|
5
|
+
environment:
|
|
6
|
+
- ALTO_RPC=http://bundler:4337
|
|
7
|
+
- ANVIL_RPC=http://anvil:8545
|
|
8
|
+
healthcheck:
|
|
9
|
+
test: ["CMD", "curl", "-fsS", "http://127.0.0.1:3000/ping"]
|
|
10
|
+
start_period: 10s
|
|
11
|
+
start_interval: 200ms
|
|
12
|
+
interval: 10s
|
|
13
|
+
timeout: 1s
|
|
14
|
+
retries: 5
|
|
15
|
+
|
|
16
|
+
proxy:
|
|
17
|
+
volumes:
|
|
18
|
+
- ./proxy/paymaster.yaml:/etc/traefik/conf.d/paymaster.yaml
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
services:
|
|
2
|
+
proxy:
|
|
3
|
+
image: traefik:v3.3.4
|
|
4
|
+
healthcheck:
|
|
5
|
+
test: ["CMD", "traefik", "healthcheck", "--ping"]
|
|
6
|
+
start_period: 10s
|
|
7
|
+
start_interval: 200ms
|
|
8
|
+
interval: 10s
|
|
9
|
+
timeout: 1s
|
|
10
|
+
retries: 5
|
|
11
|
+
command:
|
|
12
|
+
[
|
|
13
|
+
"--ping=true",
|
|
14
|
+
"--entryPoints.web.address=:8088",
|
|
15
|
+
"--entryPoints.traefik.address=:8080",
|
|
16
|
+
"--metrics.prometheus=true",
|
|
17
|
+
"--metrics.prometheus.addServicesLabels=true",
|
|
18
|
+
"--providers.file.directory=/etc/traefik/conf.d",
|
|
19
|
+
"--providers.file.watch=true",
|
|
20
|
+
"--log",
|
|
21
|
+
"--log.level=INFO",
|
|
22
|
+
]
|
|
23
|
+
ports:
|
|
24
|
+
- ${CARTESI_LISTEN_PORT:-8080}:8088
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
anvil:
|
|
4
|
+
rule: "PathPrefix(`/anvil`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "remove-anvil-prefix"
|
|
7
|
+
service: anvil
|
|
8
|
+
middlewares:
|
|
9
|
+
remove-anvil-prefix:
|
|
10
|
+
replacePathRegex:
|
|
11
|
+
regex: "^/anvil(.*)"
|
|
12
|
+
replacement: "$1"
|
|
13
|
+
services:
|
|
14
|
+
anvil:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://anvil:8545"
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
bundler:
|
|
4
|
+
rule: "PathPrefix(`/bundler`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "cors"
|
|
7
|
+
- "remove-bundler-prefix"
|
|
8
|
+
service: bundler
|
|
9
|
+
middlewares:
|
|
10
|
+
cors:
|
|
11
|
+
headers:
|
|
12
|
+
accessControlAllowMethods:
|
|
13
|
+
- GET
|
|
14
|
+
- OPTIONS
|
|
15
|
+
- PUT
|
|
16
|
+
accessControlAllowHeaders: "*"
|
|
17
|
+
accessControlAllowOriginList:
|
|
18
|
+
- "*"
|
|
19
|
+
accessControlMaxAge: 100
|
|
20
|
+
addVaryHeader: true
|
|
21
|
+
remove-bundler-prefix:
|
|
22
|
+
replacePathRegex:
|
|
23
|
+
regex: "^/bundler/(.*)"
|
|
24
|
+
replacement: "/$1"
|
|
25
|
+
services:
|
|
26
|
+
bundler:
|
|
27
|
+
loadBalancer:
|
|
28
|
+
servers:
|
|
29
|
+
- url: "http://bundler:4337"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
espresso-reader:
|
|
4
|
+
rule: "PathPrefix(`/transaction`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "remove-espresso-reader-prefix"
|
|
7
|
+
service: espresso-reader
|
|
8
|
+
middlewares:
|
|
9
|
+
remove-espresso-reader-prefix:
|
|
10
|
+
replacePathRegex:
|
|
11
|
+
regex: "^/transaction/(.*)"
|
|
12
|
+
replacement: "/$1"
|
|
13
|
+
services:
|
|
14
|
+
espresso-reader:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://espresso_reader:8081"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
explorer-api:
|
|
4
|
+
rule: "PathPrefix(`/explorer-api`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "remove-explorer-api-prefix"
|
|
7
|
+
service: explorer-api
|
|
8
|
+
middlewares:
|
|
9
|
+
remove-explorer-api-prefix:
|
|
10
|
+
replacePathRegex:
|
|
11
|
+
regex: "^/explorer-api/(.*)"
|
|
12
|
+
replacement: "/$1"
|
|
13
|
+
services:
|
|
14
|
+
explorer-api:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://explorer_api:4350"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
passkey-server:
|
|
4
|
+
rule: "PathPrefix(`/passkey`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "remove-passkey-server-prefix"
|
|
7
|
+
service: passkey-server
|
|
8
|
+
middlewares:
|
|
9
|
+
remove-passkey-server-prefix:
|
|
10
|
+
replacePathRegex:
|
|
11
|
+
regex: "^/passkey/(.*)"
|
|
12
|
+
replacement: "/$1"
|
|
13
|
+
services:
|
|
14
|
+
passkey-server:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://passkey-server:3000"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
paymaster:
|
|
4
|
+
rule: "PathPrefix(`/paymaster`)"
|
|
5
|
+
middlewares:
|
|
6
|
+
- "remove-paymaster-prefix"
|
|
7
|
+
service: paymaster
|
|
8
|
+
middlewares:
|
|
9
|
+
remove-paymaster-prefix:
|
|
10
|
+
replacePathRegex:
|
|
11
|
+
regex: "^/paymaster/(.*)"
|
|
12
|
+
replacement: "/$1"
|
|
13
|
+
services:
|
|
14
|
+
paymaster:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://paymaster:3000"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
http:
|
|
2
|
+
routers:
|
|
3
|
+
inspect_server:
|
|
4
|
+
rule: "PathPrefix(`/inspect`)"
|
|
5
|
+
service: inspect_server
|
|
6
|
+
rpc_server:
|
|
7
|
+
rule: "PathPrefix(`/rpc`)"
|
|
8
|
+
service: rpc_server
|
|
9
|
+
services:
|
|
10
|
+
inspect_server:
|
|
11
|
+
loadBalancer:
|
|
12
|
+
servers:
|
|
13
|
+
- url: "http://rollups-node:10012"
|
|
14
|
+
rpc_server:
|
|
15
|
+
loadBalancer:
|
|
16
|
+
servers:
|
|
17
|
+
- url: "http://rollups-node:10011"
|
package/dist/config.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TomlPrimitive } from "smol-toml";
|
|
1
|
+
import { type TomlPrimitive } from "smol-toml";
|
|
2
2
|
/**
|
|
3
3
|
* Typed Errors
|
|
4
4
|
*/
|
|
@@ -29,7 +29,9 @@ export declare class RequiredFieldError extends Error {
|
|
|
29
29
|
export declare class InvalidStringArrayError extends Error {
|
|
30
30
|
constructor();
|
|
31
31
|
}
|
|
32
|
-
export declare const
|
|
32
|
+
export declare const DEFAULT_COMPOSE_ENVIRONMENT_NAME = "cartesi-rollups";
|
|
33
|
+
export declare const DEFAULT_SDK_VERSION = "0.12.0-alpha.15";
|
|
34
|
+
export declare const DEFAULT_SDK_IMAGE = "cartesi/sdk";
|
|
33
35
|
type DriveFormat = "ext2" | "sqfs";
|
|
34
36
|
export type ImageInfo = {
|
|
35
37
|
cmd: string[];
|
|
@@ -37,7 +39,7 @@ export type ImageInfo = {
|
|
|
37
39
|
env: string[];
|
|
38
40
|
workdir: string;
|
|
39
41
|
};
|
|
40
|
-
export type DriveResult = ImageInfo | undefined
|
|
42
|
+
export type DriveResult = ImageInfo | undefined;
|
|
41
43
|
export type DirectoryDriveConfig = {
|
|
42
44
|
builder: "directory";
|
|
43
45
|
extraSize: number;
|
|
@@ -94,7 +96,6 @@ export type Config = {
|
|
|
94
96
|
sdk: string;
|
|
95
97
|
};
|
|
96
98
|
export declare const defaultRootDriveConfig: () => DriveConfig;
|
|
97
|
-
export declare const defaultRamImage: () => string;
|
|
98
99
|
export declare const defaultMachineConfig: () => MachineConfig;
|
|
99
100
|
export declare const defaultConfig: () => Config;
|
|
100
101
|
export declare const getDriveFormat: (filename: string) => DriveFormat;
|
package/dist/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,aAAa,EAAsB,MAAM,WAAW,CAAC;AAEnE;;GAEG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;gBAC9B,OAAO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AC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,MAAM,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,GAAG,EAAE,MAAM,CAAC;CACf,CAAC;AAIF,eAAO,MAAM,sBAAsB,QAAO,WAOxC,CAAC;AAEH,eAAO,MAAM,oBAAoB,QAAO,aAYtC,CAAC;AAEH,eAAO,MAAM,aAAa,QAAO,MAI/B,CAAC;AA+LH,eAAO,MAAM,cAAc,GAAI,UAAU,MAAM,KAAG,WAUjD,CAAC;AA0GF,eAAO,MAAM,KAAK,GAAI,KAAK,MAAM,KAAG,MAanC,CAAC"}
|
package/dist/config.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import bytes from "bytes";
|
|
2
|
-
import
|
|
3
|
-
import { extname } from "path";
|
|
2
|
+
import { extname } from "node:path";
|
|
4
3
|
import { parse as parseToml } from "smol-toml";
|
|
5
4
|
/**
|
|
6
5
|
* Typed Errors
|
|
@@ -55,19 +54,19 @@ export class RequiredFieldError extends Error {
|
|
|
55
54
|
}
|
|
56
55
|
export class InvalidStringArrayError extends Error {
|
|
57
56
|
constructor() {
|
|
58
|
-
super(
|
|
57
|
+
super("Invalid string array");
|
|
59
58
|
this.name = "InvalidStringArrayError";
|
|
60
59
|
}
|
|
61
60
|
}
|
|
61
|
+
export const DEFAULT_COMPOSE_ENVIRONMENT_NAME = "cartesi-rollups";
|
|
62
62
|
/**
|
|
63
63
|
* Configuration for drives of a Cartesi Machine. A drive may already exist or be built by a builder
|
|
64
64
|
*/
|
|
65
65
|
const DEFAULT_FORMAT = "ext2";
|
|
66
66
|
const DEFAULT_RAM = "128Mi";
|
|
67
|
-
const
|
|
68
|
-
const
|
|
69
|
-
const
|
|
70
|
-
export const DEFAULT_SDK = "cartesi/sdk:0.12.0-alpha.0";
|
|
67
|
+
const DEFAULT_RAM_IMAGE = "/usr/share/cartesi-machine/images/linux.bin";
|
|
68
|
+
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.15";
|
|
69
|
+
export const DEFAULT_SDK_IMAGE = "cartesi/sdk";
|
|
71
70
|
export const defaultRootDriveConfig = () => ({
|
|
72
71
|
builder: "docker",
|
|
73
72
|
context: ".",
|
|
@@ -76,14 +75,6 @@ export const defaultRootDriveConfig = () => ({
|
|
|
76
75
|
format: DEFAULT_FORMAT,
|
|
77
76
|
tags: [],
|
|
78
77
|
});
|
|
79
|
-
export const defaultRamImage = () => {
|
|
80
|
-
switch (os.platform()) {
|
|
81
|
-
case "darwin":
|
|
82
|
-
return DEFAULT_RAM_IMAGE_MAC;
|
|
83
|
-
default:
|
|
84
|
-
return DEFAULT_RAM_IMAGE_LINUX;
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
78
|
export const defaultMachineConfig = () => ({
|
|
88
79
|
assertRollingTemplate: undefined,
|
|
89
80
|
bootargs: [],
|
|
@@ -93,20 +84,20 @@ export const defaultMachineConfig = () => ({
|
|
|
93
84
|
maxMCycle: undefined,
|
|
94
85
|
noRollup: undefined,
|
|
95
86
|
ramLength: DEFAULT_RAM,
|
|
96
|
-
ramImage:
|
|
87
|
+
ramImage: DEFAULT_RAM_IMAGE,
|
|
97
88
|
store: "image",
|
|
98
89
|
user: undefined,
|
|
99
90
|
});
|
|
100
91
|
export const defaultConfig = () => ({
|
|
101
92
|
drives: { root: defaultRootDriveConfig() },
|
|
102
93
|
machine: defaultMachineConfig(),
|
|
103
|
-
sdk:
|
|
94
|
+
sdk: `${DEFAULT_SDK_IMAGE}:${DEFAULT_SDK_VERSION}`,
|
|
104
95
|
});
|
|
105
96
|
const parseBoolean = (value, defaultValue) => {
|
|
106
97
|
if (value === undefined) {
|
|
107
98
|
return defaultValue;
|
|
108
99
|
}
|
|
109
|
-
|
|
100
|
+
if (typeof value === "boolean") {
|
|
110
101
|
return value;
|
|
111
102
|
}
|
|
112
103
|
throw new InvalidBooleanValueError(value);
|
|
@@ -115,7 +106,7 @@ const parseOptionalBoolean = (value) => {
|
|
|
115
106
|
if (value === undefined) {
|
|
116
107
|
return undefined;
|
|
117
108
|
}
|
|
118
|
-
|
|
109
|
+
if (typeof value === "boolean") {
|
|
119
110
|
return value;
|
|
120
111
|
}
|
|
121
112
|
throw new InvalidBooleanValueError(value);
|
|
@@ -124,7 +115,7 @@ const parseString = (value, defaultValue) => {
|
|
|
124
115
|
if (value === undefined) {
|
|
125
116
|
return defaultValue;
|
|
126
117
|
}
|
|
127
|
-
|
|
118
|
+
if (typeof value === "string") {
|
|
128
119
|
return value;
|
|
129
120
|
}
|
|
130
121
|
throw new InvalidStringValueError(value);
|
|
@@ -133,10 +124,10 @@ const parseStringArray = (value) => {
|
|
|
133
124
|
if (value === undefined) {
|
|
134
125
|
return [];
|
|
135
126
|
}
|
|
136
|
-
|
|
127
|
+
if (typeof value === "string") {
|
|
137
128
|
return [value];
|
|
138
129
|
}
|
|
139
|
-
|
|
130
|
+
if (typeof value === "object" && Array.isArray(value)) {
|
|
140
131
|
return value.map((v) => {
|
|
141
132
|
if (typeof v === "string") {
|
|
142
133
|
return v;
|
|
@@ -150,7 +141,7 @@ const parseRequiredString = (value, key) => {
|
|
|
150
141
|
if (value === undefined) {
|
|
151
142
|
throw new RequiredFieldError(key);
|
|
152
143
|
}
|
|
153
|
-
|
|
144
|
+
if (typeof value === "string") {
|
|
154
145
|
return value;
|
|
155
146
|
}
|
|
156
147
|
throw new InvalidStringValueError(value);
|
|
@@ -159,7 +150,7 @@ const parseOptionalString = (value) => {
|
|
|
159
150
|
if (value === undefined) {
|
|
160
151
|
return undefined;
|
|
161
152
|
}
|
|
162
|
-
|
|
153
|
+
if (typeof value === "string") {
|
|
163
154
|
return value;
|
|
164
155
|
}
|
|
165
156
|
throw new InvalidStringValueError(value);
|
|
@@ -168,10 +159,10 @@ const parseOptionalStringBoolean = (value) => {
|
|
|
168
159
|
if (value === undefined) {
|
|
169
160
|
return undefined;
|
|
170
161
|
}
|
|
171
|
-
|
|
162
|
+
if (typeof value === "string") {
|
|
172
163
|
return value;
|
|
173
164
|
}
|
|
174
|
-
|
|
165
|
+
if (typeof value === "boolean") {
|
|
175
166
|
return value;
|
|
176
167
|
}
|
|
177
168
|
throw new InvalidStringValueError(value);
|
|
@@ -180,10 +171,10 @@ const parseOptionalNumber = (value) => {
|
|
|
180
171
|
if (value === undefined) {
|
|
181
172
|
return undefined;
|
|
182
173
|
}
|
|
183
|
-
|
|
174
|
+
if (typeof value === "bigint") {
|
|
184
175
|
return value;
|
|
185
176
|
}
|
|
186
|
-
|
|
177
|
+
if (typeof value === "number") {
|
|
187
178
|
return BigInt(value);
|
|
188
179
|
}
|
|
189
180
|
throw new InvalidNumberValueError(value);
|
|
@@ -192,10 +183,10 @@ const parseBytes = (value, defaultValue) => {
|
|
|
192
183
|
if (value === undefined) {
|
|
193
184
|
return defaultValue;
|
|
194
185
|
}
|
|
195
|
-
|
|
186
|
+
if (typeof value === "bigint") {
|
|
196
187
|
return Number(value);
|
|
197
188
|
}
|
|
198
|
-
|
|
189
|
+
if (typeof value === "number" || typeof value === "string") {
|
|
199
190
|
const output = bytes.parse(value);
|
|
200
191
|
if (output !== null) {
|
|
201
192
|
return output;
|
|
@@ -207,7 +198,7 @@ const parseBuilder = (value) => {
|
|
|
207
198
|
if (value === undefined) {
|
|
208
199
|
return "docker";
|
|
209
200
|
}
|
|
210
|
-
|
|
201
|
+
if (typeof value === "string") {
|
|
211
202
|
switch (value) {
|
|
212
203
|
case "directory":
|
|
213
204
|
return "directory";
|
|
@@ -227,7 +218,7 @@ const parseFormat = (value) => {
|
|
|
227
218
|
if (value === undefined) {
|
|
228
219
|
return DEFAULT_FORMAT;
|
|
229
220
|
}
|
|
230
|
-
|
|
221
|
+
if (typeof value === "string") {
|
|
231
222
|
switch (value) {
|
|
232
223
|
case "ext2":
|
|
233
224
|
return "ext2";
|
|
@@ -241,7 +232,7 @@ const parseEmptyFormat = (value) => {
|
|
|
241
232
|
if (value === undefined) {
|
|
242
233
|
return DEFAULT_FORMAT;
|
|
243
234
|
}
|
|
244
|
-
|
|
235
|
+
if (typeof value === "string") {
|
|
245
236
|
switch (value) {
|
|
246
237
|
case "ext2":
|
|
247
238
|
return "ext2";
|
|
@@ -268,7 +259,7 @@ const parseMachine = (value) => {
|
|
|
268
259
|
maxMCycle: parseOptionalNumber(toml["max-mcycle"]),
|
|
269
260
|
noRollup: parseBoolean(toml["no-rollup"], false),
|
|
270
261
|
ramLength: parseString(toml["ram-length"], DEFAULT_RAM),
|
|
271
|
-
ramImage: parseString(toml["ram-image"],
|
|
262
|
+
ramImage: parseString(toml["ram-image"], DEFAULT_RAM_IMAGE),
|
|
272
263
|
store: "image",
|
|
273
264
|
user: parseOptionalString(toml.user),
|
|
274
265
|
};
|
|
@@ -372,7 +363,7 @@ export const parse = (str) => {
|
|
|
372
363
|
const config = {
|
|
373
364
|
drives: parseDrives(toml.drives),
|
|
374
365
|
machine: parseMachine(toml.machine),
|
|
375
|
-
sdk: parseString(toml.sdk,
|
|
366
|
+
sdk: parseString(toml.sdk, `${DEFAULT_SDK_IMAGE}:${DEFAULT_SDK_VERSION}`),
|
|
376
367
|
};
|
|
377
368
|
return config;
|
|
378
369
|
};
|