@cartesi/cli 2.0.0-alpha.4 → 2.0.0-alpha.6

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 (143) hide show
  1. package/dist/base.d.ts +18 -0
  2. package/dist/base.d.ts.map +1 -0
  3. package/dist/base.js +103 -0
  4. package/dist/builder/directory.d.ts.map +1 -1
  5. package/dist/builder/docker.d.ts.map +1 -1
  6. package/dist/builder/empty.d.ts.map +1 -1
  7. package/dist/builder/none.d.ts.map +1 -1
  8. package/dist/builder/tar.d.ts.map +1 -1
  9. package/dist/commands/address-book.d.ts +4 -8
  10. package/dist/commands/address-book.d.ts.map +1 -1
  11. package/dist/commands/address-book.js +15 -14
  12. package/dist/commands/build.d.ts +5 -11
  13. package/dist/commands/build.d.ts.map +1 -1
  14. package/dist/commands/build.js +16 -28
  15. package/dist/commands/clean.d.ts +2 -7
  16. package/dist/commands/clean.d.ts.map +1 -1
  17. package/dist/commands/clean.js +9 -10
  18. package/dist/commands/create.d.ts +5 -14
  19. package/dist/commands/create.d.ts.map +1 -1
  20. package/dist/commands/create.js +36 -51
  21. package/dist/commands/deploy/build.d.ts +2 -14
  22. package/dist/commands/deploy/build.d.ts.map +1 -1
  23. package/dist/commands/deploy/build.js +8 -61
  24. package/dist/commands/deploy.d.ts +3 -0
  25. package/dist/commands/deploy.d.ts.map +1 -0
  26. package/dist/commands/deploy.js +12 -0
  27. package/dist/commands/doctor.d.ts +2 -12
  28. package/dist/commands/doctor.d.ts.map +1 -1
  29. package/dist/commands/doctor.js +96 -91
  30. package/dist/commands/hash.d.ts +4 -9
  31. package/dist/commands/hash.d.ts.map +1 -1
  32. package/dist/commands/hash.js +14 -14
  33. package/dist/commands/rollups/deploy.d.ts +16 -0
  34. package/dist/commands/rollups/deploy.d.ts.map +1 -0
  35. package/dist/commands/rollups/deploy.js +225 -0
  36. package/dist/commands/rollups/logs.d.ts +11 -0
  37. package/dist/commands/rollups/logs.d.ts.map +1 -0
  38. package/dist/commands/rollups/logs.js +32 -0
  39. package/dist/commands/rollups/start.d.ts +14 -0
  40. package/dist/commands/rollups/start.d.ts.map +1 -0
  41. package/dist/commands/rollups/start.js +209 -0
  42. package/dist/commands/rollups/status.d.ts +7 -0
  43. package/dist/commands/rollups/status.d.ts.map +1 -0
  44. package/dist/commands/rollups/status.js +46 -0
  45. package/dist/commands/rollups/stop.d.ts +5 -0
  46. package/dist/commands/rollups/stop.d.ts.map +1 -0
  47. package/dist/commands/rollups/stop.js +26 -0
  48. package/dist/commands/rollups.d.ts +6 -0
  49. package/dist/commands/rollups.d.ts.map +1 -0
  50. package/dist/commands/rollups.js +19 -0
  51. package/dist/commands/run.d.ts +2 -21
  52. package/dist/commands/run.d.ts.map +1 -1
  53. package/dist/commands/run.js +9 -199
  54. package/dist/commands/send/erc20.d.ts +11 -13
  55. package/dist/commands/send/erc20.d.ts.map +1 -1
  56. package/dist/commands/send/erc20.js +57 -52
  57. package/dist/commands/send/erc721.d.ts +11 -13
  58. package/dist/commands/send/erc721.d.ts.map +1 -1
  59. package/dist/commands/send/erc721.js +51 -46
  60. package/dist/commands/send/ether.d.ts +11 -12
  61. package/dist/commands/send/ether.d.ts.map +1 -1
  62. package/dist/commands/send/ether.js +25 -21
  63. package/dist/commands/send/generic.d.ts +12 -14
  64. package/dist/commands/send/generic.d.ts.map +1 -1
  65. package/dist/commands/send/generic.js +92 -97
  66. package/dist/commands/send.d.ts +21 -0
  67. package/dist/commands/send.d.ts.map +1 -0
  68. package/dist/commands/send.js +67 -0
  69. package/dist/commands/shell.d.ts +6 -14
  70. package/dist/commands/shell.d.ts.map +1 -1
  71. package/dist/commands/shell.js +21 -43
  72. package/dist/compose/rollups/default.env +35 -0
  73. package/dist/compose/rollups/docker-compose-anvil.yaml +15 -0
  74. package/dist/{node → compose/rollups}/docker-compose-bundler.yaml +14 -25
  75. package/dist/{node → compose/rollups}/docker-compose-database.yaml +4 -2
  76. package/dist/compose/rollups/docker-compose-espresso.yaml +103 -0
  77. package/dist/{node → compose/rollups}/docker-compose-explorer.yaml +23 -37
  78. package/dist/compose/rollups/docker-compose-graphql.yaml +52 -0
  79. package/dist/compose/rollups/docker-compose-node-cpus.yaml +7 -0
  80. package/dist/compose/rollups/docker-compose-node-memory.yaml +6 -0
  81. package/dist/compose/rollups/docker-compose-node.yaml +39 -0
  82. package/dist/compose/rollups/docker-compose-paymaster.yaml +21 -0
  83. package/dist/compose/rollups/docker-compose-proxy.yaml +22 -0
  84. package/dist/compose/rollups/proxy/bundler.yaml +17 -0
  85. package/dist/compose/rollups/proxy/espresso-reader.yaml +17 -0
  86. package/dist/compose/rollups/proxy/espresso.yaml +56 -0
  87. package/dist/compose/rollups/proxy/explorer-api.yaml +17 -0
  88. package/dist/compose/rollups/proxy/explorer.yaml +10 -0
  89. package/dist/compose/rollups/proxy/graphql.yaml +10 -0
  90. package/dist/compose/rollups/proxy/paymaster.yaml +17 -0
  91. package/dist/compose/rollups/proxy/rollups-node.yaml +17 -0
  92. package/dist/config.d.ts +1 -1
  93. package/dist/config.d.ts.map +1 -1
  94. package/dist/config.js +1 -1
  95. package/dist/contracts.d.ts.map +1 -1
  96. package/dist/exec/cartesi-machine.d.ts.map +1 -1
  97. package/dist/exec/crane.d.ts +1 -1
  98. package/dist/exec/crane.d.ts.map +1 -1
  99. package/dist/exec/genext2fs.d.ts.map +1 -1
  100. package/dist/exec/mksquashfs.d.ts.map +1 -1
  101. package/dist/exec/rollups.d.ts +17 -0
  102. package/dist/exec/rollups.d.ts.map +1 -0
  103. package/dist/exec/rollups.js +40 -0
  104. package/dist/exec/util.d.ts +1 -1
  105. package/dist/exec/util.d.ts.map +1 -1
  106. package/dist/index.d.ts +2 -1
  107. package/dist/index.d.ts.map +1 -1
  108. package/dist/index.js +53 -1
  109. package/dist/machine.d.ts.map +1 -1
  110. package/dist/prompts.d.ts.map +1 -1
  111. package/dist/wallet.d.ts.map +1 -1
  112. package/dist/wallet.js +29 -6
  113. package/package.json +28 -45
  114. package/bin/dev.cmd +0 -3
  115. package/bin/dev.js +0 -25
  116. package/bin/run.cmd +0 -3
  117. package/bin/run.js +0 -8
  118. package/dist/baseCommand.d.ts +0 -22
  119. package/dist/baseCommand.d.ts.map +0 -1
  120. package/dist/baseCommand.js +0 -92
  121. package/dist/commands/deploy/index.d.ts +0 -12
  122. package/dist/commands/deploy/index.d.ts.map +0 -1
  123. package/dist/commands/deploy/index.js +0 -78
  124. package/dist/commands/send/index.d.ts +0 -28
  125. package/dist/commands/send/index.d.ts.map +0 -1
  126. package/dist/commands/send/index.js +0 -102
  127. package/dist/flags.d.ts +0 -17
  128. package/dist/flags.d.ts.map +0 -1
  129. package/dist/flags.js +0 -28
  130. package/dist/node/DockerfileDeploy.txt +0 -4
  131. package/dist/node/default.env +0 -27
  132. package/dist/node/docker-compose-anvil.yaml +0 -50
  133. package/dist/node/docker-compose-envfile.yaml +0 -4
  134. package/dist/node/docker-compose-espresso.yaml +0 -127
  135. package/dist/node/docker-compose-host.yaml +0 -30
  136. package/dist/node/docker-compose-paymaster.yaml +0 -33
  137. package/dist/node/docker-compose-prompt.yaml +0 -17
  138. package/dist/node/docker-compose-proxy.yaml +0 -48
  139. package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
  140. package/dist/node/docker-compose-validator-cpus.yaml +0 -6
  141. package/dist/node/docker-compose-validator-memory.yaml +0 -6
  142. package/dist/node/docker-compose-validator.yaml +0 -59
  143. package/oclif.manifest.json +0 -883
package/bin/dev.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\dev" %*
package/bin/dev.js DELETED
@@ -1,25 +0,0 @@
1
- #!/usr/bin/env node --no-warnings=ExperimentalWarning --loader ts-node/esm
2
-
3
- import oclif from "@oclif/core";
4
- import path from "node:path";
5
- import url from "node:url";
6
- import { register } from "ts-node";
7
-
8
- // In dev mode -> use ts-node and dev plugins
9
- process.env.NODE_ENV = "development";
10
-
11
- const project = path.join(
12
- path.dirname(url.fileURLToPath(import.meta.url)),
13
- "..",
14
- "tsconfig.json"
15
- );
16
- register({ project });
17
-
18
- // In dev mode, always show stack traces
19
- oclif.settings.debug = true;
20
-
21
- // Start the CLI
22
- oclif
23
- .run(process.argv.slice(2), import.meta.url)
24
- .then(oclif.flush)
25
- .catch(oclif.Errors.handle);
package/bin/run.cmd DELETED
@@ -1,3 +0,0 @@
1
- @echo off
2
-
3
- node "%~dp0\run" %*
package/bin/run.js DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- import oclif from "@oclif/core";
4
-
5
- oclif
6
- .run(process.argv.slice(2), import.meta.url)
7
- .then(oclif.flush)
8
- .catch(oclif.Errors.handle);
@@ -1,22 +0,0 @@
1
- import { Command, Interfaces } from "@oclif/core";
2
- import { Address, Hash } from "viem";
3
- import { Config } from "./config.js";
4
- export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof BaseCommand)["baseFlags"] & T["flags"]>;
5
- export type Args<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;
6
- export type AddressBook = Record<string, Address>;
7
- export declare abstract class BaseCommand<T extends typeof Command> extends Command {
8
- protected flags: Flags<T>;
9
- protected args: Args<T>;
10
- protected getServiceState(projectName: string, serviceName: string): Promise<string | undefined>;
11
- protected getContextPath(...paths: string[]): string;
12
- protected getApplicationConfig(configPath: string): Config;
13
- protected getMachineHash(): Hash | undefined;
14
- protected logPrompt({ title, value }: {
15
- title: string;
16
- value: string;
17
- }): void;
18
- protected getApplicationAddress(): Promise<Address>;
19
- protected getAddressBook(): Promise<AddressBook>;
20
- init(): Promise<void>;
21
- }
22
- //# sourceMappingURL=baseCommand.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"baseCommand.d.ts","sourceRoot":"","sources":["../src/baseCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAKlD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAsB,MAAM,MAAM,CAAC;AAEzD,OAAO,EAAE,MAAM,EAAS,MAAM,aAAa,CAAC;AAiB5C,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,aAAa,CAClE,CAAC,OAAO,WAAW,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CACjD,CAAC;AACF,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAChF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,8BAAsB,WAAW,CAAC,CAAC,SAAS,OAAO,OAAO,CAAE,SAAQ,OAAO;IACvE,SAAS,CAAC,KAAK,EAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,SAAS,CAAC,IAAI,EAAG,IAAI,CAAC,CAAC,CAAC,CAAC;cAET,eAAe,CAC3B,WAAW,EAAE,MAAM,EACnB,WAAW,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC;IAe9B,SAAS,CAAC,cAAc,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM;IAIpD,SAAS,CAAC,oBAAoB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM;IAM1D,SAAS,CAAC,cAAc,IAAI,IAAI,GAAG,SAAS;IAY5C,SAAS,CAAC,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE;cAItD,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;cAKzC,cAAc,IAAI,OAAO,CAAC,WAAW,CAAC;IAiCzC,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;CAYrC"}
@@ -1,92 +0,0 @@
1
- import { Command } from "@oclif/core";
2
- import chalk from "chalk";
3
- import { execa } from "execa";
4
- import fs from "fs";
5
- import path from "path";
6
- import { getAddress, isHash } from "viem";
7
- import { parse } from "./config.js";
8
- import { applicationFactoryAddress, authorityFactoryAddress, erc1155BatchPortalAddress, erc1155SinglePortalAddress, erc20PortalAddress, erc721PortalAddress, etherPortalAddress, inputBoxAddress, selfHostedApplicationFactoryAddress, testMultiTokenAddress, testNftAddress, testTokenAddress, } from "./contracts.js";
9
- export class BaseCommand extends Command {
10
- async getServiceState(projectName, serviceName) {
11
- // get service information
12
- const { stdout } = await execa("docker", [
13
- "compose",
14
- "--project-name",
15
- projectName,
16
- "ps",
17
- serviceName,
18
- "--format",
19
- "json",
20
- ]);
21
- const ps = stdout ? JSON.parse(stdout) : undefined;
22
- return ps?.State;
23
- }
24
- getContextPath(...paths) {
25
- return path.join(".cartesi", ...paths);
26
- }
27
- getApplicationConfig(configPath) {
28
- return fs.existsSync(configPath)
29
- ? parse(fs.readFileSync(configPath).toString())
30
- : parse("");
31
- }
32
- getMachineHash() {
33
- // read hash of the cartesi machine snapshot, if one exists
34
- const hashPath = this.getContextPath("image", "hash");
35
- if (fs.existsSync(hashPath)) {
36
- const hash = fs.readFileSync(hashPath).toString("hex");
37
- if (isHash(`0x${hash}`)) {
38
- return `0x${hash}`;
39
- }
40
- }
41
- return undefined;
42
- }
43
- logPrompt({ title, value }) {
44
- this.log(`${chalk.green("?")} ${title} ${chalk.cyan(value)}`);
45
- }
46
- async getApplicationAddress() {
47
- // fixed value, as we do deterministic deployment with a zero hash
48
- return getAddress("0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e");
49
- }
50
- async getAddressBook() {
51
- const applicationAddress = await this.getApplicationAddress();
52
- // build rollups contracts address book
53
- const contracts = {
54
- Application: applicationAddress,
55
- ApplicationFactory: applicationFactoryAddress,
56
- AuthorityFactory: authorityFactoryAddress,
57
- EntryPointV06: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
58
- EntryPointV07: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
59
- ERC1155BatchPortal: erc1155BatchPortalAddress,
60
- ERC1155SinglePortal: erc1155SinglePortalAddress,
61
- ERC20Portal: erc20PortalAddress,
62
- ERC721Portal: erc721PortalAddress,
63
- EtherPortal: etherPortalAddress,
64
- InputBox: inputBoxAddress,
65
- LightAccountFactory: "0x00004EC70002a32400f8ae005A26081065620D20",
66
- SelfHostedApplicationFactory: selfHostedApplicationFactoryAddress,
67
- SimpleAccountFactory: "0x9406Cc6185a346906296840746125a0E44976454",
68
- SmartAccountFactory: "0x000000a56Aaca3e9a4C479ea6b6CD0DbcB6634F5",
69
- KernelFactoryV2: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",
70
- KernelFactoryV3: "0x6723b44Abeec4E71eBE3232BD5B455805baDD22f",
71
- KernelFactoryV3_1: "0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419",
72
- TestToken: testTokenAddress,
73
- TestNFT: testNftAddress,
74
- TestMultiToken: testMultiTokenAddress,
75
- VerifyingPaymasterV06: "0x28ec0633192d0cBd9E1156CE05D5FdACAcB93947",
76
- VerifyingPaymasterV07: "0xc5c97885C67F7361aBAfD2B95067a5bBdA603608",
77
- };
78
- return contracts;
79
- }
80
- async init() {
81
- await super.init();
82
- const { args, flags } = await this.parse({
83
- flags: this.ctor.flags,
84
- baseFlags: super.ctor.baseFlags,
85
- args: this.ctor.args,
86
- enableJsonFlag: this.ctor.enableJsonFlag,
87
- strict: this.ctor.strict,
88
- });
89
- this.flags = flags;
90
- this.args = args;
91
- }
92
- }
@@ -1,12 +0,0 @@
1
- import { BaseCommand } from "../../baseCommand.js";
2
- export default class Deploy extends BaseCommand<typeof Deploy> {
3
- static summary: string;
4
- static description: string;
5
- static examples: string[];
6
- static flags: {
7
- hosting: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
8
- webapp: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<import("url").URL, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
9
- };
10
- run(): Promise<void>;
11
- }
12
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,MAAM,CAAC,OAAO,OAAO,MAAO,SAAQ,WAAW,CAAC,OAAO,MAAM,CAAC;IAC1D,MAAM,CAAC,OAAO,SAA2C;IAEzD,MAAM,CAAC,WAAW,SACoD;IAEtE,MAAM,CAAC,QAAQ,WAA2C;IAE1D,MAAM,CAAC,KAAK;;;MAWV;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAiEpC"}
@@ -1,78 +0,0 @@
1
- import confirm from "@inquirer/confirm";
2
- import select from "@inquirer/select";
3
- import { Flags } from "@oclif/core";
4
- import chalk from "chalk";
5
- import open, { apps } from "open";
6
- import { BaseCommand } from "../../baseCommand.js";
7
- class Deploy extends BaseCommand {
8
- async run() {
9
- const { flags } = await this.parse(Deploy);
10
- // print machine hash
11
- const templateHash = this.getMachineHash();
12
- if (!templateHash) {
13
- this.error(`Cartesi machine snapshot not found, run '${this.config.bin} build'`);
14
- }
15
- this.logPrompt({
16
- title: "Cartesi machine templateHash",
17
- value: templateHash,
18
- });
19
- // ask for deployment type
20
- const hosting = flags.hosting ||
21
- (await select({
22
- message: "Select hosting type",
23
- choices: [
24
- {
25
- name: "Self-hosting",
26
- description: `Select this option if you want to run the node for your application.
27
- You will need the following infrastructure:
28
-
29
- - a cloud server for the application node
30
- - a postgres database
31
- - a web3 node provider
32
- - a funded wallet
33
- `,
34
- value: "self-hosted",
35
- },
36
- {
37
- name: "Use third-party provider",
38
- description: "Select this option to use a third-party service provider to run a node for your application.",
39
- value: "third-party",
40
- disabled: "(coming soon)",
41
- },
42
- ],
43
- }));
44
- let queryString = "";
45
- switch (hosting) {
46
- case "self-hosted": {
47
- // build docker image
48
- await this.config.runCommand("deploy:build");
49
- queryString = `?templateHash=${templateHash}`;
50
- break;
51
- }
52
- case "third-party": {
53
- this.error("Third-party provider deployment not supported yet");
54
- }
55
- }
56
- // prompt user to open webapp for onchain deployment
57
- const deployUrl = `${flags.webapp}${queryString}`;
58
- if (await confirm({ message: `Open ${chalk.cyan(deployUrl)}?` })) {
59
- open(deployUrl, { app: { name: apps.chrome } });
60
- }
61
- return;
62
- }
63
- }
64
- Deploy.summary = "Deploy application to a live network.";
65
- Deploy.description = "Package and deploy the application to a supported live network.";
66
- Deploy.examples = ["<%= config.bin %> <%= command.id %>"];
67
- Deploy.flags = {
68
- hosting: Flags.string({
69
- options: ["self-hosted", "third-party"],
70
- summary: "hosting type",
71
- description: "Select wheather the user will host an application node himself, or use a third-party node provider",
72
- }),
73
- webapp: Flags.url({
74
- description: "address of deploy webapp",
75
- required: true,
76
- }),
77
- };
78
- export default Deploy;
@@ -1,28 +0,0 @@
1
- import { Command, Interfaces } from "@oclif/core";
2
- import { Address, PublicClient, WalletClient } from "viem";
3
- import { BaseCommand } from "../../baseCommand.js";
4
- export type Flags<T extends typeof Command> = Interfaces.InferredFlags<(typeof SendBaseCommand)["baseFlags"] & T["flags"]>;
5
- export type Args<T extends typeof Command> = Interfaces.InferredArgs<T["args"]>;
6
- export declare abstract class SendBaseCommand<T extends typeof Command> extends BaseCommand<typeof SendBaseCommand> {
7
- static baseFlags: {
8
- dapp: Interfaces.OptionFlag<`0x${string}` | undefined, Interfaces.CustomOptions>;
9
- "chain-id": Interfaces.OptionFlag<number | undefined, Interfaces.CustomOptions>;
10
- "rpc-url": Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
11
- "mnemonic-passphrase": Interfaces.OptionFlag<string | undefined, Interfaces.CustomOptions>;
12
- "mnemonic-index": Interfaces.OptionFlag<number, Interfaces.CustomOptions>;
13
- };
14
- protected flags: Flags<T>;
15
- protected args: Args<T>;
16
- private connect;
17
- protected getApplicationAddress(): Promise<Address>;
18
- init(): Promise<void>;
19
- protected abstract send(publicClient: PublicClient, walletClient: WalletClient): Promise<Address>;
20
- run(): Promise<void>;
21
- }
22
- export default class Send extends Command {
23
- static summary: string;
24
- static description: string;
25
- static examples: string[];
26
- run(): Promise<void>;
27
- }
28
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/send/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,OAAO,EAAE,UAAU,EAA0B,MAAM,aAAa,CAAC;AAE1E,OAAO,EAAE,OAAO,EAAE,YAAY,EAAE,YAAY,EAAa,MAAM,MAAM,CAAC;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAInD,MAAM,MAAM,KAAK,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,aAAa,CAClE,CAAC,OAAO,eAAe,CAAC,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,CACrD,CAAC;AACF,MAAM,MAAM,IAAI,CAAC,CAAC,SAAS,OAAO,OAAO,IAAI,UAAU,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;AAGhF,8BAAsB,eAAe,CACjC,CAAC,SAAS,OAAO,OAAO,CAC1B,SAAQ,WAAW,CAAC,OAAO,eAAe,CAAC;IACzC,MAAM,CAAC,SAAS;;;;;;MA8Bd;IAEF,SAAS,CAAC,KAAK,EAAG,KAAK,CAAC,CAAC,CAAC,CAAC;IAC3B,SAAS,CAAC,IAAI,EAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAEX,OAAO;cAeL,qBAAqB,IAAI,OAAO,CAAC,OAAO,CAAC;IAmB5C,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAYlC,SAAS,CAAC,QAAQ,CAAC,IAAI,CACnB,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,GAC3B,OAAO,CAAC,OAAO,CAAC;IAEN,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAOpC;AAED,MAAM,CAAC,OAAO,OAAO,IAAK,SAAQ,OAAO;IACrC,MAAM,CAAC,OAAO,SAAoC;IAElD,MAAM,CAAC,WAAW,SAC2D;IAE7E,MAAM,CAAC,QAAQ,WAA2C;IAE7C,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAmBpC"}
@@ -1,102 +0,0 @@
1
- import input from "@inquirer/input";
2
- import select from "@inquirer/select";
3
- import { Command, Flags as StandardFlags } from "@oclif/core";
4
- import ora from "ora";
5
- import { isAddress } from "viem";
6
- import { BaseCommand } from "../../baseCommand.js";
7
- import * as CustomFlags from "../../flags.js";
8
- import createClients, { supportedChains } from "../../wallet.js";
9
- // base command for sending input to the application
10
- export class SendBaseCommand extends BaseCommand {
11
- async connect() {
12
- // create viem clients
13
- return createClients({
14
- chain: supportedChains({ includeDevnet: true }).find((c) => c.id == this.flags["chain-id"]),
15
- rpcUrl: this.flags["rpc-url"],
16
- mnemonicPassphrase: this.flags["mnemonic-passphrase"],
17
- mnemonicIndex: this.flags["mnemonic-index"],
18
- });
19
- }
20
- async getApplicationAddress() {
21
- if (this.flags.dapp) {
22
- // honor the flag
23
- return this.flags.dapp;
24
- }
25
- // get the running container dapp address
26
- const nodeAddress = await super.getApplicationAddress();
27
- // query for the address
28
- const applicationAddress = await input({
29
- message: "Application address",
30
- validate: (value) => isAddress(value) || "Invalid address",
31
- default: nodeAddress,
32
- });
33
- return applicationAddress;
34
- }
35
- async init() {
36
- await super.init();
37
- const { args, flags } = await this.parse({
38
- flags: this.ctor.flags,
39
- baseFlags: super.ctor.baseFlags,
40
- args: this.ctor.args,
41
- strict: this.ctor.strict,
42
- });
43
- this.flags = flags;
44
- this.args = args;
45
- }
46
- async run() {
47
- const { publicClient, walletClient } = await this.connect();
48
- const hash = await this.send(publicClient, walletClient);
49
- const progress = ora("Sending input...").start();
50
- await publicClient.waitForTransactionReceipt({ hash });
51
- progress.succeed(`Input sent: ${hash}`);
52
- }
53
- }
54
- SendBaseCommand.baseFlags = {
55
- dapp: CustomFlags.address({
56
- summary: "dapp address.",
57
- description: "the address of the DApp, defaults to the deployed DApp address if application is running.",
58
- }),
59
- "chain-id": StandardFlags.integer({
60
- description: "The EIP-155 chain ID.",
61
- char: "c",
62
- env: "CHAIN",
63
- helpGroup: "Ethereum",
64
- options: supportedChains({ includeDevnet: true }).map((c) => c.id.toString()),
65
- }),
66
- "rpc-url": StandardFlags.string({
67
- description: "The RPC endpoint.",
68
- char: "r",
69
- env: "ETH_RPC_URL",
70
- helpGroup: "Ethereum",
71
- }),
72
- "mnemonic-passphrase": StandardFlags.string({
73
- description: "Use a BIP39 passphrase for the mnemonic.",
74
- helpGroup: "Wallet",
75
- }),
76
- "mnemonic-index": StandardFlags.integer({
77
- description: "Use the private key from the given mnemonic index.",
78
- helpGroup: "Wallet",
79
- default: 0,
80
- }),
81
- };
82
- class Send extends Command {
83
- async run() {
84
- // get all send sub-commands
85
- const sendCommands = this.config.commands.filter((command) => command.id.startsWith("send:"));
86
- // select the send sub-command
87
- const commandId = await select({
88
- message: "Select send sub-command",
89
- choices: sendCommands.map((command) => ({
90
- value: command.id,
91
- name: command.summary,
92
- description: command.description,
93
- })),
94
- });
95
- // invoke the sub-command
96
- await this.config.runCommand(commandId, this.argv);
97
- }
98
- }
99
- Send.summary = "Send input to the application.";
100
- Send.description = "Sends different kinds of input to the application in interactive mode.";
101
- Send.examples = ["<%= config.bin %> <%= command.id %>"];
102
- export default Send;
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
- });
@@ -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.3
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.3
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: {}
@@ -1,4 +0,0 @@
1
- services:
2
- validator:
3
- env_file:
4
- - ./.cartesi.env