mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-10 12:44:31 +00:00
Merge branch 'stellar' into tor
This commit is contained in:
commit
2a472491a6
4 changed files with 31 additions and 6 deletions
|
@ -19,6 +19,9 @@ class Stellar extends Bip39Currency {
|
||||||
@override
|
@override
|
||||||
int get minConfirms => 1;
|
int get minConfirms => 1;
|
||||||
|
|
||||||
|
@override
|
||||||
|
bool get torSupport => true;
|
||||||
|
|
||||||
@override
|
@override
|
||||||
String get genesisHash => throw UnimplementedError(
|
String get genesisHash => throw UnimplementedError(
|
||||||
"Not used for stellar",
|
"Not used for stellar",
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
import 'dart:async';
|
import 'dart:async';
|
||||||
import 'dart:convert';
|
import 'dart:convert';
|
||||||
|
import 'dart:io';
|
||||||
|
|
||||||
import 'package:isar/isar.dart';
|
import 'package:isar/isar.dart';
|
||||||
|
import 'package:socks5_proxy/socks.dart';
|
||||||
import 'package:stackwallet/models/balance.dart';
|
import 'package:stackwallet/models/balance.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/address.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/transaction.dart';
|
||||||
|
@ -9,6 +11,7 @@ import 'package:stackwallet/models/isar/models/blockchain_data/v2/input_v2.dart'
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/output_v2.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/v2/output_v2.dart';
|
||||||
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart';
|
import 'package:stackwallet/models/isar/models/blockchain_data/v2/transaction_v2.dart';
|
||||||
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
import 'package:stackwallet/models/paymint/fee_object_model.dart';
|
||||||
|
import 'package:stackwallet/services/tor_service.dart';
|
||||||
import 'package:stackwallet/utilities/amount/amount.dart';
|
import 'package:stackwallet/utilities/amount/amount.dart';
|
||||||
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
import 'package:stackwallet/utilities/enums/fee_rate_type_enum.dart';
|
||||||
import 'package:stackwallet/utilities/logger.dart';
|
import 'package:stackwallet/utilities/logger.dart';
|
||||||
|
@ -43,6 +46,7 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
||||||
// ============== Private ====================================================
|
// ============== Private ====================================================
|
||||||
|
|
||||||
stellar.StellarSDK? _stellarSdk;
|
stellar.StellarSDK? _stellarSdk;
|
||||||
|
HttpClient? _httpClient;
|
||||||
|
|
||||||
Future<int> _getBaseFee() async {
|
Future<int> _getBaseFee() async {
|
||||||
final fees = await stellarSdk.feeStats.execute();
|
final fees = await stellarSdk.feeStats.execute();
|
||||||
|
@ -51,7 +55,21 @@ class StellarWallet extends Bip39Wallet<Stellar> {
|
||||||
|
|
||||||
void _updateSdk() {
|
void _updateSdk() {
|
||||||
final currentNode = getCurrentNode();
|
final currentNode = getCurrentNode();
|
||||||
_stellarSdk = stellar.StellarSDK("${currentNode.host}:${currentNode.port}");
|
|
||||||
|
// TODO [prio=med]: refactor out and call before requests in case Tor is enabled/disabled, listen to prefs change, or similar.
|
||||||
|
if (prefs.useTor) {
|
||||||
|
final ({InternetAddress host, int port}) proxyInfo =
|
||||||
|
TorService.sharedInstance.getProxyInfo();
|
||||||
|
|
||||||
|
_httpClient = HttpClient();
|
||||||
|
SocksTCPClient.assignToHttpClient(
|
||||||
|
_httpClient!, [ProxySettings(proxyInfo.host, proxyInfo.port)]);
|
||||||
|
} else {
|
||||||
|
_httpClient = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
_stellarSdk = stellar.StellarSDK("${currentNode.host}:${currentNode.port}",
|
||||||
|
httpClient: _httpClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> _accountExists(String accountId) async {
|
Future<bool> _accountExists(String accountId) async {
|
||||||
|
|
|
@ -1659,10 +1659,11 @@ packages:
|
||||||
stellar_flutter_sdk:
|
stellar_flutter_sdk:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
description:
|
description:
|
||||||
name: stellar_flutter_sdk
|
path: "."
|
||||||
sha256: "4c55b1b6dfbde7f89bba59a422754280715fa3b5726cff5e7eeaed454d2c4b89"
|
ref: eca1d730e952cf6a6d64502f977cfc03876b75d4
|
||||||
url: "https://pub.dev"
|
resolved-ref: eca1d730e952cf6a6d64502f977cfc03876b75d4
|
||||||
source: hosted
|
url: "https://github.com/cypherstack/stellar_flutter_sdk.git"
|
||||||
|
source: git
|
||||||
version: "1.5.3"
|
version: "1.5.3"
|
||||||
stream_channel:
|
stream_channel:
|
||||||
dependency: "direct main"
|
dependency: "direct main"
|
||||||
|
|
|
@ -156,7 +156,10 @@ dependencies:
|
||||||
desktop_drop: ^0.4.1
|
desktop_drop: ^0.4.1
|
||||||
nanodart: ^2.0.0
|
nanodart: ^2.0.0
|
||||||
basic_utils: ^5.5.4
|
basic_utils: ^5.5.4
|
||||||
stellar_flutter_sdk: ^1.5.3
|
stellar_flutter_sdk: # ^1.5.3
|
||||||
|
git: # TODO [prio=low]: Revert to official package once Tor support is merged upstream.
|
||||||
|
url: https://github.com/cypherstack/stellar_flutter_sdk.git
|
||||||
|
ref: eca1d730e952cf6a6d64502f977cfc03876b75d4 # tor-backport branch (based on 1.5.3).
|
||||||
bip340: ^0.2.0
|
bip340: ^0.2.0
|
||||||
# tezart: ^2.0.5
|
# tezart: ^2.0.5
|
||||||
tezart:
|
tezart:
|
||||||
|
|
Loading…
Reference in a new issue