Skip to content

Commit

Permalink
removing many unused eth utils
Browse files Browse the repository at this point in the history
  • Loading branch information
arjanjohan committed Jul 9, 2024
1 parent a1218da commit 6ef3857
Show file tree
Hide file tree
Showing 31 changed files with 40 additions and 502 deletions.
3 changes: 0 additions & 3 deletions packages/nextjs/app/bio/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { InputTransactionData, useWallet } from "@aptos-labs/wallet-adapter-reac
import type { NextPage } from "next";
import { InputBase } from "~~/components/scaffold-eth";
import deployedModules from "~~/contracts/deployedModules";
import { useGetAccountModules } from "~~/hooks/scaffold-move/useGetAccountModules";
import useSubmitTransaction from "~~/hooks/scaffold-move/useSubmitTransaction";
import { aptosClient } from "~~/utils/scaffold-move/aptosClient";

Expand All @@ -23,8 +22,6 @@ const OnchainBio: NextPage = () => {
const [currentName, setCurrentName] = useState(null);
const [currentBio, setCurrentBio] = useState(null);

const { data, isLoading, error } = useGetAccountModules(ONCHAIN_BIO.address);

const { submitTransaction, transactionResponse, transactionInProcess } = useSubmitTransaction();

const fetchBio = async () => {
Expand Down
10 changes: 5 additions & 5 deletions packages/nextjs/app/debug/_components/DebugContracts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useEffect } from "react";
import { useLocalStorage } from "usehooks-ts";
import { BarsArrowUpIcon } from "@heroicons/react/20/solid";
import { ContractUI } from "~~/app/debug/_components/contract";
import { ContractName } from "~~/utils/scaffold-eth/contract";
import { ContractName } from "~~/utils/scaffold-move/contract";
import { getAllContracts } from "~~/utils/scaffold-move/contractsData";

const contractsData = getAllContracts();
Expand Down Expand Up @@ -40,11 +40,11 @@ export function DebugContracts() {
? "bg-base-300 hover:bg-base-300 no-animation"
: "bg-base-100 hover:bg-secondary"
}`}
key={contractName}
key={contractName as string}
onClick={() => setSelectedContract(contractName)}
>
{contractName}
{contractsData[contractName].external && (
{contractName as string}
{contractsData[contractName as string].external && (
<span className="tooltip tooltip-top tooltip-accent" data-tip="External contract">
<BarsArrowUpIcon className="h-4 w-4 cursor-pointer" />
</span>
Expand All @@ -55,7 +55,7 @@ export function DebugContracts() {
)}
{contractNames.map(contractName => (
<ContractUI
key={contractName}
key={contractName as string}
contractName={contractName}
className={contractName === selectedContract ? "" : "hidden"}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
IntegerInput,
IntegerVariant,
} from "~~/components/scaffold-eth";
import { AbiParameterTuple } from "~~/utils/scaffold-eth/contract";
import { AbiParameterTuple } from "~~/utils/scaffold-move/contract";

type ContractInputProps = {
setForm: Dispatch<SetStateAction<Record<string, any>>>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { FunctionForm } from "~~/app/debug/_components/contract";
import { Contract, ContractName } from "~~/utils/scaffold-move/contract";
import { Types } from "aptos";

export const ContractReadMethods = ({ deployedContractData }: { deployedContractData: Contract<ContractName> }) => {
if (!deployedContractData || deployedContractData.abi === undefined) {
return null;
}

const functionsToDisplay = deployedContractData.abi.exposed_functions.filter(fn => fn.is_view);
const functionsToDisplay = deployedContractData.abi.exposed_functions.filter((fn: Types.MoveFunction) => fn.is_view);

if (!functionsToDisplay.length) {
return <>No view functions</>;
}

return (
<>
{functionsToDisplay.map((fn, index) => (
{functionsToDisplay.map((fn: Types.MoveFunction, index: number) => (
<div key={index}>
<FunctionForm key={index} module={deployedContractData.abi!} fn={fn} write={false} />
</div>
Expand Down
5 changes: 3 additions & 2 deletions packages/nextjs/app/debug/_components/contract/ContractUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { ModuleResources } from "./ModuleResources";
import { Address, Balance } from "~~/components/scaffold-move";
import { useDeployedContractInfo } from "~~/hooks/scaffold-move";
import { useTargetNetwork } from "~~/hooks/scaffold-move/useTargetNetwork";
import { ContractName } from "~~/utils/scaffold-eth/contract";
import { ContractName } from "~~/utils/scaffold-move/contract";

type ContractUIProps = {
contractName: ContractName;
Expand Down Expand Up @@ -91,7 +91,8 @@ export const ContractUI = ({ contractName, className = "" }: ContractUIProps) =>
</div>
</div>
<div className="p-5 divide-y divide-base-300">
<ModuleResources deployedContractData={deployedContractData} />
I disabled the Resources tab due to errors in the Vercel deployment, run the project locally to see it in action.
{/* <ModuleResources deployedContractData={deployedContractData} /> */}
</div>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { FunctionForm } from "~~/app/debug/_components/contract";
import { Contract, ContractName } from "~~/utils/scaffold-move/contract";
import { Types } from "aptos";

export const ContractWriteMethods = ({ deployedContractData }: { deployedContractData: Contract<ContractName> }) => {
if (!deployedContractData || deployedContractData.abi === undefined) {
return null;
}

const functionsToDisplay = deployedContractData.abi.exposed_functions.filter(fn => fn.is_entry);
const functionsToDisplay = deployedContractData.abi.exposed_functions.filter((fn : Types.MoveFunction) => fn.is_entry);

if (!functionsToDisplay.length) {
return <>No write functions</>;
}

return (
<>
{functionsToDisplay.map((fn, index) => (
{functionsToDisplay.map((fn: Types.MoveFunction, index: number) => (
<div key={index}>
<FunctionForm key={index} module={deployedContractData.abi!} fn={fn} write={true} />
</div>
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/app/debug/_components/contract/Tuple.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import { ContractInput } from "./ContractInput";
import { getFunctionInputKey, getInitalTupleFormState } from "./utilsContract";
import { replacer } from "~~/utils/scaffold-eth/common";
import { AbiParameterTuple } from "~~/utils/scaffold-eth/contract";
import { replacer } from "~~/utils/scaffold-move/common";
import { AbiParameterTuple } from "~~/utils/scaffold-move/contract";

type TupleProps = {
abiTupleParameter: AbiParameterTuple;
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/app/debug/_components/contract/TupleArray.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Dispatch, SetStateAction, useEffect, useState } from "react";
import { ContractInput } from "./ContractInput";
import { getFunctionInputKey, getInitalTupleArrayFormState } from "./utilsContract";
import { replacer } from "~~/utils/scaffold-eth/common";
import { AbiParameterTuple } from "~~/utils/scaffold-eth/contract";
import { replacer } from "~~/utils/scaffold-move/common";
import { AbiParameterTuple } from "~~/utils/scaffold-move/contract";

type TupleArrayProps = {
abiTupleParameter: AbiParameterTuple & { isVirtual?: true };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard";
import { TransactionReceipt } from "viem";
import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline";
import { ObjectFieldDisplay } from "~~/app/debug/_components/contract";
import { replacer } from "~~/utils/scaffold-eth/common";
import { replacer } from "~~/utils/scaffold-move/common";

export const TxReceipt = ({ txResult }: { txResult: TransactionReceipt }) => {
const [txResultCopied, setTxResultCopied] = useState(false);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AbiFunction, AbiParameter } from "abitype";
import { AbiParameterTuple } from "~~/utils/scaffold-eth/contract";
import { AbiParameterTuple } from "~~/utils/scaffold-move/contract";

/**
* Generates a key based on function metadata
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ReactElement, useState } from "react";
import { TransactionBase, TransactionReceipt, formatEther, isAddress, isHex } from "viem";
import { ArrowsRightLeftIcon } from "@heroicons/react/24/solid";
import { Address } from "~~/components/scaffold-move";
import { replacer } from "~~/utils/scaffold-eth/common";
import { replacer } from "~~/utils/scaffold-move/common";

type DisplayContent =
| string
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/debug/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DebugContracts } from "./_components/DebugContracts";
import type { NextPage } from "next";
import { getMetadata } from "~~/utils/scaffold-eth/getMetadata";
import { getMetadata } from "~~/utils/scaffold-move/getMetadata";

export const metadata = getMetadata({
title: "Debug Contracts",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import "@rainbow-me/rainbowkit/styles.css";
import { ScaffoldEthAppWithProviders } from "~~/components/ScaffoldEthAppWithProviders";
import { ThemeProvider } from "~~/components/ThemeProvider";
import "~~/styles/globals.css";
import { getMetadata } from "~~/utils/scaffold-eth/getMetadata";
import { getMetadata } from "~~/utils/scaffold-move/getMetadata";

export const metadata = getMetadata({
title: "Scaffold-Move App",
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/components/scaffold-move/Address.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CopyToClipboard } from "react-copy-to-clipboard";
import { CheckCircleIcon, DocumentDuplicateIcon } from "@heroicons/react/24/outline";
import { BlockieAvatar } from "~~/components/scaffold-move";
import { useTargetNetwork } from "~~/hooks/scaffold-move/useTargetNetwork";
import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth";
import { getBlockExplorerAddressLink } from "~~/utils/scaffold-move";

type AddressProps = {
address?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import {
} from "@heroicons/react/24/outline";
import { BlockieAvatar, isENS } from "~~/components/scaffold-move";
import { useOutsideClick } from "~~/hooks/scaffold-move";
import { getTargetNetworks } from "~~/utils/scaffold-eth";
import { getTargetNetworks } from "~~/utils/scaffold-move";

const allowedNetworks = getTargetNetworks();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ArrowsRightLeftIcon } from "@heroicons/react/24/solid";
import { getTargetNetworks } from "~~/utils/scaffold-eth";
import { getTargetNetworks } from "~~/utils/scaffold-move";

const allowedNetworks = getTargetNetworks();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { WalletSelector } from "@aptos-labs/wallet-adapter-ant-design";
import { useWallet } from "@aptos-labs/wallet-adapter-react";
// import { WrongNetworkDropdown } from "./WrongNetworkDropdown";
import { useTargetNetwork } from "~~/hooks/scaffold-move/useTargetNetwork";
import { getBlockExplorerAddressLink } from "~~/utils/scaffold-eth";
import { getBlockExplorerAddressLink } from "~~/utils/scaffold-move";

export const CustomConnectButton = () => {
const { targetNetwork } = useTargetNetwork();
Expand Down
3 changes: 2 additions & 1 deletion packages/nextjs/contracts/deployedModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,5 @@ const deployedContracts = {
}
} as const;

export default deployedContracts satisfies GenericContractsDeclaration;
export default deployedContracts;
// satisfies GenericContractsDeclaration;
3 changes: 2 additions & 1 deletion packages/nextjs/contracts/externalModules.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ const externalContracts = {
}
} as const;

export default externalContracts satisfies GenericContractsDeclaration;
export default externalContracts;
// satisfies GenericContractsDeclaration;
43 changes: 0 additions & 43 deletions packages/nextjs/services/web3/wagmiConnectors.tsx

This file was deleted.

17 changes: 0 additions & 17 deletions packages/nextjs/utils/scaffold-eth/block.ts

This file was deleted.

Loading

0 comments on commit 6ef3857

Please sign in to comment.