mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 17:37:58 -05:00
feat(relayer): add withdrawal simulation to relayer service
This commit is contained in:
@@ -58,6 +58,14 @@ export class PrivacyPoolRelayer {
|
||||
if (!isValidWithdrawalProof) {
|
||||
throw ZkError.invalidProof();
|
||||
}
|
||||
|
||||
// simulate tx before broadcasting
|
||||
const simulationResult = await this.sdkProvider.simulateWithdrawal(req, chainId);
|
||||
|
||||
if (!simulationResult.success) {
|
||||
const simulationError = simulationResult.error || "Unknown simulation failure";
|
||||
throw BlockchainError.txSimulationError(`Relay simulation failed: ${simulationError}`);
|
||||
}
|
||||
|
||||
const response = await this.broadcastWithdrawal(req, chainId);
|
||||
await this.db.updateBroadcastedRequest(requestId, response.hash);
|
||||
|
||||
Reference in New Issue
Block a user