execute static method

Uint8List execute(
  1. EthereumAddress walletAddress,
  2. {required EthereumAddress to,
  3. EtherAmount? amount,
  4. Uint8List? innerCallData}
)

Generates the calldata for a user operation.

  • walletAddress: The address of the wallet.
  • to: The address or contract to send the transaction to.
  • amount: The amount to send.
  • innerCallData: The calldata of the inner call.

Returns the Uint8List of the calldata.

Implementation

static Uint8List execute(EthereumAddress walletAddress,
    {required EthereumAddress to,
    EtherAmount? amount,
    Uint8List? innerCallData}) {
  final params = [
    to,
    amount ?? EtherAmount.zero().getInWei,
  ];
  if (innerCallData != null && innerCallData.isNotEmpty) {
    params.add(innerCallData);
  }
  return encodeFunctionCall(
    'execute',
    walletAddress,
    ContractAbis.get('execute'),
    params,
  );
}