PageSourceSearch

https://protocol.art/assets/hashTypedData-fc5ab6bd.js

js protocol.art collected 2026-10-06 19:11:43 UTC 4,286 bytes, 2 lines download raw bytes

1import{aJ as I,ax as H,am as g,_ as E,aK as p,M as l,Q as D,aL as N,aw as A,ag as C,ah as O,aM as j,aN as B,$ as T,aE as v}from"./index-c2fc66f8.js";const R=`�Ethereum Signed Message:
2`;function W(e){const t=(()=>typeof e=="string"?I(e):typeof e.raw=="string"?e.raw:H(e.raw))(),s=I(`${R}${g(t)}`);return E([s,t])}function G(e,t){return p(W(e),t)}class _ extends l{constructor({domain:t}){super(`Invalid domain "${D(t)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class F extends l{constructor({primaryType:t,types:s}){super(`Invalid primary type \`${t}\` must be one of \`${JSON.stringify(Object.keys(s))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class J extends l{constructor({type:t}){super(`Struct type "${t}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}function U(e){const{domain:t,message:s,primaryType:r,types:n}=e,a=(m,h)=>{const c={...h};for(const o of m){const{name:y,type:d}=o;d==="address"&&(c[y]=c[y].toLowerCase())}return c},i=(()=>n.EIP712Domain?t?a(n.EIP712Domain,t):{}:{})(),f=(()=>{if(r!=="EIP712Domain")return a(n[r],s)})();return D({domain:i,message:f,primaryType:r,types:n})}function L(e){const{domain:t,message:s,primaryType:r,types:n}=e,a=(i,f)=>{for(const m of i){const{name:h,type:c}=m,o=f[h],y=c.match(N);if(y&&(typeof o=="number"||typeof o=="bigint")){const[z,u,k]=y;A(o,{signed:u==="int",size:Number.parseInt(k,10)/8})}if(c==="address"&&typeof o=="string"&&!C(o))throw new O({address:o});const d=c.match(j);if(d){const[z,u]=d;if(u&&g(o)!==Number.parseInt(u,10))throw new B({expectedSize:Number.parseInt(u,10),givenSize:g(o)})}const b=n[c];b&&(V(c),a(b,o))}};if(n.EIP712Domain&&t){if(typeof t!="object")throw new _({domain:t});a(n.EIP712Domain,t)}if(r!=="EIP712Domain")if(n[r])a(n[r],s);else throw new F({primaryType:r,types:n})}function x({domain:e}){return[typeof(e==null?void 0:e.name)=="string"&&{name:"name",type:"string"},(e==null?void 0:e.version)&&{name:"version",type:"string"},(typeof(e==null?void 0:e.chainId)=="number"||typeof(e==null?void 0:e.chainId)=="bigint")&&{name:"chainId",type:"uint256"},(e==null?void 0:e.verifyingContract)&&{name:"verifyingContract",type:"address"},(e==null?void 0:e.salt)&&{name:"salt",type:"bytes32"}].filter(Boolean)}function X({domain:e}){return P({domain:e,types:{EIP712Domain:x({domain:e})}})}function V(e){if(e==="address"||e==="bool"||e==="string"||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new J({type:e})}function Y(e){const{domain:t={},message:s,primaryType:r}=e,n={EIP712Domain:x({domain:t}),...e.types};L({domain:t,message:s,primaryType:r,types:n});const a=["0x1901"];return t&&a.push(P({domain:t,types:n})),r!=="EIP712Domain"&&a.push(w({data:s,primaryType:r,types:n})),p(E(a))}function P({domain:e,types:t}){return w({data:e,primaryType:"EIP712Domain",types:t})}function w({data:e,primaryType:t,types:s}){const r=M({data:e,primaryType:t,types:s});return p(r)}function M({data:e,primaryType:t,types:s}){const r=[{type:"bytes32"}],n=[K({primaryType:t,types:s})];for(const a of s[t]){const[i,f]=$({types:s,name:a.name,type:a.type,value:e[a.name]});r.push(i),n.push(f)}return T(r,n)}function K({primaryType:e,types:t}){const s=v(Q({primaryType:e,types:t}));return p(s)}function Q({primaryType:e,types:t}){let s="";const r=S({primaryType:e,types:t});r.delete(e);const n=[e,...Array.from(r).sort()];for(const a of n)s+=`${a}(${t[a].map(({name:i,type:f})=>`${f} ${i}`).join(",")})`;return s}function S({primaryType:e,types:t},s=new Set){const r=e.match(/^\w*/u),n=r==null?void 0:r[0];if(s.has(n)||t[n]===void 0)return s;s.add(n);for(const a of t[n])S({primaryType:a.type,types:t},s);return s}function $({types:e,name:t,type:s,value:r}){if(e[s]!==void 0)return[{type:"bytes32"},p(M({data:r,primaryType:s,types:e}))];if(s==="bytes")return[{type:"bytes32"},p(r)];if(s==="string")return[{type:"bytes32"},p(v(r))];if(s.lastIndexOf("]")===s.length-1){const n=s.slice(0,s.lastIndexOf("[")),a=r.map(i=>$({name:t,type:n,types:e,value:i}));return[{type:"bytes32"},p(T(a.map(([i])=>i),a.map(([,i])=>i)))]}return[{type:s},r]}export{_ as I,G as a,F as b,J as c,P as d,w as e,X as f,x as g,Y as h,R as p,U as s,W as t,L as v};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.