getPaymentAssetsForNetwork method
ℹ️ Get supported assets on the given chainId (CAIP-2) Null value will return all supported assets in all networks
Implementation
@override
List<ExchangeAsset> getPaymentAssetsForNetwork({
String? chainId,
bool includeNative = true,
}) {
if (chainId == null) {
if (includeNative) {
return allExchangeAssets;
}
return allExchangeAssets.where((e) => !e.isNative()).toList();
}
if (!NamespaceUtils.isValidChainId(chainId)) {
throw Errors.getSdkError(
Errors.UNSUPPORTED_CHAINS,
context: 'chainId should conform to "CAIP-2" format',
).toSignError();
}
if (includeNative) {
return allExchangeAssets.where((a) => a.network == chainId).toList();
}
return allExchangeAssets
.where((a) => a.network == chainId && !a.isNative())
.toList();
}