@@ -15,9 +15,7 @@ const SolcVersion = ({ hexversion }) => {
1515 }
1616 const rawHex = hexversion . slice ( 2 ) ; // remove 0x
1717 const rawHexFields = rawHex . match ( / .{ 1 , 2 } / g) ; // split into two chars
18- const decimalFields = rawHexFields
19- . map ( ( rawHex ) => "0x" + rawHex )
20- . map ( ( prefixedHex ) => Number ( prefixedHex ) ) ;
18+ const decimalFields = rawHexFields . map ( ( rawHex ) => "0x" + rawHex ) . map ( ( prefixedHex ) => Number ( prefixedHex ) ) ;
2119 const version = decimalFields . join ( "." ) ;
2220 return version ;
2321} ;
@@ -27,20 +25,12 @@ const ByteCodeInput = ({ children, cborByteLength }) => {
2725 useEffect ( ( ) => {
2826 bottom . current . scrollIntoView ( { behavior : "smooth" , block : "nearest" } ) ;
2927 // Scroll again to fix when sometimes it does not scroll fully to the bottom.
30- setTimeout (
31- ( ) =>
32- bottom . current . scrollIntoView ( { behavior : "smooth" , block : "nearest" } ) ,
33- 200
34- ) ;
28+ setTimeout ( ( ) => bottom . current . scrollIntoView ( { behavior : "smooth" , block : "nearest" } ) , 200 ) ;
3529 } ) ;
3630 // If cborByteLength === 0, don't highlight.
3731 const cborStrLength = 2 * cborByteLength ;
38- const unhighlighted = cborByteLength
39- ? children . slice ( 0 , - cborStrLength - 4 )
40- : children ;
41- const highlighted = cborByteLength
42- ? children . slice ( - cborStrLength - 4 , - 4 )
43- : null ;
32+ const unhighlighted = cborByteLength ? children . slice ( 0 , - cborStrLength - 4 ) : children ;
33+ const highlighted = cborByteLength ? children . slice ( - cborStrLength - 4 , - 4 ) : null ;
4434 const cborBytes = cborByteLength ? children . slice ( - 4 ) : null ;
4535 return (
4636 < div className = "text-gray-700 overflow-y-auto break-all max-h-48 md:max-h-56 font-mono" >
@@ -62,6 +52,7 @@ export default function Modal({
6252 address,
6353 chainObject,
6454 sourcifyChains,
55+ etherscanChains,
6556} ) {
6657 const focusButtonRef = useRef ( ) ;
6758 useEffect ( ( ) => {
@@ -72,18 +63,11 @@ export default function Modal({
7263 return null ;
7364 }
7465 const { chainId : chain , name : networkName } = chainObject ;
75- const cborByteLength = decodedCbor
76- ? parseInt ( Number ( "0x" + byteCode . slice ( - 4 ) ) , 10 )
77- : 0 ;
66+ const cborByteLength = decodedCbor ? parseInt ( Number ( "0x" + byteCode . slice ( - 4 ) ) , 10 ) : 0 ;
7867
7968 return (
8069 < Transition . Root show = { isOpen } as = { Fragment } >
81- < Dialog
82- as = "div"
83- className = "fixed z-10 inset-0 md:mx-24 "
84- initialFocus = { focusButtonRef }
85- onClose = { onClose }
86- >
70+ < Dialog as = "div" className = "fixed z-10 inset-0 md:mx-24 " initialFocus = { focusButtonRef } onClose = { onClose } >
8771 < div className = "flex justify-center items-center h-screen py-4 px-4 pb-4 text-center sm:p-0 text-sm md:text-base" >
8872 < Transition . Child
8973 as = { Fragment }
@@ -98,10 +82,7 @@ export default function Modal({
9882 </ Transition . Child >
9983
10084 { /* This element is to trick the browser into centering the modal contents. */ }
101- < span
102- className = "hidden sm:inline-block sm:align-middle sm:h-screen"
103- aria-hidden = "true"
104- >
85+ < span className = "hidden sm:inline-block sm:align-middle sm:h-screen" aria-hidden = "true" >
10586 ​
10687 </ span >
10788 < Transition . Child
@@ -119,50 +100,34 @@ export default function Modal({
119100 < div className = "mt-3 sm:mt-0 sm:ml-4 sm:text-left white" >
120101 { address ? (
121102 < div >
122- < Dialog . Title
123- as = "h3"
124- className = "text-center text-lg leading-6 font-medium text-gray-900"
125- >
103+ < Dialog . Title as = "h3" className = "text-center text-lg leading-6 font-medium text-gray-900" >
126104 Contract { address } on { networkName }
127105 </ Dialog . Title >
128106
129- < div
130- className = "flex justify-center align-middle my-2"
131- ref = { focusButtonRef }
132- >
107+ < div className = "flex justify-center align-middle my-2" ref = { focusButtonRef } >
133108 < SourcifyButton chain = { chain } address = { address } />
134109 < BlockExplorerButton
135110 chain = { chain }
136111 address = { address }
137112 sourcifyChains = { sourcifyChains }
113+ etherscanChains = { etherscanChains }
138114 />
139115 </ div >
140116 </ div >
141117 ) : null }
142- < p className = "text-lg font-bold text-gray-900" >
143- Contract Bytecode
144- </ p >
145- < ByteCodeInput cborByteLength = { cborByteLength } >
146- { byteCode }
147- </ ByteCodeInput >
118+ < p className = "text-lg font-bold text-gray-900" > Contract Bytecode</ p >
119+ < ByteCodeInput cborByteLength = { cborByteLength } > { byteCode } </ ByteCodeInput >
148120 { /* Decoded */ }
149121 < div className = "mt-4" >
150- < p className = "text-lg font-bold text-gray-900" >
151- CBOR decoding
152- </ p >
122+ < p className = "text-lg font-bold text-gray-900" > CBOR decoding</ p >
153123
154124 { decodedCbor ? (
155125 < div >
156126 < span > CBOR length:</ span > { " " }
157- < pre className = { "inline-block " + cborHighlightStyle } >
158- { cborByteLength } Bytes
159- </ pre >
127+ < pre className = { "inline-block " + cborHighlightStyle } > { cborByteLength } Bytes</ pre >
160128 < span className = "text-xs underline ml-2 text-gray-700" >
161129 < a
162- href = { `https://cbor.me/?bytes=${ byteCode . slice (
163- - ( 2 * cborByteLength ) - 4 ,
164- - 4
165- ) } `}
130+ href = { `https://cbor.me/?bytes=${ byteCode . slice ( - ( 2 * cborByteLength ) - 4 , - 4 ) } ` }
166131 target = "_blank"
167132 rel = "noreferrer"
168133 >
@@ -180,17 +145,13 @@ export default function Modal({
180145 { /* solc version */ }
181146 { decodedCbor ?. solc && (
182147 < div className = "mt-4" >
183- < p className = "text-lg font-bold text-gray-900" >
184- Solidity compiler version (decoded)
185- </ p >
148+ < p className = "text-lg font-bold text-gray-900" > Solidity compiler version (decoded)</ p >
186149 < SolcVersion hexversion = { decodedCbor . solc } />
187150 </ div >
188151 ) }
189152 { /* IPFS Link */ }
190153 < div className = "mt-4" >
191- < p className = "text-lg font-bold text-gray-900" >
192- Metadata Hash (decoded)
193- </ p >
154+ < p className = "text-lg font-bold text-gray-900" > Metadata Hash (decoded)</ p >
194155 < MetadataAndSources metadataHash = { metadataHash } />
195156 </ div >
196157 </ div >
0 commit comments