Skip to content

Commit

Permalink
#252 - code review suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianscatularo committed Jul 20, 2023
1 parent b40ad3b commit bb33e3b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/components/Recovery.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ export default function Recovery() {
useState(false);
const [recoverySourceTxError, setRecoverySourceTxError] = useState("");
const [recoverySignedVAA, setRecoverySignedVAA] = useState("");
const { itIsNFTTransfer, itIsTokenBridgeTransfer } =
const { isNFTTransfer, isTokenBridgeTransfer } =
useVaaVerifier(recoverySignedVAA);
const [recoveryParsedVAA, setRecoveryParsedVAA] = useState<ParsedVaa | null>(
null
Expand Down Expand Up @@ -908,7 +908,7 @@ export default function Recovery() {
const enableRecovery =
recoverySignedVAA &&
parsedPayloadTargetChain &&
(itIsNFTTransfer || itIsTokenBridgeTransfer);
(isNFTTransfer || isTokenBridgeTransfer);

const handleRecoverClickBase = useCallback(
(useRelayer: boolean) => {
Expand Down
14 changes: 7 additions & 7 deletions src/hooks/useVaaVerifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function itWasEmittedFrom(
return false;
}

function itIsASupportedType(
function isItASupportedType(
type: VAAType,
...supportedTypes: VAAType[]
): boolean {
Expand All @@ -95,34 +95,34 @@ export function useVaaVerifier(hexVaa: string) {
[vaa]
);
const payloadType = useMemo(() => getPayloadType(vaa?.payload), [vaa]);
const itIsTokenBridgeTransfer = useMemo(
const isTokenBridgeTransfer = useMemo(
() =>
itWasEmittedFrom(
vaaEmitterAddress,
vaaEmitterChain,
getTokenBridgeAddressForChain
) &&
itIsASupportedType(
isItASupportedType(
payloadType,
VAAType.TRANSFER,
VAAType.TRANSFER_WITH_PAYLOAD
),
[vaaEmitterAddress, vaaEmitterChain, payloadType]
);
const itIsNFTTransfer = useMemo(
const isNFTTransfer = useMemo(
() =>
itWasEmittedFrom(
vaaEmitterAddress,
vaaEmitterChain,
getNFTBridgeAddressForChain
) && itIsASupportedType(payloadType, VAAType.TRANSFER),
) && isItASupportedType(payloadType, VAAType.TRANSFER),
[vaaEmitterAddress, vaaEmitterChain, payloadType]
);
return {
transfer,
nft,
payloadType,
itIsTokenBridgeTransfer,
itIsNFTTransfer,
isTokenBridgeTransfer,
isNFTTransfer,
};
}

0 comments on commit bb33e3b

Please sign in to comment.