Skip to content

feat: add custom local coins and coins-config file selection#3492

Open
CharlVS wants to merge 2 commits into
devfrom
feat/local-coins-config
Open

feat: add custom local coins and coins-config file selection#3492
CharlVS wants to merge 2 commits into
devfrom
feat/local-coins-config

Conversation

@CharlVS

@CharlVS CharlVS commented Jun 16, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds an advanced Custom coins configuration setting that lets users point KDF and the SDK at local coins and coins_config.json files instead of the bundled configuration — useful for development and testing against local coin definitions.

Two independent overrides are supported:

  • KDF coins — the raw coins list fed to mm2 at startup.
  • Coins config — the enriched coins_config.json consumed by the SDK asset registry.

SDK (komodo-defi-sdk-flutter)

Submodule bumped to branch feat/local-coins-config:

  • New CustomCoinsFileSource (filesystem path on native, in-memory content on web) and FileCoinConfigProvider.
  • New CustomCoinsConfig: a persisted (Hive) registry loaded during bootstrap() that supplies the parsed coins list to mm2 startup and an authoritative coins-config source to the asset manager and startup coins provider. Background coin updates are disabled while an override is active.
  • Public, UI-free API on KomodoDefiSdk: setCustomCoinsPath({ kdfCoins, coinsConfig }) and resetCustomCoinsPath() — file selection is the host app's responsibility.
  • Overrides are validated before persisting; individual malformed coins are skipped (consistent with the existing per-coin loading tolerance), so one invalid coin does not break loading the rest.

App

  • New SettingsCustomCoinsPath section in General Settings that opens a file picker (pre-populating the starting directory on native, reading file content on web) and calls the SDK.
  • Display labels persisted via StoredSettings / SettingsBloc; a restart-required dialog is shown after each change/reset.

Behaviour notes

  • An app restart is required for changes to take effect — coins data is read once at KDF start and when the asset registry is built.
  • On web there is no filesystem path, so the picked file's content is captured in memory and persisted (IndexedDB via Hive).
  • Setting only the coins config (not KDF coins) also derives the mm2 coins from that file, keeping KDF and the SDK asset registry consistent.

Testing

  • flutter analyze is clean on the changed SDK and app files.
  • Manual: select local coins / coins_config files in Settings → restart → confirm KDF and the asset registry use the local files; reset reverts to the bundled config.

Manual test files

Single-coin (DOC, a Komodo testnet UTXO coin) fixtures for manually exercising the two override slots, hosted as a gist (not committed to the repo). The DOC entries are copied verbatim from the bundled coins.json / coins_config.json, so they parse, pass set-time validation, and are accepted by mm2.

Gist: https://gist.github.com/CharlVS/477754b4012c619ea0f855e626bdc430

Slot File (download) Format
KDF coins file kdf_coins_DOC.json JSON array [ {…} ] (raw mm2 coins)
Coins config file coins_config_DOC.json JSON object { "DOC": {…} } (coins_config.json)

Download each file, pick it in Settings → General → Custom coins configuration, then fully restart. With the coins config file set, after restart the wallet's asset registry shows only DOC (clearest signal). Reset to bundled config reverts after a restart.

Add an advanced "Custom coins configuration" section in General Settings
that lets users point KDF and the SDK at local coins and
coins_config.json files instead of the bundled configuration.

- New SettingsCustomCoinsPath widget that opens a file picker
  (pre-populating the starting directory on native, reading file content
  on web) and calls KomodoDefiSdk.setCustomCoinsPath /
  resetCustomCoinsPath.
- Persist display labels via StoredSettings and SettingsBloc, and show a
  restart-required dialog after each change or reset.
- Bump the komodo-defi-sdk submodule to the matching
  feat/local-coins-config commit that implements the SDK-layer feature.

An app restart is required for changes to take effect.
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@github-actions

github-actions Bot commented Jun 16, 2026

Copy link
Copy Markdown

Visit the preview URL for this PR (updated for commit 75952a6):

https://walletrc--pull-3492-merge-f68gs49l.web.app

(expires Tue, 23 Jun 2026 20:37:26 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: f66a4ff03faa546f12f0ae5a841bd9eff2714dcc

Rework the Custom coins configuration setting to be content-based,
matching the SDK change. The picked file's content is now captured in
memory (identically on native and web) instead of storing a filesystem
path, and only the original file name is kept for display.

- Read the selected file's bytes via the picker (withData) and pass a
  CustomCoinsFile snapshot to KomodoDefiSdk.setCustomCoins; drop the
  native path / initialDirectory handling.
- Rename the setting widget to SettingsCustomCoins, the stored fields to
  customKdfCoinsFileName / customCoinsConfigFileName, and the events to
  CustomCoinsChanged / CustomCoinsReset.
- Bump the komodo-defi-sdk submodule to the content-based rework.

An app restart is still required for changes to take effect.
@CharlVS
CharlVS force-pushed the feat/local-coins-config branch 2 times, most recently from 01cf3dd to 75952a6 Compare June 16, 2026 20:31
@DeckerSU
DeckerSU requested review from DeckerSU and cipig June 16, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant