@cartesi/cli 2.0.0-alpha.3 → 2.0.0-alpha.31

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 (131) hide show
  1. package/dist/index.js +704 -1
  2. package/dist/index.js.map +791 -0
  3. package/package.json +77 -101
  4. package/LICENSE +0 -202
  5. package/bin/dev.cmd +0 -3
  6. package/bin/dev.js +0 -25
  7. package/bin/run.cmd +0 -3
  8. package/bin/run.js +0 -8
  9. package/dist/baseCommand.d.ts +0 -22
  10. package/dist/baseCommand.d.ts.map +0 -1
  11. package/dist/baseCommand.js +0 -92
  12. package/dist/builder/directory.d.ts +0 -3
  13. package/dist/builder/directory.d.ts.map +0 -1
  14. package/dist/builder/directory.js +0 -37
  15. package/dist/builder/docker.d.ts +0 -10
  16. package/dist/builder/docker.d.ts.map +0 -1
  17. package/dist/builder/docker.js +0 -112
  18. package/dist/builder/empty.d.ts +0 -3
  19. package/dist/builder/empty.d.ts.map +0 -1
  20. package/dist/builder/empty.js +0 -21
  21. package/dist/builder/index.d.ts +0 -6
  22. package/dist/builder/index.d.ts.map +0 -1
  23. package/dist/builder/index.js +0 -5
  24. package/dist/builder/none.d.ts +0 -3
  25. package/dist/builder/none.d.ts.map +0 -1
  26. package/dist/builder/none.js +0 -11
  27. package/dist/builder/tar.d.ts +0 -3
  28. package/dist/builder/tar.d.ts.map +0 -1
  29. package/dist/builder/tar.js +0 -30
  30. package/dist/commands/address-book.d.ts +0 -9
  31. package/dist/commands/address-book.d.ts.map +0 -1
  32. package/dist/commands/address-book.js +0 -40
  33. package/dist/commands/build.d.ts +0 -12
  34. package/dist/commands/build.d.ts.map +0 -1
  35. package/dist/commands/build.js +0 -73
  36. package/dist/commands/clean.d.ts +0 -8
  37. package/dist/commands/clean.d.ts.map +0 -1
  38. package/dist/commands/clean.js +0 -11
  39. package/dist/commands/create.d.ts +0 -16
  40. package/dist/commands/create.d.ts.map +0 -1
  41. package/dist/commands/create.js +0 -66
  42. package/dist/commands/deploy/build.d.ts +0 -15
  43. package/dist/commands/deploy/build.d.ts.map +0 -1
  44. package/dist/commands/deploy/build.js +0 -62
  45. package/dist/commands/deploy/index.d.ts +0 -12
  46. package/dist/commands/deploy/index.d.ts.map +0 -1
  47. package/dist/commands/deploy/index.js +0 -78
  48. package/dist/commands/doctor.d.ts +0 -13
  49. package/dist/commands/doctor.d.ts.map +0 -1
  50. package/dist/commands/doctor.js +0 -106
  51. package/dist/commands/hash.d.ts +0 -10
  52. package/dist/commands/hash.d.ts.map +0 -1
  53. package/dist/commands/hash.js +0 -22
  54. package/dist/commands/run.d.ts +0 -21
  55. package/dist/commands/run.d.ts.map +0 -1
  56. package/dist/commands/run.js +0 -191
  57. package/dist/commands/send/erc20.d.ts +0 -14
  58. package/dist/commands/send/erc20.d.ts.map +0 -1
  59. package/dist/commands/send/erc20.js +0 -70
  60. package/dist/commands/send/erc721.d.ts +0 -14
  61. package/dist/commands/send/erc721.d.ts.map +0 -1
  62. package/dist/commands/send/erc721.js +0 -73
  63. package/dist/commands/send/ether.d.ts +0 -13
  64. package/dist/commands/send/ether.d.ts.map +0 -1
  65. package/dist/commands/send/ether.js +0 -32
  66. package/dist/commands/send/generic.d.ts +0 -15
  67. package/dist/commands/send/generic.d.ts.map +0 -1
  68. package/dist/commands/send/generic.js +0 -119
  69. package/dist/commands/send/index.d.ts +0 -28
  70. package/dist/commands/send/index.d.ts.map +0 -1
  71. package/dist/commands/send/index.js +0 -102
  72. package/dist/commands/shell.d.ts +0 -15
  73. package/dist/commands/shell.d.ts.map +0 -1
  74. package/dist/commands/shell.js +0 -65
  75. package/dist/config.d.ts +0 -102
  76. package/dist/config.d.ts.map +0 -1
  77. package/dist/config.js +0 -367
  78. package/dist/contracts.d.ts +0 -4317
  79. package/dist/contracts.d.ts.map +0 -1
  80. package/dist/contracts.js +0 -1799
  81. package/dist/exec/cartesi-machine.d.ts +0 -9
  82. package/dist/exec/cartesi-machine.d.ts.map +0 -1
  83. package/dist/exec/cartesi-machine.js +0 -20
  84. package/dist/exec/crane.d.ts +0 -15
  85. package/dist/exec/crane.d.ts.map +0 -1
  86. package/dist/exec/crane.js +0 -17
  87. package/dist/exec/genext2fs.d.ts +0 -28
  88. package/dist/exec/genext2fs.d.ts.map +0 -1
  89. package/dist/exec/genext2fs.js +0 -44
  90. package/dist/exec/index.d.ts +0 -5
  91. package/dist/exec/index.d.ts.map +0 -1
  92. package/dist/exec/index.js +0 -4
  93. package/dist/exec/mksquashfs.d.ts +0 -21
  94. package/dist/exec/mksquashfs.d.ts.map +0 -1
  95. package/dist/exec/mksquashfs.js +0 -45
  96. package/dist/exec/util.d.ts +0 -36
  97. package/dist/exec/util.d.ts.map +0 -1
  98. package/dist/exec/util.js +0 -80
  99. package/dist/flags.d.ts +0 -17
  100. package/dist/flags.d.ts.map +0 -1
  101. package/dist/flags.js +0 -28
  102. package/dist/index.d.ts +0 -2
  103. package/dist/index.d.ts.map +0 -1
  104. package/dist/machine.d.ts +0 -6
  105. package/dist/machine.d.ts.map +0 -1
  106. package/dist/machine.js +0 -80
  107. package/dist/node/DockerfileDeploy.txt +0 -4
  108. package/dist/node/default.env +0 -27
  109. package/dist/node/docker-compose-anvil.yaml +0 -50
  110. package/dist/node/docker-compose-bundler.yaml +0 -57
  111. package/dist/node/docker-compose-database.yaml +0 -10
  112. package/dist/node/docker-compose-envfile.yaml +0 -4
  113. package/dist/node/docker-compose-explorer.yaml +0 -88
  114. package/dist/node/docker-compose-host.yaml +0 -30
  115. package/dist/node/docker-compose-paymaster.yaml +0 -33
  116. package/dist/node/docker-compose-prompt.yaml +0 -17
  117. package/dist/node/docker-compose-proxy.yaml +0 -48
  118. package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
  119. package/dist/node/docker-compose-validator-cpus.yaml +0 -6
  120. package/dist/node/docker-compose-validator-memory.yaml +0 -6
  121. package/dist/node/docker-compose-validator.yaml +0 -59
  122. package/dist/prompts.d.ts +0 -62
  123. package/dist/prompts.d.ts.map +0 -1
  124. package/dist/prompts.js +0 -158
  125. package/dist/types/docker.d.ts +0 -22
  126. package/dist/types/docker.d.ts.map +0 -1
  127. package/dist/types/docker.js +0 -1
  128. package/dist/wallet.d.ts +0 -24
  129. package/dist/wallet.d.ts.map +0 -1
  130. package/dist/wallet.js +0 -204
  131. package/oclif.manifest.json +0 -876
@@ -1,9 +0,0 @@
1
- import { Range, SemVer } from "semver";
2
- import { DockerFallbackOptions, ExecaOptionsDockerFallback } from "./util.js";
3
- export declare const requiredVersion: Range;
4
- export declare const boot: (args: readonly string[], options: ExecaOptionsDockerFallback) => Promise<import("execa").Result<import("execa").Options & {
5
- image?: string;
6
- forceDocker?: false;
7
- }>>;
8
- export declare const version: (options?: DockerFallbackOptions) => Promise<SemVer | null>;
9
- //# sourceMappingURL=cartesi-machine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"cartesi-machine.d.ts","sourceRoot":"","sources":["../../src/exec/cartesi-machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACH,qBAAqB,EAErB,0BAA0B,EAC7B,MAAM,WAAW,CAAC;AAEnB,eAAO,MAAM,eAAe,OAAuB,CAAC;AAEpD,eAAO,MAAM,IAAI,SACP,SAAS,MAAM,EAAE,WACd,0BAA0B;;;GAGtC,CAAC;AAEF,eAAO,MAAM,OAAO,aACN,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAgBvB,CAAC"}
@@ -1,20 +0,0 @@
1
- import { parse, Range } from "semver";
2
- import { execaDockerFallback, } from "./util.js";
3
- export const requiredVersion = new Range("^0.18.1");
4
- export const boot = async (args, options) => {
5
- return execaDockerFallback("cartesi-machine", args, options);
6
- };
7
- export const version = async (options) => {
8
- const { image } = options || {};
9
- try {
10
- const { stdout } = await execaDockerFallback("cartesi-machine", ["--version-json"], { image });
11
- if (typeof stdout === "string") {
12
- const output = JSON.parse(stdout);
13
- return parse(output.version);
14
- }
15
- return null;
16
- }
17
- catch (e) {
18
- return null;
19
- }
20
- };
@@ -1,15 +0,0 @@
1
- import { Range, SemVer } from "semver";
2
- import { Stream } from "stream";
3
- import { DockerFallbackOptions } from "./util.js";
4
- export declare const requiredVersion: Range;
5
- export declare const exportImage: (options: {
6
- stdin: Stream | number;
7
- stdout: Stream | number;
8
- } & DockerFallbackOptions) => Promise<import("child_process").SpawnSyncReturns<string | Buffer> | {
9
- error: {
10
- code: string;
11
- };
12
- stdout: string;
13
- }>;
14
- export declare const version: (options?: DockerFallbackOptions) => Promise<SemVer | null>;
15
- //# sourceMappingURL=crane.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"crane.d.ts","sourceRoot":"","sources":["../../src/exec/crane.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,qBAAqB,EAA2B,MAAM,WAAW,CAAC;AAE3E,eAAO,MAAM,eAAe,OAAuB,CAAC;AAEpD,eAAO,MAAM,WAAW,YACX;IACL,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,GAAG,qBAAqB;;;;;EAO5B,CAAC;AAEF,eAAO,MAAM,OAAO,aACN,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAMvB,CAAC"}
@@ -1,17 +0,0 @@
1
- import { parse, Range } from "semver";
2
- import { spawnSyncDockerFallback } from "./util.js";
3
- export const requiredVersion = new Range("^0.19.1");
4
- export const exportImage = async (options) => {
5
- const { image, stdin, stdout } = options;
6
- return spawnSyncDockerFallback("crane", ["export", "-", "-"], {
7
- image,
8
- stdio: [stdin, stdout, "inherit"],
9
- });
10
- };
11
- export const version = async (options) => {
12
- const result = spawnSyncDockerFallback("crane", ["version"], options || {});
13
- if (result.error) {
14
- return null;
15
- }
16
- return parse(result.stdout.toString());
17
- };
@@ -1,28 +0,0 @@
1
- import { Range, SemVer } from "semver";
2
- import { DockerFallbackOptions } from "./util.js";
3
- export declare const requiredVersion: Range;
4
- export declare const empty: (options: {
5
- cwd?: string;
6
- size: number;
7
- output: string;
8
- } & DockerFallbackOptions) => Promise<void>;
9
- export declare const fromDirectory: (options: {
10
- cwd?: string;
11
- extraSize: number;
12
- input: string;
13
- output: string;
14
- } & DockerFallbackOptions) => Promise<import("execa").Result<import("execa").Options & {
15
- image?: string;
16
- forceDocker?: false;
17
- }>>;
18
- export declare const fromTar: (options: {
19
- cwd?: string;
20
- extraSize: number;
21
- input: string;
22
- output: string;
23
- } & DockerFallbackOptions) => Promise<import("execa").Result<import("execa").Options & {
24
- image?: string;
25
- forceDocker?: false;
26
- }>>;
27
- export declare const version: (options?: DockerFallbackOptions) => Promise<SemVer | null>;
28
- //# sourceMappingURL=genext2fs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"genext2fs.d.ts","sourceRoot":"","sources":["../../src/exec/genext2fs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAIvE,eAAO,MAAM,eAAe,EAAE,KAA2B,CAAC;AAU1D,eAAO,MAAM,KAAK,YACL;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB,kBAgB5B,CAAC;AAEF,eAAO,MAAM,aAAa,YACb;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAS5B,CAAC;AAEF,eAAO,MAAM,OAAO,YACP;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAS5B,CAAC;AAEF,eAAO,MAAM,OAAO,aACN,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAevB,CAAC"}
@@ -1,44 +0,0 @@
1
- import { parse, Range } from "semver";
2
- import { execaDockerFallback } from "./util.js";
3
- const BLOCK_SIZE = 4096; // fixed at 4k
4
- export const requiredVersion = new Range("^1.5.6");
5
- const baseArgs = (options) => [
6
- "--block-size",
7
- BLOCK_SIZE.toString(),
8
- "--faketime",
9
- "--readjustment",
10
- `+${options.extraBlocks}`,
11
- ];
12
- export const empty = async (options) => {
13
- const { size, output } = options;
14
- const blocks = Math.ceil(size / BLOCK_SIZE); // size in blocks
15
- await execaDockerFallback("xgenext2fs", [
16
- "--block-size",
17
- BLOCK_SIZE.toString(),
18
- "--faketime",
19
- "--size-in-blocks",
20
- blocks.toString(),
21
- output,
22
- ], options);
23
- };
24
- export const fromDirectory = async (options) => {
25
- const { cwd, extraSize, image, input, output } = options;
26
- const extraBlocks = Math.ceil(extraSize / BLOCK_SIZE);
27
- return execaDockerFallback("xgenext2fs", [...baseArgs({ extraBlocks }), "--root", input, output], { cwd, image });
28
- };
29
- export const fromTar = async (options) => {
30
- const { cwd, extraSize, image, input, output } = options;
31
- const extraBlocks = Math.ceil(extraSize / BLOCK_SIZE);
32
- return execaDockerFallback("xgenext2fs", [...baseArgs({ extraBlocks }), "--tarball", input, output], { cwd, image });
33
- };
34
- export const version = async (options) => {
35
- const { stdout } = await execaDockerFallback("xgenext2fs", ["--version"], options || {});
36
- if (typeof stdout === "string") {
37
- const regex = /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?/;
38
- const m = stdout.match(regex);
39
- if (m && m[0]) {
40
- return parse(m[0]);
41
- }
42
- }
43
- return null;
44
- };
@@ -1,5 +0,0 @@
1
- export * as cartesiMachine from "./cartesi-machine.js";
2
- export * as crane from "./crane.js";
3
- export * as genext2fs from "./genext2fs.js";
4
- export * as mksquashfs from "./mksquashfs.js";
5
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/exec/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,cAAc,MAAM,sBAAsB,CAAC;AACvD,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,KAAK,SAAS,MAAM,gBAAgB,CAAC;AAC5C,OAAO,KAAK,UAAU,MAAM,iBAAiB,CAAC"}
@@ -1,4 +0,0 @@
1
- export * as cartesiMachine from "./cartesi-machine.js";
2
- export * as crane from "./crane.js";
3
- export * as genext2fs from "./genext2fs.js";
4
- export * as mksquashfs from "./mksquashfs.js";
@@ -1,21 +0,0 @@
1
- import { Range, SemVer } from "semver";
2
- import { DockerFallbackOptions } from "./util.js";
3
- export declare const requiredVersion: Range;
4
- export declare const fromDirectory: (options: {
5
- cwd?: string;
6
- input: string;
7
- output: string;
8
- } & DockerFallbackOptions) => Promise<import("execa").Result<import("execa").Options & {
9
- image?: string;
10
- forceDocker?: false;
11
- }>>;
12
- export declare const fromTar: (options: {
13
- cwd?: string;
14
- input: string;
15
- output: string;
16
- } & DockerFallbackOptions) => Promise<import("execa").Result<import("execa").Options & {
17
- image?: string;
18
- forceDocker?: false;
19
- }>>;
20
- export declare const version: (options?: DockerFallbackOptions) => Promise<SemVer | null>;
21
- //# sourceMappingURL=mksquashfs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mksquashfs.d.ts","sourceRoot":"","sources":["../../src/exec/mksquashfs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAuB,MAAM,WAAW,CAAC;AAIvE,eAAO,MAAM,eAAe,EAAE,KAA2B,CAAC;AAY1D,eAAO,MAAM,aAAa,YACb;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAO5B,CAAC;AAEF,eAAO,MAAM,OAAO,YACP;IACL,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;CAClB,GAAG,qBAAqB;;;GAY5B,CAAC;AAEF,eAAO,MAAM,OAAO,aACN,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAoBvB,CAAC"}
@@ -1,45 +0,0 @@
1
- import { parse, Range } from "semver";
2
- import { execaDockerFallback } from "./util.js";
3
- const COMPRESSION = "lzo"; // make customizable? default is gzip
4
- export const requiredVersion = new Range("^4.5.1");
5
- const baseArgs = () => [
6
- "-all-time",
7
- "0",
8
- "-all-root", // XXX: should we use this?
9
- "-noappend",
10
- "-comp",
11
- COMPRESSION,
12
- "-no-progress",
13
- ];
14
- export const fromDirectory = (options) => {
15
- const { cwd, image, input, output } = options;
16
- return execaDockerFallback("mksquashfs", [input, output, ...baseArgs()], {
17
- cwd,
18
- image,
19
- });
20
- };
21
- export const fromTar = (options) => {
22
- const { cwd, image, input, output } = options;
23
- return execaDockerFallback("mksquashfs", ["-", output, "-tar", ...baseArgs()], {
24
- cwd,
25
- image,
26
- inputFile: input, // use stdin in case of tar file
27
- });
28
- };
29
- export const version = async (options) => {
30
- try {
31
- const { stdout } = await execaDockerFallback("mksquashfs", ["-version"], options || {});
32
- if (typeof stdout === "string") {
33
- const regex = /(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?/gm;
34
- const m = stdout.match(regex);
35
- if (m && m[0]) {
36
- return parse(m[0]);
37
- }
38
- }
39
- }
40
- catch (e) {
41
- console.error(e);
42
- return null;
43
- }
44
- return null;
45
- };
@@ -1,36 +0,0 @@
1
- import { SpawnSyncOptions } from "child_process";
2
- import { Options } from "execa";
3
- export type DockerFallbackOptions = {
4
- image: string;
5
- forceDocker: true;
6
- } | {
7
- image?: string;
8
- forceDocker?: false;
9
- };
10
- /**
11
- * Calls execa and falls back to docker run if command (on the host) fails
12
- * @param command command to be executed
13
- * @param args arguments to be passed to the command
14
- * @param options execution options
15
- * @returns return of execa
16
- */
17
- export type ExecaOptionsDockerFallback = Options & DockerFallbackOptions;
18
- export declare const execaDockerFallback: (command: string, args: readonly string[], options: ExecaOptionsDockerFallback) => Promise<import("execa").Result<Options & {
19
- image?: string;
20
- forceDocker?: false;
21
- }>>;
22
- /**
23
- * Calls spawnSync and falls back to docker run if command (on the host) fails
24
- * @param command command to be executed
25
- * @param args arguments to be passed to the command
26
- * @param options execution options
27
- * @returns return of execa
28
- */
29
- export type SpawnOptionsDockerFallback = SpawnSyncOptions & DockerFallbackOptions;
30
- export declare const spawnSyncDockerFallback: (command: string, args: readonly string[], options: SpawnOptionsDockerFallback) => import("child_process").SpawnSyncReturns<string | Buffer> | {
31
- error: {
32
- code: string;
33
- };
34
- stdout: string;
35
- };
36
- //# sourceMappingURL=util.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../../src/exec/util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAC5D,OAAO,EAAqB,OAAO,EAAE,MAAM,OAAO,CAAC;AAGnD,MAAM,MAAM,qBAAqB,GAC3B;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,IAAI,CAAA;CAAE,GACpC;IAAE,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAE9C;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,OAAO,GAAG,qBAAqB,CAAC;AACzE,eAAO,MAAM,mBAAmB,YACnB,MAAM,QACT,SAAS,MAAM,EAAE,WACd,0BAA0B;YAbvB,MAAM;kBAAgB,KAAK;GAoD1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GACrD,qBAAqB,CAAC;AAC1B,eAAO,MAAM,uBAAuB,YACvB,MAAM,QACT,SAAS,MAAM,EAAE,WACd,0BAA0B;;;;;CA8CtC,CAAC"}
package/dist/exec/util.js DELETED
@@ -1,80 +0,0 @@
1
- import { spawnSync } from "child_process";
2
- import { execa, ExecaError } from "execa";
3
- import os from "os";
4
- export const execaDockerFallback = async (command, args, options) => {
5
- try {
6
- if (options.forceDocker) {
7
- const error = new ExecaError();
8
- error.code = "ENOENT";
9
- throw error;
10
- }
11
- return await execa(command, args, options);
12
- }
13
- catch (error) {
14
- if (error instanceof ExecaError) {
15
- if (error.code === "ENOENT" && options.image) {
16
- if (!options.forceDocker) {
17
- console.warn(`error executing '${command}', falling back to docker execution using image '${options.image}'`);
18
- }
19
- const userInfo = os.userInfo();
20
- const dockerOpts = [
21
- "--volume",
22
- `${options.cwd}:/work`,
23
- "--workdir",
24
- "/work",
25
- "--interactive",
26
- "--rm",
27
- "--user",
28
- `${userInfo.uid}:${userInfo.gid}`,
29
- ];
30
- return await execa("docker", ["run", ...dockerOpts, options.image, command, ...args], options);
31
- }
32
- else {
33
- console.error(`error executing '${command}'`, error);
34
- }
35
- }
36
- throw error;
37
- }
38
- };
39
- export const spawnSyncDockerFallback = (command, args, options) => {
40
- const result = options.forceDocker
41
- ? { error: { code: "ENOENT" }, stdout: "" }
42
- : spawnSync(command, args, options);
43
- if (result.error) {
44
- const code = result.error.code;
45
- if (code === "ENOENT" && options.image) {
46
- if (!options.forceDocker) {
47
- console.warn(`error executing '${command}', falling back to docker execution using image '${options.image}'`);
48
- }
49
- const userInfo = os.userInfo();
50
- const dockerOpts = [
51
- "--volume",
52
- `${options.cwd}:/work`,
53
- "--workdir",
54
- "/work",
55
- "--interactive",
56
- "--rm",
57
- "--user",
58
- `${userInfo.uid}:${userInfo.gid}`,
59
- ];
60
- const dockerArgs = [
61
- "run",
62
- ...dockerOpts,
63
- options.image,
64
- command,
65
- ...args,
66
- ];
67
- const dockerResult = spawnSync("docker", dockerArgs, options);
68
- if (dockerResult.error) {
69
- console.error(`error executing '${command}'`, dockerResult.error);
70
- throw dockerResult.error;
71
- }
72
- return dockerResult;
73
- }
74
- else {
75
- console.error(`error executing '${command}'`, result.error);
76
- throw result.error;
77
- }
78
- }
79
- return result;
80
- };
package/dist/flags.d.ts DELETED
@@ -1,17 +0,0 @@
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
@@ -1 +0,0 @@
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 DELETED
@@ -1,28 +0,0 @@
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 DELETED
@@ -1,2 +0,0 @@
1
- export { run } from "@oclif/core";
2
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC"}
package/dist/machine.d.ts DELETED
@@ -1,6 +0,0 @@
1
- import { Config, ImageInfo } from "./config.js";
2
- export declare const bootMachine: (config: Config, info: ImageInfo | undefined, destination: string) => Promise<import("execa").Result<import("execa").Options & {
3
- image?: string;
4
- forceDocker?: false;
5
- }>>;
6
- //# sourceMappingURL=machine.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAoB7D,eAAO,MAAM,WAAW,WACZ,MAAM,QACR,SAAS,GAAG,SAAS,eACd,MAAM;;;GAwFtB,CAAC"}
package/dist/machine.js DELETED
@@ -1,80 +0,0 @@
1
- import { cartesiMachine } from "./exec/index.js";
2
- const flashDrive = (label, drive) => {
3
- const { format, mount, shared, user } = drive;
4
- const filename = `${label}.${format}`;
5
- const vars = [`label:${label}`, `filename:${filename}`];
6
- if (mount !== undefined) {
7
- vars.push(`mount:${mount}`);
8
- }
9
- if (user) {
10
- vars.push(`user:${user}`);
11
- }
12
- if (shared) {
13
- vars.push("shared");
14
- }
15
- // don't specify start and length
16
- return `--flash-drive=${vars.join(",")}`;
17
- };
18
- export const bootMachine = async (config, info, destination) => {
19
- const { machine } = config;
20
- const { assertRollingTemplate, finalHash, interactive, maxMCycle, noRollup, ramLength, ramImage, store, user, } = machine;
21
- // list of environment variables of docker image
22
- const env = info?.env ?? [];
23
- const envs = env.map((variable) => `--env=${variable}`);
24
- // check if we need a rootfstype boot arg
25
- const root = config.drives.root;
26
- if (root?.format === "sqfs") {
27
- const definedRootfsType = config.machine.bootargs.find((arg) => arg.startsWith("rootfstype="));
28
- // not checking here if user intentionally defined wrong type
29
- if (!definedRootfsType) {
30
- config.machine.bootargs.push("rootfstype=squashfs");
31
- }
32
- }
33
- // bootargs from config string array
34
- const bootargs = machine.bootargs.map((arg) => `--append-bootargs="${arg}"`);
35
- // entrypoint from config or image info (Docker ENTRYPOINT + CMD)
36
- const entrypoint = machine.entrypoint ?? // takes priority
37
- (info ? [...info.entrypoint, ...info.cmd].join(" ") : undefined); // ENTRYPOINT and CMD as a space separated string
38
- if (!entrypoint) {
39
- throw new Error("Undefined machine entrypoint");
40
- }
41
- const flashDrives = Object.entries(config.drives).map(([label, drive]) => flashDrive(label, drive));
42
- // command to change working directory if WORKDIR is defined
43
- const args = [
44
- ...bootargs,
45
- ...envs,
46
- ...flashDrives,
47
- `--ram-image=${ramImage}`,
48
- `--ram-length=${ramLength}`,
49
- `--append-entrypoint=${entrypoint}`,
50
- ];
51
- if (assertRollingTemplate) {
52
- args.push("--assert-rolling-template");
53
- }
54
- if (finalHash) {
55
- args.push("--final-hash");
56
- }
57
- if (info?.workdir) {
58
- args.push(`--workdir="${info.workdir}"`);
59
- }
60
- if (interactive) {
61
- args.push("-it");
62
- }
63
- if (noRollup) {
64
- args.push("--no-rollup");
65
- }
66
- if (maxMCycle) {
67
- args.push(`--max-mcycle=${maxMCycle.toString()}`);
68
- }
69
- if (store) {
70
- args.push(`--store=${store}`);
71
- }
72
- if (user) {
73
- args.push(`--user=${user}`);
74
- }
75
- return cartesiMachine.boot(args, {
76
- cwd: destination,
77
- image: config.sdk,
78
- stdio: "inherit",
79
- });
80
- };
@@ -1,4 +0,0 @@
1
- FROM cartesi/rollups-node:1.5.1
2
- ENV CARTESI_SNAPSHOT_DIR=/usr/share/rollups-node/snapshot
3
- ENV CARTESI_HTTP_ADDRESS=0.0.0.0
4
- COPY --chown=cartesi:cartesi . ${CARTESI_SNAPSHOT_DIR}
@@ -1,27 +0,0 @@
1
- # cartesi/rollups-node
2
- CARTESI_LOG_LEVEL="${CARTESI_LOG_LEVEL:-error}"
3
- CARTESI_HTTP_ADDRESS="${CARTESI_HTTP_ADDRESS:-0.0.0.0}"
4
- CARTESI_HTTP_PORT="${CARTESI_HTTP_PORT:-10000}"
5
- CARTESI_FEATURE_HOST_MODE="${CARTESI_FEATURE_HOST_MODE:-false}"
6
- CARTESI_FEATURE_READER_MODE_ENABLED="${CARTESI_FEATURE_READER_MODE_ENABLED:-false}"
7
- CARTESI_FEATURE_DISABLE_CLAIMER="${CARTESI_FEATURE_DISABLE_CLAIMER:-false}"
8
- CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK="${CARTESI_FEATURE_DISABLE_MACHINE_HASH_CHECK:-true}"
9
- CARTESI_EPOCH_LENGTH="${CARTESI_EPOCH_LENGTH:-720}"
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_BLOCKCHAIN_BLOCK_TIMEOUT="${CARTESI_BLOCKCHAIN_BLOCK_TIMEOUT:-60}"
16
- CARTESI_CONTRACTS_APPLICATION_ADDRESS="${CARTESI_CONTRACTS_APPLICATION_ADDRESS:-0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e}"
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_SERVER_MANAGER_BYPASS_LOG="${CARTESI_EXPERIMENTAL_SERVER_MANAGER_BYPASS_LOG:-false}"
25
-
26
- # server-manager
27
- SM_DEADLINE_MACHINE="${SM_DEADLINE_MACHINE:-30000}"
@@ -1,50 +0,0 @@
1
- services:
2
- anvil:
3
- image: cartesi/sdk:0.12.0-alpha.1
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.12.0-alpha.1
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
- "0x4C11C7F82D6D56a726f9B53dd99af031AFd86BB6",
36
- "deployContracts(address,address,bytes32,bytes32)",
37
- "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
38
- "720",
39
- "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266",
40
- "0x0000000000000000000000000000000000000000000000000000000000000000",
41
- "0x0000000000000000000000000000000000000000000000000000000000000000",
42
- ]
43
-
44
- prompt:
45
- image: debian:bookworm-slim
46
- environment:
47
- PROMPT_TXT_01_ANVIL: "Anvil running at http://localhost:8545"
48
-
49
- volumes:
50
- blockchain-data: {}