Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
KuphJr committed Nov 27, 2023
1 parent 886a2fe commit 581c652
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ Up-to-date documentation on Chainlink Functions can be found [here](https://docs

# Table of Contents

- [functions-toolkit](#functions-toolkit)
- [Table of Contents](#table-of-contents)
- [Prerequisites](#prerequisites)
- [Functions Billing Subscription Management](#functions-billing-subscription-management)
Expand Down Expand Up @@ -572,6 +573,17 @@ const result = await simulateScript({
}
```

Any 3rd party imports used in the JavaScript source code are loaded asynchronously at runtime. Therefore, to use 3rd party imports in the source code that is executed by the `simulateScript` function, you must use the async `import` function as shown in the examples below.

```
const { format } = await import("npm:date-fns");
return Functions.encodeString(format(new Date(), "yyyy-MM-dd"));
```
```
const { escape } = await import("https://deno.land/std/regexp/mod.ts");
return Functions.encodeString(escape("$hello*world?"));
```

**_NOTE:_** When running `simulateScript`, depending on your security settings, you may get a popup asking if you would like to accept incoming network connections. You can safely accept or ignore this popup and it should disappear when the simulation is complete.

**_NOTE:_** The `simulateScript` function is a debugging tool and hence is not a perfect representation of the actual Chainlink oracle execution environment. Therefore, it is important to make a Functions request on a supported testnet blockchain before mainnet usage.
Expand Down

0 comments on commit 581c652

Please sign in to comment.