Eip712TypedData.fromJson constructor
Eip712TypedData.fromJson(
- Map<
String, dynamic> json, { - EIP712Version version = EIP712Version.v4,
Implementation
factory Eip712TypedData.fromJson(
Map<String, dynamic> json, {
EIP712Version version = EIP712Version.v4,
}) {
try {
final jsonTypes = Map<String, List<dynamic>>.from(json["types"]);
final Map<String, List<Eip712TypeDetails>> types = {};
for (final i in jsonTypes.entries) {
final List values = i.value;
List<Eip712TypeDetails> eip712Types =
values.map((e) => Eip712TypeDetails.fromJson(e)).toList();
types[i.key] = eip712Types;
}
return Eip712TypedData(
types: types,
primaryType: json["primaryType"],
domain: json["domain"],
message: json["message"],
version: version);
} catch (e) {
throw const SolidityAbiException("invalid EIP712 json struct.");
}
}