json serialize fix

This commit is contained in:
julian 2023-03-01 14:03:44 -06:00
parent 508fc48462
commit 5bf18a541a

View file

@ -46,6 +46,7 @@ class TokenBalance extends Balance {
@override @override
String toJsonIgnoreCoin() => jsonEncode({ String toJsonIgnoreCoin() => jsonEncode({
"contractAddress": contractAddress,
"decimalPlaces": decimalPlaces, "decimalPlaces": decimalPlaces,
"total": total, "total": total,
"spendable": spendable, "spendable": spendable,
@ -55,12 +56,10 @@ class TokenBalance extends Balance {
factory TokenBalance.fromJson( factory TokenBalance.fromJson(
String json, String json,
String contractAddress,
int decimalPlaces,
) { ) {
final decoded = jsonDecode(json); final decoded = jsonDecode(json);
return TokenBalance( return TokenBalance(
contractAddress: contractAddress, contractAddress: decoded["contractAddress"] as String,
decimalPlaces: decoded["decimalPlaces"] as int, decimalPlaces: decoded["decimalPlaces"] as int,
total: decoded["total"] as int, total: decoded["total"] as int,
spendable: decoded["spendable"] as int, spendable: decoded["spendable"] as int,