register_ui: further cleanup

This commit is contained in:
bitful-pannul 2024-06-26 21:19:01 -07:00
parent c6d5ebe543
commit ff00829140
11 changed files with 3 additions and 144 deletions

View File

@ -1,27 +0,0 @@
import React, { useEffect, useRef } from 'react';
import jazzicon from 'jazzicon';
interface JazziconProps extends React.HTMLAttributes<HTMLDivElement> {
address: string;
diameter?: number;
}
const Jazzicon: React.FC<JazziconProps> = ({ address, diameter = 40, ...props }) => {
const ref = useRef<HTMLDivElement>(null);
useEffect(() => {
if (address && ref.current) {
const seed = parseInt(address.slice(2, 10), 16); // Derive a seed from Ethereum address
const icon = jazzicon(diameter, seed);
// Clear the current icon
ref.current.innerHTML = '';
// Append the new icon
ref.current.appendChild(icon);
}
}, [address, diameter]);
return <div {...props} ref={ref} />;
};
export default Jazzicon;

View File

@ -1,34 +0,0 @@
import { ChainId } from './chainId'
type AddressMap = { [chainId: string]: string }
export const KNS_REGISTRY_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0x3807fBD692Aa5c96F1D8D7c59a1346a885F40B1C',
[ChainId.OPTIMISM]: '0xca5b5811c0C40aAB3295f932b1B5112Eb7bb4bD6',
}
export const DOT_OS_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0xC5a939923E0B336642024b479502E039338bEd00',
[ChainId.OPTIMISM]: '0x66929F55Ea1E38591f9430E5013C92cdC01F6cAd',
}
export const NAMEWRAPPER_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0x0635513f179D50A207757E05759CbD106d7dFcE8',
[ChainId.MAINNET]: '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401',
}
export const ENS_REGISTRY_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
[ChainId.MAINNET]: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e',
}
export const KNS_ENS_ENTRY_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0xD4583DFd73B382B7e3230aa29Be774C1843FB7d2',
[ChainId.GOERLI]: '0xD4583DFd73B382B7e3230aa29Be774C1843FB7d2',
[ChainId.MAINNET]: '0xa1F47fBBa93574DB4a049C1c5bA03471A21EE01D',
}
export const KNS_ENS_EXIT_ADDRESSES: AddressMap = {
[ChainId.SEPOLIA]: '0x528bA1BA3186d8CABD2c4E8758a98fAf64eD8Af0',
[ChainId.OPTIMISM]: '0x0b35664aB5950cE92bce7222be165BB575D9b7c5',
}

View File

@ -1,13 +0,0 @@
export enum ChainId {
LOCAL = 1337,
MAINNET = 1,
SEPOLIA = 11155111,
OPTIMISM = 10,
OPTIMISM_GOERLI = 420,
GOERLI = 5,
}
export const SEPOLIA_OPT_HEX = '0xaa36a7';
export const OPTIMISM_OPT_HEX = '0xa';
export const MAINNET_OPT_HEX = '0x1';
export const SEPOLIA_OPT_INT = '11155111';

View File

@ -1,2 +0,0 @@
export const KEY_WRONG_NET_KEY = "Keyfile does not match public key";
export const KEY_WRONG_IP = "IP Address does not match records";

View File

@ -1 +0,0 @@
declare module "jazzicon";

View File

@ -1,58 +0,0 @@
import type { AddEthereumChainParameter } from '@web3-react/types'
import { ChainId } from '../constants/chainId'
const ETH: AddEthereumChainParameter['nativeCurrency'] = {
name: 'Ether',
symbol: 'ETH',
decimals: 18,
}
interface ChainInformation {
urls: string[]
name: string
nativeCurrency: AddEthereumChainParameter['nativeCurrency']
blockExplorerUrls: AddEthereumChainParameter['blockExplorerUrls']
}
export function getAddChainParameters(chainId: number): AddEthereumChainParameter | number {
const chainInformation = CHAINS[chainId]
return {
chainId,
chainName: chainInformation.name,
nativeCurrency: chainInformation.nativeCurrency,
rpcUrls: chainInformation.urls,
blockExplorerUrls: chainInformation.blockExplorerUrls,
}
}
type ChainConfig = { [chainId: number]: ChainInformation }
export const MAINNET_CHAINS: ChainConfig = {
[ChainId.OPTIMISM]: {
urls: [''].filter(Boolean), // TODO uhhhh
name: 'Optimism',
nativeCurrency: ETH,
blockExplorerUrls: ['https://optimistic.etherscan.io'],
},
}
export const TESTNET_CHAINS: ChainConfig = {
[ChainId.OPTIMISM_GOERLI]: {
urls: ['https://goerli.optimism.io'],
name: 'Optimism Goerli',
nativeCurrency: ETH,
blockExplorerUrls: ['https://goerli-explorer.optimism.io'],
},
[ChainId.LOCAL]: {
urls: ['http://localhost:8545'],
name: 'Localhost 8545',
nativeCurrency: ETH,
blockExplorerUrls: [],
}
}
export const CHAINS: ChainConfig = {
...MAINNET_CHAINS,
...TESTNET_CHAINS,
}

View File

@ -1,6 +1,5 @@
import { useEffect } from "react"
import { useNavigate } from "react-router-dom"
import { OPTIMISM_OPT_HEX } from "../constants/chainId";
type OsHomeProps = {
knsName: string
@ -46,13 +45,13 @@ function KinodeHome({ knsName, nodeChainId }: OsHomeProps) {
<h4 className="self-start mx-auto">
Other options
</h4>
{nodeChainId !== OPTIMISM_OPT_HEX && <button
{/* {nodeChainId !== OPTIMISM_OPT_HEX && <button
disabled={!hasNetwork}
onClick={registerEthRedir}
className="alt"
>
Register ENS Name
</button>}
</button>} */}
<button
disabled={!hasNetwork}
onClick={inviteRedir}

View File

@ -7,7 +7,6 @@ import { useNavigate } from "react-router-dom";
import { Tooltip } from "../components/Tooltip";
import { isMobileCheck } from "../utils/dimensions";
import classNames from "classnames";
import { generateNetworkingKeys } from "../abis";
import { getFetchUrl } from "../utils/fetch";
import { useAccount } from "wagmi";

View File

@ -5,8 +5,6 @@ import Loader from "../components/Loader";
import { PageProps } from "../lib/types";
import { hash } from "@ensdomains/eth-ens-namehash";
import DirectCheckbox from "../components/DirectCheckbox";
import { MAINNET_OPT_HEX, OPTIMISM_OPT_HEX } from "../constants/chainId";
import { KinodeTitle } from "../components/KinodeTitle";
import { useAccount } from "wagmi";
@ -57,7 +55,6 @@ function RegisterEthName({
try {
const cleanedName = name.trim().replace(".eth", "");
const nameToSet = "namehash(`${cleanedName}.eth`)";
const targetChainId = nodeChainId === OPTIMISM_OPT_HEX ? MAINNET_OPT_HEX : nodeChainId;
// const data = await generateNetworkingKeys({
// direct,

View File

@ -9,7 +9,7 @@ import { Tooltip } from "../components/Tooltip";
import { useAccount, useWaitForTransactionReceipt, useWriteContract } from "wagmi";
import { useConnectModal } from "@rainbow-me/rainbowkit"
import { KINOMAP, kinomapAbi, generateNetworkingKeys, KINO_ACCOUNT_IMPL, DOTOS } from "../abis";
import { kinomapAbi, generateNetworkingKeys, KINO_ACCOUNT_IMPL, DOTOS } from "../abis";
import { encodePacked, stringToHex } from "viem";
interface RegisterOsNameProps extends PageProps { }

View File

@ -2,7 +2,6 @@ import React, { useState, useEffect, FormEvent, useCallback } from "react";
import Loader from "../components/Loader";
import { downloadKeyfile } from "../utils/download-keyfile";
import { Tooltip } from "../components/Tooltip";
// import { KinodeTitle } from "../components/KinodeTitle";
import { getFetchUrl } from "../utils/fetch";
import { sha256, toBytes } from "viem";