Add Chainflip exchange provider (#1807) (#1970)

* Add Chainflip exchange provider (#1807)

* feat: add Chainflip exchange provider

feat: add chainflip provider (fetchLimits and fetchRate)
feat: add createTrade
feat: add icon
feat: add swap status
feat: add FLIP to list
feat: add to transaction list, with target amount
feat: update receivedAmount with real values
style: dart formatting
feat: update received amount
chore: cleanup space and typo

* fix: use correct retryDurationInBlocks

* feat: use secrets for api key

---------

Co-authored-by: Omar Hatem <omarh.ismail1@gmail.com>

* Add secrets to workflow

* revert boostfee change

* minor ui fix [skip ci]

---------

Co-authored-by: David Cumps <david@cumps.be>
This commit is contained in:
Omar Hatem
2025-01-24 20:17:37 +02:00
committed by GitHub
co-authored by David Cumps
parent 199ada3fa9
commit 9cda2c99e7
21 changed files with 413 additions and 21 deletions
@@ -160,7 +160,8 @@ class TransactionsPage extends StatelessWidget {
createdAtFormattedDate: trade.createdAt != null
? DateFormat('HH:mm').format(trade.createdAt!)
: null,
formattedAmount: item.tradeFormattedAmount,
formattedAmount: item.tradeFormattedAmount,
formattedReceiveAmount: item.tradeFormattedReceiveAmount
),
);
}
@@ -13,6 +13,7 @@ class TradeRow extends StatelessWidget {
required this.createdAtFormattedDate,
this.onTap,
this.formattedAmount,
this.formattedReceiveAmount,
super.key,
});
@@ -22,10 +23,12 @@ class TradeRow extends StatelessWidget {
final CryptoCurrency to;
final String? createdAtFormattedDate;
final String? formattedAmount;
final String? formattedReceiveAmount;
@override
Widget build(BuildContext context) {
final amountCrypto = from.toString();
final receiveAmountCrypto = to.toString();
return InkWell(
onTap: onTap,
@@ -61,12 +64,21 @@ class TradeRow extends StatelessWidget {
: Container()
]),
SizedBox(height: 5),
Row(mainAxisAlignment: MainAxisAlignment.spaceBetween, children: <Widget>[
if (createdAtFormattedDate != null)
Text(createdAtFormattedDate!,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
Row(
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: <Widget>[
createdAtFormattedDate != null
? Text(createdAtFormattedDate!,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
: Container(),
formattedReceiveAmount != null
? Text(formattedReceiveAmount! + ' ' + receiveAmountCrypto,
style: TextStyle(
fontSize: 14,
color: Theme.of(context).extension<CakeTextTheme>()!.dateSectionRowColor))
: Container(),
])
],
))
+6 -2
View File
@@ -1,4 +1,5 @@
import 'package:cake_wallet/exchange/exchange_provider_description.dart';
import 'package:cake_wallet/exchange/provider/chainflip_exchange_provider.dart';
import 'package:cake_wallet/exchange/provider/thorchain_exchange.provider.dart';
import 'package:cake_wallet/themes/extensions/exchange_page_theme.dart';
import 'package:cake_wallet/themes/extensions/keyboard_theme.dart';
@@ -444,7 +445,8 @@ class ExchangePage extends BasePage {
}
if (state is TradeIsCreatedSuccessfully) {
exchangeViewModel.reset();
(exchangeViewModel.tradesStore.trade?.provider == ExchangeProviderDescription.thorChain)
(exchangeViewModel.tradesStore.trade?.provider == ExchangeProviderDescription.thorChain ||
exchangeViewModel.tradesStore.trade?.provider == ExchangeProviderDescription.chainflip)
? Navigator.of(context).pushReplacementNamed(Routes.exchangeTrade)
: Navigator.of(context).pushReplacementNamed(Routes.exchangeConfirm);
}
@@ -495,8 +497,10 @@ class ExchangePage extends BasePage {
exchangeViewModel.isSendAllEnabled = false;
final isThorChain = exchangeViewModel.selectedProviders
.any((provider) => provider is ThorChainExchangeProvider);
final isChainflip = exchangeViewModel.selectedProviders
.any((provider) => provider is ChainflipExchangeProvider);
_depositAmountDebounce = isThorChain
_depositAmountDebounce = isThorChain || isChainflip
? Debounce(Duration(milliseconds: 1000))
: Debounce(Duration(milliseconds: 500));
@@ -27,6 +27,7 @@ class TransactionSuccessPage extends InfoPage {
Key? get buttonKey => ValueKey('transaction_success_info_page_button_key');
@override
void Function(BuildContext) get onPressed =>
(BuildContext context) => Navigator.of(context).pop();
void Function(BuildContext) get onPressed => (BuildContext context) {
if (context.mounted) Navigator.of(context).pop();
};
}