Skip to content

Commit

Permalink
Adapted CLI to new @guidanoli/cmioc API
Browse files Browse the repository at this point in the history
  • Loading branch information
guidanoli committed Jul 14, 2024
1 parent e50a983 commit 377e822
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-lamps-joke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@guidanoli/cmioc-cli": patch
---

Adapted to new @guidanoli/cmioc API
14 changes: 6 additions & 8 deletions apps/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ encodeCommand
.action((options) => {
const input: Input = { ...options };
const { binary } = options;
writeHexToStdout(encodeInputBlob(input), binary);
writeHexToStdout(encodeInput(input), binary);
});

encodeCommand
Expand All @@ -172,7 +172,7 @@ encodeCommand
.action((options) => {
const voucher: Voucher = { type: "voucher", ...options };
const { binary } = options;
writeHexToStdout(encodeOutputBlob(voucher), binary);
writeHexToStdout(encodeOutput(voucher), binary);
});

encodeCommand
Expand All @@ -183,7 +183,7 @@ encodeCommand
.action((options) => {
const notice: Notice = { type: "notice", ...options };
const { binary } = options;
writeHexToStdout(encodeOutputBlob(notice), binary);
writeHexToStdout(encodeOutput(notice), binary);
});

encodeCommand
Expand All @@ -202,7 +202,7 @@ encodeCommand
...options,
};
const { binary } = options;
writeHexToStdout(encodeOutputBlob(delegatecallvoucher), binary);
writeHexToStdout(encodeOutput(delegatecallvoucher), binary);
});

const decodeCommand = program.command("decode");
Expand All @@ -216,9 +216,7 @@ decodeCommand
.option("-b, --binary", "read from stdin as binary data", false)
.action(async (blob, { binary }) => {
try {
const input = decodeInputBlob(
blob ?? (await readHexFromStdin(binary)),
);
const input = decodeInput(blob ?? (await readHexFromStdin(binary)));
console.log(toJSON(input));
} catch (e) {
handleError(e);
Expand All @@ -232,7 +230,7 @@ decodeCommand
.option("-b, --binary", "read from stdin as binary data", false)
.action(async (blob, { binary }) => {
try {
const output = decodeOutputBlob(
const output = decodeOutput(
blob ?? (await readHexFromStdin(binary)),
);
console.log(toJSON(output));
Expand Down

0 comments on commit 377e822

Please sign in to comment.