diff --git a/lib/src/crypto/evm/entities/abi/uniswap_v2/uniswap_v2_router.dart b/lib/src/crypto/evm/entities/abi/uniswap_v2/uniswap_v2_router.dart index 8c80342ab..33ee945d8 100644 --- a/lib/src/crypto/evm/entities/abi/uniswap_v2/uniswap_v2_router.dart +++ b/lib/src/crypto/evm/entities/abi/uniswap_v2/uniswap_v2_router.dart @@ -1291,19 +1291,17 @@ class UniswapV2Router extends InternalContract { final function = abi.getFunction("addLiquidity")!; final result = await buildTransactionForFunction( sender: sender, - function: function.addValues(values: [ - tokenA, - tokenB, - amountADesired, - amountBDesired, - amountAMin, - amountBMin, - to, - deadline, - ]), - feeInfo: EvmFeeInformation( - gasLimit: 3E5.toInt(), - gasPrice: Amount(value: 1E10.toInt().toBigInt, decimals: 18), + function: function.addValues( + values: [ + tokenA, + tokenB, + amountADesired, + amountBDesired, + amountAMin, + amountBMin, + to, + deadline, + ], ), ); return result; diff --git a/lib/src/crypto/evm/entities/contract/internal_contract.dart b/lib/src/crypto/evm/entities/contract/internal_contract.dart index 455a5c063..dd5358c8f 100644 --- a/lib/src/crypto/evm/entities/contract/internal_contract.dart +++ b/lib/src/crypto/evm/entities/contract/internal_contract.dart @@ -39,7 +39,7 @@ abstract class InternalContract { sender: sender, recipient: contractAddress, seed: seed, - feeInfo: feeInfo ?? EvmFeeInformation.zero, + feeInfo: feeInfo, data: functionData, value: value ?? BigInt.zero, accessList: accessList, @@ -69,7 +69,7 @@ abstract class InternalContract { return await rpc.buildUnsignedTransaction( sender: sender, recipient: contractAddress, - feeInfo: feeInfo ?? EvmFeeInformation.zero, + feeInfo: feeInfo, data: functionData, value: value ?? BigInt.zero, ); diff --git a/lib/src/crypto/evm/repositories/rpc/evm_client.dart b/lib/src/crypto/evm/repositories/rpc/evm_client.dart index 9caa7168d..b542ce6a6 100644 --- a/lib/src/crypto/evm/repositories/rpc/evm_client.dart +++ b/lib/src/crypto/evm/repositories/rpc/evm_client.dart @@ -284,6 +284,17 @@ base class EvmRpcClient { return gasPrice; } + Future getPriorityFee() async { + // Direct RPC call to get suggested priority fee + final response = await _call( + 'eth_maxPriorityFeePerGas', + ); + + final priorityFee = response.toBigIntOrNull; + if (priorityFee == null) throw Exception('Could not parse priority fee'); + return priorityFee; + } + /// /// Estimate Gas Fee /// diff --git a/lib/src/crypto/evm/repositories/rpc/evm_rpc_interface.dart b/lib/src/crypto/evm/repositories/rpc/evm_rpc_interface.dart index 5f8d81d94..f3f66ea51 100644 --- a/lib/src/crypto/evm/repositories/rpc/evm_rpc_interface.dart +++ b/lib/src/crypto/evm/repositories/rpc/evm_rpc_interface.dart @@ -1,11 +1,14 @@ import 'dart:async'; import 'dart:typed_data'; +import 'package:walletkit_dart/src/common/logger.dart'; import 'package:walletkit_dart/src/crypto/evm/entities/block_number.dart'; import 'package:walletkit_dart/src/crypto/evm/repositories/rpc/queued_rpc_interface.dart'; import 'package:walletkit_dart/src/domain/exceptions.dart'; import 'package:walletkit_dart/src/utils/int.dart'; import 'package:walletkit_dart/walletkit_dart.dart'; +const type2Multiplier = 1.5; + final class EvmRpcInterface { final EVMNetworkType type; final Map blockTimestampCache = {}; @@ -126,6 +129,13 @@ final class EvmRpcInterface { ); } + /// + /// Get Gas Price + /// + Future getGasPriceAmount() => getGasPrice().then( + (value) => Amount(value: value, decimals: 18), + ); + /// /// Get Transaction Count (Nonce) /// @@ -201,6 +211,61 @@ final class EvmRpcInterface { ); } + Future getPriorityFee() async { + final priorityFee = await performTask( + (client) => client.getPriorityFee(), + ); + + return Amount(value: priorityFee, decimals: 9); + } + + Future getType2GasPrice() async { + final maxFeePerGas = await getGasPriceAmount(); + final maxPriorityFeePerGas = await getPriorityFee(); + + return EvmType2GasPrice( + maxFeePerGas: + maxFeePerGas.multiplyAndCeil(type2Multiplier) + maxPriorityFeePerGas, + maxPriorityFeePerGas: maxPriorityFeePerGas, + ); + } + + Future<(int gasLimit, EvmGasPrice gasPrice)> fetchNetworkFees({ + EvmFeeInformation? existing, + required String recipient, + required String sender, + required Uint8List? data, + required BigInt? value, + }) async { + var gasLimit = existing?.gasLimit; + try { + gasLimit ??= await estimateGasLimit( + recipient: recipient, + sender: sender, + data: data, + value: value, + ); + } catch (e) { + Logger.logError(e, hint: "Gas estimation failed"); + + // Only Debug + assert(true, "Gas estimation failed"); + + gasLimit = 1E6.toInt(); + } + + final EvmGasPrice gasPrice = switch (existing?.gasPrice) { + EvmLegacyGasPrice feeInfo => feeInfo, + EvmType2GasPrice feeInfo => feeInfo, + null when type.useEIP1559 => await getType2GasPrice(), + null => EvmLegacyGasPrice( + gasPrice: await getGasPriceAmount(), + ), + }; + + return (gasLimit, gasPrice); + } + /// /// Used to create a raw Transactions /// Fetches the gasPrice and gasLimit from the network @@ -210,55 +275,28 @@ final class EvmRpcInterface { Future buildUnsignedTransaction({ required String sender, required String recipient, - required EvmFeeInformation feeInfo, + required EvmFeeInformation? feeInfo, required Uint8List? data, required BigInt? value, List? accessList, }) async { - final (gasPrice, gasLimit) = switch ((feeInfo.gasPrice, feeInfo.gasLimit)) { - (null, int gasLimit) => ( - Amount(value: await getGasPrice(), decimals: 18), - gasLimit - ), - (Amount gasPrice, null) => ( - gasPrice, - await estimateGasLimit( - recipient: recipient, - sender: sender, - data: data, - value: value, - ) - ), - _ => await estimateNetworkFees( - recipient: recipient, sender: sender, data: data, value: value), - }; + final (gasLimit, gasPrice) = await fetchNetworkFees( + recipient: recipient, + sender: sender, + data: data, + value: value, + existing: feeInfo, + ); final nonce = await performTask( (client) => client.getTransactionCount(sender), ); - if (type is ZENIQ_SMART_NETWORK) { - return RawEVMTransactionType0.unsigned( - nonce: nonce, - gasPrice: gasPrice.value, - gasLimit: gasLimit.toBI, - to: recipient, - value: value ?? BigInt.zero, - data: data ?? Uint8List(0), - ); - } - - if (feeInfo is EvmType2FeeInformation && - gasPrice.value < feeInfo.maxPriorityFeePerGas!.value) { - throw Failure("Gas price is less than max priority fee"); - } - - return switch (feeInfo) { - EvmType2FeeInformation() => RawEVMTransactionType2.unsigned( + return switch (gasPrice) { + EvmType2GasPrice fee => RawEVMTransactionType2.unsigned( nonce: nonce, - maxFeePerGas: gasPrice.value, - maxPriorityFeePerGas: - feeInfo.maxPriorityFeePerGas?.value ?? Amount.zero.value, + maxFeePerGas: fee.maxFeePerGas.value, + maxPriorityFeePerGas: fee.maxPriorityFeePerGas.value, gasLimit: gasLimit.toBI, to: recipient, value: value ?? BigInt.zero, @@ -266,10 +304,10 @@ final class EvmRpcInterface { accessList: accessList ?? [], chainId: type.chainId, ), - EvmFeeInformation() => accessList != null + EvmLegacyGasPrice fee => accessList != null ? RawEVMTransactionType1.unsigned( nonce: nonce, - gasPrice: gasPrice.value, + gasPrice: fee.gasPrice.value, gasLimit: gasLimit.toBI, to: recipient, value: value ?? BigInt.zero, @@ -279,7 +317,7 @@ final class EvmRpcInterface { ) : RawEVMTransactionType0.unsigned( nonce: nonce, - gasPrice: gasPrice.value, + gasPrice: fee.gasPrice.value, gasLimit: gasLimit.toBI, to: recipient, value: value ?? BigInt.zero, @@ -298,7 +336,7 @@ final class EvmRpcInterface { required String sender, required String recipient, required Uint8List seed, - required EvmFeeInformation feeInfo, + required EvmFeeInformation? feeInfo, required Uint8List? data, required BigInt? value, List? accessList, @@ -345,7 +383,7 @@ final class EvmRpcInterface { required String sender, required String recipient, required Uint8List seed, - required EvmFeeInformation feeInfo, + required EvmFeeInformation? feeInfo, required Uint8List? data, required BigInt? value, List? accessList, @@ -409,7 +447,7 @@ final class EvmRpcInterface { sender: sender, recipient: contractAddress, seed: seed, - feeInfo: feeInfo ?? EvmFeeInformation.zero, + feeInfo: feeInfo, data: data, value: value ?? BigInt.zero, ); @@ -477,7 +515,7 @@ final class EvmRpcInterface { function: function, sender: from, seed: seed, - feeInfo: EvmFeeInformation.zero, + feeInfo: null, ); } diff --git a/lib/src/crypto/network_type.dart b/lib/src/crypto/network_type.dart index 53e5427dd..cf7606303 100644 --- a/lib/src/crypto/network_type.dart +++ b/lib/src/crypto/network_type.dart @@ -19,12 +19,14 @@ sealed class NetworkType { sealed class EVMNetworkType extends NetworkType { final int chainId; + final bool useEIP1559; const EVMNetworkType({ required super.messagePrefix, required super.coin, required super.blockTime, required this.chainId, + this.useEIP1559 = true, }); } @@ -382,6 +384,7 @@ class ZENIQ_SMART_NETWORK extends EVMNetworkType { coin: zeniqSmart, messagePrefix: "\x19Zeniq Signed Message:\n", blockTime: 3, + useEIP1559: false, ); } @@ -394,6 +397,7 @@ class BNB_NETWORK extends EVMNetworkType { coin: binanceSmart, messagePrefix: "\x19Binance Chain Signed Message:\n", blockTime: 3, + useEIP1559: true, ); } diff --git a/lib/src/crypto/utxo/utils/send.dart b/lib/src/crypto/utxo/utils/send.dart index c7d64f0f7..f61d9ab8f 100644 --- a/lib/src/crypto/utxo/utils/send.dart +++ b/lib/src/crypto/utxo/utils/send.dart @@ -21,7 +21,7 @@ import 'package:walletkit_dart/walletkit_dart.dart'; /// RawTransaction buildUnsignedTransaction({ - required TransferIntent intent, + required TransferIntent intent, required UTXONetworkType networkType, required HDWalletPath walletPath, required Iterable txList, diff --git a/lib/src/domain/entities/fee.dart b/lib/src/domain/entities/fee.dart index 8a5693531..f04aca146 100644 --- a/lib/src/domain/entities/fee.dart +++ b/lib/src/domain/entities/fee.dart @@ -47,7 +47,19 @@ sealed class FeeInformation { } => EvmFeeInformation( gasLimit: gasLimit, - gasPrice: Amount.fromJson(gasPrice), + gasPrice: EvmLegacyGasPrice(gasPrice: Amount.fromJson(gasPrice)), + ), + { + 'gasLimit': int gasLimit, + 'maxFeePerGas': Map maxFeePerGas, + 'maxPriorityFeePerGas': Map maxPriorityFeePerGas, + } => + EvmFeeInformation( + gasLimit: gasLimit, + gasPrice: EvmType2GasPrice( + maxFeePerGas: Amount.fromJson(maxFeePerGas), + maxPriorityFeePerGas: Amount.fromJson(maxPriorityFeePerGas), + ), ), { 'feePerByte': Map feePerByte, @@ -68,30 +80,37 @@ sealed class FeeInformation { } } -final class EvmFeeInformation extends FeeInformation { +final class EvmFeeInformation extends FeeInformation { final int? gasLimit; - final Amount? gasPrice; + final T? gasPrice; const EvmFeeInformation({ - required this.gasLimit, - required this.gasPrice, + this.gasLimit, + this.gasPrice, }); - Amount get fee { - return (gasPrice ?? Amount.zero) * - Amount.convert(value: gasLimit ?? 0, decimals: 0); - } - - Json toJson() { - return { - 'gasLimit': gasLimit, - 'gasPrice': gasPrice?.toJson() ?? Amount.zero.toJson(), + Amount? get maxFee { + if (gasLimit == null) { + return null; + } + if (gasPrice == null) { + return null; + } + + return switch (gasPrice!) { + EvmLegacyGasPrice gasPrice => gasPrice.gasPrice * + Amount.convert( + value: gasLimit!, + decimals: 0, + ), + EvmType2GasPrice gasPrice => + gasPrice.maxFeePerGas * Amount.convert(value: gasLimit!, decimals: 0), }; } - EvmFeeInformation copyWith({ + EvmFeeInformation copyWith({ int? gasLimit, - Amount? gasPrice, + T? gasPrice, }) { return EvmFeeInformation( gasLimit: gasLimit ?? this.gasLimit, @@ -99,44 +118,56 @@ final class EvmFeeInformation extends FeeInformation { ); } - static EvmFeeInformation get zero { - return EvmFeeInformation(gasLimit: null, gasPrice: null); + Json toJson() { + return { + 'gasLimit': gasLimit, + ...?gasPrice?.toJson(), + }; } } -final class EvmType2FeeInformation extends EvmFeeInformation { - final Amount? maxPriorityFeePerGas; +sealed class EvmGasPrice { + const EvmGasPrice(); - const EvmType2FeeInformation({ - required super.gasLimit, - required super.gasPrice, - required this.maxPriorityFeePerGas, + Json toJson(); +} + +final class EvmLegacyGasPrice extends EvmGasPrice { + final Amount gasPrice; + + const EvmLegacyGasPrice({ + required this.gasPrice, }); - static EvmType2FeeInformation get zero { - return EvmType2FeeInformation( - gasLimit: null, - gasPrice: null, - maxPriorityFeePerGas: null, - ); + Json toJson() { + return { + 'gasPrice': gasPrice.toJson(), + }; } +} + +final class EvmType2GasPrice extends EvmGasPrice { + final Amount maxFeePerGas; + final Amount maxPriorityFeePerGas; + + const EvmType2GasPrice({ + required this.maxFeePerGas, + required this.maxPriorityFeePerGas, + }); Json toJson() { return { - 'gasLimit': gasLimit, 'maxPriorityFeePerGas': maxPriorityFeePerGas.toString(), - 'gasPrice': gasPrice?.toJson() ?? Amount.zero.toJson(), + 'maxFeePerGas': maxFeePerGas.toString(), }; } - EvmType2FeeInformation copyWith({ - int? gasLimit, - Amount? gasPrice, + EvmType2GasPrice copyWith({ + Amount? maxFeePerGas, Amount? maxPriorityFeePerGas, }) { - return EvmType2FeeInformation( - gasLimit: gasLimit ?? this.gasLimit, - gasPrice: gasPrice ?? this.gasPrice, + return EvmType2GasPrice( + maxFeePerGas: maxFeePerGas ?? this.maxFeePerGas, maxPriorityFeePerGas: maxPriorityFeePerGas ?? this.maxPriorityFeePerGas, ); } diff --git a/lib/src/domain/entities/transfer_intent.dart b/lib/src/domain/entities/transfer_intent.dart index 95780533e..ff57e5742 100644 --- a/lib/src/domain/entities/transfer_intent.dart +++ b/lib/src/domain/entities/transfer_intent.dart @@ -2,32 +2,33 @@ import 'dart:convert'; import 'dart:typed_data'; import 'package:walletkit_dart/walletkit_dart.dart'; -class TransferIntent { +class TransferIntent { final CoinEntity token; final String recipient; final Amount amount; /// If null, the fee will be calculated by the network - final T feeInfo; + final T? feeInfo; + /// For EVM represents UTF8 Data in the input field + /// For Tron and UTXO not implemented final String? memo; + + /// Is only respected for EVM Transactions final List? accessList; const TransferIntent({ required this.recipient, required this.amount, - required this.feeInfo, required this.token, required this.memo, this.accessList, + this.feeInfo, }); - bool get isType2 => feeInfo is EvmType2FeeInformation; - bool get isType1 => accessList != null; - Amount? get fee { if (feeInfo is EvmFeeInformation) { - return (feeInfo as EvmFeeInformation).fee; + return (feeInfo as EvmFeeInformation).maxFee; } if (feeInfo is TronFeeInformation) { return (feeInfo as TronFeeInformation).feeLimit; @@ -68,8 +69,9 @@ class TransferIntent { Amount? balance, }) { final newTargetValue = switch ((balance, feeInfo)) { - (Amount balance, EvmFeeInformation info) when token.isERC20 == false => - _calcTargetAmount(balance, info.fee), + (Amount balance, EvmFeeInformation info) + when token.isERC20 == false && info.maxFee != null => + _calcTargetAmount(balance, info.maxFee!), (Amount balance, TronFeeInformation info) when token.isERC20 == false => _calcTargetAmount(balance, info.feeLimit), _ => amount, @@ -81,6 +83,7 @@ class TransferIntent { feeInfo: feeInfo, token: token, memo: memo, + accessList: accessList, ); } diff --git a/lib/src/domain/entities/tx_gasFee_entity.dart b/lib/src/domain/entities/tx_gasFee_entity.dart index 03a3f124e..abeb05c06 100644 --- a/lib/src/domain/entities/tx_gasFee_entity.dart +++ b/lib/src/domain/entities/tx_gasFee_entity.dart @@ -37,11 +37,18 @@ final class EvmNetworkFees extends NetworkFees { final BigInt average; final BigInt fast; + final BigInt safePriority; + final BigInt averagePriority; + final BigInt fastPriority; + const EvmNetworkFees({ required this.lastBlock, required this.safe, required this.average, required this.fast, + required this.safePriority, + required this.averagePriority, + required this.fastPriority, }); BigInt getFeeGWEI(FeePriority feePriority) => switch (feePriority) { @@ -51,24 +58,40 @@ final class EvmNetworkFees extends NetworkFees { _ => safe, }; + BigInt getPriorityGWEI(FeePriority feePriority) => switch (feePriority) { + FeePriority.high => fastPriority, + FeePriority.medium => averagePriority, + FeePriority.low => safePriority, + _ => safePriority, + }; + Amount getFeeAmount(FeePriority feePriority) => Amount( value: getFeeGWEI(feePriority), decimals: 18, // GWEI ); + Amount getPriorityAmount(FeePriority feePriority) => Amount( + value: getPriorityGWEI(feePriority), + decimals: 18, // GWEI + ); + const EvmNetworkFees.fromBigInt({ required BigInt lastBlock, + required BigInt maxPriorityFeePerGas, }) : this( lastBlock: lastBlock, safe: lastBlock, average: lastBlock, fast: lastBlock, + safePriority: maxPriorityFeePerGas, + averagePriority: maxPriorityFeePerGas, + fastPriority: maxPriorityFeePerGas, ); factory EvmNetworkFees.fromJson(Map json) { if (json case { - // 'suggestBaseFee': String last, + 'suggestBaseFee': String last, 'SafeGasPrice': String safe, 'ProposeGasPrice': String propose, 'FastGasPrice': String fast, @@ -76,12 +99,42 @@ final class EvmNetworkFees extends NetworkFees { final safe_num = toGwei(safe); final propose_num = toGwei(propose); final fast_num = toGwei(fast); + final last_num = toGwei(last); + + final safePriority = safe_num - last_num; + final averagePriority = propose_num - last_num; + final fastPriority = fast_num - last_num; return EvmNetworkFees( - lastBlock: safe_num, + lastBlock: last_num, safe: safe_num, average: propose_num, fast: fast_num, + safePriority: safePriority, + averagePriority: averagePriority, + fastPriority: fastPriority, + ); + } + + if (json + case { + 'SafeGasPrice': String safe, + 'ProposeGasPrice': String average, + 'FastGasPrice': String fast, + }) { + final safe_num = toGwei(safe); + final last_num = safe_num; + final average_num = toGwei(average); + final fast_num = toGwei(fast); + + return EvmNetworkFees( + lastBlock: last_num, + safe: safe_num, + average: average_num, + fast: fast_num, + safePriority: BigInt.zero, + averagePriority: BigInt.zero, + fastPriority: BigInt.zero, ); } diff --git a/test/no_ci/arb_test.dart b/test/no_ci/arb_test.dart index 739b50ed5..a48d0cef9 100644 --- a/test/no_ci/arb_test.dart +++ b/test/no_ci/arb_test.dart @@ -27,7 +27,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethArbitrum, memo: null, ); diff --git a/test/no_ci/ava_test.dart b/test/no_ci/ava_test.dart index f8c7a2ffc..82b3b2ee4 100644 --- a/test/no_ci/ava_test.dart +++ b/test/no_ci/ava_test.dart @@ -8,7 +8,7 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, + feeInfo: null, token: avalanche, memo: null, ); @@ -27,7 +27,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.0005, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: wrappedETH, memo: null, ); diff --git a/test/no_ci/base_test.dart b/test/no_ci/base_test.dart index 0e79e0918..48bdd904f 100644 --- a/test/no_ci/base_test.dart +++ b/test/no_ci/base_test.dart @@ -8,7 +8,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethBase, memo: null, ); diff --git a/test/no_ci/contract_test.dart b/test/no_ci/contract_test.dart index 01fa08b6f..1cfc00462 100644 --- a/test/no_ci/contract_test.dart +++ b/test/no_ci/contract_test.dart @@ -246,7 +246,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 10, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: arbitrum, memo: null, ); diff --git a/test/no_ci/moon_test.dart b/test/no_ci/moon_test.dart index f1a545678..cad1be4a0 100644 --- a/test/no_ci/moon_test.dart +++ b/test/no_ci/moon_test.dart @@ -8,7 +8,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: moonbeam, memo: null, ); @@ -27,7 +26,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.01, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: frax, memo: null, ); diff --git a/test/no_ci/op_test.dart b/test/no_ci/op_test.dart index a1b22175a..a39122913 100644 --- a/test/no_ci/op_test.dart +++ b/test/no_ci/op_test.dart @@ -9,7 +9,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: optimism, memo: null, ); @@ -27,7 +26,6 @@ void main() { final intentETH = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethOptimism, memo: null, ); diff --git a/test/no_ci/sign_evmtx_test.dart b/test/no_ci/sign_evmtx_test.dart index 91d60729b..8c4783283 100644 --- a/test/no_ci/sign_evmtx_test.dart +++ b/test/no_ci/sign_evmtx_test.dart @@ -118,7 +118,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmType2FeeInformation.zero, token: arbitrum, memo: null, ); @@ -135,12 +134,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - // feeInfo: EvmType2FeeInformation.zero, - feeInfo: EvmType2FeeInformation( - gasLimit: null, - gasPrice: null, - maxPriorityFeePerGas: Amount.convert(value: 0.0001, decimals: 9), - ), token: ethArbitrum, memo: null, ); @@ -157,7 +150,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmType2FeeInformation.zero, token: zeniqSmart, memo: null, ); @@ -174,10 +166,8 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethArbitrum, memo: null, - accessList: [], ); final hash = await arbitrumRPC.sendCoin( @@ -193,7 +183,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethArbitrum, memo: "Hello my friend", ); diff --git a/test/no_ci/wallet_test.dart b/test/no_ci/wallet_test.dart index b20ac437f..3706259ff 100644 --- a/test/no_ci/wallet_test.dart +++ b/test/no_ci/wallet_test.dart @@ -18,7 +18,6 @@ void main() { intent: TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.1, decimals: zeniqSmart.decimals), - feeInfo: EvmFeeInformation.zero, token: zeniqSmart, memo: null, ), @@ -34,7 +33,6 @@ void main() { intent: TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: avinocZSC.decimals), - feeInfo: EvmFeeInformation.zero, token: avinocZSC, memo: null, ), @@ -58,16 +56,13 @@ void main() { txs: txList, ); - final intent = TransferIntent( - recipient: reveiveAddress, - amount: Amount(value: BigInt.from(100000000), decimals: 8), - feeInfo: null, - token: zeniqCoin, - memo: null, - ); - final unsignedTx = buildUnsignedTransaction( - intent: intent, + intent: TransferIntent( + recipient: reveiveAddress, + amount: Amount(value: BigInt.from(100000000), decimals: 8), + token: zeniqCoin, + memo: null, + ), networkType: ZeniqNetwork, walletPath: bitcoinNSHDPath, txList: txList, @@ -122,16 +117,14 @@ void main() { print("Receive Address: $receive"); - final intent = TransferIntent( - recipient: receive, - amount: Amount.convert(value: 1.2, decimals: 5), - feeInfo: null, - token: ec8Coin, - memo: null, - ); - final unsignedTx = buildUnsignedTransaction( - intent: intent, + intent: TransferIntent( + recipient: receive, + amount: Amount.convert(value: 1.2, decimals: 5), + feeInfo: null, + token: ec8Coin, + memo: null, + ), networkType: EurocoinNetwork, walletPath: bitcoinNSHDPath, txList: txList, diff --git a/test/no_ci/zkSync_test.dart b/test/no_ci/zkSync_test.dart index 5aa513489..c0c192c3f 100644 --- a/test/no_ci/zkSync_test.dart +++ b/test/no_ci/zkSync_test.dart @@ -9,7 +9,6 @@ void main() { final intent = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.00004, decimals: 8), - feeInfo: EvmFeeInformation.zero, token: wbtcZKSync, memo: null, ); @@ -27,7 +26,6 @@ void main() { final intentETH = TransferIntent( recipient: arbitrumTestWallet, amount: Amount.convert(value: 0.001, decimals: 18), - feeInfo: EvmFeeInformation.zero, token: ethzkSync, memo: null, );