diff --git a/.env.example b/.env.example index f7720f1..5002bc8 100644 --- a/.env.example +++ b/.env.example @@ -1,9 +1,9 @@ -REACT_APP_RPC_URL_SHARD0=https://a.api.s0.t.hmny.io -REACT_APP_RPC_URL_SHARD1=https://api.s1.t.hmny.io -REACT_APP_RPC_URL_SHARD2=https://api.s2.t.hmny.io -REACT_APP_RPC_URL_SHARD3=https://api.s3.t.hmny.io -REACT_APP_AVAILABLE_SHARDS=0 -REACT_APP_EXPLORER_V1_API_URL=https://explorer.harmony.one:8888 +REACT_APP_RPC_URL_SHARD0=https://a.api.s0.t.hmny.io/ +REACT_APP_RPC_URL_SHARD1=https://api.s1.t.hmny.io/ +REACT_APP_RPC_URL_SHARD2=https://api.s2.t.hmny.io/ +REACT_APP_RPC_URL_SHARD3=https://api.s3.t.hmny.io/ +REACT_APP_AVAILABLE_SHARDS=0,1,2,3 +REACT_APP_EXPLORER_V1_API_URL=https://explorer.pops.one:8888 REACT_APP_INDEXER_IPFS_GATEWAY=https://ipfs.io/ipfs/ -REACT_APP_PROD_ADDRESS=https://explorer-v2-api.hmny.io -REACT_APP_DEV_ADDRESS=https://ws.explorer-v2.hmny.io +REACT_APP_PROD_ADDRESS=https://explorer-v2-api.hmny.io/ +REACT_APP_DEV_ADDRESS=https://ws.explorer-v2.hmny.io/ diff --git a/src/api/explorerV1.ts b/src/api/explorerV1.ts index 7b83656..13c65c0 100644 --- a/src/api/explorerV1.ts +++ b/src/api/explorerV1.ts @@ -28,7 +28,7 @@ export interface IVerifyContractDataSendData { export const verifyContractCode = async (data: IVerifyContractDataSendData) => { const response = await fetch( - `${process.env.REACT_APP_EXPLORER_V1_API_URL}/codeVerification`, + `${process.env.REACT_APP_EXPLORER_V1_API_URL}codeVerification`, { method: "POST", mode: "cors", @@ -48,7 +48,7 @@ export const verifyContractCode = async (data: IVerifyContractDataSendData) => { export const loadSourceCode = async (address: string): Promise => { const response = await fetch( - `${process.env.REACT_APP_EXPLORER_V1_API_URL}/fetchContractCode?contractAddress=${address}`, + `${process.env.REACT_APP_EXPLORER_V1_API_URL}fetchContractCode?contractAddress=${address}`, { mode: "cors", cache: "no-cache", diff --git a/src/components/tables/TransactionsTable.tsx b/src/components/tables/TransactionsTable.tsx index fdd1c4d..7d1d2b8 100644 --- a/src/components/tables/TransactionsTable.tsx +++ b/src/components/tables/TransactionsTable.tsx @@ -186,6 +186,11 @@ export function TransactionsTable(props: TransactionTableProps) { const _IsLoading = isLoading; + useEffect(() => { + filter.offset = 0; + setFilter(filter); + }, [filter.limit]); + return ( <> { Suggested Event - + {displaySignature || signatures[0].signature || ''} diff --git a/src/components/ui/Pagination/index.tsx b/src/components/ui/Pagination/index.tsx index c7c5c4f..14c8db5 100644 --- a/src/components/ui/Pagination/index.tsx +++ b/src/components/ui/Pagination/index.tsx @@ -34,7 +34,7 @@ export function PaginationNavigator(props: PaginationNavigator) { const onPrevClick = () => { const newFilter = JSON.parse(JSON.stringify(filter)) as Filter; - newFilter.offset = newFilter.offset - 10; + newFilter.offset = newFilter.offset - (filter.limit || 10); if (!isLoading) { onChange(newFilter, "prevPage"); @@ -43,7 +43,7 @@ export function PaginationNavigator(props: PaginationNavigator) { const onNextClick = () => { const newFilter = JSON.parse(JSON.stringify(filter)) as Filter; - newFilter.offset += 10; + newFilter.offset += filter.limit || 10; if (!isLoading) { onChange(newFilter, "nextPage"); } diff --git a/src/components/ui/Search.tsx b/src/components/ui/Search.tsx index 1357304..a7dc2d5 100644 --- a/src/components/ui/Search.tsx +++ b/src/components/ui/Search.tsx @@ -19,34 +19,41 @@ import { Address } from "./Address"; let timeoutID: any | null = null; +export interface ISearchItem { + symbol: string; + name: string; + type: "erc1155" | "erc20" | "erc721"; + item: any; +} + export const SearchInput = () => { const [value, setValue] = useState(""); const [readySubmit, setReadySubmit] = useState(false); const [focus, setFocus] = useState(false); - const [results, setResults] = useState([]); + const [results, setResults] = useState([]); const themeMode = useThemeMode(); const erc20Map = useERC20Pool(); const erc721Map = useERC721Pool(); const erc1155Map = useERC1155Pool(); - const dataTest = [ + const dataTest: ISearchItem[] = [ ...Object.keys(erc1155Map).map((address) => ({ symbol: erc1155Map[address].symbol, name: erc1155Map[address].name, - type: "erc1155", + type: "erc1155" as "erc1155", item: erc1155Map[address], })), ...Object.keys(erc20Map).map((address) => ({ symbol: erc20Map[address].symbol, name: erc20Map[address].name, - type: "erc20", + type: "erc20" as "erc20", item: erc20Map[address], })), ...Object.keys(erc721Map).map((address) => ({ symbol: erc721Map[address].symbol, name: erc721Map[address].name, - type: "erc721", + type: "erc721" as "erc721", item: erc721Map[address], })), ]; @@ -60,9 +67,6 @@ export const SearchInput = () => { const { value: newValue } = event.target; setValue(newValue); - - clearTimeout(timeoutID); - timeoutID = setTimeout(() => setReadySubmit(true), 200); }, []); useEffect(() => { @@ -87,7 +91,7 @@ export const SearchInput = () => { if ("" + +v === v && +v > 0) { // is block number history.push(`/block/${v}`); - setValue('') + setValue(""); return; } @@ -97,7 +101,7 @@ export const SearchInput = () => { if (v.length === 42 && /^0x[a-f0-9]+$/.test(v)) { // address history.push(`/address/${v}`); - setValue('') + setValue(""); return; } @@ -106,7 +110,7 @@ export const SearchInput = () => { const ethAddress = getAddress(v).basicHex; history.push(`/address/${ethAddress}`); - setValue('') + setValue(""); return; } @@ -130,7 +134,7 @@ export const SearchInput = () => { return; } history.push(`/tx/${v}`); - setValue('') + setValue(""); }) .catch(), getStakingTransactionByField([0, "hash", v]).then((res) => { @@ -139,7 +143,7 @@ export const SearchInput = () => { } history.push(`/staking-tx/${v}`); - setValue('') + setValue(""); }), ]); } catch { @@ -153,14 +157,14 @@ export const SearchInput = () => { return; } history.push(`/block/${v}`); - setValue('') + setValue(""); }), getTransactionByField([shard, "hash", v]).then((res) => { if (!res) { return; } history.push(`/tx/${v}`); - setValue('') + setValue(""); }), getStakingTransactionByField([shard, "hash", v]).then( (res) => { @@ -169,7 +173,7 @@ export const SearchInput = () => { } history.push(`/staking-tx/${v}`); - setValue('') + setValue(""); } ), ]); @@ -213,11 +217,25 @@ export const SearchInput = () => { setValue(""); }} > + + {`H${results[index].type + .slice(1) + .toUpperCase()}`} + - Name {results[index].name} | + {results[index].name} | - Symbol {results[index].symbol} | + {results[index].symbol} |
{ setFocus(false); }, 100); }} + onPaste={(evt) => { + clearTimeout(timeoutID); + timeoutID = setTimeout(() => setReadySubmit(true), 200); + }} onKeyDown={(e) => { if (e.keyCode === 13) { - onChange(e); + clearTimeout(timeoutID); + timeoutID = setTimeout(() => setReadySubmit(true), 200); } }} color="red" diff --git a/src/hooks/themeSwitcherHook.ts b/src/hooks/themeSwitcherHook.ts index 4901328..72e113c 100644 --- a/src/hooks/themeSwitcherHook.ts +++ b/src/hooks/themeSwitcherHook.ts @@ -7,20 +7,23 @@ let globalSetMode = () => { throw new Error("you must useDarkMode before setting its state"); }; -export const useThemeMode = singletonHook(initTheme, () => { - const currentTheme = window.localStorage.getItem('themeMode') as themeType || initTheme; - - const [mode, setMode] = useState(currentTheme); - //@ts-ignore - globalSetMode = setMode; - return mode; -}); +export const useThemeMode = singletonHook( + (window.localStorage.getItem("themeMode") || initTheme) as themeType, + () => { + const currentTheme = + (window.localStorage.getItem("themeMode") as themeType) || initTheme; + const [mode, setMode] = useState(currentTheme); + //@ts-ignore + globalSetMode = setMode; + return mode; + } +); -export const setThemeMode = (mode: themeType) => { +export const setThemeMode = (mode: themeType) => { //@ts-ignore globalSetMode(mode); - window.localStorage.setItem('themeMode', mode); + window.localStorage.setItem("themeMode", mode); }; export type themeType = "light" | "dark"; diff --git a/src/pages/AddressPage/ContractDetails/AbiMethodView.tsx b/src/pages/AddressPage/ContractDetails/AbiMethodView.tsx index 69035e0..00595a6 100644 --- a/src/pages/AddressPage/ContractDetails/AbiMethodView.tsx +++ b/src/pages/AddressPage/ContractDetails/AbiMethodView.tsx @@ -16,7 +16,8 @@ const ViewWrapper = styled(Box)` const NameWrapper = styled(Box)` border-bottom: 1px solid #e7ecf7; padding: 10px; - background: #f8f9fa; + opacity: 0.7; + border-radius: 5px; `; const SmallTextInput = styled(TextInput)` @@ -127,7 +128,7 @@ export const AbiMethodsView = (props: { return ( - + {index + 1}. {abiMethod.name} diff --git a/src/pages/AddressPage/ContractDetails/index.tsx b/src/pages/AddressPage/ContractDetails/index.tsx index 3fc1a1b..af9639f 100644 --- a/src/pages/AddressPage/ContractDetails/index.tsx +++ b/src/pages/AddressPage/ContractDetails/index.tsx @@ -1,5 +1,5 @@ import React, { useState } from "react"; -import { Box, Text } from "grommet"; +import { Box, Text, TextArea } from "grommet"; import { AddressDetails } from "src/types"; import { Item } from "../AddressDetails"; import { useHistory } from "react-router-dom"; @@ -9,11 +9,10 @@ import { AbiMethodsView } from "./AbiMethodView"; import { AbiItem } from "web3-utils"; import { Wallet } from "./ConnectWallets"; -const StyledTextArea = styled("textarea")` - padding: 0.75rem; - border: 1px solid #e7eaf3; - background-color: #f8f9fa; +const StyledTextArea = styled(TextArea)` + padding: 0.75rem; border-radius: 0.35rem; + font-weight: normal; `; export const ContractDetails = (props: { @@ -110,8 +109,10 @@ enum V_TABS { WRITE = "Write Contract", } -const TabBox = styled(Box)` - border: 1px solid #dedede; +const TabBox = styled(Box)<{ selected: boolean }>` + border: 1px solid ${(props) => props.theme.global.colors.border}; + background: ${(props) => + props.selected ? props.theme.global.colors.backgroundBack : "transparent"}; padding: 7px 12px 6px 12px; border-radius: 4px; margin: 5px 10px; @@ -125,9 +126,9 @@ const TabButton = (props: { return ( - + {props.text} diff --git a/src/pages/AllTransactionsPage/index.tsx b/src/pages/AllTransactionsPage/index.tsx index a866bae..7cd423a 100644 --- a/src/pages/AllTransactionsPage/index.tsx +++ b/src/pages/AllTransactionsPage/index.tsx @@ -87,7 +87,7 @@ export function AllTransactionsPage() { limit={+limit} filter={filter} setFilter={setFilter} - primaryKey={'blockHash'} + primaryKey={'hash'} /> diff --git a/src/pages/ERC20List/ERC20Table.tsx b/src/pages/ERC20List/ERC20Table.tsx index fbc6387..0a12e64 100644 --- a/src/pages/ERC20List/ERC20Table.tsx +++ b/src/pages/ERC20List/ERC20Table.tsx @@ -83,6 +83,7 @@ export function ERC20Table(props: TransactionTableProps) { className={"g-table-header"} style={{ width: "100%", minWidth }} columns={getColumns({ history })} + primaryKey={'address'} data={data} border={{ header: { @@ -160,7 +161,6 @@ function getColumns(props: any) { ), render: (data: Erc20) => { - console.log(data); return ( ), render: (data: Erc20) => { -console.log(data) - return
+ return
; }, }, // { diff --git a/src/pages/InventoryDetailsPage/InventoryDetailsPage.tsx b/src/pages/InventoryDetailsPage/InventoryDetailsPage.tsx index 6bf76a7..6af6f1e 100644 --- a/src/pages/InventoryDetailsPage/InventoryDetailsPage.tsx +++ b/src/pages/InventoryDetailsPage/InventoryDetailsPage.tsx @@ -15,7 +15,7 @@ export function InventoryDetailsPage() { // @ts-ignore const { address, tokenID, type } = useParams(); - const item = erc721Map[address] || erc1155Map[address]; + const item = erc721Map[address] || erc1155Map[address] || {}; const name = item.name || ""; useEffect(() => { diff --git a/src/web3/parseByteCode.tsx b/src/web3/parseByteCode.tsx index a7ef2d1..ca7f6a2 100644 --- a/src/web3/parseByteCode.tsx +++ b/src/web3/parseByteCode.tsx @@ -130,9 +130,10 @@ export const DisplaySignature = (props: any = {}) => { if (!parsed || !event || !abi) { return <>—; } + return ( - <> + {event.name}( <> {abi.inputs.map((input: any, i: number) => { @@ -158,7 +159,7 @@ export const DisplaySignature = (props: any = {}) => { ) : Array.isArray(parsed[input.name]) ? ( parsed[input.name].join(", ") ) : ( - parsed[input.name] + parsed[input.name].toString() )} {i < abi.inputs.length - 1 ? ", " : null} @@ -166,7 +167,7 @@ export const DisplaySignature = (props: any = {}) => { })} ) - + ); };