Skip to content
Merged
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
175 changes: 70 additions & 105 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,126 +4,91 @@
</a>
</p>

# Komodo Defi Framework SDK for Flutter
# Komodo DeFi SDK for Flutter

This is a series of Flutter packages for integrating the [Komodo DeFi Framework](https://komodoplatform.com/en/komodo-defi-framework.html) into Flutter applications. This enhances devex by providing an intuitive abstraction layer and handling all binary/media file fetching, reducing what previously would have taken months to understand the API and build a Flutter dApp with KDF integration into a few days.
Komodo’s Flutter SDK lets you build cross-platform DeFi apps on top of the Komodo DeFi Framework (KDF) with a few lines of code. The SDK provides a high-level, batteries-included developer experience while still exposing the low-level framework and RPC methods when you need them.

See the Komodo DeFi Framework (API) source repository at [KomodoPlatform/komodo-defi-framework](https://github.com/KomodoPlatform/komodo-defi-framework) and view the demo site (source in [example](./example)) project at [https://komodo-playground.web.app](https://komodo-playground.web.app).
- Primary entry point: see `packages/komodo_defi_sdk`.
- Full KDF access: see `packages/komodo_defi_framework`.
- RPC models and namespaces: see `packages/komodo_defi_rpc_methods`.
- Core types: see `packages/komodo_defi_types`.
- Coins metadata utilities: see `packages/komodo_coins`.
- Market data: see `packages/komodo_cex_market_data`.
- UI widgets: see `packages/komodo_ui`.
- Build hooks and artifacts: see `packages/komodo_wallet_build_transformer`.

The recommended entry point ([komodo_defi_sdk](/packages/komodo_defi_sdk/README.md)) is a high-level opinionated library that provides a simple way to build cross-platform Komodo Defi Framework applications (primarily focused on wallets). This repository consists of multiple other child packages in the [packages](./packages) folder, which is orchestrated by the [komodo_defi_sdk](/packages/komodo_defi_sdk/README.md) package.
Supported platforms: Android, iOS, macOS, Windows, Linux, and Web (WASM).

Note: Most of this README focuses on the lower-level `komodo-defi-framework` package and still needs to be updated to focus on the primary package, `komodo_defi_sdk`.
See the Komodo DeFi Framework (API) source at `https://github.com/KomodoPlatform/komodo-defi-framework` and a hosted demo at `https://komodo-playground.web.app`.

This project supports building for macOS (more native platforms coming soon) and the web. KDF can either be run as a local Rust binary or you can connect to a remote instance. 1-Click setup for DigitalOcean and AWS deployment is in progress.
## Quick start (SDK)

From v2.5.0-beta, seed nodes configuration is required for KDF to function properly. The `seednodes` parameter must be specified unless `disable_p2p` is set to true. See the [configuration documentation](https://docs.komodefi.com/komodo-defi-framework/setup/configure-mm2-json/) for more details.
Add the SDK to your app and initialize it:

Use the [komodo_defi_framework](packages/komodo_defi_sdk) package for an unopinionated implementation that gives access to the underlying KDF methods.

The structure for this repository is inspired by the [Flutter BLoC](https://github.com/felangel/bloc) project.

This project generally follows the guidelines and high standards set by [Very Good Ventures](https://vgv.dev/).

TODO: Add a comprehensive README

TODO: Contribution guidelines and architecture overview
```dart
import 'package:komodo_defi_sdk/komodo_defi_sdk.dart';

void main() async {
final sdk = KomodoDefiSdk(
// Local by default; use RemoteConfig to connect to a remote node
host: LocalConfig(https: false, rpcPassword: 'your-secure-password'),
config: const KomodoDefiSdkConfig(
defaultAssets: {'KMD', 'BTC', 'ETH'},
),
);

await sdk.initialize();

// Register or sign in
await sdk.auth.register(walletName: 'my_wallet', password: 'strong-pass');

// Activate assets and get a balance
final btc = sdk.assets.findAssetsByConfigId('BTC').first;
await sdk.assets.activateAsset(btc).last;
final balance = await sdk.balances.getBalance(btc.id);
print('BTC balance: ${balance.total}');

// Direct RPC access when needed
final myKmd = await sdk.client.rpc.wallet.myBalance(coin: 'KMD');
print('KMD: ${myKmd.balance}');
}
```

## Example
## Architecture overview

Below is an extract from the [example project](https://github.com/KomodoPlatform/komodo-defi-sdk-flutter/blob/dev/example/lib/main.dart) showing the straightforward integration. Note that this is for the [komodo_defi_framework](packages/komodo_defi_framework), and the [komodo_defi_sdk](/packages/komodo_defi_sdk/README.md) will provide a higher-layer abstraction.
- `komodo_defi_sdk`: High-level orchestration (auth, assets, balances, tx history, withdrawals, signing, market data).
- `komodo_defi_framework`: Platform client for KDF with multiple backends (native/WASM/local process, remote). Provides the `ApiClient` used by the SDK.
- `komodo_defi_rpc_methods`: Typed RPC request/response models and method namespaces available via `client.rpc.*`.
- `komodo_defi_types`: Shared, lightweight domain types (e.g., `Asset`, `AssetId`, `BalanceInfo`, `WalletId`).
- `komodo_coins`: Fetch/transform Komodo coins metadata, filtering strategies, seed-node utilities.
- `komodo_cex_market_data`: Price providers (Komodo, Binance, CoinGecko) with repository selection and fallbacks.
- `komodo_ui`: Reusable, SDK-friendly Flutter UI components.
- `komodo_wallet_build_transformer`: Build-time artifact & assets fetcher (KDF binaries, coins, icons) integrated via Flutter’s asset transformers.

Create the configuration for the desired runtime:
## Remote vs Local

```dart
switch (_selectedHostType) {
case 'remote':
config = RemoteConfig(
userpass: _userpassController.text,
ipAddress: '$_selectedProtocol://${_ipController.text}',
port: int.parse(_portController.text),
);
break;
case 'aws':
config = AwsConfig(
userpass: _userpassController.text,
region: _awsRegionController.text,
accessKey: _awsAccessKeyController.text,
secretKey: _awsSecretKeyController.text,
instanceType: _awsInstanceTypeController.text,
);
break;
case 'local':
config = LocalConfig(userpass: _userpassController.text);
break;
default:
throw Exception(
'Invalid/unsupported host type: $_selectedHostType',
);
}
```
- Local (default): Uses native FFI on desktop/mobile and WASM in Web builds. The SDK handles artifact provisioning via the build transformer.
- Remote: Connect with `RemoteConfig(ipAddress: 'host', port: 7783, rpcPassword: '...', https: true/false)`. You manage the remote KDF lifecycle.

Start KDF:
Seed nodes: From KDF v2.5.0-beta, `seednodes` are required unless `disable_p2p` is `true`. The framework includes a validator and helpers. See `packages/komodo_defi_framework/README.md`.

```dart
void _startKdf(String passphrase) async {
_statusMessage = null;

if (_kdfFramework == null) {
_showMessage('Please configure the framework first.');
return;
}

try {
final result = await _kdfFramework!.startKdf(passphrase);
setState(() {
_statusMessage = 'KDF running: $result';
_isRunning = true;
});

if (!result.isRunning()) {
_showMessage('Failed to start KDF: $result');
// return;
}
} catch (e) {
_showMessage('Failed to start KDF: $e');
}

await _saveData();
}
```
## Packages in this monorepo

Execute RPC requests:
- `packages/komodo_defi_sdk` – High-level SDK (start here)
- `packages/komodo_defi_framework` – Low-level KDF client + lifecycle
- `packages/komodo_defi_rpc_methods` – Typed RPC surfaces
- `packages/komodo_defi_types` – Shared domain types
- `packages/komodo_coins` – Coins metadata + filters
- `packages/komodo_cex_market_data` – CEX price data
- `packages/komodo_ui` – UI widgets
- `packages/dragon_logs` – Cross-platform logging
- `packages/komodo_wallet_build_transformer` – Build artifacts/hooks
- `packages/dragon_charts_flutter` – Lightweight charts (moved here)

```dart
executeRequest: (rpcInput) async {
if (_kdfFramework == null || !_isRunning) {
_showMessage('KDF is not running.');
throw Exception('KDF is not running.');
}
return (await _kdfFramework!.executeRpc(rpcInput)).toString();
},
```
## Contributing

Stop KDF:
We follow practices inspired by Flutter BLoC and Very Good Ventures’ standards. Please open PRs and issues in this repository.

```dart
## License

void _stopKdf() async {
if (_kdfFramework == null) {
_showMessage('Please configure the framework first.');
return;
}

try {
final result = await _kdfFramework!.kdfStop();
setState(() {
_statusMessage = 'KDF stopped: $result';
_isRunning = false;
});

_checkStatus().ignore();
} catch (e) {
_showMessage('Failed to stop KDF: $e');
}
}
```
MIT. See individual package LICENSE files where present.
59 changes: 9 additions & 50 deletions packages/dragon_charts_flutter/README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
# 🚚 Repository Moved
# Dragon Charts Flutter

> **⚠️ This repository has been migrated to the Komodo DeFi SDK Flutter monorepo.**
>
> 📍 **New location:** [packages/dragon_charts_flutter](https://github.com/KomodoPlatform/komodo-defi-sdk-flutter/tree/main/packages/dragon_charts_flutter)
>
> 🔄 **Active development** continues in the monorepo. Please update your forks, bookmarks, and links.
>
> 💡 **For issues, PRs, and contributions**, please use the [main monorepo](https://github.com/KomodoPlatform/komodo-defi-sdk-flutter).

---

# Dragon Charts Flutter (Archived)

Dragon Charts Flutter is a lightweight, declarative, and highly customizable charting library for Flutter. It provides a simple yet powerful way to create various types of charts, with a focus on ease of use and flexibility.
Lightweight, declarative, and customizable charting library for Flutter with minimal dependencies. This package now lives in the Komodo DeFi SDK monorepo.

## Features

Expand All @@ -33,16 +21,6 @@ Run this command:
flutter pub add dragon_charts_flutter
```

### From GitHub

```yaml
dependencies:
dragon_charts_flutter:
git:
url: https://github.com/your_username/dragon_charts_flutter.git
ref: main # or a specific tag/branch/commit
```

Then, run `flutter pub get` to install the package.

## Usage
Expand Down Expand Up @@ -148,31 +126,12 @@ The main widget for displaying a line chart.
- `rangeExtent`: `ChartExtent` - The extent of the range (y-axis).
- `backgroundColor`: `Color` - The background color of the chart.

## Roadmap

### ✅ v0.1.0 (Done)

- ✅ Initial release with support for line charts.

### v0.2.0

- Add pie charts support.
- Improve documentation and add more examples.

### v0.3.0

- Add bar charts support.
- Implement interactive legends.

### v0.4.0

- Add scatter plots support.
- Enhance performance for large datasets.

### v1.0.0
## Roadmap (high level)

- Full documentation and stable release.
- Add support for exporting charts as images.
- Additional chart types (bar, pie, scatter)
- Legends and interactions
- Large dataset performance
- Export as image

## Why Dragon Charts Flutter?

Expand All @@ -185,8 +144,8 @@ Dragon Charts Flutter is an excellent solution for your charting needs because:

## Contributing

Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) first.
Contributions are welcome! Please open issues/PRs in the monorepo.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE.md) file for details.
MIT
13 changes: 2 additions & 11 deletions packages/dragon_logs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,8 @@ Your feedback and contributions to help achieve these features would be much app

## Installation

To use Dragon Logs, add it as a dependency in your `pubspec.yaml` file:

```yaml
dependencies:
dragon_logs: ^1.0.4
```

Then, run:

```
flutter pub get
```sh
flutter pub add dragon_logs
```

# Dragon Logs API Documentation and Usage
Expand Down
4 changes: 4 additions & 0 deletions packages/komodo_cex_market_data/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.0.1

- Initial version.

## 0.0.2

- docs: README with bootstrap, config, and SDK integration examples
Loading
Loading