{"version":3,"file":"plugin.cjs","sources":["../../../../src/plugins/spotInstrumentModule/plugin.ts"],"sourcesContent":["import { PROGRAM_ID } from '@convergence-rfq/spot-instrument';\nimport { ProgramClient } from '../programModule';\nimport { spotLegInstrumentParser } from './instruments';\nimport { SpotInstrumentClient } from './client';\nimport {\n  fetchSpotInstrumentConfigOperation,\n  fetchSpotInstrumentConfigOperationHandler,\n  initializeSpotInstrumentConfigOperation,\n  initializeSpotInstrumentConfigOperationHandler,\n  modifySpotInstrumentConfigOperation,\n  modifySpotInstrumentConfigOperationHandler,\n} from './operations';\nimport { ConvergencePlugin, Program } from '@/types';\nimport type { Convergence } from '@/Convergence';\n\n/** @group Plugins */\nexport const spotInstrumentModule = (): ConvergencePlugin => ({\n  install(convergence: Convergence) {\n    const spotInstrumentProgram = {\n      name: 'SpotInstrumentProgram',\n      address: PROGRAM_ID,\n    };\n    convergence.programs().register(spotInstrumentProgram);\n\n    convergence.programs().getSpotInstrument = function (\n      this: ProgramClient,\n      programs?: Program[]\n    ) {\n      return this.get(spotInstrumentProgram.name, programs);\n    };\n\n    convergence.spotInstrument = function () {\n      return new SpotInstrumentClient(this);\n    };\n\n    const op = convergence.operations();\n    op.register(\n      fetchSpotInstrumentConfigOperation,\n      fetchSpotInstrumentConfigOperationHandler\n    );\n    op.register(\n      initializeSpotInstrumentConfigOperation,\n      initializeSpotInstrumentConfigOperationHandler\n    );\n    op.register(\n      modifySpotInstrumentConfigOperation,\n      modifySpotInstrumentConfigOperationHandler\n    );\n\n    convergence.addLegInstrument(\n      spotInstrumentProgram.address,\n      spotLegInstrumentParser\n    );\n  },\n});\n\ndeclare module '../../Convergence' {\n  interface Convergence {\n    spotInstrument(): SpotInstrumentClient;\n  }\n}\n\ndeclare module '../programModule/ProgramClient' {\n  interface ProgramClient {\n    getSpotInstrument(programs?: Program[]): Program;\n  }\n}\n"],"names":["spotInstrumentModule","install","convergence","spotInstrumentProgram","name","address","PROGRAM_ID","programs","register","getSpotInstrument","get","spotInstrument","SpotInstrumentClient","op","operations","fetchSpotInstrumentConfigOperation","fetchSpotInstrumentConfigOperationHandler","initializeSpotInstrumentConfigOperation","initializeSpotInstrumentConfigOperationHandler","modifySpotInstrumentConfigOperation","modifySpotInstrumentConfigOperationHandler","addLegInstrument","spotLegInstrumentParser"],"mappings":";;;;;;;;;;;AAeA;AACaA,IAAAA,oBAAoB,GAAG,SAAvBA,oBAAoBA,GAAA;EAAA,OAA6B;IAC5DC,OAAO,EAAA,SAAAA,OAACC,CAAAA,WAAwB,EAAE;AAChC,MAAA,IAAMC,qBAAqB,GAAG;AAC5BC,QAAAA,IAAI,EAAE,uBAAuB;AAC7BC,QAAAA,OAAO,EAAEC,yBAAAA;OACV,CAAA;MACDJ,WAAW,CAACK,QAAQ,EAAE,CAACC,QAAQ,CAACL,qBAAqB,CAAC,CAAA;MAEtDD,WAAW,CAACK,QAAQ,EAAE,CAACE,iBAAiB,GAAG,UAEzCF,QAAoB,EACpB;QACA,OAAO,IAAI,CAACG,GAAG,CAACP,qBAAqB,CAACC,IAAI,EAAEG,QAAQ,CAAC,CAAA;OACtD,CAAA;MAEDL,WAAW,CAACS,cAAc,GAAG,YAAY;AACvC,QAAA,OAAO,IAAIC,2BAAoB,CAAC,IAAI,CAAC,CAAA;OACtC,CAAA;AAED,MAAA,IAAMC,EAAE,GAAGX,WAAW,CAACY,UAAU,EAAE,CAAA;AACnCD,MAAAA,EAAE,CAACL,QAAQ,CACTO,8CAAkC,EAClCC,qDACF,CAAC,CAAA;AACDH,MAAAA,EAAE,CAACL,QAAQ,CACTS,wDAAuC,EACvCC,+DACF,CAAC,CAAA;AACDL,MAAAA,EAAE,CAACL,QAAQ,CACTW,gDAAmC,EACnCC,uDACF,CAAC,CAAA;MAEDlB,WAAW,CAACmB,gBAAgB,CAC1BlB,qBAAqB,CAACE,OAAO,EAC7BiB,mCACF,CAAC,CAAA;AACH,KAAA;GACD,CAAA;AAAA;;;;"}