addTemplate method
Add a new template. @param walletTemplate The wallet template to add. @returns A Promise that resolves to a number.
Implementation
@override
Future<int> addTemplate(sdk.WalletTemplate walletTemplate) async {
final latest = await templatesStore.findFirst(_instance,
finder: Finder(sortOrders: [SortOrder("y", false)]));
final y = latest != null ? ((latest["y"]! as int) + 1) : 0;
final template = Template(
y: y, lock: walletTemplate.lockTemplate, name: walletTemplate.name);
try {
return templatesStore.add(_instance, template.toSembast);
} catch (e) {
rethrow;
}
}