Skip to content

Commit

Permalink
feat: added burner wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
rishabhkeshan committed Oct 30, 2024
1 parent d30dfdc commit 9ba4104
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 12 deletions.
5 changes: 2 additions & 3 deletions frontend/src/components/Game.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,16 +114,15 @@ export default function Game({
// fetches player info 30 seconds
const interval = setInterval(() => {
setUpdateNum(updateNum + 1);
}, 10000);
}, 30000);

return () => clearInterval(interval);
}, [contract, updateNum]);

const updatePageNum = () => {
setUpdateNum(updateNum + 1);
setTimeout(() => {
setUpdateNum(updateNum + 1);
}, 2000);
}, 500);
};

const controlsMap = useMemo<KeyboardControlsEntry[]>(
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/components/Garden.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,20 @@ export default function Garden({
}: GardenProps) {
useEffect(() => {
async function getPlantedSeeds() {
const startTime = performance.now();

if (contract && contract.account) {
try {
const address: AddressInput = {
bits: contract.account.address.toB256(),
};
const id: IdentityInput = { Address: address };
const { value } = await contract.functions.get_garden_vec(id).get();
const firstTxTime = performance.now();
const timeDiff = (firstTxTime - startTime) / 1000; // Difference in seconds
console.log(
`3rd tx call duration: ${timeDiff.toFixed(2)} seconds`
);
// console.log("VALUE:", value)
setTileStates(value);
} catch (err) {
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/show/WalletInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,23 +46,23 @@ export default function WalletInfo({
return (
<Box css={styles.container}>
<Flex direction={"column"} justify="space-around">
<Box css={styles.box}>
<Box
onClick={() => copyToClipboard(wallet ? wallet.address.toB256() : "")}
css={styles.box}
>
Wallet: {wallet && getTruncatedAddress(wallet.address.toB256())}
</Box>
<Box css={styles.disconnect}>
<span
style={{width: "fit-content", cursor: "pointer"}}
style={{ width: "fit-content", cursor: "pointer" }}
onClick={() => {
disconnect();
}}
>
Disconnect
</span>
</Box>
<Box
onClick={() => copyToClipboard(wallet? wallet.address.toB256():"")}
css={styles.box}
>
<Box css={styles.box}>
Balance: {balance?.isZero() ? "0" : balance?.format({ precision: 6 })}{" "}
ETH
</Box>
Expand Down
19 changes: 16 additions & 3 deletions frontend/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import {
createConfig as createFuelConfig,
FueletWalletConnector,
FuelWalletConnector,
BurnerWalletConnector,
SolanaConnector,
WalletConnectConnector,
} from "@fuels/connectors";import { FuelProvider } from "@fuels/react";
defaultConnectors,
} from "@fuels/connectors";
import { FuelProvider } from "@fuels/react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { Provider, CHAIN_IDS } from "fuels";
import { FUEL_PROVIDER_URL } from './constants.ts';
Expand Down Expand Up @@ -58,6 +61,7 @@ const FUEL_CONFIG = createFuelConfig(() => {
const fueletWalletConnector = new FueletWalletConnector();
const fuelWalletConnector = new FuelWalletConnector();
const bakoSafeConnector = new BakoSafeConnector();
const burnerWalletConnector = new BurnerWalletConnector();
const walletConnectConnector = new WalletConnectConnector({
projectId: WalletConnectProjectId,
wagmiConfig: wagmiConfig as any,
Expand All @@ -75,15 +79,24 @@ const FUEL_CONFIG = createFuelConfig(() => {
solanaConnector,
fuelWalletConnector,
bakoSafeConnector,
burnerWalletConnector
],
};
});
createRoot(document.getElementById("root")!).render(
<StrictMode>
<QueryClientProvider client={queryClient}>
<FuelProvider
networks={networks}
fuelConfig={FUEL_CONFIG}
// networks={networks}
// fuelConfig={FUEL_CONFIG}
fuelConfig={{
connectors: defaultConnectors({
devMode: true,
wcProjectId: "35b967d8f17700b2de24f0abee77e579",
chainId: CHAIN_IDS.fuel.mainnet,
fuelProvider: Provider.create(FUEL_PROVIDER_URL),
}),
}}
uiConfig={{ suggestBridge: false }}
theme="dark"
>
Expand Down

0 comments on commit 9ba4104

Please sign in to comment.