Skip to main content

Contract proxy class

When interacting with smart contracts in Unity, the contract proxy class is responsible for performing:

  • Transaction serialization
  • Transaction execution
  • Transaction result deserialization

The contract proxy class is also responsible for invoking the provider and attempts to support both asynchronous and synchronous provider objects.

Since the proxy class is responsible for a lot, some parts of the class may be decoupled into their own components. For example, transaction serialization and deserialization is not very customizable and will likely be moved into its own component to allow more extendability.

important

The contract proxy class should be considered an internal and unstable API. You should never need to inherit the Contract class, unless you're using the backed type contract factory. However, the contract code generator already generates these classes for you.

You only need to use Contract.Attach<T>(string address, IProvider provider).