(globalThis.webpackChunk=globalThis.webpackChunk||[]).push([[1938],{361938(__unused_webpack___webpack_module__,__webpack_exports__,__webpack_require__){(function(){if(!this.ST)return()=>{};with(this.ST)with(this.RH)with(this.G)return function(){"use strict";__webpack_require__.d(__webpack_exports__,{DL:()=>g,Dl:()=>a,Fy:()=>p,xF:()=>y});var e=__webpack_require__(644174);var t=__webpack_require__(496705);var r=__webpack_require__(496218);let n="https://token.api.cx.metamask.io";let a="TokenService Error: Network does not support fetchTokenMetadata";let i=`${n}/v1/suggestedOccurrenceFloors`;let o=60*6e4;let s;let c=0;let l;async function u(){let e=Date.now();return s!==undefined&&e-c<o?s:(0,l!==undefined)?l:(0,l=(async()=>{try{let e=await fetch(i);if(e.ok){let t=await e.json();s=t&&typeof t=="object"&&!Array.isArray(t)?t:{}}else s={}}catch{s={}}finally{c=Date.now(),l=undefined}return s??{}})())}async function f(t){return(await u())[String((0,e.n6)(t))]??3}async function d(t){let r=await f(t);return`${n}/tokens/${(0,e.n6)(t)}?occurrenceFloor=${r}&includeNativeAssets=false&includeTokenFees=false&includeAssetType=false&includeERC20Permit=false&includeStorage=false&includeRwaData=true`}function h(t,r){return`${n}/token/${(0,e.n6)(t)}?address=${r}&includeRwaData=true`}function w(e){let{assetIds:t,...r}=e;let a=t.map(e=>encodeURIComponent(e)).join(",");let i=new URLSearchParams;return Object.entries(r).forEach(([e,t])=>{t!==undefined&&i.append(e,String(t))}),`${n}/assets?assetIds=${a}${i.toString()?`&${i.toString()}`:""}`}async function y(e,r,{timeout:n=1e4}={}){let a=await d(e);let i=await k(a,r,n);if(i){let r=await m(i);return Array.isArray(r)&&e===t.nU["linea-mainnet"]?r.filter(e=>Boolean(e.aggregators.includes("lineaTeam"))||e.aggregators.length>=3):(0,r)}return undefined}async function g(t,{includeAggregators:r,includeCoingeckoId:n,includeLabels:a,includeMarketData:i,includeOccurrences:o,includeTokenSecurityData:s,includeRwaData:c}={}){if(t.length===0)return[];let l=w({assetIds:t,includeAggregators:r,includeCoingeckoId:n,includeLabels:a,includeMarketData:i,includeOccurrences:o,includeTokenSecurityData:s,includeRwaData:c});try{let t=await (0,e.Pf)(l);if(Array.isArray(t))return t;return[]}catch{return[]}}async function p(e,t,n,{timeout:i=1e4}={}){if(!(0,r.xJ)(e))throw new Error(a);let o=h(e,t);let s=await k(o,n,i);return s?m(s):(0,undefined)}async function k(t,r,n){try{return await (0,e.Ou)(t,{referrer:t,referrerPolicy:"no-referrer-when-downgrade",method:"GET",mode:"cors",signal:r,cache:"default",headers:{"Content-Type":"application/json"}},n)}catch(e){e instanceof Error&&e.name==="AbortError"&&console.log("Request is aborted")}return undefined}async function m(e){let t=await e.json();if(t?.error)throw new Error(`TokenService Error: ${t.error}`);return t}}}).call(__webpack_require__._LM_("@metamask/assets-controllers",{__webpack_require__,__webpack_exports__}))()}}]);