mirror of
https://github.com/0xbow-io/privacy-pools-core.git
synced 2026-01-09 01:17:58 -05:00
feat: added new exceptions for low fees and bad feeCommitments
This commit is contained in:
@@ -12,7 +12,9 @@ export enum ErrorCode {
|
||||
PROCESSOOOR_MISMATCH = "PROCESSOOOR_MISMATCH",
|
||||
FEE_RECEIVER_MISMATCH = "FEE_RECEIVER_MISMATCH",
|
||||
FEE_MISMATCH = "FEE_MISMATCH",
|
||||
FEE_TOO_LOW = "FEE_TOO_LOW",
|
||||
CONTEXT_MISMATCH = "CONTEXT_MISMATCH",
|
||||
RELAYER_COMMITMENT_REJECTED = "RELAYER_COMMITMENT_REJECTED",
|
||||
INSUFFICIENT_WITHDRAWN_VALUE = "INSUFFICIENT_WITHDRAWN_VALUE",
|
||||
ASSET_NOT_SUPPORTED = "ASSET_NOT_SUPPORTED",
|
||||
|
||||
@@ -204,6 +206,14 @@ export class WithdrawalValidationError extends RelayerError {
|
||||
);
|
||||
}
|
||||
|
||||
public static feeTooLow(details: string) {
|
||||
return new WithdrawalValidationError(
|
||||
"Fee is lower than required by relayer",
|
||||
ErrorCode.FEE_TOO_LOW,
|
||||
details,
|
||||
);
|
||||
}
|
||||
|
||||
public static feeMismatch(details: string) {
|
||||
return new WithdrawalValidationError(
|
||||
"Fee does not match relayer fee",
|
||||
@@ -212,6 +222,14 @@ export class WithdrawalValidationError extends RelayerError {
|
||||
);
|
||||
}
|
||||
|
||||
public static relayerCommitmentRejected(details: string) {
|
||||
return new WithdrawalValidationError(
|
||||
"Relayer commitment is too old or invalid",
|
||||
ErrorCode.RELAYER_COMMITMENT_REJECTED,
|
||||
details,
|
||||
);
|
||||
}
|
||||
|
||||
public static contextMismatch(details: string) {
|
||||
return new WithdrawalValidationError(
|
||||
"Context does not match public signal",
|
||||
|
||||
Reference in New Issue
Block a user