Durt2 Library
Overview
Durt2 is a Dart library designed for Duniter v2s blockchain and cryptocurrency management. It integrates various services, including Squid GraphQL, Duniter networks use, and secure wallet functionalities, making it an all-encompassing solution for duniter v2s related operations in Dart and Flutter applications.
Features
- Polkadart integration for accessing Duniter blockchain functionalities.
- GraphQL integration for querying blockchain data.
- Wallet services including encryption and decryption of mnemonics.
- Secure storage and retrieval of wallet information.
- Support for multiple blockchain networks (
gdev
,gtest
,g1
). - Configuration via JSON files for network endpoints.
Getting Started
To use Durt2 in your project, you need to include it in your Dart or Flutter project's dependency list.
Installation
- Add Durt2 to your
pubspec.yaml
file:
dependencies:
durt2: <version>
- Run the following command to get the package:
flutter pub get
Initialization
To initialize the library, you need to specify the blockchain network and the endpoints for both Duniter and Squid services.
import 'package:durt2/durt2.dart';
void main() async {
await Durt.init(
network: Networks.gdev,
);
// ...
}
Configuration
Durt2 uses JSON configuration files in the config/
directory to manage network endpoints:
-
config/duniter_endpoints.json
: Contains WebSocket endpoints for different Duniter networks. -
config/squid_endpoints.json
: Contains GraphQL endpoints for Squid services.
You can access Duniter endpoints programmatically:
// Load Duniter endpoints
final duniterEndpoints = await DuniterEndpoints.load();
// Get endpoints for a specific network
final gdevEndpoints = duniterEndpoints.getEndpointsForNetwork(Networks.gdev);