import { ContractIssuer, constructContractRef } from '@coinweb/contract-kit';

import { constructMutexBlockLockClaimTake, constructMutexLockBlock } from '../claims';
import { lockMethodName } from '../methods';
import { lockFee } from '../settings';

export const constructLockCall = (issuer: ContractIssuer, lockId: string) => {
  return {
    callInfo: {
      ref: constructContractRef(issuer, []),
      methodInfo: {
        methodName: lockMethodName,
        methodArgs: [],
      },
      contractInfo: {
        providedCweb: lockFee,
        authenticated: null,
      },
      contractArgs: [],
    },
    ops: [constructMutexLockBlock(lockId, issuer), constructMutexBlockLockClaimTake(lockId)] as const,
    fee: lockFee + 200n,
  };
};
