Skip to content

Commit

Permalink
feat: add share simulation method
Browse files Browse the repository at this point in the history
  • Loading branch information
marcusmolchany committed Aug 24, 2023
1 parent 7cdf08f commit 5ad532b
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions lib/executors/Simulator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,16 @@ export class Simulator {
return data;
}

private async executeSimulationShareRequest(simulationId: string): Promise<void> {
await this.apiV2.post<SimulationBundleRequest, SimulateBundleResponse>(
`
/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
Expand Down Expand Up @@ -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);
}
}
}

0 comments on commit 5ad532b

Please sign in to comment.