How to use the @accordproject/ergo-compiler.Compiler.compileToJavaScript function in @accordproject/ergo-compiler

To help you get started, we’ve selected a few @accordproject/ergo-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github accordproject / cicero / packages / cicero-core / src / scriptmanager.js View on Github external
compileLogic() {
        let sourceErgo = this.getLogic();
        if (sourceErgo === undefined || sourceErgo.length === 0) {
            return null;
        }
        const compiledErgo = ErgoCompiler.compileToJavaScript(sourceErgo,this.modelManager.getModels(),'cicero',true);
        //console.log('compiling' + this.contents);
        if (compiledErgo.hasOwnProperty('error')) {
            throw new Error(ErgoCompiler.ergoVerboseErrorToString(compiledErgo.error));
        }
        this.compiledScript = new Script(this.modelManager, 'main.js', '.js', compiledErgo.success);
        return this.compiledScript;
    }