import{r}from"./solana-DqgBswAh.js";function h(){const e=r.useCallback((t,p)=>new Promise((g,o)=>{const a=`${t}-${Date.now()}-${Math.random()}`,s=C=>{const{type:v,requestId:T,response:n}=C.data;v===`${t}-response`&&T===a&&(window.removeEventListener("message",s),n.success?g(n.data):o(new Error(n.error||"Unknown error")))};window.addEventListener("message",s),window.parent.postMessage({type:t,payload:p,requestId:a},"*"),setTimeout(()=>{window.removeEventListener("message",s),o(new Error("Request timeout"))},3e4)}),[]),u=r.useCallback(()=>e("get-pool-id"),[e]),c=r.useCallback(()=>e("get-token-mint"),[e]),l=r.useCallback(()=>e("get-bloom-token"),[e]),d=r.useCallback(t=>e("execute-buy",t),[e]),i=r.useCallback(t=>e("execute-sell",t),[e]),k=r.useCallback(t=>e("execute-dev-order",t),[e]),w=r.useCallback(t=>e("execute-transfer-tokens",t),[e]),m=r.useCallback(t=>e("execute-delete-order",t),[e]),x=r.useCallback(t=>e("execute-share-pnl",t),[e]),b=r.useCallback(t=>e("show-toast",t),[e]);return{getPoolId:u,getTokenMint:c,getBloomToken:l,executeBuy:d,executeSell:i,executeDevOrder:k,executeTransferTokens:w,executeDeleteOrder:m,executeSharePnl:x,showToast:b}}export{h as u};
