Skip to content
This repository has been archived by the owner on Dec 21, 2023. It is now read-only.

Commit

Permalink
pay with eth fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
intergalacticspacehighway committed Oct 30, 2023
1 parent 3b906ca commit 8be92fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
12 changes: 11 additions & 1 deletion packages/app/components/creator-token/buy-creator-token.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ export const BuyCreatorToken = () => {
setTokenAmount(1);
}
}, [selectedAction, tokenBalance.data]);

useEffect(() => {
if (selectedAction === "sell") {
setPaymentMethod("USDC");
}
}, [selectedAction, tokenBalance.data]);
const isDark = useIsDarkMode();

return (
Expand Down Expand Up @@ -225,7 +231,11 @@ export const BuyCreatorToken = () => {
<View tw="flex-1" style={{ rowGap: 16 }}>
<View tw="w-full flex-row items-center justify-between">
<Toggle
options={PAYMENT_METHODS}
options={
selectedAction === "buy"
? PAYMENT_METHODS
: PAYMENT_METHODS.slice(0, 1)
}
value={paymentMethod}
onChange={(value: any) => setPaymentMethod(value)}
/>
Expand Down
2 changes: 1 addition & 1 deletion packages/app/hooks/auth/use-get-eth-for-usdc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const useGetETHForUSDC = (params?: { amount: bigint }) => {
console.log("res ", res);
return {
value: res[0],
displayValue: Number(res[0]) / (10 ^ 18),
displayValue: Number(res[0]) / 10 ** 18,
};
}
},
Expand Down
4 changes: 2 additions & 2 deletions packages/app/hooks/creator-token/use-creator-token-buy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export const useCreatorTokenBuy = (params: {
abi: creatorTokenSwapRouterAbi,
functionName: "buyWithEth",
args: [
Number(ethPriceToBuyNext.data?.value) / (10 ^ 18),
Number(ethPriceToBuyNext.data?.value) / 10 ** 18,
profileData.data.profile.creator_token.address,
priceToBuyNext.data?.totalPrice + 500000n,
],
Expand All @@ -93,7 +93,7 @@ export const useCreatorTokenBuy = (params: {
abi: creatorTokenSwapRouterAbi,
functionName: "bulkBuyWithEth",
args: [
Number(ethPriceToBuyNext.data?.value) / (10 ^ 18),
Number(ethPriceToBuyNext.data?.value) / 10 ** 18,
profileData.data.profile.creator_token.address,
tokenAmount,
priceToBuyNext.data?.totalPrice + 500000n,
Expand Down

0 comments on commit 8be92fd

Please sign in to comment.