SmartWallet.init constructor
- {required Chain chain,
- required MultiSignerInterface signer,
- required BundlerProviderBase bundler,
- RPCProviderBase? jsonRpcProvider,
- EthereumAddress? address,
- String? initCode}
Initializes the SmartWallet instance and the associated Entrypoint contract.
Use this method directly when you need to interact with the entrypoint, wait for user Operation Events, or recovering an account.
chain
: The blockchain chain.signer
: required multi-signer interfacebundler
: The bundler provider.jsonRpcProvider
: The Ethereum JSON RPC provider (optional).address
: The Ethereum address (optional).initCode
: The init code (optional).
Implementation
factory SmartWallet.init(
{required Chain chain,
required MultiSignerInterface signer,
required BundlerProviderBase bundler,
RPCProviderBase? jsonRpcProvider,
EthereumAddress? address,
String? initCode}) {
final instance = SmartWallet(
chain: chain,
signer: signer,
bundler: bundler,
jsonRpcProvider: jsonRpcProvider,
address: address);
instance
..dangerouslySetInitCode(initCode)
..plugin<BundlerProviderBase>('bundler')
.initializeWithEntrypoint(Entrypoint(
address: chain.entrypoint,
client: instance.plugin<_AccountFactory>('factory').client,
));
return instance;
}