Skip to content

Commit 69cd117

Browse files
authored
⚡️ Make parsable big number string as covariant of Fixed classes (#88)
1 parent cbb670e commit 69cd117

File tree

5 files changed

+15
-3
lines changed

5 files changed

+15
-3
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ that can be found in the LICENSE file. -->
44

55
# Changelog
66

7+
## 1.0.0-dev.32
8+
9+
- Make parsable big number string as covariant of Fixed classes.
10+
711
## 1.0.0-dev.31
812

913
- Treat parsable big number string as a covariant of the `Nat` class.

packages/agent_dart/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agent_dart
2-
version: 1.0.0-dev.31
2+
version: 1.0.0-dev.32
33

44
description: |
55
An agent library built for Internet Computer,

packages/agent_dart_base/lib/candid/idl.dart

+8
Original file line numberDiff line numberDiff line change
@@ -636,6 +636,9 @@ class FixedIntClass extends PrimitiveType {
636636
} else if (x is int) {
637637
final v = BigInt.from(x);
638638
return v >= min && v <= max;
639+
} else if (x is String && BigInt.tryParse(x) != null) {
640+
final v = BigInt.parse(x);
641+
return v >= min && v <= max;
639642
} else {
640643
return false;
641644
}
@@ -696,6 +699,11 @@ class FixedNatClass extends PrimitiveType<dynamic> {
696699
} else if (x is int && x >= 0) {
697700
final v = BigInt.from(x);
698701
return v < max;
702+
} else if (x is String &&
703+
BigInt.tryParse(x) != null &&
704+
BigInt.parse(x) >= BigInt.zero) {
705+
final v = BigInt.parse(x);
706+
return v < max;
699707
} else {
700708
return false;
701709
}

packages/agent_dart_base/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agent_dart_base
2-
version: 1.0.0-dev.31
2+
version: 1.0.0-dev.32
33

44
description: The Dart plugin that bridges Rust implementation for agent_dart.
55
repository: https://github.com/AstroxNetwork/agent_dart

packages/agent_dart_ffi/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
name: agent_dart_ffi
2-
version: 1.0.0-dev.31
2+
version: 1.0.0-dev.32
33

44
description: The FFI plugin that bridges Rust implementation for agent_dart.
55
repository: https://github.com/AstroxNetwork/agent_dart

0 commit comments

Comments
 (0)