const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["main.js","main.css","assets/index-CIIbEJG8.js","assets/index-B8SSPOGN.js","assets/index-BGgxsbk4.js","assets/index-Zgbd9ue1.js"])))=>i.map(i=>d[i]);
var R=Object.defineProperty;var D=s=>{throw TypeError(s)};var B=(s,t,e)=>t in s?R(s,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):s[t]=e;var _=(s,t,e)=>B(s,typeof t!="symbol"?t+"":t,e),x=(s,t,e)=>t.has(s)||D("Cannot "+e);var h=(s,t,e)=>(x(s,t,"read from private field"),e?e.call(s):t.get(s)),l=(s,t,e)=>t.has(s)?D("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,e),o=(s,t,e,i)=>(x(s,t,"write to private field"),i?i.call(s,e):t.set(s,e),e);var O=(s,t,e,i)=>({set _(r){o(s,t,r,e)},get _(){return h(s,t,i)}});import{Y as I,d as V,Z as $,$ as f,a0 as W,a1 as b,_ as m,a2 as M,a3 as Y,a4 as Z}from"../main.js";var a,c;const v=class v extends I{constructor(e){super(e.provider);_(this,"signer");l(this,a);l(this,c);V(this,{signer:e}),o(this,a,null),o(this,c,0)}async getAddress(){return this.signer.getAddress()}connect(e){return new v(this.signer.connect(e))}async getNonce(e){if(e==="pending"){h(this,a)==null&&o(this,a,super.getNonce("pending"));const i=h(this,c);return await h(this,a)+i}return super.getNonce(e)}increment(){O(this,c)._++}reset(){o(this,c,0),o(this,a,null)}async sendTransaction(e){const i=this.getNonce("pending");return this.increment(),e=await this.signer.populateTransaction(e),e.nonce=await i,await this.signer.sendTransaction(e)}signTransaction(e){return this.signer.signTransaction(e)}signMessage(e){return this.signer.signMessage(e)}signTypedData(e,i,r){return this.signer.signTypedData(e,i,r)}};a=new WeakMap,c=new WeakMap;let P=v;async function j(s,t,e){const i=typeof t=="string"?new $(t,s):t,r=(e==null?void 0:e.chain)??(await f.chainFromRpc(s))[1],n=new P(i);if(n.provider===null)try{n.connect(s)}catch(g){console.error("Cannot connect to network for signer",g)}return new q(r,await i.getAddress(),n,e)}class q extends W{constructor(e,i,r,n){super(e,i,r);_(this,"opts");this.opts=n}chain(){return this._chain}address(){return this._address}async sign(e){var w,E,T,y,A,L,C;const i=this.chain(),r=[];let n=500000n,g=100000000000n,p=1500000000n,u=100000000n;if(((w=this.opts)==null?void 0:w.overrides)===void 0&&i!=="Celo"){const d=await this._signer.provider.getFeeData();g=d.gasPrice??g,p=d.maxFeePerGas??p,u=d.maxPriorityFeePerGas??u}((E=this.opts)==null?void 0:E.gasLimit)!==void 0&&(n=this.opts.gasLimit),((T=this.opts)==null?void 0:T.maxGasLimit)!==void 0&&(n=n>((y=this.opts)==null?void 0:y.maxGasLimit)?(A=this.opts)==null?void 0:A.maxGasLimit:n);const G=i==="Oasis"?{gasLimit:n,gasPrice:g,type:0}:{gasLimit:n,maxFeePerGas:p,maxPriorityFeePerGas:u};for(const d of e){const{transaction:S,description:F}=d;(L=this.opts)!=null&&L.debug&&console.log(`Signing: ${F} for ${this.address()}`);const N={...S,...G,from:this.address(),nonce:await this._signer.getNonce(),...(C=this.opts)==null?void 0:C.overrides};r.push(await this._signer.signTransaction(N))}return r}}const J={Address:M,Platform:f,getSigner:j,protocols:{WormholeCore:()=>m(()=>import("../main.js").then(s=>s.d7),__vite__mapDeps([0,1])),TokenBridge:()=>m(()=>import("./index-CIIbEJG8.js"),__vite__mapDeps([2,0,1])),PorticoBridge:()=>m(()=>import("./index-B8SSPOGN.js"),__vite__mapDeps([3,0,1,2])),CircleBridge:()=>m(()=>import("./index-BGgxsbk4.js"),__vite__mapDeps([4,0,1,2])),TBTCBridge:()=>m(()=>import("./index-Zgbd9ue1.js"),__vite__mapDeps([5,0,1]))},getChain:(s,t,e)=>new b(t,new f(s,Y(s,Z,{[t]:e})))};export{J as default};
