SmartWallet constructor

SmartWallet({
  1. required String abi,
  2. required String scwAddress,
  3. dynamic provider,
  4. required EntryPointWithoutSigner entryPointContract,
  5. required bool isInitialized,
  6. required String entryPointAddress,
  7. required String ownerAddress,
  8. required int salt,
  9. required String bundlerURL,
  10. required String rpcURL,
  11. List<String>? modules,
  12. dynamic usePaymaster,
  13. dynamic batch,
  14. PaymasterConfig? paymasterConfig,
})

Implementation

SmartWallet({
  required this.abi,
  required this.scwAddress,
  provider,
  required this.entryPointContract,
  required this.isInitialized,
  required this.entryPointAddress,
  required this.ownerAddress,
  required this.salt,
  required this.bundlerURL,
  // required this.factoryAddress,
  required this.rpcURL,
  List<String>? modules,
  // required this.signer,
  usePaymaster,
  batch,
  PaymasterConfig? paymasterConfig,
  // required flutter_web3.Web3Provider web3provider,
}) {
  if (modules != null) {
    this.modules = modules;
  } else {
    this.modules = [];
  }
  this.factoryAddress = OctacoreSmartAccountFactory().contractAddress;
  if (paymasterConfig != null) {
    this.paymasterConfig = paymasterConfig;
  }
  this.usePaymaster = usePaymaster;
  if (batch != null) {
    this.batch = batch;
  } else {
    this.batch = {};
  }
  // this.web3Provider = web3provider;
  // TODO: on alreadty initialized contract verify if the proxy has same entrypoint and owner
  // check if salt provided in is_initialized false
  isVerified = true;
  initCode =
      // "0x99f3A4b303e7D7dFF4fEF658852DdEaDdB0717d484efa6ad0000000000000000000000002de11b40602f0ec6d902dc416996909458b5f83c0000000000000000000000005ff137d4b0fdcd49dca30c7cf57e578a026d2789000000000000000000000000000000000000000000000000000000000000014300000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000000";
      isInitialized
          ? "0x"
          : factoryAddress +
              _getInitCodeData(ownerAddress, entryPointAddress, this.salt);
  print(initCode);
  // this.entryPointContract = EntryPoint(signer: signer);
  // this.contract = flutter_web3.Contract(scwAddress, abi, signer);
  this.web3Client = Web3Client(rpcURL, http.Client());
  this.deployedContract = DeployedContract(
      ContractAbi.fromJson(abi, "SmartWallet"),
      EthereumAddress.fromHex(scwAddress));
}