From fa6415a940945a42fe3a655ab065f2185300a965 Mon Sep 17 00:00:00 2001 From: Kevin Peters Date: Tue, 24 Sep 2024 09:36:26 -0500 Subject: [PATCH] automatic cctp: use MinAmountError --- connect/src/routes/cctp/automatic.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/connect/src/routes/cctp/automatic.ts b/connect/src/routes/cctp/automatic.ts index 2dff9da65..5f600fafc 100644 --- a/connect/src/routes/cctp/automatic.ts +++ b/connect/src/routes/cctp/automatic.ts @@ -13,6 +13,7 @@ import { TransferState } from "../../types.js"; import { Wormhole } from "../../wormhole.js"; import type { StaticRouteMethods } from "../route.js"; import { AutomaticRoute } from "../route.js"; +import { MinAmountError } from "../types.js"; import type { Quote, QuoteResult, @@ -163,9 +164,7 @@ export class AutomaticCCTPRoute const minAmount = (fee * 105n) / 100n; if (amount.units(amt) < minAmount) { - throw new Error( - `Minimum amount is ${amount.display(request.amountFromBaseUnits(minAmount))}`, - ); + throw new MinAmountError(amount.fromBaseUnits(minAmount, amt.decimals)); } const redeemableAmount = amount.units(amt) - fee;