From 835999bf0dc2c213e70b77eeca0596436b9da15d Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Mon, 15 Jul 2024 17:00:12 +0200 Subject: [PATCH 1/5] feat: :sparkles: Replace local history with on chain history --- lib/application/balance.dart | 2 + lib/application/balance.g.dart | 74 +++++ lib/application/bridge_blockchain.dart | 22 ++ lib/application/bridge_blockchain.g.dart | 17 + lib/application/bridge_history.dart | 310 +++++++++++++++++- lib/application/bridge_history.g.dart | 18 + lib/application/bridge_token.dart | 11 + lib/application/bridge_token.g.dart | 19 ++ .../contracts/archethic_contract.dart | 3 +- .../contracts/archethic_factory.dart | 64 ++-- lib/application/contracts/evm_htlc.dart | 47 +++ lib/application/contracts/evm_lp.dart | 2 + lib/application/evm_wallet.dart | 13 +- .../bridge_tokens.repository.dart | 3 + lib/domain/repositories/features_flags.dart | 1 + .../usecases/bridge_ae_process_mixin.dart | 31 +- .../usecases/bridge_ae_to_evm.usecase.dart | 8 +- .../usecases/bridge_evm_process_mixin.dart | 8 +- .../bridge_token.repository.dart | 9 + lib/ui/util/components/env_info.dart | 36 ++ lib/ui/util/failure_message.dart | 2 +- lib/ui/views/bridge/bloc/provider.dart | 57 ++-- lib/ui/views/bridge/bloc/provider.g.dart | 4 + .../components/local_history_card.dart | 55 ++-- .../local_history/local_history_sheet.dart | 5 +- pubspec.lock | 42 +++ pubspec.yaml | 4 +- 27 files changed, 753 insertions(+), 114 deletions(-) create mode 100644 lib/ui/util/components/env_info.dart diff --git a/lib/application/balance.dart b/lib/application/balance.dart index 1f667919..85117d78 100644 --- a/lib/application/balance.dart +++ b/lib/application/balance.dart @@ -1,5 +1,7 @@ +import 'package:aebridge/application/evm_wallet.dart'; import 'package:aebridge/domain/repositories/balance.repository.dart'; import 'package:aebridge/infrastructure/balance.repository.dart'; +import 'package:archethic_lib_dart/archethic_lib_dart.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'balance.g.dart'; diff --git a/lib/application/balance.g.dart b/lib/application/balance.g.dart index 2a993114..5015d19f 100644 --- a/lib/application/balance.g.dart +++ b/lib/application/balance.g.dart @@ -22,7 +22,11 @@ final _balanceRepositoryProvider = ); typedef _BalanceRepositoryRef = AutoDisposeProviderRef; +<<<<<<< HEAD String _$getBalanceHash() => r'd29a315387d3a35a18d20e40ab033af777e8fcd1'; +======= +String _$getBalanceHash() => r'c63e51ea9d4b5ed206ffcd4bcc1a96a62e2bbb9d'; +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) /// Copied from Dart SDK class _SystemHash { @@ -60,7 +64,12 @@ class _GetBalanceFamily extends Family> { String address, String typeToken, String tokenAddress, +<<<<<<< HEAD int decimal, { +======= + ApiService? apiService, + EVMWalletProvider? evmWalletProvider, { +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) String? providerEndpoint, }) { return _GetBalanceProvider( @@ -68,7 +77,12 @@ class _GetBalanceFamily extends Family> { address, typeToken, tokenAddress, +<<<<<<< HEAD decimal, +======= + apiService, + evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ); } @@ -82,7 +96,12 @@ class _GetBalanceFamily extends Family> { provider.address, provider.typeToken, provider.tokenAddress, +<<<<<<< HEAD provider.decimal, +======= + provider.apiService, + provider.evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: provider.providerEndpoint, ); } @@ -110,7 +129,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { String address, String typeToken, String tokenAddress, +<<<<<<< HEAD int decimal, { +======= + ApiService? apiService, + EVMWalletProvider? evmWalletProvider, { +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) String? providerEndpoint, }) : this._internal( (ref) => _getBalance( @@ -119,7 +143,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address, typeToken, tokenAddress, +<<<<<<< HEAD decimal, +======= + apiService, + evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ), from: _getBalanceProvider, @@ -135,7 +164,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address: address, typeToken: typeToken, tokenAddress: tokenAddress, +<<<<<<< HEAD decimal: decimal, +======= + apiService: apiService, + evmWalletProvider: evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ); @@ -150,7 +184,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { required this.address, required this.typeToken, required this.tokenAddress, +<<<<<<< HEAD required this.decimal, +======= + required this.apiService, + required this.evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) required this.providerEndpoint, }) : super.internal(); @@ -158,7 +197,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { final String address; final String typeToken; final String tokenAddress; +<<<<<<< HEAD final int decimal; +======= + final ApiService? apiService; + final EVMWalletProvider? evmWalletProvider; +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) final String? providerEndpoint; @override @@ -178,7 +222,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address: address, typeToken: typeToken, tokenAddress: tokenAddress, +<<<<<<< HEAD decimal: decimal, +======= + apiService: apiService, + evmWalletProvider: evmWalletProvider, +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ), ); @@ -196,7 +245,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { other.address == address && other.typeToken == typeToken && other.tokenAddress == tokenAddress && +<<<<<<< HEAD other.decimal == decimal && +======= + other.apiService == apiService && + other.evmWalletProvider == evmWalletProvider && +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) other.providerEndpoint == providerEndpoint; } @@ -207,7 +261,12 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { hash = _SystemHash.combine(hash, address.hashCode); hash = _SystemHash.combine(hash, typeToken.hashCode); hash = _SystemHash.combine(hash, tokenAddress.hashCode); +<<<<<<< HEAD hash = _SystemHash.combine(hash, decimal.hashCode); +======= + hash = _SystemHash.combine(hash, apiService.hashCode); + hash = _SystemHash.combine(hash, evmWalletProvider.hashCode); +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) hash = _SystemHash.combine(hash, providerEndpoint.hashCode); return _SystemHash.finish(hash); @@ -227,8 +286,16 @@ mixin _GetBalanceRef on AutoDisposeFutureProviderRef { /// The parameter `tokenAddress` of this provider. String get tokenAddress; +<<<<<<< HEAD /// The parameter `decimal` of this provider. int get decimal; +======= + /// The parameter `apiService` of this provider. + ApiService? get apiService; + + /// The parameter `evmWalletProvider` of this provider. + EVMWalletProvider? get evmWalletProvider; +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) /// The parameter `providerEndpoint` of this provider. String? get providerEndpoint; @@ -247,7 +314,14 @@ class _GetBalanceProviderElement @override String get tokenAddress => (origin as _GetBalanceProvider).tokenAddress; @override +<<<<<<< HEAD int get decimal => (origin as _GetBalanceProvider).decimal; +======= + ApiService? get apiService => (origin as _GetBalanceProvider).apiService; + @override + EVMWalletProvider? get evmWalletProvider => + (origin as _GetBalanceProvider).evmWalletProvider; +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) @override String? get providerEndpoint => (origin as _GetBalanceProvider).providerEndpoint; diff --git a/lib/application/bridge_blockchain.dart b/lib/application/bridge_blockchain.dart index b99b3028..ef10465a 100644 --- a/lib/application/bridge_blockchain.dart +++ b/lib/application/bridge_blockchain.dart @@ -33,6 +33,27 @@ Future> _getBlockchainsList( .getBlockchainsList(blockchainsList); } +@riverpod +Future> _getBlockchainsMap( + _GetBlockchainsMapRef ref, +) async { + final blockchainsListConf = await ref + .watch(_bridgeBlockchainsRepositoryProvider) + .getBlockchainsListConf(); + final blockchainsList = ref + .watch(_bridgeBlockchainsRepositoryProvider) + .getBlockchainsList(blockchainsListConf); + + Map convertListToMap(List list) { + return { + for (final bridgeBlockchain in list) + bridgeBlockchain.chainId: bridgeBlockchain, + }; + } + + return convertListToMap(blockchainsList); +} + @riverpod Future _getBlockchainFromChainId( _GetBlockchainFromChainIdRef ref, @@ -66,6 +87,7 @@ Future _getArchethicBlockchainFromEVM( abstract class BridgeBlockchainsProviders { static final getBlockchainsList = _getBlockchainsListProvider; + static final getBlockchainsMap = _getBlockchainsMapProvider; static const getBlockchainFromChainId = _getBlockchainFromChainIdProvider; static final getBlockchainsListConf = _getBlockchainsListConfProvider; static const getArchethicBlockchainFromEVM = diff --git a/lib/application/bridge_blockchain.g.dart b/lib/application/bridge_blockchain.g.dart index 3e97137d..1244e449 100644 --- a/lib/application/bridge_blockchain.g.dart +++ b/lib/application/bridge_blockchain.g.dart @@ -60,6 +60,23 @@ final _getBlockchainsListProvider = typedef _GetBlockchainsListRef = AutoDisposeFutureProviderRef>; +String _$getBlockchainsMapHash() => r'2081916b2501a4c7be9bc579e0ba0af8d6b1463e'; + +/// See also [_getBlockchainsMap]. +@ProviderFor(_getBlockchainsMap) +final _getBlockchainsMapProvider = + AutoDisposeFutureProvider>.internal( + _getBlockchainsMap, + name: r'_getBlockchainsMapProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$getBlockchainsMapHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef _GetBlockchainsMapRef + = AutoDisposeFutureProviderRef>; String _$getBlockchainFromChainIdHash() => r'08fc37cea8574434054a2fc60238cb69d5802948'; diff --git a/lib/application/bridge_history.dart b/lib/application/bridge_history.dart index 04b84826..0c0acf5d 100644 --- a/lib/application/bridge_history.dart +++ b/lib/application/bridge_history.dart @@ -1,8 +1,22 @@ +import 'dart:developer'; + +import 'package:aebridge/application/balance.dart'; +import 'package:aebridge/application/bridge_blockchain.dart'; +import 'package:aebridge/application/bridge_token.dart'; +import 'package:aebridge/application/contracts/archethic_contract.dart'; +import 'package:aebridge/application/contracts/archethic_factory.dart'; +import 'package:aebridge/application/contracts/evm_htlc.dart'; +import 'package:aebridge/application/contracts/evm_lp.dart'; +import 'package:aebridge/application/evm_wallet.dart'; import 'package:aebridge/domain/models/bridge_history.dart'; +import 'package:aebridge/domain/models/swap.dart'; import 'package:aebridge/domain/repositories/bridge_history.repository.dart'; +import 'package:aebridge/domain/repositories/features_flags.dart'; +import 'package:aebridge/domain/usecases/bridge_ae_process_mixin.dart'; +import 'package:aebridge/infrastructure/balance.repository.dart'; import 'package:aebridge/infrastructure/bridge_history.respository.dart'; +import 'package:archethic_lib_dart/archethic_lib_dart.dart' as archethic; import 'package:riverpod_annotation/riverpod_annotation.dart'; - part 'bridge_history.g.dart'; @riverpod @@ -24,6 +38,299 @@ Future>> _fetchBridgesList( return ref.watch(_bridgeHistoryRepositoryProvider).fetchBridgesList(asc: asc); } +@riverpod +Future>> _fetchBridgesOnchainList( + _FetchBridgesOnchainListRef ref, +) async { + final bridgesOnchainList = >[]; + + final blockchainConfMap = await ref.read( + BridgeBlockchainsProviders.getBlockchainsMap.future, + ); + + final bridgeTokensPerBridgeList = await ref.read( + BridgeTokensProviders.getTokensListPerBridgeConf.future, + ); + if (bridgeTokensPerBridgeList.tokens == null) { + return []; + } + + for (final entry in bridgeTokensPerBridgeList.tokens!.entries) { + final direction = entry.key; + final bridgeTokens = entry.value; + final directionFrom = direction.split('->')[0]; + final directionTo = direction.split('->')[1]; + + var archethicProtocolFeesAddress = ''; + var archethicProtocolFeesRate = 0.0; + + var poolTargetBalance = 0.0; + + var blockchainFrom = blockchainConfMap[int.parse(directionFrom)]; + var blockchainTo = blockchainConfMap[int.parse(directionTo)]; + + if (blockchainFrom == null || blockchainTo == null) continue; + + if (FeatureFlags.fetchBridgesOnchainListWithDevEnv == false && + blockchainFrom.env == '3-devnet') continue; + + final apiService = archethic.ApiService( + blockchainFrom.isArchethic + ? blockchainFrom.providerEndpoint + : blockchainTo.providerEndpoint, + logsActivation: false, + ); + + // Charger les informations en amont + final evmWalletProvider = EVMWalletProvider(); + + final archethicProtocolInfo = await ArchethicFactory( + blockchainFrom.isArchethic + ? blockchainFrom.archethicFactoryAddress! + : blockchainTo.archethicFactoryAddress!, + ).calculateArchethicProtocolFees(apiService); + archethicProtocolFeesAddress = archethicProtocolInfo.address; + archethicProtocolFeesRate = archethicProtocolInfo.rate; + + for (final bridgeToken in bridgeTokens) { + final evmLP = EVMLP( + blockchainFrom!.isArchethic == false + ? blockchainFrom.providerEndpoint + : blockchainTo!.providerEndpoint, + ); + final swapByOwnerResult = await evmLP.getSwapsByOwner( + blockchainFrom.isArchethic == false + ? bridgeToken.poolAddressFrom + : bridgeToken.poolAddressTo, + '0x7F0F44C4EDfBB7c54501547009d32A2BC788BE79', + ); + + final swapslist = await swapByOwnerResult.map( + success: (success) async => success, + failure: (failure) async => [], + ); + + for (final swap in swapslist) { + print( + 'swap: ${swap.htlcContractAddressEVM} -> ${swap.htlcContractAddressAE} (${swap.swapProcess?.index} (0=Chargeable, 1=Signed))', + ); + + try { + // To avoid doublons + if ((blockchainFrom!.isArchethic && swap.swapProcess?.index == 1) || + (blockchainFrom.isArchethic == false && + swap.swapProcess?.index == 0)) { + double? currentStep; + double? amount; + int? timestamp; + String? recipient; + if (swap.swapProcess?.index == 0) { + // Chargeable + blockchainFrom = blockchainFrom.copyWith( + htlcAddress: swap.htlcContractAddressEVM ?? '', + ); + blockchainTo = blockchainTo!.copyWith( + htlcAddress: swap.htlcContractAddressAE ?? '', + ); + + // Get HTLC EVM Info + final htlc = EVMHTLC( + blockchainFrom.providerEndpoint, + swap.htlcContractAddressEVM!, + blockchainFrom.chainId, + ); + + final amountResult = await htlc.getAmount(); + await amountResult.map( + success: (success) async => amount, + failure: (failure) async => null, + ); + + final timestampResult = await htlc.getHTLCTimestamp(); + await timestampResult.map( + success: (success) async => timestamp, + failure: (failure) async => null, + ); + + if (swap.htlcContractAddressEVM != null && + amount == 0 && + (swap.htlcContractAddressAE == null || + swap.htlcContractAddressAE!.isEmpty)) { + currentStep = 1; + } + + if (swap.htlcContractAddressEVM != null && + amount! > 0 && + (swap.htlcContractAddressAE == null || + swap.htlcContractAddressAE!.isEmpty)) { + currentStep = 3; + } + if (swap.htlcContractAddressEVM != null && + amount! > 0 && + (swap.htlcContractAddressAE != null && + swap.htlcContractAddressAE!.isNotEmpty)) { + var statusAEHTLC = -1; + + final info = await ArchethicContract().getInfo( + apiService, + blockchainTo.htlcAddress!, + ); + statusAEHTLC = info.statusHTLC ?? -1; + + final transactionIndexResult = await apiService + .getTransactionIndex([blockchainTo.htlcAddress!]); + if (transactionIndexResult[blockchainTo.htlcAddress!] != null) { + if (transactionIndexResult[blockchainTo.htlcAddress!] == 2) { + if (statusAEHTLC != 1) { + currentStep = 6; + } else { + currentStep = 5; + } + } else { + if (transactionIndexResult[blockchainTo.htlcAddress!] == + 3) { + currentStep = 7; + } else { + currentStep = 8; + } + } + } + } + } else { + // Signed + + blockchainFrom = blockchainFrom.copyWith( + htlcAddress: swap.htlcContractAddressAE ?? '', + ); + blockchainTo = blockchainTo!.copyWith( + htlcAddress: swap.htlcContractAddressEVM ?? '', + ); + + print( + ' blockchainTo.isArchethic ${blockchainTo.isArchethic} bridgeToken.poolAddressTo ${bridgeToken.poolAddressTo} bridgeToken.typeTarget ${bridgeToken.typeTarget} blockchainTo.providerEndpoint ${blockchainTo.providerEndpoint}', + ); + poolTargetBalance = await BalanceRepositoryImpl().getBalance( + blockchainTo.isArchethic, + bridgeToken.poolAddressTo, + bridgeToken.typeTarget, + bridgeToken.tokenAddressTarget, + null, + evmWalletProvider, + providerEndpoint: blockchainTo.providerEndpoint, + ); + print('poolTargetBalance $poolTargetBalance'); + + final transactionChainResult = + await apiService.getTransactionChain( + {swap.htlcContractAddressAE!: ''}, + request: 'address validationStamp { timestamp }', + ); + + final transactionChain = + transactionChainResult[swap.htlcContractAddressAE!]; + final nbTx = transactionChain!.length; + timestamp = transactionChain[0].validationStamp!.timestamp; + + if (nbTx > 1) { + print( + 'getAEHTLCData ${transactionChain[1].address!.address!} before', + ); + final htlcData = + await ArchethicBridgeProcessMixin().getAEHTLCData( + transactionChain[1].address!.address!, + apiService, + resolveLastAddress: false, + ); + amount = htlcData.amount; + print( + 'getAEHTLCData ${transactionChain[1].address!.address!} $amount', + ); + } + + switch (nbTx) { + case 1: + if (swap.htlcContractAddressEVM == null && + swap.htlcContractAddressEVM!.isEmpty) { + currentStep = 2; + } + break; + case 2: + if (swap.htlcContractAddressEVM == null && + swap.htlcContractAddressEVM!.isEmpty) { + currentStep = 3; + } else { + currentStep = 5; + } + break; + case 3: + if (swap.htlcContractAddressEVM != null && + swap.htlcContractAddressEVM!.isNotEmpty) { + int statusAEHTLC; + final info = await ArchethicContract().getInfo( + apiService, + blockchainFrom.htlcAddress!, + ); + statusAEHTLC = info.statusHTLC ?? -1; + if (statusAEHTLC == 0) { + currentStep = 6; + } else { + currentStep = 8; + } + } + break; + } + } + + final bridgeJson = { + // Unused info + 'archethicOracleUCO': null, + 'archethicTransactionFees': 0, + 'consentDateTime': null, + 'tokenToBridgeDecimals': 8, + 'failure': currentStep != 8 + ? {'cause': 'Unknwown', 'runtimeType': 'other'} + : null, + 'processStep': 'form', + 'isTransferInProgress': false, + 'walletConfirmation': null, + 'bridgeOk': currentStep == 8, + 'changeDirectionInProgress': false, + 'secret': [], + 'tokenBridgedBalance': 0, + 'tokenToBridgeBalance': 0, + // Used info + // TODO + 'poolTargetBalance': poolTargetBalance, + 'resumeProcess': true, + 'blockchainFrom': blockchainFrom.toJson(), + 'blockchainTo': blockchainTo.toJson(), + 'tokenToBridge': bridgeToken.toJson(), + 'tokenToBridgeAmount': amount ?? 0, + // TODO + 'targetAddress': recipient, + 'currentStep': currentStep ?? 0, + 'timestampExec': + timestamp ?? DateTime.now().millisecondsSinceEpoch, + 'htlcAEAddress': swap.htlcContractAddressAE ?? '', + 'htlcEVMAddress': swap.htlcContractAddressEVM ?? '', + // TODO + 'htlcEVMTxAddress': '', + 'archethicProtocolFeesAddress': archethicProtocolFeesAddress, + 'archethicProtocolFeesRate': archethicProtocolFeesRate, + }; + bridgesOnchainList.add(bridgeJson); + await BridgeHistoryRepositoryImpl().addBridge(bridge: bridgeJson); + } + } catch (e) { + log('$e', name: 'fetchBridgesOnchainList'); + } + } + } + } + print('END'); + return bridgesOnchainList; +} + @riverpod Future _clearBridgesList(_ClearBridgesListRef ref) async { await ref.watch(_bridgeHistoryRepositoryProvider).clearBridgesList(); @@ -34,6 +341,7 @@ Future _clearBridgesList(_ClearBridgesListRef ref) async { abstract class BridgeHistoryProviders { static final fetchBridgeHistory = _fetchBridgeHistoryProvider; static const fetchBridgesList = _fetchBridgesListProvider; + static final fetchBridgesOnchainList = _fetchBridgesOnchainListProvider; static final bridgeHistoryRepository = _bridgeHistoryRepositoryProvider; static final clearBridgesList = _clearBridgesListProvider; } diff --git a/lib/application/bridge_history.g.dart b/lib/application/bridge_history.g.dart index 3176d3a2..ccb051a3 100644 --- a/lib/application/bridge_history.g.dart +++ b/lib/application/bridge_history.g.dart @@ -195,6 +195,24 @@ class _FetchBridgesListProviderElement bool get asc => (origin as _FetchBridgesListProvider).asc; } +String _$fetchBridgesOnchainListHash() => + r'82ce22aa77aba0d10eeda1312bae1772daa7edc8'; + +/// See also [_fetchBridgesOnchainList]. +@ProviderFor(_fetchBridgesOnchainList) +final _fetchBridgesOnchainListProvider = + AutoDisposeFutureProvider>>.internal( + _fetchBridgesOnchainList, + name: r'_fetchBridgesOnchainListProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$fetchBridgesOnchainListHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef _FetchBridgesOnchainListRef + = AutoDisposeFutureProviderRef>>; String _$clearBridgesListHash() => r'781a7283eb1f4ecfb88491460e5aace9fc66ecee'; /// See also [_clearBridgesList]. diff --git a/lib/application/bridge_token.dart b/lib/application/bridge_token.dart index 49adcaf8..d54ab4d2 100644 --- a/lib/application/bridge_token.dart +++ b/lib/application/bridge_token.dart @@ -1,5 +1,6 @@ /// SPDX-License-Identifier: AGPL-3.0-or-later import 'package:aebridge/domain/models/bridge_token.dart'; +import 'package:aebridge/domain/models/bridge_token_per_bridge.dart'; import 'package:aebridge/domain/repositories/bridge_tokens.repository.dart'; import 'package:aebridge/infrastructure/bridge_token.repository.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; @@ -22,6 +23,16 @@ Future> _getTokensListPerBridge( .getTokensListPerBridge(direction); } +@riverpod +Future _getTokensListPerBridgeConf( + _GetTokensListPerBridgeConfRef ref, +) async { + return ref + .watch(_bridgeTokensRepositoryProvider) + .getTokensListPerBridgeConf(); +} + abstract class BridgeTokensProviders { static const getTokensListPerBridge = _getTokensListPerBridgeProvider; + static final getTokensListPerBridgeConf = _getTokensListPerBridgeConfProvider; } diff --git a/lib/application/bridge_token.g.dart b/lib/application/bridge_token.g.dart index f66e9535..b2263dda 100644 --- a/lib/application/bridge_token.g.dart +++ b/lib/application/bridge_token.g.dart @@ -179,5 +179,24 @@ class _GetTokensListPerBridgeProviderElement @override String get direction => (origin as _GetTokensListPerBridgeProvider).direction; } + +String _$getTokensListPerBridgeConfHash() => + r'24da5aef9bea754bc43bf7ea86ffaefe29f4e429'; + +/// See also [_getTokensListPerBridgeConf]. +@ProviderFor(_getTokensListPerBridgeConf) +final _getTokensListPerBridgeConfProvider = + AutoDisposeFutureProvider.internal( + _getTokensListPerBridgeConf, + name: r'_getTokensListPerBridgeConfProvider', + debugGetCreateSourceHash: const bool.fromEnvironment('dart.vm.product') + ? null + : _$getTokensListPerBridgeConfHash, + dependencies: null, + allTransitiveDependencies: null, +); + +typedef _GetTokensListPerBridgeConfRef + = AutoDisposeFutureProviderRef; // ignore_for_file: type=lint // ignore_for_file: subtype_of_sealed_class, invalid_use_of_internal_member, invalid_use_of_visible_for_testing_member diff --git a/lib/application/contracts/archethic_contract.dart b/lib/application/contracts/archethic_contract.dart index 8a897cff..9688c6c4 100644 --- a/lib/application/contracts/archethic_contract.dart +++ b/lib/application/contracts/archethic_contract.dart @@ -196,7 +196,8 @@ class ArchethicContract // Pending if (infoHTLCResult.statusHTLC == 0) { const d = Decimal.parse; - final resultGetAEHTLCData = await getAEHTLCData(htlcAddress); + final resultGetAEHTLCData = + await getAEHTLCData(htlcAddress, apiService); final calcul = (d('0.003') / d('0.997')).toDecimal(scaleOnInfinitePrecision: 8); final estimatedProtocolFees = diff --git a/lib/application/contracts/archethic_factory.dart b/lib/application/contracts/archethic_factory.dart index 2a86d1d8..90b7d405 100644 --- a/lib/application/contracts/archethic_factory.dart +++ b/lib/application/contracts/archethic_factory.dart @@ -9,19 +9,23 @@ class ArchethicFactory { final String factoryAddress; - Future<({double rate, String address})> - calculateArchethicProtocolFees() async { + Future<({double rate, String address})> calculateArchethicProtocolFees( + ApiService apiService, + ) async { var rate = 0.0; var address = ''; - final resultArchethicProtocolFeeRate = await _getProtocolFeeRate(); + final resultArchethicProtocolFeeRate = await _getProtocolFeeRate( + apiService, + ); await resultArchethicProtocolFeeRate.map( success: (archethicProtocolFeeRate) async { rate = archethicProtocolFeeRate; }, failure: (failure) {}, ); - final resultArchethicProtocolFeeAddress = await _getProtocolAddress(); + final resultArchethicProtocolFeeAddress = + await _getProtocolAddress(apiService); await resultArchethicProtocolFeeAddress.map( success: (archethicProtocolFeeAddress) async { address = archethicProtocolFeeAddress; @@ -31,21 +35,21 @@ class ArchethicFactory { return (rate: rate, address: address); } - Future> - _getProtocolFeeRate() async { + Future> _getProtocolFeeRate( + ApiService apiService, + ) async { return aedappfm.Result.guard( () async { - final protocolFeeRate = - await aedappfm.sl.get().callSCFunction( - jsonRPCRequest: SCCallFunctionRequest( - method: 'contract_fun', - params: SCCallFunctionParams( - contract: factoryAddress.toUpperCase(), - function: 'get_protocol_fee', - args: [], - ), - ), - ); + final protocolFeeRate = await apiService.callSCFunction( + jsonRPCRequest: SCCallFunctionRequest( + method: 'contract_fun', + params: SCCallFunctionParams( + contract: factoryAddress.toUpperCase(), + function: 'get_protocol_fee', + args: [], + ), + ), + ); try { final protocolFeeRateValue = double.parse(protocolFeeRate.toString()); return protocolFeeRateValue; @@ -58,21 +62,21 @@ class ArchethicFactory { ); } - Future> - _getProtocolAddress() async { + Future> _getProtocolAddress( + ApiService apiService, + ) async { return aedappfm.Result.guard( () async { - final protocolAddress = - await aedappfm.sl.get().callSCFunction( - jsonRPCRequest: SCCallFunctionRequest( - method: 'contract_fun', - params: SCCallFunctionParams( - contract: factoryAddress.toUpperCase(), - function: 'get_protocol_fee_address', - args: [], - ), - ), - ); + final protocolAddress = await apiService.callSCFunction( + jsonRPCRequest: SCCallFunctionRequest( + method: 'contract_fun', + params: SCCallFunctionParams( + contract: factoryAddress.toUpperCase(), + function: 'get_protocol_fee_address', + args: [], + ), + ), + ); return protocolAddress.toString(); }, ); diff --git a/lib/application/contracts/evm_htlc.dart b/lib/application/contracts/evm_htlc.dart index d9534af2..e14863d6 100644 --- a/lib/application/contracts/evm_htlc.dart +++ b/lib/application/contracts/evm_htlc.dart @@ -188,6 +188,53 @@ class EVMHTLC with EVMBridgeProcessMixin, ArchethicBridgeProcessMixin { ); } + Future> getRecipient() async { + return aedappfm.Result.guard( + () async { + final contractHTLC = await getDeployedContract( + contractNameHTLCBase, + htlcContractAddressEVM, + ); + + final recipientMap = await web3Client!.call( + contract: contractHTLC, + function: contractHTLC.function('recipient'), + params: [], + ); + + return recipientMap[0] ?? ''; + }, + ); + } + + Future> getHTLCTimestamp() async { + return aedappfm.Result.guard( + () async { + final logs = await web3Client!.getLogs( + FilterOptions( + fromBlock: const BlockNum.genesis(), + toBlock: const BlockNum.current(), + address: EthereumAddress.fromHex(htlcContractAddressEVM), + ), + ); + if (logs.isNotEmpty) { + final filterEvent = logs[0]; + final blockNum = filterEvent.blockNum; + if (blockNum != null) { + final blockInformation = await web3Client!.getBlockInformation( + blockNumber: '0x${blockNum.toRadixString(16)}', + ); + if (blockInformation.timestamp != null) { + return blockInformation.timestamp!.millisecondsSinceEpoch; + } + } + } + + return null; + }, + ); + } + Future> getSymbol( String nativeCurrency, diff --git a/lib/application/contracts/evm_lp.dart b/lib/application/contracts/evm_lp.dart index fe563a17..f7eceba4 100644 --- a/lib/application/contracts/evm_lp.dart +++ b/lib/application/contracts/evm_lp.dart @@ -310,6 +310,7 @@ class EVMLP with EVMBridgeProcessMixin { String ownerAddress, ) async { return aedappfm.Result.guard(() async { + print('poolAddress: $poolAddress - ownerAddress $ownerAddress'); final swapList = []; final web3Client = Web3Client( providerEndpoint!, @@ -341,6 +342,7 @@ class EVMLP with EVMBridgeProcessMixin { ), ); } + print('swapList: $swapList'); return swapList; }); } diff --git a/lib/application/evm_wallet.dart b/lib/application/evm_wallet.dart index cf4d4aed..15fcded2 100644 --- a/lib/application/evm_wallet.dart +++ b/lib/application/evm_wallet.dart @@ -151,19 +151,21 @@ class EVMWalletProvider extends ChangeNotifier { String erc20address = '', }) async { try { - if (web3Client == null || credentials == null) { - return 0.0; - } + final client = Web3Client( + providerEndpoint, + Client(), + ); switch (typeToken) { case 'Native': final balance = - await web3Client!.getBalance(EthereumAddress.fromHex(address)); + await client.getBalance(EthereumAddress.fromHex(address)); return balance.getValueInUnit(EtherUnit.ether); case 'ERC20': case 'Wrapped': if (erc20address.isEmpty) { return 0.0; } + final client = Web3Client( providerEndpoint, Client(), @@ -219,9 +221,6 @@ class EVMWalletProvider extends ChangeNotifier { const defaultDecimal = 8; try { - if (web3Client == null || credentials == null) { - return 8; - } switch (typeToken) { case 'Native': return 18; diff --git a/lib/domain/repositories/bridge_tokens.repository.dart b/lib/domain/repositories/bridge_tokens.repository.dart index 08aeb982..b795dfb2 100644 --- a/lib/domain/repositories/bridge_tokens.repository.dart +++ b/lib/domain/repositories/bridge_tokens.repository.dart @@ -1,5 +1,8 @@ import 'package:aebridge/domain/models/bridge_token.dart'; +import 'package:aebridge/domain/models/bridge_token_per_bridge.dart'; abstract class BridgeTokensRepository { Future> getTokensListPerBridge(String? direction); + + Future getTokensListPerBridgeConf(); } diff --git a/lib/domain/repositories/features_flags.dart b/lib/domain/repositories/features_flags.dart index b310bc96..ff45adb8 100644 --- a/lib/domain/repositories/features_flags.dart +++ b/lib/domain/repositories/features_flags.dart @@ -2,4 +2,5 @@ /// Simply activate/deactivate features. class FeatureFlags { static const inMaintenance = false; + static bool fetchBridgesOnchainListWithDevEnv = false; } diff --git a/lib/domain/usecases/bridge_ae_process_mixin.dart b/lib/domain/usecases/bridge_ae_process_mixin.dart index 256b1c6e..dfd4e52a 100644 --- a/lib/domain/usecases/bridge_ae_process_mixin.dart +++ b/lib/domain/usecases/bridge_ae_process_mixin.dart @@ -15,7 +15,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; -mixin ArchethicBridgeProcessMixin { +mixin class ArchethicBridgeProcessMixin { String getAEStepLabel( BuildContext context, int step, @@ -160,20 +160,23 @@ mixin ArchethicBridgeProcessMixin { double amount, })> getAEHTLCData( String archethicHTLCAddress, - ) async { + archethic.ApiService apiService, { + bool resolveLastAddress = true, + }) async { try { - final htlcDataMap = - await aedappfm.sl.get().callSCFunction( - jsonRPCRequest: archethic.SCCallFunctionRequest( - method: 'contract_fun', - params: archethic.SCCallFunctionParams( - contract: archethicHTLCAddress, - function: 'get_htlc_data', - args: [], - ), - ), - resultMap: true, - ) as Map; + final htlcDataMap = await apiService.callSCFunction( + jsonRPCRequest: archethic.SCCallFunctionRequest( + method: 'contract_fun', + params: archethic.SCCallFunctionParams( + contract: archethicHTLCAddress, + function: 'get_htlc_data', + args: [], + resolveLast: resolveLastAddress, + ), + ), + resultMap: true, + ) as Map; + print('$archethicHTLCAddress $htlcDataMap'); return ( secretHash: SecretHash( secretHash: htlcDataMap['secret_hash'], diff --git a/lib/domain/usecases/bridge_ae_to_evm.usecase.dart b/lib/domain/usecases/bridge_ae_to_evm.usecase.dart index b246a9d5..d4cd33a2 100644 --- a/lib/domain/usecases/bridge_ae_to_evm.usecase.dart +++ b/lib/domain/usecases/bridge_ae_to_evm.usecase.dart @@ -12,6 +12,7 @@ import 'package:aebridge/domain/usecases/bridge_evm_process_mixin.dart'; import 'package:aebridge/ui/views/bridge/bloc/provider.dart'; import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart' as aedappfm; +import 'package:archethic_lib_dart/archethic_lib_dart.dart' as archethic; import 'package:flutter/material.dart'; import 'package:flutter_gen/gen_l10n/localizations.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; @@ -98,7 +99,10 @@ class BridgeArchethicToEVMUseCase try { // 3) Get Secret Hash from API await bridgeNotifier.setCurrentStep(3); - final resultGetAEHTLCData = await getAEHTLCData(htlcAEAddress); + final resultGetAEHTLCData = await getAEHTLCData( + htlcAEAddress, + aedappfm.sl.get(), + ); secretHash = resultGetAEHTLCData.secretHash; endTime = resultGetAEHTLCData.endTime; amount = resultGetAEHTLCData.amount; @@ -248,6 +252,8 @@ class BridgeArchethicToEVMUseCase htlcEVMTxAddress!, ); + await bridgeNotifier.setCurrentStep(6); + // Wait for AE HTLC Update if (await waitForManualTxConfirmation( htlcAEAddress, diff --git a/lib/domain/usecases/bridge_evm_process_mixin.dart b/lib/domain/usecases/bridge_evm_process_mixin.dart index 8cf76cd6..85fe60d9 100644 --- a/lib/domain/usecases/bridge_evm_process_mixin.dart +++ b/lib/domain/usecases/bridge_evm_process_mixin.dart @@ -209,7 +209,7 @@ mixin EVMBridgeProcessMixin { String htlcAddress, int decimal, ) async { - double? etlcAmount; + double? htlcAmount; final bridge = ref.read(BridgeFormProvider.bridgeForm); final htlc = EVMHTLC( bridge.blockchainFrom!.providerEndpoint, @@ -219,10 +219,10 @@ mixin EVMBridgeProcessMixin { final resultAmount = await htlc.getAmount(decimal); resultAmount.map( - success: (amount) => etlcAmount = amount, - failure: (failure) => etlcAmount = null, + success: (amount) => htlcAmount = amount, + failure: (failure) => htlcAmount = null, ); - return etlcAmount; + return htlcAmount; } Future revealEVMSecret( diff --git a/lib/infrastructure/bridge_token.repository.dart b/lib/infrastructure/bridge_token.repository.dart index 6a2f1861..3eb1ecb7 100644 --- a/lib/infrastructure/bridge_token.repository.dart +++ b/lib/infrastructure/bridge_token.repository.dart @@ -43,4 +43,13 @@ class BridgeTokensRepositoryImpl implements BridgeTokensRepository { return bridgeTokens; } + + @override + Future getTokensListPerBridgeConf() async { + final jsonContent = await rootBundle + .loadString('lib/domain/repositories/tokens_list_per_bridge.json'); + + final jsonData = jsonDecode(jsonContent); + return BridgeTokensPerBridge.fromJson(jsonData); + } } diff --git a/lib/ui/util/components/env_info.dart b/lib/ui/util/components/env_info.dart new file mode 100644 index 00000000..74017039 --- /dev/null +++ b/lib/ui/util/components/env_info.dart @@ -0,0 +1,36 @@ +/// SPDX-License-Identifier: AGPL-3.0-or-later +import 'package:archethic_dapp_framework_flutter/archethic_dapp_framework_flutter.dart' + as aedappfm; +import 'package:flutter/material.dart'; + +class EnvInfo extends StatelessWidget { + const EnvInfo({ + required this.env, + super.key, + }); + + final String env; + + @override + Widget build(BuildContext context) { + if (env.isEmpty) { + return const SizedBox.shrink(); + } + + return Container( + padding: const EdgeInsets.only(left: 10, right: 10), + decoration: BoxDecoration( + color: env == '1-mainnet' + ? aedappfm.ArchethicThemeBase.raspberry500 + : env == '2-testnet' + ? aedappfm.ArchethicThemeBase.blue600 + : aedappfm.ArchethicThemeBase.blue700, + borderRadius: BorderRadius.circular(10), + ), + child: SelectableText( + env.split('-')[1], + style: Theme.of(context).textTheme.labelSmall, + ), + ); + } +} diff --git a/lib/ui/util/failure_message.dart b/lib/ui/util/failure_message.dart index e76ffef7..7bf84d29 100644 --- a/lib/ui/util/failure_message.dart +++ b/lib/ui/util/failure_message.dart @@ -74,7 +74,7 @@ class FailureMessage { } if (failure is aedappfm.OtherFailure) { - return '${(failure! as aedappfm.OtherFailure).cause}'; + return (failure! as aedappfm.OtherFailure).cause.toString(); } if (failure is aedappfm.IncompatibleBrowser) { diff --git a/lib/ui/views/bridge/bloc/provider.dart b/lib/ui/views/bridge/bloc/provider.dart index d436d93f..316930c0 100644 --- a/lib/ui/views/bridge/bloc/provider.dart +++ b/lib/ui/views/bridge/bloc/provider.dart @@ -671,43 +671,46 @@ class _BridgeFormNotifier extends _$BridgeFormNotifier } return false; } - if (state.targetAddress.isEmpty) { - if (context.mounted) { - await setFailure( - aedappfm.Failure.other( - cause: AppLocalizations.of(context)!.bridgeControlTargetAddress, - ), - ); - } - return false; - } - if (state.blockchainTo!.isArchethic) { - if (archethic.Address(address: state.targetAddress).isValid() == false) { + if (state.resumeProcess == false) { + if (state.targetAddress.isEmpty) { if (context.mounted) { await setFailure( aedappfm.Failure.other( - cause: AppLocalizations.of(context)! - .bridgeControlTargetArchethicAddressValid, + cause: AppLocalizations.of(context)!.bridgeControlTargetAddress, ), ); } return false; } - } else { - try { - webthree.EthereumAddress.fromHex( - state.targetAddress, - ); - } catch (e) { - if (context.mounted) { - await setFailure( - aedappfm.Failure.other( - cause: AppLocalizations.of(context)! - .bridgeControlTargetEVMAddressValid, - ), + if (state.blockchainTo!.isArchethic) { + if (archethic.Address(address: state.targetAddress).isValid() == + false) { + if (context.mounted) { + await setFailure( + aedappfm.Failure.other( + cause: AppLocalizations.of(context)! + .bridgeControlTargetArchethicAddressValid, + ), + ); + } + return false; + } + } else { + try { + webthree.EthereumAddress.fromHex( + state.targetAddress, ); + } catch (e) { + if (context.mounted) { + await setFailure( + aedappfm.Failure.other( + cause: AppLocalizations.of(context)! + .bridgeControlTargetEVMAddressValid, + ), + ); + } + return false; } - return false; } } diff --git a/lib/ui/views/bridge/bloc/provider.g.dart b/lib/ui/views/bridge/bloc/provider.g.dart index a059498e..7570819d 100644 --- a/lib/ui/views/bridge/bloc/provider.g.dart +++ b/lib/ui/views/bridge/bloc/provider.g.dart @@ -7,7 +7,11 @@ part of 'provider.dart'; // ************************************************************************** String _$bridgeFormNotifierHash() => +<<<<<<< HEAD r'841ed749471fc1616899bb353284fc80261d2e63'; +======= + r'4e372d2d8c8164e435bc0dabd96ab18eafaff3a3'; +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) /// See also [_BridgeFormNotifier]. @ProviderFor(_BridgeFormNotifier) diff --git a/lib/ui/views/local_history/components/local_history_card.dart b/lib/ui/views/local_history/components/local_history_card.dart index 284da4fb..72bd52e2 100755 --- a/lib/ui/views/local_history/components/local_history_card.dart +++ b/lib/ui/views/local_history/components/local_history_card.dart @@ -1,6 +1,7 @@ /// SPDX-License-Identifier: AGPL-3.0-or-later import 'package:aebridge/application/contracts/archethic_contract.dart'; import 'package:aebridge/application/contracts/evm_htlc.dart'; +import 'package:aebridge/ui/util/components/env_info.dart'; import 'package:aebridge/ui/views/bridge/bloc/state.dart'; import 'package:aebridge/ui/views/local_history/components/local_history_card_direction_infos.dart'; import 'package:aebridge/ui/views/local_history/components/local_history_card_htlc_infos.dart'; @@ -154,9 +155,11 @@ class LocalHistoryCardState extends ConsumerState if (statusEVM != null && statusEVM == 2 || statusAE != null && statusAE == 2) { - setState(() { - isRefunded = true; - }); + if (mounted) { + setState(() { + isRefunded = true; + }); + } } // Archethic -> EVM @@ -167,9 +170,11 @@ class LocalHistoryCardState extends ConsumerState statusEVM == 1 && statusAE != null && statusAE == 1))) { - setState(() { - canResume = true; - }); + if (mounted) { + setState(() { + canResume = true; + }); + } } // EVM -> Archethic final htlcLockTimeOver = htlcLockTime == null || @@ -209,23 +214,9 @@ class LocalHistoryCardState extends ConsumerState Row( mainAxisAlignment: MainAxisAlignment.spaceBetween, children: [ - Text( - DateFormat.yMd( - Localizations.localeOf(context).languageCode, - ).add_Hms().format( - DateTime.fromMillisecondsSinceEpoch( - widget.bridge.timestampExec!, - ).toLocal(), - ), - textAlign: TextAlign.center, - maxLines: 1, - overflow: TextOverflow.ellipsis, - style: Theme.of(context).textTheme.bodyMedium!.copyWith( - fontSize: aedappfm.Responsive.fontSizeFromTextStyle( - context, - Theme.of(context).textTheme.bodyMedium!, - ), - ), + Padding( + padding: const EdgeInsets.only(bottom: 10), + child: EnvInfo(env: widget.bridge.blockchainFrom!.env), ), Row( children: [ @@ -243,6 +234,24 @@ class LocalHistoryCardState extends ConsumerState ), ], ), + Text( + DateFormat.yMd( + Localizations.localeOf(context).languageCode, + ).add_Hms().format( + DateTime.fromMillisecondsSinceEpoch( + widget.bridge.timestampExec! * 1000, + ).toLocal(), + ), + textAlign: TextAlign.center, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: Theme.of(context).textTheme.bodyMedium!.copyWith( + fontSize: aedappfm.Responsive.fontSizeFromTextStyle( + context, + Theme.of(context).textTheme.bodyMedium!, + ), + ), + ), LocalHistoryCardStatusInfos(bridge: widget.bridge), LocalHistoryCardDirectionInfos(bridge: widget.bridge), LocalHistoryCardTrfInfos(bridge: widget.bridge), diff --git a/lib/ui/views/local_history/local_history_sheet.dart b/lib/ui/views/local_history/local_history_sheet.dart index f20a80d0..71d734eb 100755 --- a/lib/ui/views/local_history/local_history_sheet.dart +++ b/lib/ui/views/local_history/local_history_sheet.dart @@ -36,8 +36,7 @@ class LocalHistorySheet extends ConsumerWidget { } Widget _body(BuildContext context, WidgetRef ref) { - final bridgesList = - ref.watch(BridgeHistoryProviders.fetchBridgesList(asc: false)); + final bridgesList = ref.watch(BridgeHistoryProviders.fetchBridgesOnchainList); return Padding( padding: const EdgeInsets.only(top: 90, left: 50, right: 50), @@ -145,7 +144,7 @@ Widget _body(BuildContext context, WidgetRef ref) { bridgesList.map( data: (data) { final localHistory = - ref.read(LocalHistoryFormProvider.localHistoryForm); + ref.watch(LocalHistoryFormProvider.localHistoryForm); return Expanded( child: SizedBox( width: 700, diff --git a/pubspec.lock b/pubspec.lock index 55995d4b..333457ea 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,18 +37,60 @@ packages: dependency: "direct main" description: name: archethic_dapp_framework_flutter +<<<<<<< HEAD sha256: "781957c6e739614183000c09a1110618dd2a09a03a735c0736ea0582e7b58954" url: "https://pub.dev" source: hosted version: "1.2.13" +======= +<<<<<<< HEAD + sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 + url: "https://pub.dev" + source: hosted + version: "1.2.6" +======= +<<<<<<< HEAD + sha256: "2eae3c029bb7cb2916122142804c72dc6f30e91849fef70f9c0b4402458e4eec" + url: "https://pub.dev" + source: hosted + version: "1.1.24" +======= + sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 + url: "https://pub.dev" + source: hosted + version: "1.2.6" +>>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) +>>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) archethic_lib_dart: dependency: transitive description: name: archethic_lib_dart +<<<<<<< HEAD sha256: "9d725d17a2ac7239a4d70048520daf45723661a829c09813f937bac613465060" url: "https://pub.dev" source: hosted version: "3.4.2" +======= +<<<<<<< HEAD + sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" + url: "https://pub.dev" + source: hosted + version: "3.4.1" +======= +<<<<<<< HEAD + sha256: "34654e90c7cfdc326f8bdeea396c18eb34dba9109838ac15d2de5f58184c38c6" + url: "https://pub.dev" + source: hosted + version: "3.3.18" +======= + sha256: ecdf2e5619725f4f5ca4f2ce6a35b3ac99fa8ca46ec2bac4b2ed6990b350cbfe + url: "https://pub.dev" + source: hosted + version: "3.4.0" +>>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) +>>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) +>>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) archethic_wallet_client: dependency: "direct main" description: diff --git a/pubspec.yaml b/pubspec.yaml index 140274e0..b917a678 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -22,8 +22,8 @@ dependencies: # git: # url: https://github.com/archethic-foundation/archethic-wallet-client-dart.git # ref: dev - # archethic_wallet_client: - # path: ../../packages/archethic-wallet-client-dart + #archethic_wallet_client: + # path: ../archethic-wallet-client-dart # Implementations of SHA, MD5, and HMAC cryptographic functions crypto: ^3.0.3 From debb154c5940389978d9e3147f1000a00bfa0d5f Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Mon, 15 Jul 2024 17:02:40 +0200 Subject: [PATCH 2/5] fix rebase --- pubspec.lock | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index 333457ea..e337f35b 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,12 +37,15 @@ packages: dependency: "direct main" description: name: archethic_dapp_framework_flutter +<<<<<<< HEAD <<<<<<< HEAD sha256: "781957c6e739614183000c09a1110618dd2a09a03a735c0736ea0582e7b58954" url: "https://pub.dev" source: hosted version: "1.2.13" ======= +======= +>>>>>>> 85c2bda (fix rebase) <<<<<<< HEAD sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 url: "https://pub.dev" @@ -55,23 +58,34 @@ packages: source: hosted version: "1.1.24" ======= +======= +>>>>>>> 4485ef5 (fix rebase) sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 url: "https://pub.dev" source: hosted version: "1.2.6" +<<<<<<< HEAD >>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) >>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) +<<<<<<< HEAD >>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) +======= +======= +>>>>>>> 4485ef5 (fix rebase) +>>>>>>> 85c2bda (fix rebase) archethic_lib_dart: dependency: transitive description: name: archethic_lib_dart +<<<<<<< HEAD <<<<<<< HEAD sha256: "9d725d17a2ac7239a4d70048520daf45723661a829c09813f937bac613465060" url: "https://pub.dev" source: hosted version: "3.4.2" ======= +======= +>>>>>>> 85c2bda (fix rebase) <<<<<<< HEAD sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" url: "https://pub.dev" @@ -90,7 +104,16 @@ packages: version: "3.4.0" >>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) >>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) +<<<<<<< HEAD >>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) +======= +======= + sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" + url: "https://pub.dev" + source: hosted + version: "3.4.1" +>>>>>>> 4485ef5 (fix rebase) +>>>>>>> 85c2bda (fix rebase) archethic_wallet_client: dependency: "direct main" description: From 36e1f99600323d4d7c44e78465e5bdb8b5bea253 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Tue, 16 Jul 2024 13:55:19 +0200 Subject: [PATCH 3/5] rebase pubspec.lock --- pubspec.lock | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/pubspec.lock b/pubspec.lock index e337f35b..4f50fbdc 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -38,6 +38,7 @@ packages: description: name: archethic_dapp_framework_flutter <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD sha256: "781957c6e739614183000c09a1110618dd2a09a03a735c0736ea0582e7b58954" url: "https://pub.dev" @@ -47,10 +48,13 @@ packages: ======= >>>>>>> 85c2bda (fix rebase) <<<<<<< HEAD +======= +>>>>>>> a2d6495 (rebase pubspec.lock) sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 url: "https://pub.dev" source: hosted version: "1.2.6" +<<<<<<< HEAD ======= <<<<<<< HEAD sha256: "2eae3c029bb7cb2916122142804c72dc6f30e91849fef70f9c0b4402458e4eec" @@ -73,11 +77,14 @@ packages: ======= >>>>>>> 4485ef5 (fix rebase) >>>>>>> 85c2bda (fix rebase) +======= +>>>>>>> a2d6495 (rebase pubspec.lock) archethic_lib_dart: dependency: transitive description: name: archethic_lib_dart <<<<<<< HEAD +<<<<<<< HEAD <<<<<<< HEAD sha256: "9d725d17a2ac7239a4d70048520daf45723661a829c09813f937bac613465060" url: "https://pub.dev" @@ -87,10 +94,13 @@ packages: ======= >>>>>>> 85c2bda (fix rebase) <<<<<<< HEAD +======= +>>>>>>> a2d6495 (rebase pubspec.lock) sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" url: "https://pub.dev" source: hosted version: "3.4.1" +<<<<<<< HEAD ======= <<<<<<< HEAD sha256: "34654e90c7cfdc326f8bdeea396c18eb34dba9109838ac15d2de5f58184c38c6" @@ -114,6 +124,8 @@ packages: version: "3.4.1" >>>>>>> 4485ef5 (fix rebase) >>>>>>> 85c2bda (fix rebase) +======= +>>>>>>> a2d6495 (rebase pubspec.lock) archethic_wallet_client: dependency: "direct main" description: From 1561075ecedb1c3a40ed1a380329dba441bdc5d5 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Thu, 29 Aug 2024 17:51:09 +0200 Subject: [PATCH 4/5] Fix rebase --- lib/application/balance.dart | 2 - lib/application/balance.g.dart | 74 --------------- lib/application/bridge_history.dart | 14 ++- lib/application/bridge_history.g.dart | 2 +- .../contracts/archethic_factory.dart | 59 ++++++------ lib/application/contracts/evm_htlc.dart | 6 +- .../get_contract_creation_response.dart | 3 +- lib/ui/views/bridge/bloc/provider.g.dart | 6 +- pubspec.lock | 89 ++----------------- 9 files changed, 46 insertions(+), 209 deletions(-) diff --git a/lib/application/balance.dart b/lib/application/balance.dart index 85117d78..1f667919 100644 --- a/lib/application/balance.dart +++ b/lib/application/balance.dart @@ -1,7 +1,5 @@ -import 'package:aebridge/application/evm_wallet.dart'; import 'package:aebridge/domain/repositories/balance.repository.dart'; import 'package:aebridge/infrastructure/balance.repository.dart'; -import 'package:archethic_lib_dart/archethic_lib_dart.dart'; import 'package:riverpod_annotation/riverpod_annotation.dart'; part 'balance.g.dart'; diff --git a/lib/application/balance.g.dart b/lib/application/balance.g.dart index 5015d19f..2a993114 100644 --- a/lib/application/balance.g.dart +++ b/lib/application/balance.g.dart @@ -22,11 +22,7 @@ final _balanceRepositoryProvider = ); typedef _BalanceRepositoryRef = AutoDisposeProviderRef; -<<<<<<< HEAD String _$getBalanceHash() => r'd29a315387d3a35a18d20e40ab033af777e8fcd1'; -======= -String _$getBalanceHash() => r'c63e51ea9d4b5ed206ffcd4bcc1a96a62e2bbb9d'; ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) /// Copied from Dart SDK class _SystemHash { @@ -64,12 +60,7 @@ class _GetBalanceFamily extends Family> { String address, String typeToken, String tokenAddress, -<<<<<<< HEAD int decimal, { -======= - ApiService? apiService, - EVMWalletProvider? evmWalletProvider, { ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) String? providerEndpoint, }) { return _GetBalanceProvider( @@ -77,12 +68,7 @@ class _GetBalanceFamily extends Family> { address, typeToken, tokenAddress, -<<<<<<< HEAD decimal, -======= - apiService, - evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ); } @@ -96,12 +82,7 @@ class _GetBalanceFamily extends Family> { provider.address, provider.typeToken, provider.tokenAddress, -<<<<<<< HEAD provider.decimal, -======= - provider.apiService, - provider.evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: provider.providerEndpoint, ); } @@ -129,12 +110,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { String address, String typeToken, String tokenAddress, -<<<<<<< HEAD int decimal, { -======= - ApiService? apiService, - EVMWalletProvider? evmWalletProvider, { ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) String? providerEndpoint, }) : this._internal( (ref) => _getBalance( @@ -143,12 +119,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address, typeToken, tokenAddress, -<<<<<<< HEAD decimal, -======= - apiService, - evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ), from: _getBalanceProvider, @@ -164,12 +135,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address: address, typeToken: typeToken, tokenAddress: tokenAddress, -<<<<<<< HEAD decimal: decimal, -======= - apiService: apiService, - evmWalletProvider: evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ); @@ -184,12 +150,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { required this.address, required this.typeToken, required this.tokenAddress, -<<<<<<< HEAD required this.decimal, -======= - required this.apiService, - required this.evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) required this.providerEndpoint, }) : super.internal(); @@ -197,12 +158,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { final String address; final String typeToken; final String tokenAddress; -<<<<<<< HEAD final int decimal; -======= - final ApiService? apiService; - final EVMWalletProvider? evmWalletProvider; ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) final String? providerEndpoint; @override @@ -222,12 +178,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { address: address, typeToken: typeToken, tokenAddress: tokenAddress, -<<<<<<< HEAD decimal: decimal, -======= - apiService: apiService, - evmWalletProvider: evmWalletProvider, ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) providerEndpoint: providerEndpoint, ), ); @@ -245,12 +196,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { other.address == address && other.typeToken == typeToken && other.tokenAddress == tokenAddress && -<<<<<<< HEAD other.decimal == decimal && -======= - other.apiService == apiService && - other.evmWalletProvider == evmWalletProvider && ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) other.providerEndpoint == providerEndpoint; } @@ -261,12 +207,7 @@ class _GetBalanceProvider extends AutoDisposeFutureProvider { hash = _SystemHash.combine(hash, address.hashCode); hash = _SystemHash.combine(hash, typeToken.hashCode); hash = _SystemHash.combine(hash, tokenAddress.hashCode); -<<<<<<< HEAD hash = _SystemHash.combine(hash, decimal.hashCode); -======= - hash = _SystemHash.combine(hash, apiService.hashCode); - hash = _SystemHash.combine(hash, evmWalletProvider.hashCode); ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) hash = _SystemHash.combine(hash, providerEndpoint.hashCode); return _SystemHash.finish(hash); @@ -286,16 +227,8 @@ mixin _GetBalanceRef on AutoDisposeFutureProviderRef { /// The parameter `tokenAddress` of this provider. String get tokenAddress; -<<<<<<< HEAD /// The parameter `decimal` of this provider. int get decimal; -======= - /// The parameter `apiService` of this provider. - ApiService? get apiService; - - /// The parameter `evmWalletProvider` of this provider. - EVMWalletProvider? get evmWalletProvider; ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) /// The parameter `providerEndpoint` of this provider. String? get providerEndpoint; @@ -314,14 +247,7 @@ class _GetBalanceProviderElement @override String get tokenAddress => (origin as _GetBalanceProvider).tokenAddress; @override -<<<<<<< HEAD int get decimal => (origin as _GetBalanceProvider).decimal; -======= - ApiService? get apiService => (origin as _GetBalanceProvider).apiService; - @override - EVMWalletProvider? get evmWalletProvider => - (origin as _GetBalanceProvider).evmWalletProvider; ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) @override String? get providerEndpoint => (origin as _GetBalanceProvider).providerEndpoint; diff --git a/lib/application/bridge_history.dart b/lib/application/bridge_history.dart index 0c0acf5d..5e4c9311 100644 --- a/lib/application/bridge_history.dart +++ b/lib/application/bridge_history.dart @@ -1,13 +1,11 @@ import 'dart:developer'; -import 'package:aebridge/application/balance.dart'; import 'package:aebridge/application/bridge_blockchain.dart'; import 'package:aebridge/application/bridge_token.dart'; import 'package:aebridge/application/contracts/archethic_contract.dart'; import 'package:aebridge/application/contracts/archethic_factory.dart'; import 'package:aebridge/application/contracts/evm_htlc.dart'; import 'package:aebridge/application/contracts/evm_lp.dart'; -import 'package:aebridge/application/evm_wallet.dart'; import 'package:aebridge/domain/models/bridge_history.dart'; import 'package:aebridge/domain/models/swap.dart'; import 'package:aebridge/domain/repositories/bridge_history.repository.dart'; @@ -81,14 +79,11 @@ Future>> _fetchBridgesOnchainList( logsActivation: false, ); - // Charger les informations en amont - final evmWalletProvider = EVMWalletProvider(); - final archethicProtocolInfo = await ArchethicFactory( blockchainFrom.isArchethic ? blockchainFrom.archethicFactoryAddress! : blockchainTo.archethicFactoryAddress!, - ).calculateArchethicProtocolFees(apiService); + ).calculateArchethicProtocolFees(); archethicProtocolFeesAddress = archethicProtocolInfo.address; archethicProtocolFeesRate = archethicProtocolInfo.rate; @@ -140,7 +135,8 @@ Future>> _fetchBridgesOnchainList( blockchainFrom.chainId, ); - final amountResult = await htlc.getAmount(); + // TODO: Decimal to managed + final amountResult = await htlc.getAmount(8); await amountResult.map( success: (success) async => amount, failure: (failure) async => null, @@ -209,13 +205,13 @@ Future>> _fetchBridgesOnchainList( print( ' blockchainTo.isArchethic ${blockchainTo.isArchethic} bridgeToken.poolAddressTo ${bridgeToken.poolAddressTo} bridgeToken.typeTarget ${bridgeToken.typeTarget} blockchainTo.providerEndpoint ${blockchainTo.providerEndpoint}', ); + // TODO: Decimal to managed poolTargetBalance = await BalanceRepositoryImpl().getBalance( blockchainTo.isArchethic, bridgeToken.poolAddressTo, bridgeToken.typeTarget, bridgeToken.tokenAddressTarget, - null, - evmWalletProvider, + 8, providerEndpoint: blockchainTo.providerEndpoint, ); print('poolTargetBalance $poolTargetBalance'); diff --git a/lib/application/bridge_history.g.dart b/lib/application/bridge_history.g.dart index ccb051a3..4ad50403 100644 --- a/lib/application/bridge_history.g.dart +++ b/lib/application/bridge_history.g.dart @@ -196,7 +196,7 @@ class _FetchBridgesListProviderElement } String _$fetchBridgesOnchainListHash() => - r'82ce22aa77aba0d10eeda1312bae1772daa7edc8'; + r'7d42eca705c7a512b27775f7c2b1cea621834796'; /// See also [_fetchBridgesOnchainList]. @ProviderFor(_fetchBridgesOnchainList) diff --git a/lib/application/contracts/archethic_factory.dart b/lib/application/contracts/archethic_factory.dart index 90b7d405..ebd9c5d6 100644 --- a/lib/application/contracts/archethic_factory.dart +++ b/lib/application/contracts/archethic_factory.dart @@ -9,23 +9,19 @@ class ArchethicFactory { final String factoryAddress; - Future<({double rate, String address})> calculateArchethicProtocolFees( - ApiService apiService, - ) async { + Future<({double rate, String address})> + calculateArchethicProtocolFees() async { var rate = 0.0; var address = ''; - final resultArchethicProtocolFeeRate = await _getProtocolFeeRate( - apiService, - ); + final resultArchethicProtocolFeeRate = await _getProtocolFeeRate(); await resultArchethicProtocolFeeRate.map( success: (archethicProtocolFeeRate) async { rate = archethicProtocolFeeRate; }, failure: (failure) {}, ); - final resultArchethicProtocolFeeAddress = - await _getProtocolAddress(apiService); + final resultArchethicProtocolFeeAddress = await _getProtocolAddress(); await resultArchethicProtocolFeeAddress.map( success: (archethicProtocolFeeAddress) async { address = archethicProtocolFeeAddress; @@ -35,21 +31,21 @@ class ArchethicFactory { return (rate: rate, address: address); } - Future> _getProtocolFeeRate( - ApiService apiService, - ) async { + Future> + _getProtocolFeeRate() async { return aedappfm.Result.guard( () async { - final protocolFeeRate = await apiService.callSCFunction( - jsonRPCRequest: SCCallFunctionRequest( - method: 'contract_fun', - params: SCCallFunctionParams( - contract: factoryAddress.toUpperCase(), - function: 'get_protocol_fee', - args: [], - ), - ), - ); + final protocolFeeRate = + await aedappfm.sl.get().callSCFunction( + jsonRPCRequest: SCCallFunctionRequest( + method: 'contract_fun', + params: SCCallFunctionParams( + contract: factoryAddress.toUpperCase(), + function: 'get_protocol_fee', + args: [], + ), + ), + ); try { final protocolFeeRateValue = double.parse(protocolFeeRate.toString()); return protocolFeeRateValue; @@ -67,16 +63,17 @@ class ArchethicFactory { ) async { return aedappfm.Result.guard( () async { - final protocolAddress = await apiService.callSCFunction( - jsonRPCRequest: SCCallFunctionRequest( - method: 'contract_fun', - params: SCCallFunctionParams( - contract: factoryAddress.toUpperCase(), - function: 'get_protocol_fee_address', - args: [], - ), - ), - ); + final protocolAddress = + await aedappfm.sl.get().callSCFunction( + jsonRPCRequest: SCCallFunctionRequest( + method: 'contract_fun', + params: SCCallFunctionParams( + contract: factoryAddress.toUpperCase(), + function: 'get_protocol_fee_address', + args: [], + ), + ), + ); return protocolAddress.toString(); }, ); diff --git a/lib/application/contracts/evm_htlc.dart b/lib/application/contracts/evm_htlc.dart index e14863d6..1522e6a2 100644 --- a/lib/application/contracts/evm_htlc.dart +++ b/lib/application/contracts/evm_htlc.dart @@ -196,7 +196,7 @@ class EVMHTLC with EVMBridgeProcessMixin, ArchethicBridgeProcessMixin { htlcContractAddressEVM, ); - final recipientMap = await web3Client!.call( + final recipientMap = await web3Client.call( contract: contractHTLC, function: contractHTLC.function('recipient'), params: [], @@ -210,7 +210,7 @@ class EVMHTLC with EVMBridgeProcessMixin, ArchethicBridgeProcessMixin { Future> getHTLCTimestamp() async { return aedappfm.Result.guard( () async { - final logs = await web3Client!.getLogs( + final logs = await web3Client.getLogs( FilterOptions( fromBlock: const BlockNum.genesis(), toBlock: const BlockNum.current(), @@ -221,7 +221,7 @@ class EVMHTLC with EVMBridgeProcessMixin, ArchethicBridgeProcessMixin { final filterEvent = logs[0]; final blockNum = filterEvent.blockNum; if (blockNum != null) { - final blockInformation = await web3Client!.getBlockInformation( + final blockInformation = await web3Client.getBlockInformation( blockNumber: '0x${blockNum.toRadixString(16)}', ); if (blockInformation.timestamp != null) { diff --git a/lib/domain/models/get_contract_creation_response.dart b/lib/domain/models/get_contract_creation_response.dart index e70d4bd3..a7e75f90 100644 --- a/lib/domain/models/get_contract_creation_response.dart +++ b/lib/domain/models/get_contract_creation_response.dart @@ -25,6 +25,7 @@ class GetContractCreationResponseResult }) = _GetContractCreationResponseResult; factory GetContractCreationResponseResult.fromJson( - Map json) => + Map json, + ) => _$GetContractCreationResponseResultFromJson(json); } diff --git a/lib/ui/views/bridge/bloc/provider.g.dart b/lib/ui/views/bridge/bloc/provider.g.dart index 7570819d..879b9054 100644 --- a/lib/ui/views/bridge/bloc/provider.g.dart +++ b/lib/ui/views/bridge/bloc/provider.g.dart @@ -7,11 +7,7 @@ part of 'provider.dart'; // ************************************************************************** String _$bridgeFormNotifierHash() => -<<<<<<< HEAD - r'841ed749471fc1616899bb353284fc80261d2e63'; -======= - r'4e372d2d8c8164e435bc0dabd96ab18eafaff3a3'; ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) + r'ce69fb6da7447d8dbe3d00335ad39489d9feb071'; /// See also [_BridgeFormNotifier]. @ProviderFor(_BridgeFormNotifier) diff --git a/pubspec.lock b/pubspec.lock index 4f50fbdc..0df9bfbf 100644 --- a/pubspec.lock +++ b/pubspec.lock @@ -37,95 +37,18 @@ packages: dependency: "direct main" description: name: archethic_dapp_framework_flutter -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD sha256: "781957c6e739614183000c09a1110618dd2a09a03a735c0736ea0582e7b58954" url: "https://pub.dev" source: hosted version: "1.2.13" -======= -======= ->>>>>>> 85c2bda (fix rebase) -<<<<<<< HEAD -======= ->>>>>>> a2d6495 (rebase pubspec.lock) - sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 - url: "https://pub.dev" - source: hosted - version: "1.2.6" -<<<<<<< HEAD -======= -<<<<<<< HEAD - sha256: "2eae3c029bb7cb2916122142804c72dc6f30e91849fef70f9c0b4402458e4eec" - url: "https://pub.dev" - source: hosted - version: "1.1.24" -======= -======= ->>>>>>> 4485ef5 (fix rebase) - sha256: bba3f504d6488895cdfd1c132d9e95d4f6df828a6d64c390da6f575803d510b9 - url: "https://pub.dev" - source: hosted - version: "1.2.6" -<<<<<<< HEAD ->>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) ->>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) -<<<<<<< HEAD ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) -======= -======= ->>>>>>> 4485ef5 (fix rebase) ->>>>>>> 85c2bda (fix rebase) -======= ->>>>>>> a2d6495 (rebase pubspec.lock) archethic_lib_dart: dependency: transitive description: name: archethic_lib_dart -<<<<<<< HEAD -<<<<<<< HEAD -<<<<<<< HEAD sha256: "9d725d17a2ac7239a4d70048520daf45723661a829c09813f937bac613465060" url: "https://pub.dev" source: hosted version: "3.4.2" -======= -======= ->>>>>>> 85c2bda (fix rebase) -<<<<<<< HEAD -======= ->>>>>>> a2d6495 (rebase pubspec.lock) - sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" - url: "https://pub.dev" - source: hosted - version: "3.4.1" -<<<<<<< HEAD -======= -<<<<<<< HEAD - sha256: "34654e90c7cfdc326f8bdeea396c18eb34dba9109838ac15d2de5f58184c38c6" - url: "https://pub.dev" - source: hosted - version: "3.3.18" -======= - sha256: ecdf2e5619725f4f5ca4f2ce6a35b3ac99fa8ca46ec2bac4b2ed6990b350cbfe - url: "https://pub.dev" - source: hosted - version: "3.4.0" ->>>>>>> f92e81b (feat: :sparkles: Replace local history with on chain history) ->>>>>>> 302521d (feat: :sparkles: Replace local history with on chain history) -<<<<<<< HEAD ->>>>>>> 5fde8f3 (feat: :sparkles: Replace local history with on chain history) -======= -======= - sha256: "421f3ffe4b2f3816424fbb81ef572344a46a67590e4a237cc6251f8101582335" - url: "https://pub.dev" - source: hosted - version: "3.4.1" ->>>>>>> 4485ef5 (fix rebase) ->>>>>>> 85c2bda (fix rebase) -======= ->>>>>>> a2d6495 (rebase pubspec.lock) archethic_wallet_client: dependency: "direct main" description: @@ -314,10 +237,10 @@ packages: dependency: transitive description: name: coverage - sha256: "576aaab8b1abdd452e0f656c3e73da9ead9d7880e15bdc494189d9c1a1baf0db" + sha256: "7b594a150942e0d3be99cd45a1d0b5caff27ba5a27f292ed8e8d904ba3f167b5" url: "https://pub.dev" source: hosted - version: "1.9.0" + version: "1.9.1" crypto: dependency: "direct main" description: @@ -761,10 +684,10 @@ packages: dependency: transitive description: name: mime - sha256: "2e123074287cc9fd6c09de8336dae606d1ddb88d9ac47358826db698c176a1f2" + sha256: "801fd0b26f14a4a58ccb09d5892c3fbdeff209594300a542492cf13fba9d247a" url: "https://pub.dev" source: hosted - version: "1.0.5" + version: "1.0.6" ninja_asn1: dependency: transitive description: @@ -953,10 +876,10 @@ packages: dependency: transitive description: name: quiver - sha256: b1c1ac5ce6688d77f65f3375a9abb9319b3cb32486bdc7a1e0fdf004d7ba4e47 + sha256: ea0b925899e64ecdfbf9c7becb60d5b50e706ade44a85b2363be2a22d88117d2 url: "https://pub.dev" source: hosted - version: "3.2.1" + version: "3.2.2" rational: dependency: transitive description: From 2af9a5ea7db2b9eabf802aa62d6e3cfe4e54d3a2 Mon Sep 17 00:00:00 2001 From: redDwarf03 Date: Thu, 29 Aug 2024 17:51:28 +0200 Subject: [PATCH 5/5] Fix rebase --- lib/application/contracts/archethic_factory.dart | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/lib/application/contracts/archethic_factory.dart b/lib/application/contracts/archethic_factory.dart index ebd9c5d6..2a86d1d8 100644 --- a/lib/application/contracts/archethic_factory.dart +++ b/lib/application/contracts/archethic_factory.dart @@ -58,9 +58,8 @@ class ArchethicFactory { ); } - Future> _getProtocolAddress( - ApiService apiService, - ) async { + Future> + _getProtocolAddress() async { return aedappfm.Result.guard( () async { final protocolAddress =