Generic Fixes (#1103)

* Update trade_details_page.dart * let web3dart calculate gas price and max gas while just providing the priority fee per gas needed

Omar Hatem committed Sep 29, 2023 at 01:53 UTC b1859b9e6385f3bed049c43e587880e0b05634ff
3 files changed +6 -6
cw_ethereum/lib/ethereum_client.dart
+2 -4
@@ -65,13 +65,11 @@ class EthereumClient {
65
66 bool _isEthereum = currency == CryptoCurrency.eth;
67
68 - final price = await _client!.getGasPrice();
68 + final price = _client!.getGasPrice();
69
70 final Transaction transaction = Transaction(
71 from: privateKey.address,
72 to: EthereumAddress.fromHex(toAddress),
73 - maxGas: gas,
74 - gasPrice: price,
73 maxPriorityFeePerGas: EtherAmount.fromInt(EtherUnit.gwei, priority.tip),
74 value: _isEthereum ? EtherAmount.inWei(BigInt.parse(amount)) : EtherAmount.zero(),
75 );
@@ -101,7 +99,7 @@ class EthereumClient {
99 return PendingEthereumTransaction(
100 signedTransaction: signedTransaction,
101 amount: amount,
104 - fee: BigInt.from(gas) * price.getInWei,
102 + fee: BigInt.from(gas) * (await price).getInWei,
103 sendTransaction: _sendTransaction,
104 exponent: exponent,
105 );
lib/src/screens/trade_details/trade_details_page.dart
+3 -2
@@ -51,10 +51,11 @@ class TradeDetailsPageBodyState extends State<TradeDetailsPageBody> {
51 @override
52 Widget build(BuildContext context) {
53 return Observer(builder: (_) {
54 - // FIX-ME: Added `context` it was not used here before, maby bug ?
54 + int itemsCount = tradeDetailsViewModel.items.length;
55 +
56 return SectionStandardList(
57 sectionCount: 1,
57 - itemCounter: (int _) => tradeDetailsViewModel.items.length,
58 + itemCounter: (int _) => itemsCount,
59 itemBuilder: (__, index) {
60 final item = tradeDetailsViewModel.items[index];
61
lib/utils/exception_handler.dart
+1
@@ -161,6 +161,7 @@ class ExceptionHandler {
161 "Handshake error in client",
162 "Error while launching http",
163 "OS Error: Network is unreachable",
164 + "ClientException: Write failed, uri=https:",
165 ];
166
167 static Future<void> _addDeviceInfo(File file) async {