@cartesi/cli 0.14.0
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/LICENSE +202 -0
- package/README.md +19 -0
- package/bin/dev.cmd +3 -0
- package/bin/dev.js +25 -0
- package/bin/run.cmd +3 -0
- package/bin/run.js +8 -0
- package/dist/baseCommand.d.ts +26 -0
- package/dist/baseCommand.d.ts.map +1 -0
- package/dist/baseCommand.js +80 -0
- package/dist/commands/address-book.d.ts +9 -0
- package/dist/commands/address-book.d.ts.map +1 -0
- package/dist/commands/address-book.js +21 -0
- package/dist/commands/build.d.ts +24 -0
- package/dist/commands/build.d.ts.map +1 -0
- package/dist/commands/build.js +219 -0
- package/dist/commands/clean.d.ts +8 -0
- package/dist/commands/clean.d.ts.map +1 -0
- package/dist/commands/clean.js +11 -0
- package/dist/commands/create.d.ts +16 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +66 -0
- package/dist/commands/deploy/build.d.ts +12 -0
- package/dist/commands/deploy/build.d.ts.map +1 -0
- package/dist/commands/deploy/build.js +61 -0
- package/dist/commands/deploy/index.d.ts +13 -0
- package/dist/commands/deploy/index.d.ts.map +1 -0
- package/dist/commands/deploy/index.js +78 -0
- package/dist/commands/doctor.d.ts +13 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +106 -0
- package/dist/commands/hash.d.ts +10 -0
- package/dist/commands/hash.d.ts.map +1 -0
- package/dist/commands/hash.js +22 -0
- package/dist/commands/run.d.ts +15 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +137 -0
- package/dist/commands/send/dapp-address.d.ts +9 -0
- package/dist/commands/send/dapp-address.d.ts.map +1 -0
- package/dist/commands/send/dapp-address.js +20 -0
- package/dist/commands/send/erc20.d.ts +14 -0
- package/dist/commands/send/erc20.d.ts.map +1 -0
- package/dist/commands/send/erc20.js +70 -0
- package/dist/commands/send/erc721.d.ts +14 -0
- package/dist/commands/send/erc721.d.ts.map +1 -0
- package/dist/commands/send/erc721.js +73 -0
- package/dist/commands/send/ether.d.ts +13 -0
- package/dist/commands/send/ether.d.ts.map +1 -0
- package/dist/commands/send/ether.js +32 -0
- package/dist/commands/send/generic.d.ts +15 -0
- package/dist/commands/send/generic.d.ts.map +1 -0
- package/dist/commands/send/generic.js +119 -0
- package/dist/commands/send/index.d.ts +28 -0
- package/dist/commands/send/index.d.ts.map +1 -0
- package/dist/commands/send/index.js +102 -0
- package/dist/commands/shell.d.ts +14 -0
- package/dist/commands/shell.d.ts.map +1 -0
- package/dist/commands/shell.js +65 -0
- package/dist/contracts.d.ts +4863 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/contracts.js +2074 -0
- package/dist/flags.d.ts +17 -0
- package/dist/flags.d.ts.map +1 -0
- package/dist/flags.js +28 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1 -0
- package/dist/node/DockerfileDeploy.txt +4 -0
- package/dist/node/default.env +28 -0
- package/dist/node/docker-compose-anvil.yaml +49 -0
- package/dist/node/docker-compose-database.yaml +15 -0
- package/dist/node/docker-compose-envfile.yaml +4 -0
- package/dist/node/docker-compose-explorer.yaml +84 -0
- package/dist/node/docker-compose-host.yaml +30 -0
- package/dist/node/docker-compose-prompt.yaml +17 -0
- package/dist/node/docker-compose-proxy.yaml +48 -0
- package/dist/node/docker-compose-snapshot-volume.yaml +8 -0
- package/dist/node/docker-compose-validator.yaml +59 -0
- package/dist/prompts.d.ts +62 -0
- package/dist/prompts.d.ts.map +1 -0
- package/dist/prompts.js +159 -0
- package/dist/types/docker.d.ts +22 -0
- package/dist/types/docker.d.ts.map +1 -0
- package/dist/types/docker.js +1 -0
- package/dist/wallet.d.ts +24 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +204 -0
- package/oclif.manifest.json +887 -0
- package/package.json +100 -0
package/dist/flags.d.ts
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare const address: import("@oclif/core/lib/interfaces").FlagDefinition<`0x${string}`, import("@oclif/core/lib/interfaces").CustomOptions, {
|
|
2
|
+
multiple: false;
|
|
3
|
+
requiredOrDefaulted: false;
|
|
4
|
+
}>;
|
|
5
|
+
export declare const bigint: import("@oclif/core/lib/interfaces").FlagDefinition<bigint, import("@oclif/core/lib/interfaces").CustomOptions, {
|
|
6
|
+
multiple: false;
|
|
7
|
+
requiredOrDefaulted: false;
|
|
8
|
+
}>;
|
|
9
|
+
export declare const number: import("@oclif/core/lib/interfaces").FlagDefinition<`${number}`, import("@oclif/core/lib/interfaces").CustomOptions, {
|
|
10
|
+
multiple: false;
|
|
11
|
+
requiredOrDefaulted: false;
|
|
12
|
+
}>;
|
|
13
|
+
export declare const hex: import("@oclif/core/lib/interfaces").FlagDefinition<`0x${string}`, import("@oclif/core/lib/interfaces").CustomOptions, {
|
|
14
|
+
multiple: false;
|
|
15
|
+
requiredOrDefaulted: false;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=flags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,OAAO;;;EAOlB,CAAC;AAGH,eAAO,MAAM,MAAM;;;EAEjB,CAAC;AAGH,eAAO,MAAM,MAAM;;;EAEjB,CAAC;AAGH,eAAO,MAAM,GAAG;;;EAOd,CAAC"}
|
package/dist/flags.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Flags } from "@oclif/core";
|
|
2
|
+
import { isAddress, isHex } from "viem";
|
|
3
|
+
// custom flag for Address, does validation
|
|
4
|
+
export const address = Flags.custom({
|
|
5
|
+
parse: async (input) => {
|
|
6
|
+
if (isAddress(input)) {
|
|
7
|
+
return input;
|
|
8
|
+
}
|
|
9
|
+
throw new Error("Invalid address");
|
|
10
|
+
},
|
|
11
|
+
});
|
|
12
|
+
// custom flag for bigint
|
|
13
|
+
export const bigint = Flags.custom({
|
|
14
|
+
parse: async (input) => BigInt(input),
|
|
15
|
+
});
|
|
16
|
+
// custom flag for string number
|
|
17
|
+
export const number = Flags.custom({
|
|
18
|
+
parse: async (input) => input,
|
|
19
|
+
});
|
|
20
|
+
// custom flag for hex string
|
|
21
|
+
export const hex = Flags.custom({
|
|
22
|
+
parse: async (input) => {
|
|
23
|
+
if (isHex(input)) {
|
|
24
|
+
return input;
|
|
25
|
+
}
|
|
26
|
+
throw new Error("Invalid hex string");
|
|
27
|
+
},
|
|
28
|
+
});
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { run } from "@oclif/core";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# cartesi/rollups-node
|
|
2
|
+
CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-error}"
|
|
3
|
+
CARTESI_LOG_TIMESTAMP="${CARTESI_LOG_TIMESTAMP:-true}"
|
|
4
|
+
CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}"
|
|
5
|
+
CARTESI_HTTP_PORT="${CARTESI_HTTP_PORT:-10000}"
|
|
6
|
+
CARTESI_FEATURE_HOST_MODE="${CARTESI_FEATURE_HOST_MODE:-false}"
|
|
7
|
+
CARTESI_FEATURE_READER_MODE="${CARTESI_FEATURE_READER_MODE:-false}"
|
|
8
|
+
CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK="${CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK:-true}"
|
|
9
|
+
CARTESI_EPOCH_DURATION="${CARTESI_EPOCH_DURATION:-3600}"
|
|
10
|
+
CARTESI_BLOCKCHAIN_ID="${CARTESI_BLOCKCHAIN_ID:-31337}"
|
|
11
|
+
CARTESI_BLOCKCHAIN_HTTP_ENDPOINT="${CARTESI_BLOCKCHAIN_HTTP_ENDPOINT:-http://anvil:8545}"
|
|
12
|
+
CARTESI_BLOCKCHAIN_WS_ENDPOINT="${CARTESI_BLOCKCHAIN_WS_ENDPOINT:-ws://anvil:8545}"
|
|
13
|
+
CARTESI_BLOCKCHAIN_IS_LEGACY="${CARTESI_BLOCKCHAIN_IS_LEGACY:-false}"
|
|
14
|
+
CARTESI_BLOCKCHAIN_FINALITY_OFFSET="${CARTESI_BLOCKCHAIN_FINALITY_OFFSET:-0}"
|
|
15
|
+
CARTESI_CONTRACTS_APPLICATION_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_ADDRESS:-0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e}"
|
|
16
|
+
CARTESI_CONTRACTS_APPLICATION_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_APPLICATION_DEPLOYMENT_BLOCK_NUMBER:-22}"
|
|
17
|
+
CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER="${CARTESI_CONTRACTS_INPUT_BOX_DEPLOYMENT_BLOCK_NUMBER:-22}"
|
|
18
|
+
CARTESI_CONTRACTS_HISTORY_ADDRESS="${CARTESI_CONTRACTS_HISTORY_ADDRESS:-0x325272217ae6815b494bf38ced004c5eb8a7cda7}"
|
|
19
|
+
CARTESI_CONTRACTS_AUTHORITY_ADDRESS="${CARTESI_CONTRACTS_AUTHORITY_ADDRESS:-0x58c93f83fb3304730c95aad2e360cdb88b782010}"
|
|
20
|
+
CARTESI_CONTRACTS_INPUT_BOX_ADDRESS="${CARTESI_CONTRACTS_INPUT_BOX_ADDRESS:-0x59b22D57D4f067708AB0c00552767405926dc768}"
|
|
21
|
+
CARTESI_SNAPSHOT_DIR="${CARTESI_SNAPSHOT_DIR:-/usr/share/cartesi/snapshot}"
|
|
22
|
+
CARTESI_AUTH_MNEMONIC="${CARTESI_AUTH_MNEMONIC:-test test test test test test test test test test test junk}"
|
|
23
|
+
CARTESI_POSTGRES_ENDPOINT="${CARTESI_POSTGRES_ENDPOINT:-postgres://postgres:password@database:5432/postgres}"
|
|
24
|
+
CARTESI_EXPERIMENTAL_DISABLE_CONFIG_LOG="${CARTESI_EXPERIMENTAL_DISABLE_CONFIG_LOG:-false}"
|
|
25
|
+
CARTESI_EXPERIMENTAL_SERVER_MANAGER_BYPASS_LOG="${CARTESI_EXPERIMENTAL_SERVER_MANAGER_BYPASS_LOG:-false}"
|
|
26
|
+
|
|
27
|
+
# server-manager
|
|
28
|
+
SM_DEADLINE_MACHINE="${SM_DEADLINE_MACHINE:-30000}"
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
services:
|
|
2
|
+
anvil:
|
|
3
|
+
image: cartesi/sdk:0.6.0
|
|
4
|
+
command:
|
|
5
|
+
[
|
|
6
|
+
"devnet",
|
|
7
|
+
"--block-time",
|
|
8
|
+
"${BLOCK_TIME:-5}",
|
|
9
|
+
"${ANVIL_VERBOSITY:---silent}",
|
|
10
|
+
]
|
|
11
|
+
healthcheck:
|
|
12
|
+
test: ["CMD", "eth_isready"]
|
|
13
|
+
interval: 10s
|
|
14
|
+
timeout: 1s
|
|
15
|
+
retries: 5
|
|
16
|
+
environment:
|
|
17
|
+
ANVIL_IP_ADDR: 0.0.0.0
|
|
18
|
+
ports:
|
|
19
|
+
- 8545:8545
|
|
20
|
+
|
|
21
|
+
dapp_deployer:
|
|
22
|
+
image: cartesi/sdk:0.6.0
|
|
23
|
+
restart: on-failure
|
|
24
|
+
depends_on:
|
|
25
|
+
anvil:
|
|
26
|
+
condition: service_started
|
|
27
|
+
command:
|
|
28
|
+
[
|
|
29
|
+
"cast",
|
|
30
|
+
"send",
|
|
31
|
+
"--rpc-url",
|
|
32
|
+
"http://anvil:8545",
|
|
33
|
+
"--private-key",
|
|
34
|
+
"0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80",
|
|
35
|
+
"0x9E32e06Fd23675b2DF8eA8e6b0A25c3DF6a60AbC",
|
|
36
|
+
"deployContracts(address,address,bytes32,bytes32)",
|
|
37
|
+
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
38
|
+
"0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
|
|
39
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
40
|
+
"0x0000000000000000000000000000000000000000000000000000000000000000",
|
|
41
|
+
]
|
|
42
|
+
|
|
43
|
+
prompt:
|
|
44
|
+
image: debian:bookworm-slim
|
|
45
|
+
environment:
|
|
46
|
+
PROMPT_TXT_01_ANVIL: "Anvil running at http://localhost:8545"
|
|
47
|
+
|
|
48
|
+
volumes:
|
|
49
|
+
blockchain-data: {}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
services:
|
|
2
|
+
database:
|
|
3
|
+
image: postgres:15-alpine
|
|
4
|
+
healthcheck:
|
|
5
|
+
test: ["CMD-SHELL", "pg_isready -U postgres || exit 1"]
|
|
6
|
+
interval: 10s
|
|
7
|
+
timeout: 5s
|
|
8
|
+
retries: 5
|
|
9
|
+
environment:
|
|
10
|
+
- POSTGRES_PASSWORD=password
|
|
11
|
+
|
|
12
|
+
database_creator:
|
|
13
|
+
depends_on:
|
|
14
|
+
database:
|
|
15
|
+
condition: service_healthy
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
services:
|
|
2
|
+
database_creator:
|
|
3
|
+
image: postgres:15-alpine
|
|
4
|
+
command: ["createdb", "squid"]
|
|
5
|
+
environment:
|
|
6
|
+
PGHOST: ${PGHOST:-database}
|
|
7
|
+
PGPORT: ${PGPORT:-5432}
|
|
8
|
+
PGUSER: ${PGUSER:-postgres}
|
|
9
|
+
PGPASSWORD: ${PGPASSWORD:-password}
|
|
10
|
+
PGDATABASE: ${PGDATABASE:-postgres}
|
|
11
|
+
|
|
12
|
+
explorer_api:
|
|
13
|
+
image: cartesi/rollups-explorer-api:0.4.0
|
|
14
|
+
environment:
|
|
15
|
+
DB_NAME: ${PGDATABASE:-squid}
|
|
16
|
+
DB_PORT: ${PGPORT:-5432}
|
|
17
|
+
DB_HOST: ${PGHOST:-database}
|
|
18
|
+
DB_PASS: ${PGPASSWORD:-password}
|
|
19
|
+
GQL_PORT: 4350
|
|
20
|
+
expose:
|
|
21
|
+
- 4350
|
|
22
|
+
command: ["sqd", "serve:prod"]
|
|
23
|
+
depends_on:
|
|
24
|
+
database_creator:
|
|
25
|
+
condition: service_completed_successfully
|
|
26
|
+
|
|
27
|
+
squid_processor:
|
|
28
|
+
image: cartesi/rollups-explorer-api:0.4.0
|
|
29
|
+
environment:
|
|
30
|
+
CHAIN_ID: ${CHAIN_ID:-31337}
|
|
31
|
+
RPC_URL_31337: ${RPC_URL:-http://anvil:8545}
|
|
32
|
+
DB_NAME: ${PGDATABASE:-squid}
|
|
33
|
+
DB_PORT: ${PGPORT:-5432}
|
|
34
|
+
DB_HOST: ${PGHOST:-database}
|
|
35
|
+
DB_PASS: ${PGPASSWORD:-password}
|
|
36
|
+
command: ["sqd", "process:prod"]
|
|
37
|
+
depends_on:
|
|
38
|
+
database_creator:
|
|
39
|
+
condition: service_completed_successfully
|
|
40
|
+
|
|
41
|
+
explorer:
|
|
42
|
+
image: cartesi/rollups-explorer:0.9.0
|
|
43
|
+
expose:
|
|
44
|
+
- 3000
|
|
45
|
+
depends_on:
|
|
46
|
+
database_creator:
|
|
47
|
+
condition: service_completed_successfully
|
|
48
|
+
|
|
49
|
+
prompt:
|
|
50
|
+
image: debian:bookworm-slim
|
|
51
|
+
environment:
|
|
52
|
+
PROMPT_TXT_04_EXPLORER: "Explorer running at http://localhost:${CARTESI_LISTEN_PORT}/explorer/"
|
|
53
|
+
|
|
54
|
+
traefik-config-generator:
|
|
55
|
+
environment:
|
|
56
|
+
TRAEFIK_CONFIG_EXPLORER_API: |
|
|
57
|
+
http:
|
|
58
|
+
routers:
|
|
59
|
+
explorer-api:
|
|
60
|
+
rule: "PathPrefix(`/explorer-api`)"
|
|
61
|
+
middlewares:
|
|
62
|
+
- "remove-explorer-api-prefix"
|
|
63
|
+
service: explorer-api
|
|
64
|
+
middlewares:
|
|
65
|
+
remove-explorer-api-prefix:
|
|
66
|
+
replacePathRegex:
|
|
67
|
+
regex: "^/explorer-api/(.*)"
|
|
68
|
+
replacement: "/$1"
|
|
69
|
+
services:
|
|
70
|
+
explorer-api:
|
|
71
|
+
loadBalancer:
|
|
72
|
+
servers:
|
|
73
|
+
- url: "http://explorer_api:4350"
|
|
74
|
+
TRAEFIK_CONFIG_EXPLORER: |
|
|
75
|
+
http:
|
|
76
|
+
routers:
|
|
77
|
+
explorer:
|
|
78
|
+
rule: "PathPrefix(`/explorer`)"
|
|
79
|
+
service: explorer
|
|
80
|
+
services:
|
|
81
|
+
explorer:
|
|
82
|
+
loadBalancer:
|
|
83
|
+
servers:
|
|
84
|
+
- url: "http://explorer:3000"
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
services:
|
|
2
|
+
validator:
|
|
3
|
+
environment:
|
|
4
|
+
CARTESI_FEATURE_HOST_MODE: true
|
|
5
|
+
command: ["cartesi-rollups-node"]
|
|
6
|
+
|
|
7
|
+
traefik-config-generator:
|
|
8
|
+
environment:
|
|
9
|
+
TRAEFIK_CONFIG_HOST_RUNNER: |
|
|
10
|
+
http:
|
|
11
|
+
routers:
|
|
12
|
+
host-runner:
|
|
13
|
+
rule: "PathPrefix(`/host-runner`)"
|
|
14
|
+
middlewares:
|
|
15
|
+
- "replace-host-runner-prefix"
|
|
16
|
+
service: host-runner
|
|
17
|
+
middlewares:
|
|
18
|
+
replace-host-runner-prefix:
|
|
19
|
+
replacePathRegex:
|
|
20
|
+
regex: "^/host-runner/(.*)"
|
|
21
|
+
replacement: "/rollup/$1"
|
|
22
|
+
services:
|
|
23
|
+
host-runner:
|
|
24
|
+
loadBalancer:
|
|
25
|
+
servers:
|
|
26
|
+
- url: "http://validator:10000"
|
|
27
|
+
|
|
28
|
+
prompt:
|
|
29
|
+
environment:
|
|
30
|
+
PROMPT_TXT_05_HOST_RUNNER: "Host Runner running at http://localhost:${CARTESI_LISTEN_PORT}/host-runner"
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
services:
|
|
2
|
+
prompt:
|
|
3
|
+
image: debian:bookworm-slim
|
|
4
|
+
environment:
|
|
5
|
+
PROMPT_TXT_10_EXIT: "Press Ctrl+C to stop the node"
|
|
6
|
+
command:
|
|
7
|
+
- /bin/bash
|
|
8
|
+
- -c
|
|
9
|
+
- |
|
|
10
|
+
for txt_file in $${!PROMPT_TXT_*}
|
|
11
|
+
do
|
|
12
|
+
declare -n txt_content=$$txt_file
|
|
13
|
+
_txt_file=$${txt_file:11}
|
|
14
|
+
echo "$$txt_content"
|
|
15
|
+
done
|
|
16
|
+
trap exit INT TERM; sleep infinity & wait
|
|
17
|
+
working_dir: /prompt
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
services:
|
|
2
|
+
traefik-config-generator:
|
|
3
|
+
image: debian:bookworm-slim
|
|
4
|
+
command:
|
|
5
|
+
- /bin/bash
|
|
6
|
+
- -c
|
|
7
|
+
- |
|
|
8
|
+
for cfg_file in $${!TRAEFIK_CONFIG_*}
|
|
9
|
+
do
|
|
10
|
+
declare -n cfg_content=$$cfg_file
|
|
11
|
+
_cfg_file=$${cfg_file:15}
|
|
12
|
+
echo "$$cfg_content" > /etc/traefik/conf.d/$${_cfg_file,,}.yaml
|
|
13
|
+
done
|
|
14
|
+
volumes:
|
|
15
|
+
- traefik-conf:/etc/traefik/conf.d
|
|
16
|
+
|
|
17
|
+
proxy:
|
|
18
|
+
image: traefik:v2.10
|
|
19
|
+
depends_on:
|
|
20
|
+
traefik-config-generator:
|
|
21
|
+
condition: service_completed_successfully
|
|
22
|
+
healthcheck:
|
|
23
|
+
test: ["CMD", "traefik", "healthcheck", "--ping"]
|
|
24
|
+
interval: 5s
|
|
25
|
+
timeout: 1s
|
|
26
|
+
retries: 5
|
|
27
|
+
command:
|
|
28
|
+
[
|
|
29
|
+
"--ping=true",
|
|
30
|
+
"--entryPoints.web.address=:8088",
|
|
31
|
+
"--entryPoints.traefik.address=:8080",
|
|
32
|
+
"--metrics.prometheus=true",
|
|
33
|
+
"--metrics.prometheus.addServicesLabels=true",
|
|
34
|
+
"--providers.file.directory=/etc/traefik/conf.d",
|
|
35
|
+
"--providers.file.watch=true",
|
|
36
|
+
]
|
|
37
|
+
ports:
|
|
38
|
+
- ${CARTESI_LISTEN_PORT:-8080}:8088
|
|
39
|
+
volumes:
|
|
40
|
+
- traefik-conf:/etc/traefik/conf.d
|
|
41
|
+
|
|
42
|
+
prompt:
|
|
43
|
+
depends_on:
|
|
44
|
+
proxy:
|
|
45
|
+
condition: service_healthy
|
|
46
|
+
|
|
47
|
+
volumes:
|
|
48
|
+
traefik-conf: {}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
services:
|
|
2
|
+
validator:
|
|
3
|
+
image: cartesi/rollups-node:1.4.0
|
|
4
|
+
depends_on:
|
|
5
|
+
dapp_deployer:
|
|
6
|
+
condition: service_completed_successfully
|
|
7
|
+
expose:
|
|
8
|
+
- "10000"
|
|
9
|
+
healthcheck:
|
|
10
|
+
test: ["CMD", "curl", "-f", "http://localhost:10000/healthz"]
|
|
11
|
+
interval: 10s
|
|
12
|
+
timeout: 1s
|
|
13
|
+
retries: 5
|
|
14
|
+
command:
|
|
15
|
+
- /bin/bash
|
|
16
|
+
- -c
|
|
17
|
+
- |
|
|
18
|
+
mkdir -p "$CARTESI_SNAPSHOT_DIR"
|
|
19
|
+
cp --recursive /tmp/snapshot/* "$CARTESI_SNAPSHOT_DIR"
|
|
20
|
+
exec cartesi-rollups-node
|
|
21
|
+
|
|
22
|
+
env_file:
|
|
23
|
+
- ${CARTESI_BIN_PATH}/node/default.env
|
|
24
|
+
|
|
25
|
+
proxy:
|
|
26
|
+
depends_on:
|
|
27
|
+
validator:
|
|
28
|
+
condition: service_healthy
|
|
29
|
+
|
|
30
|
+
prompt:
|
|
31
|
+
image: debian:bookworm-slim
|
|
32
|
+
environment:
|
|
33
|
+
PROMPT_TXT_02_GRAPHQL: "GraphQL running at http://localhost:${CARTESI_LISTEN_PORT}/graphql"
|
|
34
|
+
PROMPT_TXT_03_INSPECT: "Inspect running at http://localhost:${CARTESI_LISTEN_PORT}/inspect/"
|
|
35
|
+
|
|
36
|
+
traefik-config-generator:
|
|
37
|
+
environment:
|
|
38
|
+
TRAEFIK_CONFIG_INSPECT_SERVER: |
|
|
39
|
+
http:
|
|
40
|
+
routers:
|
|
41
|
+
inspect_server:
|
|
42
|
+
rule: "PathPrefix(`/inspect`)"
|
|
43
|
+
service: inspect_server
|
|
44
|
+
services:
|
|
45
|
+
inspect_server:
|
|
46
|
+
loadBalancer:
|
|
47
|
+
servers:
|
|
48
|
+
- url: "http://validator:10000/inspect"
|
|
49
|
+
TRAEFIK_CONFIG_GRAPHQL_SERVER: |
|
|
50
|
+
http:
|
|
51
|
+
routers:
|
|
52
|
+
graphql_server:
|
|
53
|
+
rule: "PathPrefix(`/graphql`)"
|
|
54
|
+
service: graphql_server
|
|
55
|
+
services:
|
|
56
|
+
graphql_server:
|
|
57
|
+
loadBalancer:
|
|
58
|
+
servers:
|
|
59
|
+
- url: "http://validator:10000/graphql"
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Separator } from "@inquirer/core";
|
|
2
|
+
import input from "@inquirer/input";
|
|
3
|
+
import select from "@inquirer/select";
|
|
4
|
+
import { CancelablePromise, Context } from "@inquirer/type";
|
|
5
|
+
import { Address, Hex } from "viem";
|
|
6
|
+
type InputConfig = Parameters<typeof input>[0];
|
|
7
|
+
type SelectConfig<ValueType> = Parameters<typeof select<ValueType>>[0];
|
|
8
|
+
/**
|
|
9
|
+
* Prompt for an address value.
|
|
10
|
+
* @param config inquirer config
|
|
11
|
+
* @returns address
|
|
12
|
+
*/
|
|
13
|
+
export type AddressPromptConfig = InputConfig & {
|
|
14
|
+
default?: Address;
|
|
15
|
+
};
|
|
16
|
+
export declare const addressInput: (config: AddressPromptConfig) => Promise<Address>;
|
|
17
|
+
/**
|
|
18
|
+
* Prompt for a hex value.
|
|
19
|
+
* @param config inquirer config
|
|
20
|
+
* @returns hex
|
|
21
|
+
*/
|
|
22
|
+
export type HexPromptConfig = InputConfig & {
|
|
23
|
+
default?: Hex;
|
|
24
|
+
};
|
|
25
|
+
export declare const hexInput: (config: HexPromptConfig) => Promise<Hex>;
|
|
26
|
+
export type BigintPromptConfig = InputConfig & {
|
|
27
|
+
decimals: number;
|
|
28
|
+
default?: bigint;
|
|
29
|
+
};
|
|
30
|
+
export declare const bigintInput: (config: BigintPromptConfig) => Promise<bigint>;
|
|
31
|
+
/**
|
|
32
|
+
* Prompt for a bytes input, by choosing from different encoding options.
|
|
33
|
+
* @param config inquirer config
|
|
34
|
+
* @returns bytes as hex string
|
|
35
|
+
*/
|
|
36
|
+
export declare const bytesInput: (config: InputConfig & {
|
|
37
|
+
message: string;
|
|
38
|
+
}) => Promise<Hex>;
|
|
39
|
+
/**
|
|
40
|
+
* Prompt for ABI encoded parameters.
|
|
41
|
+
* @param config inquirer config
|
|
42
|
+
* @returns ABI encoded parameters as hex string
|
|
43
|
+
*/
|
|
44
|
+
export declare const abiParamsInput: (config: InputConfig & {
|
|
45
|
+
message: string;
|
|
46
|
+
}) => Promise<`0x${string}`>;
|
|
47
|
+
export type Choice<ValueType> = {
|
|
48
|
+
value: ValueType;
|
|
49
|
+
name?: string;
|
|
50
|
+
description?: string;
|
|
51
|
+
disabled?: boolean | string;
|
|
52
|
+
type?: never;
|
|
53
|
+
};
|
|
54
|
+
export type SelectAutoConfig<ValueType> = SelectConfig<ValueType> & {
|
|
55
|
+
choices: ReadonlyArray<Choice<ValueType> | Separator>;
|
|
56
|
+
pageSize?: number;
|
|
57
|
+
};
|
|
58
|
+
export declare const selectAuto: <ValueType>(config: SelectAutoConfig<ValueType> & {
|
|
59
|
+
discardDisabled?: boolean;
|
|
60
|
+
}, context?: Context | undefined) => CancelablePromise<ValueType>;
|
|
61
|
+
export {};
|
|
62
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../src/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,KAAK,MAAM,iBAAiB,CAAC;AACpC,OAAO,MAAM,MAAM,kBAAkB,CAAC;AACtC,OAAO,EAAE,iBAAiB,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAE5D,OAAO,EACH,OAAO,EACP,GAAG,EASN,MAAM,MAAM,CAAC;AAEd,KAAK,WAAW,GAAG,UAAU,CAAC,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,KAAK,YAAY,CAAC,SAAS,IAAI,UAAU,CAAC,OAAO,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAEvE;;;;GAIG;AACH,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,CAAC;AACtE,eAAO,MAAM,YAAY,WACb,mBAAmB,KAC5B,QAAQ,OAAO,CAMjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAC9D,eAAO,MAAM,QAAQ,WAAkB,eAAe,KAAG,QAAQ,GAAG,CAMnE,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,WAAW,GAAG;IAC3C,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AACF,eAAO,MAAM,WAAW,WACZ,kBAAkB,KAC3B,QAAQ,MAAM,CAUhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,WACX,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAC1C,QAAQ,GAAG,CA8Cb,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,WACf,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAC1C,QAAQ,KAAK,MAAM,EAAE,CA+DvB,CAAC;AAGF,MAAM,MAAM,MAAM,CAAC,SAAS,IAAI;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;IAC5B,IAAI,CAAC,EAAE,KAAK,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,CAAC,SAAS,IAAI,YAAY,CAAC,SAAS,CAAC,GAAG;IAChE,OAAO,EAAE,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,SAAS,CAAC,CAAC;IACtD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,UAAU,sBACX,iBAAiB,SAAS,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,YACzD,OAAO,GAAG,SAAS,KAC9B,kBAAkB,SAAS,CAwB7B,CAAC"}
|
package/dist/prompts.js
ADDED
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import confirm from "@inquirer/confirm";
|
|
2
|
+
import input from "@inquirer/input";
|
|
3
|
+
import select from "@inquirer/select";
|
|
4
|
+
import { CancelablePromise } from "@inquirer/type";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
import { encodeAbiParameters, formatUnits, getAddress, isAddress, isHex, parseAbiParameters, parseUnits, stringToHex, } from "viem";
|
|
7
|
+
export const addressInput = async (config) => {
|
|
8
|
+
const address = await input({
|
|
9
|
+
...config,
|
|
10
|
+
validate: (value) => isAddress(value) || "Enter a valid address",
|
|
11
|
+
});
|
|
12
|
+
return getAddress(address);
|
|
13
|
+
};
|
|
14
|
+
export const hexInput = async (config) => {
|
|
15
|
+
const value = await input({
|
|
16
|
+
...config,
|
|
17
|
+
validate: (value) => isHex(value) || "Enter a valid hex value",
|
|
18
|
+
});
|
|
19
|
+
return value;
|
|
20
|
+
};
|
|
21
|
+
export const bigintInput = async (config) => {
|
|
22
|
+
const defaultValue = config.default != undefined
|
|
23
|
+
? formatUnits(config.default, config.decimals)
|
|
24
|
+
: undefined;
|
|
25
|
+
const value = await input({
|
|
26
|
+
...config,
|
|
27
|
+
default: defaultValue,
|
|
28
|
+
});
|
|
29
|
+
return parseUnits(value, config.decimals);
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Prompt for a bytes input, by choosing from different encoding options.
|
|
33
|
+
* @param config inquirer config
|
|
34
|
+
* @returns bytes as hex string
|
|
35
|
+
*/
|
|
36
|
+
export const bytesInput = async (config) => {
|
|
37
|
+
const encoding = await select({
|
|
38
|
+
...config,
|
|
39
|
+
choices: [
|
|
40
|
+
{
|
|
41
|
+
value: "string",
|
|
42
|
+
name: "String encoding",
|
|
43
|
+
description: "Convert UTF-8 string to bytes",
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
value: "hex",
|
|
47
|
+
name: "Hex string encoding",
|
|
48
|
+
description: "Convert a hex string to bytes (must start with 0x)",
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
value: "abi",
|
|
52
|
+
name: "ABI encoding",
|
|
53
|
+
description: "Input as ABI encoding parameters https://abitype.dev/api/human.html#parseabiparameters",
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
});
|
|
57
|
+
switch (encoding) {
|
|
58
|
+
case "hex": {
|
|
59
|
+
const valueHex = await hexInput({
|
|
60
|
+
...config,
|
|
61
|
+
default: "0x",
|
|
62
|
+
message: `${config.message} (as hex-string)`,
|
|
63
|
+
});
|
|
64
|
+
return valueHex;
|
|
65
|
+
}
|
|
66
|
+
case "string": {
|
|
67
|
+
const valueString = await input({
|
|
68
|
+
...config,
|
|
69
|
+
message: `${config.message} (as string)`,
|
|
70
|
+
});
|
|
71
|
+
return stringToHex(valueString);
|
|
72
|
+
}
|
|
73
|
+
case "abi":
|
|
74
|
+
return await abiParamsInput(config);
|
|
75
|
+
default:
|
|
76
|
+
throw new Error(`Unsupported encoding ${encoding}`);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Prompt for ABI encoded parameters.
|
|
81
|
+
* @param config inquirer config
|
|
82
|
+
* @returns ABI encoded parameters as hex string
|
|
83
|
+
*/
|
|
84
|
+
export const abiParamsInput = async (config) => {
|
|
85
|
+
const encoding = await input({
|
|
86
|
+
message: `${config.message} (as ABI encoded https://abitype.dev/api/human.html#parseabiparameters )`,
|
|
87
|
+
validate: (value) => {
|
|
88
|
+
try {
|
|
89
|
+
parseAbiParameters(value);
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
return "Invalid ABI parameters";
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
});
|
|
97
|
+
const abiParameters = parseAbiParameters(encoding);
|
|
98
|
+
const values = [];
|
|
99
|
+
for (const param of abiParameters) {
|
|
100
|
+
const message = `${config.message} -> ${param.type} ${param.name ?? ""}`;
|
|
101
|
+
switch (param.type) {
|
|
102
|
+
case "string":
|
|
103
|
+
values.push(await input({ message }));
|
|
104
|
+
break;
|
|
105
|
+
case "bool":
|
|
106
|
+
values.push(await confirm({ message }));
|
|
107
|
+
break;
|
|
108
|
+
case "uint":
|
|
109
|
+
case "uint8":
|
|
110
|
+
case "uint16":
|
|
111
|
+
case "uint32":
|
|
112
|
+
case "uint64":
|
|
113
|
+
case "uint128":
|
|
114
|
+
case "uint256":
|
|
115
|
+
values.push(await input({
|
|
116
|
+
message,
|
|
117
|
+
validate: (value) => {
|
|
118
|
+
try {
|
|
119
|
+
BigInt(value);
|
|
120
|
+
return true;
|
|
121
|
+
}
|
|
122
|
+
catch (e) {
|
|
123
|
+
return "Invalid number";
|
|
124
|
+
}
|
|
125
|
+
},
|
|
126
|
+
}));
|
|
127
|
+
break;
|
|
128
|
+
case "bytes":
|
|
129
|
+
values.push(await bytesInput({ message }));
|
|
130
|
+
break;
|
|
131
|
+
case "address":
|
|
132
|
+
values.push(await input({
|
|
133
|
+
message,
|
|
134
|
+
validate: (value) => isAddress(value) || "Invalid address",
|
|
135
|
+
}));
|
|
136
|
+
break;
|
|
137
|
+
default:
|
|
138
|
+
throw new Error(`Unsupported type ${param.type}`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return encodeAbiParameters(abiParameters, values);
|
|
142
|
+
};
|
|
143
|
+
export const selectAuto = (config, context) => {
|
|
144
|
+
const choices = config.choices;
|
|
145
|
+
const list = config.discardDisabled
|
|
146
|
+
? choices.filter((c) => c.type !== "separator" && !c.disabled)
|
|
147
|
+
: choices;
|
|
148
|
+
if (list.length === 1) {
|
|
149
|
+
const choice = list[0];
|
|
150
|
+
if (choice.type !== "separator") {
|
|
151
|
+
const output = context?.output || process.stdout;
|
|
152
|
+
const prefix = chalk.green("?");
|
|
153
|
+
const message = chalk.bold(config.message);
|
|
154
|
+
output.write(`${prefix} ${message} ${chalk.cyan(choice.name || choice.value)}\n`);
|
|
155
|
+
return new CancelablePromise((resolve) => resolve(choice.value));
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
return select(config, context);
|
|
159
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export type ServiceStatus = {
|
|
2
|
+
ID: string;
|
|
3
|
+
Name: string;
|
|
4
|
+
Image: string;
|
|
5
|
+
Command: string;
|
|
6
|
+
Project: string;
|
|
7
|
+
Service: string;
|
|
8
|
+
Created: number;
|
|
9
|
+
State: string;
|
|
10
|
+
Status: string;
|
|
11
|
+
Health: string;
|
|
12
|
+
ExitCode: number;
|
|
13
|
+
Publishers: ServicePublisher[];
|
|
14
|
+
};
|
|
15
|
+
export type ServicePublisher = {
|
|
16
|
+
URL: string;
|
|
17
|
+
TargetPort: number;
|
|
18
|
+
PublishedPort: number;
|
|
19
|
+
Protocol: string;
|
|
20
|
+
};
|
|
21
|
+
export type PsResponse = ServiceStatus;
|
|
22
|
+
//# sourceMappingURL=docker.d.ts.map
|