eth fixes

This commit is contained in:
julian 2023-04-11 14:25:13 -06:00
parent eae2ad1651
commit 723ec64354
3 changed files with 78 additions and 63 deletions

View file

@ -552,8 +552,20 @@ class _ConfirmTransactionViewState
String fiatAmount = "N/A";
if (externalCalls) {
final price = ref
.read(priceAnd24hChangeNotifierProvider)
final price = widget.isTokenTx
? ref
.read(
priceAnd24hChangeNotifierProvider)
.getTokenPrice(
ref
.read(tokenServiceProvider)!
.tokenContract
.address,
)
.item1
: ref
.read(
priceAnd24hChangeNotifierProvider)
.getPrice(coin)
.item1;
if (price > Decimal.zero) {
@ -883,6 +895,7 @@ class _ConfirmTransactionViewState
SizedBox(
height: isDesktop ? 23 : 12,
),
if (!widget.isTokenTx)
Padding(
padding: isDesktop
? const EdgeInsets.symmetric(
@ -918,8 +931,9 @@ class _ConfirmTransactionViewState
),
),
Builder(builder: (context) {
final coin = ref.watch(walletsChangeNotifierProvider
.select((value) => value.getManager(walletId).coin));
final coin = ref.watch(
walletsChangeNotifierProvider.select(
(value) => value.getManager(walletId).coin));
final fee = transactionInfo["fee"] is Amount
? transactionInfo["fee"] as Amount
: (transactionInfo["fee"] as int)
@ -928,7 +942,8 @@ class _ConfirmTransactionViewState
localeServiceChangeNotifierProvider
.select((value) => value.locale),
);
final amount = transactionInfo["recipientAmt"] as Amount;
final amount =
transactionInfo["recipientAmt"] as Amount;
return Text(
"${(amount + fee).localizedStringAsFixed(
locale: locale,

View file

@ -923,7 +923,7 @@ class EthereumWallet extends CoinServiceAPI with WalletCache, WalletDB {
// precision may be lost here hence the following amountString
amount: (txData["recipientAmt"] as Amount).raw.toInt(),
amountString: (txData["recipientAmt"] as Amount).toJsonString(),
fee: txData["fee"] as int,
fee: (txData["fee"] as Amount).raw.toInt(),
height: null,
isCancelled: false,
isLelantus: false,

View file

@ -449,7 +449,7 @@ abstract class EthereumAPI {
}) async {
try {
final uri = Uri.parse(
"$stackBaseServer/state?addrs=$address&parts=nonce",
"$stackBaseServer/state?addrs=$address&parts=all",
);
final response = await get(uri);
@ -469,7 +469,7 @@ abstract class EthereumAPI {
}
} else {
throw EthApiException(
"getWalletTokenBalance($address) failed with status code: "
"getAddressNonce($address) failed with status code: "
"${response.statusCode}",
);
}
@ -480,7 +480,7 @@ abstract class EthereumAPI {
);
} catch (e, s) {
Logging.instance.log(
"getWalletTokenBalance(): $e\n$s",
"getAddressNonce(): $e\n$s",
level: LogLevel.Error,
);
return EthereumResponse(