Merge branch 'develop' into feature/trace-tx

This commit is contained in:
Willian Mitsuda 2021-11-04 16:34:16 -03:00
commit 45893bae8b
9 changed files with 36 additions and 10 deletions

14
package-lock.json generated
View File

@ -22,7 +22,7 @@
"@fortawesome/free-solid-svg-icons": "^5.15.4", "@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.16", "@fortawesome/react-fontawesome": "^0.1.16",
"@headlessui/react": "^1.4.1", "@headlessui/react": "^1.4.1",
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.24", "@types/jest": "^26.0.24",
@ -2887,9 +2887,9 @@
} }
}, },
"node_modules/@testing-library/jest-dom": { "node_modules/@testing-library/jest-dom": {
"version": "5.14.1", "version": "5.15.0",
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.14.1.tgz", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.15.0.tgz",
"integrity": "sha512-dfB7HVIgTNCxH22M1+KU6viG5of2ldoA5ly8Ar8xkezKHKXjRvznCdbMbqjYGgO2xjRbwnR+rR8MLUIqF3kKbQ==", "integrity": "sha512-lOMuQidnL1tWHLEWIhL6UvSZC1Qt3OkNe1khvi2h6xFiqpe5O8arYs46OU0qyUGq0cSTbroQyMktYNXu3a7sAA==",
"dependencies": { "dependencies": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@types/testing-library__jest-dom": "^5.9.1", "@types/testing-library__jest-dom": "^5.9.1",
@ -21609,9 +21609,9 @@
} }
}, },
"@testing-library/jest-dom": { "@testing-library/jest-dom": {
"version": "5.14.1", "version": "5.15.0",
"resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.14.1.tgz", "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.15.0.tgz",
"integrity": "sha512-dfB7HVIgTNCxH22M1+KU6viG5of2ldoA5ly8Ar8xkezKHKXjRvznCdbMbqjYGgO2xjRbwnR+rR8MLUIqF3kKbQ==", "integrity": "sha512-lOMuQidnL1tWHLEWIhL6UvSZC1Qt3OkNe1khvi2h6xFiqpe5O8arYs46OU0qyUGq0cSTbroQyMktYNXu3a7sAA==",
"requires": { "requires": {
"@babel/runtime": "^7.9.2", "@babel/runtime": "^7.9.2",
"@types/testing-library__jest-dom": "^5.9.1", "@types/testing-library__jest-dom": "^5.9.1",

View File

@ -17,7 +17,7 @@
"@fortawesome/free-solid-svg-icons": "^5.15.4", "@fortawesome/free-solid-svg-icons": "^5.15.4",
"@fortawesome/react-fontawesome": "^0.1.16", "@fortawesome/react-fontawesome": "^0.1.16",
"@headlessui/react": "^1.4.1", "@headlessui/react": "^1.4.1",
"@testing-library/jest-dom": "^5.14.1", "@testing-library/jest-dom": "^5.15.0",
"@testing-library/react": "^11.1.0", "@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10", "@testing-library/user-event": "^12.1.10",
"@types/jest": "^26.0.24", "@types/jest": "^26.0.24",

View File

@ -40,6 +40,7 @@ const TokenTransferItem: React.FC<TokenTransferItemProps> = ({
addressCtx={AddressContext.FROM} addressCtx={AddressContext.FROM}
txFrom={t.from === txData.from} txFrom={t.from === txData.from}
txTo={t.from === txData.to} txTo={t.from === txData.to}
resolvedAddresses={resolvedAddresses}
/> />
</AddressHighlighter> </AddressHighlighter>
</div> </div>
@ -51,6 +52,7 @@ const TokenTransferItem: React.FC<TokenTransferItemProps> = ({
addressCtx={AddressContext.TO} addressCtx={AddressContext.TO}
txFrom={t.to === txData.from} txFrom={t.to === txData.from}
txTo={t.to === txData.to} txTo={t.to === txData.to}
resolvedAddresses={resolvedAddresses}
/> />
</AddressHighlighter> </AddressHighlighter>
</div> </div>

View File

@ -1,5 +1,9 @@
{ {
"0x7d655c57f71464B6f83811C55D84009Cd9f5221C": "Gitcoin: Bulk Checkout", "0x7d655c57f71464B6f83811C55D84009Cd9f5221C": "Gitcoin: Bulk Checkout",
"0xf2354570bE2fB420832Fb7Ff6ff0AE0dF80CF2c6": "Gitcoin: GR8 Matching Payout",
"0x3342E3737732D879743f2682A3953a730ae4F47C": "Gitcoin: GR9 Matching Payout",
"0x3ebAFfe01513164e638480404c651E885cCA0AA4": "Gitcoin: GR10 Matching Payout",
"0x0EbD2E2130b73107d0C45fF2E16c93E7e2e10e3a": "Gitcoin: GR11 Matching Payout",
"0x722122dF12D4e14e13Ac3b6895a86e84145b6967": "Tornado Cash: Proxy", "0x722122dF12D4e14e13Ac3b6895a86e84145b6967": "Tornado Cash: Proxy",
"0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95": "Uniswap V1: Factory", "0xc0a47dFe034B400B47bDaD5FecDa2621de6c4d95": "Uniswap V1: Factory",
"0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f": "Uniswap V2: Factory", "0x5C69bEe701ef814a2B6a3EDD4B1652CB9cc5aA6f": "Uniswap V2: Factory",

View File

@ -375,6 +375,7 @@ const Details: React.FC<DetailsProps> = ({
hasParamNames={resolvedTxDesc === txDesc} hasParamNames={resolvedTxDesc === txDesc}
userMethod={userMethod} userMethod={userMethod}
devMethod={devMethod} devMethod={devMethod}
resolvedAddresses={resolvedAddresses}
/> />
)} )}
</Tab.Panel> </Tab.Panel>

View File

@ -114,6 +114,7 @@ const LogEntry: React.FC<LogEntryProps> = ({
paramTypes={resolvedLogDesc.eventFragment.inputs} paramTypes={resolvedLogDesc.eventFragment.inputs}
txData={txData} txData={txData}
hasParamNames={resolvedLogDesc === logDesc} hasParamNames={resolvedLogDesc === logDesc}
resolvedAddresses={resolvedAddresses}
/> />
</div> </div>
</div> </div>

View File

@ -3,13 +3,19 @@ import AddressHighlighter from "../../components/AddressHighlighter";
import DecoratedAddressLink from "../../components/DecoratedAddressLink"; import DecoratedAddressLink from "../../components/DecoratedAddressLink";
import Copy from "../../components/Copy"; import Copy from "../../components/Copy";
import { TransactionData } from "../../types"; import { TransactionData } from "../../types";
import { ResolvedAddresses } from "../../api/address-resolver";
type AddressDecoderProps = { type AddressDecoderProps = {
r: any; r: any;
txData: TransactionData; txData: TransactionData;
resolvedAddresses?: ResolvedAddresses | undefined;
}; };
const AddressDecoder: React.FC<AddressDecoderProps> = ({ r, txData }) => ( const AddressDecoder: React.FC<AddressDecoderProps> = ({
r,
txData,
resolvedAddresses,
}) => (
<div className="flex items-baseline space-x-2 -ml-1 mr-3"> <div className="flex items-baseline space-x-2 -ml-1 mr-3">
<AddressHighlighter address={r.toString()}> <AddressHighlighter address={r.toString()}>
<DecoratedAddressLink <DecoratedAddressLink
@ -17,6 +23,7 @@ const AddressDecoder: React.FC<AddressDecoderProps> = ({ r, txData }) => (
miner={r.toString() === txData.confirmedData?.miner} miner={r.toString() === txData.confirmedData?.miner}
txFrom={r.toString() === txData.from} txFrom={r.toString() === txData.from}
txTo={r.toString() === txData.to} txTo={r.toString() === txData.to}
resolvedAddresses={resolvedAddresses}
/> />
</AddressHighlighter> </AddressHighlighter>
<Copy value={r.toString()} /> <Copy value={r.toString()} />

View File

@ -9,6 +9,7 @@ import AddressDecoder from "./AddressDecoder";
import BooleanDecoder from "./BooleanDecoder"; import BooleanDecoder from "./BooleanDecoder";
import BytesDecoder from "./BytesDecoder"; import BytesDecoder from "./BytesDecoder";
import { TransactionData } from "../../types"; import { TransactionData } from "../../types";
import { ResolvedAddresses } from "../../api/address-resolver";
type DecodedParamRowProps = { type DecodedParamRowProps = {
prefix?: ReactNode; prefix?: ReactNode;
@ -18,6 +19,7 @@ type DecodedParamRowProps = {
txData: TransactionData; txData: TransactionData;
arrayElem?: number | undefined; arrayElem?: number | undefined;
help?: string | undefined; help?: string | undefined;
resolvedAddresses?: ResolvedAddresses | undefined;
}; };
const DecodedParamRow: React.FC<DecodedParamRowProps> = ({ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
@ -28,6 +30,7 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
txData, txData,
arrayElem, arrayElem,
help, help,
resolvedAddresses,
}) => { }) => {
const [showHelp, setShowHelp] = useState<boolean>(false); const [showHelp, setShowHelp] = useState<boolean>(false);
@ -72,7 +75,11 @@ const DecodedParamRow: React.FC<DecodedParamRowProps> = ({
{paramType.baseType === "uint256" ? ( {paramType.baseType === "uint256" ? (
<Uint256Decoder r={r} /> <Uint256Decoder r={r} />
) : paramType.baseType === "address" ? ( ) : paramType.baseType === "address" ? (
<AddressDecoder r={r} txData={txData} /> <AddressDecoder
r={r}
txData={txData}
resolvedAddresses={resolvedAddresses}
/>
) : paramType.baseType === "bool" ? ( ) : paramType.baseType === "bool" ? (
<BooleanDecoder r={r} /> <BooleanDecoder r={r} />
) : paramType.baseType === "bytes" ? ( ) : paramType.baseType === "bytes" ? (

View File

@ -3,6 +3,7 @@ import { ParamType, Result } from "@ethersproject/abi";
import DecodedParamRow from "./DecodedParamRow"; import DecodedParamRow from "./DecodedParamRow";
import { TransactionData } from "../../types"; import { TransactionData } from "../../types";
import { DevMethod, UserMethod } from "../../useSourcify"; import { DevMethod, UserMethod } from "../../useSourcify";
import { ResolvedAddresses } from "../../api/address-resolver";
type DecodedParamsTableProps = { type DecodedParamsTableProps = {
args: Result; args: Result;
@ -11,6 +12,7 @@ type DecodedParamsTableProps = {
hasParamNames?: boolean; hasParamNames?: boolean;
userMethod?: UserMethod | undefined; userMethod?: UserMethod | undefined;
devMethod?: DevMethod | undefined; devMethod?: DevMethod | undefined;
resolvedAddresses?: ResolvedAddresses | undefined;
}; };
const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
@ -19,6 +21,7 @@ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
txData, txData,
hasParamNames = true, hasParamNames = true,
devMethod, devMethod,
resolvedAddresses,
}) => ( }) => (
<table className="border w-full"> <table className="border w-full">
<thead> <thead>
@ -48,6 +51,7 @@ const DecodedParamsTable: React.FC<DecodedParamsTableProps> = ({
paramType={paramTypes[i]} paramType={paramTypes[i]}
txData={txData} txData={txData}
help={devMethod?.params?.[paramTypes[i].name]} help={devMethod?.params?.[paramTypes[i].name]}
resolvedAddresses={resolvedAddresses}
/> />
))} ))}
</tbody> </tbody>