@cartesi/cli 2.0.0-alpha.0 → 2.0.0-alpha.11
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 +103 -0
- package/dist/builder/directory.d.ts.map +1 -1
- package/dist/builder/docker.d.ts.map +1 -1
- package/dist/builder/docker.js +10 -1
- package/dist/builder/empty.d.ts.map +1 -1
- package/dist/builder/none.d.ts.map +1 -1
- package/dist/builder/tar.d.ts.map +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 +16 -28
- 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 +2 -15
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +7 -64
- 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 +3 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +12 -0
- package/dist/commands/doctor.d.ts +2 -12
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +96 -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/rollups/create.d.ts +7 -0
- package/dist/commands/rollups/create.d.ts.map +1 -0
- package/dist/commands/rollups/create.js +36 -0
- package/dist/commands/rollups/deploy.d.ts +16 -0
- package/dist/commands/rollups/deploy.d.ts.map +1 -0
- package/dist/commands/rollups/deploy.js +237 -0
- package/dist/commands/rollups/logs.d.ts +11 -0
- package/dist/commands/rollups/logs.d.ts.map +1 -0
- package/dist/commands/rollups/logs.js +32 -0
- package/dist/commands/rollups/start.d.ts +14 -0
- package/dist/commands/rollups/start.d.ts.map +1 -0
- package/dist/commands/rollups/start.js +211 -0
- package/dist/commands/rollups/status.d.ts +7 -0
- package/dist/commands/rollups/status.d.ts.map +1 -0
- package/dist/commands/rollups/status.js +46 -0
- package/dist/commands/rollups/stop.d.ts +5 -0
- package/dist/commands/rollups/stop.d.ts.map +1 -0
- package/dist/commands/rollups/stop.js +26 -0
- package/dist/commands/rollups.d.ts +6 -0
- package/dist/commands/rollups.d.ts.map +1 -0
- package/dist/commands/rollups.js +21 -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/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 +12 -14
- package/dist/commands/send/generic.d.ts.map +1 -1
- package/dist/commands/send/generic.js +92 -97
- 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 +21 -43
- package/dist/compose/rollups/default.env +34 -0
- package/dist/compose/rollups/docker-compose-anvil.yaml +17 -0
- package/dist/{node → compose/rollups}/docker-compose-bundler.yaml +12 -26
- package/dist/{node → compose/rollups}/docker-compose-database.yaml +4 -2
- package/dist/compose/rollups/docker-compose-espresso.yaml +68 -0
- package/dist/compose/rollups/docker-compose-explorer.yaml +57 -0
- package/dist/compose/rollups/docker-compose-graphql.yaml +23 -0
- package/dist/compose/rollups/docker-compose-node-cpus.yaml +6 -0
- package/dist/compose/rollups/docker-compose-node-memory.yaml +6 -0
- package/dist/compose/rollups/docker-compose-node.yaml +26 -0
- package/dist/compose/rollups/docker-compose-paymaster.yaml +18 -0
- package/dist/compose/rollups/docker-compose-proxy.yaml +24 -0
- package/dist/compose/rollups/proxy/anvil.yaml +17 -0
- package/dist/compose/rollups/proxy/bundler.yaml +17 -0
- package/dist/compose/rollups/proxy/espresso.yaml +17 -0
- package/dist/compose/rollups/proxy/explorer-api.yaml +17 -0
- package/dist/compose/rollups/proxy/explorer.yaml +10 -0
- package/dist/compose/rollups/proxy/graphql.yaml +10 -0
- package/dist/compose/rollups/proxy/paymaster.yaml +17 -0
- package/dist/compose/rollups/proxy/rollups-node.yaml +17 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +7 -17
- 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.map +1 -1
- package/dist/exec/crane.d.ts +1 -1
- package/dist/exec/crane.d.ts.map +1 -1
- package/dist/exec/genext2fs.d.ts.map +1 -1
- package/dist/exec/mksquashfs.d.ts.map +1 -1
- 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 +1 -1
- package/dist/exec/util.d.ts.map +1 -1
- package/dist/exec/util.js +2 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +53 -1
- package/dist/machine.d.ts.map +1 -1
- package/dist/prompts.d.ts.map +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.map +1 -1
- package/dist/wallet.js +47 -6
- package/package.json +30 -47
- 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-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
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACb,MAAM,SAAS,MAAM,EAAE,EACvB,SAAS,0BAA0B;;;GAGtC,CAAC;AAEF,eAAO,MAAM,OAAO,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAgBvB,CAAC"}
|
package/dist/exec/crane.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export declare const requiredVersion: Range;
|
|
|
5
5
|
export declare const exportImage: (options: {
|
|
6
6
|
stdin: Stream | number;
|
|
7
7
|
stdout: Stream | number;
|
|
8
|
-
} & DockerFallbackOptions) => Promise<import("child_process").SpawnSyncReturns<string | Buffer
|
|
8
|
+
} & DockerFallbackOptions) => Promise<import("child_process").SpawnSyncReturns<string | Buffer<ArrayBufferLike>> | {
|
|
9
9
|
error: {
|
|
10
10
|
code: string;
|
|
11
11
|
};
|
package/dist/exec/crane.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACpB,SAAS;IACL,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,GAAG,MAAM,CAAC;CAC3B,GAAG,qBAAqB;;;;;EAO5B,CAAC;AAEF,eAAO,MAAM,OAAO,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAMvB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACd,SAAS;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,GACtB,SAAS;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,GAChB,SAAS;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,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAevB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACtB,SAAS;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,GAChB,SAAS;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,GAChB,UAAU,qBAAqB,KAChC,OAAO,CAAC,MAAM,GAAG,IAAI,CAoBvB,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Address, Hash } from "viem";
|
|
2
|
+
export type RollupsDeployment = {
|
|
3
|
+
name: string;
|
|
4
|
+
address: Address;
|
|
5
|
+
templateHash: Hash;
|
|
6
|
+
epochLength: number;
|
|
7
|
+
state: "ENABLED" | "DISABLED";
|
|
8
|
+
};
|
|
9
|
+
type ComposeParams = {
|
|
10
|
+
environmentName?: string;
|
|
11
|
+
};
|
|
12
|
+
export declare const getDeployments: (options?: ComposeParams) => Promise<RollupsDeployment[]>;
|
|
13
|
+
export declare const getApplicationDeployment: (options?: ComposeParams) => Promise<RollupsDeployment | undefined>;
|
|
14
|
+
export declare const getApplicationAddress: () => Promise<Address | undefined>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=rollups.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/exec/rollups.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAGrC,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,cAAc,GACvB,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,EAAE,CAuB7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,UAAU,aAAa,KACxB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CASvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,QAAa,OAAO,CAAC,OAAO,GAAG,SAAS,CAGzE,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { execa } from "execa";
|
|
2
|
+
import { getMachineHash } from "../base.js";
|
|
3
|
+
export const getDeployments = async (options) => {
|
|
4
|
+
const environmentName = options?.environmentName ?? "cartesi-rollups";
|
|
5
|
+
try {
|
|
6
|
+
const { stdout } = await execa("docker", [
|
|
7
|
+
"compose",
|
|
8
|
+
"--project-name",
|
|
9
|
+
environmentName,
|
|
10
|
+
"exec",
|
|
11
|
+
"rollups-node",
|
|
12
|
+
"cartesi-rollups-cli",
|
|
13
|
+
"app",
|
|
14
|
+
"list",
|
|
15
|
+
]);
|
|
16
|
+
return JSON.parse(stdout).map((deployment) => ({
|
|
17
|
+
name: deployment.name,
|
|
18
|
+
address: deployment.iapplication_address,
|
|
19
|
+
templateHash: deployment.template_hash,
|
|
20
|
+
epochLength: deployment.epoch_lenght,
|
|
21
|
+
state: deployment.state,
|
|
22
|
+
}));
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
export const getApplicationDeployment = async (options) => {
|
|
29
|
+
const machineHash = getMachineHash();
|
|
30
|
+
if (!machineHash) {
|
|
31
|
+
return undefined;
|
|
32
|
+
}
|
|
33
|
+
const deployments = await getDeployments(options);
|
|
34
|
+
return deployments.find((deployment) => deployment.templateHash === machineHash);
|
|
35
|
+
};
|
|
36
|
+
export const getApplicationAddress = async () => {
|
|
37
|
+
const deployment = await getApplicationDeployment();
|
|
38
|
+
return deployment?.address;
|
|
39
|
+
};
|
package/dist/exec/util.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export declare const execaDockerFallback: (command: string, args: readonly strin
|
|
|
27
27
|
* @returns return of execa
|
|
28
28
|
*/
|
|
29
29
|
export type SpawnOptionsDockerFallback = SpawnSyncOptions & DockerFallbackOptions;
|
|
30
|
-
export declare const spawnSyncDockerFallback: (command: string, args: readonly string[], options: SpawnOptionsDockerFallback) => import("child_process").SpawnSyncReturns<string | Buffer
|
|
30
|
+
export declare const spawnSyncDockerFallback: (command: string, args: readonly string[], options: SpawnOptionsDockerFallback) => import("child_process").SpawnSyncReturns<string | Buffer<ArrayBufferLike>> | {
|
|
31
31
|
error: {
|
|
32
32
|
code: string;
|
|
33
33
|
};
|
package/dist/exec/util.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GAC5B,SAAS,MAAM,EACf,MAAM,SAAS,MAAM,EAAE,EACvB,SAAS,0BAA0B;YAbvB,MAAM;kBAAgB,KAAK;GAoD1C,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,0BAA0B,GAAG,gBAAgB,GACrD,qBAAqB,CAAC;AAC1B,eAAO,MAAM,uBAAuB,GAChC,SAAS,MAAM,EACf,MAAM,SAAS,MAAM,EAAE,EACvB,SAAS,0BAA0B;;;;;CA8CtC,CAAC"}
|
package/dist/exec/util.js
CHANGED
|
@@ -23,6 +23,7 @@ export const execaDockerFallback = async (command, args, options) => {
|
|
|
23
23
|
"--workdir",
|
|
24
24
|
"/work",
|
|
25
25
|
"--interactive",
|
|
26
|
+
"--rm",
|
|
26
27
|
"--user",
|
|
27
28
|
`${userInfo.uid}:${userInfo.gid}`,
|
|
28
29
|
];
|
|
@@ -52,6 +53,7 @@ export const spawnSyncDockerFallback = (command, args, options) => {
|
|
|
52
53
|
"--workdir",
|
|
53
54
|
"/work",
|
|
54
55
|
"--interactive",
|
|
56
|
+
"--rm",
|
|
55
57
|
"--user",
|
|
56
58
|
`${userInfo.uid}:${userInfo.gid}`,
|
|
57
59
|
];
|
package/dist/index.d.ts
CHANGED
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
CHANGED
|
@@ -1 +1,53 @@
|
|
|
1
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "@commander-js/extra-typings";
|
|
3
|
+
import { createRequire } from "node:module";
|
|
4
|
+
import { createAddressBookCommand } from "./commands/address-book.js";
|
|
5
|
+
import { createBuildCommand } from "./commands/build.js";
|
|
6
|
+
import { createCleanCommand } from "./commands/clean.js";
|
|
7
|
+
import { createCreateCommand } from "./commands/create.js";
|
|
8
|
+
import { createDeployCommand } from "./commands/deploy.js";
|
|
9
|
+
import { createDoctorCommand } from "./commands/doctor.js";
|
|
10
|
+
import { createHashCommand } from "./commands/hash.js";
|
|
11
|
+
import { createRollupsCommand } from "./commands/rollups.js";
|
|
12
|
+
import { createRunCommand } from "./commands/run.js";
|
|
13
|
+
import { createSendCommand } from "./commands/send.js";
|
|
14
|
+
import { createShellCommand } from "./commands/shell.js";
|
|
15
|
+
// Use `createRequire` to import JSON in ESM
|
|
16
|
+
const require = createRequire(import.meta.url);
|
|
17
|
+
const pkg = require("../package.json");
|
|
18
|
+
const splash = String.raw ` .
|
|
19
|
+
/ \
|
|
20
|
+
/ \
|
|
21
|
+
\---/---\ /----\
|
|
22
|
+
\ X \
|
|
23
|
+
\----/ \---/---\
|
|
24
|
+
\ / CARTESI
|
|
25
|
+
\ / CLI
|
|
26
|
+
'`;
|
|
27
|
+
const program = new Command()
|
|
28
|
+
.name("cartesi")
|
|
29
|
+
.version(pkg.version)
|
|
30
|
+
.addHelpText("before", splash)
|
|
31
|
+
.addCommand(createAddressBookCommand())
|
|
32
|
+
.addCommand(createBuildCommand())
|
|
33
|
+
.addCommand(createCleanCommand())
|
|
34
|
+
.addCommand(createCreateCommand())
|
|
35
|
+
.addCommand(createDeployCommand(), { hidden: true })
|
|
36
|
+
.addCommand(createDoctorCommand())
|
|
37
|
+
.addCommand(createHashCommand())
|
|
38
|
+
.addCommand(createRollupsCommand())
|
|
39
|
+
.addCommand(createRunCommand(), { hidden: true })
|
|
40
|
+
.addCommand(createSendCommand())
|
|
41
|
+
.addCommand(createShellCommand());
|
|
42
|
+
// Global error handling
|
|
43
|
+
process.on("uncaughtException", (err) => {
|
|
44
|
+
if (process.env.NODE_ENV === "development") {
|
|
45
|
+
console.error(err);
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
// in production, only print the error message, not the stack trace
|
|
49
|
+
console.error(err.message);
|
|
50
|
+
}
|
|
51
|
+
process.exit(1);
|
|
52
|
+
});
|
|
53
|
+
program.parse();
|
package/dist/machine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,GACpB,QAAQ,MAAM,EACd,MAAM,SAAS,GAAG,SAAS,EAC3B,aAAa,MAAM;;;GAwFtB,CAAC"}
|
package/dist/prompts.d.ts.map
CHANGED
|
@@ -1 +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,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,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,
|
|
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,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEzC,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,GACrB,QAAQ,mBAAmB,KAC5B,OAAO,CAAC,OAAO,CAMjB,CAAC;AAEF;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,WAAW,GAAG;IAAE,OAAO,CAAC,EAAE,GAAG,CAAA;CAAE,CAAC;AAC9D,eAAO,MAAM,QAAQ,GAAU,QAAQ,eAAe,KAAG,OAAO,CAAC,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,GACpB,QAAQ,kBAAkB,KAC3B,OAAO,CAAC,MAAM,CAUhB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,UAAU,GACnB,QAAQ,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAC1C,OAAO,CAAC,GAAG,CA8Cb,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GACvB,QAAQ,WAAW,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,KAC1C,OAAO,CAAC,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,GAAI,SAAS,EAChC,QAAQ,gBAAgB,CAAC,SAAS,CAAC,GAAG;IAAE,eAAe,CAAC,EAAE,OAAO,CAAA;CAAE,EACnE,UAAU,OAAO,GAAG,SAAS,KAC9B,OAAO,CAAC,SAAS,CAsBnB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../src/template.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,sBAAsB,EAAoB,MAAM,OAAO,CAAC;AAEjE,eAAO,MAAM,QAAQ,GACjB,WAAW,MAAM,EACjB,UAAU,MAAM,EAChB,QAAQ,MAAM,EACd,KAAK,MAAM,KACZ,OAAO,CAAC,sBAAsB,CAehC,CAAC"}
|
package/dist/template.js
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { downloadTemplate } from "giget";
|
|
2
|
+
export const download = async (framework, template, branch, out) => {
|
|
3
|
+
const cartesiProvider = async (input) => {
|
|
4
|
+
return {
|
|
5
|
+
name: "cartesi",
|
|
6
|
+
subdir: `${framework}/${input}`,
|
|
7
|
+
url: "https://github.com/cartesi/application-templates",
|
|
8
|
+
tar: `https://codeload.github.com/cartesi/application-templates/tar.gz/refs/heads/${branch}`,
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
const input = `cartesi:${template}`;
|
|
12
|
+
return downloadTemplate(input, {
|
|
13
|
+
dir: out,
|
|
14
|
+
providers: { cartesi: cartesiProvider },
|
|
15
|
+
});
|
|
16
|
+
};
|
package/dist/wallet.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,OAAO,EACP,KAAK,EACL,GAAG,EAEH,YAAY,EAEZ,YAAY,EAKf,MAAM,MAAM,CAAC;AAiBd,MAAM,MAAM,sBAAsB,GAAG;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,
|
|
1
|
+
{"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../src/wallet.ts"],"names":[],"mappings":"AAEA,OAAO,EAEH,OAAO,EACP,KAAK,EACL,GAAG,EAEH,YAAY,EAEZ,YAAY,EAKf,MAAM,MAAM,CAAC;AAiBd,MAAM,MAAM,sBAAsB,GAAG;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,eAAO,MAAM,eAAe,GAAI,UAAU,sBAAsB,KAAG,KAAK,EAoBvE,CAAC;AAEF,eAAO,MAAM,uBAAuB,gEAC6B,CAAC;AAElE,MAAM,MAAM,UAAU,GAAG,UAAU,GAAG,aAAa,CAAC;AA2CpD,MAAM,WAAW,qBAAqB;IAClC,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,GAAG,CAAC;CACpB;AAED,MAAM,MAAM,iBAAiB,GAAG,CAC5B,YAAY,EAAE,YAAY,EAC1B,YAAY,EAAE,YAAY,KACzB,OAAO,CAAC,OAAO,CAAC,CAAC;AAoMtB,QAAA,MAAM,aAAa,GACf,SAAS,qBAAqB,KAC/B,OAAO,CAAC;IACP,KAAK,EAAE,KAAK,CAAC;IACb,YAAY,EAAE,YAAY,CAAC;IAC3B,YAAY,EAAE,YAAY,CAAC;CAC9B,CAuBA,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
package/dist/wallet.js
CHANGED
|
@@ -2,7 +2,7 @@ import input from "@inquirer/input";
|
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { formatUnits, http, createPublicClient as viemCreatePublicClient, createWalletClient as viemCreateWalletClient, } from "viem";
|
|
4
4
|
import { mnemonicToAccount, privateKeyToAccount } from "viem/accounts";
|
|
5
|
-
import { arbitrum, arbitrumSepolia, base, baseSepolia,
|
|
5
|
+
import { arbitrum, arbitrumSepolia, base, baseSepolia, cannon, mainnet, optimism, optimismSepolia, sepolia, } from "viem/chains";
|
|
6
6
|
import { hexInput, selectAuto } from "./prompts.js";
|
|
7
7
|
export const supportedChains = (options) => {
|
|
8
8
|
options = options || {
|
|
@@ -14,7 +14,7 @@ export const supportedChains = (options) => {
|
|
|
14
14
|
options.includeMainnets = options.includeMainnets ?? true; // default is true if not specified
|
|
15
15
|
const chains = [];
|
|
16
16
|
if (options.includeDevnet) {
|
|
17
|
-
chains.push(
|
|
17
|
+
chains.push(cannon);
|
|
18
18
|
}
|
|
19
19
|
if (options.includeTestnets) {
|
|
20
20
|
chains.push(arbitrumSepolia, baseSepolia, optimismSepolia, sepolia);
|
|
@@ -26,7 +26,7 @@ export const supportedChains = (options) => {
|
|
|
26
26
|
};
|
|
27
27
|
export const DEFAULT_DEVNET_MNEMONIC = "test test test test test test test test test test test junk";
|
|
28
28
|
const walletChoices = (chain) => {
|
|
29
|
-
const dev = chain.id ===
|
|
29
|
+
const dev = chain.id === cannon.id;
|
|
30
30
|
return [
|
|
31
31
|
{
|
|
32
32
|
name: `Mnemonic${dev ? "" : chalk.red(" (UNSAFE)")}`,
|
|
@@ -38,8 +38,35 @@ const walletChoices = (chain) => {
|
|
|
38
38
|
},
|
|
39
39
|
];
|
|
40
40
|
};
|
|
41
|
+
/**
|
|
42
|
+
* Test if a RPC URL for a chain is working
|
|
43
|
+
* @param chain chain to test
|
|
44
|
+
* @param url url to test
|
|
45
|
+
* @returns true if the RPC URL is valid and chainId matches, false otherwise
|
|
46
|
+
*/
|
|
47
|
+
const testChainUrl = async (chain, url) => {
|
|
48
|
+
try {
|
|
49
|
+
const publicClient = viemCreatePublicClient({
|
|
50
|
+
transport: http(url),
|
|
51
|
+
chain,
|
|
52
|
+
});
|
|
53
|
+
const chainId = await publicClient.getChainId();
|
|
54
|
+
return chainId === chain.id;
|
|
55
|
+
}
|
|
56
|
+
catch (e) {
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
/**
|
|
61
|
+
* Test if the default RPC URL for a chain is working
|
|
62
|
+
* @param chain chain to test
|
|
63
|
+
* @returns true if the default RPC URL is valid, false otherwise
|
|
64
|
+
*/
|
|
65
|
+
const testDefaultPublicClient = async (chain) => {
|
|
66
|
+
return testChainUrl(chain, chain.rpcUrls.default.http[0]);
|
|
67
|
+
};
|
|
41
68
|
const selectChain = async (options) => {
|
|
42
|
-
// if development mode, include
|
|
69
|
+
// if development mode, include anvil as an option
|
|
43
70
|
const chains = supportedChains({ includeDevnet: true });
|
|
44
71
|
if (options.chain) {
|
|
45
72
|
const chain = options.chain;
|
|
@@ -68,9 +95,21 @@ const selectTransport = async (options, chain) => {
|
|
|
68
95
|
return http(options.rpcUrl);
|
|
69
96
|
}
|
|
70
97
|
else {
|
|
98
|
+
const defaultUrl = chain.rpcUrls.default.http[0];
|
|
99
|
+
// if the chain is cannon and URL is valid, use it without asking the user
|
|
100
|
+
if (chain.id === cannon.id) {
|
|
101
|
+
const port = 8080; // XXX: how to get environment port?
|
|
102
|
+
const url = `http://127.0.0.1:${port}/anvil`;
|
|
103
|
+
if (await testChainUrl(chain, url)) {
|
|
104
|
+
return http(url);
|
|
105
|
+
}
|
|
106
|
+
if (await testDefaultPublicClient(chain)) {
|
|
107
|
+
return http(defaultUrl);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
71
110
|
const url = await input({
|
|
72
111
|
message: "RPC URL",
|
|
73
|
-
default:
|
|
112
|
+
default: defaultUrl,
|
|
74
113
|
});
|
|
75
114
|
return http(url);
|
|
76
115
|
}
|
|
@@ -142,7 +181,9 @@ const createWalletClient = async (options, chain, publicClient, publicTransport)
|
|
|
142
181
|
// use the publicClient transport
|
|
143
182
|
const mnemonic = await input({
|
|
144
183
|
message: "Mnemonic",
|
|
145
|
-
default: chain.id ===
|
|
184
|
+
default: chain.id === cannon.id
|
|
185
|
+
? DEFAULT_DEVNET_MNEMONIC
|
|
186
|
+
: undefined,
|
|
146
187
|
});
|
|
147
188
|
// select account from mnemonic
|
|
148
189
|
if (options.mnemonicIndex) {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cartesi/cli",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.11",
|
|
4
4
|
"description": "Cartesi CLI",
|
|
5
5
|
"author": "Danilo Tuler <tuler@pobox.com>",
|
|
6
6
|
"bin": {
|
|
7
|
-
"cartesi": "./
|
|
7
|
+
"cartesi": "./dist/index.js"
|
|
8
8
|
},
|
|
9
9
|
"type": "module",
|
|
10
10
|
"homepage": "https://github.com/cartesi/cli",
|
|
@@ -14,80 +14,62 @@
|
|
|
14
14
|
"files": [
|
|
15
15
|
"/bin",
|
|
16
16
|
"/dist",
|
|
17
|
-
"/npm-shrinkwrap.json"
|
|
18
|
-
"/oclif.manifest.json"
|
|
17
|
+
"/npm-shrinkwrap.json"
|
|
19
18
|
],
|
|
20
19
|
"dependencies": {
|
|
21
|
-
"@
|
|
22
|
-
"@inquirer/
|
|
23
|
-
"@inquirer/
|
|
24
|
-
"@inquirer/
|
|
25
|
-
"@inquirer/
|
|
26
|
-
"@
|
|
27
|
-
"@oclif/plugin-help": "^6.2.15",
|
|
28
|
-
"@oclif/plugin-plugins": "^5.4.15",
|
|
20
|
+
"@commander-js/extra-typings": "^13.1.0",
|
|
21
|
+
"@inquirer/confirm": "^5.1.6",
|
|
22
|
+
"@inquirer/core": "^10.1.7",
|
|
23
|
+
"@inquirer/input": "^4.1.6",
|
|
24
|
+
"@inquirer/select": "^4.0.9",
|
|
25
|
+
"@inquirer/type": "^3.0.4",
|
|
29
26
|
"bytes": "^3.1.2",
|
|
30
|
-
"chalk": "^5.
|
|
27
|
+
"chalk": "^5.4.1",
|
|
31
28
|
"cli-table3": "^0.6.5",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
34
|
-
"
|
|
35
|
-
"
|
|
29
|
+
"commander": "^13.1.0",
|
|
30
|
+
"execa": "^9.5.2",
|
|
31
|
+
"fs-extra": "^11.3.0",
|
|
32
|
+
"giget": "^2.0.0",
|
|
33
|
+
"listr2": "^8.2.5",
|
|
34
|
+
"lookpath": "^1.2.3",
|
|
36
35
|
"open": "^10.1.0",
|
|
37
|
-
"ora": "^8.
|
|
36
|
+
"ora": "^8.2.0",
|
|
37
|
+
"p-retry": "^6.2.1",
|
|
38
38
|
"progress-stream": "^2.0.0",
|
|
39
|
-
"semver": "^7.
|
|
40
|
-
"smol-toml": "^1.3.
|
|
39
|
+
"semver": "^7.7.1",
|
|
40
|
+
"smol-toml": "^1.3.1",
|
|
41
41
|
"tmp": "^0.2.3",
|
|
42
|
-
"viem": "^2.
|
|
42
|
+
"viem": "^2.23.6"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
45
|
+
"@cartesi/devnet": "2.0.0-alpha.5",
|
|
46
|
+
"@cartesi/rollups": "2.0.0-rc.17",
|
|
47
|
+
"@types/bytes": "^3.1.5",
|
|
47
48
|
"@types/fs-extra": "^11.0.4",
|
|
48
49
|
"@types/inquirer": "^9.0.7",
|
|
49
|
-
"@types/node": "^22.
|
|
50
|
-
"@types/node-fetch": "^2.6.
|
|
50
|
+
"@types/node": "^22.13.9",
|
|
51
|
+
"@types/node-fetch": "^2.6.12",
|
|
51
52
|
"@types/progress-stream": "^2.0.5",
|
|
52
53
|
"@types/prompts": "^2.4.9",
|
|
53
54
|
"@types/semver": "^7.5.8",
|
|
54
55
|
"@types/tmp": "^0.2.6",
|
|
55
56
|
"@vitest/coverage-istanbul": "^2.1.3",
|
|
56
|
-
"@wagmi/cli": "^2.
|
|
57
|
+
"@wagmi/cli": "^2.2.0",
|
|
57
58
|
"copyfiles": "^2.4.1",
|
|
58
59
|
"eslint": "^8.57.0",
|
|
59
|
-
"eslint-config-oclif": "^5.2.1",
|
|
60
|
-
"eslint-config-oclif-typescript": "^3.1.12",
|
|
61
60
|
"npm-run-all": "^4.1.5",
|
|
62
|
-
"oclif": "^4.15.9",
|
|
63
61
|
"rimraf": "^6.0.1",
|
|
64
62
|
"ts-node": "^10.9.2",
|
|
65
|
-
"tslib": "^2.8.
|
|
66
|
-
"typescript": "^5.
|
|
63
|
+
"tslib": "^2.8.1",
|
|
64
|
+
"typescript": "^5.8.2",
|
|
67
65
|
"vitest": "^2.1.3",
|
|
68
|
-
"@cartesi/devnet": "2.0.0-alpha.0",
|
|
69
66
|
"@cartesi/eslint-config": "0.0.0",
|
|
70
67
|
"tsconfig": "0.0.0"
|
|
71
68
|
},
|
|
72
|
-
"oclif": {
|
|
73
|
-
"bin": "cartesi",
|
|
74
|
-
"dirname": "cartesi",
|
|
75
|
-
"commands": "./dist/commands",
|
|
76
|
-
"plugins": [
|
|
77
|
-
"@oclif/plugin-help"
|
|
78
|
-
],
|
|
79
|
-
"topicSeparator": " ",
|
|
80
|
-
"macos": {
|
|
81
|
-
"identifier": "io.cartesi.cli"
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
69
|
"engines": {
|
|
85
70
|
"node": ">=18.0.0"
|
|
86
71
|
},
|
|
87
72
|
"bugs": "https://github.com/cartesi/cli/issues",
|
|
88
|
-
"keywords": [
|
|
89
|
-
"oclif"
|
|
90
|
-
],
|
|
91
73
|
"types": "dist/index.d.ts",
|
|
92
74
|
"scripts": {
|
|
93
75
|
"build": "run-s clean codegen compile copy-files",
|
|
@@ -95,6 +77,7 @@
|
|
|
95
77
|
"codegen": "run-p codegen:wagmi",
|
|
96
78
|
"codegen:wagmi": "wagmi generate",
|
|
97
79
|
"compile": "tsc -p tsconfig.build.json",
|
|
80
|
+
"postcompile": "chmod +x dist/index.js",
|
|
98
81
|
"copy-files": "copyfiles -u 1 \"src/**/*.yaml\" \"src/**/*.env\" \"src/**/*.txt\" dist",
|
|
99
82
|
"lint": "eslint \"src/**/*.ts*\"",
|
|
100
83
|
"posttest": "pnpm lint",
|
package/bin/dev.cmd
DELETED
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
package/bin/run.js
DELETED
package/dist/baseCommand.d.ts
DELETED
|
@@ -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"}
|
package/dist/baseCommand.js
DELETED
|
@@ -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
|
-
}
|