Skip to content

Commit

Permalink
Merge pull request #38 from cypherstack/upgrades_from_stack
Browse files Browse the repository at this point in the history
Upgrades from stack
  • Loading branch information
julian-CStack authored Jun 20, 2023
2 parents b10dc4e + 8526f4c commit b520da4
Show file tree
Hide file tree
Showing 231 changed files with 13,482 additions and 14,623 deletions.
8 changes: 4 additions & 4 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@ buildscript {
ext.kotlin_version = '1.7.20'
repositories {
google()
jcenter()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:4.1.2'
classpath 'com.android.tools.build:gradle:7.3.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}

allprojects {
repositories {
google()
jcenter()
mavenCentral()
}
}

Expand All @@ -26,6 +26,6 @@ subprojects {
project.evaluationDependsOn(':app')
}

task clean(type: Delete) {
tasks.register("clean", Delete) {
delete rootProject.buildDir
}
2 changes: 1 addition & 1 deletion android/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/db/main_db.dart → lib/db/isar/main_db.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'package:stackduo/utilities/enums/coin_enum.dart';
import 'package:stackduo/utilities/stack_file_system.dart';
import 'package:tuple/tuple.dart';

part 'queries/queries.dart';
part '../queries/queries.dart';

class MainDB {
MainDB._();
Expand Down
2 changes: 1 addition & 1 deletion lib/db/queries/queries.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
part of 'package:stackduo/db/main_db.dart';
part of 'package:stackduo/db/isar/main_db.dart';

enum CCFilter {
all,
Expand Down
7 changes: 4 additions & 3 deletions lib/electrumx_rpc/cached_electrumx.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'dart:convert';

import 'package:stackduo/db/hive/db.dart';
import 'package:stackduo/electrumx_rpc/electrumx.dart';
import 'package:stackduo/hive/db.dart';
import 'package:stackduo/utilities/enums/coin_enum.dart';
import 'package:stackduo/utilities/logger.dart';
import 'package:string_validator/string_validator.dart';
Expand Down Expand Up @@ -86,8 +86,9 @@ class CachedElectrumX {
key: groupId,
value: set);
Logging.instance.log(
"Updated currently anonymity set for ${coin.name} with group ID $groupId",
level: LogLevel.Info);
"Updated current anonymity set for ${coin.name} with group ID $groupId",
level: LogLevel.Info,
);
}

return set;
Expand Down
9 changes: 7 additions & 2 deletions lib/electrumx_rpc/electrumx.dart
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ class ElectrumX {
"JSONRPC response\n"
" command: $command\n"
" args: $args\n"
" error: $response.data",
" error: ${response.data}",
);
}

Expand Down Expand Up @@ -567,8 +567,9 @@ class ElectrumX {
bool verbose = true,
String? requestID,
}) async {
dynamic response;
try {
final response = await request(
response = await request(
requestID: requestID,
command: 'blockchain.transaction.get',
args: [
Expand All @@ -582,6 +583,10 @@ class ElectrumX {

return Map<String, dynamic>.from(response["result"] as Map);
} catch (e) {
Logging.instance.log(
"getTransaction($txHash) response: $response",
level: LogLevel.Error,
);
rethrow;
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/exceptions/sw_exception.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// generic stack wallet exception which all other custom exceptions should
// extend from

class SWException with Exception {
class SWException implements Exception {
SWException(this.message);

final String message;
Expand Down
16 changes: 12 additions & 4 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import 'package:hive_flutter/hive_flutter.dart';
import 'package:isar/isar.dart';
import 'package:keyboard_dismisser/keyboard_dismisser.dart';
import 'package:path_provider/path_provider.dart';
import 'package:stackduo/db/main_db.dart';
import 'package:stackduo/hive/db.dart';
import 'package:stackduo/db/hive/db.dart';
import 'package:stackduo/db/isar/main_db.dart';
import 'package:stackduo/models/exchange/change_now/exchange_transaction.dart';
import 'package:stackduo/models/exchange/change_now/exchange_transaction_status.dart';
import 'package:stackduo/models/exchange/response_objects/trade.dart';
Expand Down Expand Up @@ -69,7 +69,7 @@ final openedFromSWBFileStringStateProvider =
// runs the MyApp widget and checks for new users, caching the value in the
// miscellaneous box for later use
void main() async {
WidgetsBinding widgetsBinding = WidgetsFlutterBinding.ensureInitialized();
WidgetsFlutterBinding.ensureInitialized();
GoogleFonts.config.allowRuntimeFetching = false;
if (Platform.isIOS) {
Util.libraryPath = await getLibraryDirectory();
Expand Down Expand Up @@ -177,7 +177,9 @@ void main() async {
}
}

monero.onStartup();
if (!Platform.isWindows) {
monero.onStartup();
}

// SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual,
// overlays: [SystemUiOverlay.bottom]);
Expand Down Expand Up @@ -440,6 +442,12 @@ class _MaterialAppWithThemeState extends ConsumerState<MaterialAppWithTheme>
super.dispose();
}

@override
void didChangeLocales(List<Locale>? locales) {
ref.read(localeServiceChangeNotifierProvider).loadLocale();
super.didChangeLocales(locales);
}

@override
void didChangeAppLifecycleState(AppLifecycleState state) async {
debugPrint("didChangeAppLifecycleState: ${state.name}");
Expand Down
18 changes: 18 additions & 0 deletions lib/models/add_wallet_list_entity/add_wallet_list_entity.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/

import 'package:equatable/equatable.dart';
import 'package:stackduo/utilities/enums/coin_enum.dart';

abstract class AddWalletListEntity extends Equatable {
Coin get coin;
String get name;
String get ticker;
}
30 changes: 30 additions & 0 deletions lib/models/add_wallet_list_entity/sub_classes/coin_entity.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/*
* This file is part of Stack Wallet.
*
* Copyright (c) 2023 Cypher Stack
* All Rights Reserved.
* The code is distributed under GPLv3 license, see LICENSE file for details.
* Generated by Cypher Stack on 2023-05-26
*
*/

import 'package:stackduo/models/add_wallet_list_entity/add_wallet_list_entity.dart';
import 'package:stackduo/utilities/enums/coin_enum.dart';

class CoinEntity extends AddWalletListEntity {
CoinEntity(this._coin);

final Coin _coin;

@override
Coin get coin => _coin;

@override
String get name => coin.prettyName;

@override
String get ticker => coin.ticker;

@override
List<Object?> get props => [coin, name, ticker];
}
11 changes: 10 additions & 1 deletion lib/models/isar/models/blockchain_data/address.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,10 @@ enum AddressType {
cryptonote,
mimbleWimble,
unknown,
nonWallet;
nonWallet,
ethereum,
nano,
banano;

String get readableName {
switch (this) {
Expand All @@ -140,6 +143,12 @@ enum AddressType {
return "Unknown";
case AddressType.nonWallet:
return "Non wallet/unknown";
case AddressType.ethereum:
return "Ethereum";
case AddressType.nano:
return "Nano";
case AddressType.banano:
return "Banano";
}
}
}
Expand Down
6 changes: 6 additions & 0 deletions lib/models/isar/models/blockchain_data/address.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion lib/models/isar/models/blockchain_data/transaction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ part 'transaction.g.dart';

@Collection()
class Transaction {

Transaction({
required this.walletId,
required this.txid,
Expand All @@ -29,6 +30,7 @@ class Transaction {
required this.inputs,
required this.outputs,
required this.nonce,
required this.numberOfMessages,
});

Tuple2<Transaction, Address?> copyWith({
Expand All @@ -50,6 +52,7 @@ class Transaction {
int? nonce,
Id? id,
Address? address,
int? numberOfMessages,
}) {
return Tuple2(
Transaction(
Expand All @@ -68,7 +71,8 @@ class Transaction {
otherData: otherData ?? this.otherData,
nonce: nonce ?? this.nonce,
inputs: inputs ?? this.inputs,
outputs: outputs ?? this.outputs)
outputs: outputs ?? this.outputs,
numberOfMessages: numberOfMessages ?? this.numberOfMessages)
..id = id ?? this.id,
address ?? this.address.value,
);
Expand Down Expand Up @@ -114,6 +118,8 @@ class Transaction {

late final List<Output> outputs;

late final int? numberOfMessages;

@Backlink(to: "transactions")
final address = IsarLink<Address>();

Expand Down Expand Up @@ -154,6 +160,7 @@ class Transaction {
"address: ${address.value}, "
"inputsLength: ${inputs.length}, "
"outputsLength: ${outputs.length}, "
"numberOfMessages: $numberOfMessages, "
"}";

String toJsonString() {
Expand All @@ -175,6 +182,7 @@ class Transaction {
"address": address.value?.toJsonString(),
"inputs": inputs.map((e) => e.toJsonString()).toList(),
"outputs": outputs.map((e) => e.toJsonString()).toList(),
"numberOfMessages": numberOfMessages,
};
return jsonEncode(result);
}
Expand Down Expand Up @@ -205,6 +213,7 @@ class Transaction {
outputs: List<String>.from(json["outputs"] as List)
.map((e) => Output.fromJsonString(e))
.toList(),
numberOfMessages: json["numberOfMessages"] as int,
);
if (json["address"] == null) {
return Tuple2(transaction, null);
Expand Down
Loading

0 comments on commit b520da4

Please sign in to comment.