mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 01:17:58 -05:00
feat: add withdrawal simulation to relayer
This commit is contained in:
@@ -59,6 +59,14 @@ export class PrivacyPoolRelayer {
|
||||
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);
|
||||
|
||||
|
||||
@@ -38,6 +38,12 @@ export interface ContractInteractions {
|
||||
scope: Hash,
|
||||
): Promise<TransactionResponse>;
|
||||
|
||||
simulateRelay(
|
||||
withdrawal: Withdrawal,
|
||||
withdrawalProof: WithdrawalProof,
|
||||
scope: Hash
|
||||
): Promise<{ success: boolean; gasEstimate?: bigint; error?: string }>;
|
||||
|
||||
ragequit(
|
||||
commitmentProof: CommitmentProof,
|
||||
privacyPoolAddress: Address,
|
||||
|
||||
Reference in New Issue
Block a user