v4.10.0 & v1.7.0 (#1113)

* New versions

* update the new version text after macos [skip ci]

* add cake-wallet headers

* add nano/banano to getAddressFromStringPattern

* Revert "Exolix integration (#1080)"

This reverts commit 9eb6867ab9.

* fix: Bug in conditions check and clean up of repeated code in switch cases (#1117)

* update build numbers [skip ci]

---------

Co-authored-by: fosse <matt.cfosse@gmail.com>
Co-authored-by: Adegoke David <64401859+Blazebrain@users.noreply.github.com>
This commit is contained in:
Omar Hatem
2023-10-09 18:18:59 +03:00
committed by GitHub
co-authored by fosse Adegoke David
parent 5a20d342ad
commit e5408a388e
32 changed files with 146 additions and 554 deletions
+14 -4
View File
@@ -178,6 +178,11 @@ class CWNano extends Nano {
BigInt getTransactionAmountRaw(TransactionInfo transactionInfo) {
return (transactionInfo as NanoTransactionInfo).amountRaw;
}
@override
String getRepresentative(Object wallet) {
return (wallet as NanoWallet).representative;
}
}
class CWNanoUtil extends NanoUtil {
@@ -308,14 +313,19 @@ class CWNanoUtil extends NanoUtil {
/// @param raw 100000000000000000000000000000
/// @return Decimal value 1.000000000000000000000000000000
///
@override
Decimal getRawAsDecimal(String? raw, BigInt? rawPerCur) {
Decimal _getRawAsDecimal(String? raw, BigInt? rawPerCur) {
rawPerCur ??= rawPerNano;
final Decimal amount = Decimal.parse(raw.toString());
final Decimal result = (amount / Decimal.parse(rawPerCur.toString())).toDecimal();
return result;
}
@override
String getRawAsDecimalString(String? raw, BigInt? rawPerCur) {
final Decimal result = _getRawAsDecimal(raw, rawPerCur);
return result.toString();
}
@override
String truncateDecimal(Decimal input, {int digits = maxDecimalDigits}) {
Decimal bigger = input.shift(digits);
@@ -332,7 +342,7 @@ class CWNanoUtil extends NanoUtil {
@override
String getRawAsUsableString(String? raw, BigInt rawPerCur) {
final String res =
truncateDecimal(getRawAsDecimal(raw, rawPerCur), digits: maxDecimalDigits + 9);
truncateDecimal(_getRawAsDecimal(raw, rawPerCur), digits: maxDecimalDigits + 9);
if (raw == null || raw == "0" || raw == "00000000000000000000000000000000") {
return "0";
@@ -361,7 +371,7 @@ class CWNanoUtil extends NanoUtil {
@override
String getRawAccuracy(String? raw, BigInt rawPerCur) {
final String rawString = getRawAsUsableString(raw, rawPerCur);
final String rawDecimalString = getRawAsDecimal(raw, rawPerCur).toString();
final String rawDecimalString = _getRawAsDecimal(raw, rawPerCur).toString();
if (raw == null || raw.isEmpty || raw == "0") {
return "";