You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
forc build adds doc-comment attributes to the generated abi whenever a function has doc comments on it. We can add those comments on typegen-generated functions in the form of multi-line comments.
Below is an example of a sway contract function and its related abi.
/// Verifies that a newly deployed contract is the child of a contract factory and registers it. /// /// # Additional Information /// /// This example does not check whether a contract has already been registered and will overwrite any values. /// /// # Arguments /// /// * `child_contract`: [ContractId] - The deployed factory child contract of which to verify the bytecode root. /// * `configurables`: [Option<ContractConfigurables>] - The configurables value set for the `child_contract`. /// /// # Returns /// /// * [Result<BytecodeRoot, str>] - Either the bytecode root of the newly registered contract or a `str` error message. /// /// # Number of Storage Accesses /// /// * Writes: `2` /// /// # Examples /// /// ```sway /// use src12::SRC12; /// /// fn foo(my_src_12_contract: ContractId, my_deployed_contract: ContractId, my_configurables: Option<ContractConfigurables>) { /// let src_12_contract_abi = abi(SRC12, my_src_12_contract.bits()); /// src_12_contract_abi.register_contract(my_deployed_contract, my_configurables); /// assert(src_12_contract_abi.is_valid(my_deployed_contract)); /// } /// ```
#[storage(read, write)]
fnregister_contract(
child_contract:ContractId,
configurables:Option<ContractConfigurables>,
) ->Result<BytecodeRoot, str> { ...
forc build
addsdoc-comment
attributes to the generated abi whenever a function has doc comments on it. We can add those comments ontypegen
-generated functions in the form of multi-line comments.Below is an example of a sway contract function and its related abi.
The generated abi will be:
The text was updated successfully, but these errors were encountered: