getTransactionHash method

  1. @override
Future<List<int>> getTransactionHash({
  1. required ETHAddress to,
  2. BigInt? value,
  3. List<int>? data,
  4. SafeContractExecutionOpration operation = SafeContractExecutionOpration.call,
  5. BigInt? safeTxGas,
  6. BigInt? baseGas,
  7. BigInt? gasPrice,
  8. ETHAddress? gasToken,
  9. ETHAddress? refundReceiver,
  10. required BigInt nonce,
  11. required EthereumProvider provider,
})
override

"stateMutability": "view", Returns the transaction hash that must be signed by the Safe owners. Parameters:

  • to: Destination address of the Safe transaction.
  • value: Amount of native tokens (e.g., ETH) to send with the transaction.
  • data: Data payload of the Safe transaction.
  • operation: Type of operation:
  • safeTxGas: Gas limit to be used for executing the Safe transaction.
  • baseGas: Base gas cost independent of transaction execution (e.g., base transaction fee, signature verification, refund payment).
  • gasPrice: Gas price used for refund or payment calculation.
  • gasToken: Address of the token used to pay for gas (0x0 for native token such as ETH).
  • refundReceiver: Address to receive gas payment refund (0x0 means tx.origin).
  • nonce: Nonce of the Safe transaction.

Implementation

@override
Future<List<int>> getTransactionHash({
  required ETHAddress to,
  BigInt? value,
  List<int>? data,
  SafeContractExecutionOpration operation =
      SafeContractExecutionOpration.call,
  BigInt? safeTxGas,
  BigInt? baseGas,
  BigInt? gasPrice,
  ETHAddress? gasToken,
  ETHAddress? refundReceiver,
  required BigInt nonce,
  required EthereumProvider provider,
}) async {
  final List<Object> params = [
    to,
    value ?? BigInt.zero,
    data ?? <int>[],
    operation.value,
    safeTxGas ?? BigInt.zero,
    baseGas ?? BigInt.zero,
    gasPrice ?? BigInt.zero,
    gasToken ?? ETHAddress.zero,
    refundReceiver ?? ETHAddress.zero,
    nonce,
  ];
  return queryContract<List<int>>(
    functionName: SafeContractFunction.getTransactionHash,
    params: params,
    provider: provider,
  );
}