• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

vaariance / web3-signers / #10

15 Jan 2026 03:08PM UTC coverage: 94.705% (-0.01%) from 94.715%
#10

push

code-z2
feat: Rework ABI encoding and parsing, remove EIP-7702 dependency, and update the Signer interface with sync and async methods.

194 of 205 new or added lines in 4 files covered. (94.63%)

5 existing lines in 3 files now uncovered.

948 of 1001 relevant lines covered (94.71%)

2.52 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.89
/lib/src/types/abi_types.dart
1
part of '../../web3_signers.dart';
2

3
typedef Dict = Map<String, dynamic>;
4

5
/// Represents a parameter in an ABI definition.
6
class AbiParameter {
7
  /// The name of the parameter.
8
  final String? name;
9

10
  /// The canonical type of the parameter (e.g., 'uint256', 'address', 'tuple').
11
  final String type;
12

13
  /// For tuple types, the nested parameters that make up the tuple.
14
  final List<AbiParameter>? components;
15

16
  /// The original type name from Solidity, if applicable (e.g., 'struct MyStruct').
17
  final String? internalType;
18

19
  const AbiParameter({
1✔
20
    this.name,
21
    required this.type,
22
    this.components,
23
    this.internalType,
24
  });
25

26
  Dict toJson() {
1✔
27
    return {
1✔
28
      if (name != null) 'name': name,
3✔
29
      'type': type,
2✔
30
      if (components != null)
1✔
NEW
31
        'components': components!.map((c) => c.toJson()).toList(),
×
32
      if (internalType != null) 'internalType': internalType,
1✔
33
    };
34
  }
35

36
  factory AbiParameter.fromJson(Dict json) {
1✔
37
    return AbiParameter(
1✔
38
      name: json['name'] as String?,
1✔
39
      type: json['type'] as String,
1✔
40
      components:
41
          (json['components'] as List<Dict>?)
1✔
42
              ?.map((e) => AbiParameter.fromJson(e))
3✔
43
              .toList(),
1✔
44
      internalType: json['internalType'] as String?,
1✔
45
    );
46
  }
47

48
  /// Returns the canonical type string for this parameter.
49
  ///
50
  /// For tuples, this includes the types of all components recursively.
51
  String get canonicalType {
1✔
52
    if (components == null || components!.isEmpty) {
3✔
53
      return type;
1✔
54
    }
55

56
    final arraySuffix = type.startsWith('tuple') ? type.substring(5) : '';
4✔
57
    final componentTypes = components!.map((c) => c.canonicalType).join(',');
5✔
58
    return 'tuple($componentTypes)$arraySuffix';
1✔
59
  }
60

NEW
61
  @override
×
62
  String toString() =>
NEW
63
      'AbiParameter(name: $name, type: $type, components: $components)';
×
64
}
65

66
/// Represents a function, event, or error definition in the ABI.
67
class AbiItem {
68
  final String? name;
69
  final String type;
70
  final List<AbiParameter> inputs;
71
  final List<AbiParameter> outputs;
72
  final String stateMutability;
73

74
  const AbiItem({
1✔
75
    this.name,
76
    required this.type,
77
    this.inputs = const [],
78
    this.outputs = const [],
79
    this.stateMutability = 'nonpayable',
80
  });
81

82
  Dict toJson() {
1✔
83
    return {
1✔
84
      'type': type,
2✔
85
      if (name != null) 'name': name,
3✔
86
      'inputs': inputs.map((i) => i.toJson()).toList(),
6✔
87
      'outputs': outputs.map((o) => o.toJson()).toList(),
6✔
88
      'stateMutability': stateMutability,
2✔
89
    };
90
  }
91

92
  @override
1✔
93
  String toString() =>
1✔
94
      'AbiItem(name: $name, type: $type, inputs: $inputs, outputs: $outputs, state: $stateMutability)';
1✔
95
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc