PageSourceSearch

https://aerodrome.finance/assets/index-kW2MbKmv.js

js aerodrome.finance collected 2026-10-02 06:14:23 UTC 32,272 bytes, 9 lines download raw bytes

1import{r as He}from"./index-BozP5vQt.js";import{ec as Re,ed as Le,ee as K,ef as qe,eg as J,eh as Q,ei as Y,ej as Ne,ek as Ve,el as De}from"./index-hZR_pMzJ.js";import"./browser-ponyfill-CEp-GVeJ.js";const z=BigInt(2**32-1),Z=BigInt(32);function Fe(e,t=!1){return t?{h:Number(e&z),l:Number(e>>Z&z)}:{h:Number(e>>Z&z)|0,l:Number(e&z)|0}}function Ue(e,t=!1){let n=new Uint32Array(e.length),s=new Uint32Array(e.length);for(let r=0;r<e.length;r++){const{h:i,l:o}=Fe(e[r],t);[n[r],s[r]]=[i,o]}return[n,s]}const Ge=(e,t,n)=>e<<n|t>>>32-n,We=(e,t,n)=>t<<n|e>>>32-n,Xe=(e,t,n)=>t<<n-32|e>>>64-n,Ke=(e,t,n)=>e<<n-32|t>>>64-n,ce=[],ue=[],le=[],Je=BigInt(0),B=BigInt(1),Qe=BigInt(2),Ye=BigInt(7),Ze=BigInt(256),et=BigInt(113);for(let e=0,t=B,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],ce.push(2*(5*s+n)),ue.push((e+1)*(e+2)/2%64);let r=Je;for(let i=0;i<7;i++)t=(t<<B^(t>>Ye)*et)%Ze,t&Qe&&(r^=B<<(B<<BigInt(i))-B);le.push(r)}const[tt,nt]=Ue(le,!0),ee=(e,t,n)=>n>32?Xe(e,t,n):Ge(e,t,n),te=(e,t,n)=>n>32?Ke(e,t,n):We(e,t,n);function st(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,l=n[c],f=n[c+1],h=ee(l,f,1)^n[a],_=te(l,f,1)^n[a+1];for(let A=0;A<50;A+=10)e[o+A]^=h,e[o+A+1]^=_}let r=e[2],i=e[3];for(let o=0;o<24;o++){const a=ue[o],c=ee(r,i,a),l=te(r,i,a),f=ce[o];r=e[f],i=e[f+1],e[f]=c,e[f+1]=l}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}e[0]^=tt[s],e[1]^=nt[s]}n.fill(0)}class V extends Le{constructor(t,n,s,r=!1,i=24){if(super(),this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=r,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,K(s),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=qe(this.state)}keccak(){J||Q(this.state32),st(this.state32,this.rounds),J||Q(this.state32),this.posOut=0,this.pos=0}update(t){Y(this);const{blockLen:n,state:s}=this;t=Ne(t);const r=t.length;for(let i=0;i<r;){const o=Math.min(n-this.pos,r-i);for(let a=0;a<o;a++)s[this.pos++]^=t[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:s,blockLen:r}=this;t[s]^=n,(n&128)!==0&&s===r-1&&this.keccak(),t[r-1]^=128,this.keccak()}writeInto(t){Y(this,!1),Ve(t),this.finish();const n=this.state,{blockLen:s}=this;for(let r=0,i=t.length;r<i;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,i-r);t.set(n.subarray(this.posOut,this.posOut+o),r),this.posOut+=o,r+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return K(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(De(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:r,rounds:i,enableXOF:o}=this;return t||(t=new V(n,s,r,o,i)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=i,t.suffix=s,t.outputLen=r,t.enableXOF=o,t.destroyed=this.destroyed,t}}const rt=(e,t,n)=>Re(()=>new V(t,e,n)),it=rt(1,136,256/8),ot=()=>"9.1.0",at=e=>e.toString(16).padStart(2,"0"),ct=e=>{const t=new Uint8Array(e/2);return window.crypto.getRandomValues(t),Array.from(t,at).join("")},ut=()=>typeof window<"u"?ct(10):new Date().getTime().toString(36);class M{}M.makeRequest=(e,t)=>({id:ut(),method:e,params:t,env:{sdkVersion:ot()}});M.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t});M.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var d;(function(e){e.sendTransactions="sendTransactions",e.rpcCall="rpcCall",e.getChainInfo="getChainInfo",e.getSafeInfo="getSafeInfo",e.getTxBySafeTxHash="getTxBySafeTxHash",e.getSafeBalances="getSafeBalances",e.signMessage="signMessage",e.signTypedMessage="signTypedMessage",e.getEnvironmentInfo="getEnvironmentInfo",e.getOffChainSignature="getOffChainSignature",e.requestAddressBook="requestAddressBook",e.wallet_getPermissions="wallet_getPermissions",e.wallet_requestPermissions="wallet_requestPermissions"})(d||(d={}));var H;(function(e){e.requestAddressBook="requestAddressBook"})(H||(H={}));class lt{constructor(t=null,n=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>"u",this.isValidMessage=({origin:s,data:r,source:i})=>{const o=!r,a=!this.isServer&&i===window.parent,c=typeof r.version<"u"&&parseInt(r.version.split(".")[0]),l=typeof c=="number"&&c>=1;let f=!0;return Array.isArray(this.allowedOrigins)&&(f=this.allowedOrigins.find(h=>h.test(s))!==void 0),!o&&a&&l&&f},this.logIncomingMessage=s=>{console.info(`Safe Apps SDK v1: A message was received from origin ${s.origin}. `,s.data)},this.onParentMessage=s=>{this.isValidMessage(s)&&(this.debugMode&&this.logIncomingMessage(s),this.handleIncomingMessage(s.data))},this.handleIncomingMessage=s=>{const{id:r}=s,i=this.callbacks.get(r);i&&(i(s),this.callbacks.delete(r))},this.send=(s,r)=>
1{const i=M.makeRequest(s,r);if(this.isServer)throw new Error("Window doesn't exist");return window.parent.postMessage(i,"*"),new Promise((o,a)=>{this.callbacks.set(i.id,c=>{if(!c.success){a(new Error(c.error));return}o(c)})})},this.allowedOrigins=t,this.debugMode=n,this.isServer||window.addEventListener("message",this.onParentMessage)}}const fe=e=>typeof e=="object"&&e!=null&&"domain"in e&&"types"in e&&"message"in e;He();class ft{constructor(t){this.communicator=t}async getBySafeTxHash(t){if(!t)throw new Error("Invalid safeTxHash");return(await this.communicator.send(d.getTxBySafeTxHash,{safeTxHash:t})).data}async signMessage(t){const n={message:t};return(await this.communicator.send(d.signMessage,n)).data}async signTypedMessage(t){if(!fe(t))throw new Error("Invalid typed data");return(await this.communicator.send(d.signTypedMessage,{typedData:t})).data}async send({txs:t,params:n}){if(!t||!t.length)throw new Error("No transactions were passed");const s={txs:t,params:n};return(await this.communicator.send(d.sendTransactions,s)).data}}const p={eth_call:"eth_call",eth_gasPrice:"eth_gasPrice",eth_getLogs:"eth_getLogs",eth_getBalance:"eth_getBalance",eth_getCode:"eth_getCode",eth_getBlockByHash:"eth_getBlockByHash",eth_getBlockByNumber:"eth_getBlockByNumber",eth_getStorageAt:"eth_getStorageAt",eth_getTransactionByHash:"eth_getTransactionByHash",eth_getTransactionReceipt:"eth_getTransactionReceipt",eth_getTransactionCount:"eth_getTransactionCount",eth_estimateGas:"eth_estimateGas",safe_setSettings:"safe_setSettings"},m={defaultBlockParam:(e="latest")=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e};class dt{constructor(t){this.communicator=t,this.call=this.buildRequest({call:p.eth_call,formatters:[null,m.defaultBlockParam]}),this.getBalance=this.buildRequest({call:p.eth_getBalance,formatters:[null,m.defaultBlockParam]}),this.getCode=this.buildRequest({call:p.eth_getCode,formatters:[null,m.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:p.eth_getStorageAt,formatters:[null,m.blockNumberToHex,m.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:p.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:p.eth_getBlockByHash,formatters:[null,m.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:p.eth_getBlockByNumber,formatters:[m.blockNumberToHex,m.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:p.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:p.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:p.eth_getTransactionCount,formatters:[null,m.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:p.eth_gasPrice}),this.getEstimateGas=n=>this.buildRequest({call:p.eth_estimateGas})([n]),this.setSafeSettings=this.buildRequest({call:p.safe_setSettings})}buildRequest(t){const{call:n,formatters:s}=t;return async r=>{s&&Array.isArray(r)&&s.forEach((a,c)=>
1{a&&(r[c]=a(r[c]))});const i={call:n,params:r||[]};return(await this.communicator.send(d.rpcCall,i)).data}}}function ht(e,t){return e.exec(t)?.groups}const ne=/^tuple(?<array>(\[(\d*)\])*)$/;function R(e){let t=e.type;if(ne.test(e.type)&&"components"in e){t="(";const n=e.components.length;for(let r=0;r<n;r++){const i=e.components[r];t+=R(i),r<n-1&&(t+=", ")}const s=ht(ne,e.type);return t+=`)${s?.array??""}`,R({...e,type:t})}return"indexed"in e&&e.indexed&&(t=`${t} indexed`),e.name?`${t} ${e.name}`:t}function E(e){let t="";const n=e.length;for(let s=0;s<n;s++){const r=e[s];t+=R(r),s!==n-1&&(t+=", ")}return t}function pt(e){return e.type==="function"?`function ${e.name}(${E(e.inputs)})${e.stateMutability&&e.stateMutability!=="nonpayable"?` ${e.stateMutability}`:""}${e.outputs.length?` returns (${E(e.outputs)})`:""}`:e.type==="event"?`event ${e.name}(${E(e.inputs)})`:e.type==="error"?`error ${e.name}(${E(e.inputs)})`:e.type==="constructor"?`constructor(${E(e.inputs)})${e.stateMutability==="payable"?" payable":""}`:e.type==="fallback"?"fallback()":"receive() external payable"}function L(e,{includeName:t=!1}={}){if(e.type!=="function"&&e.type!=="event"&&e.type!=="error")throw new Bt(e.type);return`${e.name}(${de(e.inputs,{includeName:t})})`}function de(e,{includeName:t=!1}={}){return e?e.map(n=>gt(n,{includeName:t})).join(t?", ":","):""}function gt(e,{includeName:t}){return e.type.startsWith("tuple")?`(${de(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")}function O(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function g(e){return O(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const yt="2.18.2",mt=()=>`viem@${yt}`;class u extends Error{constructor(t,n={}){super(),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ViemError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:mt()});const s=n.cause instanceof u?n.cause.details:n.cause?.message?n.cause.message:n.details,r=n.cause instanceof u&&n.cause.docsPath||n.docsPath;this.message=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${n.docsBaseUrl??"https://viem.sh"}${r}${n.docsSlug?`#${n.docsSlug}`:""}`]:[],...s?[`Details: ${s}`]:[],`Version: ${this.version}`].join(`
2`),n.cause&&(this.cause=n.cause),this.details=s,this.docsPath=r,this.metaMessages=n.metaMessages,this.shortMessage=t}walk(t){return he(this,t)}}function he(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e?he(e.cause,t):t?null:e}class bt extends u{constructor({expectedLength:t,givenLength:n,type:s}){super([`ABI encoding array length mismatch for type ${s}.`,`Expected length: ${t}`,`Given length: ${n}`].join(`
3`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingArrayLengthMismatchError"})}}class wt extends u{constructor({expectedSize:t,value:n}){super(`Size of bytes "${n}" (bytes${g(n)}) does not match expected size (bytes${t}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingBytesSizeMismatchError"})}}class xt extends u{constructor({expectedLength:t,givenLength:n}){super(["ABI encoding params/values length mismatch.",`Expected length (params): ${t}`,`Given length (values): ${n}`].join(`
4`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiEncodingLengthMismatchError"})}}class se extends u{constructor(t,{docsPath:n}={}){super([`Function ${t?`"${t}" `:""}not found on ABI.`,"Make sure you are using the correct ABI and that the function exists on it."].join(`
5`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiFunctionNotFoundError"})}}class St extends u{constructor(t,n){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${t.type}\` in \`${L(t.abiItem)}\`, and`,`\`${n.type}\` in \`${L(n.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItemAmbiguityError"})}}class At extends u{constructor({expectedSize:t,givenSize:n}){super(`Expected bytes${t}, got bytes${n}.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BytesSizeMismatchError"})}}class $t extends u{constructor(t,{docsPath:n}){super([`Type "${t}" is not a valid encoding type.`,"Please provide a valid ABI type."].join(`
6`),{docsPath:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiEncodingType"})}}class Pt extends u{constructor(t){super([`Value "${t}" is not a valid array.`].join(`
7`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidArrayError"})}}class Bt extends u{constructor(t){super([`"${t}" is not a valid definition type.`,'Valid types: "function", "event", "error"'].join(`
8`)),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidDefinitionTypeError"})}}class pe extends u{constructor({offset:t,position:n,size:s}){super(`Slice ${n==="start"?"starting":"ending"} at offset "${t}" is out-of-bounds (size: ${s}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SliceOffsetOutOfBoundsError"})}}class ge extends u{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeExceedsPaddingSizeError"})}}function $(e,{dir:t,size:n=32}={}){return typeof e=="string"?w(e,{dir:t,size:n}):Et(e,{dir:t,size:n})}function w(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new ge({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Et(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new ge({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let r=0;r<n;r++){const i=t==="right";s[i?r:n-r-1]=e[i?r:e.length-r-1]}return s}class Tt extends u{constructor({max:t,min:n,signed:s,size:r,value:i}
8){super(`Number "${i}" is not in safe ${r?`${r*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"IntegerOutOfRangeError"})}}class It extends u{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SizeOverflowError"})}}function k(e,{size:t}){if(g(e)>t)throw new It({givenSize:g(e),maxSize:t})}const Ot=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function D(e,t={}){return typeof e=="number"||typeof e=="bigint"?S(e,t):typeof e=="string"?v(e,t):typeof e=="boolean"?ye(e,t):F(e,t)}function ye(e,t={}){const n=`0x${Number(e)}`;return typeof t.size=="number"?(k(n,{size:t.size}),$(n,{size:t.size})):n}function F(e,t={}){let n="";for(let r=0;r<e.length;r++)n+=Ot[e[r]];const s=`0x${n}`;return typeof t.size=="number"?(k(s,{size:t.size}),$(s,{dir:"right",size:t.size})):s}function S(e,t={}){const{signed:n,size:s}=t,r=BigInt(e);let i;s?n?i=(1n<<BigInt(s)*8n-1n)-1n:i=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof i=="bigint"&&n?-i-1n:0;if(i&&r>i||r<o){const c=typeof e=="bigint"?"n":"";throw new Tt({max:i?`${i}${c}`:void 0,min:`${o}${c}`,signed:n,size:s,value:`${e}${c}`})}const a=`0x${(n&&r<0?(1n<<BigInt(s*8))+BigInt(r):r).toString(16)}`;return s?$(a,{size:s}):a}const kt=new TextEncoder;function v(e,t={}){const n=kt.encode(e);return F(n,t)}const _t=new TextEncoder;function me(e,t={}){return typeof e=="number"||typeof e=="bigint"?vt(e,t):typeof e=="boolean"?zt(e,t):O(e)?be(e,t):we(e,t)}function zt(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(k(n,{size:t.size}),$(n,{size:t.size})):n}const b={zero:48,nine:57,A:65,F:70,a:97,f:102};function re(e){if(e>=b.zero&&e<=b.nine)return e-b.zero;if(e>=b.A&&e<=b.F)return e-(b.A-10);if(e>=b.a&&e<=b.f)return e-(b.a-10)}function be(e,t={}){let n=e;t.size&&(k(n,{size:t.size}),n=$(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const r=s.length/2,i=new Uint8Array(r);for(let o=0,a=0;o<r;o++){const c=re(s.charCodeAt(a++)),l=re(s.charCodeAt(a++));if(c===void 0||l===void 0)throw new u(`Invalid byte sequence ("${s[a-2]}${s[a-1]}" in "${s}").`);i[o]=c*16+l}return i}function vt(e,t){const n=S(e,t);return be(n)}function we(e,t={}){const n=_t.encode(e);return typeof t.size=="number"?(k(n,{size:t.size}),$(n,{dir:"right",size:t.size})):n}function y(e,t){const n=t||"hex",s=it(O(e,{strict:!1})?me(e):e);return n==="bytes"?s:D(s)}const Mt=e=>y(me(e));function Ct(e){return Mt(e)}function jt(e){let t=!0,n="",s=0,r="",i=!1;for(let o=0;o<e.length;o++){const a=e[o];if(["(",")",","].includes(a)&&(t=!0),a==="("&&s++,a===")"&&s--,!!t){if(s===0){if(a===" "&&["event","function",""].includes(r))r="";else if(r+=a,a===")"){i=!0;break}continue}if(a===" "){e[o-1]!==","&&n!==","&&n!==",("&&(n="",t=!1);continue}r+=a,n+=a}}if(!i)throw new u("Unable to normalize signature.");return r}const Ht=e=>{const t=typeof e=="string"?e:pt(e);return jt(t)};function xe(e){return Ct(Ht(e))}const Rt=xe;class Se extends u{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAddressError"})}}class Ae extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}set(t,n){return super.set(t,n),this.maxSize&&this.size>this.maxSize&&this.delete(this.keys().next().value),this}}const C=new Ae(8192);function Lt(e,t){if(C.has(`${e}.${t}`))return C.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=y(we(n),"bytes"),r=n.split("");for(let o=0;o<40;o+=2)s[o>>1]>>4>=8&&r[o]&&(r[o]=r[o].toUpperCase()),(s[o>>1]&15)>=8&&r[o+1]&&(r[o+1]=r[o+1].toUpperCase());const i=`0x${r.join("")}`;return C.set(`${e}.${t}`,i),i}const qt=/^0x[a-fA-F0-9]{40}$/,j=new Ae(8192);function T(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(j.has(s))return j.get(s);const r=qt.test(e)?e.toLowerCase()===e?!0:n?Lt(e)===e:!0:!1;return j.set(s,r),r}function x(e){return typeof e[0]=="string"?$e(e):Nt(e)}function Nt(e){let t=0;
8for(const r of e)t+=r.length;const n=new Uint8Array(t);let s=0;for(const r of e)n.set(r,s),s+=r.length;return n}function $e(e){return`0x${e.reduce((t,n)=>t+n.replace("0x",""),"")}`}function Pe(e,t,n,{strict:s}={}){return O(e,{strict:!1})?Dt(e,t,n,{strict:s}):Vt(e,t,n,{strict:s})}function Be(e,t){if(typeof t=="number"&&t>0&&t>g(e)-1)throw new pe({offset:t,position:"start",size:g(e)})}function Ee(e,t,n){if(typeof t=="number"&&typeof n=="number"&&g(e)!==n-t)throw new pe({offset:n,position:"end",size:g(e)})}function Vt(e,t,n,{strict:s}={}){Be(e,t);const r=e.slice(t,n);return s&&Ee(r,t,n),r}function Dt(e,t,n,{strict:s}={}){Be(e,t);const r=`0x${e.replace("0x","").slice((t??0)*2,(n??e.length)*2)}`;return s&&Ee(r,t,n),r}function U(e,t){if(e.length!==t.length)throw new xt({expectedLength:e.length,givenLength:t.length});const n=Ft({params:e,values:t}),s=W(n);return s.length===0?"0x":s}function Ft({params:e,values:t}){const n=[];for(let s=0;s<e.length;s++)n.push(G({param:e[s],value:t[s]}));return n}function G({param:e,value:t}){const n=Yt(e.type);if(n){const[s,r]=n;return Gt(t,{length:s,param:{...e,type:r}})}if(e.type==="tuple")return Qt(t,{param:e});if(e.type==="address")return Ut(t);if(e.type==="bool")return Xt(t);if(e.type.startsWith("uint")||e.type.startsWith("int")){const s=e.type.startsWith("int");return Kt(t,{signed:s})}if(e.type.startsWith("bytes"))return Wt(t,{param:e});if(e.type==="string")return Jt(t);throw new $t(e.type,{docsPath:"/docs/contract/encodeAbiParameters"})}function W(e){let t=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?t+=32:t+=g(a)}const n=[],s=[];let r=0;for(let i=0;i<e.length;i++){const{dynamic:o,encoded:a}=e[i];o?(n.push(S(t+r,{size:32})),s.push(a),r+=g(a)):n.push(a)}return x([...n,...s])}function Ut(e){if(!T(e))throw new Se({address:e});return{dynamic:!1,encoded:w(e.toLowerCase())}}function Gt(e,{length:t,param:n}){const s=t===null;if(!Array.isArray(e))throw new Pt(e);if(!s&&e.length!==t)throw new bt({expectedLength:t,givenLength:e.length,type:`${n.type}[${t}]`});let r=!1;const i=[];for(let o=0;o<e.length;o++){const a=G({param:n,value:e[o]});a.dynamic&&(r=!0),i.push(a)}if(s||r){const o=W(i);if(s){const a=S(i.length,{size:32});return{dynamic:!0,encoded:i.length>0?x([a,o]):a}}if(r)return{dynamic:!0,encoded:o}}return{dynamic:!1,encoded:x(i.map(({encoded:o})=>o))}}function Wt(e,{param:t}){const[,n]=t.type.split("bytes"),s=g(e);if(!n){let r=e;return s%32!==0&&(r=w(r,{dir:"right",size:Math.ceil((e.length-2)/2/32)*32})),{dynamic:!0,encoded:x([w(S(s,{size:32})),r])}}if(s!==Number.parseInt(n))throw new wt({expectedSize:Number.parseInt(n),value:e});return{dynamic:!1,encoded:w(e,{dir:"right"})}}function Xt(e){if(typeof e!="boolean")throw new u(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:w(ye(e))}}function Kt(e,{signed:t}){return{dynamic:!1,encoded:S(e,{size:32,signed:t})}}function Jt(e){const t=v(e),n=Math.ceil(g(t)/32),s=[];for(let r=0;r<n;r++)s.push(w(Pe(t,r*32,(r+1)*32),{dir:"right"}));return{dynamic:!0,encoded:x([w(S(g(t),{size:32})),...s])}}function Qt(e,{param:t}){let n=!1;const s=[];for(let r=0;r<t.components.length;r++){const i=t.components[r],o=Array.isArray(e)?r:i.name,a=G({param:i,value:e[o]});s.push(a),a.dynamic&&(n=!0)}return{dynamic:n,encoded:n?W(s):x(s.map(({encoded:r})=>r))}}function Yt(e){const t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}const Te=e=>Pe(xe(e),0,4);function Zt(e){const{abi:t,args:n=[],name:s}=e,r=O(s,{strict:!1}),i=t.filter(a=>r?a.type==="function"?Te(a)===s:a.type==="event"?Rt(a)===s:!1:"name"in a&&a.name===s);if(i.length===0)return;if(i.length===1)return i[0];let o;for(const a of i){if(!("inputs"in a))continue;if(!n||n.length===0){if(!a.inputs||a.inputs.length===0)return a;continue}if(!a.inputs||a.inputs.length===0||a.inputs.length!==n.length)continue;if(n.every((l,f)=>{const h="inputs"in a&&a.inputs[f];return h?q(l,h):!1})){if(o&&"inputs"in o&&o.inputs){const l=Ie(a.inputs,o.inputs,n);if(l)throw new St({abiItem:a,type:l[0]},{abiItem:o,type:l[1]})}o=a}}return o||i[0]}function q(e,t){const n=typeof e,s=t.type;switch(s){case"address":return T(e,{strict:!1});case"bool":return n==="boolean";
8case"function":return n==="string";case"string":return n==="string";default:return s==="tuple"&&"components"in t?Object.values(t.components).every((r,i)=>q(Object.values(e)[i],r)):/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(s)?n==="number"||n==="bigint":/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(s)?n==="string"||e instanceof Uint8Array:/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(s)?Array.isArray(e)&&e.every(r=>q(r,{...t,type:s.replace(/(\[[0-9]{0,}\])$/,"")})):!1}}function Ie(e,t,n){for(const s in e){const r=e[s],i=t[s];if(r.type==="tuple"&&i.type==="tuple"&&"components"in r&&"components"in i)return Ie(r.components,i.components,n[s]);const o=[r.type,i.type];if(o.includes("address")&&o.includes("bytes20")?!0:o.includes("address")&&o.includes("string")?T(n[s],{strict:!1}):o.includes("address")&&o.includes("bytes")?T(n[s],{strict:!1}):!1)return o}}const ie="/docs/contract/encodeFunctionData";function en(e){const{abi:t,args:n,functionName:s}=e;let r=t[0];if(s){const i=Zt({abi:t,args:n,name:s});if(!i)throw new se(s,{docsPath:ie});r=i}if(r.type!=="function")throw new se(void 0,{docsPath:ie});return{abi:[r],functionName:Te(L(r))}}function oe(e){const{args:t}=e,{abi:n,functionName:s}=e.abi.length===1&&e.functionName?.startsWith("0x")?e:en(e),r=n[0],i=s,o="inputs"in r&&r.inputs?U(r.inputs,t??[]):void 0;return $e([i,o??"0x"])}const tn=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,nn=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/;function sn(e){const{domain:t={},message:n,primaryType:s}=e,r={EIP712Domain:un({domain:t}),...e.types};cn({domain:t,message:n,primaryType:s,types:r});const i=["0x1901"];return t&&i.push(rn({domain:t,types:r})),s!=="EIP712Domain"&&i.push(Oe({data:n,primaryType:s,types:r})),y(x(i))}function rn({domain:e,types:t}){return Oe({data:e,primaryType:"EIP712Domain",types:t})}function Oe({data:e,primaryType:t,types:n}){const s=ke({data:e,primaryType:t,types:n});return y(s)}function ke({data:e,primaryType:t,types:n}){const s=[{type:"bytes32"}],r=[on({primaryType:t,types:n})];for(const i of n[t]){const[o,a]=ze({types:n,name:i.name,type:i.type,value:e[i.name]});s.push(o),r.push(a)}return U(s,r)}function on({primaryType:e,types:t}){const n=D(an({primaryType:e,types:t}));return y(n)}function an({primaryType:e,types:t}){let n="";const s=_e({primaryType:e,types:t});s.delete(e);const r=[e,...Array.from(s).sort()];for(const i of r)n+=`${i}(${t[i].map(({name:o,type:a})=>`${a} ${o}`).join(",")})`;return n}function _e({primaryType:e,types:t},n=new Set){const r=e.match(/^\w*/u)?.[0];if(n.has(r)||t[r]===void 0)return n;n.add(r);for(const i of t[r])_e({primaryType:i.type,types:t},n);return n}function ze({types:e,name:t,type:n,value:s}){if(e[n]!==void 0)return[{type:"bytes32"},y(ke({data:s,primaryType:n,types:e}))];if(n==="bytes")return s=`0x${(s.length%2?"0":"")+s.slice(2)}`,[{type:"bytes32"},y(s)];if(n==="string")return[{type:"bytes32"},y(D(s))];if(n.lastIndexOf("]")===n.length-1){const r=n.slice(0,n.lastIndexOf("[")),i=s.map(o=>ze({name:t,type:r,types:e,value:o}));return[{type:"bytes32"},y(U(i.map(([o])=>o),i.map(([,o])=>o)))]}return[{type:n},s]}function cn(e){const{domain:t,message:n,primaryType:s,types:r}=e,i=(o,a)=>{for(const c of o){const{name:l,type:f}=c,h=a[l],_=f.match(nn);if(_&&(typeof h=="number"||typeof h=="bigint")){const[Ce,P,je]=_;S(h,{signed:P==="int",size:Number.parseInt(je)/8})}if(f==="address"&&typeof h=="string"&&!T(h))throw new Se({address:h});const A=f.match(tn);if(A){const[Ce,P]=A;if(P&&g(h)!==Number.parseInt(P))throw new At({expectedSize:Number.parseInt(P),givenSize:g(h)})}const X=r[f];X&&i(X,h)}};r.EIP712Domain&&t&&i(r.EIP712Domain,t),s!=="EIP712Domain"&&i(r[s],n)}function un({domain:e}){return[typeof e?.name=="string"&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},typeof e?.chainId=="number"&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}
8].filter(Boolean)}const ln=`�Ethereum Signed Message:
9`;function fn(e){const t=typeof e=="string"?v(e):typeof e.raw=="string"?e.raw:F(e.raw),n=v(`${ln}${g(t)}`);return x([n,t])}function dn(e,t){return y(fn(e),t)}const hn="0x1626ba7e",pn="0x20c13b0b",N=4001;class I extends Error{constructor(t,n,s){super(t),this.code=n,this.data=s,Object.setPrototypeOf(this,I.prototype)}}class ve{constructor(t){this.communicator=t}async getPermissions(){return(await this.communicator.send(d.wallet_getPermissions,void 0)).data}async requestPermissions(t){if(!this.isPermissionRequestValid(t))throw new I("Permissions request is invalid",N);try{return(await this.communicator.send(d.wallet_requestPermissions,t)).data}catch{throw new I("Permissions rejected",N)}}isPermissionRequestValid(t){return t.every(n=>typeof n=="object"?Object.keys(n).every(s=>!!Object.values(H).includes(s)):!1)}}const ae=(e,t)=>t.some(n=>n.parentCapability===e),gn=()=>(e,t,n)=>{const s=n.value;return n.value=async function(){const r=new ve(this.communicator);let i=await r.getPermissions();if(ae(t,i)||(i=await r.requestPermissions([{[t]:{}}])),!ae(t,i))throw new I("Permissions rejected",N);return s.apply(this)},n};var yn=function(e,t,n,s){var r=arguments.length,i=r<3?t:s===null?s=Object.getOwnPropertyDescriptor(t,n):s,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")i=Reflect.decorate(e,t,n,s);else for(var a=e.length-1;a>=0;a--)(o=e[a])&&(i=(r<3?o(i):r>3?o(t,n,i):o(t,n))||i);return r>3&&i&&Object.defineProperty(t,n,i),i};class Me{constructor(t){this.communicator=t}async getChainInfo(){return(await this.communicator.send(d.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(d.getSafeInfo,void 0)).data}async experimental_getBalances({currency:t="usd"}={}){return(await this.communicator.send(d.getSafeBalances,{currency:t})).data}async check1271Signature(t,n="0x"){const s=await this.getInfo(),r=oe({abi:[{constant:!1,inputs:[{name:"_dataHash",type:"bytes32"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:p.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(d.rpcCall,i)).data.slice(0,10).toLowerCase()===hn}catch{return!1}}async check1271SignatureBytes(t,n="0x"){const s=await this.getInfo(),r=oe({abi:[{constant:!1,inputs:[{name:"_data",type:"bytes"},{name:"_signature",type:"bytes"}],name:"isValidSignature",outputs:[{name:"",type:"bytes4"}],payable:!1,stateMutability:"nonpayable",type:"function"}],functionName:"isValidSignature",args:[t,n]}),i={call:p.eth_call,params:[{to:s.safeAddress,data:r},"latest"]};try{return(await this.communicator.send(d.rpcCall,i)).data.slice(0,10).toLowerCase()===pn}catch{return!1}}calculateMessageHash(t){return dn(t)}calculateTypedMessageHash(t){const n=typeof t.domain.chainId=="object"?t.domain.chainId.toNumber():Number(t.domain.chainId);let s=t.primaryType;if(!s){const r=Object.values(t.types),i=Object.keys(t.types).filter(o=>r.every(a=>a.every(({type:c})=>c.replace("[","").replace("]","")!==o)));if(i.length===0||i.length>1)throw new Error("Please specify primaryType");s=i[0]}return sn({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:s})}async getOffChainSignature(t){return(await this.communicator.send(d.getOffChainSignature,t)).data}async isMessageSigned(t,n="0x"){let s;if(typeof t=="string"&&(s=async()=>{const r=this.calculateMessageHash(t);return await this.isMessageHashSigned(r,n)}),fe(t)&&(s=async()=>{const r=this.calculateTypedMessageHash(t);return await this.isMessageHashSigned(r,n)}),s)return await s();throw new Error("Invalid message type")}async isMessageHashSigned(t,n="0x"){const s=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(const r of s)if(await r(t,n))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(d.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(d.requestAddressBook,void 0)).data}}yn([gn()],Me.prototype,"requestAddressBook",null);class xn{constructor(t={}){const{allowedDomains:n=null,debug:s=!1}=t;this.communicator=new lt(n,s),this.eth=new dt(this.communicator),this.txs=new ft(this.communicator),this.safe=new Me(this.communicator),this.wallet=new ve(this.communicator)}}export{M as MessageFormatter,d as Methods,p as RPC_CALLS,H as RestrictedMethods,xn as default,ot as getSDKVersion,fe as isObjectEIP712TypedData}
vendor: 2 bytes, line 9
9;

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.