How to pass values during compilation

Hi team, I created a sample code like

#pragma version 2
txn Amount
int 1

In this code, VAR_TMPL_AMOUNT was given by the user, how to pass this input by using javascript SDK during compiling a program. Can anyone please help me to solve this?

You can use simple string replace on the teal source file to set the value for the tmpl variable

1 Like

thanks @Ben .But you can give some example please?

const t = "... TMPL_REPLACE_ME ..." // the string representation of the TEAL source
t.replace('TMPL_REPLACE_ME', 'the_value_i_want') // Replaces the tmpl variable with a concrete value
//compile as normal
1 Like

Thanks, @Ben. I try this.