@cartesi/cli 2.0.0-alpha.1 → 2.0.0-alpha.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/base.d.ts +18 -0
- package/dist/base.d.ts.map +1 -0
- package/dist/base.js +99 -0
- package/dist/builder/directory.d.ts +2 -2
- package/dist/builder/directory.d.ts.map +1 -1
- package/dist/builder/directory.js +1 -1
- package/dist/builder/docker.d.ts +1 -1
- package/dist/builder/docker.d.ts.map +1 -1
- package/dist/builder/docker.js +8 -8
- package/dist/builder/empty.d.ts +2 -2
- package/dist/builder/empty.d.ts.map +1 -1
- package/dist/builder/empty.js +1 -1
- package/dist/builder/none.d.ts +2 -2
- package/dist/builder/none.d.ts.map +1 -1
- package/dist/builder/none.js +1 -1
- package/dist/builder/tar.d.ts +2 -2
- package/dist/builder/tar.d.ts.map +1 -1
- package/dist/builder/tar.js +1 -1
- package/dist/commands/address-book.d.ts +4 -8
- package/dist/commands/address-book.d.ts.map +1 -1
- package/dist/commands/address-book.js +15 -14
- package/dist/commands/build.d.ts +5 -11
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +18 -30
- package/dist/commands/clean.d.ts +2 -7
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +9 -10
- package/dist/commands/create.d.ts +6 -15
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +24 -54
- package/dist/commands/deploy/build.d.ts +2 -14
- package/dist/commands/deploy/build.d.ts.map +1 -1
- package/dist/commands/deploy/build.js +8 -61
- package/dist/commands/deploy.d.ts +18 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +271 -0
- package/dist/commands/doctor.d.ts +2 -12
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +90 -91
- package/dist/commands/hash.d.ts +4 -9
- package/dist/commands/hash.d.ts.map +1 -1
- package/dist/commands/hash.js +14 -14
- package/dist/commands/logs.d.ts +10 -0
- package/dist/commands/logs.d.ts.map +1 -0
- package/dist/commands/logs.js +33 -0
- package/dist/commands/run.d.ts +2 -20
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +9 -190
- package/dist/commands/send/eip712.d.ts +34 -0
- package/dist/commands/send/eip712.d.ts.map +1 -0
- package/dist/commands/send/eip712.js +81 -0
- package/dist/commands/send/erc20.d.ts +11 -13
- package/dist/commands/send/erc20.d.ts.map +1 -1
- package/dist/commands/send/erc20.js +57 -52
- package/dist/commands/send/erc721.d.ts +11 -13
- package/dist/commands/send/erc721.d.ts.map +1 -1
- package/dist/commands/send/erc721.js +51 -46
- package/dist/commands/send/ether.d.ts +11 -12
- package/dist/commands/send/ether.d.ts.map +1 -1
- package/dist/commands/send/ether.js +25 -21
- package/dist/commands/send/generic.d.ts +14 -14
- package/dist/commands/send/generic.d.ts.map +1 -1
- package/dist/commands/send/generic.js +102 -99
- package/dist/commands/send.d.ts +21 -0
- package/dist/commands/send.d.ts.map +1 -0
- package/dist/commands/send.js +67 -0
- package/dist/commands/shell.d.ts +6 -14
- package/dist/commands/shell.d.ts.map +1 -1
- package/dist/commands/shell.js +22 -44
- package/dist/commands/start.d.ts +14 -0
- package/dist/commands/start.d.ts.map +1 -0
- package/dist/commands/start.js +220 -0
- package/dist/commands/status.d.ts +6 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +47 -0
- package/dist/commands/stop.d.ts +5 -0
- package/dist/commands/stop.d.ts.map +1 -0
- package/dist/commands/stop.js +27 -0
- package/dist/compose/default.env +35 -0
- package/dist/compose/docker-compose-anvil.yaml +17 -0
- package/dist/compose/docker-compose-bundler.yaml +37 -0
- package/dist/{node → compose}/docker-compose-database.yaml +4 -2
- package/dist/compose/docker-compose-espresso.yaml +59 -0
- package/dist/compose/docker-compose-explorer.yaml +57 -0
- package/dist/compose/docker-compose-graphql.yaml +23 -0
- package/dist/compose/docker-compose-node-cpus.yaml +6 -0
- package/dist/compose/docker-compose-node-memory.yaml +6 -0
- package/dist/compose/docker-compose-node.yaml +31 -0
- package/dist/compose/docker-compose-passkey-server.yaml +15 -0
- package/dist/compose/docker-compose-paymaster.yaml +18 -0
- package/dist/compose/docker-compose-proxy.yaml +24 -0
- package/dist/compose/proxy/anvil.yaml +17 -0
- package/dist/compose/proxy/bundler.yaml +29 -0
- package/dist/compose/proxy/espresso.yaml +17 -0
- package/dist/compose/proxy/explorer-api.yaml +17 -0
- package/dist/compose/proxy/explorer.yaml +10 -0
- package/dist/compose/proxy/graphql.yaml +10 -0
- package/dist/compose/proxy/passkey-server.yaml +17 -0
- package/dist/compose/proxy/paymaster.yaml +17 -0
- package/dist/compose/proxy/rollups-node.yaml +17 -0
- package/dist/config.d.ts +5 -4
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +26 -35
- package/dist/contracts.d.ts +1695 -1636
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +632 -592
- package/dist/exec/cartesi-machine.d.ts +2 -2
- package/dist/exec/cartesi-machine.d.ts.map +1 -1
- package/dist/exec/cartesi-machine.js +1 -1
- package/dist/exec/crane.d.ts +4 -4
- package/dist/exec/crane.d.ts.map +1 -1
- package/dist/exec/crane.js +1 -1
- package/dist/exec/genext2fs.d.ts +2 -2
- package/dist/exec/genext2fs.d.ts.map +1 -1
- package/dist/exec/genext2fs.js +2 -2
- package/dist/exec/mksquashfs.d.ts +2 -2
- package/dist/exec/mksquashfs.d.ts.map +1 -1
- package/dist/exec/mksquashfs.js +2 -2
- package/dist/exec/rollups.d.ts +16 -0
- package/dist/exec/rollups.d.ts.map +1 -0
- package/dist/exec/rollups.js +39 -0
- package/dist/exec/util.d.ts +3 -3
- package/dist/exec/util.d.ts.map +1 -1
- package/dist/exec/util.js +8 -10
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +59 -1
- package/dist/machine.d.ts +1 -1
- package/dist/machine.d.ts.map +1 -1
- package/dist/prompts.d.ts +3 -3
- package/dist/prompts.d.ts.map +1 -1
- package/dist/prompts.js +1 -1
- package/dist/template.d.ts +3 -0
- package/dist/template.d.ts.map +1 -0
- package/dist/template.js +16 -0
- package/dist/wallet.d.ts +1 -1
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +109 -84
- package/package.json +32 -50
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -25
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -8
- package/dist/baseCommand.d.ts +0 -22
- package/dist/baseCommand.d.ts.map +0 -1
- package/dist/baseCommand.js +0 -92
- package/dist/commands/deploy/index.d.ts +0 -12
- package/dist/commands/deploy/index.d.ts.map +0 -1
- package/dist/commands/deploy/index.js +0 -78
- package/dist/commands/send/index.d.ts +0 -28
- package/dist/commands/send/index.d.ts.map +0 -1
- package/dist/commands/send/index.js +0 -102
- package/dist/flags.d.ts +0 -17
- package/dist/flags.d.ts.map +0 -1
- package/dist/flags.js +0 -28
- package/dist/node/DockerfileDeploy.txt +0 -4
- package/dist/node/default.env +0 -27
- package/dist/node/docker-compose-anvil.yaml +0 -50
- package/dist/node/docker-compose-bundler.yaml +0 -57
- package/dist/node/docker-compose-envfile.yaml +0 -4
- package/dist/node/docker-compose-explorer.yaml +0 -88
- package/dist/node/docker-compose-host.yaml +0 -30
- package/dist/node/docker-compose-paymaster.yaml +0 -33
- package/dist/node/docker-compose-prompt.yaml +0 -17
- package/dist/node/docker-compose-proxy.yaml +0 -48
- package/dist/node/docker-compose-snapshot-volume.yaml +0 -8
- package/dist/node/docker-compose-validator-cpus.yaml +0 -6
- package/dist/node/docker-compose-validator-memory.yaml +0 -6
- package/dist/node/docker-compose-validator.yaml +0 -59
- package/oclif.manifest.json +0 -876
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type Address, type Hash } from "viem";
|
|
2
|
+
import { type Config } from "./config.js";
|
|
3
|
+
export declare const getContextPath: (...paths: string[]) => string;
|
|
4
|
+
export declare const getMachineHash: () => Hash | undefined;
|
|
5
|
+
export declare const getApplicationConfig: (configPath: string) => Config;
|
|
6
|
+
export type AddressBook = Record<string, Address>;
|
|
7
|
+
export declare const getAddressBook: () => Promise<AddressBook>;
|
|
8
|
+
export declare const getServiceState: (options: {
|
|
9
|
+
environmentName: string;
|
|
10
|
+
service: string;
|
|
11
|
+
}) => Promise<string | undefined>;
|
|
12
|
+
export declare const getServiceHealth: (options: {
|
|
13
|
+
environmentName: string;
|
|
14
|
+
service: string;
|
|
15
|
+
}) => Promise<string | undefined>;
|
|
16
|
+
export declare const parseAddress: (value: string) => Address | undefined;
|
|
17
|
+
export declare const parseHash: (value: string) => Hash;
|
|
18
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,IAAI,EAKZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,MAAM,EAAS,MAAM,aAAa,CAAC;AAkBjD,eAAO,MAAM,cAAc,GAAI,GAAG,OAAO,MAAM,EAAE,KAAG,MAEnD,CAAC;AAEF,eAAO,MAAM,cAAc,QAAO,IAAI,GAAG,SAUxC,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,YAAY,MAAM,KAAG,MAIzD,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc,QAAa,OAAO,CAAC,WAAW,CAkC1D,CAAC;AAqBF,eAAO,MAAM,eAAe,GAAU,SAAS;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACnB,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAG7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,SAAS;IAC5C,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;CACnB,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAG7B,CAAC;AAEF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OAAO,GAAG,SAQtD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,IAQzC,CAAC"}
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { InvalidArgumentError } from "@commander-js/extra-typings";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { getAddress, isAddress, isHash, zeroHash, } from "viem";
|
|
6
|
+
import { parse } from "./config.js";
|
|
7
|
+
import { applicationFactoryAddress, authorityFactoryAddress, erc1155BatchPortalAddress, erc1155SinglePortalAddress, erc20PortalAddress, erc721PortalAddress, etherPortalAddress, inputBoxAddress, selfHostedApplicationFactoryAddress, testMultiTokenAddress, testNftAddress, testTokenAddress, } from "./contracts.js";
|
|
8
|
+
import { getApplicationAddress } from "./exec/rollups.js";
|
|
9
|
+
export const getContextPath = (...paths) => {
|
|
10
|
+
return path.join(".cartesi", ...paths);
|
|
11
|
+
};
|
|
12
|
+
export const getMachineHash = () => {
|
|
13
|
+
// read hash of the cartesi machine snapshot, if one exists
|
|
14
|
+
const hashPath = getContextPath("image", "hash");
|
|
15
|
+
if (fs.existsSync(hashPath)) {
|
|
16
|
+
const hash = fs.readFileSync(hashPath).toString("hex");
|
|
17
|
+
if (isHash(`0x${hash}`)) {
|
|
18
|
+
return `0x${hash}`;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return undefined;
|
|
22
|
+
};
|
|
23
|
+
export const getApplicationConfig = (configPath) => {
|
|
24
|
+
return fs.existsSync(configPath)
|
|
25
|
+
? parse(fs.readFileSync(configPath).toString())
|
|
26
|
+
: parse("");
|
|
27
|
+
};
|
|
28
|
+
export const getAddressBook = async () => {
|
|
29
|
+
const applicationAddress = await getApplicationAddress();
|
|
30
|
+
// build rollups contracts address book
|
|
31
|
+
const contracts = {
|
|
32
|
+
ApplicationFactory: applicationFactoryAddress,
|
|
33
|
+
AuthorityFactory: authorityFactoryAddress,
|
|
34
|
+
EntryPointV06: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
35
|
+
EntryPointV07: "0x0000000071727De22E5E9d8BAf0edAc6f37da032",
|
|
36
|
+
ERC1155BatchPortal: erc1155BatchPortalAddress,
|
|
37
|
+
ERC1155SinglePortal: erc1155SinglePortalAddress,
|
|
38
|
+
ERC20Portal: erc20PortalAddress,
|
|
39
|
+
ERC721Portal: erc721PortalAddress,
|
|
40
|
+
EtherPortal: etherPortalAddress,
|
|
41
|
+
InputBox: inputBoxAddress,
|
|
42
|
+
LightAccountFactory: "0x00004EC70002a32400f8ae005A26081065620D20",
|
|
43
|
+
SelfHostedApplicationFactory: selfHostedApplicationFactoryAddress,
|
|
44
|
+
SimpleAccountFactory: "0x9406Cc6185a346906296840746125a0E44976454",
|
|
45
|
+
SmartAccountFactory: "0x000000a56Aaca3e9a4C479ea6b6CD0DbcB6634F5",
|
|
46
|
+
KernelFactoryV2: "0x5de4839a76cf55d0c90e2061ef4386d962E15ae3",
|
|
47
|
+
KernelFactoryV3: "0x6723b44Abeec4E71eBE3232BD5B455805baDD22f",
|
|
48
|
+
KernelFactoryV3_1: "0xaac5D4240AF87249B3f71BC8E4A2cae074A3E419",
|
|
49
|
+
TestToken: testTokenAddress,
|
|
50
|
+
TestNFT: testNftAddress,
|
|
51
|
+
TestMultiToken: testMultiTokenAddress,
|
|
52
|
+
VerifyingPaymasterV06: "0x28ec0633192d0cBd9E1156CE05D5FdACAcB93947",
|
|
53
|
+
VerifyingPaymasterV07: "0xc5c97885C67F7361aBAfD2B95067a5bBdA603608",
|
|
54
|
+
};
|
|
55
|
+
if (applicationAddress) {
|
|
56
|
+
contracts.Application = applicationAddress;
|
|
57
|
+
}
|
|
58
|
+
return contracts;
|
|
59
|
+
};
|
|
60
|
+
const getServiceInfo = async (options) => {
|
|
61
|
+
const { environmentName, service } = options;
|
|
62
|
+
// get service information
|
|
63
|
+
const { stdout } = await execa("docker", [
|
|
64
|
+
"compose",
|
|
65
|
+
"--project-name",
|
|
66
|
+
environmentName,
|
|
67
|
+
"ps",
|
|
68
|
+
service,
|
|
69
|
+
"--format",
|
|
70
|
+
"json",
|
|
71
|
+
]);
|
|
72
|
+
return stdout ? JSON.parse(stdout) : undefined;
|
|
73
|
+
};
|
|
74
|
+
export const getServiceState = async (options) => {
|
|
75
|
+
const info = await getServiceInfo(options);
|
|
76
|
+
return info?.State;
|
|
77
|
+
};
|
|
78
|
+
export const getServiceHealth = async (options) => {
|
|
79
|
+
const info = await getServiceInfo(options);
|
|
80
|
+
return info?.Health;
|
|
81
|
+
};
|
|
82
|
+
export const parseAddress = (value) => {
|
|
83
|
+
if (isAddress(value)) {
|
|
84
|
+
return getAddress(value);
|
|
85
|
+
}
|
|
86
|
+
if (value !== "") {
|
|
87
|
+
throw new InvalidArgumentError(`Invalid address: ${value}`);
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
};
|
|
91
|
+
export const parseHash = (value) => {
|
|
92
|
+
if (isHash(value)) {
|
|
93
|
+
return value;
|
|
94
|
+
}
|
|
95
|
+
if (value !== "") {
|
|
96
|
+
throw new InvalidArgumentError(`Invalid hash: ${value}`);
|
|
97
|
+
}
|
|
98
|
+
return zeroHash;
|
|
99
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { DirectoryDriveConfig } from "../config.js";
|
|
2
|
-
export declare const build: (name: string, drive: DirectoryDriveConfig, sdkImage: string, destination: string) => Promise<
|
|
1
|
+
import type { DirectoryDriveConfig } from "../config.js";
|
|
2
|
+
export declare const build: (name: string, drive: DirectoryDriveConfig, sdkImage: string, destination: string) => Promise<undefined>;
|
|
3
3
|
//# sourceMappingURL=directory.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/builder/directory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/builder/directory.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGzD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,oBAAoB,EAC3B,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,SAAS,CAkCnB,CAAC"}
|
package/dist/builder/docker.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/builder/docker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/builder/docker.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQtD,KAAK,SAAS,GAAG;IACb,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;CACnB,CAAC;AA+DF,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,iBAAiB,EACxB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,SAAS,GAAG,SAAS,CA4D/B,CAAC"}
|
package/dist/builder/docker.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { execa } from "execa";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
-
import path from "path";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
import tmp from "tmp";
|
|
5
5
|
import { crane, genext2fs, mksquashfs } from "../exec/index.js";
|
|
6
6
|
/**
|
|
@@ -22,7 +22,7 @@ const buildImage = async (options) => {
|
|
|
22
22
|
context,
|
|
23
23
|
];
|
|
24
24
|
// set tags for the image built
|
|
25
|
-
args.push(...tags.
|
|
25
|
+
args.push(...tags.flatMap((tag) => ["--tag", tag]));
|
|
26
26
|
if (target) {
|
|
27
27
|
args.push("--target", target);
|
|
28
28
|
}
|
|
@@ -43,14 +43,14 @@ const getImageInfo = async (image) => {
|
|
|
43
43
|
// parse image info from docker inspect output
|
|
44
44
|
const [imageInfo] = JSON.parse(jsonStr);
|
|
45
45
|
// validate image architecture (must be riscv64)
|
|
46
|
-
if (imageInfo
|
|
47
|
-
throw new Error(`Invalid image Architecture: ${imageInfo
|
|
46
|
+
if (imageInfo.Architecture !== "riscv64") {
|
|
47
|
+
throw new Error(`Invalid image Architecture: ${imageInfo.Architecture}. Expected riscv64`);
|
|
48
48
|
}
|
|
49
49
|
const info = {
|
|
50
|
-
cmd: imageInfo
|
|
51
|
-
entrypoint: imageInfo
|
|
52
|
-
env: imageInfo
|
|
53
|
-
workdir: imageInfo
|
|
50
|
+
cmd: imageInfo.Config.Cmd ?? [],
|
|
51
|
+
entrypoint: imageInfo.Config.Entrypoint ?? [],
|
|
52
|
+
env: imageInfo.Config.Env || [],
|
|
53
|
+
workdir: imageInfo.Config.WorkingDir,
|
|
54
54
|
};
|
|
55
55
|
return info;
|
|
56
56
|
};
|
package/dist/builder/empty.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { EmptyDriveConfig } from "../config.js";
|
|
2
|
-
export declare const build: (name: string, drive: EmptyDriveConfig, sdkImage: string, destination: string) => Promise<
|
|
1
|
+
import type { EmptyDriveConfig } from "../config.js";
|
|
2
|
+
export declare const build: (name: string, drive: EmptyDriveConfig, sdkImage: string, destination: string) => Promise<undefined>;
|
|
3
3
|
//# sourceMappingURL=empty.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/builder/empty.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/builder/empty.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGrD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,gBAAgB,EACvB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,SAAS,CAoBnB,CAAC"}
|
package/dist/builder/empty.js
CHANGED
package/dist/builder/none.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { ExistingDriveConfig } from "../config.js";
|
|
2
|
-
export declare const build: (name: string, drive: ExistingDriveConfig, destination: string) => Promise<
|
|
1
|
+
import { type ExistingDriveConfig } from "../config.js";
|
|
2
|
+
export declare const build: (name: string, drive: ExistingDriveConfig, destination: string) => Promise<undefined>;
|
|
3
3
|
//# sourceMappingURL=none.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/builder/none.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAkB,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/builder/none.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,mBAAmB,EAAkB,MAAM,cAAc,CAAC;AAExE,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,mBAAmB,EAC1B,aAAa,MAAM,KACpB,OAAO,CAAC,SAAS,CAQnB,CAAC"}
|
package/dist/builder/none.js
CHANGED
package/dist/builder/tar.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { TarDriveConfig } from "../config.js";
|
|
2
|
-
export declare const build: (name: string, drive: TarDriveConfig, sdkImage: string, destination: string) => Promise<
|
|
1
|
+
import type { TarDriveConfig } from "../config.js";
|
|
2
|
+
export declare const build: (name: string, drive: TarDriveConfig, sdkImage: string, destination: string) => Promise<undefined>;
|
|
3
3
|
//# sourceMappingURL=tar.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/builder/tar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/builder/tar.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAGnD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,cAAc,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,SAAS,CA4BnB,CAAC"}
|
package/dist/builder/tar.js
CHANGED
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static enableJsonFlag: boolean;
|
|
7
|
-
run(): Promise<AddressBookType>;
|
|
8
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createAddressBookCommand: () => Command<[], {
|
|
3
|
+
json?: true | undefined;
|
|
4
|
+
}, {}>;
|
|
9
5
|
//# sourceMappingURL=address-book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../src/commands/address-book.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"address-book.d.ts","sourceRoot":"","sources":["../../src/commands/address-book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,wBAAwB;;MAsCpC,CAAC"}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import Table from "cli-table3";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
import { getAddressBook } from "../base.js";
|
|
4
|
+
export const createAddressBookCommand = () => {
|
|
5
|
+
return new Command("address-book")
|
|
6
|
+
.description("Prints the addresses of all smart contracts deployed to the runtime environment of the application.")
|
|
7
|
+
.option("--json", "Format output as json.")
|
|
8
|
+
.action(async ({ json }) => {
|
|
9
|
+
const addressBook = await getAddressBook();
|
|
10
|
+
if (!json) {
|
|
7
11
|
// print as a table
|
|
8
12
|
const table = new Table({
|
|
9
13
|
head: ["Contract", "Address"],
|
|
@@ -29,12 +33,9 @@ class AddressBook extends BaseCommand {
|
|
|
29
33
|
table.push(...Object.entries(addressBook));
|
|
30
34
|
console.log(table.toString());
|
|
31
35
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
AddressBook.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
39
|
-
AddressBook.enableJsonFlag = true;
|
|
40
|
-
export default AddressBook;
|
|
36
|
+
else {
|
|
37
|
+
// print as json
|
|
38
|
+
process.stdout.write(JSON.stringify(addressBook));
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
};
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,12 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
static flags: {
|
|
7
|
-
config: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
-
"drives-only": import("@oclif/core/lib/interfaces/parser.js").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createBuildCommand: () => Command<[], {
|
|
3
|
+
config: string;
|
|
4
|
+
drivesOnly?: true | undefined;
|
|
5
|
+
}, {}>;
|
|
12
6
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/commands/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAwCtD,eAAO,MAAM,kBAAkB;;;MAoD9B,CAAC"}
|
package/dist/commands/build.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
import fs from "fs-extra";
|
|
3
|
-
import path from "path";
|
|
3
|
+
import path from "node:path";
|
|
4
4
|
import tmp from "tmp";
|
|
5
|
-
import {
|
|
5
|
+
import { getApplicationConfig, getContextPath } from "../base.js";
|
|
6
6
|
import { buildDirectory, buildDocker, buildEmpty, buildNone, buildTar, } from "../builder/index.js";
|
|
7
7
|
import { bootMachine } from "../machine.js";
|
|
8
8
|
const buildDrive = async (name, drive, sdkImage, destination) => {
|
|
@@ -24,50 +24,38 @@ const buildDrive = async (name, drive, sdkImage, destination) => {
|
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
};
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
27
|
+
export const createBuildCommand = () => {
|
|
28
|
+
return new Command("build")
|
|
29
|
+
.description("Build application by building Cartesi machine drives, configuring a machine and booting it.")
|
|
30
|
+
.option("-c, --config <config>", "path to the configuration file", "cartesi.toml")
|
|
31
|
+
.option("-d, --drives-only", "only build drives, do not boot machine")
|
|
32
|
+
.action(async ({ config, drivesOnly }) => {
|
|
30
33
|
// clean up temp files we create along the process
|
|
31
34
|
tmp.setGracefulCleanup();
|
|
32
35
|
// get application configuration from 'cartesi.toml'
|
|
33
|
-
const
|
|
36
|
+
const c = getApplicationConfig(config);
|
|
34
37
|
// destination directory for image and intermediate files
|
|
35
|
-
const destination = path.resolve(
|
|
38
|
+
const destination = path.resolve(getContextPath());
|
|
36
39
|
// prepare context directory
|
|
37
40
|
await fs.emptyDir(destination); // XXX: make it less error prone
|
|
38
41
|
// start build of all drives simultaneously
|
|
39
|
-
const results = Object.entries(
|
|
40
|
-
acc[name] = buildDrive(name, drive,
|
|
42
|
+
const results = Object.entries(c.drives).reduce((acc, [name, drive]) => {
|
|
43
|
+
acc[name] = buildDrive(name, drive, c.sdk, destination);
|
|
41
44
|
return acc;
|
|
42
45
|
}, {});
|
|
43
46
|
// await for all drives to be built
|
|
44
47
|
await Promise.all(Object.values(results));
|
|
45
|
-
if (
|
|
48
|
+
if (drivesOnly) {
|
|
46
49
|
// only build drives, so quit here
|
|
47
50
|
return;
|
|
48
51
|
}
|
|
49
52
|
// get image info of root drive
|
|
50
|
-
const root = await results
|
|
53
|
+
const root = await results.root;
|
|
51
54
|
const imageInfo = root || undefined;
|
|
52
55
|
// path of machine snapshot
|
|
53
|
-
const snapshotPath =
|
|
56
|
+
const snapshotPath = getContextPath("image");
|
|
54
57
|
// create machine snapshot
|
|
55
|
-
await bootMachine(
|
|
58
|
+
await bootMachine(c, imageInfo, destination);
|
|
56
59
|
await fs.chmod(snapshotPath, 0o755);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
Build.summary = "Build application.";
|
|
60
|
-
Build.description = "Build application by building Cartesi machine drives, configuring a machine and booting it";
|
|
61
|
-
Build.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
62
|
-
Build.flags = {
|
|
63
|
-
config: Flags.file({
|
|
64
|
-
char: "c",
|
|
65
|
-
default: "cartesi.toml",
|
|
66
|
-
summary: "path to the configuration file",
|
|
67
|
-
}),
|
|
68
|
-
"drives-only": Flags.boolean({
|
|
69
|
-
default: false,
|
|
70
|
-
summary: "only build drives",
|
|
71
|
-
}),
|
|
60
|
+
});
|
|
72
61
|
};
|
|
73
|
-
export default Build;
|
package/dist/commands/clean.d.ts
CHANGED
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
static summary: string;
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
run(): Promise<void>;
|
|
7
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createCleanCommand: () => Command<[], {}, {}>;
|
|
8
3
|
//# sourceMappingURL=clean.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"clean.d.ts","sourceRoot":"","sources":["../../src/commands/clean.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,kBAAkB,2BAM9B,CAAC"}
|
package/dist/commands/clean.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import fs from "fs-extra";
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
Clean.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
11
|
-
export default Clean;
|
|
3
|
+
import { getContextPath } from "../base.js";
|
|
4
|
+
export const createCleanCommand = () => {
|
|
5
|
+
return new Command("clean")
|
|
6
|
+
.description("Deletes all cached build artifacts of application.")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
await fs.emptyDir(getContextPath());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
@@ -1,16 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const DEFAULT_TEMPLATES_BRANCH = "sdk-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
name: import("@oclif/core/lib/interfaces/parser.js").Arg<string, Record<string, unknown>>;
|
|
8
|
-
};
|
|
9
|
-
static flags: {
|
|
10
|
-
template: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
11
|
-
branch: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
12
|
-
};
|
|
13
|
-
private download;
|
|
14
|
-
run(): Promise<void>;
|
|
15
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
|
|
3
|
+
export declare const createCreateCommand: () => Command<[string], {
|
|
4
|
+
template: "cpp" | "cpp-low-level" | "go" | "javascript" | "lua" | "python" | "ruby" | "rust" | "typescript";
|
|
5
|
+
branch: string;
|
|
6
|
+
}, {}>;
|
|
16
7
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAK9D,eAAO,MAAM,wBAAwB,sBAAsB,CAAC;AAc5D,eAAO,MAAM,mBAAmB;;;MA0B/B,CAAC"}
|
package/dist/commands/create.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command, Option } from "@commander-js/extra-typings";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
import { downloadTemplate } from "giget";
|
|
4
3
|
import ora from "ora";
|
|
5
|
-
import {
|
|
6
|
-
export const DEFAULT_TEMPLATES_BRANCH = "sdk-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
4
|
+
import { download } from "../template.js";
|
|
5
|
+
export const DEFAULT_TEMPLATES_BRANCH = "prerelease/sdk-12";
|
|
6
|
+
const TEMPLATES = [
|
|
7
|
+
"cpp",
|
|
8
|
+
"cpp-low-level",
|
|
9
|
+
"go",
|
|
10
|
+
"javascript",
|
|
11
|
+
"lua",
|
|
12
|
+
"python",
|
|
13
|
+
"ruby",
|
|
14
|
+
"rust",
|
|
15
|
+
"typescript",
|
|
16
|
+
];
|
|
17
|
+
export const createCreateCommand = () => {
|
|
18
|
+
return new Command("create")
|
|
19
|
+
.argument("<name>", "application and directory name")
|
|
20
|
+
.addOption(new Option("-t, --template <template>", "template name to use")
|
|
21
|
+
.choices(TEMPLATES)
|
|
22
|
+
.makeOptionMandatory())
|
|
23
|
+
.option("-b, --branch <branch>", "cartesi/application-templates repository branch name to use", DEFAULT_TEMPLATES_BRANCH)
|
|
24
|
+
.action(async (name, { branch, template }) => {
|
|
25
25
|
const spinner = ora("Creating application...").start();
|
|
26
26
|
try {
|
|
27
|
-
const { dir } = await
|
|
27
|
+
const { dir } = await download(template, branch, name);
|
|
28
28
|
spinner.succeed(`Application created at ${chalk.cyan(dir)}`);
|
|
29
29
|
}
|
|
30
30
|
catch (e) {
|
|
@@ -32,35 +32,5 @@ class CreateCommand extends BaseCommand {
|
|
|
32
32
|
? `Error creating application: ${chalk.red(e.message)}`
|
|
33
33
|
: String(e));
|
|
34
34
|
}
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
CreateCommand.description = "Create application";
|
|
38
|
-
CreateCommand.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
39
|
-
CreateCommand.args = {
|
|
40
|
-
name: Args.string({
|
|
41
|
-
description: "application and directory name",
|
|
42
|
-
required: true,
|
|
43
|
-
}),
|
|
35
|
+
});
|
|
44
36
|
};
|
|
45
|
-
CreateCommand.flags = {
|
|
46
|
-
template: Flags.string({
|
|
47
|
-
description: "template name to use",
|
|
48
|
-
required: true,
|
|
49
|
-
options: [
|
|
50
|
-
"cpp",
|
|
51
|
-
"cpp-low-level",
|
|
52
|
-
"go",
|
|
53
|
-
"javascript",
|
|
54
|
-
"lua",
|
|
55
|
-
"python",
|
|
56
|
-
"ruby",
|
|
57
|
-
"rust",
|
|
58
|
-
"typescript",
|
|
59
|
-
],
|
|
60
|
-
}),
|
|
61
|
-
branch: Flags.string({
|
|
62
|
-
description: `cartesi/application-templates repository branch name to use`,
|
|
63
|
-
default: DEFAULT_TEMPLATES_BRANCH,
|
|
64
|
-
}),
|
|
65
|
-
};
|
|
66
|
-
export default CreateCommand;
|
|
@@ -1,15 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
static summary: string;
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static flags: {
|
|
7
|
-
platform: import("@oclif/core/lib/interfaces/parser.js").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces/parser.js").CustomOptions>;
|
|
8
|
-
};
|
|
9
|
-
static enableJsonFlag: boolean;
|
|
10
|
-
private buildRollupsImage;
|
|
11
|
-
run(): Promise<{
|
|
12
|
-
image: string;
|
|
13
|
-
}>;
|
|
14
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createBuildCommand: () => Command<[], {}, {}>;
|
|
15
3
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAGtD,eAAO,MAAM,kBAAkB,2BAQ9B,CAAC"}
|