import { abis } from "@bosonprotocol/common";
import { Interface } from "@ethersproject/abi";
import { rebuildSignature } from "../utils/signature";
export const bosonDisputeHandlerIface = new Interface(abis.IBosonDisputeHandlerABI);
export function encodeDecideDispute(args) {
    return bosonDisputeHandlerIface.encodeFunctionData("decideDispute", [
        args.exchangeId,
        args.buyerPercent
    ]);
}
export function encodeEscalateDispute(exchangeId) {
    return bosonDisputeHandlerIface.encodeFunctionData("escalateDispute", [
        exchangeId
    ]);
}
export function encodeExpireDispute(exchangeId) {
    return bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
        exchangeId
    ]);
}
export function encodeExpireDisputeBatch(exchangeIds) {
    return bosonDisputeHandlerIface.encodeFunctionData("expireDispute", [
        exchangeIds
    ]);
}
export function encodeExpireEscalatedDispute(exchangeId) {
    return bosonDisputeHandlerIface.encodeFunctionData("expireEscalatedDispute", [
        exchangeId
    ]);
}
export function encodeExtendDisputeTimeout(args) {
    return bosonDisputeHandlerIface.encodeFunctionData("extendDisputeTimeout", [
        args.exchangeId,
        args.newDisputeTimeout
    ]);
}
export function encodeRaiseDispute(args) {
    return bosonDisputeHandlerIface.encodeFunctionData("raiseDispute", [
        args.exchangeId
    ]);
}
export function encodeRefuseEscalatedDispute(exchangeId) {
    return bosonDisputeHandlerIface.encodeFunctionData("refuseEscalatedDispute", [
        exchangeId
    ]);
}
export function encodeResolveDispute(args) {
    let signature;
    if (!("signature" in args)) {
        signature = rebuildSignature({
            r: args.sigR.toString(),
            s: args.sigS.toString(),
            v: Number(args.sigV)
        });
    }
    else {
        signature = args.signature;
    }
    return bosonDisputeHandlerIface.encodeFunctionData("resolveDispute", [
        args.exchangeId,
        args.buyerPercentBasisPoints,
        signature
    ]);
}
export function encodeRetractDispute(exchangeId) {
    return bosonDisputeHandlerIface.encodeFunctionData("retractDispute", [
        exchangeId
    ]);
}
//# sourceMappingURL=interface.js.map