@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
package/dist/base.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Address, Hash } from "viem";
|
|
2
|
+
import { 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,EAAE,OAAO,EAAc,IAAI,EAA+B,MAAM,MAAM,CAAC;AAC9E,OAAO,EAAE,MAAM,EAAS,MAAM,aAAa,CAAC;AAkB5C,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,SAStD,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,MAAM,KAAG,IASzC,CAAC"}
|
package/dist/base.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { InvalidArgumentError } from "@commander-js/extra-typings";
|
|
2
|
+
import { execa } from "execa";
|
|
3
|
+
import fs from "fs";
|
|
4
|
+
import path from "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
|
+
else {
|
|
87
|
+
if (value !== "") {
|
|
88
|
+
throw new InvalidArgumentError(`Invalid address: ${value}`);
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
export const parseHash = (value) => {
|
|
94
|
+
if (isHash(value)) {
|
|
95
|
+
return value;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
if (value !== "") {
|
|
99
|
+
throw new InvalidArgumentError(`Invalid hash: ${value}`);
|
|
100
|
+
}
|
|
101
|
+
return zeroHash;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
@@ -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;AAGpD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"directory.d.ts","sourceRoot":"","sources":["../../src/builder/directory.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,MAAM,cAAc,CAAC;AAGpD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,oBAAoB,EAC3B,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CAkCd,CAAC"}
|
|
@@ -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;AAQjD,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;
|
|
1
|
+
{"version":3,"file":"docker.d.ts","sourceRoot":"","sources":["../../src/builder/docker.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAQjD,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
|
@@ -12,6 +12,8 @@ const buildImage = async (options) => {
|
|
|
12
12
|
const args = [
|
|
13
13
|
"buildx",
|
|
14
14
|
"build",
|
|
15
|
+
"--platform",
|
|
16
|
+
"linux/riscv64",
|
|
15
17
|
"--file",
|
|
16
18
|
dockerfile,
|
|
17
19
|
"--load",
|
|
@@ -58,7 +60,14 @@ export const build = async (name, drive, sdkImage, destination) => {
|
|
|
58
60
|
const tar = `${name}.tar`;
|
|
59
61
|
const filename = `${name}.${format}`;
|
|
60
62
|
// use pre-existing image or build docker image
|
|
61
|
-
|
|
63
|
+
let image;
|
|
64
|
+
if (drive.image) {
|
|
65
|
+
image = drive.image;
|
|
66
|
+
await execa("docker", ["image", "pull", image]);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
image = await buildImage(drive);
|
|
70
|
+
}
|
|
62
71
|
// get image info
|
|
63
72
|
const imageInfo = await getImageInfo(image);
|
|
64
73
|
try {
|
|
@@ -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;AAGhD,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"empty.d.ts","sourceRoot":"","sources":["../../src/builder/empty.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAGhD,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,gBAAgB,EACvB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CAoBd,CAAC"}
|
|
@@ -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;AAEnE,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"none.d.ts","sourceRoot":"","sources":["../../src/builder/none.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAkB,MAAM,cAAc,CAAC;AAEnE,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,mBAAmB,EAC1B,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CAQd,CAAC"}
|
|
@@ -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;AAG9C,eAAO,MAAM,KAAK,
|
|
1
|
+
{"version":3,"file":"tar.d.ts","sourceRoot":"","sources":["../../src/builder/tar.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,eAAO,MAAM,KAAK,GACd,MAAM,MAAM,EACZ,OAAO,cAAc,EACrB,UAAU,MAAM,EAChB,aAAa,MAAM,KACpB,OAAO,CAAC,IAAI,CA4Bd,CAAC"}
|
|
@@ -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
3
|
import path from "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,25 +24,28 @@ 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
|
}
|
|
@@ -50,24 +53,9 @@ class Build extends BaseCommand {
|
|
|
50
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,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const
|
|
3
|
-
export default class CreateCommand extends BaseCommand<typeof CreateCommand> {
|
|
4
|
-
static description: string;
|
|
5
|
-
static examples: string[];
|
|
6
|
-
static args: {
|
|
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 createCreateCommand: () => Command<[], {}, {}>;
|
|
16
3
|
//# 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,EAAE,MAAM,6BAA6B,CAAC;AAGtD,eAAO,MAAM,mBAAmB,2BAU/B,CAAC"}
|
package/dist/commands/create.js
CHANGED
|
@@ -1,66 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
import chalk from "chalk";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const cartesiProvider = async (input) => {
|
|
10
|
-
return {
|
|
11
|
-
name: "cartesi",
|
|
12
|
-
subdir: input,
|
|
13
|
-
url: "https://github.com/cartesi/application-templates",
|
|
14
|
-
tar: `https://codeload.github.com/cartesi/application-templates/tar.gz/refs/heads/${branch}`,
|
|
15
|
-
};
|
|
16
|
-
};
|
|
17
|
-
const input = `cartesi:${template}`;
|
|
18
|
-
return downloadTemplate(input, {
|
|
19
|
-
dir: out,
|
|
20
|
-
providers: { cartesi: cartesiProvider },
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
async run() {
|
|
24
|
-
const { args, flags } = await this.parse(CreateCommand);
|
|
25
|
-
const spinner = ora("Creating application...").start();
|
|
26
|
-
try {
|
|
27
|
-
const { dir } = await this.download(flags.template, flags.branch, args.name);
|
|
28
|
-
spinner.succeed(`Application created at ${chalk.cyan(dir)}`);
|
|
29
|
-
}
|
|
30
|
-
catch (e) {
|
|
31
|
-
spinner.fail(e instanceof Error
|
|
32
|
-
? `Error creating application: ${chalk.red(e.message)}`
|
|
33
|
-
: String(e));
|
|
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
|
-
}),
|
|
3
|
+
export const createCreateCommand = () => {
|
|
4
|
+
return new Command("create")
|
|
5
|
+
.summary("DEPRECATED: use 'rollups create' instead")
|
|
6
|
+
.action(async () => {
|
|
7
|
+
console.warn(chalk.yellow("create command is deprecated, use 'rollups create' instead"));
|
|
8
|
+
});
|
|
44
9
|
};
|
|
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"}
|
|
@@ -1,62 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
async buildRollupsImage(platform) {
|
|
10
|
-
const buildResult = tmpNameSync();
|
|
11
|
-
const imagePath = this.getContextPath("image");
|
|
12
|
-
const binPath = path.join(path.dirname(new URL(import.meta.url).pathname), "..", "..");
|
|
13
|
-
const dockerfile = path.join(binPath, "node", "DockerfileDeploy.txt");
|
|
14
|
-
const args = [
|
|
15
|
-
"buildx",
|
|
16
|
-
"build",
|
|
17
|
-
"-f",
|
|
18
|
-
dockerfile,
|
|
19
|
-
"--load",
|
|
20
|
-
"--iidfile",
|
|
21
|
-
buildResult,
|
|
22
|
-
imagePath,
|
|
23
|
-
];
|
|
24
|
-
// optional platform, default to not defining, which will build for the host platform
|
|
25
|
-
if (platform) {
|
|
26
|
-
args.push("--platform", platform);
|
|
27
|
-
}
|
|
28
|
-
await execa("docker", args, { stdio: "inherit" });
|
|
29
|
-
return fs.readFileSync(buildResult, "utf8");
|
|
30
|
-
}
|
|
31
|
-
async run() {
|
|
32
|
-
const { flags } = await this.parse(DeployBuild);
|
|
33
|
-
// print machine hash
|
|
34
|
-
const templateHash = this.getMachineHash();
|
|
35
|
-
if (!templateHash) {
|
|
36
|
-
this.error(`Cartesi machine snapshot not found, run '${this.config.bin} build'`);
|
|
37
|
-
}
|
|
38
|
-
this.logPrompt({
|
|
39
|
-
title: "Cartesi machine templateHash",
|
|
40
|
-
value: templateHash,
|
|
41
|
-
});
|
|
42
|
-
this.log("Building application node Docker image...");
|
|
43
|
-
const image = await this.buildRollupsImage(flags.platform);
|
|
44
|
-
this.logPrompt({
|
|
45
|
-
title: "Application node Docker image",
|
|
46
|
-
value: image,
|
|
47
|
-
});
|
|
48
|
-
return { image };
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
DeployBuild.summary = "Build deployment Docker image of application.";
|
|
52
|
-
DeployBuild.description = "Package the application in a Docker image ready to be deployed.";
|
|
53
|
-
DeployBuild.examples = ["<%= config.bin %> <%= command.id %>"];
|
|
54
|
-
DeployBuild.flags = {
|
|
55
|
-
platform: Flags.string({
|
|
56
|
-
options: ["linux/amd64", "linux/arm64"],
|
|
57
|
-
summary: "Docker image target platform",
|
|
58
|
-
description: "Select the target platform for the produced Docker image. It depends on the platform where the application node will be deployed.",
|
|
59
|
-
}),
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
export const createBuildCommand = () => {
|
|
4
|
+
return new Command("build")
|
|
5
|
+
.description("DEPRECATED: Package the application in a Docker image ready to be deployed.")
|
|
6
|
+
.action(async () => {
|
|
7
|
+
console.warn(chalk.yellow("deploy build command is deprecated"));
|
|
8
|
+
});
|
|
60
9
|
};
|
|
61
|
-
DeployBuild.enableJsonFlag = true;
|
|
62
|
-
export default DeployBuild;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,mBAAmB,2BAc/B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import chalk from "chalk";
|
|
3
|
+
import { createBuildCommand } from "./deploy/build.js";
|
|
4
|
+
export const createDeployCommand = () => {
|
|
5
|
+
const command = new Command("deploy")
|
|
6
|
+
.description("DEPRECATED: Package and deploy the application to a supported live network.")
|
|
7
|
+
.action(async () => {
|
|
8
|
+
console.warn(chalk.yellow("deploy command is deprecated, use 'rollups deploy' instead"));
|
|
9
|
+
});
|
|
10
|
+
command.addCommand(createBuildCommand(), { hidden: true });
|
|
11
|
+
return command;
|
|
12
|
+
};
|
|
@@ -1,13 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export
|
|
3
|
-
static description: string;
|
|
4
|
-
static examples: string[];
|
|
5
|
-
private static MINIMUM_DOCKER_VERSION;
|
|
6
|
-
private static MINIMUM_DOCKER_COMPOSE_VERSION;
|
|
7
|
-
private static MINIMUM_BUILDX_VERSION;
|
|
8
|
-
private checkDocker;
|
|
9
|
-
private checkCompose;
|
|
10
|
-
private checkBuildx;
|
|
11
|
-
run(): Promise<void>;
|
|
12
|
-
}
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createDoctorCommand: () => Command<[], {}, {}>;
|
|
13
3
|
//# sourceMappingURL=doctor.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AA4HtD,eAAO,MAAM,mBAAmB,2BAa/B,CAAC"}
|