Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into beta
Browse files Browse the repository at this point in the history
  • Loading branch information
technophile-04 committed Feb 11, 2025
2 parents 9cc5a64 + b1858cc commit 47ccc6f
Show file tree
Hide file tree
Showing 10 changed files with 26 additions and 27 deletions.
5 changes: 0 additions & 5 deletions .changeset/chatty-mugs-allow.md

This file was deleted.

10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# create-eth

## 0.1.2

### Patch Changes

- e399485: cli: allow projectName as path while initlializing the cli
- 6318c91: - fix typo in package.json scripts for lint
- Add `hardhat:clean` command to root of monorepo (https://github.com/scaffold-eth/scaffold-eth-2/pull/1043)
- Only render FaucetButton on localhost (https://github.com/scaffold-eth/scaffold-eth-2/pull/1047)
- fix: remove indexed event params (https://github.com/scaffold-eth/scaffold-eth-2/pull/1048)

## 0.1.1

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "create-eth",
"version": "0.1.1",
"version": "0.1.2",
"description": "Create a Scaffold-ETH-2 app",
"repository": {
"type": "git",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import React, { useCallback, useRef, useState } from "react";
import Image from "next/image";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { hardhat } from "viem/chains";
import { Bars3Icon, BugAntIcon } from "@heroicons/react/24/outline";
import { FaucetButton, RainbowKitCustomConnectButton } from "~~/components/scaffold-eth";
import { useOutsideClick } from "~~/hooks/scaffold-eth";
import { useOutsideClick, useTargetNetwork } from "~~/hooks/scaffold-eth";
${menuIconImports.filter(Boolean).join("\n")}
type HeaderMenuLink = {
Expand Down Expand Up @@ -62,6 +63,9 @@ export const HeaderMenuLinks = () => {
* Site header
*/
export const Header = () => {
const { targetNetwork } = useTargetNetwork();
const isLocalNetwork = targetNetwork.id === hardhat.id;
const [isDrawerOpen, setIsDrawerOpen] = useState(false);
const burgerMenuRef = useRef<HTMLDivElement>(null);
useOutsideClick(
Expand Down Expand Up @@ -109,7 +113,7 @@ export const Header = () => {
</div>
<div className="navbar-end flex-grow mr-4">
<RainbowKitCustomConnectButton />
<FaucetButton />
{isLocalNetwork && <FaucetButton />}
</div>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,7 @@ export const useScaffoldEventHistory = <
return nextBlock;
},
select: data => {
const events = data.pages.flat();
const eventHistoryData = events?.map(addIndexedArgsToEvent) as UseScaffoldEventHistoryData<
const events = data.pages.flat() as unknown as UseScaffoldEventHistoryData<
TContractName,
TEventName,
TBlockData,
Expand All @@ -152,7 +151,7 @@ export const useScaffoldEventHistory = <
>;

return {
pages: eventHistoryData?.reverse(),
pages: events?.reverse(),
pageParams: data.pageParams,
};
},
Expand Down Expand Up @@ -180,11 +179,3 @@ export const useScaffoldEventHistory = <
refetch: query.refetch,
};
};

export const addIndexedArgsToEvent = (event: any) => {
if (event.args && !Array.isArray(event.args)) {
return { ...event, args: { ...event.args, ...Object.values(event.args) } };
}

return event;
};
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Abi, ExtractAbiEventNames } from "abitype";
import { Log } from "viem";
import { useWatchContractEvent } from "wagmi";
import { useSelectedNetwork } from "~~/hooks/scaffold-eth";
import { addIndexedArgsToEvent, useDeployedContractInfo } from "~~/hooks/scaffold-eth";
import { useDeployedContractInfo } from "~~/hooks/scaffold-eth";
import { AllowedChainIds } from "~~/utils/scaffold-eth";
import { ContractAbi, ContractName, UseScaffoldEventConfig } from "~~/utils/scaffold-eth/contract";

Expand Down Expand Up @@ -30,14 +30,11 @@ export const useScaffoldWatchContractEvent = <
chainId: selectedNetwork.id as AllowedChainIds,
});

const addIndexedArgsToLogs = (logs: Log[]) => logs.map(addIndexedArgsToEvent);
const listenerWithIndexedArgs = (logs: Log[]) => onLogs(addIndexedArgsToLogs(logs) as Parameters<typeof onLogs>[0]);

return useWatchContractEvent({
address: deployedContractData?.address,
abi: deployedContractData?.abi as Abi,
chainId: selectedNetwork.id,
onLogs: listenerWithIndexedArgs,
onLogs: (logs: Log[]) => onLogs(logs as Parameters<typeof onLogs>[0]),
eventName,
});
};
2 changes: 1 addition & 1 deletion templates/solidity-frameworks/foundry/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"foundry:test": "yarn workspace @se-2/foundry test",
"foundry:verify": "yarn workspace @se-2/foundry verify",
"generate": "yarn foundry:generate",
"lint": "yarn nextjs:lint && yarn foundry:lint",
"lint": "yarn next:lint && yarn foundry:lint",
"test": "yarn foundry:test",
"verify": "yarn foundry:verify"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ format:
# Lint code
lint:
forge fmt --check && prettier --check ./script/**/*.js
forge fmt --check && prettier --check ./scripts-js/**/*.js
# Verify contracts
verify:
Expand Down
3 changes: 2 additions & 1 deletion templates/solidity-frameworks/hardhat/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"hardhat:account": "yarn workspace @se-2/hardhat account",
"hardhat:chain": "yarn workspace @se-2/hardhat chain",
"hardhat:check-types": "yarn workspace @se-2/hardhat check-types",
"hardhat:clean": "yarn workspace @se-2/hardhat clean",
"hardhat:compile": "yarn workspace @se-2/hardhat compile",
"hardhat:deploy": "yarn workspace @se-2/hardhat deploy",
"hardhat:flatten": "yarn workspace @se-2/hardhat flatten",
Expand All @@ -23,7 +24,7 @@
"hardhat:lint-staged": "yarn workspace @se-2/hardhat lint-staged",
"hardhat:test": "yarn workspace @se-2/hardhat test",
"hardhat:verify": "yarn workspace @se-2/hardhat verify",
"lint": "yarn nextjs:lint && yarn hardhat:lint",
"lint": "yarn next:lint && yarn hardhat:lint",
"test": "yarn hardhat:test",
"verify": "yarn hardhat:verify"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
"chain": "hardhat node --network hardhat --no-deploy",
"check-types": "tsc --noEmit --incremental",
"compile": "hardhat compile",
"clean": "hardhat clean",
"deploy": "ts-node scripts/runHardhatDeployWithPK.ts",
"flatten": "hardhat flatten",
"fork": "MAINNET_FORKING_ENABLED=true hardhat node --network hardhat --no-deploy",
Expand Down

0 comments on commit 47ccc6f

Please sign in to comment.