Quickadd Macro: Insert text at cursor in current file

What I’m trying to do

Getting started with quickadd macros. I want to add text at the cursor in the current document using a user script macro.

Things I have tried

I have tried the following simple script if someone can fix it I would be greatly obliged. I know I am missing something basic

module.exports = async (params) => {
    const { quickAddApi } = params;

    quickAddApi.app.workspace.activeEditor?.replaceSelection("Hello World");
};

Answering my own question

const { app } = params;
const editor = app.workspace.activeLeaf.view.editor;
editor.replaceSelection("Hello World");