"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("./platform-CCG_jgOO.js"),c=require("./platform-BMKYxqvv.js"),d=require("./create-4w0DrcRO.js");class a{network;chain;connection;contracts;chainId;coreBridge;constructor(e,n,t,o){this.network=e,this.chain=n,this.connection=t,this.contracts=o,this.chainId=s.toChainId(n);const r=o.coreBridge;if(!r)throw new Error(`CoreBridge contract Address for chain ${n} not found`);this.coreBridge=r}getGuardianSet(e){throw new Error("Method not implemented.")}getGuardianSetIndex(){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(e,n){const[t,o]=await c.AptosPlatform.chainFromRpc(e),r=n[o];if(r.network!==t)throw new Error(`Network mismatch: ${r.network} !== ${t}`);return new a(t,o,e,r.contracts)}async*publishMessage(e,n){throw new Error("Method not implemented.")}async*verifyMessage(e,n){throw new Error("Not implemented.")}async parseTransaction(e){return(await this.parseMessages(e)).map(t=>({chain:t.emitterChain,emitter:t.emitterAddress,sequence:t.sequence}))}async parseMessages(e){const n=await this.connection.getTransactionByHash({transactionHash:e});if(n.type!=="user_transaction")throw new Error(`${e} is not a user_transaction`);const t=n.events.filter(o=>o.type.endsWith("WormholeMessage"));if(!t||t.length===0)throw new Error(`WormholeMessage not found for ${e}`);return t.map(o=>{const r=o.data,i=new s.UniversalAddress(BigInt(r.sender).toString(16).padStart(64,"0"));return d.createVAA("Uint8Array",{guardianSet:0,emitterChain:this.chain,emitterAddress:i,sequence:BigInt(r.sequence),timestamp:Number(r.timestamp),consistencyLevel:r.consistency_level,nonce:Number(r.nonce),signatures:[],payload:s.hex.decode(r.payload)})})}}s.registerProtocol("Aptos","WormholeCore",a);exports.AptosWormholeCore=a;
