"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("./platform-BMKYxqvv.js"),o=require("./chunk-KJH4KKG6-BbF5W1_N.js"),c=require("./platform-CCG_jgOO.js"),a=require("./address-W9jn6Qdk.js");async function l(e,t){const[s,n]=await i.AptosPlatform.chainFromRpc(e),r=o.ze.fromPrivateKey({privateKey:new o.z(c.hex.decode(t))});return new p(n,r,e)}class p{_chain;_account;_rpc;_debug;constructor(t,s,n,r){this._chain=t,this._account=s,this._rpc=n,this._debug=r}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const s=[];for(const n of t){const{description:r,transaction:h}=n;this._debug&&console.log(`Signing: ${r} for ${this.address()}`);const u=await this._rpc.transaction.build.simple({sender:this._account.accountAddress,data:h}),{hash:d}=await this._simSignSend(u);s.push(d)}return s}async _simSignSend(t){return await this._rpc.transaction.simulate.simple({signerPublicKey:this._account.publicKey,transaction:t}).then(s=>s.forEach(n=>{if(!n.success)throw new Error(`Transaction failed: ${n.vm_status}
${JSON.stringify(n,null,2)}`)})),this._rpc.signAndSubmitTransaction({signer:this._account,transaction:t}).then(s=>this._rpc.waitForTransaction({transactionHash:s.hash}))}}const g={Address:a.AptosAddress,Platform:i.AptosPlatform,getSigner:l,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-Da9rvmCc.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-Dou5sFku.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-DBofyYkS.js"))},getChain:(e,t,s)=>new i.AptosChain(t,new i.AptosPlatform(e,c.applyChainsConfigConfigOverrides(e,a._platform,{[t]:s})))};exports.default=g;
