Skip to content

Commit

Permalink
⚡️ Make parsable big number string as covariant of Fixed classes (#88)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexV525 authored Dec 20, 2024
1 parent cbb670e commit 69cd117
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@ that can be found in the LICENSE file. -->

# Changelog

## 1.0.0-dev.32

- Make parsable big number string as covariant of Fixed classes.

## 1.0.0-dev.31

- Treat parsable big number string as a covariant of the `Nat` class.
Expand Down
2 changes: 1 addition & 1 deletion packages/agent_dart/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: agent_dart
version: 1.0.0-dev.31
version: 1.0.0-dev.32

description: |
An agent library built for Internet Computer,
Expand Down
8 changes: 8 additions & 0 deletions packages/agent_dart_base/lib/candid/idl.dart
Original file line number Diff line number Diff line change
Expand Up @@ -636,6 +636,9 @@ class FixedIntClass extends PrimitiveType {
} else if (x is int) {
final v = BigInt.from(x);
return v >= min && v <= max;
} else if (x is String && BigInt.tryParse(x) != null) {
final v = BigInt.parse(x);
return v >= min && v <= max;
} else {
return false;
}
Expand Down Expand Up @@ -696,6 +699,11 @@ class FixedNatClass extends PrimitiveType<dynamic> {
} else if (x is int && x >= 0) {
final v = BigInt.from(x);
return v < max;
} else if (x is String &&
BigInt.tryParse(x) != null &&
BigInt.parse(x) >= BigInt.zero) {
final v = BigInt.parse(x);
return v < max;
} else {
return false;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/agent_dart_base/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: agent_dart_base
version: 1.0.0-dev.31
version: 1.0.0-dev.32

description: The Dart plugin that bridges Rust implementation for agent_dart.
repository: https://github.com/AstroxNetwork/agent_dart
Expand Down
2 changes: 1 addition & 1 deletion packages/agent_dart_ffi/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: agent_dart_ffi
version: 1.0.0-dev.31
version: 1.0.0-dev.32

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

0 comments on commit 69cd117

Please sign in to comment.