const e=require(`../../functions/utils/serialize.utils.cjs`);var t=class t{eventName;transactionHash;blockNumber;args;constructor(e,t,n,r){this.eventName=e,this.transactionHash=t,this.blockNumber=n,this.args=r}static fromSerialized(n){let{eventName:r,transactionHash:i,blockNumber:a,args:o}=JSON.parse(n);return new t(r,i,a,typeof o==`string`?o:e.safeJsonStringify(o??{}))}static fromEthers(n){let{transactionHash:r,blockNumber:i,args:a={},fragment:o}=n,s=n.eventName??o?.name??``,c={},l=Array.isArray(a)?Object.fromEntries(a.map((e,t)=>[String(t),e])):a;return Object.entries(l).forEach(([e,t])=>{c[e]=typeof t==`bigint`?t.toString():t}),o?.inputs?.length&&o.inputs.forEach((e,t)=>{let{name:n}=e;n&&c[String(t)]!==void 0&&(c[n]=c[String(t)])}),new t(s,r,i,e.safeJsonStringify(c))}static fromSolanaEvent(n){let{eventName:r,signature:i,slot:a,data:o={}}=n;return new t(r,i,a,e.safeJsonStringify(o,(e,t)=>typeof t==`object`&&t&&`type`in t&&`data`in t&&t.type===`Buffer`&&Array.isArray(t.data)?t.data:t))}getArg(e){return JSON.parse(this.args)[e]}serialize(){return e.safeJsonStringify({eventName:this.eventName,transactionHash:this.transactionHash,blockNumber:this.blockNumber,args:this.args})}};exports.BlockchainEvent=t;