Skip to content

Commit

Permalink
Adds token approval, debounces quote calls, fixes other bugs
Browse files Browse the repository at this point in the history
runs format

moves flameExplorerUrl to constants

formating fix

Fixes lint errors

fixes build errors

format
  • Loading branch information
matthew-garrett committed Feb 13, 2025
1 parent 28713e9 commit ff0e7f0
Show file tree
Hide file tree
Showing 21 changed files with 731 additions and 571 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ interface ConfirmationModalProps {

export default function ConfirmationModal({
onSubmitCallback,
setTxnStatus,
txnStatus,
handleResetInputs,
buttonText,
children,
title,
actionButtonText,
handleResetInputs,
isCloseModalAction,
setTxnStatus,
skipIdleTxnStatus,
title,
txnStatus,
actionButtonText,
}: ConfirmationModalProps): React.ReactElement {
const [open, setOpen] = useState(false);

Expand Down
18 changes: 17 additions & 1 deletion apps/flame-defi/app/config/hooks/useConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useContext } from "react";

import { ConfigContext } from "../contexts/ConfigContext";
import { EvmChainInfo } from "@repo/flame-types";
import { Chain } from "viem";

/**
* Hook to use the config context.
Expand All @@ -21,5 +22,20 @@ export const useEvmChainData = () => {
const evmChainsData = Object.values(evmChains);
const selectedChain = evmChainsData[0] as EvmChainInfo;

return { selectedChain };
const evmChainConfig: Chain = {
id: selectedChain?.chainId,
name: selectedChain?.chainName,
nativeCurrency: {
name: selectedChain?.currencies[0]?.title,
symbol: selectedChain?.currencies[0]?.coinDenom,
decimals: selectedChain?.currencies[0]?.coinDecimals || 18,
},
rpcUrls: {
default: {
http: selectedChain?.rpcUrls,
},
},
};

return { selectedChain, evmChainConfig };
};
5 changes: 5 additions & 0 deletions apps/flame-defi/app/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export enum TXN_STATUS {
FAILED = "failed",
}

export const flameExplorerUrl = "https://explorer.flame.astria.org";

export const defaultApprovalAmount =
"115792089237316195423570985008687907853269984665640564039457";

export const defaultSlippageTolerance = 0.1;

export const feeData = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import {
AccordionItem,
AccordionTrigger,
} from "@repo/ui/shadcn-primitives";
import { flameExplorerUrl } from "../../../../constants";

interface ConnectEvmWalletButtonProps {
// Label to show before the user is connected to a wallet.
Expand Down Expand Up @@ -61,10 +62,16 @@ export default function ConnectEvmWalletButton({
</AccordionTrigger>
<div className="flex items-center gap-3">
<CopyToClipboardButton textToCopy={userAccount.address} />
<UpRightSquareIcon
className="cursor-pointer hover:text-white transition"
size={21}
/>
<a
href={`${flameExplorerUrl}/address/${userAccount.address}`}
target="_blank"
rel="noreferrer"
>
<UpRightSquareIcon
className="cursor-pointer hover:text-white transition"
size={21}
/>
</a>
<button type="button" onClick={() => disconnectEvmWallet()}>
<PowerIcon
className="cursor-pointer hover:text-white transition"
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
PopoverContent,
PopoverTrigger,
} from "@repo/ui/shadcn-primitives";
import { flameExplorerUrl } from "../../../../constants";

export function SingleWalletContent({
address,
Expand All @@ -32,7 +33,7 @@ export function SingleWalletContent({
};

return (
<div className="">
<div>
<div className="flex items-center justify-between">
<div className="flex items-center gap-2">
<FlameIcon />
Expand All @@ -43,10 +44,16 @@ export function SingleWalletContent({
</div>
<div className="flex items-center gap-3 text-grey-light">
<CopyToClipboardButton textToCopy={address} />
<UpRightSquareIcon
className="cursor-pointer hover:text-white transition"
size={21}
/>
<a
href={`${flameExplorerUrl}/address/${address}`}
target="_blank"
rel="noreferrer"
>
<UpRightSquareIcon
className="cursor-pointer hover:text-white transition"
size={21}
/>
</a>
<button type="button" onClick={() => handleDisconnect()}>
<PowerIcon
className="cursor-pointer hover:text-white transition"
Expand Down Expand Up @@ -109,7 +116,7 @@ export default function SingleWalletConnect() {
</PopoverTrigger>
<PopoverContent
side="bottom"
className="flex flex-col mr-12 gap-3 p-5 bg-radial-dark"
className="flex flex-col mr-12 gap-3 p-5 bg-radial-dark w-full md:w-[300px]"
>
<SingleWalletContent address={userAccount.address} />
</PopoverContent>
Expand Down
Loading

0 comments on commit ff0e7f0

Please sign in to comment.