Skip to content

Commit

Permalink
🗞️ warn user if no lzReceive gas is supplied (#347)
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Goulding <[email protected]>
  • Loading branch information
ryandgoulding authored Feb 6, 2024
1 parent 42d4d67 commit 67f7ca6
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/three-pigs-give.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"build-lz-options": patch
---

Warn users if lzReceive gas is not set.
7 changes: 6 additions & 1 deletion packages/build-lz-options/src/components/outputOptions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,13 @@ export const OutputOptions: React.FC<OptionOutputProps> = ({
}: OptionOutputProps) => {
return (
<Box flexDirection="column">
{props.warning.map((warning) => (
<Text color="yellow">
<Text bold>Warning:</Text> {warning}
</Text>
))}
<Text>
Result: <Text color={"green"}>{props.hex}</Text>
<Text bold>Result:</Text> <Text color="green">{props.hex}</Text>
</Text>
</Box>
);
Expand Down
7 changes: 6 additions & 1 deletion packages/build-lz-options/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ new Command("build-lz-options")
render(<ConfigSummary value={config} />).unmount();

let output: string = "";
const warning: string[] = [];

switch (config.type.id) {
case OptionType.TYPE_1: {
Expand Down Expand Up @@ -66,10 +67,14 @@ new Command("build-lz-options")
}
case OptionType.TYPE_3: {
const options = await promptForOptionType3();
const lzReceiveOption = options.decodeExecutorLzReceiveOption();
if (!lzReceiveOption || lzReceiveOption.gas < 1) {
warning.push("Options do not specify any lzReceive gas.");
}
output = options.toHex();
break;
}
}
render(<OutputOptions props={{ hex: output }} />);
render(<OutputOptions props={{ hex: output, warning }} />);
})
.parseAsync();
1 change: 1 addition & 0 deletions packages/build-lz-options/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface OptionTypeInput {
*/
export interface OptionOutput {
hex: string
warning: string[]
}

/**
Expand Down

0 comments on commit 67f7ca6

Please sign in to comment.