Back to Fuels Ts

Instantiating a script

apps/docs/src/guide/scripts/instantiating-a-script.md

0.103.0661 B
Original Source
<script setup> import { data } from '../../versions.data' const { forc } = data const url = ` https://docs.fuel.network/docs/sway/introduction/ ` </script>

Instantiating a script

Similar to contracts and predicates, once you've written a script in Sway and compiled it with forc build (read <a :href="url" target="_blank" rel="noreferrer">here</a> for more on how to work with Sway), you'll get the script binary. Using the binary, you can instantiate a script as shown in the code snippet below:

<<< @./snippets/initialising-scripts.ts#script-init{ts:line-numbers}

In the next section, we show how to run a script.