{"version":3,"file":"InstrumentPdasClient.mjs","sources":["../../../../src/plugins/instrumentModule/InstrumentPdasClient.ts"],"sourcesContent":["import { Buffer } from 'buffer';\n\nimport { EscrowRfq } from '../rfqModule';\nimport type { Convergence } from '../../Convergence';\nimport { Pda, PublicKey } from '../../types';\n\n/**\n * This client allows you to build PDAs related to the Instrument module.\n *\n * @see {@link InstrumentClient}\n * @group Module Pdas\n */\nexport class InstrumentPdasClient {\n  constructor(protected readonly convergence: Convergence) {}\n\n  /** Finds the PDA of a given instrument escrow. */\n  instrumentEscrow({ response, index, rfqModel }: InstrumentEscrowInput): Pda {\n    return Pda.find(rfqModel.legs[index].getProgramId(), [\n      Buffer.from('escrow', 'utf8'),\n      response.toBuffer(),\n      Buffer.from([0, index]),\n    ]);\n  }\n  /** Finds the PDA of a given quote escrow. */\n  quoteEscrow({ response, program }: QuoteEscrowInput): Pda {\n    // const programId = this.programId(programs);\n    return Pda.find(program, [\n      Buffer.from('escrow', 'utf8'),\n      response.toBuffer(),\n      Buffer.from([1, 0]),\n    ]);\n  }\n}\n\ntype InstrumentEscrowInput = {\n  /** The address of the Response account. */\n  response: PublicKey;\n\n  /** The leg index. */\n  index: number;\n\n  /** The Rfq Model. */\n  rfqModel: EscrowRfq;\n};\n\ntype QuoteEscrowInput = {\n  /** The address of the Response account. */\n  response: PublicKey;\n\n  /** The quote escrow program */\n  program: PublicKey;\n};\n"],"names":["InstrumentPdasClient","convergence","_classCallCheck","_createClass","key","value","instrumentEscrow","_ref","response","index","rfqModel","Pda","find","legs","getProgramId","Buffer","from","toBuffer","quoteEscrow","_ref2","program"],"mappings":";;;;AAMA;AACA;AACA;AACA;AACA;AACA;AACA,IAAaA,oBAAoB,gBAAA,YAAA;EAC/B,SAAAA,oBAAAA,CAA+BC,WAAwB,EAAE;AAAAC,IAAAA,eAAA,OAAAF,oBAAA,CAAA,CAAA;IAAA,IAA1BC,CAAAA,WAAwB,GAAxBA,WAAwB,CAAA;AAAG,GAAA;;AAE1D;A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