diff --git a/api_reference/javascript/CCIPLocalSimulatorFork.mdx b/api_reference/javascript/CCIPLocalSimulatorFork.mdx index f27b0b1..dc8286b 100644 --- a/api_reference/javascript/CCIPLocalSimulatorFork.mdx +++ b/api_reference/javascript/CCIPLocalSimulatorFork.mdx @@ -12,7 +12,10 @@
getEvm2EvmMessage(receipt) ⇒{' '} - object | null + + Evm2EvmMessage + {' '} + | null

@@ -33,6 +36,15 @@

+## Typedefs + +
+
+ Evm2EvmMessage : Object +
+
+
+ ## requestLinkFromTheFaucet(linkAddress, to, amount) ⇒ Promise.<string> @@ -51,15 +63,16 @@ transaction hash of the fund transfer -## getEvm2EvmMessage(receipt) ⇒ object \| null +## getEvm2EvmMessage(receipt) ⇒ [Evm2EvmMessage](#Evm2EvmMessage) \| null Parses a transaction receipt to extract the sent message Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object **Kind**: global function -**Returns**: object \| null - Returns either the sent -message or null if provided receipt does not contain `CCIPSendRequested` log +**Returns**: [Evm2EvmMessage](#Evm2EvmMessage) \| +null - Returns either the sent message or null if provided receipt +does not contain `CCIPSendRequested` log | Param | Type | Description | | ------- | ------------------- | ------------------------------------------------ | @@ -80,7 +93,30 @@ if the message is successfully routed, or reverts - Error Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` -| Param | Type | Description | -| -------------- | ------------------- | --------------------------------- | -| routerAddress | string | Address of the destination Router | -| evm2EvmMessage | object | Sent cross-chain message | +| Param | Type | Description | +| -------------- | ---------------------------------------------- | --------------------------------- | +| routerAddress | string | Address of the destination Router | +| evm2EvmMessage | [Evm2EvmMessage](#Evm2EvmMessage) | Sent cross-chain message | + + + +## Evm2EvmMessage : Object + +**Kind**: global typedef +**Properties** + +| Name | Type | +| ------------------- | ----------------------------------------------------------- | +| sourceChainSelector | bigint | +| sender | string | +| receiver | string | +| sequenceNumber | bigint | +| gasLimit | bigint | +| strict | boolean | +| nonce | bigint | +| feeToken | string | +| feeTokenAmount | bigint | +| data | string | +| tokenAmounts | Array.<\{token: string, amount: bigint}> | +| sourceTokenData | Array.<string> | +| messageId | string | diff --git a/helper_doc/generate-jsdoc.ts b/helper_doc/generate-jsdoc.ts index 6e09970..dee7414 100644 --- a/helper_doc/generate-jsdoc.ts +++ b/helper_doc/generate-jsdoc.ts @@ -1,11 +1,11 @@ -import fs from "fs-extra"; -import path from "path"; -import jsdoc2md from "jsdoc-to-markdown"; +import fs from 'fs-extra'; +import path from 'path'; +import jsdoc2md from 'jsdoc-to-markdown'; -const MDX_EXTENSION = ".mdx"; -const outputDir = path.join(process.cwd(), "api_reference/javascript"); +const MDX_EXTENSION = '.mdx'; +const outputDir = path.join(process.cwd(), 'api_reference/javascript'); -const jsFiles = ["scripts/CCIPLocalSimulatorFork.js"]; +const jsFiles = ['scripts/CCIPLocalSimulatorFork.js']; const generateMarkdownDocs = async ( files: string[], @@ -21,10 +21,11 @@ const generateMarkdownDocs = async ( `${fileName}${MDX_EXTENSION}` ); const markdown = await jsdoc2md.render({ files: absoluteFilePath }); - await fs.outputFile(outputPath, markdown); + const fixedMarkdown = markdown.replace(/<\{/g, '<\\{'); + await fs.outputFile(outputPath, fixedMarkdown); } }; generateMarkdownDocs(jsFiles, outputDir) - .then(() => console.log("Markdown documentation generated successfully.")) - .catch((err) => console.error(err)); + .then(() => console.log('Markdown documentation generated successfully.')) + .catch(err => console.error(err)); diff --git a/scripts/CCIPLocalSimulatorFork.js b/scripts/CCIPLocalSimulatorFork.js index 250f3cc..6a58409 100644 --- a/scripts/CCIPLocalSimulatorFork.js +++ b/scripts/CCIPLocalSimulatorFork.js @@ -24,12 +24,29 @@ async function requestLinkFromTheFaucet(linkAddress, to, amount) { return tx.hash; } +/** + * @typedef {Object} Evm2EvmMessage + * @property {bigint} sourceChainSelector + * @property {string} sender + * @property {string} receiver + * @property {bigint} sequenceNumber + * @property {bigint} gasLimit + * @property {boolean} strict + * @property {bigint} nonce + * @property {string} feeToken + * @property {bigint} feeTokenAmount + * @property {string} data + * @property {Array<{token: string, amount: bigint}>} tokenAmounts + * @property {Array} sourceTokenData + * @property {string} messageId + */ + /** * Parses a transaction receipt to extract the sent message * Scans through transaction logs to find a `CCIPSendRequested` event and then decodes it to an object * * @param {object} receipt - The transaction receipt from the `ccipSend` call - * @returns {object | null} Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log + * @returns {Evm2EvmMessage | null} Returns either the sent message or null if provided receipt does not contain `CCIPSendRequested` log */ function getEvm2EvmMessage(receipt) { const evm2EvmOnRampInterface = new ethers.Interface(EVM2EVMOnRampAbi); @@ -87,7 +104,7 @@ function getEvm2EvmMessage(receipt) { * Routes the sent message from the source network on the destination (current) network * * @param {string} routerAddress - Address of the destination Router - * @param {object} evm2EvmMessage - Sent cross-chain message + * @param {Evm2EvmMessage} evm2EvmMessage - Sent cross-chain message * @returns {Promise} Either resolves with no value if the message is successfully routed, or reverts * @throws {Error} Fails if no off-ramp matches the message's source chain selector or if calling `router.getOffRamps()` */