sync
This commit is contained in:
parent
d9ee23e4a8
commit
d7b2877621
|
|
@ -1,6 +1,6 @@
|
||||||
import { useRouter } from "next/router";
|
import { useRouter } from "next/router";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { getAccessToken, getEmbeddedConnectedWallet, usePrivy, useWallets, Google, Twitter, Discord } from "@privy-io/react-auth";
|
import { getAccessToken, getEmbeddedConnectedWallet, usePrivy, useWallets, Google, Twitter, Discord, useFundWallet } from "@privy-io/react-auth";
|
||||||
import Head from "next/head";
|
import Head from "next/head";
|
||||||
import { useBalance } from 'wagmi';
|
import { useBalance } from 'wagmi';
|
||||||
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
|
||||||
|
|
@ -22,6 +22,7 @@ export default function DashboardPage() {
|
||||||
|
|
||||||
const { ready, authenticated, user, logout, exportWallet, linkWallet, unlinkWallet, linkDiscord, unlinkDiscord, linkTwitter, unlinkTwitter, linkGoogle, unlinkGoogle } = usePrivy();
|
const { ready, authenticated, user, logout, exportWallet, linkWallet, unlinkWallet, linkDiscord, unlinkDiscord, linkTwitter, unlinkTwitter, linkGoogle, unlinkGoogle } = usePrivy();
|
||||||
const { wallets } = useWallets();
|
const { wallets } = useWallets();
|
||||||
|
const {fundWallet} = useFundWallet();
|
||||||
|
|
||||||
const [activeWallet, setActiveWallet] = useState(user?.wallet?.address);
|
const [activeWallet, setActiveWallet] = useState(user?.wallet?.address);
|
||||||
const [activeWalletObj, setActiveWalletObj] = useState(wallets[0]);
|
const [activeWalletObj, setActiveWalletObj] = useState(wallets[0]);
|
||||||
|
|
@ -163,6 +164,8 @@ export default function DashboardPage() {
|
||||||
|
|
||||||
const contractAddress = "0x248c005371a0a388FDD60Ec0e00c1dE53e0B79A2";
|
const contractAddress = "0x248c005371a0a388FDD60Ec0e00c1dE53e0B79A2";
|
||||||
async function buyTicket(amount: number) {
|
async function buyTicket(amount: number) {
|
||||||
|
await fundWallet(activeWalletObj?.address ?? "");
|
||||||
|
return;
|
||||||
const isEmbedded = getEmbeddedConnectedWallet(wallets)?.address == activeWalletObj?.address;
|
const isEmbedded = getEmbeddedConnectedWallet(wallets)?.address == activeWalletObj?.address;
|
||||||
const provider = await activeWalletObj?.getEthereumProvider();
|
const provider = await activeWalletObj?.getEthereumProvider();
|
||||||
if (!provider) {
|
if (!provider) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user