Skip to content

Commit

Permalink
update contract-load comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanok committed Jun 22, 2020
1 parent e1cdf6d commit 67dddc7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/contract-load.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ export function getContractExecutionEnvironment(arweave: Arweave, contractSrc: s

// Convert from ES Module format to something we can run inside a Function.
// just replaces `export [async] function handle(` with `[async] function handle(`
// and we add a `return
// and we add a `return handle` to the end of the snippet.
// We then use `new Function()` which we can call and get back the returned handle function
// which has access to the per-instance globals.

contractSrc = contractSrc.replace(/export\s+async\s+function\s+handle/gmu, 'async function handle');
contractSrc = contractSrc.replace(/export\s+function\s+handle\s/gmu, 'function handle');
const ContractErrorDef = `class ContractError extends Error { constructor(message) { super(message); this.name = 'ContractError' } };`;
Expand Down

0 comments on commit 67dddc7

Please sign in to comment.