}) => {
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>;
@@ -14,7 +15,7 @@ export const ContractReadMethods = ({ deployedContractData }: { deployedContract
return (
<>
- {functionsToDisplay.map((fn, index) => (
+ {functionsToDisplay.map((fn: Types.MoveFunction, index: number) => (
diff --git a/packages/nextjs/app/debug/_components/contract/ContractUI.tsx b/packages/nextjs/app/debug/_components/contract/ContractUI.tsx
index f5ac02d..75946f4 100644
--- a/packages/nextjs/app/debug/_components/contract/ContractUI.tsx
+++ b/packages/nextjs/app/debug/_components/contract/ContractUI.tsx
@@ -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;
@@ -91,7 +91,8 @@ export const ContractUI = ({ contractName, className = "" }: ContractUIProps) =>
-
+ I disabled the Resources tab due to errors in the Vercel deployment, run the project locally to see it in action.
+ {/* */}
diff --git a/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx b/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx
index d5efb83..2088e6f 100644
--- a/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx
+++ b/packages/nextjs/app/debug/_components/contract/ContractWriteMethods.tsx
@@ -1,12 +1,13 @@
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 }) => {
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>;
@@ -14,7 +15,7 @@ export const ContractWriteMethods = ({ deployedContractData }: { deployedContrac
return (
<>
- {functionsToDisplay.map((fn, index) => (
+ {functionsToDisplay.map((fn: Types.MoveFunction, index: number) => (
diff --git a/packages/nextjs/app/debug/_components/contract/Tuple.tsx b/packages/nextjs/app/debug/_components/contract/Tuple.tsx
index 0e3175d..7f4745f 100644
--- a/packages/nextjs/app/debug/_components/contract/Tuple.tsx
+++ b/packages/nextjs/app/debug/_components/contract/Tuple.tsx
@@ -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;
diff --git a/packages/nextjs/app/debug/_components/contract/TupleArray.tsx b/packages/nextjs/app/debug/_components/contract/TupleArray.tsx
index 3fa9ac8..e1789d1 100644
--- a/packages/nextjs/app/debug/_components/contract/TupleArray.tsx
+++ b/packages/nextjs/app/debug/_components/contract/TupleArray.tsx
@@ -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 };
diff --git a/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx b/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx
index 764faeb..bbf84f7 100644
--- a/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx
+++ b/packages/nextjs/app/debug/_components/contract/TxReceipt.tsx
@@ -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);
diff --git a/packages/nextjs/app/debug/_components/contract/utilsContract.tsx b/packages/nextjs/app/debug/_components/contract/utilsContract.tsx
index 023efe8..05da2a2 100644
--- a/packages/nextjs/app/debug/_components/contract/utilsContract.tsx
+++ b/packages/nextjs/app/debug/_components/contract/utilsContract.tsx
@@ -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
diff --git a/packages/nextjs/app/debug/_components/contract/utilsDisplay.tsx b/packages/nextjs/app/debug/_components/contract/utilsDisplay.tsx
index fab99eb..71231ab 100644
--- a/packages/nextjs/app/debug/_components/contract/utilsDisplay.tsx
+++ b/packages/nextjs/app/debug/_components/contract/utilsDisplay.tsx
@@ -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
diff --git a/packages/nextjs/app/debug/page.tsx b/packages/nextjs/app/debug/page.tsx
index 267b3c6..f8a4a85 100644
--- a/packages/nextjs/app/debug/page.tsx
+++ b/packages/nextjs/app/debug/page.tsx
@@ -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",
diff --git a/packages/nextjs/app/layout.tsx b/packages/nextjs/app/layout.tsx
index 9c5daa1..8ac71f3 100644
--- a/packages/nextjs/app/layout.tsx
+++ b/packages/nextjs/app/layout.tsx
@@ -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",
diff --git a/packages/nextjs/components/scaffold-move/Address.tsx b/packages/nextjs/components/scaffold-move/Address.tsx
index 7f37b53..09c8336 100644
--- a/packages/nextjs/components/scaffold-move/Address.tsx
+++ b/packages/nextjs/components/scaffold-move/Address.tsx
@@ -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;
diff --git a/packages/nextjs/components/scaffold-move/CustomConnectButton/AddressInfoDropdown.tsx b/packages/nextjs/components/scaffold-move/CustomConnectButton/AddressInfoDropdown.tsx
index eb41d67..551872c 100644
--- a/packages/nextjs/components/scaffold-move/CustomConnectButton/AddressInfoDropdown.tsx
+++ b/packages/nextjs/components/scaffold-move/CustomConnectButton/AddressInfoDropdown.tsx
@@ -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();
diff --git a/packages/nextjs/components/scaffold-move/CustomConnectButton/NetworkOptions.tsx b/packages/nextjs/components/scaffold-move/CustomConnectButton/NetworkOptions.tsx
index f73b1d5..348fc23 100644
--- a/packages/nextjs/components/scaffold-move/CustomConnectButton/NetworkOptions.tsx
+++ b/packages/nextjs/components/scaffold-move/CustomConnectButton/NetworkOptions.tsx
@@ -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();
diff --git a/packages/nextjs/components/scaffold-move/CustomConnectButton/index.tsx b/packages/nextjs/components/scaffold-move/CustomConnectButton/index.tsx
index 0a87f50..546ac3c 100644
--- a/packages/nextjs/components/scaffold-move/CustomConnectButton/index.tsx
+++ b/packages/nextjs/components/scaffold-move/CustomConnectButton/index.tsx
@@ -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();
diff --git a/packages/nextjs/contracts/deployedModules.ts b/packages/nextjs/contracts/deployedModules.ts
index 7dfc423..59fc3c7 100644
--- a/packages/nextjs/contracts/deployedModules.ts
+++ b/packages/nextjs/contracts/deployedModules.ts
@@ -17,4 +17,5 @@ const deployedContracts = {
}
} as const;
-export default deployedContracts satisfies GenericContractsDeclaration;
\ No newline at end of file
+export default deployedContracts;
+// satisfies GenericContractsDeclaration;
\ No newline at end of file
diff --git a/packages/nextjs/contracts/externalModules.ts b/packages/nextjs/contracts/externalModules.ts
index 7fd196a..3ef2354 100644
--- a/packages/nextjs/contracts/externalModules.ts
+++ b/packages/nextjs/contracts/externalModules.ts
@@ -9,4 +9,5 @@ const externalContracts = {
}
} as const;
-export default externalContracts satisfies GenericContractsDeclaration;
\ No newline at end of file
+export default externalContracts;
+// satisfies GenericContractsDeclaration;
\ No newline at end of file
diff --git a/packages/nextjs/services/web3/wagmiConnectors.tsx b/packages/nextjs/services/web3/wagmiConnectors.tsx
deleted file mode 100644
index 3edca69..0000000
--- a/packages/nextjs/services/web3/wagmiConnectors.tsx
+++ /dev/null
@@ -1,43 +0,0 @@
-import { connectorsForWallets } from "@rainbow-me/rainbowkit";
-import {
- coinbaseWallet,
- ledgerWallet,
- metaMaskWallet,
- rainbowWallet,
- safeWallet,
- walletConnectWallet,
-} from "@rainbow-me/rainbowkit/wallets";
-import { rainbowkitBurnerWallet } from "burner-connector";
-import * as chains from "viem/chains";
-import scaffoldConfig from "~~/scaffold.config";
-
-const { onlyLocalBurnerWallet, targetNetworks } = scaffoldConfig;
-
-const wallets = [
- metaMaskWallet,
- walletConnectWallet,
- ledgerWallet,
- coinbaseWallet,
- rainbowWallet,
- safeWallet,
- ...(!targetNetworks.some(network => network.id !== (chains.hardhat as chains.Chain).id) || !onlyLocalBurnerWallet
- ? [rainbowkitBurnerWallet]
- : []),
-];
-
-/**
- * wagmi connectors for the wagmi context
- */
-export const wagmiConnectors = connectorsForWallets(
- [
- {
- groupName: "Supported Wallets",
- wallets,
- },
- ],
-
- {
- appName: "scaffold-eth-2",
- projectId: "TODO: DELETE",
- },
-);
diff --git a/packages/nextjs/utils/scaffold-eth/block.ts b/packages/nextjs/utils/scaffold-eth/block.ts
deleted file mode 100644
index 19e8c9f..0000000
--- a/packages/nextjs/utils/scaffold-eth/block.ts
+++ /dev/null
@@ -1,17 +0,0 @@
-import { Block, Transaction, TransactionReceipt } from "viem";
-
-export type TransactionWithFunction = Transaction & {
- functionName?: string;
- functionArgs?: any[];
- functionArgNames?: string[];
- functionArgTypes?: string[];
-};
-
-type TransactionReceipts = {
- [key: string]: TransactionReceipt;
-};
-
-export type TransactionsTableProps = {
- blocks: Block[];
- transactionReceipts: TransactionReceipts;
-};
diff --git a/packages/nextjs/utils/scaffold-eth/contract.ts b/packages/nextjs/utils/scaffold-eth/contract.ts
deleted file mode 100644
index b8ea655..0000000
--- a/packages/nextjs/utils/scaffold-eth/contract.ts
+++ /dev/null
@@ -1,316 +0,0 @@
-import { MutateOptions } from "@tanstack/react-query";
-import {
- Abi,
- AbiParameter,
- AbiParameterToPrimitiveType,
- AbiParametersToPrimitiveTypes,
- ExtractAbiEvent,
- ExtractAbiEventNames,
- ExtractAbiFunction,
-} from "abitype";
-import type { ExtractAbiFunctionNames } from "abitype";
-import type { Simplify } from "type-fest";
-import type { MergeDeepRecord } from "type-fest/source/merge-deep";
-import {
- Address,
- Block,
- GetEventArgs,
- GetTransactionReceiptReturnType,
- GetTransactionReturnType,
- Log,
- TransactionReceipt,
- WriteContractErrorType,
-} from "viem";
-import { Config, UseReadContractParameters, UseWatchContractEventParameters } from "wagmi";
-import { WriteContractParameters, WriteContractReturnType } from "wagmi/actions";
-import { WriteContractVariables } from "wagmi/query";
-import deployedContractsData from "~~/contracts/deployedModules";
-import externalContractsData from "~~/contracts/externalModules";
-import scaffoldConfig from "~~/scaffold.config";
-
-type AddExternalFlag = {
- [ChainId in keyof T]: {
- [ContractName in keyof T[ChainId]]: T[ChainId][ContractName] & { external?: true };
- };
-};
-
-const deepMergeContracts = , E extends Record>(
- local: L,
- external: E,
-) => {
- const result: Record = {};
- const allKeys = Array.from(new Set([...Object.keys(external), ...Object.keys(local)]));
- for (const key of allKeys) {
- if (!external[key]) {
- result[key] = local[key];
- continue;
- }
- const amendedExternal = Object.fromEntries(
- Object.entries(external[key] as Record>).map(([contractName, declaration]) => [
- contractName,
- { ...declaration, external: true },
- ]),
- );
- result[key] = { ...local[key], ...amendedExternal };
- }
- return result as MergeDeepRecord, AddExternalFlag, { arrayMergeMode: "replace" }>;
-};
-
-const contractsData = deepMergeContracts(deployedContractsData, externalContractsData);
-
-export type InheritedFunctions = { readonly [key: string]: string };
-
-export type GenericContract = {
- address: Address;
- abi: Abi;
- inheritedFunctions?: InheritedFunctions;
- external?: true;
-};
-
-export type GenericContractsDeclaration = {
- [chainId: number]: {
- [contractName: string]: GenericContract;
- };
-};
-
-export const contracts = contractsData as GenericContractsDeclaration | null;
-
-type ConfiguredChainId = (typeof scaffoldConfig)["targetNetworks"][0]["id"];
-
-type IsContractDeclarationMissing = typeof contractsData extends { [key in ConfiguredChainId]: any }
- ? TNo
- : TYes;
-
-type ContractsDeclaration = IsContractDeclarationMissing;
-
-type Contracts = ContractsDeclaration[ConfiguredChainId];
-
-export type ContractName = keyof Contracts;
-
-export type Contract = Contracts[TContractName];
-
-type InferContractAbi = TContract extends { abi: infer TAbi } ? TAbi : never;
-
-export type ContractAbi = InferContractAbi>;
-
-export type AbiFunctionInputs = ExtractAbiFunction<
- TAbi,
- TFunctionName
->["inputs"];
-
-export type AbiFunctionArguments = AbiParametersToPrimitiveTypes<
- AbiFunctionInputs
->;
-
-export type AbiFunctionOutputs = ExtractAbiFunction<
- TAbi,
- TFunctionName
->["outputs"];
-
-export type AbiFunctionReturnType = IsContractDeclarationMissing<
- any,
- AbiParametersToPrimitiveTypes> extends readonly [any]
- ? AbiParametersToPrimitiveTypes>[0]
- : AbiParametersToPrimitiveTypes>
->;
-
-export type AbiEventInputs> = ExtractAbiEvent<
- TAbi,
- TEventName
->["inputs"];
-
-export enum ContractCodeStatus {
- "LOADING",
- "DEPLOYED",
- "NOT_FOUND",
-}
-
-type AbiStateMutability = "pure" | "view" | "nonpayable" | "payable";
-export type ReadAbiStateMutability = "view" | "pure";
-export type WriteAbiStateMutability = "nonpayable" | "payable";
-
-export type FunctionNamesWithInputs<
- TContractName extends ContractName,
- TAbiStateMutibility extends AbiStateMutability = AbiStateMutability,
-> = Exclude<
- Extract<
- ContractAbi[number],
- {
- type: "function";
- stateMutability: TAbiStateMutibility;
- }
- >,
- {
- inputs: readonly [];
- }
->["name"];
-
-type Expand = T extends object ? (T extends infer O ? { [K in keyof O]: O[K] } : never) : T;
-
-type UnionToIntersection = Expand<(U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never>;
-
-type OptionalTupple = T extends readonly [infer H, ...infer R] ? readonly [H | undefined, ...OptionalTupple] : T;
-
-type UseScaffoldArgsParam<
- TContractName extends ContractName,
- TFunctionName extends ExtractAbiFunctionNames>,
-> =
- TFunctionName extends FunctionNamesWithInputs
- ? {
- args: OptionalTupple, TFunctionName>>>;
- value?: ExtractAbiFunction, TFunctionName>["stateMutability"] extends "payable"
- ? bigint | undefined
- : undefined;
- }
- : {
- args?: never;
- };
-
-export type UseScaffoldReadConfig<
- TContractName extends ContractName,
- TFunctionName extends ExtractAbiFunctionNames, ReadAbiStateMutability>,
-> = {
- contractName: TContractName;
- watch?: boolean;
-} & IsContractDeclarationMissing<
- Partial,
- {
- functionName: TFunctionName;
- } & UseScaffoldArgsParam &
- Omit
->;
-
-export type ScaffoldWriteContractVariables<
- TContractName extends ContractName,
- TFunctionName extends ExtractAbiFunctionNames, WriteAbiStateMutability>,
-> = IsContractDeclarationMissing<
- Partial,
- {
- functionName: TFunctionName;
- } & UseScaffoldArgsParam &
- Omit
->;
-
-type WriteVariables = WriteContractVariables;
-
-export type TransactorFuncOptions = {
- onBlockConfirmation?: (txnReceipt: TransactionReceipt) => void;
- blockConfirmations?: number;
-};
-
-export type ScaffoldWriteContractOptions = MutateOptions<
- WriteContractReturnType,
- WriteContractErrorType,
- WriteVariables,
- unknown
-> &
- TransactorFuncOptions;
-
-export type UseScaffoldEventConfig<
- TContractName extends ContractName,
- TEventName extends ExtractAbiEventNames>,
- TEvent extends ExtractAbiEvent, TEventName> = ExtractAbiEvent<
- ContractAbi,
- TEventName
- >,
-> = {
- contractName: TContractName;
- eventName: TEventName;
-} & IsContractDeclarationMissing<
- Omit & {
- onLogs: (
- logs: Simplify<
- Omit, "args" | "eventName"> & {
- args: Record;
- eventName: string;
- }
- >[],
- ) => void;
- },
- Omit>, "onLogs" | "address" | "abi" | "eventName"> & {
- onLogs: (
- logs: Simplify<
- Omit, "args"> & {
- args: AbiParametersToPrimitiveTypes &
- GetEventArgs<
- ContractAbi,
- TEventName,
- {
- IndexedOnly: false;
- }
- >;
- }
- >[],
- ) => void;
- }
->;
-
-type IndexedEventInputs<
- TContractName extends ContractName,
- TEventName extends ExtractAbiEventNames>,
-> = Extract, TEventName>[number], { indexed: true }>;
-
-export type EventFilters<
- TContractName extends ContractName,
- TEventName extends ExtractAbiEventNames>,
-> = IsContractDeclarationMissing<
- any,
- IndexedEventInputs extends never
- ? never
- : {
- [Key in IsContractDeclarationMissing<
- any,
- IndexedEventInputs["name"]
- >]?: AbiParameterToPrimitiveType, { name: Key }>>;
- }
->;
-
-export type UseScaffoldEventHistoryConfig<
- TContractName extends ContractName,
- TEventName extends ExtractAbiEventNames>,
- TBlockData extends boolean = false,
- TTransactionData extends boolean = false,
- TReceiptData extends boolean = false,
-> = {
- contractName: TContractName;
- eventName: IsContractDeclarationMissing;
- fromBlock: bigint;
- filters?: EventFilters;
- blockData?: TBlockData;
- transactionData?: TTransactionData;
- receiptData?: TReceiptData;
- watch?: boolean;
- enabled?: boolean;
-};
-
-export type UseScaffoldEventHistoryData<
- TContractName extends ContractName,
- TEventName extends ExtractAbiEventNames>,
- TBlockData extends boolean = false,
- TTransactionData extends boolean = false,
- TReceiptData extends boolean = false,
- TEvent extends ExtractAbiEvent, TEventName> = ExtractAbiEvent<
- ContractAbi,
- TEventName
- >,
-> =
- | IsContractDeclarationMissing<
- any[],
- {
- log: Log;
- args: AbiParametersToPrimitiveTypes &
- GetEventArgs<
- ContractAbi,
- TEventName,
- {
- IndexedOnly: false;
- }
- >;
- block: TBlockData extends true ? Block : null;
- receipt: TReceiptData extends true ? GetTransactionReturnType : null;
- transaction: TTransactionData extends true ? GetTransactionReceiptReturnType : null;
- }[]
- >
- | undefined;
-
-export type AbiParameterTuple = Extract;
diff --git a/packages/nextjs/utils/scaffold-eth/contractsData.ts b/packages/nextjs/utils/scaffold-eth/contractsData.ts
deleted file mode 100644
index 84d4278..0000000
--- a/packages/nextjs/utils/scaffold-eth/contractsData.ts
+++ /dev/null
@@ -1,7 +0,0 @@
-import scaffoldConfig from "~~/scaffold.config";
-import { contracts } from "~~/utils/scaffold-eth/contract";
-
-export function getAllContracts() {
- const contractsData = contracts?.[scaffoldConfig.targetNetworks[0].id];
- return contractsData ? contractsData : {};
-}
diff --git a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts b/packages/nextjs/utils/scaffold-eth/decodeTxData.ts
deleted file mode 100644
index 5b9a3b8..0000000
--- a/packages/nextjs/utils/scaffold-eth/decodeTxData.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import { TransactionWithFunction } from "./block";
-import { GenericContractsDeclaration } from "./contract";
-import { Abi, AbiFunction, decodeFunctionData, getAbiItem } from "viem";
-import { hardhat } from "viem/chains";
-import contractData from "~~/contracts/deployedModules";
-
-type ContractsInterfaces = Record;
-type TransactionType = TransactionWithFunction | null;
-
-const deployedContracts = contractData as GenericContractsDeclaration | null;
-const chainMetaData = deployedContracts?.[hardhat.id];
-const interfaces = chainMetaData
- ? Object.entries(chainMetaData).reduce((finalInterfacesObj, [contractName, contract]) => {
- finalInterfacesObj[contractName] = contract.abi;
- return finalInterfacesObj;
- }, {} as ContractsInterfaces)
- : {};
-
-export const decodeTransactionData = (tx: TransactionWithFunction) => {
- if (tx.input.length >= 10 && !tx.input.startsWith("0x60e06040")) {
- for (const [, contractAbi] of Object.entries(interfaces)) {
- try {
- const { functionName, args } = decodeFunctionData({
- abi: contractAbi,
- data: tx.input,
- });
- tx.functionName = functionName;
- tx.functionArgs = args as any[];
- tx.functionArgNames = getAbiItem({
- abi: contractAbi as AbiFunction[],
- name: functionName,
- })?.inputs?.map((input: any) => input.name);
- tx.functionArgTypes = getAbiItem({
- abi: contractAbi as AbiFunction[],
- name: functionName,
- })?.inputs.map((input: any) => input.type);
-
- break;
- } catch (e) {
- console.error(`Parsing failed: ${e}`);
- }
- }
- }
- return tx;
-};
-
-export const getFunctionDetails = (transaction: TransactionType) => {
- if (
- transaction &&
- transaction.functionName &&
- transaction.functionArgNames &&
- transaction.functionArgTypes &&
- transaction.functionArgs
- ) {
- const details = transaction.functionArgNames.map(
- (name, i) => `${transaction.functionArgTypes?.[i] || ""} ${name} = ${transaction.functionArgs?.[i] ?? ""}`,
- );
- return `${transaction.functionName}(${details.join(", ")})`;
- }
- return "";
-};
diff --git a/packages/nextjs/utils/scaffold-eth/common.ts b/packages/nextjs/utils/scaffold-move/common.ts
similarity index 100%
rename from packages/nextjs/utils/scaffold-eth/common.ts
rename to packages/nextjs/utils/scaffold-move/common.ts
diff --git a/packages/nextjs/utils/scaffold-move/contract.ts b/packages/nextjs/utils/scaffold-move/contract.ts
index 546fbae..174737a 100644
--- a/packages/nextjs/utils/scaffold-move/contract.ts
+++ b/packages/nextjs/utils/scaffold-move/contract.ts
@@ -3,6 +3,9 @@ import type { MergeDeepRecord } from "type-fest/source/merge-deep";
import deployedContractsData from "~~/contracts/deployedModules";
import externalContractsData from "~~/contracts/externalModules";
import scaffoldConfig from "~~/scaffold.config";
+import {
+ AbiParameter
+} from "abitype";
type AddExternalFlag = {
[ChainId in keyof T]: {
@@ -34,29 +37,6 @@ const deepMergeContracts = , E extends Record
const contractsData = deepMergeContracts(deployedContractsData, externalContractsData);
-type MoveFunction = {
- name: string;
- visibility: string;
- is_entry: boolean;
- is_view: boolean;
- generic_type_params: any[];
- params: string[];
- return: string[];
-};
-
-type MoveStructField = {
- name: string;
- type: string;
-};
-
-type MoveStruct = {
- name: string;
- is_native: boolean;
- abilities: string[];
- generic_type_params: any[];
- fields: MoveStructField[];
-};
-
export type GenericContract = {
bytecode: string;
abi?: GenericContractAbi;
@@ -67,8 +47,8 @@ export type GenericContractAbi = {
address: string; // TODO: address type
name: string;
friends: string[]; //TODO: check which type?
- exposed_functions: MoveFunction[];
- structs: MoveStruct[];
+ exposed_functions: Types.MoveFunction[];
+ structs: Types.MoveStruct[];
};
export type GenericContractsDeclaration = {
[chainId: string]: {
@@ -86,7 +66,7 @@ type IsContractDeclarationMissing = typeof contractsData extends { [k
type ContractsDeclaration = IsContractDeclarationMissing;
-type Contracts = ContractsDeclaration[ConfiguredChainId];
+type Contracts = ContractsDeclaration["devnet"];
export type ContractName = keyof Contracts;
export type Contract = Contracts[TContractName];
@@ -96,3 +76,5 @@ export enum ContractCodeStatus {
"DEPLOYED",
"NOT_FOUND",
}
+
+export type AbiParameterTuple = Extract;
diff --git a/packages/nextjs/utils/scaffold-eth/getMetadata.ts b/packages/nextjs/utils/scaffold-move/getMetadata.ts
similarity index 100%
rename from packages/nextjs/utils/scaffold-eth/getMetadata.ts
rename to packages/nextjs/utils/scaffold-move/getMetadata.ts
diff --git a/packages/nextjs/utils/scaffold-eth/getParsedError.ts b/packages/nextjs/utils/scaffold-move/getParsedError.ts
similarity index 100%
rename from packages/nextjs/utils/scaffold-eth/getParsedError.ts
rename to packages/nextjs/utils/scaffold-move/getParsedError.ts
diff --git a/packages/nextjs/utils/scaffold-eth/index.ts b/packages/nextjs/utils/scaffold-move/index.ts
similarity index 62%
rename from packages/nextjs/utils/scaffold-eth/index.ts
rename to packages/nextjs/utils/scaffold-move/index.ts
index 0dc6a27..971d7cf 100644
--- a/packages/nextjs/utils/scaffold-eth/index.ts
+++ b/packages/nextjs/utils/scaffold-move/index.ts
@@ -1,5 +1,3 @@
export * from "./networks";
export * from "./notification";
-export * from "./block";
-export * from "./decodeTxData";
export * from "./getParsedError";
diff --git a/packages/nextjs/utils/scaffold-eth/networks.ts b/packages/nextjs/utils/scaffold-move/networks.ts
similarity index 100%
rename from packages/nextjs/utils/scaffold-eth/networks.ts
rename to packages/nextjs/utils/scaffold-move/networks.ts
diff --git a/packages/nextjs/utils/scaffold-eth/notification.tsx b/packages/nextjs/utils/scaffold-move/notification.tsx
similarity index 100%
rename from packages/nextjs/utils/scaffold-eth/notification.tsx
rename to packages/nextjs/utils/scaffold-move/notification.tsx