@morpho-org/midnight-sdk
Version:
Viem-based package for Morpho Midnight that exports protocol utilities, fetch helpers, and Midnight API utilities under a dedicated API subpath.
13 lines (12 loc) • 536 B
JavaScript
import { zeroAddress } from "viem";
import { InvalidOfferParameterError } from "../errors.js";
/** @internal Rejects a sell offer whose proceeds would go to the zero address. */
export function assertNonzeroSellReceiver(offer) {
if (!offer.buy && offer.receiverIfMakerIsSeller === zeroAddress) {
throw new InvalidOfferParameterError({
parameter: "receiverIfMakerIsSeller",
value: offer.receiverIfMakerIsSeller,
instruction: "Use a non-zero receiver for sell offers.",
});
}
}