docs/src/codec/encoding.md
Be sure to read the prerequisites to encoding.
Encoding is done via the ABIEncoder:
{{#include ../../../examples/codec/src/lib.rs:encoding_example}}
There is also a shortcut-macro that can encode multiple types which implement Tokenizable:
{{#include ../../../examples/codec/src/lib.rs:encoding_example_w_macro}}
The encoder can be configured to limit its resource expenditure:
{{#include ../../../examples/codec/src/lib.rs:configuring_the_encoder}}
The default values for the EncoderConfig are:
{{#include ../../../packages/fuels-core/src/codec/abi_encoder.rs:default_encoder_config}}
You can also configure the encoder used to encode the arguments of the contract method:
{{#include ../../../examples/contracts/src/lib.rs:contract_encoder_config}}
The same method is available for script calls.