sign method

TxBuilder sign(
  1. Account account
)

Implementation

TxBuilder sign(Account account) {
  if (_txParam.value.isEmpty ||
      _txParam.gasPrice.isEmpty ||
      _txParam.gasLimit.isNegative ||
      _txParam.to.isEmpty) {
    throw Exception(ErrorCode.invalidTxParam);
  }

  // chainId validation: chainId of wallet must match the one in txParam
  if (account.wallet.networkParam.chainId != _txParam.chainId) {
    throw Exception(ErrorCode.invalidWallet);
  }

  _signedTx = account.signTransaction(_txParam);
  return this;
}