From 3ea2721f04c5b7ac91f5d09b344609baec23d924 Mon Sep 17 00:00:00 2001 From: Buuh2511 Date: Wed, 25 Sep 2024 13:41:26 +0700 Subject: [PATCH 01/11] remove unless component - mactched UI button connect - dynamichook : eventhistory, contract --- packages/foundry/contracts/YourContract.sol | 8 +- packages/foundry/script/VerifyAll.s.sol | 24 ++++-- packages/nextjs/components/Footer.tsx | 80 ----------------- .../{scaffold-eth => }/ProgressBar.tsx | 0 .../AddressInfoDropdown.tsx | 8 +- .../RainbowKitCustomConnectButton/index.tsx | 9 +- .../scaffold-stark/BlockExplorer.tsx | 27 ++---- .../scaffold-stark/BlockExplorerSepolia.tsx | 22 ++--- .../scaffold-stark/BlockieAvatar.tsx | 6 +- .../AddressInfoDropdown.tsx | 25 ++---- .../AddressQRCodeModal.tsx | 12 +-- .../CustomConnectButton/GenericModal.tsx | 6 +- .../CustomConnectButton/Wallet.tsx | 13 ++- .../WrongNetworkDropdown.tsx | 10 +-- .../CustomConnectButton/index.tsx | 13 ++- .../scaffold-stark/FaucetButton.tsx | 65 -------------- .../scaffold-stark/Input/InputBase.tsx | 18 +--- .../scaffold-stark/Input/IntegerInput.tsx | 14 +-- .../components/scaffold-stark/Input/utils.ts | 7 +- .../components/scaffold-stark/ProgressBar.tsx | 78 ----------------- .../core/dynamic/hooks/useDynamicContract.ts | 23 +++++ .../dynamic/hooks/useDynamicEventHistory.ts | 86 +++++++++++++++++++ .../core/stark/contracts/deployedContracts.ts | 6 +- .../core/stark/hooks/useOutsideClick.ts | 5 +- .../stark/hooks/useScaffoldStrkBalance.ts | 4 +- .../core/stark/hooks/useSwitchNetwork.ts | 4 +- .../stark-burner/BurnerConnectorErrors.ts | 3 +- packages/nextjs/core/stark/utils/Constants.ts | 18 ++-- .../nextjs/core/stark/utils/devnetAccounts.ts | 60 +++++-------- packages/nextjs/core/stark/utils/profile.ts | 4 +- .../core/stark/utils/scaffold-stark/common.ts | 6 +- .../stark/utils/scaffold-stark/getMetadata.ts | 34 -------- .../utils/scaffold-stark/notification.tsx | 24 ++---- .../public/icons/connect-wallet-icon.svg | 3 + packages/nextjs/styles/globals.css | 15 +++- 35 files changed, 241 insertions(+), 499 deletions(-) delete mode 100644 packages/nextjs/components/Footer.tsx rename packages/nextjs/components/{scaffold-eth => }/ProgressBar.tsx (100%) delete mode 100644 packages/nextjs/components/scaffold-stark/FaucetButton.tsx delete mode 100644 packages/nextjs/components/scaffold-stark/ProgressBar.tsx create mode 100644 packages/nextjs/core/dynamic/hooks/useDynamicContract.ts create mode 100644 packages/nextjs/core/dynamic/hooks/useDynamicEventHistory.ts delete mode 100644 packages/nextjs/core/stark/utils/scaffold-stark/getMetadata.ts create mode 100644 packages/nextjs/public/icons/connect-wallet-icon.svg diff --git a/packages/foundry/contracts/YourContract.sol b/packages/foundry/contracts/YourContract.sol index 3142774..fde85a7 100644 --- a/packages/foundry/contracts/YourContract.sol +++ b/packages/foundry/contracts/YourContract.sol @@ -30,7 +30,9 @@ contract YourContract { // Constructor: Called once on contract deployment // Check packages/foundry/deploy/Deploy.s.sol - constructor(address _owner) { + constructor( + address _owner + ) { owner = _owner; } @@ -47,7 +49,9 @@ contract YourContract { * * @param _newGreeting (string memory) - new greeting to save on the contract */ - function setGreeting(string memory _newGreeting) public payable { + function setGreeting( + string memory _newGreeting + ) public payable { // Print data to the anvil chain console. Remove when deploying to a live network. console.logString("Setting new greeting"); diff --git a/packages/foundry/script/VerifyAll.s.sol b/packages/foundry/script/VerifyAll.s.sol index 829d676..ec5b1e6 100644 --- a/packages/foundry/script/VerifyAll.s.sol +++ b/packages/foundry/script/VerifyAll.s.sol @@ -17,7 +17,9 @@ struct FfiResult { } interface tempVm { - function tryFfi(string[] calldata) external returns (FfiResult memory); + function tryFfi( + string[] calldata + ) external returns (FfiResult memory); } contract VerifyAll is Script { @@ -39,7 +41,9 @@ contract VerifyAll is Script { } } - function _verifyIfContractDeployment(string memory content) internal { + function _verifyIfContractDeployment( + string memory content + ) internal { string memory txType = abi.decode( vm.parseJson(content, searchStr(currTransactionIdx, "transactionType")), (string) @@ -49,7 +53,9 @@ contract VerifyAll is Script { } } - function _verifyContract(string memory content) internal { + function _verifyContract( + string memory content + ) internal { string memory contractName = abi.decode( vm.parseJson(content, searchStr(currTransactionIdx, "contractName")), (string) @@ -98,7 +104,9 @@ contract VerifyAll is Script { return; } - function nextTransaction(string memory content) external view returns (bool) { + function nextTransaction( + string memory content + ) external view returns (bool) { try this.getTransactionFromRaw(content, currTransactionIdx) { return true; } catch { @@ -106,11 +114,9 @@ contract VerifyAll is Script { } } - function _getCompiledBytecode(string memory contractName) - internal - view - returns (string memory compiledBytecode) - { + function _getCompiledBytecode( + string memory contractName + ) internal view returns (string memory compiledBytecode) { string memory root = vm.projectRoot(); string memory path = string.concat(root, "/out/", contractName, ".sol/", contractName, ".json"); diff --git a/packages/nextjs/components/Footer.tsx b/packages/nextjs/components/Footer.tsx deleted file mode 100644 index 6ed5702..0000000 --- a/packages/nextjs/components/Footer.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import React from "react"; -import Link from "next/link"; -import { hardhat } from "viem/chains"; -import { CurrencyDollarIcon, MagnifyingGlassIcon } from "@heroicons/react/24/outline"; -import { HeartIcon } from "@heroicons/react/24/outline"; -import { SwitchTheme } from "~~/components/SwitchTheme"; -import { BuidlGuidlLogo } from "~~/components/assets/BuidlGuidlLogo"; -import { Faucet } from "~~/components/scaffold-eth"; -import { useTargetNetwork } from "~~/core/eth/hooks/useTargetNetwork"; -import { useGlobalState } from "~~/core/eth/services/store/store-eth"; - -/** - * Site footer - */ -export const Footer = () => { - const nativeCurrencyPrice = useGlobalState(state => state.nativeCurrency.price); - const { targetNetwork } = useTargetNetwork(); - const isLocalNetwork = targetNetwork.id === hardhat.id; - - return ( -
-
-
-
- {nativeCurrencyPrice > 0 && ( -
-
- - {nativeCurrencyPrice.toFixed(2)} -
-
- )} - {isLocalNetwork && ( - <> - - - - Block Explorer - - - )} -
- -
-
-
- -
-
- ); -}; diff --git a/packages/nextjs/components/scaffold-eth/ProgressBar.tsx b/packages/nextjs/components/ProgressBar.tsx similarity index 100% rename from packages/nextjs/components/scaffold-eth/ProgressBar.tsx rename to packages/nextjs/components/ProgressBar.tsx diff --git a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx index 0c29008..7c39b53 100644 --- a/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx +++ b/packages/nextjs/components/scaffold-eth/RainbowKitCustomConnectButton/AddressInfoDropdown.tsx @@ -48,12 +48,12 @@ export const AddressInfoDropdown = ({ return ( <>
- - - + + + {isENS(displayName) ? displayName : checkSumAddress?.slice(0, 6) + "..." + checkSumAddress?.slice(-4)} - +
    { {(() => { if (!connected) { return ( - +
    +

    Connect

    + wallet-icon +
    ); } diff --git a/packages/nextjs/components/scaffold-stark/BlockExplorer.tsx b/packages/nextjs/components/scaffold-stark/BlockExplorer.tsx index 68ca23c..fc9a127 100644 --- a/packages/nextjs/components/scaffold-stark/BlockExplorer.tsx +++ b/packages/nextjs/components/scaffold-stark/BlockExplorer.tsx @@ -1,9 +1,9 @@ "use client"; +import Image from "next/image"; import { Address as AddressType, mainnet } from "@starknet-react/chains"; -import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; import { useNetwork } from "@starknet-react/core"; -import Image from "next/image"; +import { MagnifyingGlassIcon } from "@heroicons/react/24/outline"; export const BlockExplorer = () => { const { chain: ConnectedChain } = useNetwork(); @@ -33,27 +33,17 @@ export const BlockExplorer = () => { return (
    -