web3.unity icon indicating copy to clipboard operation
web3.unity copied to clipboard

Refine and optimize Erc20, Erc721, Erc1155

Open oleksandrchainsafe opened this issue 1 year ago • 1 comments

Summary Refine and optimize Erc20, Erc721, Erc1155 static utility classes.

Suggested features or ways to address the summary There are two options:

  • Turn static ErcXX utility classes into services accessible through the Web3 client. This way SDK users will see intellisense suggestions when working with the web3 object, which suits well with project's ideology.
  • Extract IContract interface. Create proxies for each ErcXX type which will wrap the original Contract object and add additional methods that reside currently in static ErcXX classes. Add factory extension methods for ContractBuilder for each ErcXX type which will create corresponding proxy objects with additional methods for the specified contract address.

Motivation Both methods improve UX for the new users, as it enables an intellisense-driven learning path, and optimize the code, because that way we do not create a new Contract instance for each smart-contract interaction, but only do it once for each contract.

Acceptance Criteria

  • Erc20, Erc721, Erc1155 static utility classes removed
  • New approach introduced
  • All existing functionality is available in the new version
  • Contract instance is not getting created for each smart-contract call

oleksandrchainsafe avatar May 02 '24 10:05 oleksandrchainsafe

Great initiative!

kantagara avatar May 07 '24 12:05 kantagara