Contract constructor

Contract(
  1. String address,
  2. dynamic abi,
  3. dynamic providerOrSigner
)

Instantiate Contract object for invoking smart contract method.

Use Provider in providerOrSigner for read-only contract calls, or use Signer for read-write contract calls.

Implementation

factory Contract(String address, dynamic abi, dynamic providerOrSigner) {
  assert(
    providerOrSigner is Web3Provider ||
        providerOrSigner is JsonRpcProvider ||
        providerOrSigner is Provider ||
        providerOrSigner is Signer,
    'providerOrSigner must be Provider or Signer',
  );
  assert(
    abi is String || abi is List<String> || abi is Interface,
    'abi must be valid type',
  );
  return Contract._(
    _ContractImpl(
      address,
      abi is Interface ? abi.impl : abi,
      (providerOrSigner as Interop).impl,
    ),
  );
}