import { BlockFilter, constructContractIssuer, constructContractRef, Shard } from '@coinweb/contract-kit';

export const getEventListenerCallFee = () => {
  const transactionFee = 700n;
  const jumpContractFee = 10000n;
  const totalFee = transactionFee + jumpContractFee;

  return {
    transactionFee,
    jumpContractFee,
    totalFee,
  };
};

export const constructEventListenerCall = ({
  eventShard,
  jumpContractId,
  jumpContractMethod,
  blockFilter,
}: {
  blockFilter: BlockFilter;
  eventShard: Shard;
  jumpContractId: string;
  jumpContractMethod: string;
}) => {
  return [
    {
      callInfo: {
        ref: constructContractRef(constructContractIssuer(jumpContractId), []),
        methodInfo: {
          methodName: jumpContractMethod,
          methodArgs: [eventShard, blockFilter],
        },
        contractInfo: {
          providedCweb: getEventListenerCallFee().jumpContractFee,
          authenticated: null,
        },
        contractArgs: [],
      },
    },
  ];
};
