const e=require(`../../../constants/server.constants.cjs`),t=require(`../../../API/getServerURL.cjs`),n=require(`../../../data-structures/http/HttpClient.cjs`),r=require(`../../../API/callRelayer.cjs`),i=require(`../../../error-handling/customErrors/ErrorWithTx.cjs`),a=require(`../../snarkjs/common.snarkjs.cjs`);require(`../../../error-handling/index.cjs`),require(`../../snarkjs/index.cjs`);var o=e=>{if(e.status===`success`)return e.message;throw e.message&&e.error?new i.ErrorWithRelayerTransaction(e.error,e.message):Error(e.error)},s=async(e,t,n,i,s,c,l,u,d)=>{let f=a.serializeCircomData(i);return o(await r.callRelayerTransactAPI({chainId:e,a:t[0],b:t[1],c:t[2],dimData:n,circomData:f,withUniswapWorkAround:c,authorizationData:l,adminData:u,tronProofSignature:d,commitmentValidationData:s}))},c=async r=>o(await n.httpClient.post(`${t.RELAYER_URL}${e.RELAYER_CONFIG.SOLANA_TRANSACT}`,r)),l=e=>{if(e.status===`success`)return e.message.scheduleId;throw Error(e.error||`Batch transaction failed`)},u=async(e,t,n,i,o,s)=>{let c=t.map(e=>a.serializeCircomData(e.circomData));return l(await r.callRelayerTransactBatchAPI({chainId:e,transactions:t.map((t,n)=>({chainId:e,a:t.zkCallData[0],b:t.zkCallData[1],c:t.zkCallData[2],dimData:t.dimData,circomData:c[n],commitmentValidationData:t.commitmentValidationData,withUniswapWorkAround:t.withUniswapWorkAround,authorizationData:t.authorizationData,adminData:t.adminData,recipientAddress:t.recipientAddress,tronProofSignature:t.tronProofSignature})),txCompletionTime:i,hashedEthereumAddress:n,ref:o,hashedDashboardAccountId:s}))},d=async(e,t,n,i,a,o)=>l(await r.callRelayerSolanaTransactBatchAPI({chainId:e,transactions:t,hashedEthereumAddress:n,txCompletionTime:i,ref:a,hashedDashboardAccountId:o}));exports.solanaTransactCallRelayer=c,exports.solanaTransactCallRelayerBatch=d,exports.transactCallRelayer=s,exports.transactCallRelayerBatch=u;