diff --git a/lib/executors/Simulator.ts b/lib/executors/Simulator.ts index dff0858..d7a1296 100644 --- a/lib/executors/Simulator.ts +++ b/lib/executors/Simulator.ts @@ -229,6 +229,16 @@ export class Simulator { return data; } + private async executeSimulationShareRequest(simulationId: string): Promise { + await this.apiV2.post( + ` + /account/${this.configuration.accountName} + /project/${this.configuration.projectName} + /simulations/${simulationId}/share + `, + ); + } + /** * Simulates a transaction by encoding overrides, building a request body, and executing a simulation request. * @async @@ -302,4 +312,19 @@ export class Simulator { handleError(error); } } + + /** + * Makes the dashboard page for a simulation that was created with `save` or `save_if_fails` + * publicly viewable + * @async + * @function + * @param {string} simulationId - The ID of the simulation to be shared. + */ + async shareSimulation(simulationId: string) { + try { + await this.executeSimulationShareRequest(simulationId); + } catch (error) { + handleError(error); + } + } }