const action = {
  startBlock: `async function action(bp: typeof sdk, event: sdk.IO.IncomingEvent, args: any, { user, temp, session } = event.state) {
/** Your action code starts below */

`,
  endBlock: `
/** Your action code ends here */ 
}
`
}

const wrapper = {
  add: content => `${action.startBlock}${content}${action.endBlock}`,
  remove: content =>
    content
      .replace(action.startBlock.trim(), '')
      .replace(action.endBlock.trim(), '')
      .trim()
}

export { wrapper }

@@ -3,34 +3,30 @@
 nst 
-action = %7B%0A  startBlock: %60
+ACTION_SIGNATURE =%0A  '
 asyn
@@ -137,19 +137,48 @@
 t.state)
- %7B%0A
+'%0Aconst ACTION_START_COMMENT = %60
 /** Your
@@ -209,27 +209,38 @@
 w */
-%0A%0A%60,%0A  endBlock: %60%0A
+%60%0Aconst ACTION_END_COMMENT = '
 /** 
@@ -272,15 +272,9 @@
 e */
- %0A%7D%0A%60%0A%7D
+'
 %0A%0Aco
@@ -314,53 +314,90 @@
  %60$%7B
-action.startBlock%7D$%7Bcontent%7D$%7Baction.endBlock
+ACTION_SIGNATURE%7D%7B%5Cn$%7BACTION_START_COMMENT%7D%5Cn%5Cn$%7Bcontent%7D%5Cn$%7BACTION_END_COMMENT%7D%5Cn
 %7D%60,%0A
@@ -420,16 +420,18 @@
 t =%3E
+ %7B
 %0A    con
 tent
@@ -430,114 +430,219 @@
  con
-tent%0A      .replace(acti
+st contentStart = content.indexOf(ACTION_START_COMMENT) + ACTION_START_COMMENT.length%0A    c
 on
-.
 st
-artBlock.trim(), ''
+ contentEnd = content.indexOf(ACTION_END_COMMENT
 )%0A
+%0A
     
-  .replace(action.endBlock.trim(), '')%0A      .trim()
+return content.substring(contentStart, contentEnd).trim()%0A  %7D
 %0A%7D%0A%0A

fix function instrumentation