mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-22 10:34:32 +00:00
Merge pull request #618 from cypherstack/ui-fixes
macos and eth bug fixes
This commit is contained in:
commit
6b3876adc5
12 changed files with 118 additions and 91 deletions
|
@ -1 +1 @@
|
||||||
Subproject commit 686559344a58f77732c3d0134fbf44d271a55229
|
Subproject commit f677dec0b34d3f9fe8fce2bc8ff5c508c3f3bb9a
|
|
@ -1 +1 @@
|
||||||
Subproject commit cdccef0e8dc10b7fe703b5bb9b41b59b25177e83
|
Subproject commit 9cd241b5ea142e21c01dd7639b42603281c43287
|
|
@ -1 +1 @@
|
||||||
Subproject commit c920c09df5e415bba4bbe95dd50e1f0085f040e6
|
Subproject commit 407425c9fcf7a30c81f1345246c7225bc18b5cd5
|
|
@ -46,7 +46,7 @@ class EthTokenTxExtraDTO {
|
||||||
),
|
),
|
||||||
gas: _amountFromJsonNum(map['gas']),
|
gas: _amountFromJsonNum(map['gas']),
|
||||||
gasPrice: _amountFromJsonNum(map['gasPrice']),
|
gasPrice: _amountFromJsonNum(map['gasPrice']),
|
||||||
nonce: map['nonce'] as int,
|
nonce: map['nonce'] as int?,
|
||||||
input: map['input'] as String,
|
input: map['input'] as String,
|
||||||
gasCost: _amountFromJsonNum(map['gasCost']),
|
gasCost: _amountFromJsonNum(map['gasCost']),
|
||||||
gasUsed: _amountFromJsonNum(map['gasUsed']),
|
gasUsed: _amountFromJsonNum(map['gasUsed']),
|
||||||
|
@ -63,7 +63,7 @@ class EthTokenTxExtraDTO {
|
||||||
final Amount gas;
|
final Amount gas;
|
||||||
final Amount gasPrice;
|
final Amount gasPrice;
|
||||||
final String input;
|
final String input;
|
||||||
final int nonce;
|
final int? nonce;
|
||||||
final Amount gasCost;
|
final Amount gasCost;
|
||||||
final Amount gasUsed;
|
final Amount gasUsed;
|
||||||
|
|
||||||
|
|
|
@ -127,16 +127,16 @@ class EthTxDTO {
|
||||||
map['timestamp'] = timestamp;
|
map['timestamp'] = timestamp;
|
||||||
map['from'] = from;
|
map['from'] = from;
|
||||||
map['to'] = to;
|
map['to'] = to;
|
||||||
map['value'] = value;
|
map['value'] = value.toString();
|
||||||
map['gas'] = gas;
|
map['gas'] = gas.toString();
|
||||||
map['gasPrice'] = gasPrice;
|
map['gasPrice'] = gasPrice.toString();
|
||||||
map['maxFeePerGas'] = maxFeePerGas;
|
map['maxFeePerGas'] = maxFeePerGas.toString();
|
||||||
map['maxPriorityFeePerGas'] = maxPriorityFeePerGas;
|
map['maxPriorityFeePerGas'] = maxPriorityFeePerGas.toString();
|
||||||
map['isError'] = isError;
|
map['isError'] = isError;
|
||||||
map['hasToken'] = hasToken;
|
map['hasToken'] = hasToken;
|
||||||
map['compressedTx'] = compressedTx;
|
map['compressedTx'] = compressedTx;
|
||||||
map['gasCost'] = gasCost;
|
map['gasCost'] = gasCost.toString();
|
||||||
map['gasUsed'] = gasUsed;
|
map['gasUsed'] = gasUsed.toString();
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -493,51 +493,54 @@ class _ConfirmTransactionViewState
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
if (coin == Coin.epicCash)
|
if (coin == Coin.epicCash &&
|
||||||
|
(transactionInfo["onChainNote"] as String).isNotEmpty)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (coin == Coin.epicCash)
|
if (coin == Coin.epicCash &&
|
||||||
|
(transactionInfo["onChainNote"] as String).isNotEmpty)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"On chain note",
|
"On chain note",
|
||||||
style: STextStyles.smallMed12(context),
|
style: STextStyles.smallMed12(context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4,
|
height: 4,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
transactionInfo["onChainNote"] as String,
|
transactionInfo["onChainNote"] as String,
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
if ((transactionInfo["note"] as String).isNotEmpty)
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
RoundedWhiteContainer(
|
if ((transactionInfo["note"] as String).isNotEmpty)
|
||||||
child: Column(
|
RoundedWhiteContainer(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
child: Column(
|
||||||
children: [
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
Text(
|
children: [
|
||||||
(coin == Coin.epicCash) ? "Local Note" :
|
Text(
|
||||||
"Note",
|
(coin == Coin.epicCash) ? "Local Note" : "Note",
|
||||||
style: STextStyles.smallMed12(context),
|
style: STextStyles.smallMed12(context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 4,
|
height: 4,
|
||||||
),
|
),
|
||||||
Text(
|
Text(
|
||||||
transactionInfo["note"] as String,
|
transactionInfo["note"] as String,
|
||||||
style: STextStyles.itemSubtitle12(context),
|
style: STextStyles.itemSubtitle12(context),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
),
|
||||||
),
|
),
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
if (isDesktop)
|
if (isDesktop)
|
||||||
|
|
|
@ -358,7 +358,6 @@ class _TransactionDetailsViewState
|
||||||
final currentHeight = ref.watch(walletsChangeNotifierProvider
|
final currentHeight = ref.watch(walletsChangeNotifierProvider
|
||||||
.select((value) => value.getManager(walletId).currentHeight));
|
.select((value) => value.getManager(walletId).currentHeight));
|
||||||
|
|
||||||
|
|
||||||
print("THIS TRANSACTION IS $_transaction");
|
print("THIS TRANSACTION IS $_transaction");
|
||||||
|
|
||||||
return ConditionalParent(
|
return ConditionalParent(
|
||||||
|
@ -474,7 +473,9 @@ class _TransactionDetailsViewState
|
||||||
),
|
),
|
||||||
SelectableText(
|
SelectableText(
|
||||||
_transaction.isCancelled
|
_transaction.isCancelled
|
||||||
? "Cancelled"
|
? coin == Coin.ethereum
|
||||||
|
? "Failed"
|
||||||
|
: "Cancelled"
|
||||||
: whatIsIt(
|
: whatIsIt(
|
||||||
_transaction,
|
_transaction,
|
||||||
currentHeight,
|
currentHeight,
|
||||||
|
@ -585,7 +586,9 @@ class _TransactionDetailsViewState
|
||||||
// child:
|
// child:
|
||||||
SelectableText(
|
SelectableText(
|
||||||
_transaction.isCancelled
|
_transaction.isCancelled
|
||||||
? "Cancelled"
|
? coin == Coin.ethereum
|
||||||
|
? "Failed"
|
||||||
|
: "Cancelled"
|
||||||
: whatIsIt(
|
: whatIsIt(
|
||||||
_transaction,
|
_transaction,
|
||||||
currentHeight,
|
currentHeight,
|
||||||
|
@ -781,8 +784,8 @@ class _TransactionDetailsViewState
|
||||||
isDesktop
|
isDesktop
|
||||||
? const _Divider()
|
? const _Divider()
|
||||||
: const SizedBox(
|
: const SizedBox(
|
||||||
height: 12,
|
height: 12,
|
||||||
),
|
),
|
||||||
if (coin == Coin.epicCash)
|
if (coin == Coin.epicCash)
|
||||||
RoundedWhiteContainer(
|
RoundedWhiteContainer(
|
||||||
padding: isDesktop
|
padding: isDesktop
|
||||||
|
@ -790,22 +793,22 @@ class _TransactionDetailsViewState
|
||||||
: const EdgeInsets.all(12),
|
: const EdgeInsets.all(12),
|
||||||
child: Row(
|
child: Row(
|
||||||
mainAxisAlignment:
|
mainAxisAlignment:
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
crossAxisAlignment: CrossAxisAlignment.start,
|
crossAxisAlignment: CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Expanded(
|
Expanded(
|
||||||
child: Column(
|
child: Column(
|
||||||
crossAxisAlignment:
|
crossAxisAlignment:
|
||||||
CrossAxisAlignment.start,
|
CrossAxisAlignment.start,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
"On chain note",
|
"On chain note",
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
? STextStyles
|
? STextStyles
|
||||||
.desktopTextExtraExtraSmall(
|
.desktopTextExtraExtraSmall(
|
||||||
context)
|
context)
|
||||||
: STextStyles.itemSubtitle(
|
: STextStyles.itemSubtitle(
|
||||||
context),
|
context),
|
||||||
),
|
),
|
||||||
const SizedBox(
|
const SizedBox(
|
||||||
height: 8,
|
height: 8,
|
||||||
|
@ -814,18 +817,16 @@ class _TransactionDetailsViewState
|
||||||
_transaction.otherData ?? "",
|
_transaction.otherData ?? "",
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
? STextStyles
|
? STextStyles
|
||||||
.desktopTextExtraExtraSmall(
|
.desktopTextExtraExtraSmall(
|
||||||
context)
|
context)
|
||||||
.copyWith(
|
.copyWith(
|
||||||
color: Theme.of(
|
color: Theme.of(context)
|
||||||
context)
|
.extension<
|
||||||
.extension<
|
StackColors>()!
|
||||||
StackColors>()!
|
.textDark,
|
||||||
.textDark,
|
)
|
||||||
)
|
: STextStyles.itemSubtitle12(
|
||||||
: STextStyles
|
context),
|
||||||
.itemSubtitle12(
|
|
||||||
context),
|
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
@ -854,7 +855,9 @@ class _TransactionDetailsViewState
|
||||||
MainAxisAlignment.spaceBetween,
|
MainAxisAlignment.spaceBetween,
|
||||||
children: [
|
children: [
|
||||||
Text(
|
Text(
|
||||||
(coin == Coin.epicCash) ? "Local Note" : "Note ",
|
(coin == Coin.epicCash)
|
||||||
|
? "Local Note"
|
||||||
|
: "Note ",
|
||||||
style: isDesktop
|
style: isDesktop
|
||||||
? STextStyles
|
? STextStyles
|
||||||
.desktopTextExtraExtraSmall(
|
.desktopTextExtraExtraSmall(
|
||||||
|
@ -923,7 +926,9 @@ class _TransactionDetailsViewState
|
||||||
notesServiceChangeNotifierProvider(
|
notesServiceChangeNotifierProvider(
|
||||||
walletId)
|
walletId)
|
||||||
.select((value) => value.getNoteFor(
|
.select((value) => value.getNoteFor(
|
||||||
txid: (coin == Coin.epicCash)? _transaction.slateId! : _transaction.txid ))),
|
txid: (coin == Coin.epicCash)
|
||||||
|
? _transaction.slateId!
|
||||||
|
: _transaction.txid))),
|
||||||
builder: (builderContext,
|
builder: (builderContext,
|
||||||
AsyncSnapshot<String> snapshot) {
|
AsyncSnapshot<String> snapshot) {
|
||||||
if (snapshot.connectionState ==
|
if (snapshot.connectionState ==
|
||||||
|
|
|
@ -1023,6 +1023,7 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
final response = await EthereumAPI.getEthTransactions(
|
final response = await EthereumAPI.getEthTransactions(
|
||||||
address: thisAddress,
|
address: thisAddress,
|
||||||
firstBlock: isRescan ? 0 : firstBlock,
|
firstBlock: isRescan ? 0 : firstBlock,
|
||||||
|
includeTokens: true,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (response.value == null) {
|
if (response.value == null) {
|
||||||
|
@ -1057,8 +1058,10 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
|
||||||
txFailed = true;
|
txFailed = true;
|
||||||
}
|
}
|
||||||
isIncoming = false;
|
isIncoming = false;
|
||||||
} else {
|
} else if (checksumEthereumAddress(element.to) == thisAddress) {
|
||||||
isIncoming = true;
|
isIncoming = true;
|
||||||
|
} else {
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//Calculate fees (GasLimit * gasPrice)
|
//Calculate fees (GasLimit * gasPrice)
|
||||||
|
|
|
@ -50,6 +50,7 @@ abstract class EthereumAPI {
|
||||||
static Future<EthereumResponse<List<EthTxDTO>>> getEthTransactions({
|
static Future<EthereumResponse<List<EthTxDTO>>> getEthTransactions({
|
||||||
required String address,
|
required String address,
|
||||||
int firstBlock = 0,
|
int firstBlock = 0,
|
||||||
|
bool includeTokens = false,
|
||||||
}) async {
|
}) async {
|
||||||
try {
|
try {
|
||||||
final response = await get(
|
final response = await get(
|
||||||
|
@ -67,7 +68,7 @@ abstract class EthereumAPI {
|
||||||
for (final map in list!) {
|
for (final map in list!) {
|
||||||
final txn = EthTxDTO.fromMap(Map<String, dynamic>.from(map as Map));
|
final txn = EthTxDTO.fromMap(Map<String, dynamic>.from(map as Map));
|
||||||
|
|
||||||
if (txn.hasToken == 0) {
|
if (txn.hasToken == 0 || includeTokens) {
|
||||||
txns.add(txn);
|
txns.add(txn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -76,9 +77,11 @@ abstract class EthereumAPI {
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
// nice that the api returns an empty body instead of being
|
||||||
"getEthTransactions($address) response is empty but status code is "
|
// consistent and returning a json object with no transactions
|
||||||
"${response.statusCode}",
|
return EthereumResponse(
|
||||||
|
[],
|
||||||
|
null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -196,9 +199,11 @@ abstract class EthereumAPI {
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
// nice that the api returns an empty body instead of being
|
||||||
"getEthTransactionNonces($txns) response is empty but status code is "
|
// consistent and returning a json object with no transactions
|
||||||
"${response.statusCode}",
|
return EthereumResponse(
|
||||||
|
[],
|
||||||
|
null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -252,13 +257,13 @@ abstract class EthereumAPI {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
throw EthApiException(
|
||||||
"getEthTransaction($txids) response is empty but status code is "
|
"getEthTokenTransactionsByTxids($txids) response is empty but status code is "
|
||||||
"${response.statusCode}",
|
"${response.statusCode}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
throw EthApiException(
|
||||||
"getEthTransaction($txids) failed with status code: "
|
"getEthTokenTransactionsByTxids($txids) failed with status code: "
|
||||||
"${response.statusCode}",
|
"${response.statusCode}",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -269,7 +274,7 @@ abstract class EthereumAPI {
|
||||||
);
|
);
|
||||||
} catch (e, s) {
|
} catch (e, s) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"getEthTransaction($txids): $e\n$s",
|
"getEthTokenTransactionsByTxids($txids): $e\n$s",
|
||||||
level: LogLevel.Error,
|
level: LogLevel.Error,
|
||||||
);
|
);
|
||||||
return EthereumResponse(
|
return EthereumResponse(
|
||||||
|
@ -307,9 +312,11 @@ abstract class EthereumAPI {
|
||||||
null,
|
null,
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
throw EthApiException(
|
// nice that the api returns an empty body instead of being
|
||||||
"getTokenTransactions($address, $tokenContractAddress) response is empty but status code is "
|
// consistent and returning a json object with no transactions
|
||||||
"${response.statusCode}",
|
return EthereumResponse(
|
||||||
|
[],
|
||||||
|
null,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -70,6 +70,11 @@ class AmountFormatter {
|
||||||
String string, {
|
String string, {
|
||||||
EthContract? ethContract,
|
EthContract? ethContract,
|
||||||
}) {
|
}) {
|
||||||
return unit.tryParse(string, locale: locale, coin: coin);
|
return unit.tryParse(
|
||||||
|
string,
|
||||||
|
locale: locale,
|
||||||
|
coin: coin,
|
||||||
|
tokenContract: ethContract,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -230,7 +230,9 @@ class _TransactionCardState extends ConsumerState<TransactionCard> {
|
||||||
fit: BoxFit.scaleDown,
|
fit: BoxFit.scaleDown,
|
||||||
child: Text(
|
child: Text(
|
||||||
_transaction.isCancelled
|
_transaction.isCancelled
|
||||||
? "Cancelled"
|
? coin == Coin.ethereum
|
||||||
|
? "Failed"
|
||||||
|
: "Cancelled"
|
||||||
: whatIsIt(
|
: whatIsIt(
|
||||||
_transaction.type,
|
_transaction.type,
|
||||||
coin,
|
coin,
|
||||||
|
|
|
@ -564,6 +564,7 @@
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
STRIP_INSTALLED_PRODUCT = NO;
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
@ -716,6 +717,7 @@
|
||||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||||
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
MACOSX_DEPLOYMENT_TARGET = 10.14;
|
||||||
MTL_ENABLE_DEBUG_INFO = NO;
|
MTL_ENABLE_DEBUG_INFO = NO;
|
||||||
|
ONLY_ACTIVE_ARCH = YES;
|
||||||
SDKROOT = macosx;
|
SDKROOT = macosx;
|
||||||
STRIP_INSTALLED_PRODUCT = NO;
|
STRIP_INSTALLED_PRODUCT = NO;
|
||||||
SWIFT_COMPILATION_MODE = wholemodule;
|
SWIFT_COMPILATION_MODE = wholemodule;
|
||||||
|
|
Loading…
Reference in a new issue