connect method

Contract connect(
  1. dynamic providerOrSigner
)

Returns a new instance of the Contract, but connected to Provider or Signer.

By passing in a Provider, this will return a downgraded Contract which only has read-only access (i.e. constant calls).

By passing in a Signer. this will return a Contract which will act on behalf of that signer.

Implementation

Contract connect(dynamic providerOrSigner) {
  assert(
    providerOrSigner is Web3Provider ||
        providerOrSigner is JsonRpcProvider ||
        providerOrSigner is Provider ||
        providerOrSigner is Signer,
    'providerOrSigner must be Provider or Signer',
  );

  return Contract._(impl.connect((providerOrSigner as Interop).impl));
}