"use strict";var r=require("viem"),e=require("viem/chains"),t=require("./errors-CBapWvRs.js");const i=(r,e,i)=>{let p,o=r.id,l=Number(r.id);if(r.rpcUrls.privyWalletOverride&&r.rpcUrls.privyWalletOverride.http[0])p=r.rpcUrls.privyWalletOverride.http[0];else if(e.rpcUrls&&e.rpcUrls[l])p=e.rpcUrls[l];else if(r.rpcUrls.privy?.http[0]){let e=new URL(r.rpcUrls.privy.http[0]);e.searchParams.append("privyAppId",i),p=e.toString()}else p=r.rpcUrls.public?.http[0]?r.rpcUrls.public.http[0]:r.rpcUrls.default?.http[0];if(!p)throw new t.PrivyConnectorError(`No RPC url found for ${o}`);return p};exports.getJsonRpcEndpointFromChain=i,exports.getPublicClient=(p,o,l,n)=>{let s=Number(p),c=o.find((r=>r.id===s));if(!c)throw new t.PrivyConnectorError(`Unsupported chainId ${p}`,4901);let d=i(c,l,n.appId);if(s===e.tempo.id||s===e.tempoModerato.id){let t=s===e.tempo.id?e.tempo:e.tempoModerato;return r.createPublicClient({transport:r.http(d),chain:t})}return r.createPublicClient({transport:r.http(d),chain:c})},exports.isTempoChainId=function(r){if(void 0===r)return!1;let t=Number(r);return Number.isFinite(t)&&(t===e.tempo.id||t===e.tempoModerato.id)};
//# sourceMappingURL=getPublicClient-CFd_sHBk.js.map
