@tuwaio/satellite-evm 0.0.4 → 1.0.0-fix-test-alpha.2.f8f5982
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.mjs
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {e,f,B,c,b,w,a,t,d,g,K,i,j,h,J,I,H,G,F,E,D,C,A as A$1,z,y,x,v,u,s,r,q,p,o,n,m,l,k as k$1}from'./chunk-J3JCN55Z.mjs';import'./chunk-LHUJBWEN.mjs';import'./chunk-6R4Y2ZVK.mjs';import {OrbitAdapter}from'@tuwaio/orbit-core';import {createViemClient,getAvatar,getName,checkAndSwitchChain}from'@tuwaio/orbit-evm';import {getWalletTypeFromConnectorName}from'@tuwaio/satellite-core';import {getBytecode,getChains,getAccount,getConnectors,disconnect,connect,createConfig,createConnector,ChainNotConfiguredError}from'@wagmi/core';import {injected,metaMask,coinbaseWallet,safe,walletConnect}from'@wagmi/connectors';async function Sr(r){return new Promise(e=>setTimeout(e,r))}function Ir(r,{delay:e=100,retryCount:o=2,shouldRetry:n=()=>true}={}){return new Promise((p,a)=>{let i=async({count:m=0}={})=>{let f=async({error:s})=>{let x=typeof e=="function"?e({count:m,error:s}):e;x&&await Sr(x),i({count:m+1});};try{let s=await r();p(s);}catch(s){if(m<o&&await n({count:m,error:s}))return f({error:s});a(s);}};i();})}var rr=256,er;function kr(r=11){if(!er||rr+r>256*2){er="",rr=0;for(let e=0;e<256;e++)er+=(256+Math.random()*256|0).toString(16).substring(1);}return er.substring(rr,rr+++r)}var or=new e(8192);function Ar(r,{enabled:e=true,id:o}){if(!e||!o)return r();if(or.get(o))return or.get(o);let n=r().finally(()=>or.delete(o));return or.set(o,n),n}function vr(r$1,e={}){return async(o$1,n$1={})=>{let{dedupe:p$1=false,methods:a$1,retryDelay:i=150,retryCount:m$1=3,uid:f}={...e,...n$1},{method:s$1}=o$1;if(a$1?.exclude?.includes(s$1))throw new t(new Error("method not supported"),{method:s$1});if(a$1?.include&&!a$1.include.includes(s$1))throw new t(new Error("method not supported"),{method:s$1});let x$1=p$1?d(`${f}.${g(o$1)}`):void 0;return Ar(()=>Ir(async()=>{try{return await r$1(o$1)}catch(c){let t$1=c;switch(t$1.code){case k$1.code:throw new k$1(t$1);case l.code:throw new l(t$1);case m.code:throw new m(t$1,{method:o$1.method});case n.code:throw new n(t$1);case o.code:throw new o(t$1);case p.code:throw new p(t$1);case q.code:throw new q(t$1);case r.code:throw new r(t$1);case s.code:throw new s(t$1);case t.code:throw new t(t$1,{method:o$1.method});case u.code:throw new u(t$1);case v.code:throw new v(t$1);case w.code:throw new w(t$1);case x.code:throw new x(t$1);case y.code:throw new y(t$1);case z.code:throw new z(t$1);case A$1.code:throw new A$1(t$1);case B.code:throw new B(t$1);case C.code:throw new C(t$1);case D.code:throw new D(t$1);case E.code:throw new E(t$1);case F.code:throw new F(t$1);case G.code:throw new G(t$1);case H.code:throw new H(t$1);case I.code:throw new I(t$1);case 5e3:throw new w(t$1);default:throw c instanceof a?c:new J(t$1)}}},{delay:({count:c,error:t})=>{if(t&&t instanceof h){let d=t?.headers?.get("Retry-After");if(d?.match(/\d/))return Number.parseInt(d,10)*1e3}return ~~(1<<c)*i},retryCount:m$1,shouldRetry:({error:c})=>Hr(c)}),{enabled:p$1,id:x$1})}}function Hr(r){return "code"in r&&typeof r.code=="number"?r.code===-1||r.code===u.code||r.code===o.code:r instanceof h&&r.status?r.status===403||r.status===408||r.status===413||r.status===429||r.status===500||r.status===502||r.status===503||r.status===504:true}function Rr(r){return {formatters:void 0,fees:void 0,serializers:void 0,...r}}function zr(r,{errorInstance:e=new Error("timed out"),timeout:o,signal:n}){return new Promise((p,a)=>{(async()=>{let i;try{let m=new AbortController;o>0&&(i=setTimeout(()=>{n?m.abort():a(e);},o)),p(await r({signal:m?.signal||null}));}catch(m){m?.name==="AbortError"&&a(e),a(m);}finally{clearTimeout(i);}})();})}function Lr(){return {current:0,take(){return this.current++},reset(){this.current=0;}}}var cr=Lr();function tr(r,e={}){return {async request(o){let{body:n,fetchFn:p=e.fetchFn??fetch,onRequest:a=e.onRequest,onResponse:i=e.onResponse,timeout:m=e.timeout??1e4}=o,f={...e.fetchOptions??{},...o.fetchOptions??{}},{headers:s,method:x,signal:c}=f;try{let t=await zr(async({signal:E})=>{let w={...f,body:Array.isArray(n)?g(n.map(u=>({jsonrpc:"2.0",id:u.id??cr.take(),...u}))):g({jsonrpc:"2.0",id:n.id??cr.take(),...n}),headers:{"Content-Type":"application/json",...s},method:x||"POST",signal:c||(m>0?E:null)},mr=new Request(r,w),v=await a?.(mr,w)??{...w,url:r};return await p(v.url??r,v)},{errorInstance:new j({body:n,url:r}),timeout:m,signal:!0});i&&await i(t);let d;if(t.headers.get("Content-Type")?.startsWith("application/json"))d=await t.json();else {d=await t.text();try{d=JSON.parse(d||"{}");}catch(E){if(t.ok)throw E;d={error:d};}}if(!t.ok)throw new h({body:n,details:g(d.error)||t.statusText,headers:t.headers,status:t.status,url:r});return d}catch(t){throw t instanceof h||t instanceof j?t:new h({body:n,cause:t,url:r})}}}}function jr(r,{body:e,onError:o,onResponse:n}){return r.request({body:e,onError:o,onResponse:n}),r}async function Vr(r,{body:e,timeout:o=1e4}){return r.requestAsync({body:e,timeout:o})}var dr={http(r,e){return tr(r).request(e)},webSocket:jr,webSocketAsync:Vr};var k="0x0000000000000000000000000000000000000000";function nr({key:r,methods:e,name:o,request:n,retryCount:p=3,retryDelay:a=150,timeout:i,type:m},f){let s=kr();return {config:{key:r,methods:e,name:o,request:n,retryCount:p,retryDelay:a,timeout:i,type:m},request:vr(n,{methods:e,retryCount:p,retryDelay:a,uid:s}),value:f}}function lr(r,e={}){let{key:o="custom",methods:n,name:p="Custom Provider",retryDelay:a}=e;return ({retryCount:i})=>nr({key:o,methods:n,name:p,request:r.request.bind(r),retryCount:e.retryCount??i,retryDelay:a,type:"custom"})}var ar=class extends a{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"});}};function ur(r,e={}){let{batch:o,fetchFn:n,fetchOptions:p,key:a="http",methods:i$1,name:m="HTTP JSON-RPC",onFetchRequest:f,onFetchResponse:s,retryDelay:x,raw:c}=e;return ({chain:t,retryCount:d,timeout:E})=>{let{batchSize:w=1e3,wait:mr=0}=typeof o=="object"?o:{},v=e.retryCount??d,pr=E??e.timeout??1e4,u=t?.rpcUrls.default.http[0];if(!u)throw new ar;let yr=tr(u,{fetchFn:n,fetchOptions:p,onRequest:f,onResponse:s,timeout:pr});return nr({key:a,methods:i$1,name:m,async request({method:Nr,params:Dr}){let gr={method:Nr,params:Dr},{schedule:Br}=K({id:u,wait:mr,shouldSplitBatch(h){return h.length>w},fn:h=>yr.request({body:h}),sort:(h,qr)=>h.id-qr.id}),Mr=async h=>o?Br(h):[await yr.request({body:h})],[{error:sr,result:br}]=await Mr(gr);if(c)return {error:sr,result:br};if(sr)throw new i({body:gr,error:sr,url:u});return br},retryCount:v,retryDelay:x,timeout:pr,type:"http"},{fetchOptions:p,url:u})}}var ir=Rr({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var hr=new Map;async function Pr({config:r,address:e,chainId:o,chains:n}){if(hr.has(e))return hr.get(e);if(createViemClient(o,n)){let i=!!await getBytecode(r,{address:e});return hr.set(e,i),i}else return false}function qo(r){if(!r)throw new Error("Satellite EVM adapter requires a wagmi config object.");return {key:OrbitAdapter.EVM,connect:async({walletType:e,chainId:o,connectors:n})=>{let p=n.find(a=>getWalletTypeFromConnectorName(OrbitAdapter.EVM,a.name)===e);if(!p)throw new Error("Cannot find connector with this wallet type");try{await connect(r,{connector:p,chainId:o});let a=getAccount(r);return {walletType:e,address:a.address??k,chainId:a.chainId??ir.id,rpcURL:a.chain?.rpcUrls.default.http[0]??ir.rpcUrls.default.http[0],isConnected:a.isConnected,isContractAddress:!1}}catch(a){throw new Error(a instanceof Error?a.message:String(a))}},disconnect:async()=>{getAccount(r).isConnected&&await disconnect(r);},getConnectors:async()=>{let e=getConnectors(r);return {adapter:OrbitAdapter.EVM,connectors:e.map(o=>o)}},checkAndSwitchNetwork:async e=>await checkAndSwitchChain(e,r),getExplorerUrl:e=>{let{chain:o}=getAccount(r),n=o?.blockExplorers?.default.url;return e?`${n}/${e}`:n},getName:e=>getName(e),getAvatar:e=>getAvatar(e),checkIsContractWallet:async({address:e,chainId:o})=>{let n=getChains(r);return await Pr({config:r,address:e,chainId:o,chains:n})}}}A.type="impersonated";function A(r){let e=r.features??{},o=false,n,p;return createConnector(a=>({id:"impersonated",name:"Impersonated Connector",type:A.type,async setup(){n=a.chains[0].id;},async connect({chainId:i}={}){if(e.connectError)throw typeof e.connectError=="boolean"?new w(new Error("Failed to connect.")):e.connectError;let{request:m}=await this.getProvider(),f=await m({method:"eth_requestAccounts"}),s=await this.getChainId();return i&&s!==i&&(s=(await this.switchChain({chainId:i})).id),o=true,{accounts:f,chainId:s}},async disconnect(){o=false,p=void 0;},async getAccounts(){if(!o)throw new Error("Not connected connector");let{request:i}=await this.getProvider();return (await i({method:"eth_accounts"})).map(f)},async getChainId(){let{request:i}=await this.getProvider(),m=await i({method:"eth_chainId"});return b(m,"number")},async isAuthorized(){return o?!!(await this.getAccounts()).length:false},async switchChain({chainId:i}){let m=a.chains.find(s=>s.id===i);if(!m)throw new B(new ChainNotConfiguredError);let{request:f}=await this.getProvider();return await f({method:"wallet_switchEthereumChain",params:[{chainId:c(i)}]}),m},onAccountsChanged(i){i.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:i.map(f)});},onChainChanged(i){let m=Number(i);a.emitter.emit("change",{chainId:m});},async onDisconnect(){a.emitter.emit("disconnect"),o=false,p=void 0;},async getProvider({chainId:i$1}={}){p=r.getAccountAddress()?[r.getAccountAddress()||k]:void 0;let f=(a.chains.find(x=>x.id===i$1)??a.chains[0]).rpcUrls.default.http[0];return lr({request:async({method:x,params:c$1})=>{if(x==="eth_chainId")return c(n);if(x==="eth_requestAccounts")return p;if(x==="eth_signTypedData_v4"&&e.signTypedDataError)throw typeof e.signTypedDataError=="boolean"?new w(new Error("Failed to sign typed data.")):e.signTypedDataError;if(x==="wallet_switchEthereumChain"){if(e.switchChainError)throw typeof e.switchChainError=="boolean"?new w(new Error("Failed to switch chain.")):e.switchChainError;n=b(c$1[0].chainId,"number"),this.onChainChanged(n.toString());return}if(x==="personal_sign"){if(e.signMessageError)throw typeof e.signMessageError=="boolean"?new w(new Error("Failed to sign message.")):e.signMessageError;x="eth_sign",c$1=[c$1[1],c$1[0]];}let t={method:x,params:c$1},{error:d,result:E}=await dr.http(f,{body:t});if(d)throw new i({body:t,error:d,url:f});return E}})({retryCount:1})}}))}var ae={allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/,/metissafe.tech$/],debug:false},Ur=r=>{let e=injected(),o=metaMask({dappMetadata:{name:r.appName,url:r.appUrl}}),n=coinbaseWallet({appName:r.appName,appLogoUrl:r.appLogoUrl}),p=safe({...ae}),a=[e,o,n,p],i=r.appUrl&&r.appIcons&&r.appName&&r.description?{name:r.appName,description:r.description,url:r.appUrl,icons:r.appIcons}:void 0;if(r.projectId&&!r.getImpersonatedAccount)return [walletConnect({projectId:r.projectId,metadata:i}),...a];if(!r.projectId&&r.getImpersonatedAccount)return [A({getAccountAddress:r.getImpersonatedAccount}),...a];if(r.projectId&&r.getImpersonatedAccount){let m=walletConnect({projectId:r.projectId,metadata:i}),f=A({getAccountAddress:r.getImpersonatedAccount});return [m,f,...a]}else return a};var me=r=>r.reduce((e,o)=>{let n=o.id;return e[n]=ur(),e},{}),Xo=({chains:r,transports:e,projectId:o,appLogoUrl:n,appLogo:p,appUrl:a,appIcons:i,appName:m,getImpersonatedAccount:f,description:s,...x})=>{let c=Ur({projectId:o,appLogoUrl:n,appUrl:a,appIcons:i,appName:m,getImpersonatedAccount:f,description:s});return createConfig({connectors:c,transports:e??me(r),chains:r,...x})};
|
|
2
|
-
export{Pr as checkIsWalletAddressContract
|
|
1
|
+
import {e,f,B,c,b,w,a,t,d,g,K,i,j,h,J,I,H,G,F,E,D,C,A as A$1,z,y,x,v,u,s,r,q,p,o,n,m,l,k as k$1}from'./chunk-J3JCN55Z.mjs';import'./chunk-LHUJBWEN.mjs';import'./chunk-6R4Y2ZVK.mjs';import {OrbitAdapter,getWalletTypeFromConnectorName}from'@tuwaio/orbit-core';import {createViemClient,getAvatar,getName,checkAndSwitchChain}from'@tuwaio/orbit-evm';import {getBytecode,getChains,getAccount,getConnectors,disconnect,connect,createConfig,createConnector,ChainNotConfiguredError}from'@wagmi/core';import {injected,metaMask,coinbaseWallet,safe,walletConnect}from'@wagmi/connectors';async function Sr(r){return new Promise(e=>setTimeout(e,r))}function Ir(r,{delay:e=100,retryCount:o=2,shouldRetry:n=()=>true}={}){return new Promise((p,a)=>{let i=async({count:m=0}={})=>{let f=async({error:s})=>{let x=typeof e=="function"?e({count:m,error:s}):e;x&&await Sr(x),i({count:m+1});};try{let s=await r();p(s);}catch(s){if(m<o&&await n({count:m,error:s}))return f({error:s});a(s);}};i();})}var rr=256,er;function kr(r=11){if(!er||rr+r>256*2){er="",rr=0;for(let e=0;e<256;e++)er+=(256+Math.random()*256|0).toString(16).substring(1);}return er.substring(rr,rr+++r)}var or=new e(8192);function Ar(r,{enabled:e=true,id:o}){if(!e||!o)return r();if(or.get(o))return or.get(o);let n=r().finally(()=>or.delete(o));return or.set(o,n),n}function vr(r$1,e={}){return async(o$1,n$1={})=>{let{dedupe:p$1=false,methods:a$1,retryDelay:i=150,retryCount:m$1=3,uid:f}={...e,...n$1},{method:s$1}=o$1;if(a$1?.exclude?.includes(s$1))throw new t(new Error("method not supported"),{method:s$1});if(a$1?.include&&!a$1.include.includes(s$1))throw new t(new Error("method not supported"),{method:s$1});let x$1=p$1?d(`${f}.${g(o$1)}`):void 0;return Ar(()=>Ir(async()=>{try{return await r$1(o$1)}catch(c){let t$1=c;switch(t$1.code){case k$1.code:throw new k$1(t$1);case l.code:throw new l(t$1);case m.code:throw new m(t$1,{method:o$1.method});case n.code:throw new n(t$1);case o.code:throw new o(t$1);case p.code:throw new p(t$1);case q.code:throw new q(t$1);case r.code:throw new r(t$1);case s.code:throw new s(t$1);case t.code:throw new t(t$1,{method:o$1.method});case u.code:throw new u(t$1);case v.code:throw new v(t$1);case w.code:throw new w(t$1);case x.code:throw new x(t$1);case y.code:throw new y(t$1);case z.code:throw new z(t$1);case A$1.code:throw new A$1(t$1);case B.code:throw new B(t$1);case C.code:throw new C(t$1);case D.code:throw new D(t$1);case E.code:throw new E(t$1);case F.code:throw new F(t$1);case G.code:throw new G(t$1);case H.code:throw new H(t$1);case I.code:throw new I(t$1);case 5e3:throw new w(t$1);default:throw c instanceof a?c:new J(t$1)}}},{delay:({count:c,error:t})=>{if(t&&t instanceof h){let d=t?.headers?.get("Retry-After");if(d?.match(/\d/))return Number.parseInt(d,10)*1e3}return ~~(1<<c)*i},retryCount:m$1,shouldRetry:({error:c})=>Hr(c)}),{enabled:p$1,id:x$1})}}function Hr(r){return "code"in r&&typeof r.code=="number"?r.code===-1||r.code===u.code||r.code===o.code:r instanceof h&&r.status?r.status===403||r.status===408||r.status===413||r.status===429||r.status===500||r.status===502||r.status===503||r.status===504:true}function Rr(r){return {formatters:void 0,fees:void 0,serializers:void 0,...r}}function zr(r,{errorInstance:e=new Error("timed out"),timeout:o,signal:n}){return new Promise((p,a)=>{(async()=>{let i;try{let m=new AbortController;o>0&&(i=setTimeout(()=>{n?m.abort():a(e);},o)),p(await r({signal:m?.signal||null}));}catch(m){m?.name==="AbortError"&&a(e),a(m);}finally{clearTimeout(i);}})();})}function Lr(){return {current:0,take(){return this.current++},reset(){this.current=0;}}}var cr=Lr();function tr(r,e={}){return {async request(o){let{body:n,fetchFn:p=e.fetchFn??fetch,onRequest:a=e.onRequest,onResponse:i=e.onResponse,timeout:m=e.timeout??1e4}=o,f={...e.fetchOptions??{},...o.fetchOptions??{}},{headers:s,method:x,signal:c}=f;try{let t=await zr(async({signal:E})=>{let w={...f,body:Array.isArray(n)?g(n.map(u=>({jsonrpc:"2.0",id:u.id??cr.take(),...u}))):g({jsonrpc:"2.0",id:n.id??cr.take(),...n}),headers:{"Content-Type":"application/json",...s},method:x||"POST",signal:c||(m>0?E:null)},mr=new Request(r,w),v=await a?.(mr,w)??{...w,url:r};return await p(v.url??r,v)},{errorInstance:new j({body:n,url:r}),timeout:m,signal:!0});i&&await i(t);let d;if(t.headers.get("Content-Type")?.startsWith("application/json"))d=await t.json();else {d=await t.text();try{d=JSON.parse(d||"{}");}catch(E){if(t.ok)throw E;d={error:d};}}if(!t.ok)throw new h({body:n,details:g(d.error)||t.statusText,headers:t.headers,status:t.status,url:r});return d}catch(t){throw t instanceof h||t instanceof j?t:new h({body:n,cause:t,url:r})}}}}function jr(r,{body:e,onError:o,onResponse:n}){return r.request({body:e,onError:o,onResponse:n}),r}async function Vr(r,{body:e,timeout:o=1e4}){return r.requestAsync({body:e,timeout:o})}var dr={http(r,e){return tr(r).request(e)},webSocket:jr,webSocketAsync:Vr};var k="0x0000000000000000000000000000000000000000";function nr({key:r,methods:e,name:o,request:n,retryCount:p=3,retryDelay:a=150,timeout:i,type:m},f){let s=kr();return {config:{key:r,methods:e,name:o,request:n,retryCount:p,retryDelay:a,timeout:i,type:m},request:vr(n,{methods:e,retryCount:p,retryDelay:a,uid:s}),value:f}}function lr(r,e={}){let{key:o="custom",methods:n,name:p="Custom Provider",retryDelay:a}=e;return ({retryCount:i})=>nr({key:o,methods:n,name:p,request:r.request.bind(r),retryCount:e.retryCount??i,retryDelay:a,type:"custom"})}var ar=class extends a{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"});}};function ur(r,e={}){let{batch:o,fetchFn:n,fetchOptions:p,key:a="http",methods:i$1,name:m="HTTP JSON-RPC",onFetchRequest:f,onFetchResponse:s,retryDelay:x,raw:c}=e;return ({chain:t,retryCount:d,timeout:E})=>{let{batchSize:w=1e3,wait:mr=0}=typeof o=="object"?o:{},v=e.retryCount??d,pr=E??e.timeout??1e4,u=t?.rpcUrls.default.http[0];if(!u)throw new ar;let yr=tr(u,{fetchFn:n,fetchOptions:p,onRequest:f,onResponse:s,timeout:pr});return nr({key:a,methods:i$1,name:m,async request({method:Nr,params:Dr}){let gr={method:Nr,params:Dr},{schedule:Br}=K({id:u,wait:mr,shouldSplitBatch(h){return h.length>w},fn:h=>yr.request({body:h}),sort:(h,qr)=>h.id-qr.id}),Mr=async h=>o?Br(h):[await yr.request({body:h})],[{error:sr,result:br}]=await Mr(gr);if(c)return {error:sr,result:br};if(sr)throw new i({body:gr,error:sr,url:u});return br},retryCount:v,retryDelay:x,timeout:pr,type:"http"},{fetchOptions:p,url:u})}}var ir=Rr({id:1,name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},blockTime:12e3,rpcUrls:{default:{http:["https://eth.merkle.io"]}},blockExplorers:{default:{name:"Etherscan",url:"https://etherscan.io",apiUrl:"https://api.etherscan.io/api"}},contracts:{ensUniversalResolver:{address:"0xeeeeeeee14d718c2b47d9923deab1335e144eeee",blockCreated:23085558},multicall3:{address:"0xca11bde05977b3631167028862be2a173976ca11",blockCreated:14353601}}});var hr=new Map;async function Pr({config:r,address:e,chainId:o,chains:n}){if(hr.has(e))return hr.get(e);if(createViemClient(o,n)){let i=!!await getBytecode(r,{address:e});return hr.set(e,i),i}else return false}function Do(r){if(!r)throw new Error("Satellite EVM adapter requires a wagmi config object.");return {key:OrbitAdapter.EVM,connect:async({walletType:e,chainId:o,connectors:n})=>{let p=n.find(a=>getWalletTypeFromConnectorName(OrbitAdapter.EVM,a.name)===e);if(!p)throw new Error("Cannot find connector with this wallet type");try{await connect(r,{connector:p,chainId:o});let a=getAccount(r);return {walletType:e,address:a.address??k,chainId:a.chainId??ir.id,rpcURL:a.chain?.rpcUrls.default.http[0]??ir.rpcUrls.default.http[0],isConnected:a.isConnected,isContractAddress:!1}}catch(a){throw new Error(a instanceof Error?a.message:String(a))}},disconnect:async()=>{getAccount(r).isConnected&&await disconnect(r);},getConnectors:async()=>{let e=getConnectors(r);return {adapter:OrbitAdapter.EVM,connectors:e.map(o=>o)}},checkAndSwitchNetwork:async e=>await checkAndSwitchChain(e,r),getExplorerUrl:e=>{let{chain:o}=getAccount(r),n=o?.blockExplorers?.default.url;return e?`${n}/${e}`:n},getName:e=>getName(e),getAvatar:e=>getAvatar(e),checkIsContractWallet:async({address:e,chainId:o})=>{let n=getChains(r);return await Pr({config:r,address:e,chainId:o,chains:n})}}}A.type="impersonated";function A(r){let e=r.features??{},o=false,n,p;return createConnector(a=>({id:"impersonated",name:"Impersonated Connector",type:A.type,async setup(){n=a.chains[0].id;},async connect({chainId:i}={}){if(e.connectError)throw typeof e.connectError=="boolean"?new w(new Error("Failed to connect.")):e.connectError;let{request:m}=await this.getProvider(),f=await m({method:"eth_requestAccounts"}),s=await this.getChainId();return i&&s!==i&&(s=(await this.switchChain({chainId:i})).id),o=true,{accounts:f,chainId:s}},async disconnect(){o=false,p=void 0;},async getAccounts(){if(!o)throw new Error("Not connected connector");let{request:i}=await this.getProvider();return (await i({method:"eth_accounts"})).map(f)},async getChainId(){let{request:i}=await this.getProvider(),m=await i({method:"eth_chainId"});return b(m,"number")},async isAuthorized(){return o?!!(await this.getAccounts()).length:false},async switchChain({chainId:i}){let m=a.chains.find(s=>s.id===i);if(!m)throw new B(new ChainNotConfiguredError);let{request:f}=await this.getProvider();return await f({method:"wallet_switchEthereumChain",params:[{chainId:c(i)}]}),m},onAccountsChanged(i){i.length===0?this.onDisconnect():a.emitter.emit("change",{accounts:i.map(f)});},onChainChanged(i){let m=Number(i);a.emitter.emit("change",{chainId:m});},async onDisconnect(){a.emitter.emit("disconnect"),o=false,p=void 0;},async getProvider({chainId:i$1}={}){p=r.getAccountAddress()?[r.getAccountAddress()||k]:void 0;let f=(a.chains.find(x=>x.id===i$1)??a.chains[0]).rpcUrls.default.http[0];return lr({request:async({method:x,params:c$1})=>{if(x==="eth_chainId")return c(n);if(x==="eth_requestAccounts")return p;if(x==="eth_signTypedData_v4"&&e.signTypedDataError)throw typeof e.signTypedDataError=="boolean"?new w(new Error("Failed to sign typed data.")):e.signTypedDataError;if(x==="wallet_switchEthereumChain"){if(e.switchChainError)throw typeof e.switchChainError=="boolean"?new w(new Error("Failed to switch chain.")):e.switchChainError;n=b(c$1[0].chainId,"number"),this.onChainChanged(n.toString());return}if(x==="personal_sign"){if(e.signMessageError)throw typeof e.signMessageError=="boolean"?new w(new Error("Failed to sign message.")):e.signMessageError;x="eth_sign",c$1=[c$1[1],c$1[0]];}let t={method:x,params:c$1},{error:d,result:E}=await dr.http(f,{body:t});if(d)throw new i({body:t,error:d,url:f});return E}})({retryCount:1})}}))}var ae={allowedDomains:[/gnosis-safe.io$/,/app.safe.global$/,/metissafe.tech$/],debug:false},Ur=r=>{let e=injected(),o=metaMask({dappMetadata:{name:r.appName,url:r.appUrl}}),n=coinbaseWallet({appName:r.appName,appLogoUrl:r.appLogoUrl}),p=safe({...ae}),a=[e,o,n,p],i=r.appUrl&&r.appIcons&&r.appName&&r.description?{name:r.appName,description:r.description,url:r.appUrl,icons:r.appIcons}:void 0;if(r.projectId&&!r.getImpersonatedAccount)return [walletConnect({projectId:r.projectId,metadata:i}),...a];if(!r.projectId&&r.getImpersonatedAccount)return [A({getAccountAddress:r.getImpersonatedAccount}),...a];if(r.projectId&&r.getImpersonatedAccount){let m=walletConnect({projectId:r.projectId,metadata:i}),f=A({getAccountAddress:r.getImpersonatedAccount});return [m,f,...a]}else return a};var me=r=>r.reduce((e,o)=>{let n=o.id;return e[n]=ur(),e},{}),$o=({chains:r,transports:e,projectId:o,appLogoUrl:n,appLogo:p,appUrl:a,appIcons:i,appName:m,getImpersonatedAccount:f,description:s,...x})=>{let c=Ur({projectId:o,appLogoUrl:n,appUrl:a,appIcons:i,appName:m,getImpersonatedAccount:f,description:s});return createConfig({connectors:c,transports:e??me(r),chains:r,...x})};
|
|
2
|
+
export{Pr as checkIsWalletAddressContract,$o as createWagmiConfig,Ur as initAllConnectors,ae as safeSdkOptions,Do as satelliteEVMAdapter};//# sourceMappingURL=index.mjs.map
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/wait.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withRetry.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/uid.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withDedupe.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/buildRequest.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/chain/defineChain.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withTimeout.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/id.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/http.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/compat.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/constants/address.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/createTransport.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/custom.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/errors/transport.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/http.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/chains/definitions/mainnet.ts","../src/utils/checkIsWalletAddressContract.ts","../src/adapters/evmAdapter.ts","../src/connectors/ImpersonatedConnector.ts","../src/connectors/index.ts","../src/utils/createWagmiConfig.ts"],"names":["wait","time","res","withRetry","fn","delay_","retryCount","shouldRetry","resolve","reject","attemptRetry","count","retry","error","delay","data","err","index","buffer","uid","length","i","promiseCache","LruMap","withDedupe","enabled","id","promise","buildRequest","request","options","args","overrideOptions","dedupe","methods","retryDelay","method","MethodNotSupportedRpcError","requestId","stringToHex","stringify","err_","ParseRpcError","InvalidRequestRpcError","MethodNotFoundRpcError","InvalidParamsRpcError","InternalRpcError","InvalidInputRpcError","ResourceNotFoundRpcError","ResourceUnavailableRpcError","TransactionRejectedRpcError","LimitExceededRpcError","JsonRpcVersionUnsupportedError","UserRejectedRequestError","UnauthorizedProviderError","UnsupportedProviderMethodError","ProviderDisconnectedError","ChainDisconnectedError","SwitchChainError","UnsupportedNonOptionalCapabilityError","UnsupportedChainIdError","DuplicateIdError","UnknownBundleIdError","BundleTooLargeError","AtomicReadyWalletRejectedUpgradeError","AtomicityNotSupportedError","BaseError","UnknownRpcError","HttpRequestError","retryAfter","defineChain","chain","withTimeout","errorInstance","timeout","signal","timeoutId","controller","createIdStore","idCache","getHttpRpcClient","url","params","body","fetchFn","onRequest","onResponse","fetchOptions","headers","signal_","response","init","TimeoutError","webSocket","socketClient","onError","webSocketAsync","rpc","zeroAddress","createTransport","key","name","type","value","custom","provider","config","defaultRetryCount","UrlRequiredError","http","batch","onFetchRequest","onFetchResponse","raw","retryCount_","timeout_","batchSize","url_","rpcClient","schedule","createBatchScheduler","requests","a","b","result","RpcRequestError","mainnet","walletsCache","checkIsWalletAddressContract","address","chainId","chains","createViemClient","isContract","getBytecode","satelliteEVMAdapter","OrbitAdapter","walletType","connectors","connector","getWalletTypeFromConnectorName","connect","account","getAccount","e","disconnect","getConnectors","checkAndSwitchChain","baseExplorerLink","getName","getAvatar","getChains","impersonated","parameters","features","connected","connectedChainId","accountAddress","createConnector","accounts","currentChainId","getAddress","hexChainId","fromHex","x","ChainNotConfiguredError","numberToHex","safeSdkOptions","initAllConnectors","props","injectedConnector","injected","metamaskConnector","metaMask","coinbaseConnector","coinbaseWallet","gnosisSafeConnector","safe","wcMetadata","walletConnect","walletConnectConnector","impersonatedConnector","createDefaultTransports","acc","createWagmiConfig","transports","projectId","appLogoUrl","appLogo","appU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AA,CAAArD,CAAAA,CACA,WAAAsD,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,sBAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CACA,GAAG/G,CACL,CAAA,GAAmF,CAEjF,IAAMwD,CAAAA,CAAa8B,EAAAA,CAAkB,CACnC,UAAAkB,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAEA,MAAA,CAAAE,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,sBAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAC,CAAA,CAGD,OAAOC,YAAAA,CAAa,CAClB,WAAAxD,CAAAA,CAEA,UAAA,CAAY+C,CAAAA,EAAcH,EAAAA,CAAwBnD,CAAM,CAAA,CACxD,MAAA,CAAAA,EACA,GAAGjD,CACL,CAAC,CACH","file":"index.mjs","sourcesContent":["export async function wait(time: number) {\n return new Promise((res) => setTimeout(res, time))\n}\n","import type { ErrorType } from '../../errors/utils.js'\nimport { wait } from '../wait.js'\n\nexport type WithRetryParameters = {\n // The delay (in ms) between retries.\n delay?:\n | ((config: { count: number; error: Error }) => number)\n | number\n | undefined\n // The max number of times to retry.\n retryCount?: number | undefined\n // Whether or not to retry when an error is thrown.\n shouldRetry?:\n | (({\n count,\n error,\n }: {\n count: number\n error: Error\n }) => Promise<boolean> | boolean)\n | undefined\n}\n\nexport type WithRetryErrorType = ErrorType\n\nexport function withRetry<data>(\n fn: () => Promise<data>,\n {\n delay: delay_ = 100,\n retryCount = 2,\n shouldRetry = () => true,\n }: WithRetryParameters = {},\n) {\n return new Promise<data>((resolve, reject) => {\n const attemptRetry = async ({ count = 0 } = {}) => {\n const retry = async ({ error }: { error: Error }) => {\n const delay =\n typeof delay_ === 'function' ? delay_({ count, error }) : delay_\n if (delay) await wait(delay)\n attemptRetry({ count: count + 1 })\n }\n\n try {\n const data = await fn()\n resolve(data)\n } catch (err) {\n if (\n count < retryCount &&\n (await shouldRetry({ count, error: err as Error }))\n )\n return retry({ error: err as Error })\n reject(err)\n }\n }\n attemptRetry()\n })\n}\n","const size = 256\nlet index = size\nlet buffer: string\n\nexport function uid(length = 11) {\n if (!buffer || index + length > size * 2) {\n buffer = ''\n index = 0\n for (let i = 0; i < size; i++) {\n buffer += ((256 + Math.random() * 256) | 0).toString(16).substring(1)\n }\n }\n return buffer.substring(index, index++ + length)\n}\n","import { LruMap } from '../lru.js'\n\n/** @internal */\nexport const promiseCache = /*#__PURE__*/ new LruMap<Promise<any>>(8192)\n\ntype WithDedupeOptions = {\n enabled?: boolean | undefined\n id?: string | undefined\n}\n\n/** Deduplicates in-flight promises. */\nexport function withDedupe<data>(\n fn: () => Promise<data>,\n { enabled = true, id }: WithDedupeOptions,\n): Promise<data> {\n if (!enabled || !id) return fn()\n if (promiseCache.get(id)) return promiseCache.get(id)!\n const promise = fn().finally(() => promiseCache.delete(id))\n promiseCache.set(id, promise)\n return promise\n}\n","import { BaseError } from '../errors/base.js'\nimport {\n HttpRequestError,\n type HttpRequestErrorType,\n type RpcRequestErrorType,\n type TimeoutErrorType,\n type WebSocketRequestErrorType,\n} from '../errors/request.js'\nimport {\n AtomicityNotSupportedError,\n type AtomicityNotSupportedErrorType,\n AtomicReadyWalletRejectedUpgradeError,\n type AtomicReadyWalletRejectedUpgradeErrorType,\n BundleTooLargeError,\n type BundleTooLargeErrorType,\n ChainDisconnectedError,\n type ChainDisconnectedErrorType,\n DuplicateIdError,\n type DuplicateIdErrorType,\n InternalRpcError,\n type InternalRpcErrorType,\n InvalidInputRpcError,\n type InvalidInputRpcErrorType,\n InvalidParamsRpcError,\n type InvalidParamsRpcErrorType,\n InvalidRequestRpcError,\n type InvalidRequestRpcErrorType,\n JsonRpcVersionUnsupportedError,\n type JsonRpcVersionUnsupportedErrorType,\n LimitExceededRpcError,\n type LimitExceededRpcErrorType,\n MethodNotFoundRpcError,\n type MethodNotFoundRpcErrorType,\n MethodNotSupportedRpcError,\n type MethodNotSupportedRpcErrorType,\n ParseRpcError,\n type ParseRpcErrorType,\n ProviderDisconnectedError,\n type ProviderDisconnectedErrorType,\n type ProviderRpcErrorCode,\n ResourceNotFoundRpcError,\n type ResourceNotFoundRpcErrorType,\n ResourceUnavailableRpcError,\n type ResourceUnavailableRpcErrorType,\n type RpcError,\n type RpcErrorCode,\n type RpcErrorType,\n SwitchChainError,\n type SwitchChainErrorType,\n TransactionRejectedRpcError,\n type TransactionRejectedRpcErrorType,\n UnauthorizedProviderError,\n type UnauthorizedProviderErrorType,\n UnknownBundleIdError,\n type UnknownBundleIdErrorType,\n UnknownRpcError,\n type UnknownRpcErrorType,\n UnsupportedChainIdError,\n type UnsupportedChainIdErrorType,\n UnsupportedNonOptionalCapabilityError,\n type UnsupportedNonOptionalCapabilityErrorType,\n UnsupportedProviderMethodError,\n type UnsupportedProviderMethodErrorType,\n UserRejectedRequestError,\n type UserRejectedRequestErrorType,\n} from '../errors/rpc.js'\nimport type { ErrorType } from '../errors/utils.js'\nimport type {\n EIP1193RequestFn,\n EIP1193RequestOptions,\n} from '../types/eip1193.js'\nimport { stringToHex } from './encoding/toHex.js'\nimport type { CreateBatchSchedulerErrorType } from './promise/createBatchScheduler.js'\nimport { withDedupe } from './promise/withDedupe.js'\nimport { type WithRetryErrorType, withRetry } from './promise/withRetry.js'\nimport type { GetSocketRpcClientErrorType } from './rpc/socket.js'\nimport { stringify } from './stringify.js'\n\nexport type RequestErrorType =\n | AtomicityNotSupportedErrorType\n | AtomicReadyWalletRejectedUpgradeErrorType\n | BundleTooLargeErrorType\n | ChainDisconnectedErrorType\n | CreateBatchSchedulerErrorType\n | DuplicateIdErrorType\n | HttpRequestErrorType\n | InternalRpcErrorType\n | InvalidInputRpcErrorType\n | InvalidParamsRpcErrorType\n | InvalidRequestRpcErrorType\n | GetSocketRpcClientErrorType\n | JsonRpcVersionUnsupportedErrorType\n | LimitExceededRpcErrorType\n | MethodNotFoundRpcErrorType\n | MethodNotSupportedRpcErrorType\n | ParseRpcErrorType\n | ProviderDisconnectedErrorType\n | ResourceNotFoundRpcErrorType\n | ResourceUnavailableRpcErrorType\n | RpcErrorType\n | RpcRequestErrorType\n | SwitchChainErrorType\n | TimeoutErrorType\n | TransactionRejectedRpcErrorType\n | UnauthorizedProviderErrorType\n | UnknownBundleIdErrorType\n | UnknownRpcErrorType\n | UnsupportedChainIdErrorType\n | UnsupportedNonOptionalCapabilityErrorType\n | UnsupportedProviderMethodErrorType\n | UserRejectedRequestErrorType\n | WebSocketRequestErrorType\n | WithRetryErrorType\n | ErrorType\n\nexport function buildRequest<request extends (args: any) => Promise<any>>(\n request: request,\n options: EIP1193RequestOptions = {},\n): EIP1193RequestFn {\n return async (args, overrideOptions = {}) => {\n const {\n dedupe = false,\n methods,\n retryDelay = 150,\n retryCount = 3,\n uid,\n } = {\n ...options,\n ...overrideOptions,\n }\n\n const { method } = args\n if (methods?.exclude?.includes(method))\n throw new MethodNotSupportedRpcError(new Error('method not supported'), {\n method,\n })\n if (methods?.include && !methods.include.includes(method))\n throw new MethodNotSupportedRpcError(new Error('method not supported'), {\n method,\n })\n\n const requestId = dedupe\n ? stringToHex(`${uid}.${stringify(args)}`)\n : undefined\n return withDedupe(\n () =>\n withRetry(\n async () => {\n try {\n return await request(args)\n } catch (err_) {\n const err = err_ as unknown as RpcError<\n RpcErrorCode | ProviderRpcErrorCode\n >\n switch (err.code) {\n // -32700\n case ParseRpcError.code:\n throw new ParseRpcError(err)\n // -32600\n case InvalidRequestRpcError.code:\n throw new InvalidRequestRpcError(err)\n // -32601\n case MethodNotFoundRpcError.code:\n throw new MethodNotFoundRpcError(err, { method: args.method })\n // -32602\n case InvalidParamsRpcError.code:\n throw new InvalidParamsRpcError(err)\n // -32603\n case InternalRpcError.code:\n throw new InternalRpcError(err)\n // -32000\n case InvalidInputRpcError.code:\n throw new InvalidInputRpcError(err)\n // -32001\n case ResourceNotFoundRpcError.code:\n throw new ResourceNotFoundRpcError(err)\n // -32002\n case ResourceUnavailableRpcError.code:\n throw new ResourceUnavailableRpcError(err)\n // -32003\n case TransactionRejectedRpcError.code:\n throw new TransactionRejectedRpcError(err)\n // -32004\n case MethodNotSupportedRpcError.code:\n throw new MethodNotSupportedRpcError(err, {\n method: args.method,\n })\n // -32005\n case LimitExceededRpcError.code:\n throw new LimitExceededRpcError(err)\n // -32006\n case JsonRpcVersionUnsupportedError.code:\n throw new JsonRpcVersionUnsupportedError(err)\n\n // 4001\n case UserRejectedRequestError.code:\n throw new UserRejectedRequestError(err)\n // 4100\n case UnauthorizedProviderError.code:\n throw new UnauthorizedProviderError(err)\n // 4200\n case UnsupportedProviderMethodError.code:\n throw new UnsupportedProviderMethodError(err)\n // 4900\n case ProviderDisconnectedError.code:\n throw new ProviderDisconnectedError(err)\n // 4901\n case ChainDisconnectedError.code:\n throw new ChainDisconnectedError(err)\n // 4902\n case SwitchChainError.code:\n throw new SwitchChainError(err)\n\n // 5700\n case UnsupportedNonOptionalCapabilityError.code:\n throw new UnsupportedNonOptionalCapabilityError(err)\n // 5710\n case UnsupportedChainIdError.code:\n throw new UnsupportedChainIdError(err)\n // 5720\n case DuplicateIdError.code:\n throw new DuplicateIdError(err)\n // 5730\n case UnknownBundleIdError.code:\n throw new UnknownBundleIdError(err)\n // 5740\n case BundleTooLargeError.code:\n throw new BundleTooLargeError(err)\n // 5750\n case AtomicReadyWalletRejectedUpgradeError.code:\n throw new AtomicReadyWalletRejectedUpgradeError(err)\n // 5760\n case AtomicityNotSupportedError.code:\n throw new AtomicityNotSupportedError(err)\n\n // CAIP-25: User Rejected Error\n // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25\n case 5000:\n throw new UserRejectedRequestError(err)\n\n default:\n if (err_ instanceof BaseError) throw err_\n throw new UnknownRpcError(err as Error)\n }\n }\n },\n {\n delay: ({ count, error }) => {\n // If we find a Retry-After header, let's retry after the given time.\n if (error && error instanceof HttpRequestError) {\n const retryAfter = error?.headers?.get('Retry-After')\n if (retryAfter?.match(/\\d/))\n return Number.parseInt(retryAfter, 10) * 1000\n }\n\n // Otherwise, let's retry with an exponential backoff.\n return ~~(1 << count) * retryDelay\n },\n retryCount,\n shouldRetry: ({ error }) => shouldRetry(error),\n },\n ),\n { enabled: dedupe, id: requestId },\n )\n }\n}\n\n/** @internal */\nexport function shouldRetry(error: Error) {\n if ('code' in error && typeof error.code === 'number') {\n if (error.code === -1) return true // Unknown error\n if (error.code === LimitExceededRpcError.code) return true\n if (error.code === InternalRpcError.code) return true\n return false\n }\n if (error instanceof HttpRequestError && error.status) {\n // Forbidden\n if (error.status === 403) return true\n // Request Timeout\n if (error.status === 408) return true\n // Request Entity Too Large\n if (error.status === 413) return true\n // Too Many Requests\n if (error.status === 429) return true\n // Internal Server Error\n if (error.status === 500) return true\n // Bad Gateway\n if (error.status === 502) return true\n // Service Unavailable\n if (error.status === 503) return true\n // Gateway Timeout\n if (error.status === 504) return true\n return false\n }\n return true\n}\n","import type { Chain, ChainFormatters } from '../../types/chain.js'\nimport type { Assign, Prettify } from '../../types/utils.js'\n\nexport function defineChain<\n formatters extends ChainFormatters,\n const chain extends Chain<formatters>,\n>(chain: chain): Prettify<Assign<Chain<undefined>, chain>> {\n return {\n formatters: undefined,\n fees: undefined,\n serializers: undefined,\n ...chain,\n } as Assign<Chain<undefined>, chain>\n}\n","import type { ErrorType } from '../../errors/utils.js'\n\nexport type WithTimeoutErrorType = ErrorType\n\nexport function withTimeout<data>(\n fn: ({\n signal,\n }: {\n signal: AbortController['signal'] | null\n }) => Promise<data>,\n {\n errorInstance = new Error('timed out'),\n timeout,\n signal,\n }: {\n // The error instance to throw when the timeout is reached.\n errorInstance?: Error | undefined\n // The timeout (in ms).\n timeout: number\n // Whether or not the timeout should use an abort signal.\n signal?: boolean | undefined\n },\n): Promise<data> {\n return new Promise((resolve, reject) => {\n ;(async () => {\n let timeoutId!: NodeJS.Timeout\n try {\n const controller = new AbortController()\n if (timeout > 0) {\n timeoutId = setTimeout(() => {\n if (signal) {\n controller.abort()\n } else {\n reject(errorInstance)\n }\n }, timeout) as NodeJS.Timeout // need to cast because bun globals.d.ts overrides @types/node\n }\n resolve(await fn({ signal: controller?.signal || null }))\n } catch (err) {\n if ((err as Error)?.name === 'AbortError') reject(errorInstance)\n reject(err)\n } finally {\n clearTimeout(timeoutId)\n }\n })()\n })\n}\n","function createIdStore() {\n return {\n current: 0,\n take() {\n return this.current++\n },\n reset() {\n this.current = 0\n },\n }\n}\n\nexport const idCache = /*#__PURE__*/ createIdStore()\n","import {\n HttpRequestError,\n type HttpRequestErrorType as HttpRequestErrorType_,\n TimeoutError,\n type TimeoutErrorType,\n} from '../../errors/request.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { RpcRequest, RpcResponse } from '../../types/rpc.js'\nimport type { MaybePromise } from '../../types/utils.js'\nimport {\n type WithTimeoutErrorType,\n withTimeout,\n} from '../promise/withTimeout.js'\nimport { stringify } from '../stringify.js'\nimport { idCache } from './id.js'\n\nexport type HttpRpcClientOptions = {\n /** Override for the fetch function used to make requests. */\n fetchFn?:\n | ((input: string | URL | Request, init?: RequestInit) => Promise<Response>)\n | undefined\n /** Request configuration to pass to `fetch`. */\n fetchOptions?: Omit<RequestInit, 'body'> | undefined\n /** A callback to handle the request. */\n onRequest?:\n | ((\n request: Request,\n init: RequestInit,\n ) => MaybePromise<\n void | undefined | (RequestInit & { url?: string | undefined })\n >)\n | undefined\n /** A callback to handle the response. */\n onResponse?: ((response: Response) => Promise<void> | void) | undefined\n /** The timeout (in ms) for the request. */\n timeout?: number | undefined\n}\n\nexport type HttpRequestParameters<\n body extends RpcRequest | RpcRequest[] = RpcRequest,\n> = {\n /** The RPC request body. */\n body: body\n /** Override for the fetch function used to make requests. */\n fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined\n /** Request configuration to pass to `fetch`. */\n fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined\n /** A callback to handle the response. */\n onRequest?:\n | ((\n request: Request,\n init: RequestInit,\n ) => MaybePromise<\n void | undefined | (RequestInit & { url?: string | undefined })\n >)\n | undefined\n /** A callback to handle the response. */\n onResponse?: ((response: Response) => Promise<void> | void) | undefined\n /** The timeout (in ms) for the request. */\n timeout?: HttpRpcClientOptions['timeout'] | undefined\n}\n\nexport type HttpRequestReturnType<\n body extends RpcRequest | RpcRequest[] = RpcRequest,\n> = body extends RpcRequest[] ? RpcResponse[] : RpcResponse\n\nexport type HttpRequestErrorType =\n | HttpRequestErrorType_\n | TimeoutErrorType\n | WithTimeoutErrorType\n | ErrorType\n\nexport type HttpRpcClient = {\n request<body extends RpcRequest | RpcRequest[]>(\n params: HttpRequestParameters<body>,\n ): Promise<HttpRequestReturnType<body>>\n}\n\nexport function getHttpRpcClient(\n url: string,\n options: HttpRpcClientOptions = {},\n): HttpRpcClient {\n return {\n async request(params) {\n const {\n body,\n fetchFn = options.fetchFn ?? fetch,\n onRequest = options.onRequest,\n onResponse = options.onResponse,\n timeout = options.timeout ?? 10_000,\n } = params\n\n const fetchOptions = {\n ...(options.fetchOptions ?? {}),\n ...(params.fetchOptions ?? {}),\n }\n\n const { headers, method, signal: signal_ } = fetchOptions\n\n try {\n const response = await withTimeout(\n async ({ signal }) => {\n const init: RequestInit = {\n ...fetchOptions,\n body: Array.isArray(body)\n ? stringify(\n body.map((body) => ({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n })),\n )\n : stringify({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n }),\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n method: method || 'POST',\n signal: signal_ || (timeout > 0 ? signal : null),\n }\n const request = new Request(url, init)\n const args = (await onRequest?.(request, init)) ?? { ...init, url }\n const response = await fetchFn(args.url ?? url, args)\n return response\n },\n {\n errorInstance: new TimeoutError({ body, url }),\n timeout,\n signal: true,\n },\n )\n\n if (onResponse) await onResponse(response)\n\n let data: any\n if (\n response.headers.get('Content-Type')?.startsWith('application/json')\n )\n data = await response.json()\n else {\n data = await response.text()\n try {\n data = JSON.parse(data || '{}')\n } catch (err) {\n if (response.ok) throw err\n data = { error: data }\n }\n }\n\n if (!response.ok) {\n throw new HttpRequestError({\n body,\n details: stringify(data.error) || response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n })\n }\n\n return data\n } catch (err) {\n if (err instanceof HttpRequestError) throw err\n if (err instanceof TimeoutError) throw err\n throw new HttpRequestError({\n body,\n cause: err as Error,\n url,\n })\n }\n },\n }\n}\n","// TODO(v3): This file is here for backwards compatibility, and to prevent breaking changes.\n// These APIs will be removed in v3.\n\n/* c8 ignore start */\nimport type {\n TimeoutErrorType,\n WebSocketRequestError,\n} from '../../errors/request.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { RpcResponse } from '../../types/rpc.js'\nimport type { WithTimeoutErrorType } from '../promise/withTimeout.js'\nimport { getHttpRpcClient, type HttpRequestParameters } from './http.js'\nimport type { SocketRpcClient } from './socket.js'\nimport { getWebSocketRpcClient } from './webSocket.js'\n\nexport type WebSocketOptions = Parameters<\n SocketRpcClient<WebSocket>['request']\n>[0]\nexport type WebSocketReturnType = SocketRpcClient<WebSocket>\nexport type WebSocketErrorType = WebSocketRequestError | ErrorType\n\nfunction webSocket(\n socketClient: SocketRpcClient<WebSocket>,\n { body, onError, onResponse }: WebSocketOptions,\n): WebSocketReturnType {\n socketClient.request({\n body,\n onError,\n onResponse,\n })\n return socketClient\n}\n\nexport type WebSocketAsyncOptions = Parameters<\n SocketRpcClient<WebSocket>['requestAsync']\n>[0]\nexport type WebSocketAsyncReturnType = RpcResponse\nexport type WebSocketAsyncErrorType =\n | WebSocketErrorType\n | TimeoutErrorType\n | WithTimeoutErrorType\n | ErrorType\n\nasync function webSocketAsync(\n socketClient: SocketRpcClient<WebSocket>,\n { body, timeout = 10_000 }: WebSocketAsyncOptions,\n): Promise<WebSocketAsyncReturnType> {\n return socketClient.requestAsync({\n body,\n timeout,\n })\n}\n\n/**\n * @deprecated use `getSocketClient` instead.\n *\n * ```diff\n * -import { getSocket } from 'viem/utils'\n * +import { getSocketClient } from 'viem/utils'\n *\n * -const socket = await getSocket(url)\n * +const socketClient = await getSocketClient(url)\n * +const socket = socketClient.socket\n * ```\n */\nexport async function getSocket(url: string) {\n const client = await getWebSocketRpcClient(url)\n return Object.assign(client.socket, {\n requests: client.requests,\n subscriptions: client.subscriptions,\n })\n}\n\nexport const rpc = {\n /**\n * @deprecated use `getHttpRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getHttpRpcClient } from 'viem/utils'\n *\n * -rpc.http(url, params)\n * +const httpClient = getHttpRpcClient(url)\n * +httpClient.request(params)\n * ```\n */\n http(url: string, params: HttpRequestParameters) {\n return getHttpRpcClient(url).request(params)\n },\n /**\n * @deprecated use `getWebSocketRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getWebSocketRpcClient } from 'viem/utils'\n *\n * -rpc.webSocket(url, params)\n * +const webSocketClient = getWebSocketRpcClient(url)\n * +webSocketClient.request(params)\n * ```\n */\n webSocket,\n /**\n * @deprecated use `getWebSocketRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getWebSocketRpcClient } from 'viem/utils'\n *\n * -const response = await rpc.webSocketAsync(url, params)\n * +const webSocketClient = getWebSocketRpcClient(url)\n * +const response = await webSocketClient.requestAsync(params)\n * ```\n */\n webSocketAsync,\n}\n/* c8 ignore end */\n","export const entryPoint06Address =\n '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789' as const\nexport const entryPoint07Address =\n '0x0000000071727De22E5E9d8BAf0edAc6f37da032' as const\nexport const entryPoint08Address =\n '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108' as const\n\nexport const ethAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const\n\nexport const zeroAddress = '0x0000000000000000000000000000000000000000' as const\n","import type { ErrorType } from '../../errors/utils.js'\nimport type { Chain } from '../../types/chain.js'\nimport type { EIP1193RequestFn } from '../../types/eip1193.js'\nimport type { OneOf } from '../../types/utils.js'\nimport { buildRequest } from '../../utils/buildRequest.js'\nimport { uid as uid_ } from '../../utils/uid.js'\nimport type { ClientConfig } from '../createClient.js'\n\nexport type TransportConfig<\n type extends string = string,\n eip1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn,\n> = {\n /** The name of the transport. */\n name: string\n /** The key of the transport. */\n key: string\n /** Methods to include or exclude from executing RPC requests. */\n methods?:\n | OneOf<\n | {\n include?: string[] | undefined\n }\n | {\n exclude?: string[] | undefined\n }\n >\n | undefined\n /** The JSON-RPC request function that matches the EIP-1193 request spec. */\n request: eip1193RequestFn\n /** The base delay (in ms) between retries. */\n retryDelay?: number | undefined\n /** The max number of times to retry. */\n retryCount?: number | undefined\n /** The timeout (in ms) for requests. */\n timeout?: number | undefined\n /** The type of the transport. */\n type: type\n}\n\nexport type Transport<\n type extends string = string,\n rpcAttributes = Record<string, any>,\n eip1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn,\n> = <chain extends Chain | undefined = Chain>({\n chain,\n}: {\n chain?: chain | undefined\n pollingInterval?: ClientConfig['pollingInterval'] | undefined\n retryCount?: TransportConfig['retryCount'] | undefined\n timeout?: TransportConfig['timeout'] | undefined\n}) => {\n config: TransportConfig<type>\n request: eip1193RequestFn\n value?: rpcAttributes | undefined\n}\n\nexport type CreateTransportErrorType = ErrorType\n\n/**\n * @description Creates an transport intended to be used with a client.\n */\nexport function createTransport<\n type extends string,\n rpcAttributes extends Record<string, any>,\n>(\n {\n key,\n methods,\n name,\n request,\n retryCount = 3,\n retryDelay = 150,\n timeout,\n type,\n }: TransportConfig<type>,\n value?: rpcAttributes | undefined,\n): ReturnType<Transport<type, rpcAttributes>> {\n const uid = uid_()\n return {\n config: {\n key,\n methods,\n name,\n request,\n retryCount,\n retryDelay,\n timeout,\n type,\n },\n request: buildRequest(request, { methods, retryCount, retryDelay, uid }),\n value,\n }\n}\n","import type { ErrorType } from '../../errors/utils.js'\nimport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './createTransport.js'\n\ntype EthereumProvider = { request(...args: any): Promise<any> }\n\nexport type CustomTransportConfig = {\n /** The key of the transport. */\n key?: TransportConfig['key'] | undefined\n /** Methods to include or exclude from executing RPC requests. */\n methods?: TransportConfig['methods'] | undefined\n /** The name of the transport. */\n name?: TransportConfig['name'] | undefined\n /** The max number of times to retry. */\n retryCount?: TransportConfig['retryCount'] | undefined\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig['retryDelay'] | undefined\n}\n\nexport type CustomTransport = Transport<\n 'custom',\n {},\n EthereumProvider['request']\n>\n\nexport type CustomTransportErrorType = CreateTransportErrorType | ErrorType\n\n/**\n * @description Creates a custom transport given an EIP-1193 compliant `request` attribute.\n */\nexport function custom<provider extends EthereumProvider>(\n provider: provider,\n config: CustomTransportConfig = {},\n): CustomTransport {\n const {\n key = 'custom',\n methods,\n name = 'Custom Provider',\n retryDelay,\n } = config\n return ({ retryCount: defaultRetryCount }) =>\n createTransport({\n key,\n methods,\n name,\n request: provider.request.bind(provider),\n retryCount: config.retryCount ?? defaultRetryCount,\n retryDelay,\n type: 'custom',\n })\n}\n","import { BaseError } from './base.js'\n\nexport type UrlRequiredErrorType = UrlRequiredError & {\n name: 'UrlRequiredError'\n}\nexport class UrlRequiredError extends BaseError {\n constructor() {\n super(\n 'No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.',\n {\n docsPath: '/docs/clients/intro',\n name: 'UrlRequiredError',\n },\n )\n }\n}\n","import { RpcRequestError } from '../../errors/request.js'\nimport {\n UrlRequiredError,\n type UrlRequiredErrorType,\n} from '../../errors/transport.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { EIP1193RequestFn, RpcSchema } from '../../types/eip1193.js'\nimport type { RpcRequest } from '../../types/rpc.js'\nimport { createBatchScheduler } from '../../utils/promise/createBatchScheduler.js'\nimport {\n getHttpRpcClient,\n type HttpRpcClientOptions,\n} from '../../utils/rpc/http.js'\n\nimport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './createTransport.js'\n\nexport type HttpTransportConfig<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n> = {\n /**\n * Whether to enable Batch JSON-RPC.\n * @link https://www.jsonrpc.org/specification#batch\n */\n batch?:\n | boolean\n | {\n /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */\n batchSize?: number | undefined\n /** The maximum number of milliseconds to wait before sending a batch. @default 0 */\n wait?: number | undefined\n }\n | undefined\n fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined\n /**\n * Request configuration to pass to `fetch`.\n * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch\n */\n fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined\n /** A callback to handle the response from `fetch`. */\n onFetchRequest?: HttpRpcClientOptions['onRequest'] | undefined\n /** A callback to handle the response from `fetch`. */\n onFetchResponse?: HttpRpcClientOptions['onResponse'] | undefined\n /** The key of the HTTP transport. */\n key?: TransportConfig['key'] | undefined\n /** Methods to include or exclude from executing RPC requests. */\n methods?: TransportConfig['methods'] | undefined\n /** The name of the HTTP transport. */\n name?: TransportConfig['name'] | undefined\n /** Whether to return JSON RPC errors as responses instead of throwing. */\n raw?: raw | boolean | undefined\n /** The max number of times to retry. */\n retryCount?: TransportConfig['retryCount'] | undefined\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig['retryDelay'] | undefined\n /** Typed JSON-RPC schema for the transport. */\n rpcSchema?: rpcSchema | RpcSchema | undefined\n /** The timeout (in ms) for the HTTP request. Default: 10_000 */\n timeout?: TransportConfig['timeout'] | undefined\n}\n\nexport type HttpTransport<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n> = Transport<\n 'http',\n {\n fetchOptions?: HttpTransportConfig['fetchOptions'] | undefined\n url?: string | undefined\n },\n EIP1193RequestFn<rpcSchema, raw>\n>\n\nexport type HttpTransportErrorType =\n | CreateTransportErrorType\n | UrlRequiredErrorType\n | ErrorType\n\n/**\n * @description Creates a HTTP transport that connects to a JSON-RPC API.\n */\nexport function http<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n>(\n /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */\n url?: string | undefined,\n config: HttpTransportConfig<rpcSchema, raw> = {},\n): HttpTransport<rpcSchema, raw> {\n const {\n batch,\n fetchFn,\n fetchOptions,\n key = 'http',\n methods,\n name = 'HTTP JSON-RPC',\n onFetchRequest,\n onFetchResponse,\n retryDelay,\n raw,\n } = config\n return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {\n const { batchSize = 1000, wait = 0 } =\n typeof batch === 'object' ? batch : {}\n const retryCount = config.retryCount ?? retryCount_\n const timeout = timeout_ ?? config.timeout ?? 10_000\n const url_ = url || chain?.rpcUrls.default.http[0]\n if (!url_) throw new UrlRequiredError()\n\n const rpcClient = getHttpRpcClient(url_, {\n fetchFn,\n fetchOptions,\n onRequest: onFetchRequest,\n onResponse: onFetchResponse,\n timeout,\n })\n\n return createTransport(\n {\n key,\n methods,\n name,\n async request({ method, params }) {\n const body = { method, params }\n\n const { schedule } = createBatchScheduler({\n id: url_,\n wait,\n shouldSplitBatch(requests) {\n return requests.length > batchSize\n },\n fn: (body: RpcRequest[]) =>\n rpcClient.request({\n body,\n }),\n sort: (a, b) => a.id - b.id,\n })\n\n const fn = async (body: RpcRequest) =>\n batch\n ? schedule(body)\n : [\n await rpcClient.request({\n body,\n }),\n ]\n\n const [{ error, result }] = await fn(body)\n\n if (raw) return { error, result }\n if (error)\n throw new RpcRequestError({\n body,\n error,\n url: url_,\n })\n return result\n },\n retryCount,\n retryDelay,\n timeout,\n type: 'http',\n },\n {\n fetchOptions,\n url: url_,\n },\n )\n }\n}\n","import { defineChain } from '../../utils/chain/defineChain.js'\n\nexport const mainnet = /*#__PURE__*/ defineChain({\n id: 1,\n name: 'Ethereum',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n blockTime: 12_000,\n rpcUrls: {\n default: {\n http: ['https://eth.merkle.io'],\n },\n },\n blockExplorers: {\n default: {\n name: 'Etherscan',\n url: 'https://etherscan.io',\n apiUrl: 'https://api.etherscan.io/api',\n },\n },\n contracts: {\n ensUniversalResolver: {\n address: '0xeeeeeeee14d718c2b47d9923deab1335e144eeee',\n blockCreated: 23_085_558,\n },\n multicall3: {\n address: '0xca11bde05977b3631167028862be2a173976ca11',\n blockCreated: 14_353_601,\n },\n },\n})\n","import { createViemClient } from '@tuwaio/orbit-evm';\nimport { Config, getBytecode } from '@wagmi/core';\nimport { Address } from 'viem';\nimport { Chain } from 'viem/chains';\n\n/**\n * An in-memory cache for wallets bytecode to avoid redundant requests to the blockchain.\n * Key is the wallet address, value is boolean indicating if it's a contract address.\n * @internal\n */\nconst walletsCache = new Map<string, boolean>();\n\n/**\n * Checks if a given wallet address is a smart contract by examining its bytecode\n *\n * @remarks\n * This function uses an in-memory cache to store results and avoid redundant blockchain requests.\n * The cache persists for the lifetime of the application session.\n *\n * @param config - Wagmi configuration object\n * @param address - Ethereum address to check\n * @param chainId - ID of the blockchain network\n * @param chains - Array of supported chain configurations\n *\n * @returns Promise resolving to boolean indicating if the address is a contract\n * - true: Address is a smart contract\n * - false: Address is an EOA (Externally Owned Account) or client creation failed\n *\n * @example\n * ```typescript\n * const isContract = await checkIsWalletAddressContract({\n * config: wagmiConfig,\n * address: \"0x1234...\",\n * chainId: 1,\n * chains: [mainnet, polygon]\n * });\n * ```\n *\n * @throws Will throw an error if getBytecode request fails\n */\nexport async function checkIsWalletAddressContract({\n config,\n address,\n chainId,\n chains,\n}: {\n /** Wagmi configuration for blockchain interaction */\n config: Config;\n /** Ethereum address to check */\n address: string;\n /** Chain ID where the check should be performed */\n chainId: number | string;\n /** Array of supported chain configurations */\n chains: readonly [Chain, ...Chain[]];\n}): Promise<boolean> {\n // Check cache first to avoid redundant blockchain requests\n if (walletsCache.has(address)) {\n return walletsCache.get(address)!;\n }\n\n // Create Viem client for blockchain interaction\n const client = createViemClient(chainId as number, chains);\n\n if (client) {\n // Get bytecode from the blockchain\n const codeOfWalletAddress = await getBytecode(config, {\n address: address as Address,\n });\n\n // Cache the result\n const isContract = !!codeOfWalletAddress;\n walletsCache.set(address, isContract);\n\n return isContract;\n } else {\n // Return false if client creation failed\n return false;\n }\n}\n","import { OrbitAdapter } from '@tuwaio/orbit-core';\nimport { checkAndSwitchChain, getAvatar, getName } from '@tuwaio/orbit-evm';\nimport { ConnectorEVM, getWalletTypeFromConnectorName, SatelliteAdapter } from '@tuwaio/satellite-core';\nimport {\n Config,\n connect,\n Connector,\n CreateConnectorFn,\n disconnect,\n getAccount,\n getChains,\n getConnectors,\n} from '@wagmi/core';\nimport { zeroAddress } from 'viem';\nimport { mainnet } from 'viem/chains';\n\nimport { checkIsWalletAddressContract } from '../utils/checkIsWalletAddressContract';\n\n/**\n * Creates an EVM-compatible adapter for Satellite\n *\n * @remarks\n * This adapter implements the SatelliteAdapter interface for Ethereum Virtual Machine (EVM) compatible chains.\n * It uses wagmi as the underlying library for wallet connections and chain interactions.\n *\n * @param config - Wagmi configuration object containing chain and connector settings\n * @returns A configured SatelliteAdapter instance for EVM chains\n * @throws Error if config is not provided\n *\n * @example\n * ```typescript\n * const config = createConfig({\n * chains: [mainnet, polygon],\n * connectors: [\n * new InjectedConnector(),\n * new WalletConnectConnector({ projectId: 'your_project_id' })\n * ]\n * });\n *\n * const evmAdapter = satelliteEVMAdapter(config);\n * ```\n */\nexport function satelliteEVMAdapter(config: Config): SatelliteAdapter {\n if (!config) throw new Error('Satellite EVM adapter requires a wagmi config object.');\n\n return {\n /** Identifies this adapter as EVM-compatible */\n key: OrbitAdapter.EVM,\n\n /**\n * Connects to an EVM wallet\n * @returns Connected wallet information\n * @throws Error if connector not found or connection fails\n */\n connect: async ({ walletType, chainId, connectors }) => {\n const connector = connectors.find(\n (connector) => getWalletTypeFromConnectorName(OrbitAdapter.EVM, connector.name) === walletType,\n );\n if (!connector) throw new Error('Cannot find connector with this wallet type');\n\n try {\n await connect(config, {\n connector: connector as Connector<CreateConnectorFn>,\n chainId: chainId as number,\n });\n const account = getAccount(config);\n\n return {\n walletType,\n address: account.address ?? zeroAddress,\n chainId: account.chainId ?? mainnet.id,\n rpcURL: account.chain?.rpcUrls.default.http[0] ?? mainnet.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n isContractAddress: false,\n };\n } catch (e) {\n throw new Error(e instanceof Error ? e.message : String(e));\n }\n },\n\n /**\n * Disconnects the currently connected wallet\n * Only executes if a wallet is actually connected\n */\n disconnect: async () => {\n const account = getAccount(config);\n if (account.isConnected) {\n await disconnect(config);\n }\n },\n\n /**\n * Retrieves available EVM wallet connectors\n * @returns Object containing adapter type and list of available connectors\n */\n getConnectors: async () => {\n const connectors = getConnectors(config);\n return {\n adapter: OrbitAdapter.EVM,\n connectors: connectors.map((connector) => {\n return connector;\n }) as ConnectorEVM[],\n };\n },\n\n /**\n * Switches the connected wallet to specified network\n * @param chainId - Target chain ID to switch to\n */\n checkAndSwitchNetwork: async (chainId) => await checkAndSwitchChain(chainId as number, config),\n\n /**\n * Generates blockchain explorer URLs for the current network\n * @param url - Optional path to append to base explorer URL\n * @returns Complete explorer URL or base explorer URL if no path provided\n */\n getExplorerUrl: (url) => {\n const { chain } = getAccount(config);\n const baseExplorerLink = chain?.blockExplorers?.default.url;\n return url ? `${baseExplorerLink}/${url}` : baseExplorerLink;\n },\n\n /**\n * Resolves ENS name for given address\n * @param address - Ethereum address to resolve\n * @returns ENS name if available, null otherwise\n */\n getName: (address: string) => getName(address as `0x${string}`),\n\n /**\n * Retrieves avatar for ENS name\n * @param name - ENS name to get avatar for\n * @returns Avatar URL if available, null otherwise\n */\n getAvatar: (name: string) => getAvatar(name),\n\n /**\n * Checks if given address is a smart contract\n * @param address - Address to check\n * @param chainId - Chain ID on which to perform the check\n * @returns Promise resolving to boolean indicating if address is a contract\n */\n checkIsContractWallet: async ({ address, chainId }) => {\n const chains = getChains(config);\n return await checkIsWalletAddressContract({ config, address, chainId, chains });\n },\n };\n}\n","import { ChainNotConfiguredError, createConnector } from '@wagmi/core';\nimport {\n type Address,\n custom,\n type EIP1193RequestFn,\n fromHex,\n getAddress,\n type Hex,\n numberToHex,\n RpcRequestError,\n SwitchChainError,\n type Transport,\n UserRejectedRequestError,\n type WalletRpcSchema,\n zeroAddress,\n} from 'viem';\nimport { rpc } from 'viem/utils';\n\n/**\n * Configuration parameters for impersonated wallet connector\n */\nexport type ImpersonatedParameters = {\n /** Function that returns the address to impersonate */\n getAccountAddress: () => string | undefined;\n\n /** Optional feature flags for testing error scenarios */\n features?: {\n /** Simulate connection error */\n connectError?: boolean | Error;\n /** Simulate chain switching error */\n switchChainError?: boolean | Error;\n /** Simulate message signing error */\n signMessageError?: boolean | Error;\n /** Simulate typed data signing error */\n signTypedDataError?: boolean | Error;\n /** Enable reconnection behavior */\n reconnect?: boolean;\n };\n};\n\n/**\n * Creates a wagmi connector for impersonating Ethereum accounts\n *\n * @remarks\n * This connector allows testing wallet interactions without an actual wallet by impersonating\n * an Ethereum address. It implements the EIP-1193 provider interface and can simulate\n * various error scenarios for testing purposes.\n *\n * @param parameters - Configuration options for the impersonated connector\n * @returns A wagmi connector instance\n *\n * @example\n * ```typescript\n * const connector = impersonated({\n * getAccountAddress: () => \"0x1234...\",\n * features: {\n * // Simulate errors for testing\n * connectError: false,\n * signMessageError: false\n * }\n * });\n * ```\n */\nimpersonated.type = 'impersonated' as const;\nexport function impersonated(parameters: ImpersonatedParameters) {\n const features = parameters.features ?? {};\n\n type Provider = ReturnType<Transport<'custom', NonNullable<unknown>, EIP1193RequestFn<WalletRpcSchema>>>;\n let connected = false;\n let connectedChainId: number;\n let accountAddress: Hex[] | undefined = undefined;\n\n return createConnector<Provider>((config) => ({\n id: 'impersonated',\n name: 'Impersonated Connector',\n type: impersonated.type,\n\n /**\n * Initial setup - sets default chain ID\n */\n async setup() {\n connectedChainId = config.chains[0].id;\n },\n /**\n * Simulates wallet connection\n * @throws {UserRejectedRequestError} When connection is rejected\n */\n // @ts-expect-error - not typed correctly\n async connect({ chainId } = {}) {\n if (features.connectError) {\n if (typeof features.connectError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to connect.'));\n throw features.connectError;\n }\n\n const { request } = await this.getProvider();\n const accounts = await request({\n method: 'eth_requestAccounts',\n });\n\n let currentChainId = await this.getChainId();\n if (chainId && currentChainId !== chainId) {\n const chain = await this.switchChain!({ chainId });\n currentChainId = chain.id;\n }\n\n connected = true;\n return { accounts, chainId: currentChainId };\n },\n\n /**\n * Simulates wallet disconnection\n */\n async disconnect() {\n connected = false;\n accountAddress = undefined;\n },\n\n /**\n * Returns impersonated accounts\n * @throws {Error} When not connected\n */\n async getAccounts() {\n if (!connected) throw new Error('Not connected connector');\n const { request } = await this.getProvider();\n const accounts = await request({ method: 'eth_accounts' });\n return accounts.map(getAddress);\n },\n\n /**\n * Returns current chain ID\n */\n async getChainId() {\n const { request } = await this.getProvider();\n const hexChainId = await request({ method: 'eth_chainId' });\n return fromHex(hexChainId, 'number');\n },\n\n /**\n * Checks if wallet is connected and authorized\n */\n async isAuthorized() {\n if (!connected) return false;\n const accounts = await this.getAccounts();\n return !!accounts.length;\n },\n\n /**\n * Simulates switching to a different chain\n * @throws {SwitchChainError} When chain is not configured\n * @throws {UserRejectedRequestError} When switch is rejected\n */\n async switchChain({ chainId }) {\n const chain = config.chains.find((x) => x.id === chainId);\n if (!chain) throw new SwitchChainError(new ChainNotConfiguredError());\n // @ts-expect-error - request is not typed correctly\n const { request } = await this.getProvider();\n await request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: numberToHex(chainId) }],\n });\n return chain;\n },\n\n /**\n * Handles account changes\n */\n onAccountsChanged(accounts) {\n if (accounts.length === 0) this.onDisconnect();\n else config.emitter.emit('change', { accounts: accounts.map(getAddress) });\n },\n\n /**\n * Handles chain changes\n */\n onChainChanged(chain) {\n const chainId = Number(chain);\n config.emitter.emit('change', { chainId });\n },\n\n /**\n * Handles disconnection\n */\n async onDisconnect() {\n config.emitter.emit('disconnect');\n connected = false;\n accountAddress = undefined;\n },\n\n /**\n * Creates an EIP-1193 compatible provider\n * @returns Custom provider instance\n */\n async getProvider({ chainId }: { chainId?: number } = {}) {\n accountAddress = parameters.getAccountAddress()\n ? [(parameters.getAccountAddress() as Address) || zeroAddress]\n : undefined;\n const chain = config.chains.find((x) => x.id === chainId) ?? config.chains[0];\n const url = chain.rpcUrls.default.http[0]!;\n\n const request: EIP1193RequestFn = async ({ method, params }) => {\n // eth methods\n if (method === 'eth_chainId') return numberToHex(connectedChainId);\n if (method === 'eth_requestAccounts') return accountAddress;\n if (method === 'eth_signTypedData_v4')\n if (features.signTypedDataError) {\n if (typeof features.signTypedDataError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to sign typed data.'));\n throw features.signTypedDataError;\n }\n\n // wallet methods\n if (method === 'wallet_switchEthereumChain') {\n if (features.switchChainError) {\n if (typeof features.switchChainError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to switch chain.'));\n throw features.switchChainError;\n }\n type Params = [{ chainId: Hex }];\n connectedChainId = fromHex((params as Params)[0].chainId, 'number');\n this.onChainChanged(connectedChainId.toString());\n return;\n }\n\n // other methods\n if (method === 'personal_sign') {\n if (features.signMessageError) {\n if (typeof features.signMessageError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to sign message.'));\n throw features.signMessageError;\n }\n // Change `personal_sign` to `eth_sign` and swap params\n method = 'eth_sign';\n type Params = [data: Hex, address: Address];\n params = [(params as Params)[1], (params as Params)[0]];\n }\n\n const body = { method, params };\n const { error, result } = await rpc.http(url, { body });\n if (error) throw new RpcRequestError({ body, error, url });\n\n return result;\n };\n return custom({ request })({ retryCount: 1 });\n },\n }));\n}\n","import { ConnectorsInitProps } from '@tuwaio/satellite-core';\nimport { coinbaseWallet, injected, metaMask, safe, walletConnect } from '@wagmi/connectors';\nimport { CreateConnectorFn } from '@wagmi/core';\n\nimport { impersonated } from './ImpersonatedConnector';\n\n/**\n * Configuration options for Gnosis Safe SDK\n * @remarks\n * Defines allowed domains and debug mode for Safe integration\n */\nexport const safeSdkOptions = {\n /** Regular expressions for allowed Safe wallet domains */\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/, /metissafe.tech$/],\n /** Enable debug mode */\n debug: false,\n};\n\n/**\n * Initializes all supported wallet connectors based on provided configuration\n *\n * @remarks\n * Creates instances of various wallet connectors including:\n * - Injected provider (e.g. browser wallets)\n * - MetaMask\n * - Coinbase Wallet\n * - Gnosis Safe\n * - WalletConnect (if projectId provided)\n * - Impersonated wallet (for development/testing)\n *\n * The order of connectors in the returned array determines their priority\n * in the wallet connection UI.\n *\n * @param props - Configuration options for initializing connectors\n * @returns Array of wallet connector instances\n *\n * @example\n * ```typescript\n * const connectors = initAllConnectors({\n * appName: \"My dApp\",\n * projectId: \"wallet_connect_project_id\",\n * appUrl: \"https://mydapp.com\",\n * appLogoUrl: \"https://mydapp.com/logo.png\"\n * });\n * ```\n */\nexport const initAllConnectors = (props: ConnectorsInitProps): readonly CreateConnectorFn[] => {\n // Base connectors that are always available\n const injectedConnector = injected();\n const metamaskConnector = metaMask({\n dappMetadata: { name: props.appName, url: props.appUrl },\n });\n const coinbaseConnector = coinbaseWallet({\n appName: props.appName,\n appLogoUrl: props.appLogoUrl,\n });\n const gnosisSafeConnector = safe({\n ...safeSdkOptions,\n });\n\n // Array of base connectors\n const connectors = [injectedConnector, metamaskConnector, coinbaseConnector, gnosisSafeConnector];\n\n // WalletConnect metadata configuration\n const wcMetadata =\n props.appUrl && props.appIcons && props.appName && props.description\n ? {\n name: props.appName,\n description: props.description,\n url: props.appUrl,\n icons: props.appIcons,\n }\n : undefined;\n\n // Add optional connectors based on configuration\n if (props.projectId && !props.getImpersonatedAccount) {\n // WalletConnect only\n const walletConnectConnector = walletConnect({\n projectId: props.projectId,\n metadata: wcMetadata,\n });\n return [walletConnectConnector, ...connectors];\n } else if (!props.projectId && !!props.getImpersonatedAccount) {\n // Impersonated connector only\n const impersonatedConnector = impersonated({\n getAccountAddress: props.getImpersonatedAccount,\n });\n return [impersonatedConnector, ...connectors];\n } else if (props.projectId && !!props.getImpersonatedAccount) {\n // Both optional connectors\n const walletConnectConnector = walletConnect({\n projectId: props.projectId,\n metadata: wcMetadata,\n });\n const impersonatedConnector = impersonated({\n getAccountAddress: props.getImpersonatedAccount,\n });\n return [walletConnectConnector, impersonatedConnector, ...connectors];\n } else {\n // Base connectors only\n return connectors;\n }\n};\n","import { ConnectorsInitProps } from '@tuwaio/satellite-core';\nimport { createConfig, CreateConfigParameters } from '@wagmi/core';\nimport { http, Transport } from 'viem';\n\nimport { initAllConnectors } from '../connectors';\n\n/**\n * Creates default HTTP transports for each chain in the configuration\n *\n * @param chains - Array of chain configurations from wagmi\n * @returns Object mapping chain IDs to their corresponding HTTP transport instances\n *\n * @internal\n */\nconst createDefaultTransports = (chains: CreateConfigParameters['chains']): Record<number, Transport> => {\n return chains.reduce(\n (acc, chain) => {\n const key = chain.id;\n acc[key] = http() as Transport;\n return acc;\n },\n {} as Record<number, Transport>,\n );\n};\n\n/**\n * Creates a Wagmi configuration with initialized connectors and transports\n *\n * @remarks\n * This function combines Satellite connector initialization with Wagmi configuration.\n * It automatically sets up HTTP transports for each chain if custom transports are not provided.\n *\n * @param config - Combined configuration parameters for Satellite and Wagmi\n * @param config.chains - Array of supported blockchain networks\n * @param config.transports - Optional custom transport configurations for each chain\n * @param config.projectId - WalletConnect project ID\n * @param config.appName - Application name for wallet connection UI\n * @param config.appUrl - Application URL for metadata\n * @param config.appLogoUrl - URL to application logo\n * @param config.appLogo - Optional inline logo data\n * @param config.appIcons - Array of application icon URLs\n * @param config.description - Application description for wallet connection UI\n * @param config.getImpersonatedAccount - Optional function for development wallet impersonation\n *\n * @returns Configured Wagmi instance\n *\n * @example\n * ```typescript\n * const config = createWagmiConfig({\n * chains: [mainnet, polygon],\n * projectId: \"your_project_id\",\n * appName: \"My dApp\",\n * appUrl: \"https://mydapp.com\",\n * appLogoUrl: \"https://mydapp.com/logo.png\"\n * });\n * ```\n */\nexport const createWagmiConfig = ({\n chains,\n transports,\n projectId,\n appLogoUrl,\n appLogo,\n appUrl,\n appIcons,\n appName,\n getImpersonatedAccount,\n description,\n ...params\n}: ConnectorsInitProps & Omit<CreateConfigParameters, 'client' | 'connectors'>) => {\n // Initialize wallet connectors with provided configuration\n const connectors = initAllConnectors({\n projectId,\n appLogoUrl,\n appLogo,\n appUrl,\n appIcons,\n appName,\n getImpersonatedAccount,\n description,\n });\n\n // Create and return the complete Wagmi configuration\n return createConfig({\n connectors,\n // Use custom transports if provided, otherwise create default HTTP transports\n transports: transports ?? createDefaultTransports(chains),\n chains,\n ...params,\n });\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/wait.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withRetry.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/uid.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withDedupe.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/buildRequest.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/chain/defineChain.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/promise/withTimeout.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/id.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/http.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/utils/rpc/compat.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/constants/address.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/createTransport.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/custom.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/errors/transport.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/clients/transports/http.ts","../../../node_modules/.pnpm/viem@2.37.8_bufferutil@4.0.9_typescript@5.9.2_utf-8-validate@5.0.10_zod@3.22.4/node_modules/viem/chains/definitions/mainnet.ts","../src/utils/checkIsWalletAddressContract.ts","../src/adapters/evmAdapter.ts","../src/connectors/ImpersonatedConnector.ts","../src/connectors/index.ts","../src/utils/createWagmiConfig.ts"],"names":["wait","time","res","withRetry","fn","delay_","retryCount","shouldRetry","resolve","reject","attemptRetry","count","retry","error","delay","data","err","index","buffer","uid","length","i","promiseCache","LruMap","withDedupe","enabled","id","promise","buildRequest","request","options","args","overrideOptions","dedupe","methods","retryDelay","method","MethodNotSupportedRpcError","requestId","stringToHex","stringify","err_","ParseRpcError","InvalidRequestRpcError","MethodNotFoundRpcError","InvalidParamsRpcError","InternalRpcError","InvalidInputRpcError","ResourceNotFoundRpcError","ResourceUnavailableRpcError","TransactionRejectedRpcError","LimitExceededRpcError","JsonRpcVersionUnsupportedError","UserRejectedRequestError","UnauthorizedProviderError","UnsupportedProviderMethodError","ProviderDisconnectedError","ChainDisconnectedError","SwitchChainError","UnsupportedNonOptionalCapabilityError","UnsupportedChainIdError","DuplicateIdError","UnknownBundleIdError","BundleTooLargeError","AtomicReadyWalletRejectedUpgradeError","AtomicityNotSupportedError","BaseError","UnknownRpcError","HttpRequestError","retryAfter","defineChain","chain","withTimeout","errorInstance","timeout","signal","timeoutId","controller","createIdStore","idCache","getHttpRpcClient","url","params","body","fetchFn","onRequest","onResponse","fetchOptions","headers","signal_","response","init","TimeoutError","webSocket","socketClient","onError","webSocketAsync","rpc","zeroAddress","createTransport","key","name","type","value","custom","provider","config","defaultRetryCount","UrlRequiredError","http","batch","onFetchRequest","onFetchResponse","raw","retryCount_","timeout_","batchSize","url_","rpcClient","schedule","createBatchScheduler","requests","a","b","result","RpcRequestError","mainnet","walletsCache","checkIsWalletAddressContract","address","chainId","chains","createViemClient","isContract","getBytecode","satelliteEVMAdapter","OrbitAdapter","walletType","connectors","connector","getWalletTypeFromConnectorName","connect","account","getAccount","e","disconnect","getConnectors","checkAndSwitchChain","baseExplorerLink","getName","getAvatar","getChains","impersonated","parameters","features","connected","connectedChainId","accountAddress","createConnector","accounts","currentChainId","getAddress","hexChainId","fromHex","x","ChainNotConfiguredError","numberToHex","safeSdkOptions","initAllConnectors","props","injectedConnector","injected","metamaskConnector","metaMask","coinbaseConnector","coinbaseWallet","gnosisSafeConnector","safe","wcMetadata","walletConnect","walletConnectConnector","impersonatedConnector","createDefaultTransports","acc","createWagmiConfig","transports","projectId","appLogoUrl","appLogo","appUrl","appIcons","appName","getImpersonatedAccount","description","createConfig"],"mappings":"8jBAAA,eAAsBA,EAAAA,CAAKC,CAAAA,CAAY,CACrC,OAAO,IAAI,OAAA,CAASC,CAAAA,EAAQ,WAAWA,CAAAA,CAAKD,CAAI,CAAC,CACnD,CCuBM,SAAUE,EAAAA,CACdC,EACA,CACE,KAAA,CAAOC,CAAAA,CAAS,GAAA,CAChB,WAAAC,CAAAA,CAAa,CAAA,CACb,WAAA,CAAAC,CAAAA,CAAc,IAAM,IAAI,CAAA,CACD,EAAA,CAAE,CAE3B,OAAO,IAAI,OAAA,CAAc,CAACC,EAASC,CAAAA,GAAU,CAC3C,IAAMC,CAAAA,CAAe,MAAO,CAAE,KAAA,CAAAC,CAAAA,CAAQ,CAAC,EAAK,EAAA,GAAM,CAChD,IAAMC,CAAAA,CAAQ,MAAO,CAAE,KAAA,CAAAC,CAAK,CAAA,GAAwB,CAClD,IAAMC,CAAAA,CACJ,OAAOT,CAAAA,EAAW,WAAaA,CAAAA,CAAO,CAAE,KAAA,CAAAM,CAAAA,CAAO,MAAAE,CAAK,CAAE,CAAA,CAAIR,CAAAA,CACxDS,GAAO,MAAMd,EAAAA,CAAKc,CAAK,CAAA,CAC3BJ,EAAa,CAAE,KAAA,CAAOC,CAAAA,CAAQ,CAAC,CAAE,EACnC,CAAA,CAEA,GAAI,CACF,IAAMI,CAAAA,CAAO,MAAMX,GAAE,CACrBI,CAAAA,CAAQO,CAAI,EACd,CAAA,MAASC,CAAAA,CAAK,CACZ,GACEL,CAAAA,CAAQL,CAAAA,EACP,MAAMC,CAAAA,CAAY,CAAE,KAAA,CAAAI,CAAAA,CAAO,KAAA,CAAOK,CAAY,CAAE,CAAA,CAEjD,OAAOJ,CAAAA,CAAM,CAAE,MAAOI,CAAY,CAAE,CAAA,CACtCP,CAAAA,CAAOO,CAAG,EACZ,CACF,CAAA,CACAN,CAAAA,GACF,C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AAAA,EAAK,CACT0E,CACT,CAAA,CACA,EACF,CAAA,CAmCWC,GAAoB,CAAC,CAChC,MAAA,CAAArD,CAAAA,CACA,WAAAsD,CAAAA,CACA,SAAA,CAAAC,CAAAA,CACA,UAAA,CAAAC,EACA,OAAA,CAAAC,CAAAA,CACA,MAAA,CAAAC,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,sBAAA,CAAAC,CAAAA,CACA,YAAAC,CAAAA,CACA,GAAG/G,CACL,CAAA,GAAmF,CAEjF,IAAMwD,CAAAA,CAAa8B,EAAAA,CAAkB,CACnC,UAAAkB,CAAAA,CACA,UAAA,CAAAC,CAAAA,CAEA,MAAA,CAAAE,CAAAA,CACA,SAAAC,CAAAA,CACA,OAAA,CAAAC,EACA,sBAAA,CAAAC,CAAAA,CACA,WAAA,CAAAC,CACF,CAAC,CAAA,CAGD,OAAOC,YAAAA,CAAa,CAClB,WAAAxD,CAAAA,CAEA,UAAA,CAAY+C,CAAAA,EAAcH,EAAAA,CAAwBnD,CAAM,CAAA,CACxD,MAAA,CAAAA,EACA,GAAGjD,CACL,CAAC,CACH","file":"index.mjs","sourcesContent":["export async function wait(time: number) {\n return new Promise((res) => setTimeout(res, time))\n}\n","import type { ErrorType } from '../../errors/utils.js'\nimport { wait } from '../wait.js'\n\nexport type WithRetryParameters = {\n // The delay (in ms) between retries.\n delay?:\n | ((config: { count: number; error: Error }) => number)\n | number\n | undefined\n // The max number of times to retry.\n retryCount?: number | undefined\n // Whether or not to retry when an error is thrown.\n shouldRetry?:\n | (({\n count,\n error,\n }: {\n count: number\n error: Error\n }) => Promise<boolean> | boolean)\n | undefined\n}\n\nexport type WithRetryErrorType = ErrorType\n\nexport function withRetry<data>(\n fn: () => Promise<data>,\n {\n delay: delay_ = 100,\n retryCount = 2,\n shouldRetry = () => true,\n }: WithRetryParameters = {},\n) {\n return new Promise<data>((resolve, reject) => {\n const attemptRetry = async ({ count = 0 } = {}) => {\n const retry = async ({ error }: { error: Error }) => {\n const delay =\n typeof delay_ === 'function' ? delay_({ count, error }) : delay_\n if (delay) await wait(delay)\n attemptRetry({ count: count + 1 })\n }\n\n try {\n const data = await fn()\n resolve(data)\n } catch (err) {\n if (\n count < retryCount &&\n (await shouldRetry({ count, error: err as Error }))\n )\n return retry({ error: err as Error })\n reject(err)\n }\n }\n attemptRetry()\n })\n}\n","const size = 256\nlet index = size\nlet buffer: string\n\nexport function uid(length = 11) {\n if (!buffer || index + length > size * 2) {\n buffer = ''\n index = 0\n for (let i = 0; i < size; i++) {\n buffer += ((256 + Math.random() * 256) | 0).toString(16).substring(1)\n }\n }\n return buffer.substring(index, index++ + length)\n}\n","import { LruMap } from '../lru.js'\n\n/** @internal */\nexport const promiseCache = /*#__PURE__*/ new LruMap<Promise<any>>(8192)\n\ntype WithDedupeOptions = {\n enabled?: boolean | undefined\n id?: string | undefined\n}\n\n/** Deduplicates in-flight promises. */\nexport function withDedupe<data>(\n fn: () => Promise<data>,\n { enabled = true, id }: WithDedupeOptions,\n): Promise<data> {\n if (!enabled || !id) return fn()\n if (promiseCache.get(id)) return promiseCache.get(id)!\n const promise = fn().finally(() => promiseCache.delete(id))\n promiseCache.set(id, promise)\n return promise\n}\n","import { BaseError } from '../errors/base.js'\nimport {\n HttpRequestError,\n type HttpRequestErrorType,\n type RpcRequestErrorType,\n type TimeoutErrorType,\n type WebSocketRequestErrorType,\n} from '../errors/request.js'\nimport {\n AtomicityNotSupportedError,\n type AtomicityNotSupportedErrorType,\n AtomicReadyWalletRejectedUpgradeError,\n type AtomicReadyWalletRejectedUpgradeErrorType,\n BundleTooLargeError,\n type BundleTooLargeErrorType,\n ChainDisconnectedError,\n type ChainDisconnectedErrorType,\n DuplicateIdError,\n type DuplicateIdErrorType,\n InternalRpcError,\n type InternalRpcErrorType,\n InvalidInputRpcError,\n type InvalidInputRpcErrorType,\n InvalidParamsRpcError,\n type InvalidParamsRpcErrorType,\n InvalidRequestRpcError,\n type InvalidRequestRpcErrorType,\n JsonRpcVersionUnsupportedError,\n type JsonRpcVersionUnsupportedErrorType,\n LimitExceededRpcError,\n type LimitExceededRpcErrorType,\n MethodNotFoundRpcError,\n type MethodNotFoundRpcErrorType,\n MethodNotSupportedRpcError,\n type MethodNotSupportedRpcErrorType,\n ParseRpcError,\n type ParseRpcErrorType,\n ProviderDisconnectedError,\n type ProviderDisconnectedErrorType,\n type ProviderRpcErrorCode,\n ResourceNotFoundRpcError,\n type ResourceNotFoundRpcErrorType,\n ResourceUnavailableRpcError,\n type ResourceUnavailableRpcErrorType,\n type RpcError,\n type RpcErrorCode,\n type RpcErrorType,\n SwitchChainError,\n type SwitchChainErrorType,\n TransactionRejectedRpcError,\n type TransactionRejectedRpcErrorType,\n UnauthorizedProviderError,\n type UnauthorizedProviderErrorType,\n UnknownBundleIdError,\n type UnknownBundleIdErrorType,\n UnknownRpcError,\n type UnknownRpcErrorType,\n UnsupportedChainIdError,\n type UnsupportedChainIdErrorType,\n UnsupportedNonOptionalCapabilityError,\n type UnsupportedNonOptionalCapabilityErrorType,\n UnsupportedProviderMethodError,\n type UnsupportedProviderMethodErrorType,\n UserRejectedRequestError,\n type UserRejectedRequestErrorType,\n} from '../errors/rpc.js'\nimport type { ErrorType } from '../errors/utils.js'\nimport type {\n EIP1193RequestFn,\n EIP1193RequestOptions,\n} from '../types/eip1193.js'\nimport { stringToHex } from './encoding/toHex.js'\nimport type { CreateBatchSchedulerErrorType } from './promise/createBatchScheduler.js'\nimport { withDedupe } from './promise/withDedupe.js'\nimport { type WithRetryErrorType, withRetry } from './promise/withRetry.js'\nimport type { GetSocketRpcClientErrorType } from './rpc/socket.js'\nimport { stringify } from './stringify.js'\n\nexport type RequestErrorType =\n | AtomicityNotSupportedErrorType\n | AtomicReadyWalletRejectedUpgradeErrorType\n | BundleTooLargeErrorType\n | ChainDisconnectedErrorType\n | CreateBatchSchedulerErrorType\n | DuplicateIdErrorType\n | HttpRequestErrorType\n | InternalRpcErrorType\n | InvalidInputRpcErrorType\n | InvalidParamsRpcErrorType\n | InvalidRequestRpcErrorType\n | GetSocketRpcClientErrorType\n | JsonRpcVersionUnsupportedErrorType\n | LimitExceededRpcErrorType\n | MethodNotFoundRpcErrorType\n | MethodNotSupportedRpcErrorType\n | ParseRpcErrorType\n | ProviderDisconnectedErrorType\n | ResourceNotFoundRpcErrorType\n | ResourceUnavailableRpcErrorType\n | RpcErrorType\n | RpcRequestErrorType\n | SwitchChainErrorType\n | TimeoutErrorType\n | TransactionRejectedRpcErrorType\n | UnauthorizedProviderErrorType\n | UnknownBundleIdErrorType\n | UnknownRpcErrorType\n | UnsupportedChainIdErrorType\n | UnsupportedNonOptionalCapabilityErrorType\n | UnsupportedProviderMethodErrorType\n | UserRejectedRequestErrorType\n | WebSocketRequestErrorType\n | WithRetryErrorType\n | ErrorType\n\nexport function buildRequest<request extends (args: any) => Promise<any>>(\n request: request,\n options: EIP1193RequestOptions = {},\n): EIP1193RequestFn {\n return async (args, overrideOptions = {}) => {\n const {\n dedupe = false,\n methods,\n retryDelay = 150,\n retryCount = 3,\n uid,\n } = {\n ...options,\n ...overrideOptions,\n }\n\n const { method } = args\n if (methods?.exclude?.includes(method))\n throw new MethodNotSupportedRpcError(new Error('method not supported'), {\n method,\n })\n if (methods?.include && !methods.include.includes(method))\n throw new MethodNotSupportedRpcError(new Error('method not supported'), {\n method,\n })\n\n const requestId = dedupe\n ? stringToHex(`${uid}.${stringify(args)}`)\n : undefined\n return withDedupe(\n () =>\n withRetry(\n async () => {\n try {\n return await request(args)\n } catch (err_) {\n const err = err_ as unknown as RpcError<\n RpcErrorCode | ProviderRpcErrorCode\n >\n switch (err.code) {\n // -32700\n case ParseRpcError.code:\n throw new ParseRpcError(err)\n // -32600\n case InvalidRequestRpcError.code:\n throw new InvalidRequestRpcError(err)\n // -32601\n case MethodNotFoundRpcError.code:\n throw new MethodNotFoundRpcError(err, { method: args.method })\n // -32602\n case InvalidParamsRpcError.code:\n throw new InvalidParamsRpcError(err)\n // -32603\n case InternalRpcError.code:\n throw new InternalRpcError(err)\n // -32000\n case InvalidInputRpcError.code:\n throw new InvalidInputRpcError(err)\n // -32001\n case ResourceNotFoundRpcError.code:\n throw new ResourceNotFoundRpcError(err)\n // -32002\n case ResourceUnavailableRpcError.code:\n throw new ResourceUnavailableRpcError(err)\n // -32003\n case TransactionRejectedRpcError.code:\n throw new TransactionRejectedRpcError(err)\n // -32004\n case MethodNotSupportedRpcError.code:\n throw new MethodNotSupportedRpcError(err, {\n method: args.method,\n })\n // -32005\n case LimitExceededRpcError.code:\n throw new LimitExceededRpcError(err)\n // -32006\n case JsonRpcVersionUnsupportedError.code:\n throw new JsonRpcVersionUnsupportedError(err)\n\n // 4001\n case UserRejectedRequestError.code:\n throw new UserRejectedRequestError(err)\n // 4100\n case UnauthorizedProviderError.code:\n throw new UnauthorizedProviderError(err)\n // 4200\n case UnsupportedProviderMethodError.code:\n throw new UnsupportedProviderMethodError(err)\n // 4900\n case ProviderDisconnectedError.code:\n throw new ProviderDisconnectedError(err)\n // 4901\n case ChainDisconnectedError.code:\n throw new ChainDisconnectedError(err)\n // 4902\n case SwitchChainError.code:\n throw new SwitchChainError(err)\n\n // 5700\n case UnsupportedNonOptionalCapabilityError.code:\n throw new UnsupportedNonOptionalCapabilityError(err)\n // 5710\n case UnsupportedChainIdError.code:\n throw new UnsupportedChainIdError(err)\n // 5720\n case DuplicateIdError.code:\n throw new DuplicateIdError(err)\n // 5730\n case UnknownBundleIdError.code:\n throw new UnknownBundleIdError(err)\n // 5740\n case BundleTooLargeError.code:\n throw new BundleTooLargeError(err)\n // 5750\n case AtomicReadyWalletRejectedUpgradeError.code:\n throw new AtomicReadyWalletRejectedUpgradeError(err)\n // 5760\n case AtomicityNotSupportedError.code:\n throw new AtomicityNotSupportedError(err)\n\n // CAIP-25: User Rejected Error\n // https://docs.walletconnect.com/2.0/specs/clients/sign/error-codes#rejected-caip-25\n case 5000:\n throw new UserRejectedRequestError(err)\n\n default:\n if (err_ instanceof BaseError) throw err_\n throw new UnknownRpcError(err as Error)\n }\n }\n },\n {\n delay: ({ count, error }) => {\n // If we find a Retry-After header, let's retry after the given time.\n if (error && error instanceof HttpRequestError) {\n const retryAfter = error?.headers?.get('Retry-After')\n if (retryAfter?.match(/\\d/))\n return Number.parseInt(retryAfter, 10) * 1000\n }\n\n // Otherwise, let's retry with an exponential backoff.\n return ~~(1 << count) * retryDelay\n },\n retryCount,\n shouldRetry: ({ error }) => shouldRetry(error),\n },\n ),\n { enabled: dedupe, id: requestId },\n )\n }\n}\n\n/** @internal */\nexport function shouldRetry(error: Error) {\n if ('code' in error && typeof error.code === 'number') {\n if (error.code === -1) return true // Unknown error\n if (error.code === LimitExceededRpcError.code) return true\n if (error.code === InternalRpcError.code) return true\n return false\n }\n if (error instanceof HttpRequestError && error.status) {\n // Forbidden\n if (error.status === 403) return true\n // Request Timeout\n if (error.status === 408) return true\n // Request Entity Too Large\n if (error.status === 413) return true\n // Too Many Requests\n if (error.status === 429) return true\n // Internal Server Error\n if (error.status === 500) return true\n // Bad Gateway\n if (error.status === 502) return true\n // Service Unavailable\n if (error.status === 503) return true\n // Gateway Timeout\n if (error.status === 504) return true\n return false\n }\n return true\n}\n","import type { Chain, ChainFormatters } from '../../types/chain.js'\nimport type { Assign, Prettify } from '../../types/utils.js'\n\nexport function defineChain<\n formatters extends ChainFormatters,\n const chain extends Chain<formatters>,\n>(chain: chain): Prettify<Assign<Chain<undefined>, chain>> {\n return {\n formatters: undefined,\n fees: undefined,\n serializers: undefined,\n ...chain,\n } as Assign<Chain<undefined>, chain>\n}\n","import type { ErrorType } from '../../errors/utils.js'\n\nexport type WithTimeoutErrorType = ErrorType\n\nexport function withTimeout<data>(\n fn: ({\n signal,\n }: {\n signal: AbortController['signal'] | null\n }) => Promise<data>,\n {\n errorInstance = new Error('timed out'),\n timeout,\n signal,\n }: {\n // The error instance to throw when the timeout is reached.\n errorInstance?: Error | undefined\n // The timeout (in ms).\n timeout: number\n // Whether or not the timeout should use an abort signal.\n signal?: boolean | undefined\n },\n): Promise<data> {\n return new Promise((resolve, reject) => {\n ;(async () => {\n let timeoutId!: NodeJS.Timeout\n try {\n const controller = new AbortController()\n if (timeout > 0) {\n timeoutId = setTimeout(() => {\n if (signal) {\n controller.abort()\n } else {\n reject(errorInstance)\n }\n }, timeout) as NodeJS.Timeout // need to cast because bun globals.d.ts overrides @types/node\n }\n resolve(await fn({ signal: controller?.signal || null }))\n } catch (err) {\n if ((err as Error)?.name === 'AbortError') reject(errorInstance)\n reject(err)\n } finally {\n clearTimeout(timeoutId)\n }\n })()\n })\n}\n","function createIdStore() {\n return {\n current: 0,\n take() {\n return this.current++\n },\n reset() {\n this.current = 0\n },\n }\n}\n\nexport const idCache = /*#__PURE__*/ createIdStore()\n","import {\n HttpRequestError,\n type HttpRequestErrorType as HttpRequestErrorType_,\n TimeoutError,\n type TimeoutErrorType,\n} from '../../errors/request.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { RpcRequest, RpcResponse } from '../../types/rpc.js'\nimport type { MaybePromise } from '../../types/utils.js'\nimport {\n type WithTimeoutErrorType,\n withTimeout,\n} from '../promise/withTimeout.js'\nimport { stringify } from '../stringify.js'\nimport { idCache } from './id.js'\n\nexport type HttpRpcClientOptions = {\n /** Override for the fetch function used to make requests. */\n fetchFn?:\n | ((input: string | URL | Request, init?: RequestInit) => Promise<Response>)\n | undefined\n /** Request configuration to pass to `fetch`. */\n fetchOptions?: Omit<RequestInit, 'body'> | undefined\n /** A callback to handle the request. */\n onRequest?:\n | ((\n request: Request,\n init: RequestInit,\n ) => MaybePromise<\n void | undefined | (RequestInit & { url?: string | undefined })\n >)\n | undefined\n /** A callback to handle the response. */\n onResponse?: ((response: Response) => Promise<void> | void) | undefined\n /** The timeout (in ms) for the request. */\n timeout?: number | undefined\n}\n\nexport type HttpRequestParameters<\n body extends RpcRequest | RpcRequest[] = RpcRequest,\n> = {\n /** The RPC request body. */\n body: body\n /** Override for the fetch function used to make requests. */\n fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined\n /** Request configuration to pass to `fetch`. */\n fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined\n /** A callback to handle the response. */\n onRequest?:\n | ((\n request: Request,\n init: RequestInit,\n ) => MaybePromise<\n void | undefined | (RequestInit & { url?: string | undefined })\n >)\n | undefined\n /** A callback to handle the response. */\n onResponse?: ((response: Response) => Promise<void> | void) | undefined\n /** The timeout (in ms) for the request. */\n timeout?: HttpRpcClientOptions['timeout'] | undefined\n}\n\nexport type HttpRequestReturnType<\n body extends RpcRequest | RpcRequest[] = RpcRequest,\n> = body extends RpcRequest[] ? RpcResponse[] : RpcResponse\n\nexport type HttpRequestErrorType =\n | HttpRequestErrorType_\n | TimeoutErrorType\n | WithTimeoutErrorType\n | ErrorType\n\nexport type HttpRpcClient = {\n request<body extends RpcRequest | RpcRequest[]>(\n params: HttpRequestParameters<body>,\n ): Promise<HttpRequestReturnType<body>>\n}\n\nexport function getHttpRpcClient(\n url: string,\n options: HttpRpcClientOptions = {},\n): HttpRpcClient {\n return {\n async request(params) {\n const {\n body,\n fetchFn = options.fetchFn ?? fetch,\n onRequest = options.onRequest,\n onResponse = options.onResponse,\n timeout = options.timeout ?? 10_000,\n } = params\n\n const fetchOptions = {\n ...(options.fetchOptions ?? {}),\n ...(params.fetchOptions ?? {}),\n }\n\n const { headers, method, signal: signal_ } = fetchOptions\n\n try {\n const response = await withTimeout(\n async ({ signal }) => {\n const init: RequestInit = {\n ...fetchOptions,\n body: Array.isArray(body)\n ? stringify(\n body.map((body) => ({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n })),\n )\n : stringify({\n jsonrpc: '2.0',\n id: body.id ?? idCache.take(),\n ...body,\n }),\n headers: {\n 'Content-Type': 'application/json',\n ...headers,\n },\n method: method || 'POST',\n signal: signal_ || (timeout > 0 ? signal : null),\n }\n const request = new Request(url, init)\n const args = (await onRequest?.(request, init)) ?? { ...init, url }\n const response = await fetchFn(args.url ?? url, args)\n return response\n },\n {\n errorInstance: new TimeoutError({ body, url }),\n timeout,\n signal: true,\n },\n )\n\n if (onResponse) await onResponse(response)\n\n let data: any\n if (\n response.headers.get('Content-Type')?.startsWith('application/json')\n )\n data = await response.json()\n else {\n data = await response.text()\n try {\n data = JSON.parse(data || '{}')\n } catch (err) {\n if (response.ok) throw err\n data = { error: data }\n }\n }\n\n if (!response.ok) {\n throw new HttpRequestError({\n body,\n details: stringify(data.error) || response.statusText,\n headers: response.headers,\n status: response.status,\n url,\n })\n }\n\n return data\n } catch (err) {\n if (err instanceof HttpRequestError) throw err\n if (err instanceof TimeoutError) throw err\n throw new HttpRequestError({\n body,\n cause: err as Error,\n url,\n })\n }\n },\n }\n}\n","// TODO(v3): This file is here for backwards compatibility, and to prevent breaking changes.\n// These APIs will be removed in v3.\n\n/* c8 ignore start */\nimport type {\n TimeoutErrorType,\n WebSocketRequestError,\n} from '../../errors/request.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { RpcResponse } from '../../types/rpc.js'\nimport type { WithTimeoutErrorType } from '../promise/withTimeout.js'\nimport { getHttpRpcClient, type HttpRequestParameters } from './http.js'\nimport type { SocketRpcClient } from './socket.js'\nimport { getWebSocketRpcClient } from './webSocket.js'\n\nexport type WebSocketOptions = Parameters<\n SocketRpcClient<WebSocket>['request']\n>[0]\nexport type WebSocketReturnType = SocketRpcClient<WebSocket>\nexport type WebSocketErrorType = WebSocketRequestError | ErrorType\n\nfunction webSocket(\n socketClient: SocketRpcClient<WebSocket>,\n { body, onError, onResponse }: WebSocketOptions,\n): WebSocketReturnType {\n socketClient.request({\n body,\n onError,\n onResponse,\n })\n return socketClient\n}\n\nexport type WebSocketAsyncOptions = Parameters<\n SocketRpcClient<WebSocket>['requestAsync']\n>[0]\nexport type WebSocketAsyncReturnType = RpcResponse\nexport type WebSocketAsyncErrorType =\n | WebSocketErrorType\n | TimeoutErrorType\n | WithTimeoutErrorType\n | ErrorType\n\nasync function webSocketAsync(\n socketClient: SocketRpcClient<WebSocket>,\n { body, timeout = 10_000 }: WebSocketAsyncOptions,\n): Promise<WebSocketAsyncReturnType> {\n return socketClient.requestAsync({\n body,\n timeout,\n })\n}\n\n/**\n * @deprecated use `getSocketClient` instead.\n *\n * ```diff\n * -import { getSocket } from 'viem/utils'\n * +import { getSocketClient } from 'viem/utils'\n *\n * -const socket = await getSocket(url)\n * +const socketClient = await getSocketClient(url)\n * +const socket = socketClient.socket\n * ```\n */\nexport async function getSocket(url: string) {\n const client = await getWebSocketRpcClient(url)\n return Object.assign(client.socket, {\n requests: client.requests,\n subscriptions: client.subscriptions,\n })\n}\n\nexport const rpc = {\n /**\n * @deprecated use `getHttpRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getHttpRpcClient } from 'viem/utils'\n *\n * -rpc.http(url, params)\n * +const httpClient = getHttpRpcClient(url)\n * +httpClient.request(params)\n * ```\n */\n http(url: string, params: HttpRequestParameters) {\n return getHttpRpcClient(url).request(params)\n },\n /**\n * @deprecated use `getWebSocketRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getWebSocketRpcClient } from 'viem/utils'\n *\n * -rpc.webSocket(url, params)\n * +const webSocketClient = getWebSocketRpcClient(url)\n * +webSocketClient.request(params)\n * ```\n */\n webSocket,\n /**\n * @deprecated use `getWebSocketRpcClient` instead.\n *\n * ```diff\n * -import { rpc } from 'viem/utils'\n * +import { getWebSocketRpcClient } from 'viem/utils'\n *\n * -const response = await rpc.webSocketAsync(url, params)\n * +const webSocketClient = getWebSocketRpcClient(url)\n * +const response = await webSocketClient.requestAsync(params)\n * ```\n */\n webSocketAsync,\n}\n/* c8 ignore end */\n","export const entryPoint06Address =\n '0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789' as const\nexport const entryPoint07Address =\n '0x0000000071727De22E5E9d8BAf0edAc6f37da032' as const\nexport const entryPoint08Address =\n '0x4337084D9E255Ff0702461CF8895CE9E3b5Ff108' as const\n\nexport const ethAddress = '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee' as const\n\nexport const zeroAddress = '0x0000000000000000000000000000000000000000' as const\n","import type { ErrorType } from '../../errors/utils.js'\nimport type { Chain } from '../../types/chain.js'\nimport type { EIP1193RequestFn } from '../../types/eip1193.js'\nimport type { OneOf } from '../../types/utils.js'\nimport { buildRequest } from '../../utils/buildRequest.js'\nimport { uid as uid_ } from '../../utils/uid.js'\nimport type { ClientConfig } from '../createClient.js'\n\nexport type TransportConfig<\n type extends string = string,\n eip1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn,\n> = {\n /** The name of the transport. */\n name: string\n /** The key of the transport. */\n key: string\n /** Methods to include or exclude from executing RPC requests. */\n methods?:\n | OneOf<\n | {\n include?: string[] | undefined\n }\n | {\n exclude?: string[] | undefined\n }\n >\n | undefined\n /** The JSON-RPC request function that matches the EIP-1193 request spec. */\n request: eip1193RequestFn\n /** The base delay (in ms) between retries. */\n retryDelay?: number | undefined\n /** The max number of times to retry. */\n retryCount?: number | undefined\n /** The timeout (in ms) for requests. */\n timeout?: number | undefined\n /** The type of the transport. */\n type: type\n}\n\nexport type Transport<\n type extends string = string,\n rpcAttributes = Record<string, any>,\n eip1193RequestFn extends EIP1193RequestFn = EIP1193RequestFn,\n> = <chain extends Chain | undefined = Chain>({\n chain,\n}: {\n chain?: chain | undefined\n pollingInterval?: ClientConfig['pollingInterval'] | undefined\n retryCount?: TransportConfig['retryCount'] | undefined\n timeout?: TransportConfig['timeout'] | undefined\n}) => {\n config: TransportConfig<type>\n request: eip1193RequestFn\n value?: rpcAttributes | undefined\n}\n\nexport type CreateTransportErrorType = ErrorType\n\n/**\n * @description Creates an transport intended to be used with a client.\n */\nexport function createTransport<\n type extends string,\n rpcAttributes extends Record<string, any>,\n>(\n {\n key,\n methods,\n name,\n request,\n retryCount = 3,\n retryDelay = 150,\n timeout,\n type,\n }: TransportConfig<type>,\n value?: rpcAttributes | undefined,\n): ReturnType<Transport<type, rpcAttributes>> {\n const uid = uid_()\n return {\n config: {\n key,\n methods,\n name,\n request,\n retryCount,\n retryDelay,\n timeout,\n type,\n },\n request: buildRequest(request, { methods, retryCount, retryDelay, uid }),\n value,\n }\n}\n","import type { ErrorType } from '../../errors/utils.js'\nimport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './createTransport.js'\n\ntype EthereumProvider = { request(...args: any): Promise<any> }\n\nexport type CustomTransportConfig = {\n /** The key of the transport. */\n key?: TransportConfig['key'] | undefined\n /** Methods to include or exclude from executing RPC requests. */\n methods?: TransportConfig['methods'] | undefined\n /** The name of the transport. */\n name?: TransportConfig['name'] | undefined\n /** The max number of times to retry. */\n retryCount?: TransportConfig['retryCount'] | undefined\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig['retryDelay'] | undefined\n}\n\nexport type CustomTransport = Transport<\n 'custom',\n {},\n EthereumProvider['request']\n>\n\nexport type CustomTransportErrorType = CreateTransportErrorType | ErrorType\n\n/**\n * @description Creates a custom transport given an EIP-1193 compliant `request` attribute.\n */\nexport function custom<provider extends EthereumProvider>(\n provider: provider,\n config: CustomTransportConfig = {},\n): CustomTransport {\n const {\n key = 'custom',\n methods,\n name = 'Custom Provider',\n retryDelay,\n } = config\n return ({ retryCount: defaultRetryCount }) =>\n createTransport({\n key,\n methods,\n name,\n request: provider.request.bind(provider),\n retryCount: config.retryCount ?? defaultRetryCount,\n retryDelay,\n type: 'custom',\n })\n}\n","import { BaseError } from './base.js'\n\nexport type UrlRequiredErrorType = UrlRequiredError & {\n name: 'UrlRequiredError'\n}\nexport class UrlRequiredError extends BaseError {\n constructor() {\n super(\n 'No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.',\n {\n docsPath: '/docs/clients/intro',\n name: 'UrlRequiredError',\n },\n )\n }\n}\n","import { RpcRequestError } from '../../errors/request.js'\nimport {\n UrlRequiredError,\n type UrlRequiredErrorType,\n} from '../../errors/transport.js'\nimport type { ErrorType } from '../../errors/utils.js'\nimport type { EIP1193RequestFn, RpcSchema } from '../../types/eip1193.js'\nimport type { RpcRequest } from '../../types/rpc.js'\nimport { createBatchScheduler } from '../../utils/promise/createBatchScheduler.js'\nimport {\n getHttpRpcClient,\n type HttpRpcClientOptions,\n} from '../../utils/rpc/http.js'\n\nimport {\n type CreateTransportErrorType,\n createTransport,\n type Transport,\n type TransportConfig,\n} from './createTransport.js'\n\nexport type HttpTransportConfig<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n> = {\n /**\n * Whether to enable Batch JSON-RPC.\n * @link https://www.jsonrpc.org/specification#batch\n */\n batch?:\n | boolean\n | {\n /** The maximum number of JSON-RPC requests to send in a batch. @default 1_000 */\n batchSize?: number | undefined\n /** The maximum number of milliseconds to wait before sending a batch. @default 0 */\n wait?: number | undefined\n }\n | undefined\n fetchFn?: HttpRpcClientOptions['fetchFn'] | undefined\n /**\n * Request configuration to pass to `fetch`.\n * @link https://developer.mozilla.org/en-US/docs/Web/API/fetch\n */\n fetchOptions?: HttpRpcClientOptions['fetchOptions'] | undefined\n /** A callback to handle the response from `fetch`. */\n onFetchRequest?: HttpRpcClientOptions['onRequest'] | undefined\n /** A callback to handle the response from `fetch`. */\n onFetchResponse?: HttpRpcClientOptions['onResponse'] | undefined\n /** The key of the HTTP transport. */\n key?: TransportConfig['key'] | undefined\n /** Methods to include or exclude from executing RPC requests. */\n methods?: TransportConfig['methods'] | undefined\n /** The name of the HTTP transport. */\n name?: TransportConfig['name'] | undefined\n /** Whether to return JSON RPC errors as responses instead of throwing. */\n raw?: raw | boolean | undefined\n /** The max number of times to retry. */\n retryCount?: TransportConfig['retryCount'] | undefined\n /** The base delay (in ms) between retries. */\n retryDelay?: TransportConfig['retryDelay'] | undefined\n /** Typed JSON-RPC schema for the transport. */\n rpcSchema?: rpcSchema | RpcSchema | undefined\n /** The timeout (in ms) for the HTTP request. Default: 10_000 */\n timeout?: TransportConfig['timeout'] | undefined\n}\n\nexport type HttpTransport<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n> = Transport<\n 'http',\n {\n fetchOptions?: HttpTransportConfig['fetchOptions'] | undefined\n url?: string | undefined\n },\n EIP1193RequestFn<rpcSchema, raw>\n>\n\nexport type HttpTransportErrorType =\n | CreateTransportErrorType\n | UrlRequiredErrorType\n | ErrorType\n\n/**\n * @description Creates a HTTP transport that connects to a JSON-RPC API.\n */\nexport function http<\n rpcSchema extends RpcSchema | undefined = undefined,\n raw extends boolean = false,\n>(\n /** URL of the JSON-RPC API. Defaults to the chain's public RPC URL. */\n url?: string | undefined,\n config: HttpTransportConfig<rpcSchema, raw> = {},\n): HttpTransport<rpcSchema, raw> {\n const {\n batch,\n fetchFn,\n fetchOptions,\n key = 'http',\n methods,\n name = 'HTTP JSON-RPC',\n onFetchRequest,\n onFetchResponse,\n retryDelay,\n raw,\n } = config\n return ({ chain, retryCount: retryCount_, timeout: timeout_ }) => {\n const { batchSize = 1000, wait = 0 } =\n typeof batch === 'object' ? batch : {}\n const retryCount = config.retryCount ?? retryCount_\n const timeout = timeout_ ?? config.timeout ?? 10_000\n const url_ = url || chain?.rpcUrls.default.http[0]\n if (!url_) throw new UrlRequiredError()\n\n const rpcClient = getHttpRpcClient(url_, {\n fetchFn,\n fetchOptions,\n onRequest: onFetchRequest,\n onResponse: onFetchResponse,\n timeout,\n })\n\n return createTransport(\n {\n key,\n methods,\n name,\n async request({ method, params }) {\n const body = { method, params }\n\n const { schedule } = createBatchScheduler({\n id: url_,\n wait,\n shouldSplitBatch(requests) {\n return requests.length > batchSize\n },\n fn: (body: RpcRequest[]) =>\n rpcClient.request({\n body,\n }),\n sort: (a, b) => a.id - b.id,\n })\n\n const fn = async (body: RpcRequest) =>\n batch\n ? schedule(body)\n : [\n await rpcClient.request({\n body,\n }),\n ]\n\n const [{ error, result }] = await fn(body)\n\n if (raw) return { error, result }\n if (error)\n throw new RpcRequestError({\n body,\n error,\n url: url_,\n })\n return result\n },\n retryCount,\n retryDelay,\n timeout,\n type: 'http',\n },\n {\n fetchOptions,\n url: url_,\n },\n )\n }\n}\n","import { defineChain } from '../../utils/chain/defineChain.js'\n\nexport const mainnet = /*#__PURE__*/ defineChain({\n id: 1,\n name: 'Ethereum',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 },\n blockTime: 12_000,\n rpcUrls: {\n default: {\n http: ['https://eth.merkle.io'],\n },\n },\n blockExplorers: {\n default: {\n name: 'Etherscan',\n url: 'https://etherscan.io',\n apiUrl: 'https://api.etherscan.io/api',\n },\n },\n contracts: {\n ensUniversalResolver: {\n address: '0xeeeeeeee14d718c2b47d9923deab1335e144eeee',\n blockCreated: 23_085_558,\n },\n multicall3: {\n address: '0xca11bde05977b3631167028862be2a173976ca11',\n blockCreated: 14_353_601,\n },\n },\n})\n","import { createViemClient } from '@tuwaio/orbit-evm';\nimport { Config, getBytecode } from '@wagmi/core';\nimport { Address } from 'viem';\nimport { Chain } from 'viem/chains';\n\n/**\n * An in-memory cache for wallets bytecode to avoid redundant requests to the blockchain.\n * Key is the wallet address, value is boolean indicating if it's a contract address.\n * @internal\n */\nconst walletsCache = new Map<string, boolean>();\n\n/**\n * Checks if a given wallet address is a smart contract by examining its bytecode\n *\n * @remarks\n * This function uses an in-memory cache to store results and avoid redundant blockchain requests.\n * The cache persists for the lifetime of the application session.\n *\n * @param config - Wagmi configuration object\n * @param address - Ethereum address to check\n * @param chainId - ID of the blockchain network\n * @param chains - Array of supported chain configurations\n *\n * @returns Promise resolving to boolean indicating if the address is a contract\n * - true: Address is a smart contract\n * - false: Address is an EOA (Externally Owned Account) or client creation failed\n *\n * @example\n * ```typescript\n * const isContract = await checkIsWalletAddressContract({\n * config: wagmiConfig,\n * address: \"0x1234...\",\n * chainId: 1,\n * chains: [mainnet, polygon]\n * });\n * ```\n *\n * @throws Will throw an error if getBytecode request fails\n */\nexport async function checkIsWalletAddressContract({\n config,\n address,\n chainId,\n chains,\n}: {\n /** Wagmi configuration for blockchain interaction */\n config: Config;\n /** Ethereum address to check */\n address: string;\n /** Chain ID where the check should be performed */\n chainId: number | string;\n /** Array of supported chain configurations */\n chains: readonly [Chain, ...Chain[]];\n}): Promise<boolean> {\n // Check cache first to avoid redundant blockchain requests\n if (walletsCache.has(address)) {\n return walletsCache.get(address)!;\n }\n\n // Create Viem client for blockchain interaction\n const client = createViemClient(chainId as number, chains);\n\n if (client) {\n // Get bytecode from the blockchain\n const codeOfWalletAddress = await getBytecode(config, {\n address: address as Address,\n });\n\n // Cache the result\n const isContract = !!codeOfWalletAddress;\n walletsCache.set(address, isContract);\n\n return isContract;\n } else {\n // Return false if client creation failed\n return false;\n }\n}\n","import { getWalletTypeFromConnectorName, OrbitAdapter } from '@tuwaio/orbit-core';\nimport { checkAndSwitchChain, getAvatar, getName } from '@tuwaio/orbit-evm';\nimport { ConnectorEVM, SatelliteAdapter } from '@tuwaio/satellite-core';\nimport {\n Config,\n connect,\n Connector,\n CreateConnectorFn,\n disconnect,\n getAccount,\n getChains,\n getConnectors,\n} from '@wagmi/core';\nimport { zeroAddress } from 'viem';\nimport { mainnet } from 'viem/chains';\n\nimport { checkIsWalletAddressContract } from '../utils/checkIsWalletAddressContract';\n\n/**\n * Creates an EVM-compatible adapter for Satellite\n *\n * @remarks\n * This adapter implements the SatelliteAdapter interface for Ethereum Virtual Machine (EVM) compatible chains.\n * It uses wagmi as the underlying library for wallet connections and chain interactions.\n *\n * @param config - Wagmi configuration object containing chain and connector settings\n * @returns A configured SatelliteAdapter instance for EVM chains\n * @throws Error if config is not provided\n *\n * @example\n * ```typescript\n * const config = createConfig({\n * chains: [mainnet, polygon],\n * connectors: [\n * new InjectedConnector(),\n * new WalletConnectConnector({ projectId: 'your_project_id' })\n * ]\n * });\n *\n * const evmAdapter = satelliteEVMAdapter(config);\n * ```\n */\nexport function satelliteEVMAdapter(config: Config): SatelliteAdapter {\n if (!config) throw new Error('Satellite EVM adapter requires a wagmi config object.');\n\n return {\n /** Identifies this adapter as EVM-compatible */\n key: OrbitAdapter.EVM,\n\n /**\n * Connects to an EVM wallet\n * @returns Connected wallet information\n * @throws Error if connector not found or connection fails\n */\n connect: async ({ walletType, chainId, connectors }) => {\n const connector = connectors.find(\n (connector) => getWalletTypeFromConnectorName(OrbitAdapter.EVM, connector.name) === walletType,\n );\n if (!connector) throw new Error('Cannot find connector with this wallet type');\n\n try {\n await connect(config, {\n connector: connector as Connector<CreateConnectorFn>,\n chainId: chainId as number,\n });\n const account = getAccount(config);\n\n return {\n walletType,\n address: account.address ?? zeroAddress,\n chainId: account.chainId ?? mainnet.id,\n rpcURL: account.chain?.rpcUrls.default.http[0] ?? mainnet.rpcUrls.default.http[0],\n isConnected: account.isConnected,\n isContractAddress: false,\n };\n } catch (e) {\n throw new Error(e instanceof Error ? e.message : String(e));\n }\n },\n\n /**\n * Disconnects the currently connected wallet\n * Only executes if a wallet is actually connected\n */\n disconnect: async () => {\n const account = getAccount(config);\n if (account.isConnected) {\n await disconnect(config);\n }\n },\n\n /**\n * Retrieves available EVM wallet connectors\n * @returns Object containing adapter type and list of available connectors\n */\n getConnectors: async () => {\n const connectors = getConnectors(config);\n return {\n adapter: OrbitAdapter.EVM,\n connectors: connectors.map((connector) => {\n return connector;\n }) as ConnectorEVM[],\n };\n },\n\n /**\n * Switches the connected wallet to specified network\n * @param chainId - Target chain ID to switch to\n */\n checkAndSwitchNetwork: async (chainId) => await checkAndSwitchChain(chainId as number, config),\n\n /**\n * Generates blockchain explorer URLs for the current network\n * @param url - Optional path to append to base explorer URL\n * @returns Complete explorer URL or base explorer URL if no path provided\n */\n getExplorerUrl: (url) => {\n const { chain } = getAccount(config);\n const baseExplorerLink = chain?.blockExplorers?.default.url;\n return url ? `${baseExplorerLink}/${url}` : baseExplorerLink;\n },\n\n /**\n * Resolves ENS name for given address\n * @param address - Ethereum address to resolve\n * @returns ENS name if available, null otherwise\n */\n getName: (address: string) => getName(address as `0x${string}`),\n\n /**\n * Retrieves avatar for ENS name\n * @param name - ENS name to get avatar for\n * @returns Avatar URL if available, null otherwise\n */\n getAvatar: (name: string) => getAvatar(name),\n\n /**\n * Checks if given address is a smart contract\n * @param address - Address to check\n * @param chainId - Chain ID on which to perform the check\n * @returns Promise resolving to boolean indicating if address is a contract\n */\n checkIsContractWallet: async ({ address, chainId }) => {\n const chains = getChains(config);\n return await checkIsWalletAddressContract({ config, address, chainId, chains });\n },\n };\n}\n","import { ChainNotConfiguredError, createConnector } from '@wagmi/core';\nimport {\n type Address,\n custom,\n type EIP1193RequestFn,\n fromHex,\n getAddress,\n type Hex,\n numberToHex,\n RpcRequestError,\n SwitchChainError,\n type Transport,\n UserRejectedRequestError,\n type WalletRpcSchema,\n zeroAddress,\n} from 'viem';\nimport { rpc } from 'viem/utils';\n\n/**\n * Configuration parameters for impersonated wallet connector\n */\nexport type ImpersonatedParameters = {\n /** Function that returns the address to impersonate */\n getAccountAddress: () => string | undefined;\n\n /** Optional feature flags for testing error scenarios */\n features?: {\n /** Simulate connection error */\n connectError?: boolean | Error;\n /** Simulate chain switching error */\n switchChainError?: boolean | Error;\n /** Simulate message signing error */\n signMessageError?: boolean | Error;\n /** Simulate typed data signing error */\n signTypedDataError?: boolean | Error;\n /** Enable reconnection behavior */\n reconnect?: boolean;\n };\n};\n\n/**\n * Creates a wagmi connector for impersonating Ethereum accounts\n *\n * @remarks\n * This connector allows testing wallet interactions without an actual wallet by impersonating\n * an Ethereum address. It implements the EIP-1193 provider interface and can simulate\n * various error scenarios for testing purposes.\n *\n * @param parameters - Configuration options for the impersonated connector\n * @returns A wagmi connector instance\n *\n * @example\n * ```typescript\n * const connector = impersonated({\n * getAccountAddress: () => \"0x1234...\",\n * features: {\n * // Simulate errors for testing\n * connectError: false,\n * signMessageError: false\n * }\n * });\n * ```\n */\nimpersonated.type = 'impersonated' as const;\nexport function impersonated(parameters: ImpersonatedParameters) {\n const features = parameters.features ?? {};\n\n type Provider = ReturnType<Transport<'custom', NonNullable<unknown>, EIP1193RequestFn<WalletRpcSchema>>>;\n let connected = false;\n let connectedChainId: number;\n let accountAddress: Hex[] | undefined = undefined;\n\n return createConnector<Provider>((config) => ({\n id: 'impersonated',\n name: 'Impersonated Connector',\n type: impersonated.type,\n\n /**\n * Initial setup - sets default chain ID\n */\n async setup() {\n connectedChainId = config.chains[0].id;\n },\n /**\n * Simulates wallet connection\n * @throws {UserRejectedRequestError} When connection is rejected\n */\n // @ts-expect-error - not typed correctly\n async connect({ chainId } = {}) {\n if (features.connectError) {\n if (typeof features.connectError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to connect.'));\n throw features.connectError;\n }\n\n const { request } = await this.getProvider();\n const accounts = await request({\n method: 'eth_requestAccounts',\n });\n\n let currentChainId = await this.getChainId();\n if (chainId && currentChainId !== chainId) {\n const chain = await this.switchChain!({ chainId });\n currentChainId = chain.id;\n }\n\n connected = true;\n return { accounts, chainId: currentChainId };\n },\n\n /**\n * Simulates wallet disconnection\n */\n async disconnect() {\n connected = false;\n accountAddress = undefined;\n },\n\n /**\n * Returns impersonated accounts\n * @throws {Error} When not connected\n */\n async getAccounts() {\n if (!connected) throw new Error('Not connected connector');\n const { request } = await this.getProvider();\n const accounts = await request({ method: 'eth_accounts' });\n return accounts.map(getAddress);\n },\n\n /**\n * Returns current chain ID\n */\n async getChainId() {\n const { request } = await this.getProvider();\n const hexChainId = await request({ method: 'eth_chainId' });\n return fromHex(hexChainId, 'number');\n },\n\n /**\n * Checks if wallet is connected and authorized\n */\n async isAuthorized() {\n if (!connected) return false;\n const accounts = await this.getAccounts();\n return !!accounts.length;\n },\n\n /**\n * Simulates switching to a different chain\n * @throws {SwitchChainError} When chain is not configured\n * @throws {UserRejectedRequestError} When switch is rejected\n */\n async switchChain({ chainId }) {\n const chain = config.chains.find((x) => x.id === chainId);\n if (!chain) throw new SwitchChainError(new ChainNotConfiguredError());\n // @ts-expect-error - request is not typed correctly\n const { request } = await this.getProvider();\n await request({\n method: 'wallet_switchEthereumChain',\n params: [{ chainId: numberToHex(chainId) }],\n });\n return chain;\n },\n\n /**\n * Handles account changes\n */\n onAccountsChanged(accounts) {\n if (accounts.length === 0) this.onDisconnect();\n else config.emitter.emit('change', { accounts: accounts.map(getAddress) });\n },\n\n /**\n * Handles chain changes\n */\n onChainChanged(chain) {\n const chainId = Number(chain);\n config.emitter.emit('change', { chainId });\n },\n\n /**\n * Handles disconnection\n */\n async onDisconnect() {\n config.emitter.emit('disconnect');\n connected = false;\n accountAddress = undefined;\n },\n\n /**\n * Creates an EIP-1193 compatible provider\n * @returns Custom provider instance\n */\n async getProvider({ chainId }: { chainId?: number } = {}) {\n accountAddress = parameters.getAccountAddress()\n ? [(parameters.getAccountAddress() as Address) || zeroAddress]\n : undefined;\n const chain = config.chains.find((x) => x.id === chainId) ?? config.chains[0];\n const url = chain.rpcUrls.default.http[0]!;\n\n const request: EIP1193RequestFn = async ({ method, params }) => {\n // eth methods\n if (method === 'eth_chainId') return numberToHex(connectedChainId);\n if (method === 'eth_requestAccounts') return accountAddress;\n if (method === 'eth_signTypedData_v4')\n if (features.signTypedDataError) {\n if (typeof features.signTypedDataError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to sign typed data.'));\n throw features.signTypedDataError;\n }\n\n // wallet methods\n if (method === 'wallet_switchEthereumChain') {\n if (features.switchChainError) {\n if (typeof features.switchChainError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to switch chain.'));\n throw features.switchChainError;\n }\n type Params = [{ chainId: Hex }];\n connectedChainId = fromHex((params as Params)[0].chainId, 'number');\n this.onChainChanged(connectedChainId.toString());\n return;\n }\n\n // other methods\n if (method === 'personal_sign') {\n if (features.signMessageError) {\n if (typeof features.signMessageError === 'boolean')\n throw new UserRejectedRequestError(new Error('Failed to sign message.'));\n throw features.signMessageError;\n }\n // Change `personal_sign` to `eth_sign` and swap params\n method = 'eth_sign';\n type Params = [data: Hex, address: Address];\n params = [(params as Params)[1], (params as Params)[0]];\n }\n\n const body = { method, params };\n const { error, result } = await rpc.http(url, { body });\n if (error) throw new RpcRequestError({ body, error, url });\n\n return result;\n };\n return custom({ request })({ retryCount: 1 });\n },\n }));\n}\n","import { ConnectorsInitProps } from '@tuwaio/satellite-core';\nimport { coinbaseWallet, injected, metaMask, safe, walletConnect } from '@wagmi/connectors';\nimport { CreateConnectorFn } from '@wagmi/core';\n\nimport { impersonated } from './ImpersonatedConnector';\n\n/**\n * Configuration options for Gnosis Safe SDK\n * @remarks\n * Defines allowed domains and debug mode for Safe integration\n */\nexport const safeSdkOptions = {\n /** Regular expressions for allowed Safe wallet domains */\n allowedDomains: [/gnosis-safe.io$/, /app.safe.global$/, /metissafe.tech$/],\n /** Enable debug mode */\n debug: false,\n};\n\n/**\n * Initializes all supported wallet connectors based on provided configuration\n *\n * @remarks\n * Creates instances of various wallet connectors including:\n * - Injected provider (e.g. browser wallets)\n * - MetaMask\n * - Coinbase Wallet\n * - Gnosis Safe\n * - WalletConnect (if projectId provided)\n * - Impersonated wallet (for development/testing)\n *\n * The order of connectors in the returned array determines their priority\n * in the wallet connection UI.\n *\n * @param props - Configuration options for initializing connectors\n * @returns Array of wallet connector instances\n *\n * @example\n * ```typescript\n * const connectors = initAllConnectors({\n * appName: \"My dApp\",\n * projectId: \"wallet_connect_project_id\",\n * appUrl: \"https://mydapp.com\",\n * appLogoUrl: \"https://mydapp.com/logo.png\"\n * });\n * ```\n */\nexport const initAllConnectors = (props: ConnectorsInitProps): readonly CreateConnectorFn[] => {\n // Base connectors that are always available\n const injectedConnector = injected();\n const metamaskConnector = metaMask({\n dappMetadata: { name: props.appName, url: props.appUrl },\n });\n const coinbaseConnector = coinbaseWallet({\n appName: props.appName,\n appLogoUrl: props.appLogoUrl,\n });\n const gnosisSafeConnector = safe({\n ...safeSdkOptions,\n });\n\n // Array of base connectors\n const connectors = [injectedConnector, metamaskConnector, coinbaseConnector, gnosisSafeConnector];\n\n // WalletConnect metadata configuration\n const wcMetadata =\n props.appUrl && props.appIcons && props.appName && props.description\n ? {\n name: props.appName,\n description: props.description,\n url: props.appUrl,\n icons: props.appIcons,\n }\n : undefined;\n\n // Add optional connectors based on configuration\n if (props.projectId && !props.getImpersonatedAccount) {\n // WalletConnect only\n const walletConnectConnector = walletConnect({\n projectId: props.projectId,\n metadata: wcMetadata,\n });\n return [walletConnectConnector, ...connectors];\n } else if (!props.projectId && !!props.getImpersonatedAccount) {\n // Impersonated connector only\n const impersonatedConnector = impersonated({\n getAccountAddress: props.getImpersonatedAccount,\n });\n return [impersonatedConnector, ...connectors];\n } else if (props.projectId && !!props.getImpersonatedAccount) {\n // Both optional connectors\n const walletConnectConnector = walletConnect({\n projectId: props.projectId,\n metadata: wcMetadata,\n });\n const impersonatedConnector = impersonated({\n getAccountAddress: props.getImpersonatedAccount,\n });\n return [walletConnectConnector, impersonatedConnector, ...connectors];\n } else {\n // Base connectors only\n return connectors;\n }\n};\n","import { ConnectorsInitProps } from '@tuwaio/satellite-core';\nimport { createConfig, CreateConfigParameters } from '@wagmi/core';\nimport { http, Transport } from 'viem';\n\nimport { initAllConnectors } from '../connectors';\n\n/**\n * Creates default HTTP transports for each chain in the configuration\n *\n * @param chains - Array of chain configurations from wagmi\n * @returns Object mapping chain IDs to their corresponding HTTP transport instances\n *\n * @internal\n */\nconst createDefaultTransports = (chains: CreateConfigParameters['chains']): Record<number, Transport> => {\n return chains.reduce(\n (acc, chain) => {\n const key = chain.id;\n acc[key] = http() as Transport;\n return acc;\n },\n {} as Record<number, Transport>,\n );\n};\n\n/**\n * Creates a Wagmi configuration with initialized connectors and transports\n *\n * @remarks\n * This function combines Satellite connector initialization with Wagmi configuration.\n * It automatically sets up HTTP transports for each chain if custom transports are not provided.\n *\n * @param config - Combined configuration parameters for Satellite and Wagmi\n * @param config.chains - Array of supported blockchain networks\n * @param config.transports - Optional custom transport configurations for each chain\n * @param config.projectId - WalletConnect project ID\n * @param config.appName - Application name for wallet connection UI\n * @param config.appUrl - Application URL for metadata\n * @param config.appLogoUrl - URL to application logo\n * @param config.appLogo - Optional inline logo data\n * @param config.appIcons - Array of application icon URLs\n * @param config.description - Application description for wallet connection UI\n * @param config.getImpersonatedAccount - Optional function for development wallet impersonation\n *\n * @returns Configured Wagmi instance\n *\n * @example\n * ```typescript\n * const config = createWagmiConfig({\n * chains: [mainnet, polygon],\n * projectId: \"your_project_id\",\n * appName: \"My dApp\",\n * appUrl: \"https://mydapp.com\",\n * appLogoUrl: \"https://mydapp.com/logo.png\"\n * });\n * ```\n */\nexport const createWagmiConfig = ({\n chains,\n transports,\n projectId,\n appLogoUrl,\n appLogo,\n appUrl,\n appIcons,\n appName,\n getImpersonatedAccount,\n description,\n ...params\n}: ConnectorsInitProps & Omit<CreateConfigParameters, 'client' | 'connectors'>) => {\n // Initialize wallet connectors with provided configuration\n const connectors = initAllConnectors({\n projectId,\n appLogoUrl,\n appLogo,\n appUrl,\n appIcons,\n appName,\n getImpersonatedAccount,\n description,\n });\n\n // Create and return the complete Wagmi configuration\n return createConfig({\n connectors,\n // Use custom transports if provided, otherwise create default HTTP transports\n transports: transports ?? createDefaultTransports(chains),\n chains,\n ...params,\n });\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tuwaio/satellite-evm",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "1.0.0-fix-test-alpha.2.f8f5982",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Oleksandr Tkach",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -62,9 +62,9 @@
|
|
|
62
62
|
"viem": "^2.37.4",
|
|
63
63
|
"vitest": "^3.2.4",
|
|
64
64
|
"zustand": "^5.0.8",
|
|
65
|
-
"@tuwaio/orbit-core": "^0.0.
|
|
66
|
-
"@tuwaio/
|
|
67
|
-
"@tuwaio/
|
|
65
|
+
"@tuwaio/orbit-core": "^1.0.0-fix-test-alpha.2.f8f5982",
|
|
66
|
+
"@tuwaio/satellite-core": "^1.0.0-fix-test-alpha.2.f8f5982",
|
|
67
|
+
"@tuwaio/orbit-evm": "^1.0.0-fix-test-alpha.2.f8f5982"
|
|
68
68
|
},
|
|
69
69
|
"scripts": {
|
|
70
70
|
"start": "tsup src/index.ts --watch",
|