From 67f7ca63ad1d4facd3b94df1b25efbe3043866af Mon Sep 17 00:00:00 2001 From: Ryan Goulding Date: Tue, 6 Feb 2024 13:50:50 -0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=97=9E=EF=B8=8F=20warn=20user=20if=20no?= =?UTF-8?q?=20lzReceive=20gas=20is=20supplied=20(#347)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Ryan Goulding --- .changeset/three-pigs-give.md | 5 +++++ packages/build-lz-options/src/components/outputOptions.tsx | 7 ++++++- packages/build-lz-options/src/index.tsx | 7 ++++++- packages/build-lz-options/src/types.ts | 1 + 4 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 .changeset/three-pigs-give.md diff --git a/.changeset/three-pigs-give.md b/.changeset/three-pigs-give.md new file mode 100644 index 000000000..008bc485a --- /dev/null +++ b/.changeset/three-pigs-give.md @@ -0,0 +1,5 @@ +--- +"build-lz-options": patch +--- + +Warn users if lzReceive gas is not set. diff --git a/packages/build-lz-options/src/components/outputOptions.tsx b/packages/build-lz-options/src/components/outputOptions.tsx index ea5b69700..13f85b7a7 100644 --- a/packages/build-lz-options/src/components/outputOptions.tsx +++ b/packages/build-lz-options/src/components/outputOptions.tsx @@ -15,8 +15,13 @@ export const OutputOptions: React.FC = ({ }: OptionOutputProps) => { return ( + {props.warning.map((warning) => ( + + Warning: {warning} + + ))} - Result: {props.hex} + Result: {props.hex} ); diff --git a/packages/build-lz-options/src/index.tsx b/packages/build-lz-options/src/index.tsx index 56225efe9..39e208977 100644 --- a/packages/build-lz-options/src/index.tsx +++ b/packages/build-lz-options/src/index.tsx @@ -32,6 +32,7 @@ new Command("build-lz-options") render().unmount(); let output: string = ""; + const warning: string[] = []; switch (config.type.id) { case OptionType.TYPE_1: { @@ -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(); + render(); }) .parseAsync(); diff --git a/packages/build-lz-options/src/types.ts b/packages/build-lz-options/src/types.ts index 16e189866..ec59b9cdb 100644 --- a/packages/build-lz-options/src/types.ts +++ b/packages/build-lz-options/src/types.ts @@ -20,6 +20,7 @@ export interface OptionTypeInput { */ export interface OptionOutput { hex: string + warning: string[] } /**