Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
2afcb6e
feat(pubkeys): persist AssetPubkeys across sessions using Hive TypeAd…
CharlVS Oct 26, 2025
f11c5f5
chore(format): run dart format on pubkey persistence and balance mana…
CharlVS Oct 26, 2025
77ca946
perf(sdk): dedupe pubkeys/address fetch, cache-first hydrate; throttl…
CharlVS Oct 26, 2025
0db04b2
test(local-auth): add ensureKdfHealthy to FakeAuthService for Trezor …
CharlVS Oct 26, 2025
301ddb2
Refactor: Wallet-aware pubkey persistence and retrieval
cursoragent Oct 26, 2025
eb8572a
Refactor: Improve pubkey and balance fetching logic
cursoragent Oct 26, 2025
f2da6f1
fix: market data resource improvements
CharlVS Oct 27, 2025
df63a72
perf(assets): cache activated assets and coalesce activation checks
CharlVS Oct 27, 2025
1c791aa
feat(streaming): add typed stream RPCs and web SharedWorker integrati…
CharlVS Oct 27, 2025
3ad6766
feat(web): package event_streaming_worker.js in framework assets and …
CharlVS Oct 27, 2025
256b51f
fix(web): correct SharedWorker path to package asset under assets/web/
CharlVS Oct 27, 2025
8688ae2
refactor(streaming): improve type safety with sealed event classes
CharlVS Oct 27, 2025
0ef0f44
feat(sdk): add internal event streaming manager with lifecycle manage…
CharlVS Oct 27, 2025
dccd813
perf: eliminate RPC polling by using event streaming
CharlVS Oct 27, 2025
5e48143
fix(cache): address PR review issues - error handling and race condit…
CharlVS Oct 27, 2025
62ac254
chore: add event streaming logging
CharlVS Oct 27, 2025
7f7d5e7
fix(rpc): address critical review feedback on caching implementation
CharlVS Oct 27, 2025
ac0c2f0
perf(auth): use shutdown event streaming to minimize RPC polling
CharlVS Oct 27, 2025
ba9ccd6
feat(rpc): optimize initial balance/history for newly created wallets
CharlVS Oct 27, 2025
5227316
fix(auth): track imported vs created wallets to prevent incorrect opt…
CharlVS Oct 27, 2025
bf7c16f
Merge branch 'dev' of https://github.com/KomodoPlatform/komodo-defi-s…
CharlVS Oct 27, 2025
7665a30
fix: remove errors from KDF merge
CharlVS Oct 27, 2025
9c7fe20
chore: roll `coins`
CharlVS Oct 27, 2025
211f513
fix: misc streaming fixes
CharlVS Oct 27, 2025
5d31da6
feat(sdk): add event streaming support for task status updates
CharlVS Oct 28, 2025
be78b9e
fix(activation): force cache refresh when verifying asset availability
CharlVS Oct 28, 2025
bb50720
fix(streaming): use asset config ID instead of display name for event…
CharlVS Oct 28, 2025
6df8315
perf: reduce RPC spam in activation strategies and managers
CharlVS Oct 28, 2025
6dd9b32
fix(auth-service): update cache alongside storage for metadata updates
takenagain Oct 28, 2025
cd9640b
chore: roll KDF to release preview
CharlVS Oct 28, 2025
cd54228
fix(stream): normalize KDF stream _type parsing for suffixed IDs; for…
CharlVS Oct 28, 2025
8b6ebed
fix: use correct streaming worker js path
CharlVS Oct 28, 2025
47a4add
fix: tx history streaming
CharlVS Oct 28, 2025
2bd1c68
fix: improve robustness of event parsing
CharlVS Oct 28, 2025
33067ed
fix: backwards compatibility for KDF API status
CharlVS Oct 28, 2025
087d545
Merge branch 'dev' of https://github.com/KomodoPlatform/komodo-defi-s…
CharlVS Oct 29, 2025
74d4999
Refactor: Improve transaction comparison logic (#268)
CharlVS Oct 29, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -443,4 +443,9 @@ class BinanceRepository implements CexRepository {
return false;
}
}

@override
void dispose() {
// No resources to dispose in this implementation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ class MarketDataBootstrap {
if (config.enableCoinPaprika) {
container.registerSingletonAsync<ICoinPaprikaProvider>(
() async => config.coinPaprikaProvider ?? CoinPaprikaProvider(),
dispose: (provider) => provider.dispose(),
);
}

Expand Down Expand Up @@ -166,6 +167,7 @@ class MarketDataBootstrap {
coinPaprikaProvider: await container.getAsync<ICoinPaprikaProvider>(),
),
dependsOn: [ICoinPaprikaProvider],
dispose: (repository) => repository.dispose(),
);
}

Expand Down
6 changes: 6 additions & 0 deletions packages/komodo_cex_market_data/lib/src/cex_repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -202,4 +202,10 @@ abstract class CexRepository {
QuoteCurrency fiatCurrency,
PriceRequestType requestType,
);

/// Releases any resources held by the repository.
///
/// Repositories that allocate resources such as HTTP clients or file handles
/// should override this method to dispose them when no longer needed.
void dispose() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,9 @@ class CoinGeckoRepository implements CexRepository {
// For paid plans with cutoff from 2013/2018, return a reasonable batch size
return daysSinceCutoff > 365 ? 365 : daysSinceCutoff;
}

@override
void dispose() {
// No resources to dispose in this implementation
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ abstract class ICoinPaprikaProvider {

/// The current API plan with its limitations and features.
CoinPaprikaApiPlan get apiPlan;

/// Releases any resources held by the provider.
void dispose();
}

/// Implementation of CoinPaprika data provider using HTTP requests.
Expand All @@ -80,7 +83,8 @@ class CoinPaprikaProvider implements ICoinPaprikaProvider {
this.apiPlan = const CoinPaprikaApiPlan.free(),
http.Client? httpClient,
}) : _apiKey = apiKey,
_httpClient = httpClient ?? http.Client();
_httpClient = httpClient ?? http.Client(),
_ownsHttpClient = httpClient == null;

/// The base URL for the CoinPaprika API.
final String baseUrl;
Expand All @@ -97,6 +101,7 @@ class CoinPaprikaProvider implements ICoinPaprikaProvider {

/// The HTTP client for the CoinPaprika API.
final http.Client _httpClient;
final bool _ownsHttpClient;

static final Logger _logger = Logger('CoinPaprikaProvider');

Expand Down Expand Up @@ -514,4 +519,11 @@ class CoinPaprikaProvider implements ICoinPaprikaProvider {
: null,
);
}

@override
void dispose() {
if (_ownsHttpClient) {
_httpClient.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ class CoinPaprikaRepository implements CexRepository {
CoinPaprikaRepository({
required this.coinPaprikaProvider,
bool enableMemoization = true,
bool ownsProvider = false,
}) : _idResolutionStrategy = CoinPaprikaIdResolutionStrategy(),
_enableMemoization = enableMemoization;
_enableMemoization = enableMemoization,
_ownsProvider = ownsProvider;

/// The CoinPaprika provider to use for fetching data.
final ICoinPaprikaProvider coinPaprikaProvider;
final IdResolutionStrategy _idResolutionStrategy;
final bool _enableMemoization;
final bool _ownsProvider;

final AsyncMemoizer<List<CexCoin>> _coinListMemoizer = AsyncMemoizer();
Set<String>? _cachedQuoteCurrencies;
Expand Down Expand Up @@ -437,4 +440,11 @@ class CoinPaprikaRepository implements CexRepository {
return false;
}
}

@override
void dispose() {
if (_ownsProvider) {
coinPaprikaProvider.dispose();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ class SparklineRepository with RepositoryFallbackMixin {
factory SparklineRepository.defaultInstance() {
return SparklineRepository([
BinanceRepository(binanceProvider: const BinanceProvider()),
CoinPaprikaRepository(coinPaprikaProvider: CoinPaprikaProvider()),
CoinPaprikaRepository(
coinPaprikaProvider: CoinPaprikaProvider(),
ownsProvider: true,
),
CoinGeckoRepository(coinGeckoProvider: CoinGeckoCexProvider()),
], selectionStrategy: DefaultRepositorySelectionStrategy());
}
Expand Down Expand Up @@ -174,6 +177,28 @@ class SparklineRepository with RepositoryFallbackMixin {
return future;
}

/// Releases held resources such as HTTP clients and Hive boxes.
Future<void> dispose() async {
for (final repository in _repositories) {
try {
repository.dispose();
} catch (e, st) {
_logger.severe('Error disposing repository: $repository', e, st);
}
}

final box = _box;
if (box != null && box.isOpen) {
try {
await box.close();
} catch (e, st) {
_logger.severe('Error closing Hive box', e, st);
}
}
_box = null;
isInitialized = false;
}

/// Internal method to perform the actual sparkline fetch
///
/// This is separated from fetchSparkline to enable proper request
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@ class TestUnknownRepository implements CexRepository {
) async {
return false;
}

@override
void dispose() {
// No resources to dispose in mock
}
}

void main() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class MockSupportingRepository implements CexRepository {
@override
bool canHandleAsset(AssetId assetId) => true;

@override
void dispose() {
// No resources to dispose in mock
}

@override
String toString() => 'MockRepository($name)';
}
Expand Down Expand Up @@ -170,6 +175,11 @@ class MockFailingRepository implements CexRepository {
@override
bool canHandleAsset(AssetId assetId) => true;

@override
void dispose() {
// No resources to dispose in mock
}

@override
String toString() => 'MockFailingRepository';
}
Expand Down Expand Up @@ -420,6 +430,11 @@ class MockGeckoStyleRepository implements CexRepository {
@override
bool canHandleAsset(AssetId assetId) => true;

@override
void dispose() {
// No resources to dispose in mock
}

@override
String toString() => 'MockGeckoStyleRepository';
}
Expand Down Expand Up @@ -488,6 +503,11 @@ class MockPaprikaStyleRepository implements CexRepository {
@override
bool canHandleAsset(AssetId assetId) => true;

@override
void dispose() {
// No resources to dispose in mock
}

@override
String toString() => 'MockPaprikaStyleRepository';
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Generated by the `index_generator` package with the `index_generator.yaml` configuration file.

library;
library _coins_config;

export 'asset_parser.dart';
export 'coin_config_provider.dart';
Expand Down
20 changes: 10 additions & 10 deletions packages/komodo_defi_framework/app_build/build_config.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"api": {
"api_commit_hash": "96023711777feda55990a7510c352485d8a5c7a5",
"branch": "staging",
"api_commit_hash": "9aa41b4c741907d59e4887db08cf84fb78e967e0",
"branch": "dev",
"fetch_at_build_enabled": true,
"concurrent_downloads_enabled": true,
"source_urls": [
Expand All @@ -13,14 +13,14 @@
"web": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-wasm|mm2_[a-f0-9]{7,40}-wasm|mm2-[a-f0-9]{7,40}-wasm)\\.zip$",
"valid_zip_sha256_checksums": [
"37738eb7d487aefa125ffed8e2de0be0d4279752234cfb90c94542d6a054d6f3"
"f92d61595317c16b8f8294c038c7c9215aca94187e22aedc7e0adeba93c94d82"
],
"path": "web/kdf/bin"
},
"ios": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-ios-aarch64|mm2_[a-f0-9]{7,40}-ios-aarch64|mm2-[a-f0-9]{7,40}-ios-aarch64-CI)\\.zip$",
"valid_zip_sha256_checksums": [
"eef4d2f5ddd000d9c6be7b9b1afcd6e1265096ca4d31664b2481ea89493d1a72"
"4f18e9e82ca16e7b1133cabd898d7503f925be1b7d06693f687c34866617da2e"
],
"path": "ios"
},
Expand All @@ -31,35 +31,35 @@
"mac-arm64"
],
"valid_zip_sha256_checksums": [
"3943c7ad8cab1e7263eb9693936909df87ae60816f09d16435d7122411895624"
"169db9b1410888d7da9f6a0ead2e1a05834528982cebbb70a2e2e3d01e220b69"
],
"path": "macos/bin"
},
"windows": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-win-x86-64|mm2_[a-f0-9]{7,40}-win-x86-64|mm2-[a-f0-9]{7,40}-Win64)\\.zip$",
"valid_zip_sha256_checksums": [
"c875dac3a4e850dffd68a16036350acfbdde21285f35f0889e4b8abd7c75b67f"
"d4f5954071df5c2c23016a69074bf19d3daeba10ab413fda2fce8205ee32184c"
],
"path": "windows/bin"
},
"android-armv7": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-android-armv7|mm2_[a-f0-9]{7,40}-android-armv7|mm2-[a-f0-9]{7,40}-android-armv7-CI)\\.zip$",
"valid_zip_sha256_checksums": [
"4125917ceacfbc9da6856bf84281e48768e8a6d7f537019575c751ec1cab0164"
"d964f608787683de67ddde7d827dee88185509cc5ffeb6e85d5f7e2aeba84f08"
],
"path": "android/app/src/main/cpp/libs/armeabi-v7a"
},
"android-aarch64": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-android-aarch64|mm2_[a-f0-9]{7,40}-android-aarch64|mm2-[a-f0-9]{7,40}-android-aarch64-CI)\\.zip$",
"valid_zip_sha256_checksums": [
"c99c96c08c02b9d0ebe91c5dbad57aeda3d0b39d0b960343f8831fd70e0af032"
"32927dfa36a283d344c34cd1514ca8ea3233f20752ec15b7929309cf4df969c2"
],
"path": "android/app/src/main/cpp/libs/arm64-v8a"
},
"linux": {
"matching_pattern": "^(?:kdf_[a-f0-9]{7,40}-linux-x86-64|mm2_[a-f0-9]{7,40}-linux-x86-64|mm2-[a-f0-9]{7,40}-Linux-Release)\\.zip$",
"valid_zip_sha256_checksums": [
"04f57689eba9c7d9a901bae3da7c954f2cfa248140a0112df1ab5920871d2926"
"e3315a46cb9e1957206b36036954bce51d61d8c4784ed878cc93360b9d01c1cb"
],
"path": "linux/bin"
}
Expand All @@ -68,7 +68,7 @@
"coins": {
"fetch_at_build_enabled": true,
"update_commit_on_build": true,
"bundled_coins_repo_commit": "3d23cb5dcc82d4bb8c88f8ebf67ad3fb51ed3b6b",
"bundled_coins_repo_commit": "561576a817f0fb40663d0ce04a04755b7cf8a8a2",
"coins_repo_api_url": "https://api.github.com/repos/KomodoPlatform/coins",
"coins_repo_content_url": "https://raw.githubusercontent.com/KomodoPlatform/coins",
"coins_repo_branch": "master",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// SharedWorker script that forwards messages to all connected ports.
/* eslint-disable no-restricted-globals */

const connections = [];

onconnect = function (e) {
const port = e.ports[0];
connections.push(port);
port.start();

port.onmessage = function (msgEvent) {
try {
const data = msgEvent.data;
for (const p of connections) {
try { p.postMessage(data); } catch (_) { }
}
} catch (_) { }
};
};
Loading
Loading