diff --git a/packages/app/components/creator-token/buy-creator-token.web.tsx b/packages/app/components/creator-token/buy-creator-token.web.tsx index d2c2d384f..ace763a50 100644 --- a/packages/app/components/creator-token/buy-creator-token.web.tsx +++ b/packages/app/components/creator-token/buy-creator-token.web.tsx @@ -32,6 +32,7 @@ import { useRedirectToCreatorTokensShare } from "app/hooks/use-redirect-to-creat import { useUser } from "app/hooks/use-user"; import { useWallet } from "app/hooks/use-wallet"; import { useWalletETHBalance } from "app/hooks/use-wallet-balance"; +import { usePrivyFundWallet } from "app/lib/privy/privy-hooks"; import { useNavigateToLogin } from "app/navigation/use-navigate-to"; import { toast } from "design-system/toast"; @@ -97,6 +98,7 @@ export const BuyCreatorToken = () => { const usdcBalance = useWalletUSDCBalance(); const ethBalance = useWalletETHBalance(); + const fundWallet = usePrivyFundWallet(); const [showExplanation, setShowExplanation] = useState(false); const priceToBuyNext = useCreatorTokenPriceToBuyNext( selectedAction === "buy" @@ -167,11 +169,7 @@ export const BuyCreatorToken = () => { + ) : null} - {/* TODO: creator tokens p2 + + + + + - Token earnings + USDC balance } - text={ - "Every time someone trades\nyour token you earn a 7%\nfee." - } + text={"Your USDC balance on\nthe Base Ethereum L2."} /> - $21.67 + {getCurrencyPrice("USD", usdcBalance.data?.displayBalance)} - */} diff --git a/packages/app/lib/privy/privy-hooks.ts b/packages/app/lib/privy/privy-hooks.ts index b55227bce..05399db5a 100644 --- a/packages/app/lib/privy/privy-hooks.ts +++ b/packages/app/lib/privy/privy-hooks.ts @@ -4,3 +4,9 @@ export const useExportPrivyWallet = () => { const exportPrivyWallet = async () => {}; return exportPrivyWallet; }; + +export const usePrivyFundWallet = () => { + const fundWallet = (currencyCode: "eth" | "usdc") => {}; + + return fundWallet; +}; diff --git a/packages/app/lib/privy/privy-hooks.web.ts b/packages/app/lib/privy/privy-hooks.web.ts index 7373f9a15..1e755a144 100644 --- a/packages/app/lib/privy/privy-hooks.web.ts +++ b/packages/app/lib/privy/privy-hooks.web.ts @@ -1,4 +1,4 @@ -import { usePrivy } from "@privy-io/react-auth"; +import { usePrivy, useWallets } from "@privy-io/react-auth"; export const useLoginWithSMS = () => { return { @@ -11,3 +11,16 @@ export const useExportPrivyWallet = () => { const { exportWallet } = usePrivy(); return exportWallet; }; + +export const usePrivyFundWallet = () => { + const { wallets } = useWallets(); + const fundWallet = (currencyCode: "eth" | "usdc") => { + return wallets[0].fund({ + config: { + currencyCode: currencyCode === "usdc" ? "USDC_BASE" : "ETH_BASE", + }, + }); + }; + + return fundWallet; +};