"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8548],{89888:function(e,s,r){r.d(s,{Z:function(){return K}});var n=r(85893),t=r(34151),a=r(65291),i=r(77374),o=r(10191),l=r(33838),d=r(23438),c=r(56880),u=r(67294),h=r(39399),m=r(39513),x=r(21967),g=r(32862),p=r(23100),f=r(31507),j=r(204),b=r(96272),y=r(87536),v=r(99640),S=r(64903),w=r(85e3),k=r(97733),C=r(70654),I=r(28129),R=r(74206),_=r(12022),E=u.memo(e=>{let{formState:s,control:r}=e,t=u.useCallback(e=>{let{field:r}=e,t="address"in s.errors?s.errors.address:void 0;return(0,n.jsxs)(C.NI,{variant:"floating",id:r.name,isRequired:!0,size:"md",bgColor:"dialog_bg",mt:8,children:[(0,n.jsx)(I.I,{...r,required:!0,isInvalid:!!t,maxLength:R.y,isDisabled:s.isSubmitting,autoComplete:"off",bgColor:"dialog_bg"}),(0,n.jsx)(_.Z,{text:"Smart contract address (0x...)",error:t})]})},[s.errors,s.isSubmitting]);return(0,n.jsx)(y.Qr,{name:"address",control:r,render:t,rules:{required:!0,pattern:R.T}})}),N=u.memo(e=>{let{defaultAddress:s,onContinue:r}=e,{handleSubmit:t,formState:a,control:i,setError:o,clearErrors:l,watch:d}=(0,y.cI)({mode:"onBlur",defaultValues:{address:s}}),c=(0,S.Z)(),m=d("address");u.useEffect(()=>{l("root")},[m,l]);let x=t(u.useCallback(async e=>{var s,n;try{let n={contractAddress:e.address},t=await c("address_verification",{fetchParams:{method:"POST",body:n},pathParams:{chainId:h.Z.chain.id,type:":prepare"}});if("SUCCESS"!==t.status){let e="number"==typeof t.status?"UNKNOWN_ERROR":t.status,r=("payload"in t?null===(s=t.payload)||void 0===s?void 0:s.message:void 0)||"Oops! Something went wrong";return o("root",{type:e,message:r})}r({...t.result,address:e.address})}catch(e){o("root",{type:"manual",message:(null===(n=e.payload)||void 0===n?void 0:n.message)||"Oops! Something went wrong"})}},[c,r,o])),g=(()=>{var e,s;switch(null===(e=a.errors.root)||void 0===e?void 0:e.type){case"INVALID_ADDRESS_ERROR":return(0,n.jsx)("span",{children:"Specified address either does not exist or is EOA."});case"IS_OWNER_ERROR":return(0,n.jsx)("span",{children:"Ownership of this contract address is already verified by this account."});case"OWNERSHIP_VERIFIED_ERROR":return(0,n.jsx)("span",{children:"Ownership of this contract address is already verified by another account."});case"SOURCE_CODE_NOT_VERIFIED_ERROR":{let e=(0,v.B)({pathname:"/address/[hash]/contract-verification",query:{hash:m}});return(0,n.jsxs)(p.xu,{children:[(0,n.jsx)("span",{children:"The contract source code you entered is not yet verified. Please follow these steps to "}),(0,n.jsx)(w.Z,{href:e,children:"verify the contract"}),(0,n.jsx)("span",{children:"."})]})}case void 0:return null;default:return null===(s=a.errors.root)||void 0===s?void 0:s.message}})();return(0,n.jsxs)("form",{noValidate:!0,onSubmit:x,children:[(0,n.jsx)(p.xu,{children:"Enter the contract address you are verifying ownership for."}),g&&(0,n.jsx)(f.b,{status:"warning",mt:3,children:g}),(0,n.jsx)(E,{formState:a,control:i}),(0,n.jsxs)(j.k,{alignItems:{base:"flex-start",lg:"center"},mt:8,columnGap:5,rowGap:2,flexDir:{base:"column",lg:"row"},children:[(0,n.jsx)(b.z,{size:"lg",type:"submit",isLoading:a.isSubmitting,loadingText:"Continue",flexShrink:0,children:"Continue"}),(0,n.jsx)(k.Z,{})]})]})}),A=r(75350),O=r(94060),T=r(47860),D=r(71310),G=r(92321),Z=r(61774),V=r(31314),z=r(92074),W=r(41753),P=u.memo(e=>{let{formState:s,control:r}=e,t=u.useCallback(e=>{let{field:r}=e,t="message"in s.errors?s.errors.message:void 0;return(0,n.jsxs)(C.NI,{variant:"floating",id:r.name,isRequired:!0,size:"md",bgColor:"dialog_bg",children:[(0,n.jsx)(W.g,{...r,required:!0,isInvalid:!!t,isReadOnly:!0,autoComplete:"off",maxH:{base:"140px",lg:"80px"},bgColor:"dialog_bg"}),(0,n.jsx)(_.Z,{text:"Message to sign",error:t})]})},[s.errors]);return(0,n.jsx)(y.Qr,{defaultValue:"some value",name:"message",control:r,render:t,rules:{required:!0}})});let L=/^0x[a-fA-F\d]{130}$/;var q=u.memo(e=>{let{formState:s,control:r}=e,t=u.useCallback(e=>{let{field:r}=e,t="signature"in s.errors?s.errors.signature:void 0;return(0,n.jsxs)(C.NI,{variant:"floating",id:r.name,isRequired:!0,size:"md",bgColor:"dialog_bg",children:[(0,n.jsx)(I.I,{...r,required:!0,isInvalid:!!t,isDisabled:s.isSubmitting,autoComplete:"off",bgColor:"dialog_bg"}),(0,n.jsx)(_.Z,{text:"Signature hash",error:t})]})},[s.errors,s.isSubmitting]);return(0,n.jsx)(y.Qr,{name:"signature",control:r,render:t,rules:{required:!0,pattern:L}})}),U=u.memo(e=>{let{address:s,signingMessage:r,contractCreator:t,contractOwner:a,onContinue:i,noWeb3Provider:o}=e,[d,c]=u.useState(o?"manual":"wallet"),{open:m}=(0,D.k_)(),{isConnected:x}=(0,G.m)(),{handleSubmit:g,formState:v,control:w,setValue:C,getValues:I,setError:R,clearErrors:_,watch:E}=(0,y.cI)({mode:"onBlur",defaultValues:{message:r}}),N=(0,S.Z)(),W=E("signature");u.useEffect(()=>{_("root")},[_,W]);let L=g(u.useCallback(async e=>{try{let r={contractAddress:s,message:e.message,signature:e.signature},n=await N("address_verification",{fetchParams:{method:"POST",body:r},pathParams:{chainId:h.Z.chain.id,type:":verify"}});if("SUCCESS"!==n.status){let e="number"==typeof n.status?"UNKNOWN_STATUS":n.status;return R("root",{type:e,message:"INVALID_SIGNER_ERROR"===n.status?n.invalidSigner.signer:void 0})}i(n.result.verifiedAddress,d)}catch(e){R("root",{type:"UNKNOWN_STATUS"})}},[s,N,i,R,d])),{signMessage:U,isPending:F}=(0,Z.Q)(),K=u.useCallback(e=>{c(e),_("root")},[_]),Y=u.useCallback(()=>{_("root"),m()},[_,m]),B=u.useCallback(()=>{if(_("root"),!x)return R("root",{type:"manual",message:"Please connect to your Web3 wallet first"});U({message:I("message")},{onSuccess:e=>{C("signature",e),L()},onError:e=>R("root",{type:"SIGNING_FAIL",message:(null==e?void 0:e.message)||"Oops! Something went wrong"})})},[_,x,I,U,R,C,L]),M=u.useCallback(()=>{_("root"),L()},[_,L]),Q="manual"===d?(0,n.jsx)(b.z,{size:"lg",onClick:M,isLoading:v.isSubmitting,loadingText:"Verifying",children:"Verify"}):(0,n.jsx)(b.z,{size:"lg",onClick:x?B:Y,isLoading:v.isSubmitting||F,loadingText:F?"Signing":"Verifying",children:x?"Sign and verify":"Connect wallet"}),H=(0,n.jsxs)("span",{children:["contact us ",(0,n.jsx)(l.r,{href:"mailto:help@blockscout.com",children:"help@blockscout.com"})]}),X=(()=>{var e;switch(null===(e=v.errors.root)||void 0===e?void 0:e.type){case"INVALID_SIGNATURE_ERROR":return(0,n.jsx)("span",{children:"The signature could not be processed."});case"VALIDITY_EXPIRED_ERROR":return(0,n.jsx)("span",{children:"This verification message has expired. Add the contract address to restart the process."});case"SIGNING_FAIL":return(0,n.jsx)("span",{children:v.errors.root.message});case"INVALID_SIGNER_ERROR":{let e=(0,V.Z)(v.errors.root.message||""),s=[t,a].filter(Boolean).map(e=>(0,V.Z)(e)).join(", ");return(0,n.jsxs)(p.xu,{children:[(0,n.jsx)("span",{children:"This address "}),(0,n.jsx)("span",{children:e}),(0,n.jsx)("span",{children:" is not a creator/owner of the requested contract and cannot claim ownership. Only "}),(0,n.jsx)("span",{children:s}),(0,n.jsx)("span",{children:" can verify ownership of this contract."})]})}case"UNKNOWN_STATUS":return(0,n.jsxs)(p.xu,{children:[(0,n.jsx)("span",{children:"We are not able to process the verify account ownership for this contract address. Kindly "}),H,(0,n.jsx)("span",{children:" for further assistance."})]});case void 0:return null}})();return(0,n.jsxs)("form",{noValidate:!0,onSubmit:L,children:[X&&(0,n.jsx)(f.b,{status:"warning",mb:6,children:X}),(0,n.jsxs)(p.xu,{mb:8,children:[(0,n.jsx)("span",{children:"Please select the address to sign and copy the message and sign it using the Blockscout message provider of your choice. "}),(0,n.jsx)(l.r,{href:"https://docs.blockscout.com/for-users/my-account/verified-addresses/copy-and-sign-message",target:"_blank",children:"Additional instructions"}),(0,n.jsx)("span",{children:". If you do not see your address here but are sure that you are the owner of the contract, kindly "}),H,(0,n.jsx)("span",{children:" for further assistance."})]}),(a||t)&&(0,n.jsxs)(j.k,{flexDir:"column",rowGap:4,mb:4,children:[t&&(0,n.jsxs)(p.xu,{children:[(0,n.jsx)(A.m.span,{fontWeight:600,children:"Contract creator: "}),(0,n.jsx)(A.m.span,{children:t})]}),a&&(0,n.jsxs)(p.xu,{children:[(0,n.jsx)(A.m.span,{fontWeight:600,children:"Contract owner: "}),(0,n.jsx)(A.m.span,{children:a})]})]}),(0,n.jsxs)(j.k,{rowGap:5,flexDir:"column",children:[(0,n.jsxs)("div",{children:[(0,n.jsx)(z.Z,{text:r,ml:"auto",display:"block"}),(0,n.jsx)(P,{formState:v,control:w})]}),!o&&(0,n.jsxs)(O.E,{onChange:K,value:d,display:"flex",flexDir:"column",rowGap:4,children:[(0,n.jsx)(T.Y,{value:"wallet",children:"Sign via Web3 wallet"}),(0,n.jsx)(T.Y,{value:"manual",children:"Sign manually"})]}),"manual"===d&&(0,n.jsx)(q,{formState:v,control:w})]}),(0,n.jsxs)(j.k,{alignItems:{base:"flex-start",lg:"center"},mt:8,columnGap:5,rowGap:2,flexDir:{base:"column",lg:"row"},children:[Q,(0,n.jsx)(k.Z,{})]})]})}),F=u.memo(e=>{let{onAddTokenInfoClick:s,onShowListClick:r,isToken:t,address:a}=e;return(0,n.jsxs)(p.xu,{children:[(0,n.jsxs)(f.b,{status:"success",flexWrap:"wrap",whiteSpace:"pre-wrap",wordBreak:"break-word",mb:3,display:"inline-block",children:[(0,n.jsx)("span",{children:"The address ownership for "}),(0,n.jsx)(A.m.span,{fontWeight:700,children:a}),(0,n.jsx)("span",{children:" is verified."})]}),(0,n.jsx)("p",{children:"You may now submit the “Add token information” request"}),(0,n.jsxs)(j.k,{alignItems:"center",mt:8,columnGap:5,flexWrap:"wrap",rowGap:5,children:[(0,n.jsx)(b.z,{size:"lg",variant:t?"outline":"solid",onClick:r,children:"View my verified addresses"}),t&&(0,n.jsx)(b.z,{size:"lg",onClick:s,children:"Add token information"})]})]})}),K=u.memo(e=>{let{defaultAddress:s,isOpen:r,onClose:p,onSubmit:f,onAddTokenInfoClick:j,onShowListClick:b,pageType:y}=e,[v,S]=u.useState(0),[w,k]=u.useState({address:"",signingMessage:""});u.useEffect(()=>{r&&m.Kz(m.GM.VERIFY_ADDRESS,{Action:"Form opened","Page type":y})},[r,y]);let C=u.useCallback(e=>{k(e),S(e=>e+1),m.Kz(m.GM.VERIFY_ADDRESS,{Action:"Address entered","Page type":y})},[y]),I=u.useCallback((e,s)=>{f(e),S(e=>e+1),k(s=>({...s,isToken:!!e.metadata.tokenName})),m.Kz(m.GM.VERIFY_ADDRESS,{Action:"Sign ownership","Page type":y,"Sign method":s})},[f,y]),R=u.useCallback(()=>{S(e=>e-1)},[]),_=u.useCallback(()=>{p(),S(0),k({address:"",signingMessage:""})},[p]),E=u.useCallback(()=>{j(w.address),_()},[_,w.address,j]),A=[{title:"Verify new address ownership",content:(0,n.jsx)(N,{onContinue:C,defaultAddress:s})},{title:"Copy and sign message",content:(0,n.jsx)(U,{...w,onContinue:I,noWeb3Provider:!h.Z.features.blockchainInteraction.isEnabled})},{title:"Congrats! Address is verified.",content:(0,n.jsx)(F,{onShowListClick:b,onAddTokenInfoClick:E,isToken:w.isToken,address:w.address})}][v];return(0,n.jsxs)(t.u_,{isOpen:r,onClose:_,size:{base:"full",lg:"md"},children:[(0,n.jsx)(a.Z,{}),(0,n.jsxs)(i.h,{children:[(0,n.jsxs)(o.x,{fontWeight:"500",textStyle:"h3",mb:6,children:[0!==v&&(0,n.jsx)(l.r,{mr:3,onClick:R,children:(0,n.jsx)(x.Z,{name:"arrows/east",boxSize:6,transform:"rotate(180deg)",verticalAlign:"middle",color:"gray.400"})}),(0,n.jsx)("span",{children:A.title})]}),(0,n.jsx)(d.o,{}),(0,n.jsx)(c.f,{mb:0,children:(0,n.jsx)(g.Z,{children:A.content})})]})]})})},12022:function(e,s,r){var n=r(85893),t=r(96177),a=r(75350),i=r(67294);s.Z=i.memo(e=>{let{text:s,icon:r,error:i,isFancy:o}=e,l=null==i?void 0:i.message;return l||(null==i?void 0:i.type)!=="pattern"||(l="Invalid format"),(0,n.jsxs)(t.l,{alignItems:"center",...o?{"data-fancy":!0}:{},variant:"floating",bgColor:"deeppink",children:[r,(0,n.jsx)(a.m.span,{children:s}),l&&(0,n.jsxs)(a.m.span,{order:3,whiteSpace:"pre",children:[" - ",l]})]})})},96343:function(e,s,r){var n=r(85893),t=r(75350),a=r(31708),i=r(93344),o=r(776),l=r(24262);r(67294);let d=(0,t.m)(e=>{let{isAnimated:s,children:r,className:t}=e;return(0,n.jsx)(a.r,{as:l.E.div,w:"100%",initial:s?{opacity:0,scale:.97}:{opacity:1,scale:1},animate:{opacity:1,scale:1},transitionDuration:"normal",transitionTimingFunction:"linear",rowGap:2,columnGap:2,gridTemplateColumns:"86px auto",alignItems:"start",paddingY:4,borderColor:"divider",borderTopWidth:"1px",_last:{borderBottomWidth:"1px"},className:t,fontSize:"sm",lineHeight:"20px",children:r})}),c=(0,t.m)(e=>{let{children:s,className:r,isLoading:t}=e;return(0,n.jsx)(i.O,{className:r,isLoaded:!t,fontWeight:500,my:"5px",justifySelf:"start",children:s})}),u=(0,t.m)(e=>{let{children:s,className:r}=e;return(0,n.jsx)(o.P,{className:r,py:"5px",color:"text_secondary",overflow:"hidden",children:s})});s.Z={Container:d,Label:c,Value:u}},97733:function(e,s,r){var n=r(85893),t=r(23100),a=r(33838),i=r(75350);r(67294),s.Z=(0,i.m)(e=>{let{className:s}=e;return(0,n.jsxs)(t.xu,{className:s,children:[(0,n.jsx)("span",{children:"Need help? Contact admin team at "}),(0,n.jsx)(a.r,{href:"mailto:help@blockscout.com",children:"help@blockscout.com"}),(0,n.jsx)("span",{children:" for assistance!"})]})})}}]);
//# sourceMappingURL=8548-c186f1775f29fc17.js.map