import{a as o}from"./chunk-OOX2UCLJ.js";import{b as e,c as l,g as c,h as f}from"./chunk-DCWKMLDG.js";import{a}from"./chunk-CVKDPNYM.js";import{generalSolanaTransactionExecutor as w}from"@rango-dev/signer-solana";import{PublicKey as T}from"@solana/web3.js";import{SignerError as h,SignerErrorCode as y}from"rango-types";function x(g){return"version"in g}a(x,"isVersionedTransaction");var m=class{static{a(this,"SolanaSigner")}async signMessage(t){try{let r=await c();return(await new o(r).signOffchainMessage(e(),Buffer.from(t))).signature.toString()}catch(r){throw new h(y.SIGN_TX_ERROR,void 0,r)}}async signAndSendTx(t){try{return{hash:await w(t,a(async n=>{let p=await c(),i=new o(p),s;x(n)?s=await i.signTransaction(e(),n.message.serialize()):s=await i.signTransaction(e(),n.serialize());let u=await i.getAddress(e()),S=new T(u.address);return n.addSignature(S,Buffer.from(s.signature)),n.serialize()},"DefaultSolanaSigner"))}}catch(r){throw l(r)}finally{await f()}}};export{m as SolanaSigner,x as isVersionedTransaction};
//# sourceMappingURL=solana-IAFAKOIV.js.map
