-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathparser.ts
51 lines (48 loc) · 1.08 KB
/
parser.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { BigNumber } from "ethers";
import yargs from "yargs";
export function parseMessageNumArgs() {
return yargs
.option("msgNum", {
alias: "m",
description: "L1 message number",
type: "number",
demandOption: true,
})
.help()
.alias("help", "h").argv as {
msgNum: number;
};
}
export function parseMessageArgs(): {
batchNumber: number;
batchIndex: number;
} {
return yargs
.option("batchNumber", {
alias: "n",
description: "Batch number including message",
type: "number",
demandOption: true,
})
.option("batchIndex", {
alias: "i",
description: "Message index in batch",
type: "number",
demandOption: true,
})
.help()
.alias("help", "h").argv as {
batchNumber: number;
batchIndex: number;
};
}
export function parseMessageArgsAsBigNumber(): {
batchNumber: BigNumber;
batchIndex: BigNumber;
} {
const { batchNumber, batchIndex } = parseMessageArgs();
return {
batchNumber: BigNumber.from(batchNumber),
batchIndex: BigNumber.from(batchIndex),
};
}