mint method
Mint tokens to address.
amount must be a string in base units
(contract decimals, e.g. 6 decimals = "1000000" for 1 token).
Implementation
Future<Map<String, dynamic>> mint({
required String address,
required String amount,
bool waitForTx = false,
}) async {
final uri = Uri.parse('$baseUrl/admin/mint');
final body = jsonEncode({
'address': address,
'amount': amount,
'waitForTx': waitForTx,
});
final res = await http.post(uri, headers: _headersJson, body: body);
if (res.statusCode != 200) {
throw Exception(
'Mint failed: status ${res.statusCode}, body: ${res.body}',
);
}
final data = jsonDecode(res.body) as Map<String, dynamic>;
return data;
}