-
Notifications
You must be signed in to change notification settings - Fork 175
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: follow up from Jan's feedback
Signed-off-by: Ryan Goulding <goulding@layerzerolabs.org>
- Loading branch information
1 parent
2ae50e2
commit e515462
Showing
11 changed files
with
175 additions
and
238 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 19 additions & 61 deletions
80
packages/build-lz-options/src/components/outputOptions.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,24 @@ | ||
import { makeBytes32 } from "@layerzerolabs/devtools-evm"; | ||
import React, { useEffect } from "react"; | ||
import type { OptionType1, OptionType2, OptionType3 } from "@/types"; | ||
import { Box } from "ink"; | ||
import { useTask } from "@/utilities/tasks"; | ||
import { optionsType1, optionsType2 } from "@layerzerolabs/lz-utility-v2"; | ||
import React from "react"; | ||
import type { OptionOutput } from "@/types"; | ||
import { Box, Text } from "ink"; | ||
|
||
interface Props { | ||
props: OptionType1; | ||
interface OptionOutputProps { | ||
props: OptionOutput; | ||
} | ||
|
||
export const outputOptionsType1 = async (gasLimit: OptionType1) => { | ||
console.log(optionsType1(gasLimit.gasLimit)); | ||
}; | ||
|
||
export const OutputOptionsType1: React.FC<Props> = ({ props }) => { | ||
const output = useTask(() => outputOptionsType1(props)); | ||
|
||
useEffect(() => { | ||
output.run().catch(() => {}); | ||
}, [output.run]); | ||
|
||
return <Box flexDirection="column"></Box>; | ||
}; | ||
|
||
interface OptionsType2Props { | ||
props: OptionType2; | ||
} | ||
|
||
const outputOptionsType2 = async (options: OptionType2) => { | ||
console.log( | ||
optionsType2( | ||
options.gasLimit, | ||
options.nativeDropAmount, | ||
makeBytes32(options.nativeDropAddress), | ||
), | ||
/** | ||
* Render the options output to the user. | ||
* @param {OptionOutputProps} props | ||
* @constructor | ||
*/ | ||
export const OutputOptions: React.FC<OptionOutputProps> = ({ | ||
props, | ||
}: OptionOutputProps) => { | ||
return ( | ||
<Box flexDirection="column"> | ||
<Text> | ||
Result: <Text color={"green"}>{props.hex}</Text> | ||
</Text> | ||
</Box> | ||
); | ||
}; | ||
|
||
export const OutputOptionsType2: React.FC<OptionsType2Props> = ({ props }) => { | ||
const output = useTask(() => outputOptionsType2(props)); | ||
|
||
useEffect(() => { | ||
output.run().catch(() => {}); | ||
}, [output.run]); | ||
|
||
return <Box flexDirection="column"></Box>; | ||
}; | ||
|
||
interface OptionsType3Props { | ||
props: OptionType3; | ||
} | ||
|
||
const outputOptionsType3 = async (options: OptionType3) => { | ||
console.log(options.output); | ||
}; | ||
|
||
export const OutputOptionsType3: React.FC<OptionsType3Props> = ({ props }) => { | ||
const output = useTask(() => outputOptionsType3(props)); | ||
|
||
useEffect(() => { | ||
output.run().catch(() => {}); | ||
}, [output.run]); | ||
|
||
return <Box flexDirection="column"></Box>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,36 @@ | ||
export interface OptionConfig { | ||
type: OptionType | ||
} | ||
|
||
/** | ||
* Used to render OptionType input from the user. | ||
*/ | ||
export interface OptionType { | ||
id: string | ||
label: string | ||
} | ||
|
||
export interface OptionType1 { | ||
/** | ||
* Input OptionType selection. | ||
*/ | ||
export interface OptionTypeInput { | ||
type: OptionType | ||
} | ||
|
||
/** | ||
* The result of building an Option. | ||
*/ | ||
export interface OptionOutput { | ||
hex: string | ||
} | ||
|
||
/** | ||
* Summary of OptionType.TYPE_1. | ||
*/ | ||
export interface OptionType1Summary { | ||
gasLimit: string | ||
} | ||
|
||
export interface OptionType2 extends OptionType1 { | ||
/** | ||
* Summary of OptionType.TYPE_2. | ||
*/ | ||
export interface OptionType2Summary extends OptionType1Summary { | ||
nativeDropAmount: string | ||
nativeDropAddress: string | ||
} | ||
|
||
export interface OptionType3 { | ||
output: string | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.