@cartesi/cli 2.0.0-alpha.5 → 2.0.0-alpha.7
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 +10 -6
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +41 -15
- package/dist/builder/directory.d.ts.map +1 -1
- package/dist/builder/docker.d.ts.map +1 -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 +3 -1
- package/dist/commands/address-book.d.ts.map +1 -1
- package/dist/commands/address-book.js +3 -3
- package/dist/commands/build.d.ts +4 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/build.js +3 -3
- package/dist/commands/clean.d.ts +1 -1
- package/dist/commands/clean.d.ts.map +1 -1
- package/dist/commands/clean.js +3 -3
- package/dist/commands/create.d.ts +4 -1
- package/dist/commands/create.d.ts.map +1 -1
- package/dist/commands/create.js +3 -4
- package/dist/commands/deploy/build.d.ts +1 -1
- package/dist/commands/deploy/build.d.ts.map +1 -1
- package/dist/commands/deploy/build.js +7 -54
- package/dist/commands/deploy.d.ts +1 -1
- package/dist/commands/deploy.d.ts.map +1 -1
- package/dist/commands/deploy.js +9 -73
- package/dist/commands/doctor.d.ts +1 -1
- package/dist/commands/doctor.d.ts.map +1 -1
- package/dist/commands/doctor.js +23 -11
- package/dist/commands/hash.d.ts +3 -1
- package/dist/commands/hash.d.ts.map +1 -1
- package/dist/commands/hash.js +3 -3
- 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 +225 -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 +209 -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 +19 -0
- package/dist/commands/run.d.ts +1 -1
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +7 -155
- package/dist/commands/send/erc20.d.ts +10 -1
- package/dist/commands/send/erc20.d.ts.map +1 -1
- package/dist/commands/send/erc20.js +10 -8
- package/dist/commands/send/erc721.d.ts +10 -1
- package/dist/commands/send/erc721.d.ts.map +1 -1
- package/dist/commands/send/erc721.js +10 -8
- package/dist/commands/send/ether.d.ts +10 -1
- package/dist/commands/send/ether.d.ts.map +1 -1
- package/dist/commands/send/ether.js +10 -8
- package/dist/commands/send/generic.d.ts +11 -1
- package/dist/commands/send/generic.d.ts.map +1 -1
- package/dist/commands/send/generic.js +10 -9
- package/dist/commands/send.d.ts +4 -4
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +19 -19
- package/dist/commands/shell.d.ts +5 -1
- package/dist/commands/shell.d.ts.map +1 -1
- package/dist/commands/shell.js +3 -3
- package/dist/compose/rollups/default.env +35 -0
- package/dist/compose/rollups/docker-compose-anvil.yaml +15 -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 +94 -0
- package/dist/{node → compose/rollups}/docker-compose-explorer.yaml +18 -37
- package/dist/compose/rollups/docker-compose-graphql.yaml +49 -0
- package/dist/compose/rollups/docker-compose-node-cpus.yaml +7 -0
- package/dist/compose/rollups/docker-compose-node-memory.yaml +6 -0
- package/dist/compose/rollups/docker-compose-node.yaml +36 -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/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 +1 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +1 -1
- package/dist/contracts.d.ts.map +1 -1
- 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 +17 -0
- package/dist/exec/rollups.d.ts.map +1 -0
- package/dist/exec/rollups.js +40 -0
- package/dist/exec/util.d.ts +1 -1
- package/dist/exec/util.d.ts.map +1 -1
- package/dist/index.js +23 -21
- package/dist/machine.d.ts.map +1 -1
- package/dist/prompts.d.ts.map +1 -1
- package/dist/wallet.d.ts.map +1 -1
- package/dist/wallet.js +29 -6
- package/package.json +24 -22
- 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-espresso.yaml +0 -127
- 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/dist/base.d.ts
CHANGED
|
@@ -3,12 +3,16 @@ import { Config } from "./config.js";
|
|
|
3
3
|
export declare const getContextPath: (...paths: string[]) => string;
|
|
4
4
|
export declare const getMachineHash: () => Hash | undefined;
|
|
5
5
|
export declare const getApplicationConfig: (configPath: string) => Config;
|
|
6
|
-
export declare const getApplicationAddress: () => Promise<Address>;
|
|
7
6
|
export type AddressBook = Record<string, Address>;
|
|
8
7
|
export declare const getAddressBook: () => Promise<AddressBook>;
|
|
9
|
-
export declare const
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
}) =>
|
|
13
|
-
export declare const
|
|
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;
|
|
14
18
|
//# sourceMappingURL=base.d.ts.map
|
package/dist/base.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAc,IAAI,
|
|
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
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { InvalidArgumentError } from "@commander-js/extra-typings";
|
|
2
2
|
import { execa } from "execa";
|
|
3
3
|
import fs from "fs";
|
|
4
4
|
import path from "path";
|
|
5
|
-
import { getAddress, isHash } from "viem";
|
|
5
|
+
import { getAddress, isAddress, isHash, zeroHash } from "viem";
|
|
6
6
|
import { parse } from "./config.js";
|
|
7
7
|
import { applicationFactoryAddress, authorityFactoryAddress, erc1155BatchPortalAddress, erc1155SinglePortalAddress, erc20PortalAddress, erc721PortalAddress, etherPortalAddress, inputBoxAddress, selfHostedApplicationFactoryAddress, testMultiTokenAddress, testNftAddress, testTokenAddress, } from "./contracts.js";
|
|
8
|
+
import { getApplicationAddress } from "./exec/rollups.js";
|
|
8
9
|
export const getContextPath = (...paths) => {
|
|
9
10
|
return path.join(".cartesi", ...paths);
|
|
10
11
|
};
|
|
@@ -24,15 +25,10 @@ export const getApplicationConfig = (configPath) => {
|
|
|
24
25
|
? parse(fs.readFileSync(configPath).toString())
|
|
25
26
|
: parse("");
|
|
26
27
|
};
|
|
27
|
-
export const getApplicationAddress = async () => {
|
|
28
|
-
// fixed value, as we do deterministic deployment with a zero hash
|
|
29
|
-
return getAddress("0xab7528bb862fb57e8a2bcd567a2e929a0be56a5e");
|
|
30
|
-
};
|
|
31
28
|
export const getAddressBook = async () => {
|
|
32
29
|
const applicationAddress = await getApplicationAddress();
|
|
33
30
|
// build rollups contracts address book
|
|
34
31
|
const contracts = {
|
|
35
|
-
Application: applicationAddress,
|
|
36
32
|
ApplicationFactory: applicationFactoryAddress,
|
|
37
33
|
AuthorityFactory: authorityFactoryAddress,
|
|
38
34
|
EntryPointV06: "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789",
|
|
@@ -56,22 +52,52 @@ export const getAddressBook = async () => {
|
|
|
56
52
|
VerifyingPaymasterV06: "0x28ec0633192d0cBd9E1156CE05D5FdACAcB93947",
|
|
57
53
|
VerifyingPaymasterV07: "0xc5c97885C67F7361aBAfD2B95067a5bBdA603608",
|
|
58
54
|
};
|
|
55
|
+
if (applicationAddress) {
|
|
56
|
+
contracts.Application = applicationAddress;
|
|
57
|
+
}
|
|
59
58
|
return contracts;
|
|
60
59
|
};
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
};
|
|
64
|
-
export const getServiceState = async (projectName, serviceName) => {
|
|
60
|
+
const getServiceInfo = async (options) => {
|
|
61
|
+
const { environmentName, service } = options;
|
|
65
62
|
// get service information
|
|
66
63
|
const { stdout } = await execa("docker", [
|
|
67
64
|
"compose",
|
|
68
65
|
"--project-name",
|
|
69
|
-
|
|
66
|
+
environmentName,
|
|
70
67
|
"ps",
|
|
71
|
-
|
|
68
|
+
service,
|
|
72
69
|
"--format",
|
|
73
70
|
"json",
|
|
74
71
|
]);
|
|
75
|
-
|
|
76
|
-
|
|
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
|
+
}
|
|
77
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;AA+DF,eAAO,MAAM,KAAK,
|
|
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"}
|
|
@@ -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,3 +1,5 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const createAddressBookCommand: () => Command<[], {
|
|
3
|
+
json?: true | undefined;
|
|
4
|
+
}, {}>;
|
|
3
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":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,
|
|
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,8 +1,8 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import Table from "cli-table3";
|
|
2
3
|
import { getAddressBook } from "../base.js";
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
.command("address-book")
|
|
4
|
+
export const createAddressBookCommand = () => {
|
|
5
|
+
return new Command("address-book")
|
|
6
6
|
.description("Prints the addresses of all smart contracts deployed to the runtime environment of the application.")
|
|
7
7
|
.option("--json", "Format output as json.")
|
|
8
8
|
.action(async ({ json }) => {
|
package/dist/commands/build.d.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const createBuildCommand: () => Command<[], {
|
|
3
|
+
config: string;
|
|
4
|
+
drivesOnly?: true | undefined;
|
|
5
|
+
}, {}>;
|
|
3
6
|
//# sourceMappingURL=build.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,3 +1,4 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import fs from "fs-extra";
|
|
2
3
|
import path from "path";
|
|
3
4
|
import tmp from "tmp";
|
|
@@ -23,9 +24,8 @@ const buildDrive = async (name, drive, sdkImage, destination) => {
|
|
|
23
24
|
}
|
|
24
25
|
}
|
|
25
26
|
};
|
|
26
|
-
export const
|
|
27
|
-
|
|
28
|
-
.command("build")
|
|
27
|
+
export const createBuildCommand = () => {
|
|
28
|
+
return new Command("build")
|
|
29
29
|
.description("Build application by building Cartesi machine drives, configuring a machine and booting it.")
|
|
30
30
|
.option("-c, --config <config>", "path to the configuration file", "cartesi.toml")
|
|
31
31
|
.option("-d, --drives-only", "only build drives, do not boot machine")
|
package/dist/commands/clean.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
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,
|
|
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,8 +1,8 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import fs from "fs-extra";
|
|
2
3
|
import { getContextPath } from "../base.js";
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
.command("clean")
|
|
4
|
+
export const createCleanCommand = () => {
|
|
5
|
+
return new Command("clean")
|
|
6
6
|
.description("Deletes all cached build artifacts of application.")
|
|
7
7
|
.action(async () => {
|
|
8
8
|
await fs.emptyDir(getContextPath());
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
export declare const DEFAULT_TEMPLATES_BRANCH = "sdk-0.9";
|
|
3
|
-
export declare const
|
|
3
|
+
export declare const createCreateCommand: () => Command<[string], {
|
|
4
|
+
template: "cpp" | "cpp-low-level" | "go" | "javascript" | "lua" | "python" | "ruby" | "rust" | "typescript";
|
|
5
|
+
branch: string;
|
|
6
|
+
}, {}>;
|
|
4
7
|
//# sourceMappingURL=create.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAM9D,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAmClD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../src/commands/create.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AAM9D,eAAO,MAAM,wBAAwB,YAAY,CAAC;AAmClD,eAAO,MAAM,mBAAmB;;;MA0B/B,CAAC"}
|
package/dist/commands/create.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Option } from "@commander-js/extra-typings";
|
|
1
|
+
import { Command, Option } from "@commander-js/extra-typings";
|
|
2
2
|
import chalk from "chalk";
|
|
3
3
|
import { downloadTemplate } from "giget";
|
|
4
4
|
import ora from "ora";
|
|
@@ -29,9 +29,8 @@ const download = async (template, branch, out) => {
|
|
|
29
29
|
providers: { cartesi: cartesiProvider },
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
|
-
export const
|
|
33
|
-
|
|
34
|
-
.command("create")
|
|
32
|
+
export const createCreateCommand = () => {
|
|
33
|
+
return new Command("create")
|
|
35
34
|
.argument("<name>", "application and directory name")
|
|
36
35
|
.addOption(new Option("-t, --template <template>", "template name to use")
|
|
37
36
|
.choices(TEMPLATES)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../../src/commands/deploy/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
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,56 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
const buildResult = tmpNameSync();
|
|
9
|
-
const imagePath = getContextPath("image");
|
|
10
|
-
const binPath = path.join(path.dirname(new URL(import.meta.url).pathname), "..", "..");
|
|
11
|
-
const dockerfile = path.join(binPath, "node", "DockerfileDeploy.txt");
|
|
12
|
-
const args = [
|
|
13
|
-
"buildx",
|
|
14
|
-
"build",
|
|
15
|
-
"-f",
|
|
16
|
-
dockerfile,
|
|
17
|
-
"--load",
|
|
18
|
-
"--iidfile",
|
|
19
|
-
buildResult,
|
|
20
|
-
imagePath,
|
|
21
|
-
];
|
|
22
|
-
// optional platform, default to not defining, which will build for the host platform
|
|
23
|
-
if (platform) {
|
|
24
|
-
args.push("--platform", platform);
|
|
25
|
-
}
|
|
26
|
-
await execa("docker", args, { stdio: "inherit" });
|
|
27
|
-
return fs.readFileSync(buildResult, "utf8");
|
|
28
|
-
};
|
|
29
|
-
export const registerBuildCommand = (program) => {
|
|
30
|
-
program
|
|
31
|
-
.command("build")
|
|
32
|
-
.description("Package the application in a Docker image ready to be deployed.")
|
|
33
|
-
.addOption(new Option("--platform <platform>", "Docker image target platform").choices(["linux/amd64", "linux/arm64"]))
|
|
34
|
-
.option("--json", "Format output as json.")
|
|
35
|
-
.action(async ({ platform, json }, command) => {
|
|
36
|
-
// print machine hash
|
|
37
|
-
const templateHash = getMachineHash();
|
|
38
|
-
if (!templateHash) {
|
|
39
|
-
command.error(`Cartesi machine snapshot not found, run 'build'`);
|
|
40
|
-
return;
|
|
41
|
-
}
|
|
42
|
-
logPrompt({
|
|
43
|
-
title: "Cartesi machine templateHash",
|
|
44
|
-
value: templateHash,
|
|
45
|
-
});
|
|
46
|
-
console.log("Building application node Docker image...");
|
|
47
|
-
const image = await buildRollupsImage(platform);
|
|
48
|
-
logPrompt({
|
|
49
|
-
title: "Application node Docker image",
|
|
50
|
-
value: image,
|
|
51
|
-
});
|
|
52
|
-
if (json) {
|
|
53
|
-
process.stdout.write(JSON.stringify({ image }));
|
|
54
|
-
}
|
|
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"));
|
|
55
8
|
});
|
|
56
9
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../src/commands/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,
|
|
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"}
|
package/dist/commands/deploy.js
CHANGED
|
@@ -1,76 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import confirm from "@inquirer/confirm";
|
|
3
|
-
import select from "@inquirer/select";
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
4
2
|
import chalk from "chalk";
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
.
|
|
11
|
-
.description("Package and deploy the application to a supported live network.")
|
|
12
|
-
.addOption(new Option("--hosting <hosting>", "hosting type").choices([
|
|
13
|
-
"self-hosted",
|
|
14
|
-
"third-party",
|
|
15
|
-
]))
|
|
16
|
-
.addOption(new Option("--webapp <webapp>", "webapp address").makeOptionMandatory())
|
|
17
|
-
.action(async (options, command) => {
|
|
18
|
-
// print machine hash
|
|
19
|
-
const templateHash = getMachineHash();
|
|
20
|
-
if (!templateHash) {
|
|
21
|
-
command.error(`Cartesi machine snapshot not found, run 'build'`);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
logPrompt({
|
|
25
|
-
title: "Cartesi machine templateHash",
|
|
26
|
-
value: templateHash,
|
|
27
|
-
});
|
|
28
|
-
// ask for deployment type
|
|
29
|
-
const hosting = options.hosting ||
|
|
30
|
-
(await select({
|
|
31
|
-
message: "Select hosting type",
|
|
32
|
-
choices: [
|
|
33
|
-
{
|
|
34
|
-
name: "Self-hosting",
|
|
35
|
-
description: `Select this option if you want to run the node for your application.
|
|
36
|
-
You will need the following infrastructure:
|
|
37
|
-
|
|
38
|
-
- a cloud server for the application node
|
|
39
|
-
- a postgres database
|
|
40
|
-
- a web3 node provider
|
|
41
|
-
- a funded wallet
|
|
42
|
-
`,
|
|
43
|
-
value: "self-hosted",
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "Use third-party provider",
|
|
47
|
-
description: "Select this option to use a third-party service provider to run a node for your application.",
|
|
48
|
-
value: "third-party",
|
|
49
|
-
disabled: "(coming soon)",
|
|
50
|
-
},
|
|
51
|
-
],
|
|
52
|
-
}));
|
|
53
|
-
let queryString = "";
|
|
54
|
-
switch (hosting) {
|
|
55
|
-
case "self-hosted": {
|
|
56
|
-
// build docker image
|
|
57
|
-
// Execute the build subcommand
|
|
58
|
-
program.commands
|
|
59
|
-
.find((cmd) => cmd.name() === "build")
|
|
60
|
-
?.parseAsync(program.args);
|
|
61
|
-
queryString = `?templateHash=${templateHash}`;
|
|
62
|
-
break;
|
|
63
|
-
}
|
|
64
|
-
case "third-party": {
|
|
65
|
-
command.error("Third-party provider deployment not supported yet");
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
// prompt user to open webapp for onchain deployment
|
|
69
|
-
const deployUrl = `${options.webapp}${queryString}`;
|
|
70
|
-
if (await confirm({ message: `Open ${chalk.cyan(deployUrl)}?` })) {
|
|
71
|
-
open(deployUrl, { app: { name: apps.chrome } });
|
|
72
|
-
}
|
|
73
|
-
return;
|
|
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"));
|
|
74
9
|
});
|
|
75
|
-
|
|
10
|
+
command.addCommand(createBuildCommand(), { hidden: true });
|
|
11
|
+
return command;
|
|
76
12
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"doctor.d.ts","sourceRoot":"","sources":["../../src/commands/doctor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
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"}
|
package/dist/commands/doctor.js
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import chalk from "chalk";
|
|
1
3
|
import { execa } from "execa";
|
|
4
|
+
import ora from "ora";
|
|
2
5
|
import semver from "semver";
|
|
3
6
|
const MINIMUM_DOCKER_VERSION = "23.0.0"; // Replace with our minimum required Docker version
|
|
4
7
|
const MINIMUM_DOCKER_COMPOSE_VERSION = "2.21.0"; // Replace with our minimum required Docker Compose version
|
|
5
8
|
const MINIMUM_BUILDX_VERSION = "0.13.0"; // Replace with our minimum required Buildx version
|
|
6
|
-
const checkDocker = async () => {
|
|
9
|
+
const checkDocker = async (progress) => {
|
|
7
10
|
try {
|
|
11
|
+
progress.start("Checking Docker Engine version...");
|
|
8
12
|
const { stdout: dockerVersion } = await execa("docker", [
|
|
9
13
|
"version",
|
|
10
14
|
"--format",
|
|
@@ -14,6 +18,7 @@ const checkDocker = async () => {
|
|
|
14
18
|
if (v !== null && !semver.gte(v, MINIMUM_DOCKER_VERSION)) {
|
|
15
19
|
throw new Error(`Unsupported Docker version. Minimum required version is ${MINIMUM_DOCKER_VERSION}. Installed version is ${v}.`);
|
|
16
20
|
}
|
|
21
|
+
progress.succeed(`Docker Engine ${chalk.cyan(v)}`);
|
|
17
22
|
}
|
|
18
23
|
catch (e) {
|
|
19
24
|
if (e instanceof Error &&
|
|
@@ -26,8 +31,9 @@ const checkDocker = async () => {
|
|
|
26
31
|
}
|
|
27
32
|
return true;
|
|
28
33
|
};
|
|
29
|
-
const checkCompose = async () => {
|
|
34
|
+
const checkCompose = async (progress) => {
|
|
30
35
|
try {
|
|
36
|
+
progress.start("Checking Docker Compose version...");
|
|
31
37
|
const { stdout: dockerComposeVersion } = await execa("docker", [
|
|
32
38
|
"compose",
|
|
33
39
|
"version",
|
|
@@ -37,6 +43,7 @@ const checkCompose = async () => {
|
|
|
37
43
|
if (v !== null && !semver.gte(v, MINIMUM_DOCKER_COMPOSE_VERSION)) {
|
|
38
44
|
throw new Error(`Unsupported Docker Compose version. Minimum required version is ${MINIMUM_DOCKER_COMPOSE_VERSION}. Installed version is ${v}.`);
|
|
39
45
|
}
|
|
46
|
+
progress.succeed(`Docker Compose ${chalk.cyan(dockerComposeVersion)}`);
|
|
40
47
|
}
|
|
41
48
|
catch (e) {
|
|
42
49
|
if (e instanceof Error &&
|
|
@@ -49,8 +56,9 @@ const checkCompose = async () => {
|
|
|
49
56
|
}
|
|
50
57
|
return true;
|
|
51
58
|
};
|
|
52
|
-
const checkBuildx = async () => {
|
|
59
|
+
const checkBuildx = async (progress) => {
|
|
53
60
|
try {
|
|
61
|
+
progress.start("Checking Docker Buildx version...");
|
|
54
62
|
const { stdout: buildxOutput } = await execa("docker", [
|
|
55
63
|
"buildx",
|
|
56
64
|
"version",
|
|
@@ -59,6 +67,8 @@ const checkBuildx = async () => {
|
|
|
59
67
|
if (v !== null && !semver.gte(v, MINIMUM_BUILDX_VERSION)) {
|
|
60
68
|
throw new Error(`Unsupported Docker Buildx version. Minimum required version is ${MINIMUM_BUILDX_VERSION}. Installed version is ${v}.`);
|
|
61
69
|
}
|
|
70
|
+
progress.succeed(`Docker Buildx ${chalk.cyan(v)}`);
|
|
71
|
+
progress.start("Checking Docker RISC-V support...");
|
|
62
72
|
const { stdout: platformsOutput } = await execa("docker", [
|
|
63
73
|
"buildx",
|
|
64
74
|
"ls",
|
|
@@ -71,6 +81,7 @@ const checkBuildx = async () => {
|
|
|
71
81
|
if (!buildxPlatforms.includes("linux/riscv64")) {
|
|
72
82
|
throw new Error("Your system does not support riscv64 architecture. Run `docker run --privileged --rm tonistiigi/binfmt:riscv` to enable riscv64 support.");
|
|
73
83
|
}
|
|
84
|
+
progress.succeed(`Docker RISC-V support ${chalk.cyan("linux/riscv64")}`);
|
|
74
85
|
}
|
|
75
86
|
catch (e) {
|
|
76
87
|
if (e instanceof Error &&
|
|
@@ -83,17 +94,18 @@ const checkBuildx = async () => {
|
|
|
83
94
|
}
|
|
84
95
|
return true;
|
|
85
96
|
};
|
|
86
|
-
export const
|
|
87
|
-
|
|
97
|
+
export const createDoctorCommand = () => {
|
|
98
|
+
return new Command("doctor").action(async () => {
|
|
99
|
+
const progress = ora();
|
|
88
100
|
try {
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
101
|
+
await checkDocker(progress);
|
|
102
|
+
await checkCompose(progress);
|
|
103
|
+
await checkBuildx(progress);
|
|
104
|
+
progress.succeed("Your system is ready.");
|
|
93
105
|
}
|
|
94
106
|
catch (e) {
|
|
95
|
-
|
|
107
|
+
progress.fail(e.message);
|
|
108
|
+
process.exit(1);
|
|
96
109
|
}
|
|
97
|
-
console.log("Your system is ready.");
|
|
98
110
|
});
|
|
99
111
|
};
|
package/dist/commands/hash.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/commands/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"hash.d.ts","sourceRoot":"","sources":["../../src/commands/hash.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,iBAAiB;;MAsB7B,CAAC"}
|
package/dist/commands/hash.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
1
2
|
import chalk from "chalk";
|
|
2
3
|
import { getMachineHash } from "../base.js";
|
|
3
|
-
export const
|
|
4
|
-
|
|
5
|
-
.command("hash")
|
|
4
|
+
export const createHashCommand = () => {
|
|
5
|
+
return new Command("hash")
|
|
6
6
|
.description("Converts the binary generated by the build command to hexadecimal and prints out the result to console.")
|
|
7
7
|
.option("--json", "Format output as json.")
|
|
8
8
|
.action(async ({ json }, command) => {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createDeployCommand: () => Command<[], {
|
|
3
|
+
chainId: number;
|
|
4
|
+
rpcUrl?: string | undefined;
|
|
5
|
+
mnemonic?: string | undefined;
|
|
6
|
+
mnemonicIndex: number;
|
|
7
|
+
name?: string | undefined;
|
|
8
|
+
authorityOwner?: `0x${string}` | undefined;
|
|
9
|
+
applicationOwner?: `0x${string}` | undefined;
|
|
10
|
+
epochLength: number;
|
|
11
|
+
salt: `0x${string}`;
|
|
12
|
+
json?: true | undefined;
|
|
13
|
+
}, {
|
|
14
|
+
environmentName: string;
|
|
15
|
+
}>;
|
|
16
|
+
//# sourceMappingURL=deploy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy.d.ts","sourceRoot":"","sources":["../../../src/commands/rollups/deploy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAU,MAAM,6BAA6B,CAAC;AA8N9D,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;EAqG/B,CAAC"}
|