run method
Runs this command.
The return value is wrapped in a Future if necessary and returned by
CommandRunner.runCommand.
Implementation
@override
Future<void> run() async {
final account = accountFromArgs(globalResults);
final classHashStr = argResults?['hash'] as String?;
if (classHashStr == null) {
throw ArgumentError('Class hash is required');
}
if (!classHashStr.startsWith('0x')) {
throw ArgumentError('Class hash must start with 0x');
}
final classHash = Felt.fromHexString(classHashStr);
final contractAddress = await account.deploy(classHash: classHash);
stdout.writeln('Contract address: ${contractAddress?.toHexString()}');
}