I am currently working on this issue: https://github.com/FuelLabs/fuels-ts/issues/1050 For the sake of comparison, I am going to use the `VM_TX_MEMORY` constant that needs to be calculated when we calculate the call script's data offset before making any contract calls. ___ ### Rust SDK When someone tries to `call` a contract function, the `async build_tx` function (https://github.com/FuelLabs/fuels-rs/blob/6efa6f11c8f69f4ef604b70bb78d55f6d4bf76e1/packages/fuels-programs/src/contract.rs#L469) is called. This function takes care of calculating the call script's data offset, and 'prepares' the contract call. Note that this function is `async`. ___ ### TS SDK The TS SDK has a very different arrangement in place. The TS SDK 'builds' all the functions in a contract whenever a `Contract` is initialized (i.e., whenever a `Contract` object is created). This happens long before and without the need of a contract call being requested. The call script's data offset is calculated here too. Note that all of this takes place inside of a constructor - which cannot be `async` natively. The `Contract` class creates and stores all the functions as `FunctionInvocationScope`s when it is initialized. This is fine, but there needs to be some change so that the `FunctionInvocationScope` class prepares/builds the contract calls/txs when they are requested. And not before that. https://github.com/FuelLabs/fuels-ts/blob/c295fdb3b74d8203532c7261bdb90c6847d60b28/packages/program/src/functions/invocation-scope.ts#L25 ```ts // `FunctionInvocationScope` constructor. This line eventually calls the code that calculates the call script's data offset. super.addCall(this); // ====================================== // `BaseInvocationScope` methods protected addCall(funcScope: InvocationScopeLike) { this.addCalls([funcScope]); return this; } protected addCalls(funcScopes: Array<InvocationScopeLike>) { this.functionInvocationScopes.push(...funcScopes); this.updateScriptRequest(); this.updateRequiredCoins(); return this; } ``` I am struggling to figure out if we can isolate the script update logic from the `addCalls` function altogether, and put it into some new function called `buildTx` instead.