Skip to content

Commit 19b9fec

Browse files
Update the script example in the Sway Book to use an actual example (#2738)
1 parent fe14baa commit 19b9fec

File tree

1 file changed

+1
-19
lines changed

1 file changed

+1
-19
lines changed

docs/src/sway-program-types/scripts.md

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,7 @@ Scripts are state-aware in that while they have no persistent storage (because t
77
This example script calls a contract:
88

99
```sway
10-
script;
11-
12-
use example_contract::MyContract;
13-
14-
struct InputStruct {
15-
field_1: bool,
16-
field_2: u64,
17-
}
18-
19-
// All scripts require a main function.
20-
fn main () {
21-
let x = abi(MyContract, 0x8900c5bec4ca97d4febf9ceb4754a60d782abbf3cd815836c1872116f203f861);
22-
let asset_id = 0x7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777_7777;
23-
let input = InputStruct {
24-
field_1: true,
25-
field_2: 3,
26-
};
27-
x.foo(5000, 0, asset_id, input);
28-
}
10+
{{#include ../../../examples/wallet_contract_caller_script/src/main.sw}}
2911
```
3012

3113
Scripts, similar to predicates, rely on a `main()` function as an entry point. You can call other functions defined in a script from the `main()` function or call another contract via an [abi cast](./smart_contracts.md#calling-a-smart-contract-from-a-script).

0 commit comments

Comments
 (0)