PageSourceSearch

https://phantom.com/_web_platform_assets/usePriceHistory-BEukGKcw.js

js phantom.com collected 2026-10-01 08:37:58 UTC 4,806 bytes, 1 lines download raw bytes

1import{p as D,j as t,q as w,c as x,a as h,s as c,e as p,f as k,b as E,l as i,u as P}from"./phantom-ui-9_ioPNP4.js";import{L as j,P as N}from"./Intro-DdM2r8aT.js";import{W as u}from"./WebText-DXxu9hPf.js";import{b as H}from"./constants-BcLd24ib.js";import{u as M}from"./useQuery-1QV9pwDU.js";import{r as F}from"./requestBuilder-DNK2VTi2.js";import{C as m,m as o}from"./chains-QyT6f0s9.js";import{C as V,c as I,a as q}from"./chainConfigRegistry-ClmUPDCy.js";import{e as A,d as B}from"./encodeCaip19-CFXmn2XC.js";import{t as n}from"./toMilliseconds-lEPjhsBN.js";const S=r=>{const s=m.getNetworkIDs(r),e=m.getMainnetNetworkID(s[0]),a=m[r].slip44;return{chainId:e,resourceType:V.nativeToken,slip44:a}};var l={strong:"_3w9sf23",em:"_3w9sf24",underline:"_3w9sf25",orderedList:"_3w9sf20",unorderedList:"_3w9sf21",list:"_3w9sf26",link:"_3w9sf22",color:D({defaultClassName:"_3w9sf27",variantClassNames:{color:{blue:"_3w9sf28",green:"_3w9sf29",grey:"_3w9sf2a",purple:"_3w9sf2b",lilac:"_3w9sf2c",black:"_3w9sf2d",midnightPurple:"_3w9sf2e",moonYellow:"_3w9sf2f",pink:"_3w9sf2g",white:"_3w9sf2h",yellow:"_3w9sf2i"}},defaultVariants:{},compoundVariants:[]})};const U={block:{normal:({children:r})=>t.jsx(u,{font:"bodyM",asChild:!0,display:"block",children:t.jsx("p",{children:r})}),small:({children:r})=>t.jsx(u,{font:"bodyS",asChild:!0,display:"block",children:t.jsx("p",{children:r})})},marks:{em:({children:r})=>t.jsx("i",{className:l.em,children:r}),color:({children:r,value:s})=>{const e=s==null?void 0:s.color;return t.jsx("span",{className:l.color({color:e}),children:r})},strong:({children:r})=>t.jsx("b",{className:l.strong,children:r}),link:({children:r,value:s})=>t.jsx(j,{...H(s),className:l.link,children:r})},list:{bullet:({children:r})=>t.jsx("ul",{className:w(l.unorderedList,l.list),children:r}),number:({children:r})=>t.jsx("ol",{className:w(l.orderedList,l.list),children:r})},listItem:{bullet:({children:r})=>t.jsx(u,{asChild:!0,font:"bodyM",children:t.jsx("li",{children:r})}),number:({children:r})=>t.jsx(u,{asChild:!0,font:"bodyM",children:t.jsx("li",{children:r})})}},ur=r=>{const s=x.c(2),{content:e}=r;let a;return s[0]!==e?(a=t.jsx(N,{value:e,components:U}),s[0]=e,s[1]=a):a=s[1],a};function Y(r){return(Math.pow(2,-10*r)-.0009765625)*1.0009775171065494}function dr(r){return 1-Y(r)}const O=new q({[o.Solana]:{liveChartDataEnabled:!0},[o.Ethereum]:{liveChartDataEnabled:!0},[o.Polygon]:{liveChartDataEnabled:!0},[o.Base]:{liveChartDataEnabled:!0,nativeOhlcSourceCaip19:A(S(o.Ethereum))},[o.Arbitrum]:{},[o.Monad]:{},[o.Bitcoin]:{},[o.Sui]:{},[o.Hypercore]:{},[o.Hyperevm]:{},[o.Bnb]:{liveChartDataEnabled:!0,requiredFeatureFlag:"enable-bnb"},[o.Robinhood]:{liveChartDataEnabled:!0,requiredFeatureFlag:"enable-robinhood"},[o.Arc]:{liveChartDataEnabled:!0,requiredFeatureFlag:"enable-arc"}}),Q=I(O),mr=h({caip19:c(),price:p().nullish(),priceChange24h:p().nullish(),lastUpdatedAt:c().datetime({offset:!0}),marketCap:c().nullish(),volume24hUSD:c().nullish()}),W=["1H","1D","1W","1M","1Y","YTD","ALL"],L=k(W);L.nullish().transform(r=>r??"1D");const _=L.exclude(["1Y"]);_.options;const yr=k(_.options).nullish().transform(r=>r??"1D"),K=[i("1m"),i("5m"),i("1h"),i("4h"),i("1d"),i("1w"),i("4w"),i("1mo")];P(K).nullish().transform(r=>r??"1d");const $=h({unixTime:p(),value:c()}),R=h({history:E($)}),C="prices",z={priceHistory:(r,s)=>[C,r,s],priceHistoryInterval:(r,s,e,a)=>[C,r,s,e,...a?[a]:[]]};var G=(r=>(r[r.Always=1/0]="Always",r[r.Short=n({days:1})]="Short",r[r.Medium=n({days:3})]="Medium",r[r.Long=n({days:7})]="Long",r[r.VeryLong=n({days:30})]="VeryLong",r[r.Never=0]="Never",r))(G||{}),f=(r=>(r[r.Immediate=0]="Immediate",r[r.VeryShort=n({seconds:1})]="VeryShort",r[r.Short=n({seconds:15})]="Short",r[r.Medium=n({minutes:3})]="Medium",r[r.Long=n({minutes:5})]="Long",r[r.VeryLong=n({minutes:10})]="VeryLong",r[r.Never=1/0]="Never",r))(f||{}),J=(r=>(r[r.VeryShort=n({seconds:2})]="VeryShort",r[r.Short=n({seconds:15})]="Short",r[r.Medium=n({minutes:3})]="Medium",r[r.Long=n({minutes:5})]="Long",r))(J||{});const y=new Error("Price history unavailable for this token"),X=new Error("Insufficient data for this time frame and token"),Z=async({caip19:r,timeFrame:s},e)=>{var g;const a=B(r);if((g=Q.get(a.chainId))!=null&&g.pricesDisabled)throw y;const b=await F.api().get("/price-history/v1",{params:{token:r,type:s},signal:e==null?void 0:e.signal});if(b.status===400)throw y;const d=R.safeParse(b.data);if(!d.success)throw y;if(d.data.history.length<2)throw X;return d.data.history},T=({caip19:r,timeFrame:s})=>({queryKey:z.priceHistory(r,s),queryFn:async({signal:e})=>Z({caip19:r,timeFrame:s},{signal:e}),staleTime:f.Short,gcTime:f.Short}),pr=r=>{const s=x.c(2);let e;return s[0]!==r?(e=T(r),s[0]=r,s[1]=e):e=s[1],M(e)};
1export{ur as B,Q as P,mr as a,U as b,y as c,X as d,dr as e,yr as f,pr as u};

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.