code formatting

This commit is contained in:
julian 2023-08-23 14:12:11 -06:00
parent 19a6e0b826
commit 31cac4b950

View file

@ -1,6 +1,6 @@
import 'dart:async'; import 'dart:async';
import 'package:bip39/bip39.dart' as bip39; import 'package:bip39/bip39.dart' as bip39;
import 'package:http/http.dart' as http;
import 'package:isar/isar.dart'; import 'package:isar/isar.dart';
import 'package:stackwallet/db/isar/main_db.dart'; import 'package:stackwallet/db/isar/main_db.dart';
import 'package:stackwallet/models/balance.dart' as SWBalance; import 'package:stackwallet/models/balance.dart' as SWBalance;
@ -37,7 +37,6 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
late StellarSDK stellarSdk; late StellarSDK stellarSdk;
late Network stellarNetwork; late Network stellarNetwork;
StellarWallet({ StellarWallet({
required String walletId, required String walletId,
required String walletName, required String walletName,
@ -54,7 +53,6 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
initCache(walletId, coin); initCache(walletId, coin);
initWalletDB(mockableOverride: mockableOverride); initWalletDB(mockableOverride: mockableOverride);
if (coin.isTestNet) { if (coin.isTestNet) {
stellarNetwork = Network.TESTNET; stellarNetwork = Network.TESTNET;
} else { } else {
@ -212,13 +210,12 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
} }
transaction.sign(senderKeyPair, stellarNetwork); transaction.sign(senderKeyPair, stellarNetwork);
try { try {
SubmitTransactionResponse response = SubmitTransactionResponse response = await stellarSdk
await stellarSdk.submitTransaction(transaction).onError((error, stackTrace) => throw (error.toString())); .submitTransaction(transaction)
.onError((error, stackTrace) => throw (error.toString()));
if (!response.success) { if (!response.success) {
throw ( throw ("${response.extras?.resultCodes?.transactionResultCode}"
"${response.extras?.resultCodes?.transactionResultCode}" " ::: ${response.extras?.resultCodes?.operationsResultCodes}");
" ::: ${response.extras?.resultCodes?.operationsResultCodes}"
);
} }
return response.hash!; return response.hash!;
} catch (e, s) { } catch (e, s) {
@ -248,7 +245,8 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override @override
Future<Amount> estimateFeeFor(Amount amount, int feeRate) async { Future<Amount> estimateFeeFor(Amount amount, int feeRate) async {
var baseFee = await getBaseFee(); var baseFee = await getBaseFee();
return Amount(rawValue: BigInt.from(baseFee), fractionDigits: coin.decimals); return Amount(
rawValue: BigInt.from(baseFee), fractionDigits: coin.decimals);
} }
@override @override
@ -276,7 +274,6 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
@override @override
Future<FeeObject> get fees async { Future<FeeObject> get fees async {
int fee = await getBaseFee(); int fee = await getBaseFee();
return FeeObject( return FeeObject(
numberOfBlocksFast: 10, numberOfBlocksFast: 10,
@ -402,7 +399,6 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
{required String address, {required String address,
required Amount amount, required Amount amount,
Map<String, dynamic>? args}) async { Map<String, dynamic>? args}) async {
try { try {
final feeRate = args?["feeRate"]; final feeRate = args?["feeRate"];
var fee = 1000; var fee = 1000;
@ -433,12 +429,13 @@ class StellarWallet extends CoinServiceAPI with WalletCache, WalletDB {
} }
@override @override
Future<void> recoverFromMnemonic( Future<void> recoverFromMnemonic({
{required String mnemonic, required String mnemonic,
String? mnemonicPassphrase, String? mnemonicPassphrase,
required int maxUnusedAddressGap, required int maxUnusedAddressGap,
required int maxNumberOfIndexesToCheck, required int maxNumberOfIndexesToCheck,
required int height}) async { required int height,
}) async {
if ((await mnemonicString) != null || if ((await mnemonicString) != null ||
(await this.mnemonicPassphrase) != null) { (await this.mnemonicPassphrase) != null) {
throw Exception("Attempted to overwrite mnemonic on restore!"); throw Exception("Attempted to overwrite mnemonic on restore!");