Improve DX for `IdentityInput`
Author: arboleyaCreated Mar 19, 2024Updated May 13, 2025
Labelsfeat
Discussed in https://github.com/FuelLabs/fuels-ts/discussions/1844
Originally posted by Dhaiwat10 March 7, 2024 Take this Sway function signature for example:
fn new_game(player: Identity);If you try to call this function via the TS SDK, it would look something like this:
await contract.functions.new_game({ Address: { value: walletAddress });
await contract.functions.new_game({ ContractId: { value: contractId });The idea is to change it to something like:
type Identity = {address: string, contractId?: never} | {address?: never; contractId: string}
await contract.functions.new_game({ address: walletAddress });
await contract.functions.new_game({ contractId: contractId });Source: FuelLabs/fuels-ts