Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ jobs:
const kCypherGoatAffiliate = "";
const kTrocadorApiKey = "";
const kTrocadorRefCode = "";
const kChainflipApiKey = "";
EOF
fi

Expand Down
22 changes: 22 additions & 0 deletions asset_sources/svg/campfire/exchange_icons/chainflip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions asset_sources/svg/stack_duo/exchange_icons/chainflip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
22 changes: 22 additions & 0 deletions asset_sources/svg/stack_wallet/exchange_icons/chainflip.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
19 changes: 16 additions & 3 deletions lib/models/isar/exchange_cache/currency.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import 'package:isar_community/isar.dart';

import '../../../app_config.dart';
import '../../../services/exchange/chainflip/chainflip_exchange.dart';
import '../../../services/exchange/change_now/change_now_exchange.dart';
import '../../../services/exchange/cyphergoat/cyphergoat_exchange.dart';
import '../../../services/exchange/exchange.dart';
Expand Down Expand Up @@ -80,9 +81,8 @@ class Currency {
return ticker.toLowerCase();
}

return _fuzzyCache ??= switch (Exchange.fromName(
exchangeName,
).runtimeType) {
return _fuzzyCache ??= switch (Exchange.fromName(exchangeName)
.runtimeType) {
// already lower case ticker basically
const (ChangeNowExchange) => network,

Expand All @@ -108,6 +108,8 @@ class Currency {
const (CypherGoatExchange) =>
network.isNotEmpty ? network.toLowerCase() : ticker.toLowerCase(),

const (ChainflipExchange) => _chainflipFuzzyNet(network, externalId),

_ => throw Exception("Unknown exchange: $exchangeName"),
};
}
Expand Down Expand Up @@ -206,3 +208,14 @@ class Currency {
return "Currency: ${toJson()}";
}
}

/// Chainflip `network` values are display names ("Bitcoin", "Ethereum",
/// "Solana"). Cross-provider grouping uses the asset-id suffix ("btc", "eth",
/// "sol"), the short codes the default pair and sibling providers use;
/// otherwise the Chainflip rows never join the shared currency rows.
String _chainflipFuzzyNet(String network, String? externalId) {
if (externalId != null && externalId.contains(".")) {
return externalId.split(".").last;
}
return network.toLowerCase();
}
2 changes: 2 additions & 0 deletions lib/pages/exchange_view/exchange_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import '../../models/isar/exchange_cache/currency.dart';
import '../../models/isar/models/ethereum/eth_contract.dart';
import '../../pages_desktop_specific/desktop_exchange/exchange_steps/step_scaffold.dart';
import '../../providers/providers.dart';
import '../../services/exchange/chainflip/chainflip_exchange.dart';
import '../../services/exchange/change_now/change_now_exchange.dart';
import '../../services/exchange/cyphergoat/cyphergoat_exchange.dart';
import '../../services/exchange/exchange.dart';
Expand Down Expand Up @@ -90,6 +91,7 @@ class _ExchangeFormState extends ConsumerState<ExchangeForm> {
NanswapExchange.instance,
WizardSwapExchange.instance,
CypherGoatExchange.instance,
ChainflipExchange.instance,
];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import 'package:flutter_riverpod/flutter_riverpod.dart';

import '../../../models/exchange/aggregate_currency.dart';
import '../../../providers/providers.dart';
import '../../../services/exchange/chainflip/chainflip_exchange.dart';
import '../../../services/exchange/change_now/change_now_exchange.dart';
import '../../../services/exchange/cyphergoat/cyphergoat_exchange.dart';
import '../../../services/exchange/exchange.dart';
Expand Down Expand Up @@ -115,6 +116,11 @@ class _ExchangeProviderOptionsState
sendCurrency: sendCurrency,
receiveCurrency: receivingCurrency,
);
final showChainflip = exchangeSupported(
exchangeName: ChainflipExchange.exchangeName,
sendCurrency: sendCurrency,
receiveCurrency: receivingCurrency,
);

return RoundedWhiteContainer(
padding: isDesktop ? const EdgeInsets.all(0) : const EdgeInsets.all(12),
Expand All @@ -130,6 +136,7 @@ class _ExchangeProviderOptionsState
if (showNanswap) NanswapExchange.instance,
if (showWizardSwap) WizardSwapExchange.instance,
if (showCypherGoat) CypherGoatExchange.instance,
if (showChainflip) ChainflipExchange.instance,
],
fixedRate: widget.fixedRate,
reversed: widget.reversed,
Expand Down
Loading