@cartesi/cli 2.0.0-alpha.16 → 2.0.0-alpha.18
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 +5 -0
- package/dist/base.d.ts.map +1 -1
- package/dist/base.js +1 -1
- package/dist/commands/deposit/erc1155.d.ts +18 -0
- package/dist/commands/deposit/erc1155.d.ts.map +1 -0
- package/dist/commands/deposit/erc1155.js +254 -0
- package/dist/commands/deposit.d.ts.map +1 -1
- package/dist/commands/deposit.js +3 -2
- package/dist/commands/logs.d.ts +0 -1
- package/dist/commands/logs.d.ts.map +1 -1
- package/dist/commands/logs.js +10 -13
- package/dist/compose/docker-compose-explorer.yaml +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +1 -1
- package/dist/exec/rollups.d.ts.map +1 -1
- package/dist/exec/rollups.js +1 -1
- package/dist/machine.d.ts.map +1 -1
- package/dist/machine.js +4 -1
- package/dist/wallet.d.ts +1078 -7804
- package/dist/wallet.d.ts.map +1 -1
- package/package.json +24 -25
package/dist/base.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type Address, type Hash } from "viem";
|
|
2
2
|
import { type Config } from "./config.js";
|
|
3
|
+
import type { PsResponse } from "./types/docker.js";
|
|
3
4
|
export declare const getContextPath: (...paths: string[]) => string;
|
|
4
5
|
export declare const getMachineHash: () => Hash | undefined;
|
|
5
6
|
export declare const getApplicationConfig: (configPaths: string[]) => Config;
|
|
@@ -10,6 +11,10 @@ export type AddressBook = Record<string, Address>;
|
|
|
10
11
|
export declare const getAddressBook: (options: {
|
|
11
12
|
projectName?: string;
|
|
12
13
|
}) => Promise<AddressBook>;
|
|
14
|
+
export declare const getServiceInfo: (options: {
|
|
15
|
+
projectName: string;
|
|
16
|
+
service: string;
|
|
17
|
+
}) => Promise<PsResponse | undefined>;
|
|
13
18
|
export declare const getServiceState: (options: {
|
|
14
19
|
projectName: string;
|
|
15
20
|
service: string;
|
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,EACH,KAAK,OAAO,
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAIA,OAAO,EACH,KAAK,OAAO,EAEZ,KAAK,IAAI,EAIZ,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,KAAK,MAAM,EAAS,MAAM,aAAa,CAAC;AAgBjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,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,aAAa,MAAM,EAAE,KAAG,MAW5D,CAAC;AAEF,eAAO,MAAM,cAAc,GAAI,SAAS;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,WAE/D,CAAC;AAEF,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;AAElD,eAAO,MAAM,cAAc,GAAU,SAAS;IAC1C,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,KAAG,OAAO,CAAC,WAAW,CAkCtB,CAAC;AAEF,eAAO,MAAM,cAAc,GAAU,SAAS;IAC1C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,KAAG,OAAO,CAAC,UAAU,GAAG,SAAS,CAcjC,CAAC;AAEF,eAAO,MAAM,eAAe,GAAU,SAAS;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACnB,KAAG,OAAO,CAAC,MAAM,GAAG,SAAS,CAG7B,CAAC;AAEF,eAAO,MAAM,gBAAgB,GAAU,SAAS;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,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
CHANGED
|
@@ -67,7 +67,7 @@ export const getAddressBook = async (options) => {
|
|
|
67
67
|
}
|
|
68
68
|
return contracts;
|
|
69
69
|
};
|
|
70
|
-
const getServiceInfo = async (options) => {
|
|
70
|
+
export const getServiceInfo = async (options) => {
|
|
71
71
|
const { projectName, service } = options;
|
|
72
72
|
// get service information
|
|
73
73
|
const { stdout } = await execa("docker", [
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
export declare const createErc1155SingleCommand: () => Command<[string | undefined, string | undefined], {
|
|
3
|
+
[x: string]: never;
|
|
4
|
+
}, {
|
|
5
|
+
from?: string | undefined;
|
|
6
|
+
application?: string | undefined;
|
|
7
|
+
projectName?: string | undefined;
|
|
8
|
+
rpcUrl?: string | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
export declare const createErc1155BatchCommand: () => Command<[string | undefined, string | undefined], {
|
|
11
|
+
[x: string]: never;
|
|
12
|
+
}, {
|
|
13
|
+
from?: string | undefined;
|
|
14
|
+
application?: string | undefined;
|
|
15
|
+
projectName?: string | undefined;
|
|
16
|
+
rpcUrl?: string | undefined;
|
|
17
|
+
}>;
|
|
18
|
+
//# sourceMappingURL=erc1155.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc1155.d.ts","sourceRoot":"","sources":["../../../src/commands/deposit/erc1155.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAyCtD,eAAO,MAAM,0BAA0B;;;;;;;EAmItC,CAAC;AAEF,eAAO,MAAM,yBAAyB;;;;;;;EAwKrC,CAAC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { Command } from "@commander-js/extra-typings";
|
|
2
|
+
import input from "@inquirer/input";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import ora from "ora";
|
|
5
|
+
import { getAddress, isAddress, isHex } from "viem";
|
|
6
|
+
import { getProjectName } from "../../base.js";
|
|
7
|
+
import { erc1155BatchPortalAbi, erc1155BatchPortalAddress, erc1155SinglePortalAbi, erc1155SinglePortalAddress, testMultiTokenAbi, testMultiTokenAddress, } from "../../contracts.js";
|
|
8
|
+
import { addressInput, bigintInput, getInputApplicationAddress, } from "../../prompts.js";
|
|
9
|
+
import { connect } from "../../wallet.js";
|
|
10
|
+
const parseToken = async (options) => {
|
|
11
|
+
const address = options.token && isAddress(options.token)
|
|
12
|
+
? getAddress(options.token)
|
|
13
|
+
: await addressInput({
|
|
14
|
+
message: "Token address",
|
|
15
|
+
default: testMultiTokenAddress,
|
|
16
|
+
});
|
|
17
|
+
return { address, name: "TestMultiToken" };
|
|
18
|
+
};
|
|
19
|
+
export const createErc1155SingleCommand = () => {
|
|
20
|
+
return new Command("erc1155-single")
|
|
21
|
+
.description("Deposits an ERC1155 token to the application")
|
|
22
|
+
.configureHelp({ showGlobalOptions: true })
|
|
23
|
+
.argument("[token-id]", "token ID")
|
|
24
|
+
.argument("[amount]", "amount to send")
|
|
25
|
+
.option("--token <address>", "ERC1155 token address")
|
|
26
|
+
.option("--base-layer-data <hex>", "base layer data", "0x")
|
|
27
|
+
.option("--exec-layer-data <hex>", "exec layer data", "0x")
|
|
28
|
+
.action(async (tokenIdString, amountString, options, command) => {
|
|
29
|
+
const { from } = command.optsWithGlobals();
|
|
30
|
+
// connect to anvil
|
|
31
|
+
const testClient = await connect(command.optsWithGlobals());
|
|
32
|
+
const token = await parseToken({
|
|
33
|
+
token: options.token,
|
|
34
|
+
});
|
|
35
|
+
const tokenId = tokenIdString
|
|
36
|
+
? BigInt(tokenIdString)
|
|
37
|
+
: await bigintInput({ decimals: 0, message: "Token ID" });
|
|
38
|
+
const projectName = getProjectName(command.optsWithGlobals());
|
|
39
|
+
// get dapp address from local node, or ask
|
|
40
|
+
const application = await getInputApplicationAddress({
|
|
41
|
+
...command.optsWithGlobals(),
|
|
42
|
+
projectName,
|
|
43
|
+
});
|
|
44
|
+
// the input sender, impersonated
|
|
45
|
+
const account = from && isAddress(from)
|
|
46
|
+
? getAddress(from)
|
|
47
|
+
: (await testClient.getAddresses())[0];
|
|
48
|
+
const amount = amountString
|
|
49
|
+
? BigInt(amountString)
|
|
50
|
+
: await bigintInput({
|
|
51
|
+
message: `Amount of token ID ${tokenId}`,
|
|
52
|
+
decimals: 0,
|
|
53
|
+
});
|
|
54
|
+
// ensure amount is positive
|
|
55
|
+
if (amount <= BigInt(0)) {
|
|
56
|
+
console.error(chalk.red("Amount of tokens to be deposited, must be greater than zero."));
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const tokenAbi = testMultiTokenAbi;
|
|
60
|
+
const baseLayerData = isHex(options.baseLayerData)
|
|
61
|
+
? options.baseLayerData
|
|
62
|
+
: "0x";
|
|
63
|
+
const execLayerData = isHex(options.execLayerData)
|
|
64
|
+
? options.execLayerData
|
|
65
|
+
: "0x";
|
|
66
|
+
// progress spinner
|
|
67
|
+
const progress = ora();
|
|
68
|
+
// check balance
|
|
69
|
+
const balance = await testClient.readContract({
|
|
70
|
+
abi: tokenAbi,
|
|
71
|
+
address: token.address,
|
|
72
|
+
functionName: "balanceOf",
|
|
73
|
+
args: [account, tokenId],
|
|
74
|
+
});
|
|
75
|
+
if (balance < amount) {
|
|
76
|
+
progress.fail("Insufficient balance");
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
// check if sufficiently approved
|
|
80
|
+
const isApproved = await testClient.readContract({
|
|
81
|
+
abi: tokenAbi,
|
|
82
|
+
address: token.address,
|
|
83
|
+
functionName: "isApprovedForAll",
|
|
84
|
+
args: [account, erc1155SinglePortalAddress],
|
|
85
|
+
});
|
|
86
|
+
// approve if needed
|
|
87
|
+
if (isApproved === false) {
|
|
88
|
+
progress.start(`Approving ERC1155Portal...`);
|
|
89
|
+
const { request } = await testClient.simulateContract({
|
|
90
|
+
abi: tokenAbi,
|
|
91
|
+
account,
|
|
92
|
+
address: token.address,
|
|
93
|
+
functionName: "setApprovalForAll",
|
|
94
|
+
args: [erc1155SinglePortalAddress, true],
|
|
95
|
+
});
|
|
96
|
+
const hash = await testClient.writeContract(request);
|
|
97
|
+
await testClient.waitForTransactionReceipt({ hash });
|
|
98
|
+
progress.succeed(`Approved ERC1155Portal`);
|
|
99
|
+
}
|
|
100
|
+
// simulate deposit call
|
|
101
|
+
const { request } = await testClient.simulateContract({
|
|
102
|
+
abi: erc1155SinglePortalAbi,
|
|
103
|
+
account,
|
|
104
|
+
address: erc1155SinglePortalAddress,
|
|
105
|
+
functionName: "depositSingleERC1155Token",
|
|
106
|
+
args: [
|
|
107
|
+
token.address,
|
|
108
|
+
application,
|
|
109
|
+
tokenId,
|
|
110
|
+
amount,
|
|
111
|
+
baseLayerData,
|
|
112
|
+
execLayerData,
|
|
113
|
+
],
|
|
114
|
+
});
|
|
115
|
+
// for messages
|
|
116
|
+
const amountLabel = `${chalk.cyan(amount)} units of token id ${tokenId}`;
|
|
117
|
+
// send deposit
|
|
118
|
+
progress.start(`Depositing ${amountLabel} to ${chalk.cyan(application)}...`);
|
|
119
|
+
const hash = await testClient.writeContract(request);
|
|
120
|
+
await testClient.waitForTransactionReceipt({ hash });
|
|
121
|
+
progress.succeed(`Deposited ${amountLabel} to ${chalk.cyan(application)}`);
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
export const createErc1155BatchCommand = () => {
|
|
125
|
+
return new Command("erc1155-batch")
|
|
126
|
+
.description("Deposits multiple ERC1155 tokens to the application")
|
|
127
|
+
.configureHelp({ showGlobalOptions: true })
|
|
128
|
+
.argument("[token-ids]", "token IDs separated by comma")
|
|
129
|
+
.argument("[amounts]", "amounts separated by comma")
|
|
130
|
+
.option("--token <address>", "ERC1155 token address")
|
|
131
|
+
.option("--base-layer-data <hex>", "base layer data", "0x")
|
|
132
|
+
.option("--exec-layer-data <hex>", "exec layer data", "0x")
|
|
133
|
+
.action(async (tokenIdsString, amountsString, options, command) => {
|
|
134
|
+
const { from } = command.optsWithGlobals();
|
|
135
|
+
// connect to anvil
|
|
136
|
+
const testClient = await connect(command.optsWithGlobals());
|
|
137
|
+
const token = await parseToken({
|
|
138
|
+
token: options.token,
|
|
139
|
+
});
|
|
140
|
+
// Parse token IDs
|
|
141
|
+
let tokenIds;
|
|
142
|
+
if (tokenIdsString) {
|
|
143
|
+
tokenIds = tokenIdsString
|
|
144
|
+
.split(",")
|
|
145
|
+
.map((id) => BigInt(id.trim()));
|
|
146
|
+
}
|
|
147
|
+
else {
|
|
148
|
+
// Prompt for token IDs if not provided
|
|
149
|
+
const user_input = await input({
|
|
150
|
+
message: "Token IDs (comma separated)",
|
|
151
|
+
});
|
|
152
|
+
tokenIds = user_input.split(",").map((id) => BigInt(id.trim()));
|
|
153
|
+
}
|
|
154
|
+
// Parse amounts
|
|
155
|
+
let amounts;
|
|
156
|
+
if (amountsString) {
|
|
157
|
+
amounts = amountsString.split(",").map((a) => BigInt(a.trim()));
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
// Prompt for amounts if not provided
|
|
161
|
+
const user_input = await input({
|
|
162
|
+
message: "Amounts (comma separated)",
|
|
163
|
+
});
|
|
164
|
+
amounts = user_input.split(",").map((a) => BigInt(a.trim()));
|
|
165
|
+
}
|
|
166
|
+
if (tokenIds.length !== amounts.length) {
|
|
167
|
+
console.error(chalk.red("Token IDs and amounts must have the same length."));
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
for (let i = 0; i < amounts.length; i++) {
|
|
171
|
+
if (amounts[i] <= BigInt(0)) {
|
|
172
|
+
console.error(chalk.red(`Amount of token Id: ${tokenIds[i]} to be deposited, must be greater than zero.`));
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const projectName = getProjectName(command.optsWithGlobals());
|
|
177
|
+
// get dapp address from local node, or ask
|
|
178
|
+
const application = await getInputApplicationAddress({
|
|
179
|
+
...command.optsWithGlobals(),
|
|
180
|
+
projectName,
|
|
181
|
+
});
|
|
182
|
+
// the input sender, impersonated
|
|
183
|
+
const account = from && isAddress(from)
|
|
184
|
+
? getAddress(from)
|
|
185
|
+
: (await testClient.getAddresses())[0];
|
|
186
|
+
const tokenAbi = testMultiTokenAbi;
|
|
187
|
+
const baseLayerData = isHex(options.baseLayerData)
|
|
188
|
+
? options.baseLayerData
|
|
189
|
+
: "0x";
|
|
190
|
+
const execLayerData = isHex(options.execLayerData)
|
|
191
|
+
? options.execLayerData
|
|
192
|
+
: "0x";
|
|
193
|
+
// progress spinner
|
|
194
|
+
const progress = ora();
|
|
195
|
+
// check balances
|
|
196
|
+
for (let i = 0; i < tokenIds.length; i++) {
|
|
197
|
+
const balance = await testClient.readContract({
|
|
198
|
+
abi: tokenAbi,
|
|
199
|
+
address: token.address,
|
|
200
|
+
functionName: "balanceOf",
|
|
201
|
+
args: [account, tokenIds[i]],
|
|
202
|
+
});
|
|
203
|
+
if (balance < amounts[i]) {
|
|
204
|
+
progress.fail(`Insufficient balance for token ID ${tokenIds[i]}`);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
// check if sufficiently approved
|
|
209
|
+
const isApproved = await testClient.readContract({
|
|
210
|
+
abi: tokenAbi,
|
|
211
|
+
address: token.address,
|
|
212
|
+
functionName: "isApprovedForAll",
|
|
213
|
+
args: [account, erc1155BatchPortalAddress],
|
|
214
|
+
});
|
|
215
|
+
// approve if needed
|
|
216
|
+
if (isApproved === false) {
|
|
217
|
+
progress.start(`Approving ERC1155Portal...`);
|
|
218
|
+
const { request } = await testClient.simulateContract({
|
|
219
|
+
abi: tokenAbi,
|
|
220
|
+
account,
|
|
221
|
+
address: token.address,
|
|
222
|
+
functionName: "setApprovalForAll",
|
|
223
|
+
args: [erc1155BatchPortalAddress, true],
|
|
224
|
+
});
|
|
225
|
+
const hash = await testClient.writeContract(request);
|
|
226
|
+
await testClient.waitForTransactionReceipt({ hash });
|
|
227
|
+
progress.succeed(`Approved ERC1155Portal`);
|
|
228
|
+
}
|
|
229
|
+
// simulate batch deposit call
|
|
230
|
+
const { request } = await testClient.simulateContract({
|
|
231
|
+
abi: erc1155BatchPortalAbi,
|
|
232
|
+
account,
|
|
233
|
+
address: erc1155BatchPortalAddress,
|
|
234
|
+
functionName: "depositBatchERC1155Token",
|
|
235
|
+
args: [
|
|
236
|
+
token.address,
|
|
237
|
+
application,
|
|
238
|
+
tokenIds,
|
|
239
|
+
amounts,
|
|
240
|
+
baseLayerData,
|
|
241
|
+
execLayerData,
|
|
242
|
+
],
|
|
243
|
+
});
|
|
244
|
+
// for messages
|
|
245
|
+
const amountLabel = tokenIds
|
|
246
|
+
.map((id, i) => `${chalk.cyan(amounts[i])} units of token id ${id}`)
|
|
247
|
+
.join(", ");
|
|
248
|
+
// send deposit
|
|
249
|
+
progress.start(`Depositing tokens to ${chalk.cyan(application)}...`);
|
|
250
|
+
const hash = await testClient.writeContract(request);
|
|
251
|
+
await testClient.waitForTransactionReceipt({ hash });
|
|
252
|
+
progress.succeed(`Deposited ${amountLabel} to ${chalk.cyan(application)}`);
|
|
253
|
+
});
|
|
254
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../src/commands/deposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"deposit.d.ts","sourceRoot":"","sources":["../../src/commands/deposit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAUtD,eAAO,MAAM,oBAAoB;;;;;MAsChC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,UAAU,CACvC,UAAU,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAClD,CAAC"}
|
package/dist/commands/deposit.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
import select from "@inquirer/select";
|
|
3
|
+
import { createErc1155BatchCommand, createErc1155SingleCommand, } from "./deposit/erc1155.js";
|
|
3
4
|
import { createErc20Command } from "./deposit/erc20.js";
|
|
4
5
|
import { createErc721Command } from "./deposit/erc721.js";
|
|
5
6
|
import { createEtherCommand } from "./deposit/ether.js";
|
|
@@ -30,7 +31,7 @@ export const createDepositCommand = () => {
|
|
|
30
31
|
command.addCommand(createEtherCommand());
|
|
31
32
|
command.addCommand(createErc20Command());
|
|
32
33
|
command.addCommand(createErc721Command());
|
|
33
|
-
|
|
34
|
-
|
|
34
|
+
command.addCommand(createErc1155SingleCommand());
|
|
35
|
+
command.addCommand(createErc1155BatchCommand());
|
|
35
36
|
return command;
|
|
36
37
|
};
|
package/dist/commands/logs.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import { Command } from "@commander-js/extra-typings";
|
|
|
2
2
|
export declare const createLogsCommand: () => Command<[], {
|
|
3
3
|
projectName?: string | undefined;
|
|
4
4
|
follow?: true | undefined;
|
|
5
|
-
color: boolean;
|
|
6
5
|
since?: string | undefined;
|
|
7
6
|
tail: string;
|
|
8
7
|
until?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,iBAAiB
|
|
1
|
+
{"version":3,"file":"logs.d.ts","sourceRoot":"","sources":["../../src/commands/logs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAItD,eAAO,MAAM,iBAAiB;;;;;;MA6C7B,CAAC"}
|
package/dist/commands/logs.js
CHANGED
|
@@ -1,37 +1,34 @@
|
|
|
1
1
|
import { Command } from "@commander-js/extra-typings";
|
|
2
2
|
import { execa } from "execa";
|
|
3
|
-
import { getProjectName } from "../base.js";
|
|
3
|
+
import { getProjectName, getServiceInfo } from "../base.js";
|
|
4
4
|
export const createLogsCommand = () => {
|
|
5
5
|
return new Command("logs")
|
|
6
6
|
.description("Show logs of a local environment.")
|
|
7
7
|
.option("--project-name <string>", "name of project (used by docker compose and cartesi-rollups-node)")
|
|
8
8
|
.option("-f, --follow", "Follow log output")
|
|
9
|
-
.option("--no-color", "Produce monochrome output")
|
|
10
9
|
.option("--since <string>", "Show logs since timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
|
|
11
10
|
.option("-n, --tail <string>", "Number of lines to show from the end of the logs", "all")
|
|
12
11
|
.option("--until <string>", "Show logs before a timestamp (e.g. 2013-01-02T13:23:37Z) or relative (e.g. 42m for 42 minutes)")
|
|
13
12
|
.configureHelp({ showGlobalOptions: true })
|
|
14
13
|
.action(async (options) => {
|
|
15
|
-
const { follow,
|
|
14
|
+
const { follow, since, tail, until } = options;
|
|
16
15
|
const projectName = getProjectName(options);
|
|
17
|
-
const logOptions = [
|
|
16
|
+
const logOptions = [];
|
|
18
17
|
if (follow)
|
|
19
18
|
logOptions.push("--follow");
|
|
20
|
-
if (color === false)
|
|
21
|
-
logOptions.push("--no-color");
|
|
22
19
|
if (since)
|
|
23
20
|
logOptions.push("--since", since);
|
|
24
21
|
if (tail)
|
|
25
22
|
logOptions.push("--tail", tail);
|
|
26
23
|
if (until)
|
|
27
24
|
logOptions.push("--until", until);
|
|
28
|
-
await
|
|
29
|
-
"compose",
|
|
30
|
-
"--project-name",
|
|
25
|
+
const serviceInfo = await getServiceInfo({
|
|
31
26
|
projectName,
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
27
|
+
service: "rollups-node",
|
|
28
|
+
});
|
|
29
|
+
if (!serviceInfo) {
|
|
30
|
+
throw new Error(`service rollups-node not found`);
|
|
31
|
+
}
|
|
32
|
+
await execa("docker", ["container", "logs", ...logOptions, serviceInfo.ID], { stdio: "inherit" });
|
|
36
33
|
});
|
|
37
34
|
};
|
|
@@ -78,7 +78,7 @@ services:
|
|
|
78
78
|
condition: service_healthy
|
|
79
79
|
|
|
80
80
|
explorer:
|
|
81
|
-
image: cartesi/rollups-explorer:1.
|
|
81
|
+
image: cartesi/rollups-explorer:1.3.3
|
|
82
82
|
environment:
|
|
83
83
|
NODE_RPC_URL: "http://127.0.0.1:${CARTESI_LISTEN_PORT:-6751}/anvil"
|
|
84
84
|
EXPLORER_API_URL: "http://127.0.0.1:${CARTESI_LISTEN_PORT:-6751}/explorer-api/graphql"
|
package/dist/config.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare class RequiredFieldError extends Error {
|
|
|
29
29
|
export declare class InvalidStringArrayError extends Error {
|
|
30
30
|
constructor();
|
|
31
31
|
}
|
|
32
|
-
export declare const DEFAULT_SDK_VERSION = "0.12.0-alpha.
|
|
32
|
+
export declare const DEFAULT_SDK_VERSION = "0.12.0-alpha.22";
|
|
33
33
|
export declare const DEFAULT_SDK_IMAGE = "cartesi/sdk";
|
|
34
34
|
export declare const PREFERRED_PORT = 6751;
|
|
35
35
|
type DriveFormat = "ext2" | "sqfs";
|
package/dist/config.js
CHANGED
|
@@ -63,7 +63,7 @@ export class InvalidStringArrayError extends Error {
|
|
|
63
63
|
*/
|
|
64
64
|
const DEFAULT_FORMAT = "ext2";
|
|
65
65
|
const DEFAULT_RAM = "128Mi";
|
|
66
|
-
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.
|
|
66
|
+
export const DEFAULT_SDK_VERSION = "0.12.0-alpha.22";
|
|
67
67
|
export const DEFAULT_SDK_IMAGE = "cartesi/sdk";
|
|
68
68
|
export const PREFERRED_PORT = 6751;
|
|
69
69
|
export const defaultRootDriveConfig = () => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollups.d.ts","sourceRoot":"","sources":["../../src/exec/rollups.ts"],"names":[],"mappings":"AAKA,OAAO,EACH,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,GAAG,EAGX,MAAM,MAAM,CAAC;AASd,MAAM,MAAM,iBAAiB,GAAG;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,SAAS,EAAE,OAAO,CAAC;IACnB,YAAY,EAAE,IAAI,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,SAAS,GAAG,UAAU,CAAC;CACjC,CAAC;AAWF,KAAK,aAAa,GAAG;IACjB,WAAW,EAAE,MAAM,CAAC;CACvB,CAAC;AAaF,eAAO,MAAM,cAAc,GACvB,SAAS,aAAa,KACvB,OAAO,CAAC,iBAAiB,EAAE,CAgB7B,CAAC;AAEF,eAAO,MAAM,wBAAwB,GACjC,SAAS,aAAa,KACvB,OAAO,CAAC,iBAAiB,GAAG,SAAS,CASvC,CAAC;AAEF,eAAO,MAAM,qBAAqB,GAAU,SAAS;IACjD,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB,KAAG,OAAO,CAAC,OAAO,GAAG,SAAS,CAI9B,CAAC;AAoGF,eAAO,MAAM,kBAAkB,UAA4C,CAAC;AAgC5E,eAAO,MAAM,gBAAgB,GAAU,SAAS;IAC5C,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,OAAO,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAA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IACpB,YAAY,EAAE,IAAI,CAAC;CACtB,KAAG,OAAO,CAAC,MAAM,CAajB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,wCASrE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,GAAU,SAAS;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACvB,KAAG,OAAO,CAAC,OAAO,CAmBlB,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAC7C,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,YAAY,EAAE,MAAM,CAAC;CACxB,KAAG,OAAO,CAAC,iBAAiB,CAmC5B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAU,SAAS;IAC7C,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;CACvB,wCAkCA,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,cAAc,GAAU,SAAS;IAAE,WAAW,EAAE,MAAM,CAAA;CAAE,oBAWpE,CAAC"}
|
package/dist/exec/rollups.js
CHANGED
|
@@ -304,7 +304,7 @@ export const deployApplication = async (options) => {
|
|
|
304
304
|
deployArgs.push("--consensus", consensus);
|
|
305
305
|
}
|
|
306
306
|
else {
|
|
307
|
-
deployArgs.push("--epoch-length", epochLength.toString()
|
|
307
|
+
deployArgs.push("--epoch-length", epochLength.toString());
|
|
308
308
|
}
|
|
309
309
|
if (salt) {
|
|
310
310
|
deployArgs.push("--salt", salt);
|
package/dist/machine.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAmBjE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GACpB,QAAQ,MAAM,EACd,MAAM,SAAS,GAAG,SAAS,EAC3B,aAAa,kBAAkB,EAC/B,UAAU,0BAA0B;;;
|
|
1
|
+
{"version":3,"file":"machine.d.ts","sourceRoot":"","sources":["../src/machine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAe,SAAS,EAAE,MAAM,aAAa,CAAC;AAElE,OAAO,KAAK,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAmBjE,MAAM,MAAM,kBAAkB,GAAG;IAC7B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,eAAO,MAAM,WAAW,GACpB,QAAQ,MAAM,EACd,MAAM,SAAS,GAAG,SAAS,EAC3B,aAAa,kBAAkB,EAC/B,UAAU,0BAA0B;;;GAkGvC,CAAC"}
|
package/dist/machine.js
CHANGED
|
@@ -20,7 +20,10 @@ export const bootMachine = (config, info, bootOptions, options) => {
|
|
|
20
20
|
const { assertRollingTemplate, maxMCycle, noRollup, ramLength, ramImage, useDockerEnv, useDockerWorkdir, user, } = machine;
|
|
21
21
|
// list of environment variables of docker image
|
|
22
22
|
const env = useDockerEnv ? (info?.env ?? []) : [];
|
|
23
|
-
const envs = env.map((variable) =>
|
|
23
|
+
const envs = env.map((variable) => {
|
|
24
|
+
const [key, value] = variable.split("=");
|
|
25
|
+
return `--env=${key}="${value}"`;
|
|
26
|
+
});
|
|
24
27
|
// check if we need a rootfstype boot arg
|
|
25
28
|
const root = config.drives.root;
|
|
26
29
|
if (root?.format === "sqfs") {
|