import { encodeFunctionData } from "viem";
import { ContractType, ENVIRONMENT } from "../types/dimo.js";
import { CHAIN_ABI_MAPPING, ENV_MAPPING } from "../constants/mappings.js";
import { CLAIM_AFTERMARKET_DEVICE, PAIR_AFTERMARKET_DEVICE } from "../constants/methods.js";
export const claimAndPairDevice = async (args, client, environment = "prod") => {
    var _a;
    const contracts = CHAIN_ABI_MAPPING[(_a = ENV_MAPPING.get(environment)) !== null && _a !== void 0 ? _a : ENVIRONMENT.DEV].contracts;
    return await client.account.encodeCallData([
        {
            to: contracts[ContractType.DIMO_REGISTRY].address,
            value: BigInt(0),
            data: encodeFunctionData({
                abi: contracts[ContractType.DIMO_REGISTRY].abi,
                functionName: CLAIM_AFTERMARKET_DEVICE,
                args: [args.aftermarketDeviceNode, args.aftermarketDeviceSig],
            }),
        },
        {
            to: contracts[ContractType.DIMO_REGISTRY].address,
            value: BigInt(0),
            data: encodeFunctionData({
                abi: contracts[ContractType.DIMO_REGISTRY].abi,
                functionName: PAIR_AFTERMARKET_DEVICE,
                args: [args.aftermarketDeviceNode, args.vehicleNode],
            }),
        },
    ]);
};
//# sourceMappingURL=claimAndPair.js.map