Skip to content

Jainakin/wdk_core_flutter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wdk_core_flutter

wdk_core_flutter is the orchestrator for the Wallet Development Kit (WDK) in Dart. It lets you manage wallets, protocols, and middleware for multiple blockchains through a single object.

What This Does

  • Module manager – holds one WalletManager per blockchain and connects them to protocol modules
  • Wallet modules – works with any wallet implementation that extends WalletManager from wdk_wallet_flutter
  • Service modules – works with protocol implementations that extend SwapProtocol, BridgeProtocol, LendingProtocol, and FiatProtocol
  • Middleware – lets you attach per‑blockchain hooks that run after account derivation but before protocol access is attached

Features

  • Manage multiple chains (BTC, EVM, TON, TRON, Solana, …) from one WDK instance
  • Register swap/bridge/lending/fiat protocol modules per chain
  • Add middleware for logging, metrics, policy checks, or additional decorators
  • Strong, typed interfaces built on top of wdk_wallet_flutter

Installation

dart pub add wdk_core_flutter
dart pub add wdk_wallet_flutter

Quick Start

import 'package:wdk_core_flutter/wdk_core_flutter.dart';
import 'package:wdk_wallet_flutter/wdk_wallet_flutter.dart';

// Your concrete wallet manager implementations should extend WalletManager.
class MyEvmWalletManager extends WalletManager {
  MyEvmWalletManager(super.seed);

  @override
  Future<WalletAccount> getAccount([int index = 0]) async {
    // ...
    throw UnimplementedError();
  }

  @override
  Future<WalletAccount> getAccountByPath(String path) async {
    // ...
    throw UnimplementedError();
  }

  @override
  Future<FeeRates> getFeeRates() async {
    // ...
    throw UnimplementedError();
  }
}

Future<void> main() async {
  const mnemonic =
      'abandon abandon abandon abandon abandon abandon '
      'abandon abandon abandon abandon abandon about';

  final wdk = WDK(mnemonic)
    ..registerWallet(
      'ethereum',
      (seed, config) => MyEvmWalletManager(seed),
    );

  final account = await wdk.getAccount('ethereum', 0);
  final address = await account.getAddress();
  print('ETH address: $address');
}

Core API

WDK

  • WDK(dynamic seed) – create a manager from a BIP‑39 mnemonic or raw seed bytes
  • registerWallet(String blockchain, WalletManagerFactory factory, [dynamic config])
  • registerProtocol(String blockchain, String label, ProtocolFactory factory, [dynamic config])
  • registerMiddleware(String blockchain, MiddlewareFunction fn)
  • Future<WalletAccountWithProtocols> getAccount(String blockchain, [int index = 0])
  • Future<WalletAccountWithProtocols> getAccountByPath(String blockchain, String path)
  • Future<FeeRates> getFeeRates(String blockchain)
  • void dispose()
  • static String getRandomSeedPhrase({int wordCount = 12})
  • static bool isValidSeedPhrase(String seedPhrase)

WalletAccountWithProtocols

Wrapper around a WalletAccount that adds protocol accessors:

  • registerProtocol(String label, ProtocolFactory factory, [dynamic config])
  • SwapProtocol getSwapProtocol(String label)
  • BridgeProtocol getBridgeProtocol(String label)
  • LendingProtocol getLendingProtocol(String label)
  • FiatProtocol getFiatProtocol(String label)

Learn More

For an overview of the WDK project and the available modules, see the official WDK documentation.

License

This project is licensed under the Apache License 2.0 – see the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages