decodeBoxes static method

List<TokenBox> decodeBoxes(
  1. List boxes
)

Implementation

static List<TokenBox> decodeBoxes(List<dynamic> boxes) {
  return boxes.map((box) {
    switch (box['type']) {
      case 'PolyBox':
        return PolyBox.fromJson(box as Map<String, dynamic>);
      case 'AssetBox':
        return AssetBox.fromJson(box as Map<String, dynamic>);
      case 'ArbitBox':
        return ArbitBox.fromJson(box as Map<String, dynamic>);
      default:
        return TokenBox.fromJson(box as Map<String, dynamic>);
    }
  }).toList();
}