Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Corantin committed Jun 7, 2024
1 parent 273ff70 commit b5e51cc
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 20 deletions.
2 changes: 1 addition & 1 deletion packages/nextjs/components/FileValidation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ const FileValidation = ({
};

const openFile = async (file: FileModel) => {
await fileClient.getFile(file.fileId, file.fileName, false);
await fileClient.getFile(file, file.fileName, false);
};

const handleStateChanged = (ev: any) => {
Expand Down
1 change: 1 addition & 0 deletions packages/nextjs/components/ValidationPropertyOverview.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const PropertyOverview = ({ deedData, onRefresh, handleMint, handleValidate }: P
<>
<div id="Map" className="max-w-72 h-72 sm:w-72 sm:h-full bg-[#141414] flex-grow">
<Map
// @ts-ignore
center={{
lat: deedData.propertyDetails.propertyLatitude || 0,
lng: deedData.propertyDetails.propertyLongitude || 0,
Expand Down
7 changes: 5 additions & 2 deletions packages/nextjs/contracts/deployedContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,7 @@ const deployedContracts = {
supportsInterface:
"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol",
},
startBlock: 57804878,
},
DeedNFT: {
address: "0x48E1c1b180D01aD435A8641107E235605CDe0A95",
Expand Down Expand Up @@ -1245,6 +1246,7 @@ const deployedContracts = {
transferFrom:
"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol",
},
startBlock: 57804881,
},
TokenMock: {
address: "0x8D891d57699CC977269b80C8C993735DAd1F3667",
Expand Down Expand Up @@ -1603,6 +1605,7 @@ const deployedContracts = {
transfer: "@openzeppelin/contracts/token/ERC20/ERC20.sol",
transferFrom: "@openzeppelin/contracts/token/ERC20/ERC20.sol",
},
startBlock: 57839741,
},
},
1337: {
Expand Down Expand Up @@ -3580,7 +3583,7 @@ const deployedContracts = {
supportsInterface:
"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol",
},
startBlock: "5839660",
startBlock: 5839660,
},
DeedNFT: {
address: "0xC04836E6FFd56c440fd5d6D48cE9701D1D80a759",
Expand Down Expand Up @@ -4449,7 +4452,7 @@ const deployedContracts = {
transferFrom:
"@openzeppelin/contracts-upgradeable/token/ERC721/extensions/ERC721URIStorageUpgradeable.sol",
},
startBlock: "5839748",
startBlock: 5839748,
},
TokenMock: {
address: "0xb884B7749cEeaA13993b42f030b41A7252043618",
Expand Down
1 change: 0 additions & 1 deletion packages/nextjs/contracts/externalContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,3 @@ import { GenericContractsDeclaration } from "~~/utils/scaffold-eth/contract";
const externalContracts = {} as const;

export default externalContracts satisfies GenericContractsDeclaration;

7 changes: 2 additions & 5 deletions packages/nextjs/hooks/scaffold-eth/useAutoConnect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import { useEffectOnce, useLocalStorage, useReadLocalStorage } from "usehooks-ts
import { hardhat } from "viem/chains";
import { Connector, useAccount, useConnect } from "wagmi";
import CONFIG from "~~/config";
import {
burnerWalletId,
defaultBurnerChainId,
} from "~~/services/web3/wagmi-burner/BurnerConnector";
import { burnerWalletId } from "~~/services/web3/wagmi-burner/BurnerConnector";
import { getTargetNetwork } from "~~/utils/scaffold-eth";

const SCAFFOLD_WALLET_STORAGE_KEY = "scaffoldEth2.wallet";
Expand Down Expand Up @@ -41,7 +38,7 @@ const getInitialConnector = (
// The user was not connected to a wallet
if (allowBurner && CONFIG.walletAutoConnect) {
const connector = connectors.find(f => f.id === burnerWalletId);
return { connector, chainId: defaultBurnerChainId };
return { connector, chainId: getTargetNetwork().id };
}
} else {
// the user was connected to wallet
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ export const useScaffoldEventHistory = <
address: deployedContractData?.address,
event,
args: filters as any, // TODO: check if it works and fix type
fromBlock: BigInt(deployedContractData.startBlock),
// @ts-ignore
fromBlock: BigInt(deployedContractData.startBlock ?? 0),
});
const newEvents = [];
for (let i = logs.length - 1; i >= 0; i--) {
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/pages/agent-explorer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ const AgentExplorer: NextPage = () => {
cover: `https://picsum.photos/seed/${Math.round(Math.random() * 1000)}/500/300`,
email: "[email protected]",
phone: "1234567890",
latitude: center.lat + (Math.random() - 0.5) * (radius * 2),
longitude: center.lng + (Math.random() - 0.5) * (radius * 2),
lat: center.lat + (Math.random() - 0.5) * (radius * 2),
lng: center.lng + (Math.random() - 0.5) * (radius * 2),
icon: agentIcon,
type: "fixme",
location: "New York",
Expand Down
4 changes: 2 additions & 2 deletions packages/nextjs/pages/playground/ContractEvent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const ContractEvent = <
return (
x.log.blockNumber.toString() === search.trim() ||
x.log.transactionHash.includes(search) ||
x.log.topics.find(topic => topic.includes(search)) ||
x.log.topics.find((topic: any) => topic.includes(search)) ||
(argsString
? argsString.includes(search)
: (x.args as any).toString().includes(search))
Expand All @@ -69,7 +69,7 @@ const ContractEvent = <
<div>
<span className="font-bold">Topics:</span>
<ul>
{x.log.topics.map((topic, i) => (
{x.log.topics.map((topic: any, i: number) => (
<li key={i} className="ml-2">
- {topic}
</li>
Expand Down
2 changes: 1 addition & 1 deletion packages/nextjs/servers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const authentify = async (
const contract = getContract({
address: accessManager.address,
abi: accessManager.abi,
publicClient: getClient(req, chainId),
publicClient: getClient(req.headers.host ?? "", chainId),
});

if (constraint === "Validator") {
Expand Down
11 changes: 6 additions & 5 deletions packages/nextjs/utils/scaffold-eth/fetchPriceFromUniswap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { createPublicClient, http, parseAbi } from "viem";
import { goerli } from "viem/chains";
import { mainnet } from "wagmi";
import CONFIG from "~~/config";
import logger from "~~/services/logger.service";
import { getTargetNetwork } from "~~/utils/scaffold-eth";

const publicClient = createPublicClient({
Expand All @@ -20,17 +21,17 @@ const ABI = parseAbi([
export const fetchPriceFromUniswap = async (): Promise<number> => {
const configuredNetwork = getTargetNetwork();
if (
configuredNetwork.nativeCurrency.symbol !== "ETH" &&
configuredNetwork.nativeCurrency.symbol !== "SEP" &&
!configuredNetwork.nativeCurrencyTokenAddress
configuredNetwork.stableCoin.symbol !== "ETH" &&
configuredNetwork.stableCoin.symbol !== "SEP" &&
!configuredNetwork.stableCoin
) {
return 0;
}
try {
const DAI = new Token(1, "0x6B175474E89094C44Da98b954EedeAC495271d0F", 18);
const TOKEN = new Token(
1,
configuredNetwork.nativeCurrencyTokenAddress || "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
configuredNetwork.stableCoin.address || "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2",
18,
);
const pairAddress = Pair.getAddress(TOKEN, DAI);
Expand Down Expand Up @@ -64,7 +65,7 @@ export const fetchPriceFromUniswap = async (): Promise<number> => {
const price = parseFloat(route.midPrice.toSignificant(6));
return price;
} catch (error) {
console.error("useNativeCurrencyPrice - Error fetching ETH price from Uniswap: ", error);
logger.error("useNativeCurrencyPrice - Error fetching ETH price from Uniswap: ", error);
return 0;
}
};
2 changes: 2 additions & 0 deletions packages/nextjs/utils/scaffold-eth/networks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export const NETWORKS_EXTRA_DATA: Record<string, TChainAttributes> = {
},
deedSubgraph: "https://api.studio.thegraph.com/query/56229/deed3-sepolia/version/latest",
ipfsGateway: "https://ipfs.io/ipfs/",
blockExplorer: "https://blockscout.com/xdai/mainnet",
},
[chains.polygon.id]: {
color: "#5f4bb6",
Expand All @@ -62,6 +63,7 @@ export const NETWORKS_EXTRA_DATA: Record<string, TChainAttributes> = {
symbol: "USDC",
coinGeckoId: "usd-coin",
},
blockExplorer: "https://polygonscan.com/",
},
// [chains.hardhat.id]: {
// color: "#b8af0c",
Expand Down

0 comments on commit b5e51cc

Please sign in to comment.