{"version":3,"file":"calculateCollateralForConfirmation.cjs","sources":["../../../../../src/plugins/riskEngineModule/operations/calculateCollateralForConfirmation.ts"],"sourcesContent":["import { PublicKey } from '@solana/web3.js';\nimport { Confirmation } from '../../rfqModule/models/Confirmation';\n\nimport { Convergence } from '@/Convergence';\nimport {\n  Operation,\n  OperationHandler,\n  OperationScope,\n  useOperation,\n} from '@/types';\n\nconst Key = 'CalculateCollateralForConfirmationOperation' as const;\n\n/**\n * Calculates the required collateral for a taker for a particular confirmation of the response\n *\n * ```ts\n * await cvg\n      .riskEngine()\n      .calculateCollateralForConfirmation({\n        rfqAddress: rfq.address,\n        responseAddress: rfqResponse.address,\n        confirmation: {\n          side: 'buy',\n          overrideLegMultiplier: 3,\n        },\n      });\n * ```\n *\n * @group Operations\n * @category Constructors\n */\nexport const calculateCollateralForConfirmationOperation =\n  useOperation<CalculateCollateralForConfirmationOperation>(Key);\n\n/**\n * @group Operations\n * @category Types\n */\nexport type CalculateCollateralForConfirmationOperation = Operation<\n  typeof Key,\n  CalculateCollateralForConfirmationInput,\n  CalculateCollateralForConfirmationOutput\n>;\n\n/**\n * @group Operations\n * @category Inputs\n */\nexport type CalculateCollateralForConfirmationInput = {\n  /** The address of the Rfq account. */\n  rfqAddress: PublicKey;\n\n  /** The address of the response account. */\n  responseAddress: PublicKey;\n\n  /** Confirmation which collateral requirements are estimated */\n  confirmation: Confirmation;\n};\n\n/**\n * @group Operations\n * @category Outputs\n */\nexport type CalculateCollateralForConfirmationOutput = {\n  /** Collateral required as a floating point number */\n  requiredCollateral: number;\n};\n\nexport type CalculateCollateralForConfirmationBuilderParams =\n  CalculateCollateralForConfirmationInput;\n\nexport const calculateCollateralForConfirmationOperationHandler: OperationHandler<CalculateCollateralForConfirmationOperation> =\n  {\n    handle: async (\n      _operation: CalculateCollateralForConfirmationOperation,\n      _convergence: Convergence,\n      _scope: OperationScope\n    ) => {\n      return { requiredCollateral: 0 };\n    },\n  };\n"],"names":["Key","calculateCollateralForConfirmationOperation","useOperation","calculateCollateralForConfirmationOperationHandler","handle","_handle","_asyncToGenerator","_regeneratorRuntime","mark","_callee","_operation","_convergence","_scope","wrap","_callee$","_context","prev","next","abrupt","requiredCollateral","stop","_x","_x2","_x3","apply","arguments"],"mappings":";;;;;;;AAWA,IAAMA,GAAG,GAAG,6CAAsD,CAAA;;AAElE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;IACaC,2CAA2C,GACtDC,sBAAY,CAA8CF,GAAG,EAAC;;AAEhE;AACA;AACA;AACA;;AAOA;AACA;AACA;AACA;;AAYA;AACA;AACA;AACA;;AASO,IAAMG,kDAAiH,GAC5H;EACEC,MAAM,EAAA,YAAA;AAAA,IAAA,IAAAC,OAAA,GAAAC,0CAAA,eAAAC,4CAAA,EAAAC,CAAAA,IAAA,CAAE,SAAAC,OACNC,CAAAA,UAAuD,EACvDC,YAAyB,EACzBC,MAAsB,EAAA;AAAA,MAAA,OAAAL,4CAAA,EAAA,CAAAM,IAAA,CAAA,SAAAC,SAAAC,QAAA,EAAA;AAAA,QAAA,OAAA,CAAA,EAAA,QAAAA,QAAA,CAAAC,IAAA,GAAAD,QAAA,CAAAE,IAAA;AAAA,UAAA,KAAA,CAAA;YAAA,OAAAF,QAAA,CAAAG,MAAA,CAEf,QAAA,EAAA;AAAEC,cAAAA,kBAAkB,EAAE,CAAA;aAAG,CAAA,CAAA;AAAA,UAAA,KAAA,CAAA,CAAA;AAAA,UAAA,KAAA,KAAA;YAAA,OAAAJ,QAAA,CAAAK,IAAA,EAAA,CAAA;AAAA,SAAA;AAAA,OAAA,EAAAX,OAAA,CAAA,CAAA;KACjC,CAAA,CAAA,CAAA;AAAA,IAAA,SAAAL,MAAAiB,CAAAA,EAAA,EAAAC,GAAA,EAAAC,GAAA,EAAA;AAAA,MAAA,OAAAlB,OAAA,CAAAmB,KAAA,CAAA,IAAA,EAAAC,SAAA,CAAA,CAAA;AAAA,KAAA;AAAA,IAAA,OAAArB,MAAA,CAAA;AAAA,GAAA,EAAA;AACH;;;;;"}