Skip to content

Commit

Permalink
🔥 Rollback "Add decimal property in toBigInt and fromBigInt method"
Browse files Browse the repository at this point in the history
  • Loading branch information
redDwarf03 committed Apr 19, 2024
1 parent 2a3016d commit b65b649
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 13 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@ Changelog
=========
=========

#### Version 3.3.14
* Rollback "Add decimal property in `toBigInt` and `fromBigInt` method" because the Blockchain will manage directly decimals

#### Version 3.3.13
* Add decimal property in `toBigInt` and `fromBigInt` method

Expand Down
6 changes: 4 additions & 2 deletions lib/src/utils/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ Uint8List concatUint8List(Iterable<Uint8List> list) =>
/// Convert any number into a big int for 10^8 decimals
/// @param {num} Number to convert
/// @param {num} Number to of decimals
int toBigInt(num? number, {int decimal = 8}) {
int toBigInt(num? number) {
const decimal = 8;
if (number == null) {
return 0;
}
Expand All @@ -53,7 +54,8 @@ int toBigInt(num? number, {int decimal = 8}) {

/// Convert big int of 10^8 decimals to any number
/// @param {int} Number to convert
num fromBigInt(int? number, {int decimal = 8}) {
num fromBigInt(int? number) {
const decimal = 8;
if (number == null) {
return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: archethic_lib_dart
description: Archethic dart library for Flutter for Node and Browser. This library aims to provide a easy way to create Archethic transaction and to send them over the network
homepage: https://github.com/archethic-foundation/libdart

version: 3.3.13
version: 3.3.14

environment:
sdk: ">=3.3.0 <4.0.0"
Expand Down
4 changes: 2 additions & 2 deletions scripts/preparePackage.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ dart pub publish

Clean dependencies (from https://pub.dev/packages/dependency_validator)
dart pub add --dev dependency_validator
flutter pub run dependency_validator
dart pub run dependency_validator
dart pub remove dependency_validator

List unused files (https://pub.dev/packages/daunused)
dart pub add --dev daunused
flutter pub run daunused:daunused.dart .
dart pub run daunused:daunused.dart .
dart pub remove daunused
8 changes: 0 additions & 8 deletions test/utils_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,6 @@ void main() {
test('should return Big Int with 8 decimals by default', () {
expect(toBigInt(12.5345), 1253450000);
});

test('should return Big Int with decimals passed in param', () {
expect(toBigInt(12.5345, decimal: 6), 12534500);
});
});

group('fromBigInt', () {
Expand All @@ -82,10 +78,6 @@ void main() {
test('should return 8 decimals number by default', () {
expect(12.5345, fromBigInt(1253450000));
});

test('should return decimals number with decimals passed in param', () {
expect(12.5345, fromBigInt(12534500, decimal: 6));
});
});

group('toByteArray', () {
Expand Down

0 comments on commit b65b649

Please sign in to comment.