Skip to content

Commit 3632223

Browse files
authored
automatic cctp: use MinAmountError (#703)
1 parent 94d966a commit 3632223

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

connect/src/routes/cctp/automatic.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import { TransferState } from "../../types.js";
1313
import { Wormhole } from "../../wormhole.js";
1414
import type { StaticRouteMethods } from "../route.js";
1515
import { AutomaticRoute } from "../route.js";
16+
import { MinAmountError } from "../types.js";
1617
import type {
1718
Quote,
1819
QuoteResult,
@@ -163,9 +164,7 @@ export class AutomaticCCTPRoute<N extends Network>
163164

164165
const minAmount = (fee * 105n) / 100n;
165166
if (amount.units(amt) < minAmount) {
166-
throw new Error(
167-
`Minimum amount is ${amount.display(request.amountFromBaseUnits(minAmount))}`,
168-
);
167+
throw new MinAmountError(amount.fromBaseUnits(minAmount, amt.decimals));
169168
}
170169

171170
const redeemableAmount = amount.units(amt) - fee;

0 commit comments

Comments
 (0)