"use strict";var g=Object.defineProperty;var p=(n,t,s)=>t in n?g(n,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):n[t]=s;var i=(n,t,s)=>p(n,typeof t!="symbol"?t+"":t,s);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("./platform-CyTWPtDR.js"),a=require("./chunk-IMTC3J2M-D-un3eDX.js"),h=require("./address-RcMobNYE.js"),c=require("./address-B-_yHNB2.js");async function _(n,t){const[s,e]=await o.AptosPlatform.chainFromRpc(n),r=a.o.fromPrivateKey({privateKey:new a.z(h.hex.decode(t))});return new f(e,r,n)}class f{constructor(t,s,e,r){i(this,"_chain");i(this,"_account");i(this,"_rpc");i(this,"_debug");this._chain=t,this._account=s,this._rpc=e,this._debug=r}chain(){return this._chain}address(){return this._account.accountAddress.toString()}async signAndSend(t){const s=[];for(const e of t){const{description:r,transaction:u}=e;this._debug&&console.log(`Signing: ${r} for ${this.address()}`);const d=await this._rpc.transaction.build.simple({sender:this._account.accountAddress,data:u}),{hash:l}=await this._simSignSend(d);s.push(l)}return s}async _simSignSend(t){return await this._rpc.transaction.simulate.simple({signerPublicKey:this._account.publicKey,transaction:t}).then(s=>s.forEach(e=>{if(!e.success)throw new Error(`Transaction failed: ${e.vm_status}
${JSON.stringify(e,null,2)}`)})),this._rpc.signAndSubmitTransaction({signer:this._account,transaction:t}).then(s=>this._rpc.waitForTransaction({transactionHash:s.hash}))}}const m={Address:c.AptosAddress,Platform:o.AptosPlatform,getSigner:_,protocols:{WormholeCore:()=>Promise.resolve().then(()=>require("./index-C2Pe6i5V.js")),TokenBridge:()=>Promise.resolve().then(()=>require("./index-f_27F6WX.js")),CircleBridge:()=>Promise.resolve().then(()=>require("./index-DC1ot7tO.js"))},getChain:(n,t,s)=>new o.AptosChain(t,new o.AptosPlatform(n,h.applyChainsConfigConfigOverrides(n,c._platform,{[t]:s})))};exports.default=m;
