import{cS as a,cg as i,c$ as c}from"../main.mjs";import{S as d}from"./sui-BcTGBE_4.js";import{c as h}from"./create-CbNCGANY.js";import"./blake2b-CTqEa12K.js";import"./index-S_2EIxuJ.js";class n{network;chain;provider;contracts;chainId;coreBridgePackageId;constructor(t,s,r,o){this.network=t,this.chain=s,this.provider=r,this.contracts=o,this.chainId=a(s);const e=o.coreBridge;if(!e)throw new Error(`CoreBridge contract Address for chain ${s} not found`);this.coreBridgePackageId=e}getGuardianSet(t){throw new Error("Method not implemented.")}getMessageFee(){throw new Error("Method not implemented.")}static async fromRpc(t,s){const[r,o]=await d.chainFromRpc(t),e=s[o];if(e.network!==r)throw new Error(`Network mismatch: ${e.network} !== ${r}`);return new n(r,o,t,e.contracts)}async*verifyMessage(t,s){throw new Error("Method not implemented.")}async*publishMessage(t,s){throw new Error("Method not implemented.")}async parseTransaction(t){return(await this.parseMessages(t)).map(r=>({emitter:r.emitterAddress,sequence:r.sequence,chain:this.chain}))}async getGuardianSetIndex(){throw new Error("Method not implemented.")}async parseMessages(t){const r=(await this.provider.getTransactionBlock({digest:t,options:{showEvents:!0,showEffects:!0,showInput:!0}})).events?.filter(o=>o.type.endsWith("WormholeMessage"));if(!r||r.length==0)throw new Error("WormholeMessage not found");return r.map(o=>{const e=o.parsedJson;return h("Uint8Array",{emitterChain:this.chain,emitterAddress:new i(e.sender).toUniversalAddress(),sequence:BigInt(e.sequence),guardianSet:0,timestamp:Number(e.timestamp),consistencyLevel:e.consistency_level,nonce:e.nonce,signatures:[],payload:new Uint8Array(e.payload)})})}}c("Sui","WormholeCore",n);export{n as SuiWormholeCore};
